Beispiel #1
0
        void FillClassDefs(Glyph[] inputGlyphs)
        {
            //1. glyph def
            ClassDefTable classDef = GlyphClassDef;

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

            switch (classDef.Format)
            {
            default:
                Utils.WarnUnimplemented("GDEF GlyphClassDef Format {0}", classDef.Format);
                break;

            case 1:
            {
                ushort   startGlyph  = classDef.startGlyph;
                ushort[] classValues = classDef.classValueArray;
                int      gIndex      = startGlyph;
                for (int i = 0; i < classValues.Length; ++i)
                {
#if DEBUG
                    ushort classV = classValues[i];
                    if (classV > (ushort)GlyphClassKind.Component)
                    {
                    }
#endif

                    inputGlyphs[gIndex].GlyphClass = (GlyphClassKind)classValues[i];
                    gIndex++;
                }
            }
            break;

            case 2:
            {
                ClassDefTable.ClassRangeRecord[] records = classDef.records;
                for (int n = 0; n < records.Length; ++n)
                {
                    ClassDefTable.ClassRangeRecord rec = records[n];

#if DEBUG
                    if (rec.classNo > (ushort)GlyphClassKind.Component)
                    {
                    }
#endif

                    GlyphClassKind glyphKind = (GlyphClassKind)rec.classNo;
                    for (int i = rec.startGlyphId; i <= rec.endGlyphId; ++i)
                    {
                        inputGlyphs[i].GlyphClass = glyphKind;
                    }
                }
            }
            break;
            }
        }
Beispiel #2
0
        public short                   advanceW; // actually this value is ushort, TODO: review here

        public GlyphPos(
            ushort glyphIndex,
            GlyphClassKind glyphClass,
            ushort orgAdvanced
            )
        {
            this.glyphClass = glyphClass;
            this.glyphIndex = glyphIndex;
            this.advanceW   = (short)orgAdvanced;
            xoffset         = yoffset = 0;
        }
Beispiel #3
0
        void FillClassDefs(Glyph[] inputGlyphs)
        {
            //1. glyph def
            ClassDefTable classDef = GlyphClassDef;

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

            switch (classDef.Format)
            {
            default:
                throw new NotSupportedException();

            case 1:
            {
                ushort   startGlyph  = classDef.startGlyph;
                ushort[] classValues = classDef.classValueArray;
                int      len         = classValues.Length;
                int      gIndex      = startGlyph;
                for (int i = 0; i < len; ++i)
                {
                    inputGlyphs[gIndex].GlyphClass = (GlyphClassKind)classValues[i];
                    gIndex++;
                }
            }
            break;

            case 2:
            {
                ClassDefTable.ClassRangeRecord[] records = classDef.records;
                int len = records.Length;
                for (int n = 0; n < len; ++n)
                {
                    ClassDefTable.ClassRangeRecord rec = records[n];
                    GlyphClassKind glyphKind           = (GlyphClassKind)rec.classNo;
                    for (int i = rec.startGlyphId; i <= rec.endGlyphId; ++i)
                    {
                        inputGlyphs[i].GlyphClass = glyphKind;
                    }
                }
            }
            break;
            }
        }
Beispiel #4
0
 public GlyphPos(ushort glyphIndex, GlyphClassKind classKind, ushort advWidth)
 {
     this.glyphIndex = glyphIndex;
     this.advWidth   = advWidth;
     this._classKind = classKind;
 }