mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 21:21:04 +00:00
- fixed: in order to ensure that all font characters are of texture type FontChar it is necessary to clone the texture instead of changing its use type.
The use type is being used for texture lookup, so changing this alters the texture lookup rules and may cause return of incorrect textures. This also ensures that context depending upscaling rules get used, because FontChars are separate from regular textures.
This commit is contained in:
parent
afe4a45a76
commit
53c2d7e8d2
2 changed files with 15 additions and 9 deletions
|
@ -318,10 +318,13 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
}
|
||||
}
|
||||
|
||||
pic->SetUseType(ETextureType::FontChar);
|
||||
Chars[i].OriginalPic = new FImageTexture(pic->GetImage(), "");
|
||||
Chars[i].OriginalPic->SetUseType(ETextureType::FontChar);
|
||||
Chars[i].OriginalPic->CopySize(pic);
|
||||
TexMan.AddTexture(Chars[i].OriginalPic);
|
||||
|
||||
if (!noTranslate)
|
||||
{
|
||||
Chars[i].OriginalPic = pic;
|
||||
Chars[i].TranslatedPic = new FImageTexture(new FFontChar1(pic->GetImage()), "");
|
||||
Chars[i].TranslatedPic->CopySize(pic);
|
||||
Chars[i].TranslatedPic->SetUseType(ETextureType::FontChar);
|
||||
|
@ -329,7 +332,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
}
|
||||
else
|
||||
{
|
||||
Chars[i].TranslatedPic = pic;
|
||||
Chars[i].TranslatedPic = Chars[i].OriginalPic;
|
||||
}
|
||||
|
||||
Chars[i].XMove = Chars[i].TranslatedPic->GetDisplayWidth();
|
||||
|
@ -444,10 +447,13 @@ void FFont::ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height
|
|||
|
||||
auto b = pic->Get8BitPixels(false);
|
||||
|
||||
Chars[i].OriginalPic = pic;
|
||||
Chars[i].OriginalPic = new FImageTexture(pic->GetImage(), "");
|
||||
Chars[i].OriginalPic->SetUseType(ETextureType::FontChar);
|
||||
Chars[i].OriginalPic->CopySize(pic);
|
||||
Chars[i].TranslatedPic = new FImageTexture(new FFontChar1(pic->GetImage()), "");
|
||||
Chars[i].TranslatedPic->CopySize(pic);
|
||||
Chars[i].TranslatedPic->SetUseType(ETextureType::FontChar);
|
||||
TexMan.AddTexture(Chars[i].OriginalPic);
|
||||
TexMan.AddTexture(Chars[i].TranslatedPic);
|
||||
}
|
||||
Chars[i].XMove = width;
|
||||
|
|
|
@ -102,12 +102,12 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, FTexture **l
|
|||
|
||||
if (charlumps[i] != nullptr)
|
||||
{
|
||||
// If texture is used as a sprite, do not set use type
|
||||
// Changing it would break actors that use this sprite
|
||||
if (charlumps[i]->GetUseType() != ETextureType::Sprite)
|
||||
charlumps[i]->SetUseType(ETextureType::FontChar);
|
||||
auto pic = charlumps[i];
|
||||
Chars[i].OriginalPic = new FImageTexture(pic->GetImage(), "");
|
||||
Chars[i].OriginalPic->SetUseType(ETextureType::FontChar);
|
||||
Chars[i].OriginalPic->CopySize(pic);
|
||||
TexMan.AddTexture(Chars[i].OriginalPic);
|
||||
|
||||
Chars[i].OriginalPic = charlumps[i];
|
||||
if (!noTranslate)
|
||||
{
|
||||
Chars[i].TranslatedPic = new FImageTexture(new FFontChar1 (charlumps[i]->GetImage()), "");
|
||||
|
|
Loading…
Reference in a new issue