diff options
author | Zack Middleton <zturtleman@gmail.com> | 2014-12-01 20:23:22 -0600 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2015-03-17 11:39:02 +0000 |
commit | e9153002f1ed520b7e7c87d2f379dd466fe8a408 (patch) | |
tree | 4afe1bdae1e39f3b0636f313e968e930d6365a79 /src/renderercommon | |
parent | 7069cb284aed90817ab4b013f5f36ab1388c67bc (diff) |
Fix saving/loading glyph 255 in RegisterFont
The glyph for character 255 (lower case y with two dots above it) was
rendered, but it's glyph information was not stored in fontInfo_t and
not saved into .dat file (including the ones in Team Arena).
Attempting to load it from existing .dat font files is fine because
shader name is "" and gets 0 handle. The handle was already 0 anyway.
Diffstat (limited to 'src/renderercommon')
-rw-r--r-- | src/renderercommon/tr_font.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/renderercommon/tr_font.c b/src/renderercommon/tr_font.c index 07a87df8..48f72330 100644 --- a/src/renderercommon/tr_font.c +++ b/src/renderercommon/tr_font.c @@ -398,7 +398,7 @@ void RE_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) { // Com_Memcpy(font, faceData, sizeof(fontInfo_t)); Q_strncpyz(font->name, name, sizeof(font->name)); - for (i = GLYPH_START; i < GLYPH_END; i++) { + for (i = GLYPH_START; i <= GLYPH_END; i++) { font->glyphs[i].glyph = RE_RegisterShaderNoMip(font->glyphs[i].shaderName); } Com_Memcpy(®isteredFont[registeredFontCount++], font, sizeof(fontInfo_t)); @@ -446,7 +446,7 @@ void RE_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) { maxHeight = 0; - for (i = GLYPH_START; i < GLYPH_END; i++) { + for (i = GLYPH_START; i <= GLYPH_END; i++) { RE_ConstructGlyphInfo(out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qtrue); } @@ -456,11 +456,16 @@ void RE_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) { lastStart = i; imageNumber = 0; - while ( i <= GLYPH_END ) { + while ( i <= GLYPH_END + 1 ) { - glyph = RE_ConstructGlyphInfo(out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qfalse); + if ( i == GLYPH_END + 1 ) { + // upload/save current image buffer + xOut = yOut = -1; + } else { + glyph = RE_ConstructGlyphInfo(out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qfalse); + } - if (xOut == -1 || yOut == -1 || i == GLYPH_END) { + if (xOut == -1 || yOut == -1) { // ran out of room // we need to create an image from the bitmap, set all the handles in the glyphs to this point // @@ -505,7 +510,7 @@ void RE_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font) { xOut = 0; yOut = 0; ri.Free(imageBuff); - if(i == GLYPH_END) + if ( i == GLYPH_END + 1 ) i++; } else { Com_Memcpy(&font->glyphs[i], glyph, sizeof(glyphInfo_t)); |