Skip to content

Instantly share code, notes, and snippets.

@be5invis
Created November 26, 2019 18:31
Show Gist options
  • Save be5invis/70405c799828fd3f9a371b942038cba0 to your computer and use it in GitHub Desktop.
Save be5invis/70405c799828fd3f9a371b942038cba0 to your computer and use it in GitHub Desktop.

Assembly Alternatives Table ASMB

Assembly Alternatives Table (ASMB) defines the mechanism for complex justification, including Kashida. The principle is to associate assembly alternative lists to current glyphs. An assembly alternative list will have multiple glyph assemblies, being a glyph list with optional stretchable parts.

The table follows the structure of GSUB and GPOS. Listing lookups only.

Lookup type 1: Simple glue application

  • subtableFormat: UInt16: Format identifier: format = 1
  • coverage: Offset16 Coverage: Offset to Coverage table, from beginning of this subtable.
  • category: UInt16: Category identifier.
  • asmCount: UInt16: Quantity of entries in glueTransformArray.
  • asmArray: Array glueCount (Offset16 AsmAltList): Array of assembly alternative lists.

Lookup type 2: Contextual glue application

  • subtableFormat: UInt16: Format identifier: format = 1
  • coverage: Offset16 Coverage: Offset to Coverage table, from beginning of this subtable.
  • inputCondition: Offset16 FilteringCondition: Offset to filtering condition at subject glyph. Could be null for always-accept.
  • backtrackGlyphCount: UInt16: Number of glyphs in the backtracking sequence.
  • backtrackCoverageOffsets: Array backtrackGlyphCount (Offset16 Coverage): Array of offsets to coverage tables in backtracking sequence, in glyph sequence order.
  • backtrackFilters: Array backtrackGlyphCount (Offset16 FilteringCondition): Array of offsets to filtering conditions in backtracking sequence, in glyph sequence order. Could be null.
  • lookaheadGlyphCount: UInt16: Number of glyphs in lookahead sequence.
  • lookaheadCoverageOffsets: Array lookaheadGlyphCount (Offset16 Coverage): Array of offsets to coverage tables in lookahead sequence, in glyph sequence order.
  • lookaheadFilters: Array lookaheadGlyphCount (Offset16 FilteringCondition): Array of offsets to filtering conditions in lookahead sequence, in glyph sequence order. Could be null.
  • category: UInt16: Category identifier.
  • asmCount: UInt16: Quantity of entries in glueTransformArray.
  • asmArray: Array glueCount (Offset16 AsmAltList): Array of assembly alternative lists. May be null for cancelling glue application.

FilteringCondition

  • format: Uint16: Format identifier. Set to 1.
  • catRangeCount: UInt16
  • catRanges: Array catRangeCount FilteringCategoryRange

FilteringCategoryRange

  • catMin: UInt16: Min category number. Inclusive.
  • catMax: UInt16: Max category number. Inclusive.

Common data structure

Assembly alternative list (AsmAltList)

  • alternativesCount: UInt16:Quantity of glue alternatives
  • alternatives: Array alternativesCount GlyphAsmRun: Array of the alternative run.

Glyph assembly run (GlyphAsmRun)

  • glyphCount: UInt16: Quantity of glyphs in this alternative run.
  • parts: Array glyphCount GlyphAssemblyPart: Array of glyphs in this alt run.

GlyphAssemblyPart

  • glyphID: GID
  • markHolderClass: UInt16: TODO
  • stretchFactor: UInt8
    • When being zero, this glyph should not be stretched.
    • When being positive, this glyph should be stretched. Larger value represents more proportion.
  • stretchElevation: ValueRecord:
    • Defines the elevation when repeating this glyph. Useful for cases like Kashida in Nastaliq.

TODO

  • Mark handling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment