Example #1
0
        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;
        }
Example #2
0
 public TextRenderResources(eLoadGlyphFlags loadFlags, GlyphDictionary glyphs, TextureAtlas textureAtlas)
 {
     this.loadFlags    = loadFlags;
     this.glyphs       = glyphs;
     this.textureAtlas = textureAtlas;
 }