Пример #1
0
        public virtual bool IsSkip(int glyph, int flag)
        {
            if (glyphClass != null && (flag & (FLAG_IGNORE_BASE | FLAG_IGNORE_LIGATURE | FLAG_IGNORE_MARK)) != 0)
            {
                int cla = glyphClass.GetOtfClass(glyph);
                if (cla == OtfClass.GLYPH_BASE && (flag & FLAG_IGNORE_BASE) != 0)
                {
                    return(true);
                }
                if (cla == OtfClass.GLYPH_MARK && (flag & FLAG_IGNORE_MARK) != 0)
                {
                    return(true);
                }
                if (cla == OtfClass.GLYPH_LIGATURE && (flag & FLAG_IGNORE_LIGATURE) != 0)
                {
                    return(true);
                }
            }
            int markAttachmentType = (flag >> 8);

            // If MarkAttachmentType is non-zero, then mark attachment classes must be defined in the
            // Mark Attachment Class Definition Table in the GDEF table. When processing glyph sequences,
            // a lookup must ignore any mark glyphs that are not in the specified mark attachment class;
            // only marks of the specified type are processed.
            if (markAttachmentType != 0 && glyphClass != null)
            {
                int currentGlyphClass = glyphClass.GetOtfClass(glyph);
                // Will be 0 in case the class is not defined for this particular glyph
                int glyphMarkAttachmentClass = markAttachmentClass != null?markAttachmentClass.GetOtfClass(glyph) : 0;

                return(currentGlyphClass == OtfClass.GLYPH_MARK && glyphMarkAttachmentClass != markAttachmentType);
            }
            return(false);
        }
Пример #2
0
 public virtual bool IsSkip(int glyph, int flag)
 {
     if (glyphClass != null && (flag & (FLAG_IGNORE_BASE | FLAG_IGNORE_LIGATURE | FLAG_IGNORE_MARK)) != 0)
     {
         int cla = glyphClass.GetOtfClass(glyph);
         if (cla == OtfClass.GLYPH_BASE && (flag & FLAG_IGNORE_BASE) != 0)
         {
             return(true);
         }
         if (cla == OtfClass.GLYPH_MARK && (flag & FLAG_IGNORE_MARK) != 0)
         {
             return(true);
         }
         if (cla == OtfClass.GLYPH_LIGATURE && (flag & FLAG_IGNORE_LIGATURE) != 0)
         {
             return(true);
         }
     }
     if (markAttachmentClass != null && markAttachmentClass.GetOtfClass(glyph) > 0 && (flag >> 8) > 0)
     {
         return(markAttachmentClass.GetOtfClass(glyph) != (flag >> 8));
     }
     return(false);
 }
Пример #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);
            }