class HexaPDF::Font::TrueTypeWrapper::Glyph

Represents a single glyph of the wrapped font.

Attributes

id[R]

The glyph ID.

str[R]

The string representation of the glyph.

Public Class Methods

new(font, id, str) click to toggle source

Creates a new Glyph object.

# File lib/hexapdf/font/true_type_wrapper.rb, line 68
def initialize(font, id, str)
  @font = font
  @id = id
  @str = str
end

Public Instance Methods

apply_word_spacing?() click to toggle source

Returns false since the word spacing parameter is never applied for multibyte font encodings where each glyph is encoded using two bytes.

# File lib/hexapdf/font/true_type_wrapper.rb, line 101
def apply_word_spacing?
  false
end
width() click to toggle source

Returns the width of the glyph.

# File lib/hexapdf/font/true_type_wrapper.rb, line 95
def width
  @width ||= @font[:hmtx][id].advance_width * 1000.0 / @font[:head].units_per_em
end
x_max() click to toggle source

Returns the glyph's maximum x coordinate.

# File lib/hexapdf/font/true_type_wrapper.rb, line 80
def x_max
  @x_max ||= @font[:glyf][id].x_max * 1000.0 / @font[:head].units_per_em
end
x_min() click to toggle source

Returns the glyph's minimum x coordinate.

# File lib/hexapdf/font/true_type_wrapper.rb, line 75
def x_min
  @x_min ||= @font[:glyf][id].x_min * 1000.0 / @font[:head].units_per_em
end
y_max() click to toggle source

Returns the glyph's maximum y coordinate.

# File lib/hexapdf/font/true_type_wrapper.rb, line 90
def y_max
  @y_max ||= @font[:glyf][id].y_max * 1000.0 / @font[:head].units_per_em
end
y_min() click to toggle source

Returns the glyph's minimum y coordinate.

# File lib/hexapdf/font/true_type_wrapper.rb, line 85
def y_min
  @y_min ||= @font[:glyf][id].y_min * 1000.0 / @font[:head].units_per_em
end