Example #1
0
        void DrawGlyphContour(GlyphContour cnt, AggCanvasPainter p)
        {
            //for debug
            List <GlyphPart> parts = cnt.parts;
            int j = parts.Count;

            for (int i = 0; i < j; ++i)
            {
                GlyphPart part = parts[i];
                switch (part.Kind)
                {
                default: throw new NotSupportedException();

                case GlyphPartKind.Line:
                {
                    GlyphLine line = (GlyphLine)part;
                    p.FillColor = PixelFarm.Drawing.Color.Red;
                    p.FillRectLBWH(line.x0, line.y0, 2, 2);
                    p.FillRectLBWH(line.x1, line.y1, 2, 2);
                }
                break;

                case GlyphPartKind.Curve3:
                {
                    GlyphCurve3 c = (GlyphCurve3)part;
                    p.FillColor = PixelFarm.Drawing.Color.Red;
                    p.FillRectLBWH(c.x0, c.y0, 2, 2);
                    p.FillColor = PixelFarm.Drawing.Color.Blue;
                    p.FillRectLBWH(c.p2x, c.p2y, 2, 2);
                    p.FillColor = PixelFarm.Drawing.Color.Red;
                    p.FillRectLBWH(c.x, c.y, 2, 2);
                }
                break;

                case GlyphPartKind.Curve4:
                {
                    GlyphCurve4 c = (GlyphCurve4)part;
                    p.FillColor = PixelFarm.Drawing.Color.Red;
                    p.FillRectLBWH(c.x0, c.y0, 2, 2);
                    p.FillColor = PixelFarm.Drawing.Color.Blue;
                    p.FillRectLBWH(c.p2x, c.p2y, 2, 2);
                    p.FillRectLBWH(c.p3x, c.p3y, 2, 2);
                    p.FillColor = PixelFarm.Drawing.Color.Red;
                    p.FillRectLBWH(c.x, c.y, 2, 2);
                }
                break;
                }
            }
        }
Example #2
0
        public override GlyphPart <Glyph>[] GetVerticalGlyphAssembly(Glyph rawGlyph, Fonts fonts)
        {
            var records = rawGlyph.Info.MathGlyphInfo.VertGlyphConstruction.GlyphAsm_GlyphPartRecords;
            var scale   = rawGlyph.Typeface.CalculateScaleToPixelFromPointSize(fonts.PointSize);
            var parts   = new GlyphPart <Glyph> [records.Length];

            for (int i = 0; i < records.Length; i++)
            {
                parts[i] = new GlyphPart <Glyph> {
                    EndConnectorLength = records[i].EndConnectorLength * scale,
                    FullAdvance        = records[i].FullAdvance * scale,
                    Glyph                = new Glyph(rawGlyph.Typeface, rawGlyph.Typeface.GetGlyphByIndex(records[i].GlyphId)),
                    IsExtender           = records[i].IsExtender,
                    StartConnectorLength = records[i].StartConnectorLength * scale
                }
            }
            ;
            return(parts);
        }
Example #3
0
File: Glyph.cs Project: jonc/carto
 public void AddArea(SymColor color, SymPathWithHoles path)
 {
     GlyphPart part = new GlyphPart();
     part.kind = GlyphPartKind.Area;
     part.color = color;
     part.areaPath = path;
     AddGlyphPart(part);
 }
Example #4
0
File: Glyph.cs Project: jonc/carto
        void AddGlyphPart(GlyphPart part)
        {
            // Add one additional element to the glyph part array.
            int curLen = (parts == null) ? 0 : parts.Length;
            GlyphPart[] newArray = new GlyphPart[curLen + 1];
            for (int i = 0; i < curLen; ++i)
                newArray[i] = parts[i];
            parts = newArray;
            parts[curLen] = part;

            if (curLen == 0 && (part.kind == GlyphPartKind.Circle || part.kind == GlyphPartKind.FilledCircle) &&
                (part.point.X == 0.0F && part.point.Y == 0.0F))
                simple = true;
            else
                simple = false;
        }
Example #5
0
File: Glyph.cs Project: jonc/carto
 public void AddLine(SymColor color, SymPath path, float width, LineStyle lineStyle)
 {
     path.CheckConstructed();
     GlyphPart part = new GlyphPart();
     part.kind = GlyphPartKind.Line;
     part.color = color;
     part.lineWidth = width;
     part.path = path;
     part.lineStyle = lineStyle;
     AddGlyphPart(part);
 }
Example #6
0
File: Glyph.cs Project: jonc/carto
 public void AddFilledCircle(SymColor color, PointF center, float diameter)
 {
     GlyphPart part = new GlyphPart();
     part.kind = GlyphPartKind.FilledCircle;
     part.color = color;
     part.circleDiam = diameter;
     part.point = center;
     AddGlyphPart(part);
 }