OpenType font format

<< Click to Display Table of Contents >>

Navigation:  Font engine >

OpenType font format

 TOTFFont = class
 public
   OffsetTable: TOTFOffsetTable;
   CMAPTable: TOTFCMAPTable;
   FontHeader: TOTFFontHeaderTable;
   HHeader: TOTFHHeaderTable;
   MaxProfile: TOTFMaxProfileTable;
   Names: TOTFNameTable;
   HMetrics: TOTFHMetricsTable;
   OS2: TOTFOS2Table;
   PostScript: TOTFPostScriptTable;
   LocaTable: TOTFLocaTable;
   GlyphTable: TOTFGlyphTable;
   GPOS: TOTFGPOSTable;
   GSUB: TOTFGSUBTable;
   Kern: TOTFKerningTable;
   CFFData: TBytes;
   TableRecs: array of TOTFTableRec;
   Name: string;
   class function NormalizeFont(const FontData: TBytes; AFont: THtBaseFont): TBytes;
   class function NormalizeHeader(const FontData: TBytes): TBytes;
   class function WofftoOTF(const FontData: TBytes; const FontName: string = ''): TBytes;
   constructor Create;
   destructor Destroy; override;
   procedure LoadfromStream(ST: TStream);
   procedure LoadfromFile(const AFileName: string);
   procedure DeleteTablebyType(Tag: cardinal);
   procedure Assign(ASource: TCFFFont);
   procedure SavetoStream(ST: TStream);
   procedure SavetoWOFFStream(ST: TStream);
   procedure LoadfromWOFFStream(ST: TStream);
   procedure LoadfromWOFFFile(const AFileName: string);
   procedure SavetoFile(const AFileName: string);
   procedure SavetoWOFFFile(const AFileName: string);
   function AsFontFace(const AFamilyName: string): string;
   procedure SavetoSVG(const FileName: string);
   function GetGlyphName(GID: integer): string;
   function GetGlyphs(const s: hstring): TWordDynArray; 
   function CreateLayout(const Text: hstring; const FontSize: single; out Layout: THtLayout): boolean;
   procedure PrepareLayout(var Layout: THtLayout);
   procedure GetGlyphPlacement(var Layout: THtLayout);
   function MeasureString(const Text: hstring; const FontSize: single): single;
   function Ascent(const FontSize: single): single;
   function Descent(const FontSize: single): single;
   function Underline(const FontSize: single): single;
   property Tables[Index: integer]: TOTFTable read GetTable;
   property TableCount: integer read GetTableCount;
   property IsTTF: boolean read GetIsTTF write SetIsTTF;
   ///<summary> Returns font as set of SVG images</summary>
   property AsSVG: string read GetSVG; end;
 

 

OffsetTable, CMAPTable, FontHeader, HHeader, MaxProfile, Names,  HMetrics, OS2, PostScript, LocaTable, GlyphTable, GPOS, GSUB, Kern

 

Font tables (may be nil).

 

CFFData

 

Font data when font is in CFF format

 

TableRecs

 

Font table records

 

Name

 

Font name

 

NormalizeFont

 

Add necessary tables and encodings to font.

 

NormalizeHeader

 

Calculate font header fields

 

WofftoOTF

 

Convert WOFF font to OTF font.

 

LoadfromStream

 

Load OTF from stream

 

LoadfromFile

 

Load OTF from file

 

DeleteTablebyType

 

Delete font table by table type

 

Assign

 

Load from CFF font.

 

SavetoStream

 

Save to OTF stream

 

SavetoWOFFStream

 

Save to WOFF  stream

 

LoadfromWOFFStream

 

Load from WOFF stream

 

LoadfromWOFFFile

 

Load from WOFF file

 

SavetoFile

 

Save to OTF file

 

SavetoWOFFFile

 

Save to WOFF file

 

AsFontFace

 

Get base64 encoded string for embedding into HTML

 

SavetoSVG

 

Save all glyphs as SVG

 

GetGlyphName

 

Postscript glyph name

 

GetGlyphs

 

Get glyph IDs for string

 

CreateLayout

 

Create new layout object, set glyph IDs and set properties to default values

 

PrepareLayout

 

Process glyph substitutions, position adjustment and kerning (GPOS, GSUB and KERN tables)

 

GetGlyphPlacement

 

Set glyph widths

 

MeasureString

 

Measure string width

 

Ascent

 

Font ascent value

 

Descent

 

Font descent valie

 

Underline

 

Underline position (from top)

 

Table

 

Font tables by index

 

TableCount

 

Font table count

 

IsTTF

 

Font oulines type: TTF or CFF

 

AsSVG

 

Get font glyphs as SVG string.