コード例 #1
0
ファイル: D3Fonts.cs プロジェクト: ramccor/BFGFontTool
        public void Load(BMFont font, bool hackForBFG, float hackScaleForBFG = 1.0f)
        {
            Debug.Assert(font.pages.Count == 1);
            BMPage page     = font.pages[0];
            var    bmglyphs = from g in font.glyphs
                              where g.page == 0
                              select g;

            var dict = bmglyphs.ToDictionary(g => g.id, g => g);

            maxHeight = 0;
            maxWidth  = 0;
            maxTop    = 0;
            maxBottom = 0;
            for (int i = 0; i < GLYPHS_PER_FONT; ++i)
            {
                BMGlyph bmglyph = dict.ContainsKey(i) ? dict[i] : bmglyphs.First();

                D3Glyph glyph = new D3Glyph();
                glyph.Load(font, bmglyph, hackForBFG, hackScaleForBFG);
                name = font.faceName;

                if (maxHeight < glyph.height)
                {
                    maxHeight = glyph.height;
                }
                if (maxWidth < glyph.xSkip)
                {
                    maxWidth = glyph.xSkip;
                }
                if (maxTop < glyph.top)
                {
                    maxTop = glyph.top;
                }
                if (maxBottom < glyph.bottom)
                {
                    maxBottom = glyph.bottom;
                }

                glyphs[i] = glyph;
            }

            this.glyphScale = hackScaleForBFG;
        }
コード例 #2
0
ファイル: D3Fonts.cs プロジェクト: ramccor/BFGFontTool
        public void Load(string fileName)
        {
            FileStream   fs = File.OpenRead(fileName);
            BinaryReader br = new BinaryReader(fs);

            name = FriendlyFontFace(fileName);

            maxHeight = 0;
            maxWidth  = 0;
            maxTop    = 0;
            maxBottom = 0;
            for (int i = 0; i < GLYPHS_PER_FONT; i++)
            {
                D3Glyph glyph = new D3Glyph();
                glyph.Load(br);
                glyphs[i] = glyph;

                if (maxHeight < glyph.height)
                {
                    maxHeight = glyph.height;
                }
                if (maxWidth < glyph.xSkip)
                {
                    maxWidth = glyph.xSkip;
                }
                if (maxTop < glyph.top)
                {
                    maxTop = glyph.top;
                }
                if (maxBottom < glyph.bottom)
                {
                    maxBottom = glyph.bottom;
                }
            }

            glyphScale = br.ReadSingle();

            br.Close();
            fs.Close();
        }
コード例 #3
0
ファイル: D3Fonts.cs プロジェクト: Zbyl/BFGFontTool
        public void Load(BMFont font, bool hackForBFG, float hackScaleForBFG = 1.0f)
        {
            Debug.Assert(font.pages.Count == 1);
            BMPage page = font.pages[0];
            var bmglyphs = from g in font.glyphs
                         where g.page == 0
                         select g;

            var dict = bmglyphs.ToDictionary(g => g.id, g => g);

            maxHeight = 0;
            maxWidth = 0;
            maxTop = 0;
            maxBottom = 0;
            for (int i = 0; i < GLYPHS_PER_FONT; ++i)
            {
                BMGlyph bmglyph = dict.ContainsKey(i) ? dict[i] : bmglyphs.First();

                D3Glyph glyph = new D3Glyph();
                glyph.Load(font, bmglyph, hackForBFG, hackScaleForBFG);
                name = font.faceName;

                if (maxHeight < glyph.height)
                    maxHeight = glyph.height;
                if (maxWidth < glyph.xSkip)
                    maxWidth = glyph.xSkip;
                if (maxTop < glyph.top)
                    maxTop = glyph.top;
                if (maxBottom < glyph.bottom)
                    maxBottom = glyph.bottom;

                glyphs[i] = glyph;
            }

            this.glyphScale = hackScaleForBFG;
        }
コード例 #4
0
ファイル: D3Fonts.cs プロジェクト: Zbyl/BFGFontTool
        public void Load(string fileName)
        {
            FileStream fs = File.OpenRead(fileName);
            BinaryReader br = new BinaryReader(fs);

            name = FriendlyFontFace(fileName);

            maxHeight = 0;
            maxWidth = 0;
            maxTop = 0;
            maxBottom = 0;
            for (int i = 0; i < GLYPHS_PER_FONT; i++)
            {
                D3Glyph glyph = new D3Glyph();
                glyph.Load(br);
                glyphs[i] = glyph;

                if (maxHeight < glyph.height)
                    maxHeight = glyph.height;
                if (maxWidth < glyph.xSkip)
                    maxWidth = glyph.xSkip;
                if (maxTop < glyph.top)
                    maxTop = glyph.top;
                if (maxBottom < glyph.bottom)
                    maxBottom = glyph.bottom;
            }

            glyphScale = br.ReadSingle();

            br.Close();
            fs.Close();
        }