Class: Fontisan::Woff2::GlyfLocaTransform::Streams
- Inherits:
-
Struct
- Object
- Struct
- Fontisan::Woff2::GlyfLocaTransform::Streams
- Defined in:
- lib/fontisan/woff2/glyf_loca_transform.rb
Overview
Mutable container for the 7 streams + 2 bitmaps. Avoids passing 9
parameters through every helper. Defined at top-level so the Struct
class isn't hidden behind private (Ruby treats constants as public
regardless, but RuboCop flags the modifier as useless).
Instance Attribute Summary collapse
-
#bbox_bitmap ⇒ Object
Returns the value of attribute bbox_bitmap.
-
#bbox_data ⇒ Object
Returns the value of attribute bbox_data.
-
#composite ⇒ Object
Returns the value of attribute composite.
-
#flags ⇒ Object
Returns the value of attribute flags.
-
#glyph ⇒ Object
Returns the value of attribute glyph.
-
#instructions ⇒ Object
Returns the value of attribute instructions.
-
#n_contour ⇒ Object
Returns the value of attribute n_contour.
-
#n_points ⇒ Object
Returns the value of attribute n_points.
-
#overlap_bitmap ⇒ Object
Returns the value of attribute overlap_bitmap.
Instance Method Summary collapse
-
#bbox_wire ⇒ Object
bboxStream on the wire = bboxBitmap || bboxStream (spec section 5.1).
- #has_overlap? ⇒ Boolean
-
#initialize(num_glyphs) ⇒ Streams
constructor
A new instance of Streams.
Constructor Details
#initialize(num_glyphs) ⇒ Streams
Returns a new instance of Streams.
97 98 99 100 101 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 97 def initialize(num_glyphs) super(*Array.new(7) { String.new(encoding: Encoding::BINARY) }, Array.new(((num_glyphs + 31) >> 5) << 2, 0), Array.new((num_glyphs + 7) >> 3, 0)) end |
Instance Attribute Details
#bbox_bitmap ⇒ Object
Returns the value of attribute bbox_bitmap
94 95 96 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 94 def bbox_bitmap @bbox_bitmap end |
#bbox_data ⇒ Object
Returns the value of attribute bbox_data
94 95 96 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 94 def bbox_data @bbox_data end |
#composite ⇒ Object
Returns the value of attribute composite
94 95 96 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 94 def composite @composite end |
#flags ⇒ Object
Returns the value of attribute flags
94 95 96 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 94 def flags @flags end |
#glyph ⇒ Object
Returns the value of attribute glyph
94 95 96 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 94 def glyph @glyph end |
#instructions ⇒ Object
Returns the value of attribute instructions
94 95 96 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 94 def instructions @instructions end |
#n_contour ⇒ Object
Returns the value of attribute n_contour
94 95 96 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 94 def n_contour @n_contour end |
#n_points ⇒ Object
Returns the value of attribute n_points
94 95 96 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 94 def n_points @n_points end |
#overlap_bitmap ⇒ Object
Returns the value of attribute overlap_bitmap
94 95 96 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 94 def overlap_bitmap @overlap_bitmap end |
Instance Method Details
#bbox_wire ⇒ Object
bboxStream on the wire = bboxBitmap || bboxStream (spec section 5.1).
108 109 110 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 108 def bbox_wire bbox_bitmap.pack("C*") + bbox_data end |
#has_overlap? ⇒ Boolean
103 104 105 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 103 def has_overlap? overlap_bitmap.any?(&:nonzero?) end |