class HexaPDF::Content::GraphicsState

Parent

A GraphicsState object holds all the graphic control parameters needed for correct operation when parsing or creating a content stream with a Processor object.

While a content stream is parsed/created, operations may use the current parameters or modify them.

The device-dependent graphics state parameters have not been implemented!

See: PDF2.0 s8.4.1

Attributes

alpha_source[RW]

A boolean specifying whether the current soft mask and alpha parameters should be interpreted as shape values or opacity values.

blend_mode[RW]

The current blend mode for the transparent imaging model.

character_spacing[R]

The character spacing in unscaled text units.

It specifies the additional spacing used for the horizontal or vertical displacement of glyphs.

ctm[RW]

The current transformation matrix.

fill_alpha[RW]

The alpha constant for non-stroking operations in the transparent imaging model.

fill_color[RW]

The current color used for all other (i.e. non-stroking) painting operations.

font[R]

The font for the text.

font_size[R]

The font size.

horizontal_scaling[R]

The horizontal text scaling.

The value specifies the percentage of the normal width that should be used.

leading[RW]

The leading in unscaled text units.

It specifies the distance between the baselines of adjacent lines of text.

line_cap_style[RW]

The current line cap style (for the available values see LineCapStyle).

line_dash_pattern[RW]

The line dash pattern (see LineDashPattern).

line_join_style[RW]

The current line join style (for the available values see LineJoinStyle).

line_width[RW]

The current line width in user space units.

miter_limit[RW]

The maximum line length of mitered line joins for stroked paths.

rendering_intent[RW]

The rendering intent (only used for CIE-based colors; for the available values see RenderingIntent).

scaled_character_spacing[R]

The scaled character spacing used in glyph displacement calculations.

This returns the character spacing multiplied by scaled_horizontal_scaling.

See PDF2.0 s9.4.4

scaled_font_size[R]

The scaled font size used in glyph displacement calculations.

This returns the font size multiplied by the scaling factor from glyph space to text space (0.001 for all fonts except Type3 fonts or the scaling specified in /FontMatrix for Type3 fonts) and multiplied by scaled_horizontal_scaling.

See PDF2.0 s9.4.4, HexaPDF::Type::FontType3

scaled_horizontal_scaling[R]

The scaled horizontal scaling used in glyph displacement calculations.

Since the horizontal scaling attribute is stored in percent of 100, this method returns the correct value for calculations.

See PDF2.0 s9.4.4

scaled_word_spacing[R]

The scaled word spacing used in glyph displacement calculations.

This returns the word spacing multiplied by scaled_horizontal_scaling.

See PDF2.0 s9.4.4

soft_mask[RW]

The soft mask specifying the mask shape or mask opacity value to be used in the transparent imaging model.

stroke_adjustment[RW]

The stroke adjustment for very small line width.

stroke_alpha[RW]

The alpha constant for stroking operations in the transparent imaging model.

stroke_color[RW]

The current color used for stroking operations during painting.

stroke_color_space[RW]

The current color space for stroking operations during painting.

text_knockout[RW]

The text knockout, a boolean value.

It specifies whether each glyph should be treated as separate elementary object for the purpose of color compositing in the transparent imaging model (knockout = false) or if all glyphs together are treated as one elementary object (knockout = true).

text_rendering_mode[RW]

The text rendering mode.

It determines if and how the glyphs of a text should be shown (for all available values see TextRenderingMode).

text_rise[RW]

The text rise distance in unscaled text units.

It specifies the distance that the baseline should be moved up or down from its default location.

tlm[RW]

The text line matrix which captures the state of the text matrix at the beginning of a line.

As with the text matrix the text line matrix is non-nil only when inside a text object.

tm[RW]

The text matrix.

This attribute is non-nil only when inside a text object.

word_spacing[R]

The word spacing in unscaled text units.

It works like the character spacing but is only applied to the ASCII space character.

Public Class Methods

new()

Initializes the graphics state parameters to their default values.

Public Instance Methods

restore()

Restores the graphics state from the internal stack.

Raises an error if the stack is empty.

save()

Saves the current graphics state on the internal stack.

saved_states?()

Returns true if the internal stack of saved graphic states contains entries.