Fix the remaining font assumption

Two new parameters to oolite-font.plist (default to the 1.80 hard-coded
values if not set) "f6KernGovernment" and "f6KernTechLevel". Fonts with
proportional numbers should set the latter to 0.0.
master
cim 2014-07-07 22:02:32 +01:00
parent 44a5899c8b
commit 3421f75216
2 changed files with 13 additions and 6 deletions

View File

@ -13,6 +13,12 @@
encoding = "windows-latin-1";
texture = "oolite-font.png";
/* Some fonts (including the default) may adjust the kerning on
* the F6 screen slightly for better results. Units are the same
* as the 'widths' parameter. */
"f6KernGovernment" = 1.0;
"f6KernTechLevel" = 2.0;
substitutions =
{
/* This section specifies automatic string conversions. Some of these

View File

@ -186,6 +186,8 @@ static const GLfloat black_color[4] = {0.0, 0.0, 0.0, 1.0};
static const GLfloat lightgray_color[4] = {0.25, 0.25, 0.25, 1.0};
static float sGlyphWidths[256];
static float sF6KernGovt;
static float sF6KernTL;
static BOOL _scannerUpdated;
static BOOL _compassUpdated;
static BOOL hostiles;
@ -3630,6 +3632,9 @@ static void InitTextEngine(void)
lodBias:-0.75f];
[sFontTexture retain];
sF6KernGovt = [fontSpec oo_floatForKey:@"f6KernGovernment" defaultValue:1.0];
sF6KernTL = [fontSpec oo_floatForKey:@"f6KernTechLevel" defaultValue:2.0];
sEncodingCoverter = [[OOEncodingConverter alloc] initWithFontPList:fontSpec];
widths = [fontSpec oo_arrayForKey:@"widths"];
count = [widths count];
@ -3807,22 +3812,18 @@ void OODrawPlanetInfo(int gov, int eco, int tec, GLfloat x, GLfloat y, GLfloat z
OOGL(glEnable(GL_TEXTURE_2D));
[sFontTexture apply];
/* TODO: the modifications of cx here cause difficulties for fonts
* with different number widths to the default font. Find an
* alternative way to do this. - CIM: 14/06/2014 */
OOGLBEGIN(GL_QUADS);
glColor4f(ce1, 1.0f, 0.0f, 1.0f);
// see OODrawHilightedPlanetInfo
cx += drawCharacterQuad(23 - eco, cx, y, z, siz); // characters 16..23 are economy symbols
glColor3fv(&govcol[gov * 3]);
cx += drawCharacterQuad(gov, cx, y, z, siz) - 1.0f; // charcters 0..7 are government symbols
cx += drawCharacterQuad(gov, cx, y, z, siz) - sF6KernGovt; // charcters 0..7 are government symbols
glColor4f(0.5f, 1.0f, 1.0f, 1.0f);
if (tl > 9)
{
// display TL clamped between 1..16, this must be a '1'!
cx += drawCharacterQuad(49, cx, y - 2, z, siz) - 2.0f;
cx += drawCharacterQuad(49, cx, y - 2, z, siz) - sF6KernTL;
}
cx += drawCharacterQuad(48 + (tl % 10), cx, y - 2.0f, z, siz);
OOGLEND();