mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-07-20 15:00:36 +00:00
feat: font generation from ttf (#882)
* chore: add file variant of json fonts * chore: add stb dependency * feat: generate fonts from ttf files * chore: add option to add yOffset to file font * chore: dynamically adjust generated font bitmap size * fix: printable characters should respect ISO-8859-1 control characters * chore: do not write missing glyphs into the bitmap * chore: remove test texture conversion * chore: adjust font compiler for iw3,iw4,iw5,t4,t5 * chore: add possibility to fill color channels when converting * fix: games other than t6 use rgba for fonts * fix: make sure no mipmaps are set on loaddef * fix: t4 and iw3 use dimensions in image loaddef * chore: also include optional glyphs in fonts
This commit is contained in:
@@ -13,6 +13,7 @@ namespace font
|
||||
return path.string();
|
||||
}
|
||||
|
||||
// ISO-8859-1
|
||||
bool IsPrintableLetter(const unsigned letter)
|
||||
{
|
||||
// Control characters
|
||||
@@ -23,25 +24,17 @@ namespace font
|
||||
if (letter < 0x7F)
|
||||
return true;
|
||||
|
||||
// 0xA0 is not a control character but NBSP that just looks like a space
|
||||
if (letter < 0xA1)
|
||||
return false;
|
||||
|
||||
// There are characters after this point that are printable as well
|
||||
// But they don't seem to play a role in cod fonts
|
||||
if (letter > 0xFF)
|
||||
return false;
|
||||
|
||||
switch (letter)
|
||||
{
|
||||
case 0x7F:
|
||||
case 0x81:
|
||||
case 0x8D:
|
||||
case 0x8F:
|
||||
case 0x90:
|
||||
case 0x9D:
|
||||
case 0xA0:
|
||||
case 0xAD:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
// 0xAD is soft hyphen
|
||||
return letter != 0xAD;
|
||||
}
|
||||
|
||||
std::string LetterToString(const unsigned letter)
|
||||
|
||||
Reference in New Issue
Block a user