- font side support for 'OffsetsNotForFont' flag.

This commit is contained in:
Christoph Oelckers 2020-09-27 11:40:03 +02:00
parent b3a179b691
commit 6dd6df96e1
3 changed files with 9 additions and 9 deletions

View file

@ -328,14 +328,14 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
auto orig = pic->GetTexture();
auto tex = MakeGameTexture(orig, nullptr, ETextureType::FontChar);
tex->CopySize(pic);
tex->CopySize(pic, true);
TexMan.AddGameTexture(tex);
Chars[i].OriginalPic = tex;
if (!noTranslate)
{
Chars[i].TranslatedPic = MakeGameTexture(new FImageTexture(new FFontChar1(orig->GetImage())), nullptr, ETextureType::FontChar);
Chars[i].TranslatedPic->CopySize(pic);
Chars[i].TranslatedPic->CopySize(pic, true);
TexMan.AddGameTexture(Chars[i].TranslatedPic);
}
else
@ -441,9 +441,9 @@ void FFont::ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height
auto pic = (*lump)->GetTexture();
Chars[i].OriginalPic = (*lump)->GetUseType() == ETextureType::FontChar? (*lump) : MakeGameTexture(pic, nullptr, ETextureType::FontChar);
Chars[i].OriginalPic->SetUseType(ETextureType::FontChar);
Chars[i].OriginalPic->CopySize(*lump);
Chars[i].OriginalPic->CopySize(*lump, true);
Chars[i].TranslatedPic = MakeGameTexture(new FImageTexture(new FFontChar1(pic->GetImage())), nullptr, ETextureType::FontChar);
Chars[i].TranslatedPic->CopySize(*lump);
Chars[i].TranslatedPic->CopySize(*lump, true);
Chars[i].TranslatedPic->SetUseType(ETextureType::FontChar);
if (Chars[i].OriginalPic != *lump) TexMan.AddGameTexture(Chars[i].OriginalPic);
TexMan.AddGameTexture(Chars[i].TranslatedPic);
@ -860,7 +860,7 @@ int FFont::GetColorTranslation (EColorRange range, PalEntry *color) const
}
if (color != nullptr) *color = retcolor;
}
if (ActiveColors == 0)
if (ActiveColors == 0 || range == CR_UNDEFINED)
return -1;
else if (range >= NumTextColors)
range = CR_UNTRANSLATED;
@ -977,7 +977,7 @@ FGameTexture *FFont::GetChar (int code, int translation, int *const width, bool
if (code < 0) return nullptr;
if (translation == CR_UNTRANSLATED && !forceremap)
if ((translation == CR_UNTRANSLATED || translation == CR_UNDEFINED) && !forceremap)
{
bool redirect = Chars[code].OriginalPic && Chars[code].OriginalPic != Chars[code].TranslatedPic;
if (redirected) *redirected = redirect;

View file

@ -46,7 +46,7 @@ public:
// FFont interface
FGameTexture *GetChar(int code, int translation, int *const width, bool *redirected = nullptr) const override;
int GetCharWidth (int code) const;
int GetCharWidth (int code) const override;
protected:
FTextureID PicNum;

View file

@ -105,13 +105,13 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, FGameTexture
{
auto pic = charlumps[i];
Chars[i].OriginalPic = MakeGameTexture(pic->GetTexture(), nullptr, ETextureType::FontChar);
Chars[i].OriginalPic->CopySize(pic);
Chars[i].OriginalPic->CopySize(pic, true);
TexMan.AddGameTexture(Chars[i].OriginalPic);
if (!noTranslate)
{
Chars[i].TranslatedPic = MakeGameTexture(new FImageTexture(new FFontChar1 (charlumps[i]->GetTexture()->GetImage())), nullptr, ETextureType::FontChar);
Chars[i].TranslatedPic->CopySize(charlumps[i]);
Chars[i].TranslatedPic->CopySize(charlumps[i], true);
TexMan.AddGameTexture(Chars[i].TranslatedPic);
}
else Chars[i].TranslatedPic = Chars[i].OriginalPic;