Class: HexaPDF::Font::Type1::FontMetrics
- Inherits:
-
Object
- Object
- HexaPDF::Font::Type1::FontMetrics
- 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
-
#ascender ⇒ Object
Ascender of the font.
-
#bounding_box ⇒ Object
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.
-
#cap_height ⇒ Object
The y-value of the top of the capital H (or 0 or nil if the font doesn’t contain a capital H).
-
#character_metrics ⇒ Object
Mapping of character codes and names to CharacterMetrics objects.
-
#character_set ⇒ Object
A string describing the character set of the font.
-
#descender ⇒ Object
Descender of the font.
-
#dominant_horizontal_stem_width ⇒ Object
Dominant width of horizontal stems.
-
#dominant_vertical_stem_width ⇒ Object
Dominant width of vertical stems.
-
#encoding_scheme ⇒ Object
A string indicating the default encoding used for the font.
-
#family_name ⇒ Object
Name of the typeface family to which the font belongs.
-
#font_name ⇒ Object
PostScript name of the font.
-
#full_name ⇒ Object
Full text name of the font.
-
#is_fixed_pitch ⇒ Object
Boolean specifying if the font is a fixed pitch (monospaced) font.
-
#italic_angle ⇒ Object
Angle (in degrees counter-clockwise from the vertical) of the dominant vertical strokes of the font.
-
#kerning_pairs ⇒ Object
Nested mapping of kerning pairs, ie.
-
#underline_position ⇒ Object
Distance from the baseline for centering underlining strokes.
-
#underline_thickness ⇒ Object
Stroke width for underlining.
-
#weight ⇒ Object
Weight of the font.
-
#x_height ⇒ Object
The y-value of the top of the lowercase x (or 0 or nil if the font doesnt’ contain a lowercase x).
Instance Method Summary collapse
-
#initialize ⇒ FontMetrics
constructor
:nodoc:.
Constructor Details
#initialize ⇒ FontMetrics
: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
#ascender ⇒ Object
Ascender of the font.
75 76 77 |
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 75 def ascender @ascender end |
#bounding_box ⇒ Object
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_height ⇒ Object
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_metrics ⇒ Object
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_set ⇒ Object
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 |
#descender ⇒ Object
Descender of the font.
78 79 80 |
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 78 def descender @descender end |
#dominant_horizontal_stem_width ⇒ Object
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_width ⇒ Object
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_scheme ⇒ Object
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_name ⇒ Object
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_name ⇒ Object
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_name ⇒ Object
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_pitch ⇒ Object
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_angle ⇒ Object
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_pairs ⇒ Object
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_position ⇒ Object
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_thickness ⇒ Object
Stroke width for underlining.
91 92 93 |
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 91 def underline_thickness @underline_thickness end |
#weight ⇒ Object
Weight of the font.
60 61 62 |
# File 'lib/hexapdf/font/type1/font_metrics.rb', line 60 def weight @weight end |
#x_height ⇒ Object
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 |