Example #1
0
        public void Add(FontChar font_char)
        {
            font_chars.Add(font_char);

            Rectangle crop = font_char.CropRect;

            if (crop.Y < min_crop_y)
            {
                min_crop_y = crop.Y;
            }
            if (crop.Y + crop.Height > max_crop_y)
            {
                max_crop_y = crop.Y + crop.Height;
            }

            max_height = max_crop_y - min_crop_y;
        }
Example #2
0
        public void Add(FontChar c)
        {
            if (c.PixelCount == 0)
            {
                return;
            }

            Rectangle hash_bounds = new Rectangle(0, 0, c.Width, c.Height);

            if (hash_bounds.Width > MAX_HASH_WIDTH)
            {
                hash_bounds.Width = MAX_HASH_WIDTH;
            }

            int hash = CalculateHash(c.Bitmap, hash_bounds, c.FontColor);

            if (c.Height > max_char_height)
            {
                max_char_height = c.Height;
            }

            int max_offset = c.FontChars.MaxHeight - c.Height;

            if (max_offset > max_offset_by_height[c.Height])
            {
                max_offset_by_height[c.Height] = max_offset;
            }


            if (!lookup_table.ContainsKey(hash))
            {
                lookup_table[hash] = new List <FontChar>();
            }

            lookup_table[hash].Add(c);
        }