Class: HexaPDF::Font::Type1::FontMetrics

Inherits:
Object
  • Object
show all
Defined in:
lib/hexapdf/font/type1/font_metrics.rb

Overview

Represents the information stored in an AFM font metrics file for a Type1 font that is needed for working with that font in context of the PDF format.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFontMetrics

:nodoc:



108
109
110
111
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 108

def initialize #:nodoc:
  @character_metrics = {}
  @kerning_pairs = Hash.new {|h, k| h[k] = {}}
end

Instance Attribute Details

#ascenderObject

Ascender of the font.



75
76
77
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 75

def ascender
  @ascender
end

#bounding_boxObject

The font bounding box as array of four numbers, specifying the x- and y-coordinates of the lower-left corner and the x- and y-coordinates of the upper-right corner.



64
65
66
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 64

def bounding_box
  @bounding_box
end

#cap_heightObject

The y-value of the top of the capital H (or 0 or nil if the font doesn’t contain a capital H).



68
69
70
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 68

def cap_height
  @cap_height
end

#character_metricsObject

Mapping of character codes and names to CharacterMetrics objects.



102
103
104
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 102

def character_metrics
  @character_metrics
end

#character_setObject

A string describing the character set of the font.



54
55
56
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 54

def character_set
  @character_set
end

#descenderObject

Descender of the font.



78
79
80
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 78

def descender
  @descender
end

#dominant_horizontal_stem_widthObject

Dominant width of horizontal stems.



81
82
83
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 81

def dominant_horizontal_stem_width
  @dominant_horizontal_stem_width
end

#dominant_vertical_stem_widthObject

Dominant width of vertical stems.



84
85
86
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 84

def dominant_vertical_stem_width
  @dominant_vertical_stem_width
end

#encoding_schemeObject

A string indicating the default encoding used for the font.



57
58
59
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 57

def encoding_scheme
  @encoding_scheme
end

#family_nameObject

Name of the typeface family to which the font belongs.



51
52
53
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 51

def family_name
  @family_name
end

#font_nameObject

PostScript name of the font.



45
46
47
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 45

def font_name
  @font_name
end

#full_nameObject

Full text name of the font.



48
49
50
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 48

def full_name
  @full_name
end

#is_fixed_pitchObject

Boolean specifying if the font is a fixed pitch (monospaced) font.



98
99
100
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 98

def is_fixed_pitch
  @is_fixed_pitch
end

#italic_angleObject

Angle (in degrees counter-clockwise from the vertical) of the dominant vertical strokes of the font.



95
96
97
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 95

def italic_angle
  @italic_angle
end

#kerning_pairsObject

Nested mapping of kerning pairs, ie. each key is a character name and each value is a mapping from the second character name to the kerning amount.



106
107
108
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 106

def kerning_pairs
  @kerning_pairs
end

#underline_positionObject

Distance from the baseline for centering underlining strokes.



88
89
90
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 88

def underline_position
  @underline_position
end

#underline_thicknessObject

Stroke width for underlining.



91
92
93
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 91

def underline_thickness
  @underline_thickness
end

#weightObject

Weight of the font.



60
61
62
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 60

def weight
  @weight
end

#x_heightObject

The y-value of the top of the lowercase x (or 0 or nil if the font doesnt’ contain a lowercase x)



72
73
74
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 72

def x_height
  @x_height
end