Class: TTFunk::Table::Sbix
- Inherits:
-
TTFunk::Table
- Object
- TTFunk::Table
- TTFunk::Table::Sbix
- Defined in:
- lib/ttfunk/table/sbix.rb
Overview
Standard Bitmap Graphics (‘sbix`) table.
Defined Under Namespace
Classes: BitmapData
Instance Attribute Summary collapse
-
#flags ⇒ Integer
readonly
Flags.
-
#num_strikes ⇒ Integer
readonly
Number of bitmap strikes.
-
#strikes ⇒ Array<Hash>
readonly
Strikes.
-
#version ⇒ Integer
readonly
Table version.
Attributes inherited from TTFunk::Table
Instance Method Summary collapse
-
#all_bitmap_data_for(glyph_id) ⇒ Array<BitmapData>
Get all bitmaps for glyph.
-
#bitmap_data_for(glyph_id, strike_index) ⇒ BitmapData
Get bitmap for glyph strike.
Methods inherited from TTFunk::Table
#exists?, #initialize, #raw, #tag
Constructor Details
This class inherits a constructor from TTFunk::Table
Instance Attribute Details
#flags ⇒ Integer (readonly)
Flags.
15 16 17 |
# File 'lib/ttfunk/table/sbix.rb', line 15 def flags @flags end |
#num_strikes ⇒ Integer (readonly)
Number of bitmap strikes.
19 20 21 |
# File 'lib/ttfunk/table/sbix.rb', line 19 def num_strikes @num_strikes end |
#strikes ⇒ Array<Hash> (readonly)
Strikes.
23 24 25 |
# File 'lib/ttfunk/table/sbix.rb', line 23 def strikes @strikes end |
#version ⇒ Integer (readonly)
Table version.
11 12 13 |
# File 'lib/ttfunk/table/sbix.rb', line 11 def version @version end |
Instance Method Details
#all_bitmap_data_for(glyph_id) ⇒ Array<BitmapData>
Get all bitmaps for glyph.
72 73 74 75 76 |
# File 'lib/ttfunk/table/sbix.rb', line 72 def all_bitmap_data_for(glyph_id) strikes.each_index.filter_map { |strike_index| bitmap_data_for(glyph_id, strike_index) } end |
#bitmap_data_for(glyph_id, strike_index) ⇒ BitmapData
Get bitmap for glyph strike.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/ttfunk/table/sbix.rb', line 49 def bitmap_data_for(glyph_id, strike_index) strike = strikes[strike_index] return if strike.nil? glyph_offset = strike[:glyph_data_offset][glyph_id] next_glyph_offset = strike[:glyph_data_offset][glyph_id + 1] if glyph_offset && next_glyph_offset bytes = next_glyph_offset - glyph_offset if bytes.positive? parse_from(offset + strike[:offset] + glyph_offset) { x, y, type = read(8, 's2A4') data = StringIO.new(io.read(bytes - 8)) BitmapData.new(x, y, type, data, strike[:ppem], strike[:resolution]) } end end end |