Class: Fontisan::Tables::CblcBitmapSize

Inherits:
Binary::BaseRecord show all
Defined in:
lib/fontisan/tables/cblc_bitmap_size.rb

Overview

BitmapSize record embedded in a CBLC table (48 bytes).

Each BitmapSize describes one bitmap strike: a glyph range rendered at a specific ppem with a specific bit depth. It points (via index_subtable_array_offset) at a sequence of IndexSubTableArray records that further describe how to find the bitmap data for each glyph in CBDT.

Layout (48 bytes):

uint32 index_subtable_array_offset
uint32 index_tables_size
uint32 number_of_index_subtables
uint32 color_ref
CblcSbitLineMetrics hori (12 bytes)
CblcSbitLineMetrics vert (12 bytes)
uint16 start_glyph_index
uint16 end_glyph_index
uint8  ppem_x
uint8  ppem_y
uint8  bit_depth
int8   flags

Reference: OpenType CBLC spec, "BitmapSize" record.

Instance Attribute Summary

Attributes inherited from Binary::BaseRecord

#raw_data

Instance Method Summary collapse

Methods inherited from Binary::BaseRecord

read, #valid?

Instance Method Details

#glyph_rangeRange<Integer>

Glyph ID range covered by this strike.

Returns:

  • (Range<Integer>)

    inclusive glyph ID range



54
55
56
# File 'lib/fontisan/tables/cblc_bitmap_size.rb', line 54

def glyph_range
  start_glyph_index..end_glyph_index
end

#includes_glyph?(glyph_id) ⇒ Boolean

Whether the strike covers a specific glyph.

Parameters:

  • glyph_id (Integer)

    source glyph ID

Returns:

  • (Boolean)


62
63
64
# File 'lib/fontisan/tables/cblc_bitmap_size.rb', line 62

def includes_glyph?(glyph_id)
  glyph_range.include?(glyph_id)
end

#ppemInteger

Pixels per em, assuming square pixels (the common case).

Returns:

  • (Integer)

    ppem value



47
48
49
# File 'lib/fontisan/tables/cblc_bitmap_size.rb', line 47

def ppem
  ppem_x
end