public bool DrawGlyph(Graphics.Graphics gr, int index, float scalex, float scaley, int translatex, int translatey) { var glyph = ReadGlyph(index); if (glyph == null || glyph.Type != "simple") { return(false); } var c = 0; var firstx = 0; var firsty = 0; bool flag = false; var path = new List <CosmosGL.System.Graphics.Point>(); for (var i = 0; i < glyph.Points.Count; i++) { if (i == glyph.ContourEnds[c]) { c += 1; i++; if (c > 1) { //path.Reverse(); } gr.FillPath(path.ToArray(), Colors.Black); path.Clear(); } else { var glyphPointA = glyph.Points[i]; var x1 = (scalex * glyphPointA["x"]) + translatex; var y1 = (scaley * glyphPointA["y"]) + translatey; path.Add(new Graphics.Point((int)x1, (int)y1)); } } if (path.Count > 0) { gr.FillPolygon(path.ToArray(), Colors.Black); } /* * var p = 0; * var c = 0; * var first = 1; * * var startX = 0; * var startY = 0; * while (p < glyph.Points.Count) * { * var point = glyph.Points[p]; * if (first == 1) * { * startX = point["x"]; * startY = point["y"]; * first = 0; * } * else * { * * var x1 = scalex * (startX + translatex); * var y1 = scaley * (startY + translatey); * * var x2 = scalex * (point["x"] + translatex); * var y2 = scaley * (point["y"] + translatey); * * Console.WriteLine($"(scalex: {scalex}, trasx: {translatex}) x1: {x1}, y1: {y1} | x2: {x2}, y2: {y2}"); * * DrawLine(screen, (int) x1, (int) y1, (int) x2 , (int) y2, (uint) (p * 20)); * * startX = point["x"]; * startY = point["y"]; * * } * * if (p == glyph.ContourEnds[c]) * { * c += 1; * first = 1; * } * * p += 1; * }*/ return(true); }