/// <inheritdoc/> bool IGlyphRenderer.BeginGlyph(FontRectangle rect, GlyphRendererParameters cachKey) { this.currentColor = null; this.builder.Clear(); this.glyphBounds.Add(rect); return(this.BeginGlyph(rect, cachKey)); }
/// <summary> /// Begins the glyph. /// </summary> /// <param name="bounds">The bounds the glyph will be rendered at and at what size.</param> /// <param name="paramaters">The set of paramaters that uniquely represents a version of a glyph in at particular font size, font family, font style and DPI.</param> /// <returns>Returns true if the glyph should be rendered othersie it returns false.</returns> bool IGlyphRenderer.BeginGlyph(FontRectangle bounds, GlyphRendererParameters paramaters) { // called before each glyph/glyph layer is rendered. // The paramaters can be used to detect the exact details // of the glyph so that duplicate glyphs could optionally // be cached to reduce processing. // You can return false to skip all the figures within the glyph (if you return false EndGlyph will still be called) return(true); }
public void RenderArabicCharacters_WithIsolatedForm_Works(string testStr, int expectedGlyphIndex) { // arrange Font arabicFont = new FontCollection().Add(TestFonts.ArabicFontFile).CreateFont(8); var renderer = new ColorGlyphRenderer(); // act TextRenderer.RenderTextTo(renderer, testStr, new TextOptions(arabicFont)); // assert GlyphRendererParameters glyphKey = Assert.Single(renderer.GlyphKeys); Assert.Equal(expectedGlyphIndex, glyphKey.GlyphIndex); }
public void SingleSubstitution_Works() { // arrange Font font = new FontCollection().Add(TestFonts.GSubTestFontFile1).CreateFont(12); var renderer = new ColorGlyphRenderer(); string testStr = "A"; int expectedGlyphIndex = 38; // we expect A to be mapped to B. // act TextRenderer.RenderTextTo(renderer, testStr, new TextOptions(font)); // assert GlyphRendererParameters glyphKey = Assert.Single(renderer.GlyphKeys); Assert.Equal(expectedGlyphIndex, glyphKey.GlyphIndex); }
public bool BeginGlyph(RectangleF bounds, GlyphRendererParameters paramters) { this.currentRenderPosition = Point.Truncate(bounds.Location); // we have offset our rendering origion a little bit down to prevent edge cropping, move the draw origin up to compensate this.currentRenderPosition = new Point(this.currentRenderPosition.X - this.offset, this.currentRenderPosition.Y - this.offset); this.currentGlyphRenderParams = paramters; if (this.glyphData.ContainsKey(paramters)) { // we have already drawn the glyph vectors skip trying again this.raterizationRequired = false; return(false); } // we check to see if we have a render cache and if we do then we render else this.builder.Clear(); // ensure all glyphs render around [zero, zero] so offset negative root positions so when we draw the glyph we can offet it back this.builder.SetOrigin(new PointF(-(int)bounds.X + this.offset, -(int)bounds.Y + this.offset)); this.raterizationRequired = true; return(true); }
protected virtual bool BeginGlyph(RectangleF rect, GlyphRendererParameters cachKey) { BeginGlyph(rect); return(true); }
/// <summary> /// Begins the glyph. /// </summary> /// <param name="location">The offset that the glyph will be rendered at.</param> /// <param name="size">The size.</param> bool IGlyphRenderer.BeginGlyph(RectangleF rect, GlyphRendererParameters cachKey) { this.builder.Clear(); this.glyphBounds.Add(rect); return(BeginGlyph(rect, cachKey)); }
/// <inheritdoc/> bool IGlyphRenderer.BeginGlyph(FontRectangle bounds, GlyphRendererParameters paramaters) { this.builder.Clear(); this.BeginGlyph(bounds); return(true); }
public bool BeginGlyph(FontRectangle rect, GlyphRendererParameters cacheKey) { this.GlyphRects.Add(rect); this.GlyphKeys.Add(cacheKey); return(true); }
/// <inheritdoc/> bool IGlyphRenderer.BeginGlyph(RectangleF rect, GlyphRendererParameters glyphDetails) { this.builder.Clear(); this.BeginGlyph(rect); return(true); }
bool IGlyphRenderer.BeginGlyph(FontRectangle rect, GlyphRendererParameters cachKey) { currentColor = null; builder.Clear(); return(true); }