Class: TTFunk::Table::Hhea

Inherits:
TTFunk::Table show all
Defined in:
lib/ttfunk/table/hhea.rb

Overview

Horizontal Header (hhea) table.

Instance Attribute Summary collapse

Attributes inherited from TTFunk::Table

#file, #length, #offset

Class Method Summary collapse

Methods inherited from TTFunk::Table

#exists?, #initialize, #raw, #tag

Constructor Details

This class inherits a constructor from TTFunk::Table

Instance Attribute Details

#advance_width_maxInteger (readonly)

Maximum advance width value in hmtx table.

Returns:

  • (Integer)
Source Code
lib/ttfunk/table/hhea.rb, line 27
27
def advance_width_max
28
  @advance_width_max
29
end

#ascentInteger (readonly)

Typographic ascent.

Returns:

  • (Integer)
Source Code
lib/ttfunk/table/hhea.rb, line 15
15
def ascent
16
  @ascent
17
end

#caret_offsetInteger (readonly)

Caret offset.

Returns:

  • (Integer)
Source Code
lib/ttfunk/table/hhea.rb, line 66
66
def caret_offset
67
  @caret_offset
68
end

#caret_slope_riseInteger (readonly)

Caret slope rise.

Returns:

  • (Integer)
Source Code
lib/ttfunk/table/hhea.rb, line 44
44
def caret_slope_rise
45
  @caret_slope_rise
46
end

#caret_slope_runInteger (readonly)

Caret slope run.

Returns:

  • (Integer)
Source Code
lib/ttfunk/table/hhea.rb, line 55
55
def caret_slope_run
56
  @caret_slope_run
57
end

#carot_slope_riseInteger (readonly)

Deprecated.

Use #caret_slope_rise instead.

Returns:

  • (Integer)
Source Code
lib/ttfunk/table/hhea.rb, line 49
49
def carot_slope_rise
50
  @caret_slope_rise
51
end

#carot_slope_runInteger (readonly)

Deprecated.

Use #caret_slope_run instead.

Returns:

  • (Integer)
Source Code
lib/ttfunk/table/hhea.rb, line 60
60
def carot_slope_run
61
  @caret_slope_run
62
end

#descentInteger (readonly)

Typographic descent.

Returns:

  • (Integer)
Source Code
lib/ttfunk/table/hhea.rb, line 19
19
def descent
20
  @descent
21
end

#line_gapInteger (readonly)

Typographic line gap.

Returns:

  • (Integer)
Source Code
lib/ttfunk/table/hhea.rb, line 23
23
def line_gap
24
  @line_gap
25
end

#metric_data_formatInteger (readonly)

Metric data format. 0 for current format.

Returns:

  • (Integer)
Source Code
lib/ttfunk/table/hhea.rb, line 70
70
def metric_data_format
71
  @metric_data_format
72
end

#min_left_side_bearingInteger (readonly)

Minimum left sidebearing value in hmtx table for glyphs with contours (empty glyphs should be ignored).

Returns:

  • (Integer)
Source Code
lib/ttfunk/table/hhea.rb, line 32
32
def min_left_side_bearing
33
  @min_left_side_bearing
34
end

#min_right_side_bearingInteger (readonly)

Minimum right sidebearing value.

Returns:

  • (Integer)
Source Code
lib/ttfunk/table/hhea.rb, line 36
36
def min_right_side_bearing
37
  @min_right_side_bearing
38
end

#number_of_metricsInteger (readonly)

Number of hMetric entries in hmtx table.

Returns:

  • (Integer)
Source Code
lib/ttfunk/table/hhea.rb, line 74
74
def number_of_metrics
75
  @number_of_metrics
76
end

#versionInteger (readonly)

Table version

Returns:

  • (Integer)
Source Code
lib/ttfunk/table/hhea.rb, line 11
11
def version
12
  @version
13
end

#x_max_extentInteger (readonly)

Maximum extent.

Returns:

  • (Integer)
Source Code
lib/ttfunk/table/hhea.rb, line 40
40
def x_max_extent
41
  @x_max_extent
42
end

Class Method Details

.encode(hhea, hmtx, original, mapping) ⇒ String

Encode table.

Parameters:

Returns:

  • (String)
Source Code
lib/ttfunk/table/hhea.rb, line 85
85
def encode(hhea, hmtx, original, mapping)
86
  ''.b.tap do |table|
87
    table << [hhea.version].pack('N')
88
    table << [
89
      hhea.ascent, hhea.descent, hhea.line_gap,
90
      *min_max_values_for(original, mapping),
91
      hhea.caret_slope_rise, hhea.caret_slope_run, hhea.caret_offset,
92
      0, 0, 0, 0, hhea.metric_data_format, hmtx[:number_of_metrics],
93
    ].pack('n*')
94
  end
95
end