[iortcw] 259/497: All: Fix saving/loading glyph 255 in RegisterFont

Simon McVittie smcv at debian.org
Fri Sep 8 10:37:03 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to annotated tag 1.42d
in repository iortcw.

commit 7f2f6b6ad3d4f298449e05ad5c0a2183f3bacdde
Author: M4N4T4RMS at gmail.com <M4N4T4RMS at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date:   Wed Dec 3 23:50:10 2014 +0000

    All: Fix saving/loading glyph 255 in RegisterFont
---
 MP/code/rend2/tr_font.c    | 17 +++++++++++------
 MP/code/renderer/tr_font.c | 17 +++++++++++------
 SP/code/rend2/tr_font.c    | 17 +++++++++++------
 SP/code/renderer/tr_font.c | 17 +++++++++++------
 4 files changed, 44 insertions(+), 24 deletions(-)

diff --git a/MP/code/rend2/tr_font.c b/MP/code/rend2/tr_font.c
index 99431ac..73b5b58 100644
--- a/MP/code/rend2/tr_font.c
+++ b/MP/code/rend2/tr_font.c
@@ -407,7 +407,7 @@ void RE_RegisterFont( const char *fontName, int pointSize, fontInfo_t *font ) {
 
 //		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 );
 		}
 		memcpy( &registeredFont[registeredFontCount++], font, sizeof( fontInfo_t ) );
@@ -455,7 +455,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 );
 	}
 
@@ -465,11 +465,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
 			//
@@ -514,7 +519,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 {
 			memcpy( &font->glyphs[i], glyph, sizeof( glyphInfo_t ) );
diff --git a/MP/code/renderer/tr_font.c b/MP/code/renderer/tr_font.c
index 24a8604..fa6575a 100644
--- a/MP/code/renderer/tr_font.c
+++ b/MP/code/renderer/tr_font.c
@@ -407,7 +407,7 @@ void RE_RegisterFont( const char *fontName, int pointSize, fontInfo_t *font ) {
 
 //		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 );
 		}
 		memcpy( &registeredFont[registeredFontCount++], font, sizeof( fontInfo_t ) );
@@ -455,7 +455,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 );
 	}
 
@@ -465,11 +465,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
 			//
@@ -514,7 +519,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 {
 			memcpy( &font->glyphs[i], glyph, sizeof( glyphInfo_t ) );
diff --git a/SP/code/rend2/tr_font.c b/SP/code/rend2/tr_font.c
index 9dc45de..0e78baa 100644
--- a/SP/code/rend2/tr_font.c
+++ b/SP/code/rend2/tr_font.c
@@ -408,7 +408,7 @@ void RE_RegisterFont( const char *fontName, int pointSize, fontInfo_t *font ) {
 
 //		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 );
 		}
 		memcpy( &registeredFont[registeredFontCount++], font, sizeof( fontInfo_t ) );
@@ -456,7 +456,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++ ) {
 		glyph = RE_ConstructGlyphInfo( out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qtrue );
 	}
 
@@ -466,11 +466,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
 			//
@@ -515,7 +520,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 {
 			memcpy( &font->glyphs[i], glyph, sizeof( glyphInfo_t ) );
diff --git a/SP/code/renderer/tr_font.c b/SP/code/renderer/tr_font.c
index ec0bd1d..addd656 100644
--- a/SP/code/renderer/tr_font.c
+++ b/SP/code/renderer/tr_font.c
@@ -408,7 +408,7 @@ void RE_RegisterFont( const char *fontName, int pointSize, fontInfo_t *font ) {
 
 //		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 );
 		}
 		memcpy( &registeredFont[registeredFontCount++], font, sizeof( fontInfo_t ) );
@@ -456,7 +456,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++ ) {
 		glyph = RE_ConstructGlyphInfo( out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qtrue );
 	}
 
@@ -466,11 +466,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
 			//
@@ -515,7 +520,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 {
 			memcpy( &font->glyphs[i], glyph, sizeof( glyphInfo_t ) );

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list