예제 #1
0
        public Msdfgen.Shape CreateMsdfShape(GlyphPointF[] glyphPoints, ushort[] contourEndPoints, float pxScale = 1)
        {
            var contourBuilder = new GlyphContourReader();

            contourBuilder.Read(glyphPoints, contourEndPoints);

            List <GlyphContour> cnts           = contourBuilder.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));
        }
예제 #2
0
        public void Hint(GlyphPointF[] glyphPoints, ushort[] glyphContours, float pxScale = 1)
        {
            this.pxScale = pxScale;
            var analyzer1 = new GlyphContourReader();

            analyzer1.Read(glyphPoints, glyphContours);
            //master outline analysis
            contours = analyzer1.GetContours();
            int j        = contours.Count;
            var analyzer = new GlyphPartAnalyzer();

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

            glyphOutline = TessWithPolyTri(contours, pxScale);
        }