internal static FontInstance LoadFont(FontReader reader) { // https://www.microsoft.com/typography/otspec/recom.htm#TableOrdering // recomended order var head = reader.GetTable <HeadTable>(); // head - not saving but loading in suggested order reader.GetTable <HoizontalHeadTable>(); // hhea reader.GetTable <MaximumProfileTable>(); // maxp var os2 = reader.GetTable <OS2Table>(); // OS/2 var horizontalMetrics = reader.GetTable <HorizontalMetricsTable>(); // hmtx // LTSH - Linear threshold data // VDMX - Vertical device metrics // hdmx - Horizontal device metrics var cmap = reader.GetTable <CMapTable>(); // cmap // fpgm - Font Program // prep - Control Value Program // cvt - Control Value Table reader.GetTable <IndexLocationTable>(); // loca var glyphs = reader.GetTable <GlyphTable>(); // glyf var kern = reader.GetTable <KerningTable>(); // kern - Kerning var nameTable = reader.GetTable <NameTable>(); // name // post - PostScript information // gasp - Grid-fitting/Scan-conversion (optional table) // PCLT - PCL 5 data // DSIG - Digital signature return(new FontInstance(nameTable, cmap, glyphs, os2, horizontalMetrics, head, kern)); }
/// <summary> /// Reads a <see cref="FontDescription" /> from the specified stream. /// </summary> /// <param name="reader">The reader.</param> /// <returns> /// a <see cref="FontDescription" />. /// </returns> internal static FontDescription LoadDescription(FontReader reader) { var head = reader.GetTable <HeadTable>(); var os2 = reader.GetTable <OS2Table>(); var nameTable = reader.GetTable <NameTable>(); return(new FontDescription(nameTable, os2, head)); }
/// <summary> /// Reads a <see cref="FontDescription" /> from the specified stream. /// </summary> /// <param name="reader">The reader.</param> /// <returns> /// a <see cref="FontDescription" />. /// </returns> internal static FontDescription LoadDescription(FontReader reader) { // NOTE: These fields are read in their optimized order // https://docs.microsoft.com/en-gb/typography/opentype/spec/recom#optimized-table-ordering HeadTable head = reader.GetTable <HeadTable>(); OS2Table os2 = reader.GetTable <OS2Table>(); NameTable nameTable = reader.GetTable <NameTable>(); return(new FontDescription(nameTable, os2, head)); }
internal static FontInstance LoadFont(FontReader reader) { // https://www.microsoft.com/typography/otspec/recom.htm#TableOrdering // recomended order HeadTable head = reader.GetTable <HeadTable>(); // head - not saving but loading in suggested order reader.GetTable <HorizontalHeadTable>(); // hhea reader.GetTable <MaximumProfileTable>(); // maxp OS2Table os2 = reader.GetTable <OS2Table>(); // OS/2 HorizontalMetricsTable horizontalMetrics = reader.GetTable <HorizontalMetricsTable>(); // hmtx // LTSH - Linear threshold data // VDMX - Vertical device metrics // hdmx - Horizontal device metrics CMapTable cmap = reader.GetTable <CMapTable>(); // cmap // fpgm - Font Program // prep - Control Value Program // cvt - Control Value Table reader.GetTable <IndexLocationTable>(); // loca GlyphTable glyphs = reader.GetTable <GlyphTable>(); // glyf KerningTable kern = reader.GetTable <KerningTable>(); // kern - Kerning NameTable nameTable = reader.GetTable <NameTable>(); // name ColrTable?colrTable = reader.TryGetTable <ColrTable>(); // colr CpalTable?cpalTable; if (colrTable != null) { cpalTable = reader.GetTable <CpalTable>(); // CPAL - required if COLR is provided } else { cpalTable = reader.TryGetTable <CpalTable>(); // colr } // post - PostScript information // gasp - Grid-fitting/Scan-conversion (optional table) // PCLT - PCL 5 data // DSIG - Digital signature return(new FontInstance(nameTable, cmap, glyphs, os2, horizontalMetrics, head, kern, colrTable, cpalTable)); }