示例#1
0
            /// <exception cref="System.IO.IOException"/>
            protected internal virtual void ReadFormat(int subTableLocation)
            {
                int coverage     = openReader.rf.ReadUnsignedShort() + subTableLocation;
                int valueFormat1 = openReader.rf.ReadUnsignedShort();
                int valueFormat2 = openReader.rf.ReadUnsignedShort();
                int pairSetCount = openReader.rf.ReadUnsignedShort();

                int[]       locationRule = openReader.ReadUShortArray(pairSetCount, subTableLocation);
                IList <int> coverageList = openReader.ReadCoverageFormat(coverage);

                for (int k = 0; k < pairSetCount; ++k)
                {
                    openReader.rf.Seek(locationRule[k]);
                    IDictionary <int, GposLookupType2.PairValueFormat> pairs = new Dictionary <int, GposLookupType2.PairValueFormat
                                                                                               >();
                    gposMap.Put(coverageList[k], pairs);
                    int pairValueCount = openReader.rf.ReadUnsignedShort();
                    for (int j = 0; j < pairValueCount; ++j)
                    {
                        int glyph2 = openReader.rf.ReadUnsignedShort();
                        GposLookupType2.PairValueFormat pair = new GposLookupType2.PairValueFormat();
                        pair.first  = OtfReadCommon.ReadGposValueRecord(openReader, valueFormat1);
                        pair.second = OtfReadCommon.ReadGposValueRecord(openReader, valueFormat2);
                        pairs.Put(glyph2, pair);
                    }
                }
            }
示例#2
0
            public override bool TransformOne(GlyphLine line)
            {
                if (line.idx >= line.end || line.idx < line.start)
                {
                    return(false);
                }
                bool  changed = false;
                Glyph g1      = line.Get(line.idx);
                IDictionary <int, GposLookupType2.PairValueFormat> m = gposMap.Get(g1.GetCode());

                if (m != null)
                {
                    OpenTableLookup.GlyphIndexer gi = new OpenTableLookup.GlyphIndexer();
                    gi.line = line;
                    gi.idx  = line.idx;
                    gi.NextGlyph(openReader, lookupFlag);
                    if (gi.glyph != null)
                    {
                        GposLookupType2.PairValueFormat pv = m.Get(gi.glyph.GetCode());
                        if (pv != null)
                        {
                            Glyph g2 = gi.glyph;
                            line.Set(line.idx, new Glyph(g1, 0, 0, pv.first.XAdvance, pv.first.YAdvance, 0));
                            line.Set(gi.idx, new Glyph(g2, 0, 0, pv.second.XAdvance, pv.second.YAdvance, 0));
                            line.idx = gi.idx;
                            changed  = true;
                        }
                    }
                }
                return(changed);
            }
示例#3
0
            public override bool TransformOne(GlyphLine line)
            {
                if (line.idx >= line.end || line.idx < line.start)
                {
                    return(false);
                }
                Glyph g1 = line.Get(line.idx);

                if (!coverageSet.Contains(g1.GetCode()))
                {
                    return(false);
                }
                int c1 = classDef1.GetOtfClass(g1.GetCode());

                GposLookupType2.PairValueFormat[] pvs = posSubs.Get(c1);
                if (pvs == null)
                {
                    return(false);
                }
                OpenTableLookup.GlyphIndexer gi = new OpenTableLookup.GlyphIndexer();
                gi.line = line;
                gi.idx  = line.idx;
                gi.NextGlyph(openReader, lookupFlag);
                if (gi.glyph == null)
                {
                    return(false);
                }
                Glyph g2 = gi.glyph;
                int   c2 = classDef2.GetOtfClass(g2.GetCode());

                if (c2 >= pvs.Length)
                {
                    return(false);
                }
                GposLookupType2.PairValueFormat pv = pvs[c2];
                line.Set(line.idx, new Glyph(g1, 0, 0, pv.first.XAdvance, pv.first.YAdvance, 0));
                line.Set(gi.idx, new Glyph(g2, 0, 0, pv.second.XAdvance, pv.second.YAdvance, 0));
                line.idx = gi.idx;
                return(true);
            }