// Save the current DeviceLayoutContext to restore later.
// Set the current device layout context.
formatRendererContext.pushDeviceLayoutContext(context);
RuntimeDeviceLayout deviceLayout = formatRendererContext.getDeviceLayout();
LayoutAttributes attributes = factory.createLayoutAttributes();
attributes.setDeviceLayoutContext(context);
// Get the style sheet associated with the layout and push it into the
// styling engine.
RuntimeDeviceLayout runtimeDeviceLayout = context.getDeviceLayout();
CompiledStyleSheet layoutStyleSheet =
runtimeDeviceLayout.getCompiledStyleSheet();
// Set up the styling engine with the applicable style sheets.
FormatStylingEngine formatStylingEngine =
formatRendererContext.getFormatStylingEngine();
// First add the layout style sheet into the styling engine.