Beispiel #1
0
        public GlyphFitOutline Analyze(GlyphPointF[] glyphPoints, ushort[] glyphContours)
        {
            var glyphToCountor = new GlyphTranslatorToContour();

            glyphToCountor.Read(glyphPoints, glyphContours);
            //master outline analysis
            List <GlyphContour> contours = glyphToCountor.GetContours(); //analyzed contour
            int j        = contours.Count;
            var analyzer = new GlyphPartAnalyzer();

            analyzer.NSteps = 4;

            for (int i = 0; i < j; ++i)
            {
                contours[i].Analyze(analyzer);
            }

            if (j > 0)
            {
                return(TessWithPolyTri(contours));
            }
            else
            {
                return(null);
            }
        }
Beispiel #2
0
        public static Msdfgen.Shape CreateMsdfShape(GlyphTranslatorToContour glyphToContour, float pxScale = 1)
        {
            List <GlyphContour> cnts           = glyphToContour.GetContours();
            List <GlyphContour> newFitContours = new List <GlyphContour>();
            int j = cnts.Count;

            for (int i = 0; i < j; ++i)
            {
                newFitContours.Add(
                    CreateFitContour(
                        cnts[i], pxScale, false, true));
            }
            return(CreateMsdfShape(newFitContours));
        }
Beispiel #3
0
        //---------------------------------------------------------------------

        public static GlyphImage CreateMsdfImage(
            GlyphTranslatorToContour glyphToContour)
        {
            // create msdf shape , then convert to actual image
            return(CreateMsdfImage(CreateMsdfShape(glyphToContour, 1)));
        }