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.
101 102 103 104 105 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 101 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
98 99 100 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 98 def bbox_bitmap @bbox_bitmap end |
#bbox_data ⇒ Object
Returns the value of attribute bbox_data
98 99 100 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 98 def bbox_data @bbox_data end |
#composite ⇒ Object
Returns the value of attribute composite
98 99 100 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 98 def composite @composite end |
#flags ⇒ Object
Returns the value of attribute flags
98 99 100 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 98 def flags @flags end |
#glyph ⇒ Object
Returns the value of attribute glyph
98 99 100 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 98 def glyph @glyph end |
#instructions ⇒ Object
Returns the value of attribute instructions
98 99 100 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 98 def instructions @instructions end |
#n_contour ⇒ Object
Returns the value of attribute n_contour
98 99 100 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 98 def n_contour @n_contour end |
#n_points ⇒ Object
Returns the value of attribute n_points
98 99 100 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 98 def n_points @n_points end |
#overlap_bitmap ⇒ Object
Returns the value of attribute overlap_bitmap
98 99 100 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 98 def overlap_bitmap @overlap_bitmap end |
Instance Method Details
#bbox_wire ⇒ Object
bboxStream on the wire = bboxBitmap || bboxStream (spec section 5.1).
112 113 114 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 112 def bbox_wire bbox_bitmap.pack("C*") + bbox_data end |
#has_overlap? ⇒ Boolean
107 108 109 |
# File 'lib/fontisan/woff2/glyf_loca_transform.rb', line 107 def has_overlap? overlap_bitmap.any?(&:nonzero?) end |