Class: TTFunk::Table::Glyf::Simple
- Inherits:
-
Object
- Object
- TTFunk::Table::Glyf::Simple
- Defined in:
- lib/ttfunk/table/glyf/simple.rb
Overview
Simple TrueType glyph
Instance Attribute Summary collapse
-
#end_points_of_contours ⇒ Array<Integer>
readonly
Point indices for the last point of each contour.
-
#id ⇒ Integer
readonly
Glyph ID.
-
#instruction_length ⇒ Integer
readonly
Total number of bytes for instructions.
-
#instructions ⇒ Array<Integer>
readonly
Instruction byte code.
-
#number_of_contours ⇒ Integer
readonly
Number of contours in this glyph.
-
#raw ⇒ String
readonly
Binary serialization of this glyph.
-
#x_max ⇒ Integer
readonly
Maximum x for coordinate.
-
#x_min ⇒ Integer
readonly
Minimum x for coordinate.
-
#y_max ⇒ Integer
readonly
Maximum y for coordinate.
-
#y_min ⇒ Integer
readonly
Minimum y for coordinate.
Instance Method Summary collapse
-
#compound? ⇒ false
Is this glyph compound?.
-
#end_point_of_last_contour ⇒ Integer
End point index of last contour.
-
#initialize(id, raw) ⇒ Simple
constructor
A new instance of Simple.
-
#recode(_mapping) ⇒ String
Recode glyph.
Constructor Details
#initialize(id, raw) ⇒ Simple
Returns a new instance of Simple.
Source Code
52 | def initialize(id, raw) |
53 | @id = id |
54 | @raw = raw |
55 | io = StringIO.new(raw) |
56 | |
57 | @number_of_contours, @x_min, @y_min, @x_max, @y_max = |
58 | io.read(10).unpack('n*').map { |i| |
59 | BinUtils.twos_comp_to_int(i, bit_width: 16) |
60 | }
|
61 | |
62 | @end_points_of_contours = io.read(number_of_contours * 2).unpack('n*') |
63 | @instruction_length = io.read(2).unpack1('n') |
64 | @instructions = io.read(instruction_length).unpack('C*') |
65 | end
|
Instance Attribute Details
#end_points_of_contours ⇒ Array<Integer> (readonly)
Point indices for the last point of each contour.
Source Code
40 | def end_points_of_contours |
41 | @end_points_of_contours
|
42 | end
|
#id ⇒ Integer (readonly)
Glyph ID.
Source Code
12 | def id |
13 | @id
|
14 | end
|
#instruction_length ⇒ Integer (readonly)
Total number of bytes for instructions.
Source Code
44 | def instruction_length |
45 | @instruction_length
|
46 | end
|
#instructions ⇒ Array<Integer> (readonly)
Instruction byte code.
Source Code
48 | def instructions |
49 | @instructions
|
50 | end
|
#number_of_contours ⇒ Integer (readonly)
Number of contours in this glyph.
Source Code
20 | def number_of_contours |
21 | @number_of_contours
|
22 | end
|
#raw ⇒ String (readonly)
Binary serialization of this glyph.
Source Code
16 | def raw |
17 | @raw
|
18 | end
|
#x_max ⇒ Integer (readonly)
Maximum x for coordinate.
Source Code
32 | def x_max |
33 | @x_max
|
34 | end
|
#x_min ⇒ Integer (readonly)
Minimum x for coordinate.
Source Code
24 | def x_min |
25 | @x_min
|
26 | end
|
#y_max ⇒ Integer (readonly)
Maximum y for coordinate.
Source Code
36 | def y_max |
37 | @y_max
|
38 | end
|
#y_min ⇒ Integer (readonly)
Minimum y for coordinate.
Source Code
28 | def y_min |
29 | @y_min
|
30 | end
|
Instance Method Details
#compound? ⇒ false
Is this glyph compound?
Source Code
69 | def compound? |
70 | false
|
71 | end
|
#end_point_of_last_contour ⇒ Integer
End point index of last contour.
Source Code
83 | def end_point_of_last_contour |
84 | end_points_of_contours.last + 1 |
85 | end
|
#recode(_mapping) ⇒ String
Recode glyph.
Source Code
77 | def recode(_mapping) |
78 | raw
|
79 | end
|