mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 21:21:04 +00:00
- Backported SPACEWIDTH for fontdefs from ECWolf.
SVN r3811 (trunk)
This commit is contained in:
parent
6af0744f75
commit
5f4889d99e
2 changed files with 17 additions and 4 deletions
|
@ -339,7 +339,7 @@ FArchive &SerializeFFontPtr (FArchive &arc, FFont* &font)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FFont::FFont (const char *name, const char *nametemplate, int first, int count, int start, int fdlump)
|
||||
FFont::FFont (const char *name, const char *nametemplate, int first, int count, int start, int fdlump, int spacewidth)
|
||||
{
|
||||
int i;
|
||||
FTextureID lump;
|
||||
|
@ -422,7 +422,11 @@ FFont::FFont (const char *name, const char *nametemplate, int first, int count,
|
|||
}
|
||||
}
|
||||
|
||||
if ('N'-first >= 0 && 'N'-first < count && Chars['N' - first].Pic != NULL)
|
||||
if (spacewidth != -1)
|
||||
{
|
||||
SpaceWidth = spacewidth;
|
||||
}
|
||||
else if ('N'-first >= 0 && 'N'-first < count && Chars['N' - first].Pic != NULL)
|
||||
{
|
||||
SpaceWidth = (Chars['N' - first].XMove + 1) / 2;
|
||||
}
|
||||
|
@ -2056,6 +2060,7 @@ void V_InitCustomFonts()
|
|||
int start;
|
||||
int first;
|
||||
int count;
|
||||
int spacewidth;
|
||||
char cursor = '_';
|
||||
|
||||
while ((llump = Wads.FindLump ("FONTDEFS", &lastlump)) != -1)
|
||||
|
@ -2070,6 +2075,7 @@ void V_InitCustomFonts()
|
|||
start = 33;
|
||||
first = 33;
|
||||
count = 223;
|
||||
spacewidth = -1;
|
||||
|
||||
sc.MustGetStringName ("{");
|
||||
while (!sc.CheckString ("}"))
|
||||
|
@ -2108,6 +2114,13 @@ void V_InitCustomFonts()
|
|||
sc.MustGetString();
|
||||
cursor = sc.String[0];
|
||||
}
|
||||
else if (sc.Compare ("SPACEWIDTH"))
|
||||
{
|
||||
if (format == 2) goto wrong;
|
||||
sc.MustGetNumber();
|
||||
spacewidth = sc.Number;
|
||||
format = 1;
|
||||
}
|
||||
else if (sc.Compare ("NOTRANSLATION"))
|
||||
{
|
||||
if (format == 1) goto wrong;
|
||||
|
@ -2151,7 +2164,7 @@ void V_InitCustomFonts()
|
|||
}
|
||||
if (format == 1)
|
||||
{
|
||||
FFont *fnt = new FFont (namebuffer, templatebuf, first, count, start, llump);
|
||||
FFont *fnt = new FFont (namebuffer, templatebuf, first, count, start, llump, spacewidth);
|
||||
fnt->SetCursor(cursor);
|
||||
}
|
||||
else if (format == 2)
|
||||
|
|
|
@ -76,7 +76,7 @@ extern int NumTextColors;
|
|||
class FFont
|
||||
{
|
||||
public:
|
||||
FFont (const char *fontname, const char *nametemplate, int first, int count, int base, int fdlump);
|
||||
FFont (const char *fontname, const char *nametemplate, int first, int count, int base, int fdlump, int spacewidth=-1);
|
||||
virtual ~FFont ();
|
||||
|
||||
virtual FTexture *GetChar (int code, int *const width) const;
|
||||
|
|
Loading…
Reference in a new issue