Module: Fontisan::SfntSource

Included in:
SfntFont, Woff2Font, WoffFont
Defined in:
lib/fontisan/sfnt_source.rb

Overview

Marks a class as providing the SFNT font source interface.

SfntFont, WoffFont, and Woff2Font all expose the same table-access surface (#table, #tables, #table_data, #table_names, #has_table?) but don't share a common base class (WOFF/WOFF2 wrap an SfntFont but inherit from BinData::Record directly).

Including this module lets callers type-check with is_a?(SfntSource) instead of respond_to?(:table) duck-typing.

Instance Method Summary collapse

Instance Method Details

#has_table?(tag) ⇒ Boolean

Parameters:

  • tag (String)

    table tag

Returns:

  • (Boolean)


26
# File 'lib/fontisan/sfnt_source.rb', line 26

def has_table?(tag); end

#table(tag) ⇒ Object?

Returns parsed table or nil.

Parameters:

  • tag (String)

    table tag

Returns:

  • (Object, nil)

    parsed table or nil



16
# File 'lib/fontisan/sfnt_source.rb', line 16

def table(tag); end

#table_data(tag = nil) ⇒ Hash<String, String>

Returns raw table bytes by tag.

Returns:

  • (Hash<String, String>)

    raw table bytes by tag



19
# File 'lib/fontisan/sfnt_source.rb', line 19

def table_data(tag = nil); end

#table_namesArray<String>

Returns table tags present in this font.

Returns:

  • (Array<String>)

    table tags present in this font



22
# File 'lib/fontisan/sfnt_source.rb', line 22

def table_names; end