class HexaPDF::Font::Type1Wrapper::Glyph

Represents a single glyph of the wrapped font.

Attributes

id[R]

The name of the glyph.

name[R]

The name of the glyph.

str[R]

The string representation of the glyph.

Public Class Methods

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

Creates a new Glyph object.

# File lib/hexapdf/font/type1_wrapper.rb, line 58
def initialize(font, name, str)
  @font = font
  @name = name
  @str = str
end

Public Instance Methods

apply_word_spacing?() click to toggle source

Returns true if the word spacing parameter needs to be applied for the glyph.

# File lib/hexapdf/font/type1_wrapper.rb, line 90
def apply_word_spacing?
  @name == :space
end
width() click to toggle source

Returns the width of the glyph.

# File lib/hexapdf/font/type1_wrapper.rb, line 85
def width
  @width ||= @font.width(name)
end
x_max() click to toggle source

Returns the glyph's maximum x coordinate.

# File lib/hexapdf/font/type1_wrapper.rb, line 70
def x_max
  @font.metrics.character_metrics[name].bbox[2]
end
x_min() click to toggle source

Returns the glyph's minimum x coordinate.

# File lib/hexapdf/font/type1_wrapper.rb, line 65
def x_min
  @font.metrics.character_metrics[name].bbox[0]
end
y_max() click to toggle source

Returns the glyph's maximum y coordinate.

# File lib/hexapdf/font/type1_wrapper.rb, line 80
def y_max
  @font.metrics.character_metrics[name].bbox[3]
end
y_min() click to toggle source

Returns the glyph's minimum y coordinate.

# File lib/hexapdf/font/type1_wrapper.rb, line 75
def y_min
  @font.metrics.character_metrics[name].bbox[1]
end