mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 04:00:42 +00:00
- font system fixes.
This commit is contained in:
parent
d44500863b
commit
22be26bd2d
3 changed files with 20 additions and 2 deletions
|
@ -656,6 +656,10 @@ int FFont::GetLuminosity (uint32_t *colorsused, TArray<double> &Luminosity, int*
|
|||
|
||||
int FFont::GetColorTranslation (EColorRange range, PalEntry *color) const
|
||||
{
|
||||
// Single pic fonts do not set up their translation table and must always return 0.
|
||||
if (Translations.Size() == 0) return 0;
|
||||
assert(Translations.Size() == NumTextColors);
|
||||
|
||||
if (noTranslate)
|
||||
{
|
||||
PalEntry retcolor = PalEntry(255, 255, 255, 255);
|
||||
|
|
|
@ -141,6 +141,17 @@ void FSpecialFont::LoadTranslations()
|
|||
{
|
||||
FFont::LoadTranslations();
|
||||
|
||||
bool empty = true;
|
||||
for (auto& c : Chars)
|
||||
{
|
||||
if (c.OriginalPic != nullptr)
|
||||
{
|
||||
empty = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (empty) return; // Font has no characters.
|
||||
|
||||
bool needsnotrans = false;
|
||||
// exclude the non-translated colors from the translation calculation
|
||||
for (int i = 0; i < 256; i++)
|
||||
|
|
|
@ -714,13 +714,16 @@ static void CalcDefaultTranslation(FFont* base, int index)
|
|||
{
|
||||
int index = int(lum * 255);
|
||||
remap[index] = GPalette.BaseColors[i];
|
||||
remap[index].a = 255;
|
||||
}
|
||||
}
|
||||
|
||||
// todo: fill the gaps.
|
||||
remap[0] = 0;
|
||||
//remap[0] = 0;
|
||||
int lowindex = 0;
|
||||
int highindex = 1;
|
||||
while (lowindex < 255 && remap[lowindex].a == 0) lowindex++;
|
||||
lowindex++;
|
||||
int highindex = lowindex + 1;
|
||||
|
||||
while (lowindex < 255)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue