- added internationalized fonts.

This still needs a bit of fixing and tweaking but most is working.
This commit is contained in:
Christoph Oelckers 2021-05-30 10:56:31 +02:00
parent cd56fd66d2
commit 42b70a7d93
2102 changed files with 390 additions and 239 deletions

View file

@ -85,9 +85,6 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
Cursor = '_';
SpaceWidth = 0;
FontHeight = 0;
uint8_t pp = 0;
for (auto &p : PatchRemap) p = pp++;
translateUntranslated = false;
int FixedWidth = 0;
TMap<int, FGameTexture*> charMap;
@ -126,6 +123,11 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
sc.MustGetValue(false);
GlobalKerning = sc.Number;
}
if (sc.Compare("Altfont"))
{
sc.MustGetString();
AltFontName = sc.String;
}
else if (sc.Compare("Scale"))
{
sc.MustGetValue(true);
@ -154,6 +156,16 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
sc.MustGetValue(false);
FontHeight = sc.Number;
}
else if (sc.Compare("minluminosity"))
{
sc.MustGetValue(false);
MinLum = (int16_t)clamp(sc.Number, 0, 255);
}
else if (sc.Compare("maxluminosity"))
{
sc.MustGetValue(false);
MaxLum = (int16_t)clamp(sc.Number, 0, 255);
}
else if (sc.Compare("Translationtype"))
{
sc.MustGetToken(TK_Identifier);
@ -302,7 +314,6 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
auto count = maxchar - minchar + 1;
Chars.Resize(count);
int fontheight = 0;
int asciiheight = 0;
for (i = 0; i < count; i++)
{
@ -320,10 +331,6 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
{
fontheight = height;
}
if (height > asciiheight && FirstChar + 1 < 128)
{
asciiheight = height;
}
}
auto orig = pic->GetTexture();
@ -359,7 +366,6 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
}
}
if (FontHeight == 0) FontHeight = fontheight;
if (AsciiHeight == 0) AsciiHeight = asciiheight;
FixXMoves();
}
@ -1005,8 +1011,6 @@ FFont::FFont (int lump)
FontName = NAME_None;
Cursor = '_';
noTranslate = false;
uint8_t pp = 0;
for (auto &p : PatchRemap) p = pp++;
}
//==========================================================================

View file

@ -292,8 +292,7 @@ public:
FontHeight = 16;
SpaceWidth = 9;
GlobalKerning = 0;
translateUntranslated = true;
Chars.Resize(LastChar - FirstChar + 1);
for (int i = FirstChar; i <= LastChar; i++)
{
@ -360,7 +359,6 @@ public:
FontHeight = 18;
SpaceWidth = 9;
GlobalKerning = -1;
translateUntranslated = true;
Chars.Resize(LastChar - FirstChar + 1);
for (int i = FirstChar; i <= LastChar; i++)
{

View file

@ -227,7 +227,6 @@ void FSingleLumpFont::LoadFON1 (int lump, const uint8_t *data)
FirstChar = 0;
LastChar = 255; // This is to allow LoadTranslations to function. The way this is all set up really needs to be changed.
GlobalKerning = 0;
translateUntranslated = true;
LastChar = 0x2122;
// Move the Windows-1252 characters to their proper place.

View file

@ -103,6 +103,13 @@ FFont *V_GetFont(const char *name, const char *fontlumpname)
if (font) return font;
}
// This is only temporary until virtual fonts get implemented
if (!stricmp(name, "BIGFONT"))
{
font = FFont::FindFont("BIGFONT15");
if (font) return font;
}
int lump = -1;
int folderfile = -1;

View file

@ -127,6 +127,7 @@ public:
char GetCursor() const { return Cursor; }
void SetCursor(char c) { Cursor = c; }
void SetKerning(int c) { GlobalKerning = c; }
void SetHeight(int c) { FontHeight = c; }
bool NoTranslate() const { return noTranslate; }
virtual void RecordAllTextureColors(uint32_t *usedcolors);
void CheckCase();
@ -145,16 +146,16 @@ protected:
void ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height, const DVector2 &Scale);
EFontType Type = EFontType::Unknown;
FName AltFontName = NAME_None;
int FirstChar, LastChar;
int SpaceWidth;
int FontHeight;
int AsciiHeight = 0;
int GlobalKerning;
int TranslationType = 0;
int Displacement = 0;
int16_t MinLum = -1, MaxLum = -1;
char Cursor;
bool noTranslate = false;
bool translateUntranslated;
bool MixedCase = false;
bool forceremap = false;
struct CharData
@ -164,7 +165,6 @@ protected:
};
TArray<CharData> Chars;
TArray<int> Translations;
uint8_t PatchRemap[256];
int Lump;
FName FontName = NAME_None;

