class HexaPDF::Content::Processor::GlyphBox
Represents an (immutable) glyph box with positioning information.
Since the glyph may have been transformed by an affine matrix, the bounding may not be a rectangle in all cases but it is always a parallelogram.
Attributes
The code point representing the glyph.
The Unicode value of the code point.
Public Class Methods
Creates a new glyph box for the given code point/Unicode value pair with the lower left coordinate [llx, lly], the lower right coordinate [lrx, lry], and the upper left coordinate [ulx, uly].
# File lib/hexapdf/content/processor.rb, line 94 def initialize(code_point, string, llx, lly, lrx, lry, ulx, uly) @code_point = code_point @string = string.freeze @llx = llx @lly = lly @lrx = lrx @lry = lry @ulx = ulx @uly = uly freeze end
Public Instance Methods
Returns the lower left coordinate
# File lib/hexapdf/content/processor.rb, line 110 def lower_left [@llx, @lly] end
Returns the lower right coordinate
# File lib/hexapdf/content/processor.rb, line 118 def lower_right [@lrx, @lry] end
Returns the four corners of the box as an array of coordinates, starting with the lower left corner and going counterclockwise.
# File lib/hexapdf/content/processor.rb, line 144 def points [@llx, @lly, @lrx, @lry, @ulx + (@lrx - @llx), @uly + (@lry - @lly), @ulx, @uly] end
Returns the upper left coordinate
# File lib/hexapdf/content/processor.rb, line 126 def upper_left [@ulx, @uly] end
Returns the upper right coordinate which is computed by using the other three points of the parallelogram.
# File lib/hexapdf/content/processor.rb, line 135 def upper_right [@ulx + (@lrx - @llx), @uly + (@lry - @lly)] end