public Font(Textures textures, FontFace fontFace, uint sizePixels) { styles = new TextRenderResources[4]; var glyphs = new Dictionary <uint, sGlyphData>(64); eLoadGlyphFlags loadFlags = eLoadGlyphFlags.Render | eLoadGlyphFlags.ForceAutohint | eLoadGlyphFlags.TargetLight; styles[(byte)eTextRendering.GrayscaleExact] = new TextRenderResources(loadFlags, glyphs, textures.grayscale); styles[(byte)eTextRendering.GrayscaleTransformed] = new TextRenderResources(loadFlags, glyphs, textures.grayscale); glyphs = new Dictionary <uint, sGlyphData>(64); loadFlags = eLoadGlyphFlags.Render | eLoadGlyphFlags.ForceAutohint | eLoadGlyphFlags.TargetClearTypeHorizontal; styles[(byte)eTextRendering.ClearTypeHorizontal] = new TextRenderResources(loadFlags, glyphs, textures.cleartype); glyphs = new Dictionary <uint, sGlyphData>(64); loadFlags = eLoadGlyphFlags.Render | eLoadGlyphFlags.ForceAutohint | eLoadGlyphFlags.TargetClearTypeVertical; styles[(byte)eTextRendering.ClearTypeVertical] = new TextRenderResources(loadFlags, glyphs, textures.cleartype); this.fontFace = fontFace; scaledMetrics = fontFace.getScaledMetrics(sizePixels); textures.grayscale.resized.add(this, onGrayAtlasResized); textures.cleartype.resized.add(this, onCleartypeAtlasResized); size = sizePixels; }
public ConsoleBlock(Span <sGlyphVertex> destSpan, CPoint start, ref sScaledMetrics metrics, uint id, int width) { glyphLayout = new GlyphLayout(start); lineStartPosition = glyphLayout.currentPositionPixels; lineHeight = (ushort)metrics.lineHeight; characterWidth = (ushort)metrics.maxAdvancePixels; this.id = id; this.destSpan = destSpan; nextGlyphVertexOffset = 0; x = 0; this.width = width; }