View file

@ -59,11 +59,8 @@ int gScreenTilt;
FFont* DigiFont;
void FontSet(int id, int tile, int space)
FFont* FontSet(const char* name, int tile, int space)
{
if (id < 0 || id >= kFontNum || tile < 0 || tile >= kMaxTiles)
return;
GlyphSet glyphs;
for (int i = 1; i < 96; i++)
{
@ -75,12 +72,14 @@ void FontSet(int id, int tile, int space)
}
}
const char *names[] = { "smallfont", "bigfont", "gothfont", "smallfont2", "digifont"};
const char *defs[] = { "defsmallfont", "defbigfont", nullptr, "defsmallfont2", nullptr};
FFont ** ptrs[] = { &SmallFont, &BigFont, nullptr, &SmallFont2, &DigiFont};
auto fnt = new ::FFont(names[id], nullptr, defs[id], 0, 0, 0, 0, tileWidth(tile), false, false, false, &glyphs);
fnt->SetKerning(space);
if (ptrs[id]) *ptrs[id] = fnt;
auto fnt = V_GetFont(name);
if (!fnt)
{
fnt = new ::FFont(name, nullptr, nullptr, 0, 0, 0, 0, tileWidth(tile), false, false, false, &glyphs);
fnt->SetKerning(space);
}
return fnt;
}
void viewBackupView(int nPlayer)
@ -165,11 +164,16 @@ extern int dword_172CE0[16][3];
void viewInit(void)
{
Printf("Initializing status bar\n");
FontSet(0, 4096, 0);
FontSet(1, 4192, 1);
FontSet(2, 4288, 1);
FontSet(3, 4384, 1);
FontSet(4, 4480, 0);
FontSet("tilesmallfont", 4096, 0);
FontSet("tilebigfont", 4192, 1);
FontSet("gothfont", 4288, 1);
SmallFont2 = FontSet("smallfont2", 4384, 1);
DigiFont = FontSet("digifont", 4480, 0);
BigFont = V_GetFont("BIGFONT");
SmallFont = V_GetFont("SMALLFONT");
lensdata = fileSystem.LoadFile("lens.dat");
assert(lensdata.Size() == kLensSize * kLensSize * sizeof(int));

View file

@ -55,81 +55,103 @@ void InitFonts_d()
{
GlyphSet fontdata;
// Small font
for (int i = 0; i < 95; i++)
if (!V_GetFont("TileSmallFont"))
{
auto tile = tileGetTexture(STARTALPHANUM + i);
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
// Small font
for (int i = 0; i < 95; i++)
{
if (i >= 'a' && i <= 'z' && tileEqualTo(i, i - 32)) continue;
fontdata.Insert('!' + i, tile);
tile->SetOffsetsNotForFont();
auto tile = tileGetTexture(STARTALPHANUM + i);
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
{
if (i >= 'a' && i <= 'z' && tileEqualTo(i, i - 32)) continue;
fontdata.Insert('!' + i, tile);
tile->SetOffsetsNotForFont();
}
}
new ::FFont("TileSmallFont", nullptr, nullptr, 0, 0, 0, -1, 5, false, false, false, &fontdata);
fontdata.Clear();
}
SmallFont = new ::FFont("SmallFont", nullptr, "defsmallfont", 0, 0, 0, -1, 5, false, false, false, &fontdata);
fontdata.Clear();
// Big font
// This font is VERY messy...
fontdata.Insert('_', tileGetTexture(BIGALPHANUM - 11));
fontdata.Insert('-', tileGetTexture(BIGALPHANUM - 11));
for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(BIGALPHANUM - 10 + i));
for (int i = 0; i < 26; i++) fontdata.Insert('A' + i, tileGetTexture(BIGALPHANUM + i));
fontdata.Insert('.', tileGetTexture(BIGPERIOD));
fontdata.Insert(',', tileGetTexture(BIGCOMMA));
fontdata.Insert('!', tileGetTexture(BIGX));
fontdata.Insert('?', tileGetTexture(BIGQ));
fontdata.Insert(';', tileGetTexture(BIGSEMI));
fontdata.Insert(':', tileGetTexture(BIGCOLIN));
fontdata.Insert('\\', tileGetTexture(BIGALPHANUM + 68));
fontdata.Insert('/', tileGetTexture(BIGALPHANUM + 68));
fontdata.Insert('%', tileGetTexture(BIGALPHANUM + 69));
fontdata.Insert('`', tileGetTexture(BIGAPPOS));
fontdata.Insert('"', tileGetTexture(BIGAPPOS));
fontdata.Insert('\'', tileGetTexture(BIGAPPOS));
// The texture offsets in this font are useless for font printing. This should only apply to these glyphs, not for international extensions, though.
GlyphSet::Iterator it(fontdata);
GlyphSet::Pair* pair;
while (it.NextPair(pair)) pair->Value->SetOffsetsNotForFont();
BigFont = new ::FFont("BigFont", nullptr, "defbigfont", 0, 0, 0, -1, 5, false, false, false, &fontdata);
fontdata.Clear();
// Tiny font
for (int i = 0; i < 95; i++)
if (!V_GetFont("TileBigFont"))
{
auto tile = tileGetTexture(MINIFONT + i);
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
{
if (i >= 'a' && i <= 'z' && tileEqualTo(i, i - 32)) continue;
fontdata.Insert('!' + i, tile);
tile->SetOffsetsNotForFont();
}
// This font is VERY messy...
fontdata.Insert('_', tileGetTexture(BIGALPHANUM - 11));
fontdata.Insert('-', tileGetTexture(BIGALPHANUM - 11));
for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(BIGALPHANUM - 10 + i));
for (int i = 0; i < 26; i++) fontdata.Insert('A' + i, tileGetTexture(BIGALPHANUM + i));
fontdata.Insert('.', tileGetTexture(BIGPERIOD));
fontdata.Insert(',', tileGetTexture(BIGCOMMA));
fontdata.Insert('!', tileGetTexture(BIGX));
fontdata.Insert('?', tileGetTexture(BIGQ));
fontdata.Insert(';', tileGetTexture(BIGSEMI));
fontdata.Insert(':', tileGetTexture(BIGCOLIN));
fontdata.Insert('\\', tileGetTexture(BIGALPHANUM + 68));
fontdata.Insert('/', tileGetTexture(BIGALPHANUM + 68));
fontdata.Insert('%', tileGetTexture(BIGALPHANUM + 69));
fontdata.Insert('`', tileGetTexture(BIGAPPOS));
fontdata.Insert('"', tileGetTexture(BIGAPPOS));
fontdata.Insert('\'', tileGetTexture(BIGAPPOS));
// The texture offsets in this font are useless for font printing. This should only apply to these glyphs, not for international extensions, though.
GlyphSet::Iterator it(fontdata);
GlyphSet::Pair* pair;
while (it.NextPair(pair)) pair->Value->SetOffsetsNotForFont();
new ::FFont("TileBigFont", nullptr, nullptr, 0, 0, 0, -1, 5, false, false, false, &fontdata);
fontdata.Clear();
}
fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
SmallFont2 = new ::FFont("SmallFont2", nullptr, "defsmallfont2", 0, 0, 0, -1, 3, false, false, false, &fontdata);
SmallFont2->SetKerning(1);
fontdata.Clear();
// SBAR index font
for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(THREEBYFIVE0 + i));
fontdata.Insert(':', tileGetTexture(THREEBYFIVE0 + 10));
fontdata.Insert('/', tileGetTexture(THREEBYFIVE0 + 11));
fontdata.Insert('%', tileGetTexture(MINIFONT + '%' - '!'));
fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
GlyphSet::Iterator iti(fontdata);
while (iti.NextPair(pair)) pair->Value->SetOffsetsNotForFont();
IndexFont = new ::FFont("IndexFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata);
SmallFont2 = V_GetFont("SmallFont2");
if (!SmallFont2)
{
// Tiny font
for (int i = 0; i < 95; i++)
{
auto tile = tileGetTexture(MINIFONT + i);
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
{
if (i >= 'a' && i <= 'z' && tileEqualTo(i, i - 32)) continue;
fontdata.Insert('!' + i, tile);
tile->SetOffsetsNotForFont();
}
}
fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
SmallFont2 = new ::FFont("SmallFont2", nullptr, nullptr, 0, 0, 0, -1, 3, false, false, false, &fontdata);
SmallFont2->SetKerning(1);
fontdata.Clear();
}
fontdata.Clear();
IndexFont = V_GetFont("IndexFont");
if (!IndexFont)
{
// SBAR index font
for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(THREEBYFIVE0 + i));
fontdata.Insert(':', tileGetTexture(THREEBYFIVE0 + 10));
fontdata.Insert('/', tileGetTexture(THREEBYFIVE0 + 11));
fontdata.Insert('%', tileGetTexture(MINIFONT + '%' - '!'));
fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
GlyphSet::Iterator iti(fontdata);
GlyphSet::Pair* pair;
while (iti.NextPair(pair)) pair->Value->SetOffsetsNotForFont();
IndexFont = new ::FFont("IndexFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata);
fontdata.Clear();
}
// digital font
for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(DIGITALNUM + i));
fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
GlyphSet::Iterator itd(fontdata);
while (itd.NextPair(pair)) pair->Value->SetOffsetsNotForFont();
DigiFont = new ::FFont("DigiFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata);
DigiFont = V_GetFont("DigiFont");
if (!DigiFont)
{
// digital font
for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(DIGITALNUM + i));
fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
GlyphSet::Iterator itd(fontdata);
GlyphSet::Pair* pair;
while (itd.NextPair(pair)) pair->Value->SetOffsetsNotForFont();
DigiFont = new ::FFont("DigiFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata);
}
// Todo: virtualize this;
BigFont = V_GetFont("BIGFONT");
SmallFont = V_GetFont("SMALLFONT");
}

View file

@ -55,72 +55,93 @@ void InitFonts_r()
{
GlyphSet fontdata;
// Small font
for (int i = 0; i < 95; i++)
if (!V_GetFont("TileSmallFont"))
{
auto tile = tileGetTexture(STARTALPHANUM + i);
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
// Small font
for (int i = 0; i < 95; i++)
{
fontdata.Insert('!' + i, tile);
tile->SetOffsetsNotForFont();
auto tile = tileGetTexture(STARTALPHANUM + i);
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
{
fontdata.Insert('!' + i, tile);
tile->SetOffsetsNotForFont();
}
}
auto SmallFont = new ::FFont("TileSmallFont", nullptr, nullptr, 0, 0, 0, -1, 10, false, false, false, &fontdata);
SmallFont->SetKerning(2);
fontdata.Clear();
}
SmallFont = new ::FFont("SmallFont", nullptr, "defsmallfont", 0, 0, 0, -1, 10, false, false, false, &fontdata);
SmallFont->SetKerning(2);
fontdata.Clear();
// Big font
// This font is VERY messy...
fontdata.Insert('_', tileGetTexture(BIGALPHANUM - 11));
fontdata.Insert('-', tileGetTexture(BIGALPHANUM - 11));
for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(BIGALPHANUM - 10 + i));
for (int i = 0; i < 26; i++) fontdata.Insert('A' + i, tileGetTexture(BIGALPHANUM + i));
fontdata.Insert('.', tileGetTexture(BIGPERIOD));
fontdata.Insert(',', tileGetTexture(BIGCOMMA));
fontdata.Insert('!', tileGetTexture(BIGX));
fontdata.Insert('?', tileGetTexture(BIGQ));
fontdata.Insert(';', tileGetTexture(BIGSEMI));
fontdata.Insert(':', tileGetTexture(BIGCOLIN));
fontdata.Insert('\\', tileGetTexture(BIGALPHANUM + 68));
fontdata.Insert('/', tileGetTexture(BIGALPHANUM + 68));
fontdata.Insert('%', tileGetTexture(BIGALPHANUM + 69));
fontdata.Insert('`', tileGetTexture(BIGAPPOS));
fontdata.Insert('"', tileGetTexture(BIGAPPOS));
fontdata.Insert('\'', tileGetTexture(BIGAPPOS));
GlyphSet::Iterator it(fontdata);
GlyphSet::Pair* pair;
while (it.NextPair(pair)) pair->Value->SetOffsetsNotForFont();
BigFont = new ::FFont("BigFont", nullptr, "defbigfont", 0, 0, 0, -1, 10, false, false, false, &fontdata);
BigFont->SetKerning(6);
fontdata.Clear();
// Tiny font
for (int i = 0; i < 95; i++)
if (!V_GetFont("TileBigFont"))
{
auto tile = tileGetTexture(MINIFONT + i);
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
fontdata.Insert('!' + i, tile);
// This font is VERY messy...
fontdata.Insert('_', tileGetTexture(BIGALPHANUM - 11));
fontdata.Insert('-', tileGetTexture(BIGALPHANUM - 11));
for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(BIGALPHANUM - 10 + i));
for (int i = 0; i < 26; i++) fontdata.Insert('A' + i, tileGetTexture(BIGALPHANUM + i));
fontdata.Insert('.', tileGetTexture(BIGPERIOD));
fontdata.Insert(',', tileGetTexture(BIGCOMMA));
fontdata.Insert('!', tileGetTexture(BIGX));
fontdata.Insert('?', tileGetTexture(BIGQ));
fontdata.Insert(';', tileGetTexture(BIGSEMI));
fontdata.Insert(':', tileGetTexture(BIGCOLIN));
fontdata.Insert('\\', tileGetTexture(BIGALPHANUM + 68));
fontdata.Insert('/', tileGetTexture(BIGALPHANUM + 68));
fontdata.Insert('%', tileGetTexture(BIGALPHANUM + 69));
fontdata.Insert('`', tileGetTexture(BIGAPPOS));
fontdata.Insert('"', tileGetTexture(BIGAPPOS));
fontdata.Insert('\'', tileGetTexture(BIGAPPOS));
GlyphSet::Iterator it(fontdata);
GlyphSet::Pair* pair;
while (it.NextPair(pair)) pair->Value->SetOffsetsNotForFont();
auto BigFont = new ::FFont("TileBigFont", nullptr, nullptr, 0, 0, 0, -1, 10, false, false, false, &fontdata);
BigFont->SetKerning(6);
fontdata.Clear();
}
fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
SmallFont2 = new ::FFont("SmallFont2", nullptr, "defsmallfont2", 0, 0, 0, -1, 6, false, false, false, &fontdata);
SmallFont2->SetKerning(2);
fontdata.Clear();
// SBAR index font
for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(THREEBYFIVE + i));
fontdata.Insert(':', tileGetTexture(THREEBYFIVE + 10));
fontdata.Insert('/', tileGetTexture(THREEBYFIVE + 11));
fontdata.Insert('%', tileGetTexture(MINIFONT + '%' - '!'));
fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
IndexFont = new ::FFont("IndexFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata);
SmallFont2 = V_GetFont("SmallFont2");
if (!SmallFont2)
{
// Tiny font
for (int i = 0; i < 95; i++)
{
auto tile = tileGetTexture(MINIFONT + i);
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
fontdata.Insert('!' + i, tile);
}
fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
SmallFont2 = new ::FFont("SmallFont2", nullptr, nullptr, 0, 0, 0, -1, 6, false, false, false, &fontdata);
SmallFont2->SetKerning(2);
fontdata.Clear();
}
fontdata.Clear();
IndexFont = V_GetFont("IndexFont");
if (!IndexFont)
{
// SBAR index font
for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(THREEBYFIVE + i));
fontdata.Insert(':', tileGetTexture(THREEBYFIVE + 10));
fontdata.Insert('/', tileGetTexture(THREEBYFIVE + 11));
fontdata.Insert('%', tileGetTexture(MINIFONT + '%' - '!'));
fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
IndexFont = new ::FFont("IndexFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata);
// digital font
for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(DIGITALNUM + i));
fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
DigiFont = new ::FFont("DigiFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata);
fontdata.Clear();
}
DigiFont = V_GetFont("DigiFont");
if (!DigiFont)
{
// digital font
for (int i = 0; i < 10; i++) fontdata.Insert('0' + i, tileGetTexture(DIGITALNUM + i));
fontdata.Insert(1, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
DigiFont = new ::FFont("DigiFont", nullptr, nullptr, 0, 0, 0, -1, -1, false, false, false, &fontdata);
}
BigFont = V_GetFont("BIGFONT");
SmallFont = V_GetFont("SMALLFONT");
}

View file

@ -57,55 +57,65 @@ BEGIN_PS_NS
void InitFonts()
{
GlyphSet fontdata;
fontdata.Insert(127, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
for (int i = 0; i < 26; i++)
if (!V_GetFont("TileSmallFont"))
{
fontdata.Insert('A' + i, tileGetTexture(3522 + i));
for (int i = 0; i < 26; i++)
{
fontdata.Insert('A' + i, tileGetTexture(3522 + i));
}
for (int i = 0; i < 10; i++)
{
fontdata.Insert('0' + i, tileGetTexture(3555 + i));
}
fontdata.Insert('.', tileGetTexture(3548));
fontdata.Insert('!', tileGetTexture(3549));
fontdata.Insert('?', tileGetTexture(3550));
fontdata.Insert(',', tileGetTexture(3551));
fontdata.Insert('`', tileGetTexture(3552));
fontdata.Insert('"', tileGetTexture(3553));
fontdata.Insert('-', tileGetTexture(3554));
fontdata.Insert('_', tileGetTexture(3554));
fontdata.Insert(127, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
GlyphSet::Iterator it(fontdata);
GlyphSet::Pair* pair;
while (it.NextPair(pair)) pair->Value->SetOffsetsNotForFont();
auto SmallFont = new ::FFont("TileSmallFont", nullptr, nullptr, 0, 0, 0, -1, 4, false, false, false, &fontdata);
SmallFont->SetKerning(1);
SmallFont->SetHeight(11); // FFont calculates a bad value for this.
fontdata.Clear();
}
for (int i = 0; i < 10; i++)
{
fontdata.Insert('0' + i, tileGetTexture(3555 + i));
}
fontdata.Insert('.', tileGetTexture(3548));
fontdata.Insert('!', tileGetTexture(3549));
fontdata.Insert('?', tileGetTexture(3550));
fontdata.Insert(',', tileGetTexture(3551));
fontdata.Insert('`', tileGetTexture(3552));
fontdata.Insert('"', tileGetTexture(3553));
fontdata.Insert('-', tileGetTexture(3554));
fontdata.Insert('_', tileGetTexture(3554));
fontdata.Insert(127, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
GlyphSet::Iterator it(fontdata);
GlyphSet::Pair* pair;
while (it.NextPair(pair)) pair->Value->SetOffsetsNotForFont();
SmallFont = new ::FFont("SmallFont", nullptr, "defsmallfont", 0, 0, 0, -1, 4, false, false, false, &fontdata);
SmallFont->SetKerning(1);
fontdata.Clear();
fontdata.Insert(127, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
SmallFont2 = V_GetFont("SmallFont2");
if (!SmallFont2)
{
for (int i = 0; i < 26; i++)
{
fontdata.Insert('A' + i, tileGetTexture(3624 + i));
}
for (int i = 0; i < 10; i++)
{
fontdata.Insert('0' + i, tileGetTexture(3657 + i));
}
fontdata.Insert('!', tileGetTexture(3651));
fontdata.Insert('"', tileGetTexture(3655));
fontdata.Insert('\'', tileGetTexture(3654));
fontdata.Insert('`', tileGetTexture(3654));
fontdata.Insert('.', tileGetTexture(3650));
fontdata.Insert(',', tileGetTexture(3653));
fontdata.Insert('-', tileGetTexture(3656));
fontdata.Insert('?', tileGetTexture(3652));
fontdata.Insert(127, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
GlyphSet::Iterator it2(fontdata);
GlyphSet::Pair* pair;
while (it2.NextPair(pair)) pair->Value->SetOffsetsNotForFont();
SmallFont2 = new ::FFont("SmallFont2", nullptr, nullptr, 0, 0, 0, -1, 4, false, false, false, &fontdata);
SmallFont2->SetKerning(1);
}
BigFont = V_GetFont("BIGFONT");
SmallFont = V_GetFont("SMALLFONT");
for (int i = 0; i < 26; i++)
{
fontdata.Insert('A' + i, tileGetTexture(3624 + i));
}
for (int i = 0; i < 10; i++)
{
fontdata.Insert('0' + i, tileGetTexture(3657 + i));
}
fontdata.Insert('!', tileGetTexture(3651));
fontdata.Insert('"', tileGetTexture(3655));
fontdata.Insert('\'', tileGetTexture(3654));
fontdata.Insert('`', tileGetTexture(3654));
fontdata.Insert('.', tileGetTexture(3650));
fontdata.Insert(',', tileGetTexture(3653));
fontdata.Insert('-', tileGetTexture(3656));
fontdata.Insert('?', tileGetTexture(3652));
fontdata.Insert(127, TexMan.FindGameTexture("TINYBLAK")); // this is only here to widen the color range of the font to produce a better translation.
GlyphSet::Iterator it2(fontdata);
while (it2.NextPair(pair)) pair->Value->SetOffsetsNotForFont();
SmallFont2 = new ::FFont("SmallFont2", nullptr, "defsmallfont2", 0, 0, 0, -1, 4, false, false, false, &fontdata);
SmallFont2->SetKerning(1);
}

View file

@ -49,57 +49,73 @@ void InitFonts()
{
GlyphSet fontdata;
// Small font
for (int i = 0; i < 95; i++)
if (!V_GetFont("TileSmallFont"))
{
auto tile = tileGetTexture(STARTALPHANUM + i);
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
// Small font
for (int i = 0; i < 95; i++)
{
fontdata.Insert('!' + i, tile);
tile->SetOffsetsNotForFont();
}
}
SmallFont = new ::FFont("SmallFont", nullptr, "defsmallfont", 0, 0, 0, -1, 4, false, false, false, &fontdata);
fontdata.Clear();
// Tiny font
for (int i = 0; i < 95; i++)
{
auto tile = tileGetTexture(2930 + i);
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
{
fontdata.Insert('!' + i, tile);
tile->SetOffsetsNotForFont();
}
}
SmallFont2 = new ::FFont("SmallFont2", nullptr, "defsmallfont2", 0, 0, 0, -1, 4, false, false, false, &fontdata);
fontdata.Clear();
const int FONT_LARGE_ALPHA = 3706;
const int FONT_LARGE_DIGIT = 3732;
// Big
for (int i = 0; i < 10; i++)
{
auto tile = tileGetTexture(FONT_LARGE_DIGIT + i);
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
{
fontdata.Insert('0' + i, tile);
tile->SetOffsetsNotForFont();
}
}
for (int i = 0; i < 26; i++)
{
auto tile = tileGetTexture(FONT_LARGE_ALPHA + i);
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
{
fontdata.Insert('A' + i, tile);
tile->SetOffsetsNotForFont();
auto tile = tileGetTexture(STARTALPHANUM + i);
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
{
fontdata.Insert('!' + i, tile);
tile->SetOffsetsNotForFont();
}
}
new ::FFont("TileSmallFont", nullptr, nullptr, 0, 0, 0, -1, 4, false, false, false, &fontdata);
fontdata.Clear();
}
BigFont = new ::FFont("BigFont", nullptr, "defbigfont", 0, 0, 0, -1, 10, false, false, false, &fontdata);
BigFont->SetKerning(1);
SmallFont2 = V_GetFont("SmallFont2");
if (!SmallFont2)
{
// Tiny font
for (int i = 0; i < 95; i++)
{
auto tile = tileGetTexture(2930 + i);
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
{
fontdata.Insert('!' + i, tile);
tile->SetOffsetsNotForFont();
}
}
SmallFont2 = new ::FFont("SmallFont2", nullptr, nullptr, 0, 0, 0, -1, 4, false, false, false, &fontdata);
fontdata.Clear();
}
if (!V_GetFont("TileBigFont"))
{
const int FONT_LARGE_ALPHA = 3706;
const int FONT_LARGE_DIGIT = 3732;
// Big
for (int i = 0; i < 10; i++)
{
auto tile = tileGetTexture(FONT_LARGE_DIGIT + i);
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
{
fontdata.Insert('0' + i, tile);
tile->SetOffsetsNotForFont();
}
}
for (int i = 0; i < 26; i++)
{
auto tile = tileGetTexture(FONT_LARGE_ALPHA + i);
if (tile && tile->isValid() && tile->GetTexelWidth() > 0 && tile->GetTexelHeight() > 0)
{
fontdata.Insert('A' + i, tile);
tile->SetOffsetsNotForFont();
}
}
auto BigFont = new ::FFont("TileBigFont", nullptr, nullptr, 0, 0, 0, -1, 10, false, false, false, &fontdata);
BigFont->SetKerning(1);
}
BigFont = V_GetFont("BIGFONT");
SmallFont = V_GetFont("SMALLFONT");
}
//---------------------------------------------------------------------------

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more