public static AttachmentListTable CreateFrom(BinaryReader reader, long beginAt)
        {
            AttachmentListTable attachmentListTable = new AttachmentListTable();

            reader.BaseStream.Seek(beginAt, SeekOrigin.Begin);
            //
            ushort coverageOffset = reader.ReadUInt16();
            ushort glyphCount     = reader.ReadUInt16();

            ushort[] attachPointOffsets = Utils.ReadUInt16Array(reader, glyphCount);
            //-----------------------
            attachmentListTable.CoverageTable = CoverageTable.CreateFrom(reader, beginAt + coverageOffset);
            attachmentListTable.attachPoints  = new AttachPoint[glyphCount];
            for (int i = 0; i < glyphCount; ++i)
            {
                reader.BaseStream.Seek(beginAt + attachPointOffsets[i], SeekOrigin.Begin);
                ushort pointCount = reader.ReadUInt16();
                attachmentListTable.attachPoints[i] = new AttachPoint()
                {
                    pointIndices = Utils.ReadUInt16Array(reader, pointCount)
                };
            }

            return(attachmentListTable);
        }
Пример #2
0
        void FillAttachPoints(Glyph[] inputGlyphs)
        {
            AttachmentListTable attachmentListTable = this.AttachmentListTable;

            if (attachmentListTable == null)
            {
                return;
            }
            //-----------------------------------------
            throw new NotSupportedException();
        }
Пример #3
0
        void FillAttachPoints(Glyph[] inputGlyphs)
        {
            AttachmentListTable attachmentListTable = this.AttachmentListTable;

            if (attachmentListTable == null)
            {
                return;
            }
            //-----------------------------------------

            Utils.WarnUnimplemented("please implement GDEF.FillAttachPoints()");
        }
Пример #4
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);
            }
        }