Exemple #1
0
        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);
            }
        }
Exemple #2
0
        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);
            }
        }