Example #1
0
        public override bool TransformOne(GlyphLine line)
        {
            if (line.idx >= line.end)
            {
                return(false);
            }
            if (openReader.IsSkip(line.Get(line.idx).GetCode(), lookupFlag))
            {
                line.idx++;
                return(false);
            }
            int             glyphCode       = line.Get(line.idx).GetCode();
            bool            positionApplied = false;
            GposValueRecord valueRecord     = valueRecordMap.Get(glyphCode);

            if (valueRecord != null)
            {
                Glyph newGlyph = new Glyph(line.Get(line.idx));
                newGlyph.xAdvance += (short)valueRecord.XAdvance;
                newGlyph.yAdvance += (short)valueRecord.YAdvance;
                line.Set(line.idx, newGlyph);
                positionApplied = true;
            }
            line.idx++;
            return(positionApplied);
        }
Example #2
0
        protected internal override void ReadSubTable(int subTableLocation)
        {
            openReader.rf.Seek(subTableLocation);
            openReader.rf.ReadShort();
            int             coverage         = openReader.rf.ReadUnsignedShort();
            int             valueFormat      = openReader.rf.ReadUnsignedShort();
            GposValueRecord valueRecord      = OtfReadCommon.ReadGposValueRecord(openReader, valueFormat);
            IList <int>     coverageGlyphIds = openReader.ReadCoverageFormat(subTableLocation + coverage);

            foreach (int?glyphId in coverageGlyphIds)
            {
                valueRecordMap.Put((int)glyphId, valueRecord);
            }
        }
Example #3
0
        public static GposValueRecord ReadGposValueRecord(OpenTypeFontTableReader tableReader, int mask)
        {
            GposValueRecord vr = new GposValueRecord();

            if ((mask & 0x0001) != 0)
            {
                vr.XPlacement = tableReader.rf.ReadShort() * 1000 / tableReader.GetUnitsPerEm();
            }
            if ((mask & 0x0002) != 0)
            {
                vr.YPlacement = tableReader.rf.ReadShort() * 1000 / tableReader.GetUnitsPerEm();
            }
            if ((mask & 0x0004) != 0)
            {
                vr.XAdvance = tableReader.rf.ReadShort() * 1000 / tableReader.GetUnitsPerEm();
            }
            if ((mask & 0x0008) != 0)
            {
                vr.YAdvance = tableReader.rf.ReadShort() * 1000 / tableReader.GetUnitsPerEm();
            }
            if ((mask & 0x0010) != 0)
            {
                tableReader.rf.Skip(2);
            }
            if ((mask & 0x0020) != 0)
            {
                tableReader.rf.Skip(2);
            }
            if ((mask & 0x0040) != 0)
            {
                tableReader.rf.Skip(2);
            }
            if ((mask & 0x0080) != 0)
            {
                tableReader.rf.Skip(2);
            }
            return(vr);
        }