Class: TTFunk::Table::Post
- Inherits:
-
TTFunk::Table
- Object
- TTFunk::Table
- TTFunk::Table::Post
- Defined in:
- lib/ttfunk/table/post.rb,
lib/ttfunk/table/post/format10.rb,
lib/ttfunk/table/post/format20.rb,
lib/ttfunk/table/post/format30.rb,
lib/ttfunk/table/post/format40.rb
Defined Under Namespace
Modules: Format10, Format20, Format30, Format40
Instance Attribute Summary collapse
-
#fixed_pitch ⇒ Object
readonly
Returns the value of attribute fixed_pitch.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#italic_angle ⇒ Object
readonly
Returns the value of attribute italic_angle.
-
#max_mem_type1 ⇒ Object
readonly
Returns the value of attribute max_mem_type1.
-
#max_mem_type42 ⇒ Object
readonly
Returns the value of attribute max_mem_type42.
-
#min_mem_type1 ⇒ Object
readonly
Returns the value of attribute min_mem_type1.
-
#min_mem_type42 ⇒ Object
readonly
Returns the value of attribute min_mem_type42.
-
#subtable ⇒ Object
readonly
Returns the value of attribute subtable.
-
#underline_position ⇒ Object
readonly
Returns the value of attribute underline_position.
-
#underline_thickness ⇒ Object
readonly
Returns the value of attribute underline_thickness.
Attributes inherited from TTFunk::Table
Class Method Summary collapse
Instance 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
#fixed_pitch ⇒ Object (readonly)
Returns the value of attribute fixed_pitch.
10 11 12 |
# File 'lib/ttfunk/table/post.rb', line 10 def fixed_pitch @fixed_pitch end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
6 7 8 |
# File 'lib/ttfunk/table/post.rb', line 6 def format @format end |
#italic_angle ⇒ Object (readonly)
Returns the value of attribute italic_angle.
7 8 9 |
# File 'lib/ttfunk/table/post.rb', line 7 def italic_angle @italic_angle end |
#max_mem_type1 ⇒ Object (readonly)
Returns the value of attribute max_mem_type1.
14 15 16 |
# File 'lib/ttfunk/table/post.rb', line 14 def max_mem_type1 @max_mem_type1 end |
#max_mem_type42 ⇒ Object (readonly)
Returns the value of attribute max_mem_type42.
12 13 14 |
# File 'lib/ttfunk/table/post.rb', line 12 def max_mem_type42 @max_mem_type42 end |
#min_mem_type1 ⇒ Object (readonly)
Returns the value of attribute min_mem_type1.
13 14 15 |
# File 'lib/ttfunk/table/post.rb', line 13 def min_mem_type1 @min_mem_type1 end |
#min_mem_type42 ⇒ Object (readonly)
Returns the value of attribute min_mem_type42.
11 12 13 |
# File 'lib/ttfunk/table/post.rb', line 11 def min_mem_type42 @min_mem_type42 end |
#subtable ⇒ Object (readonly)
Returns the value of attribute subtable.
16 17 18 |
# File 'lib/ttfunk/table/post.rb', line 16 def subtable @subtable end |
#underline_position ⇒ Object (readonly)
Returns the value of attribute underline_position.
8 9 10 |
# File 'lib/ttfunk/table/post.rb', line 8 def underline_position @underline_position end |
#underline_thickness ⇒ Object (readonly)
Returns the value of attribute underline_thickness.
9 10 11 |
# File 'lib/ttfunk/table/post.rb', line 9 def underline_thickness @underline_thickness end |
Class Method Details
.encode(post, mapping) ⇒ Object
18 19 20 21 |
# File 'lib/ttfunk/table/post.rb', line 18 def self.encode(post, mapping) return nil unless post.exists? post.recode(mapping) end |
Instance Method Details
#fixed_pitch? ⇒ Boolean
23 24 25 |
# File 'lib/ttfunk/table/post.rb', line 23 def fixed_pitch? @fixed_pitch != 0 end |
#glyph_for(code) ⇒ Object
27 28 29 |
# File 'lib/ttfunk/table/post.rb', line 27 def glyph_for(code) ".notdef" end |
#recode(mapping) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ttfunk/table/post.rb', line 31 def recode(mapping) return raw if format == 0x00030000 table = raw[0,32] table[0,4] = [0x00020000].pack("N") index = [] strings = [] mapping.keys.sort.each do |new_id| post_glyph = glyph_for(mapping[new_id]) position = Format10::POSTSCRIPT_GLYPHS.index(post_glyph) if position index << position else index << 257 + strings.length strings << post_glyph end end table << [mapping.length, *index].pack("n*") strings.each do |string| table << [string.length, string].pack("CA*") end return table end |