コード例 #1
0
ファイル: FontData.cs プロジェクト: swiercc/SpacebarClicker
        // FontData
        public FontData(FontDataXML dataXML)
        {
            FontHeight    = dataXML.Info.Size;
            LineHeight    = dataXML.Common.LineHeight;
            TextureWidth  = dataXML.Common.ScaleW;
            TextureHeight = dataXML.Common.ScaleH;

            Characters = new FontDataChar[dataXML.Chars.Count];
            CharMap    = new Dictionary <char, int>(Characters.Length);

            for (int i = 0; i < dataXML.Chars.Count; ++i)
            {
                Characters[i] = new FontDataChar(dataXML.Chars[i]);
                CharMap.Add((char)dataXML.Chars[i].ID, i);
            }

            NullCharacter = CharMap[(char)0xffff];

            KerningMap = new Dictionary <int, int>(dataXML.Kernings.Count);

            for (int i = 0; i < dataXML.Kernings.Count; ++i)
            {
                KerningMap.Add(GetKerningHash((char)dataXML.Kernings[i].First, (char)dataXML.Kernings[i].Second), dataXML.Kernings[i].Amount);
            }
        }
コード例 #2
0
ファイル: FontData.cs プロジェクト: tuannsofta/kinect4bag
        // FontData
        public FontData( FontDataXML dataXML )
        {
            FontHeight = dataXML.Info.Size;
            LineHeight = dataXML.Common.LineHeight;
            TextureWidth = dataXML.Common.ScaleW;
            TextureHeight = dataXML.Common.ScaleH;

            Characters = new FontDataChar[ dataXML.Chars.Count ];
            CharMap = new Dictionary< char, int >( Characters.Length );

            for ( int i = 0; i < dataXML.Chars.Count; ++i )
            {
            Characters[ i ] = new FontDataChar( dataXML.Chars[ i ] );
            CharMap.Add( (char)dataXML.Chars[ i ].ID, i );
            }

            NullCharacter = CharMap[ (char)0xffff ];

            KerningMap = new Dictionary< int, int >( dataXML.Kernings.Count );

            for ( int i = 0; i < dataXML.Kernings.Count; ++i )
            KerningMap.Add( GetKerningHash( (char)dataXML.Kernings[ i ].First, (char)dataXML.Kernings[ i ].Second ), dataXML.Kernings[ i ].Amount );
        }