summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tilefont.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-06-14 20:48:12 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-06-14 20:48:12 +0000
commit5c837c44830ddb54d50e2a3a39851a8efc9bc6d8 (patch)
tree47b1f0c2eac6c6a5b3c377c76f717cfa1294cb85 /crawl-ref/source/tilefont.cc
parent676dc0d1108ddbf60d3f7988be0be93e808d0f9a (diff)
downloadcrawl-ref-5c837c44830ddb54d50e2a3a39851a8efc9bc6d8.tar.gz
crawl-ref-5c837c44830ddb54d50e2a3a39851a8efc9bc6d8.zip
* Make tile_menu_icons deactivate show_inventory_weights as those two
don't work well together. * Experimentally increase the redraw tick counter. Maybe that should become an option, might help track down the lags. Dunno if that's even part of the problem. * Another attempt to fix the "missing item in tiles inventory" bug. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.5@9979 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/tilefont.cc')
-rw-r--r--crawl-ref/source/tilefont.cc35
1 files changed, 16 insertions, 19 deletions
diff --git a/crawl-ref/source/tilefont.cc b/crawl-ref/source/tilefont.cc
index 63583a82eb..1d13913ca8 100644
--- a/crawl-ref/source/tilefont.cc
+++ b/crawl-ref/source/tilefont.cc
@@ -89,23 +89,21 @@ bool FTFont::load_font(const char *font_name, unsigned int font_size, bool outl)
// Get maximum advance
m_max_advance = coord_def(0,0);
- int ascender = face->ascender >> 6;
- int min_y = 100000;
- int max_y = 0;
+ int ascender = face->ascender >> 6;
+ int min_y = 100000;
+ int max_y = 0;
int max_width = 0;
- m_min_offset = 0;
+ m_min_offset = 0;
m_glyphs = new GlyphInfo[256];
for (unsigned int c = 0; c < 256; c++)
{
- m_glyphs[c].offset = 0;
+ m_glyphs[c].offset = 0;
m_glyphs[c].advance = 0;
m_glyphs[c].renderable = false;
FT_Int glyph_index = FT_Get_Char_Index(face, c);
if (!glyph_index)
- {
continue;
- }
error = FT_Load_Glyph(face, glyph_index, FT_LOAD_RENDER);
ASSERT(!error);
@@ -116,13 +114,13 @@ bool FTFont::load_font(const char *font_name, unsigned int font_size, bool outl)
m_max_advance.x = std::max(m_max_advance.x, advance);
- int bmp_width = bmp->width;
- int bmp_top = ascender - face->glyph->bitmap_top;
+ int bmp_width = bmp->width;
+ int bmp_top = ascender - face->glyph->bitmap_top;
int bmp_bottom = ascender + bmp->rows - face->glyph->bitmap_top;
if (outl)
{
- bmp_width += 2;
- bmp_top -= 1;
+ bmp_width += 2;
+ bmp_top -= 1;
bmp_bottom += 1;
}
@@ -130,9 +128,9 @@ bool FTFont::load_font(const char *font_name, unsigned int font_size, bool outl)
min_y = std::min(min_y, bmp_top);
max_y = std::max(max_y, bmp_bottom);
- m_glyphs[c].offset = face->glyph->bitmap_left;
+ m_glyphs[c].offset = face->glyph->bitmap_left;
m_glyphs[c].advance = advance;
- m_glyphs[c].width = bmp_width;
+ m_glyphs[c].width = bmp_width;
m_min_offset = std::min((char)m_min_offset, m_glyphs[c].offset);
}
@@ -142,9 +140,9 @@ bool FTFont::load_font(const char *font_name, unsigned int font_size, bool outl)
// heights on the characters we care about to get better values for the
// text height and the ascender.
m_max_advance.y = max_y - min_y;
- ascender -= min_y;
+ ascender -= min_y;
- int max_height = m_max_advance.y;
+ int max_height = m_max_advance.y;
// Grow character size to power of 2
coord_def charsz(1,1);
@@ -157,8 +155,8 @@ bool FTFont::load_font(const char *font_name, unsigned int font_size, bool outl)
// Having to blow out 8-bit alpha values into full 32-bit textures is
// kind of frustrating, but not all OpenGL implementations support the
// "esoteric" ALPHA8 format and it's not like this texture is very large.
- unsigned int width = 16 * charsz.x;
- unsigned int height = 16 * charsz.y;
+ unsigned int width = 16 * charsz.x;
+ unsigned int height = 16 * charsz.y;
unsigned char *pixels = new unsigned char[4 * width * height];
memset(pixels, 0, sizeof(unsigned char) * 4 * width * height);
@@ -462,10 +460,9 @@ unsigned int FTFont::string_height(const char *text)
{
int height = 1;
for (const char *itr = text; (*itr); itr++)
- {
if (*itr == '\n')
height++;
- }
+
return char_height() * height;
}