public static MarkGlyphSetsTable CreateFrom(BinaryReader reader, long beginAt)
        {
            reader.BaseStream.Seek(beginAt, SeekOrigin.Begin);
            //
            MarkGlyphSetsTable markGlyphSetsTable = new MarkGlyphSetsTable();

            markGlyphSetsTable._format = reader.ReadUInt16();
            ushort markSetCount = reader.ReadUInt16();

            uint[] coverageOffset = markGlyphSetsTable._coverageOffset = new uint[markSetCount];
            for (int i = 0; i < markSetCount; ++i)
            {
                //Note that the array of offsets for the Coverage tables uses ULONG
                coverageOffset[i] = reader.ReadUInt32();//
            }

            return(markGlyphSetsTable);
        }
Esempio n. 2
0
        protected override void ReadContentFrom(BinaryReader reader)
        {
            tableStartAt = reader.BaseStream.Position;
            //-----------------------------------------
            //GDEF Header, Version 1.0
            //Type      Name            Description
            //uint16    MajorVersion    Major version of the GDEF table, = 1
            //uint16    MinorVersion    Minor version of the GDEF table, = 0
            //Offset16  GlyphClassDef   Offset to class definition table for glyph type, from beginning of GDEF header (may be NULL)
            //Offset16  AttachList      Offset to list of glyphs with attachment points, from beginning of GDEF header (may be NULL)
            //Offset16  LigCaretList    Offset to list of positioning points for ligature carets, from beginning of GDEF header (may be NULL)
            //Offset16  MarkAttachClassDef  Offset to class definition table for mark attachment type, from beginning of GDEF header (may be NULL)
            //GDEF Header, Version 1.2
            //Type  Name    Description
            //uint16    MajorVersion    Major version of the GDEF table, = 1
            //uint16    MinorVersion    Minor version of the GDEF table, = 2
            //Offset16  GlyphClassDef   Offset to class definition table for glyph type, from beginning of GDEF header (may be NULL)
            //Offset16  AttachList  Offset to list of glyphs with attachment points, from beginning of GDEF header (may be NULL)
            //Offset16  LigCaretList    Offset to list of positioning points for ligature carets, from beginning of GDEF header (may be NULL)
            //Offset16  MarkAttachClassDef  Offset to class definition table for mark attachment type, from beginning of GDEF header (may be NULL)
            //Offset16  MarkGlyphSetsDef    Offset to the table of mark set definitions, from beginning of GDEF header (may be NULL)
            //GDEF Header, Version 1.3
            //Type  Name    Description
            //uint16    MajorVersion    Major version of the GDEF table, = 1
            //uint16    MinorVersion    Minor version of the GDEF table, = 3
            //Offset16  GlyphClassDef   Offset to class definition table for glyph type, from beginning of GDEF header (may be NULL)
            //Offset16  AttachList  Offset to list of glyphs with attachment points, from beginning of GDEF header (may be NULL)
            //Offset16  LigCaretList    Offset to list of positioning points for ligature carets, from beginning of GDEF header (may be NULL)
            //Offset16  MarkAttachClassDef  Offset to class definition table for mark attachment type, from beginning of GDEF header (may be NULL)
            //Offset16  MarkGlyphSetsDef    Offset to the table of mark set definitions, from beginning of GDEF header (may be NULL)
            //Offset32  ItemVarStore    Offset to the Item Variation Store table, from beginning of GDEF header (may be NULL)

            //common to 1.0, 1.2, 1.3...
            this.MajorVersion = reader.ReadUInt16();
            this.MinorVersion = reader.ReadUInt16();
            //
            ushort glyphClassDefOffset      = reader.ReadUInt16();
            ushort attachListOffset         = reader.ReadUInt16();
            ushort ligCaretListOffset       = reader.ReadUInt16();
            ushort markAttachClassDefOffset = reader.ReadUInt16();
            ushort markGlyphSetsDefOffset   = 0;
            uint   itemVarStoreOffset       = 0;

            //
            switch (MinorVersion)
            {
            default: throw new NotSupportedException();

            case 0: break;

            case 2:
                markGlyphSetsDefOffset = reader.ReadUInt16();
                break;

            case 3:
                markGlyphSetsDefOffset = reader.ReadUInt16();
                itemVarStoreOffset     = reader.ReadUInt32();
                break;
            }
            //---------------


            this.GlyphClassDef       = (glyphClassDefOffset == 0) ? null : ClassDefTable.CreateFrom(reader, tableStartAt + glyphClassDefOffset);
            this.AttachmentListTable = (attachListOffset == 0) ? null : AttachmentListTable.CreateFrom(reader, tableStartAt + attachListOffset);
            this.LigCaretList        = (ligCaretListOffset == 0) ? null : LigCaretList.CreateFrom(reader, tableStartAt + ligCaretListOffset);

            //A Mark Attachment Class Definition Table defines the class to which a mark glyph may belong.
            //This table uses the same format as the Class Definition table (for details, see the chapter, Common Table Formats ).
            this.MarkAttachmentClassDef = (markAttachClassDefOffset == 0) ? null : ClassDefTable.CreateFrom(reader, tableStartAt + markAttachClassDefOffset);
            this.MarkGlyphSetsTable     = (markGlyphSetsDefOffset == 0) ? null : MarkGlyphSetsTable.CreateFrom(reader, tableStartAt + markGlyphSetsDefOffset);

            if (itemVarStoreOffset != 0)
            {
                //not support
                throw new NotSupportedException();
                reader.BaseStream.Seek(this.Header.Offset + itemVarStoreOffset, SeekOrigin.Begin);
            }
        }