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

            pointSize = 48; // must be 48!
            ascender  = (short)font.fontBase;
            descender = (short)(font.fontBase - font.lineHeight);

            int lowestPoint = 0;

            foreach (BMGlyph g in bmGlyphs)
            {
                BFGGlyph glyph = new BFGGlyph();
                glyph.Load(font, g);
                glyphs.Add(glyph);

                int lowestGlyph = g.yoffset + glyph.height;
                if (lowestGlyph > lowestPoint)
                {
                    lowestPoint = lowestGlyph;
                }

                if (lowestGlyph > font.lineHeight)
                {
                    Console.WriteLine("WARNING: Glyph {0} is too high {1} for line height {2}.", g.id, lowestGlyph, font.lineHeight);
                }
            }

            if (lowestPoint != font.lineHeight)
            {
                Console.WriteLine("WARNING: Line height ({0}) is not what I thought it would be ({1}).", font.lineHeight, lowestPoint);
                Console.WriteLine("         BMFont's settings used to generate source font might be wrong.");
                Console.WriteLine("         Also descender might be wrong: {0} instead of {1}.", descender, font.fontBase - lowestPoint);
            }
        }
コード例 #2
0
ファイル: BFGFonts.cs プロジェクト: Zbyl/BFGFontTool
        short pointSize = 48; // must be 48!

        #endregion Fields

        #region Methods

        public void Load(BMFont font)
        {
            Debug.Assert(font.pages.Count == 1);
            BMPage page = font.pages[0];
            var bmGlyphs = from g in font.glyphs
                         where g.page == 0
                         select g;

            pointSize = 48; // must be 48!
            ascender = (short)font.fontBase;
            descender = (short)(font.fontBase - font.lineHeight);

            int lowestPoint = 0;
            foreach (BMGlyph g in bmGlyphs)
            {
                BFGGlyph glyph = new BFGGlyph();
                glyph.Load(font, g);
                glyphs.Add(glyph);

                int lowestGlyph = g.yoffset + glyph.height;
                if (lowestGlyph > lowestPoint)
                    lowestPoint = lowestGlyph;

                if (lowestGlyph > font.lineHeight)
                {
                    Console.WriteLine("WARNING: Glyph {0} is too high {1} for line height {2}.", g.id, lowestGlyph, font.lineHeight);
                }
            }

            if (lowestPoint != font.lineHeight)
            {
                Console.WriteLine("WARNING: Line height ({0}) is not what I thought it would be ({1}).", font.lineHeight, lowestPoint);
                Console.WriteLine("         BMFont's settings used to generate source font might be wrong.");
                Console.WriteLine("         Also descender might be wrong: {0} instead of {1}.", descender, font.fontBase - lowestPoint);
            }
        }