Example #1
0
        public static void UpdateAllCffGlyphBounds(this Typeface typeface)
        {
            //TODO: review here again,

            if (typeface.IsCffFont && !typeface._evalCffGlyphBounds)
            {
                int j = typeface.GlyphCount;
                CFF.CffEvaluationEngine evalEngine  = new CFF.CffEvaluationEngine();
                CffBoundFinder          boundFinder = new CffBoundFinder();
                for (ushort i = 0; i < j; ++i)
                {
                    Glyph g = typeface.GetGlyph(i);
                    boundFinder.Reset();

                    evalEngine.Run(boundFinder, g._cff1GlyphData.GlyphInstructions);

                    g.Bounds = boundFinder.GetResultBounds();
                }
                typeface._evalCffGlyphBounds = true;
            }
        }
 //-----------
 //for CFF1
 public static void Read(this IGlyphTranslator tx, CFF.Cff1Font cff1Font, CFF.Cff1GlyphData glyphData, float scale = 1)
 {
     CFF.CffEvaluationEngine evalEngine = new CFF.CffEvaluationEngine();
     evalEngine.Run(tx, cff1Font, glyphData.GlyphInstructions, scale);
 }