Пример #1
0
        private static void bitmapCharacterImpl(int font, char cin)
        {
            BitmapFontRec fontinfo = getBitmapFont(font);
            int           c        = (int)cin & 0xffff;

            if (c < fontinfo.first | c >= fontinfo.first + fontinfo.num_chars)
            {
                return;
            }
            BitmapCharRec ch = fontinfo.ch[c - fontinfo.first];

            if ((ch != null))
            {
                GL.Bitmap(ch.width, ch.height, ch.xorig, ch.yorig, ch.advance, 0, ch.bitmap);
            }
        }
Пример #2
0
        public static int BitmapLength(int font, string s)
        {
            BitmapFontRec fontinfo = getBitmapFont(font);
            float         length   = 0;
            int           len      = s.Length;

            for (int pos = 0; pos <= len - 1; pos++)
            {
                int c = (int)s.ToCharArray(pos, 1)[0] & 0xffff;
                if ((c >= fontinfo.first & c < fontinfo.first + fontinfo.num_chars))
                {
                    BitmapCharRec ch = fontinfo.ch[c - fontinfo.first];
                    if ((ch != null))
                    {
                        length += ch.advance;
                    }
                }
            }
            return((int)length);
        }