Beispiel #1
0
        static bool TargetDirection(string glifFile)
        {
            glyph  g          = Export.Deserialise(glifFile);
            int    cnt        = 0;
            int    maxContour = 0;
            double maxArea    = 0;

            foreach (Contour c in g.outline.contour)
            {
                double area = PolygonArea(c.point);
                if (area > maxArea)
                {
                    maxArea    = area;
                    maxContour = cnt;
                }
                cnt++;
            }

            Contour c2 = g.outline.contour[maxContour];

            if (c2.point.Length < 3)
            {
                return(false);
            }

            bool currDirection = GetCurrentDirection(c2);

            return(!currDirection);
        }
Beispiel #2
0
        public static glyph Deserialise(string glifFile)
        {
            glyph         g = new glyph();
            XmlSerializer x = new XmlSerializer(g.GetType());

            using (FileStream fileStream = new FileStream(glifFile, FileMode.Open))
            {
                g = (glyph)x.Deserialize(fileStream);
            }
            return(g);
        }
Beispiel #3
0
        static string ConvertToSVG(string glifFile)
        {
            glyph g = Export.Deserialise(glifFile);

            if (g.outline == null || g.outline.contour == null || g.outline.component != null)
            {
                return("");
            }
            string svgContents = Export.ToSVG(g, false, false, Precision);

            return(svgContents);
        }
Beispiel #4
0
        public static glyph AddNoise(glyph g, int noise)
        {
            glyph g2 = new glyph
            {
                advance = g.advance,
                format  = g.format,
                name    = g.name,
                outline = AddNoise(g.outline, noise),
                unicode = g.unicode
            };

            return(g2);
        }