PixelFarm.Drawing.Fonts.SimpleFontAtlas.AddGlyph C# (CSharp) Method

AddGlyph() public method

public AddGlyph ( int codePoint, TextureFontGlyphData glyphData ) : void
codePoint int
glyphData TextureFontGlyphData
return void
        public void AddGlyph(int codePoint, TextureFontGlyphData glyphData)
        {
            codePointLocations.Add(codePoint, glyphData);
        }
        

Usage Example

        void ReadGlyphList(BinaryReader reader)
        {
            ushort glyphCount = reader.ReadUInt16();

            for (int i = 0; i < glyphCount; ++i)
            {
                //read each glyph map info
                //1. codepoint
                var    glyphMap   = new TextureGlyphMapData();
                ushort glyphIndex = reader.ReadUInt16();
                //2. area, left,top,width,height

                glyphMap.Left   = reader.ReadUInt16();
                glyphMap.Top    = reader.ReadUInt16();
                glyphMap.Width  = reader.ReadUInt16();
                glyphMap.Height = reader.ReadUInt16();
                //3. border x,y
                int borderXY = reader.ReadUInt16();
                glyphMap.BorderX = borderXY & 0xff;
                glyphMap.BorderY = borderXY >> 8;
                //---------------------------------------
                //4. texture offset
                glyphMap.TextureXOffset = reader.ReadSingle();
                glyphMap.TextureYOffset = reader.ReadSingle();

                //---------------------------------------
                _atlas.AddGlyph(glyphIndex, glyphMap);
            }
        }