/// <summary> /// A glyph constructor. /// </summary> /// <param name="unicode">The unicode character.</param> /// <param name="outline">Outline.</param> /// <param name="advance">The advance after glyph.</param> internal Glyph(string unicode, OutlineCompound2f outline, float advance, GlyphCacheOptions options) { this.unicode = unicode; this.outline = outline; this.advance = advance; ConfigureCaching(options); }
SVGGlyph ProcessDefGlyph(XmlNode node) { string unicode = string.Empty; OutlineCompound2f outline = ConvertPath(node.Attributes["d"] != null ? node.Attributes["d"].InnerText : ""); float adv = horizAdvX; if (node.Attributes["horiz-adv-x"] != null) { adv = int.Parse(node.Attributes["horiz-adv-x"].InnerText); } return(new SVGGlyph(unicode, outline, adv)); }
public void PenVG2(GraphicsDevice device) { ICanvas canvas = new GraphicsCanvas(device, device.SwapChain, new Vector2f(1.0f, 1.0f)); // We first create all needed fills. SolidFill solidFill = new SolidFill(Colour.Red); Pen pen = new Pen(solidFill, 0.03f, 0.0f, OutlineEnd.Square); bool exit = false; device.SwapChain.Window.Closed += delegate(Window w) { exit = true; }; float a = 0; while (!exit) { device.SwapChain.Window.DoEvents(); using (DeviceLock l = device.Lock()) { device.Clear(device.SwapChain, Colour.Green); device.SetViewports(new Region2i(0, 0, (int)device.SwapChain.Width, (int)device.SwapChain.Height)); // We render. canvas.Begin(CanvasRenderFlags.None); OutlineCompound2f b = new OutlineCompound2f( new LineSegment2f(new Vector2f(0.1f, 0.5f), new Vector2f(0.5f, 0.5f)), new LineSegment2f(new Vector2f(0.5f, 0.5f), new Vector2f(0.7f, 0.5f * (MathHelper.Sin(a) + 1.0f))) ); canvas.DrawShape(pen, b, null); canvas.End(); } device.SwapChain.Present(); a += 0.01f; } }
void ProcessGlyph(XmlNode node) { string unicode = node.Attributes["unicode"].InnerText; OutlineCompound2f outline = ConvertPath(node.Attributes["d"] != null ? node.Attributes["d"].InnerText : ""); float adv = horizAdvX; if (node.Attributes["horiz-adv-x"] != null) { adv = int.Parse(node.Attributes["horiz-adv-x"].InnerText); } if (unicode.Length == 1) { glyphNameToUnicode.Add(node.Attributes["glyph-name"].InnerText, unicode[0]); } glyphs.Add(unicode, new SVGGlyph(unicode, outline, adv)); }
/// <summary> /// Adds a manual glyph. /// </summary> /// <param name="unicode">The unicode character.</param> /// <param name="outline">The outline.</param> /// <param name="advance">The advancement.</param> /// <param name="options">Caching options.</param> public void AddManual(string unicode, OutlineCompound2f outline, float advance, GlyphCacheOptions options) { glyphs.Add(unicode, new Glyph(unicode, outline, advance, options)); }
/// <summary> /// The glyph constructor. /// </summary> /// <param name="unicode"></param> /// <param name="outline"></param> public SVGGlyph(string unicode, OutlineCompound2f outline, float advance) { this.outline = outline; this.unicode = unicode; this.advance = advance; }