Module: Fontisan::Constants

Defined in:
lib/fontisan/constants.rb

Overview

Constants module containing immutable constant definitions for font file operations.

This module defines all magic numbers, version identifiers, and file format constants used throughout the fontisan gem. These values are based on the TrueType Collection, TrueType Font, and OpenType Font specifications.

Constant Summary collapse

TTC_TAG =

TrueType Collection file signature tag. All valid TTC files must begin with this 4-byte tag.

"ttcf"
TTC_VERSION_1 =

TrueType Collection Version 1.0 identifier. Represents the original TTC format version.

0x00010000
TTC_VERSION_2 =

TrueType Collection Version 2.0 identifier. Represents the extended TTC format with digital signature support.

0x00020000
SFNT_VERSION_TRUETYPE =

SFNT version for TrueType fonts

0x00010000
SFNT_VERSION_OTTO =

SFNT version for OpenType fonts with CFF outlines (‘OTTO’)

0x4F54544F
HEAD_TAG =

Head table tag identifier. The ‘head’ table contains global font header information including the checksum adjustment field.

"head"
NAME_TAG =

Name table tag identifier

"name"
OS2_TAG =

OS/2 table tag identifier

"OS/2"
POST_TAG =

Post table tag identifier

"post"
CMAP_TAG =

Cmap table tag identifier

"cmap"
GLYF_TAG =

Glyf table tag identifier (TrueType glyph data)

"glyf"
LOCA_TAG =

Loca table tag identifier (TrueType glyph index to location)

"loca"
CFF_TAG =

CFF table tag identifier (OpenType CFF glyph data)

"CFF "
GSUB_TAG =

GSUB table tag identifier (Glyph Substitution)

"GSUB"
GPOS_TAG =

GPOS table tag identifier (Glyph Positioning)

"GPOS"
FVAR_TAG =

Fvar table tag identifier (Font Variations)

"fvar"
CHECKSUM_ADJUSTMENT_MAGIC =

Magic number used for font file checksum adjustment calculation. This constant is used in conjunction with the file checksum to compute the checksumAdjustment value stored in the ‘head’ table. Formula: checksumAdjustment = CHECKSUM_ADJUSTMENT_MAGIC - file_checksum

0xB1B0AFBA
SUPPORTED_VERSIONS =

Supported TTC version numbers. An array of valid version identifiers for TrueType Collection files.

[TTC_VERSION_1, TTC_VERSION_2].freeze
TABLE_ALIGNMENT =

Table data alignment boundary in bytes. All table data in TTF files must be aligned to 4-byte boundaries, with padding added as necessary.

4