mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- made some adjustments to the text spacing on the level summary screen.
With the extended fonts some parts here caused too large gaps.
This commit is contained in:
parent
32dd6b049c
commit
cd7438c02e
5 changed files with 42 additions and 12 deletions
|
@ -290,6 +290,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
||||||
auto count = maxchar - minchar + 1;
|
auto count = maxchar - minchar + 1;
|
||||||
Chars.Resize(count);
|
Chars.Resize(count);
|
||||||
int fontheight = 0;
|
int fontheight = 0;
|
||||||
|
int asciiheight = 0;
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
|
@ -311,6 +312,10 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
||||||
{
|
{
|
||||||
fontheight = height;
|
fontheight = height;
|
||||||
}
|
}
|
||||||
|
if (height > asciiheight && FirstChar + 1 < 128)
|
||||||
|
{
|
||||||
|
asciiheight = height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pic->SetUseType(ETextureType::FontChar);
|
pic->SetUseType(ETextureType::FontChar);
|
||||||
|
@ -352,6 +357,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (FontHeight == 0) FontHeight = fontheight;
|
if (FontHeight == 0) FontHeight = fontheight;
|
||||||
|
if (AsciiHeight == 0) AsciiHeight = asciiheight;
|
||||||
|
|
||||||
FixXMoves();
|
FixXMoves();
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,6 +146,7 @@ protected:
|
||||||
int FirstChar, LastChar;
|
int FirstChar, LastChar;
|
||||||
int SpaceWidth;
|
int SpaceWidth;
|
||||||
int FontHeight;
|
int FontHeight;
|
||||||
|
int AsciiHeight = 0;
|
||||||
int GlobalKerning;
|
int GlobalKerning;
|
||||||
int TranslationType = 0;
|
int TranslationType = 0;
|
||||||
int Displacement = 0;
|
int Displacement = 0;
|
||||||
|
|
|
@ -2000,6 +2000,17 @@ DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetHeight, GetHeight)
|
||||||
ACTION_RETURN_INT(self->GetHeight());
|
ACTION_RETURN_INT(self->GetHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int GetDisplacement(FFont* font)
|
||||||
|
{
|
||||||
|
return font->GetDisplacement();
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetDisplacement, GetDisplacement)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(FFont);
|
||||||
|
ACTION_RETURN_INT(self->GetDisplacement());
|
||||||
|
}
|
||||||
|
|
||||||
double GetBottomAlignOffset(FFont *font, int c);
|
double GetBottomAlignOffset(FFont *font, int c);
|
||||||
DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetBottomAlignOffset, GetBottomAlignOffset)
|
DEFINE_ACTION_FUNCTION_NATIVE(FFont, GetBottomAlignOffset, GetBottomAlignOffset)
|
||||||
{
|
{
|
||||||
|
|
|
@ -322,6 +322,7 @@ struct Font native
|
||||||
native int StringWidth(String code);
|
native int StringWidth(String code);
|
||||||
native bool CanPrint(String code);
|
native bool CanPrint(String code);
|
||||||
native int GetHeight();
|
native int GetHeight();
|
||||||
|
native int GetDisplacement();
|
||||||
native String GetCursor();
|
native String GetCursor();
|
||||||
|
|
||||||
native static int FindFontColor(Name color);
|
native static int FindFontColor(Name color);
|
||||||
|
|
|
@ -149,21 +149,19 @@ class StatusScreen abstract play version("2.5")
|
||||||
//
|
//
|
||||||
//====================================================================
|
//====================================================================
|
||||||
|
|
||||||
int DrawName(int y, TextureID tex, String levelname)
|
int, int DrawName(int y, TextureID tex, String levelname)
|
||||||
{
|
{
|
||||||
// draw <LevelName>
|
// draw <LevelName>
|
||||||
if (tex.isValid())
|
if (tex.isValid())
|
||||||
{
|
{
|
||||||
int w,h;
|
|
||||||
[w, h] = TexMan.GetSize(tex);
|
|
||||||
let size = TexMan.GetScaledSize(tex);
|
let size = TexMan.GetScaledSize(tex);
|
||||||
screen.DrawTexture(tex, true, (screen.GetWidth() - size.X * CleanXfac) /2, y, DTA_CleanNoMove, true);
|
screen.DrawTexture(tex, true, (screen.GetWidth() - size.X * CleanXfac) /2, y, DTA_CleanNoMove, true);
|
||||||
if (h > 50)
|
if (size.Y > 50)
|
||||||
{ // Fix for Deus Vult II and similar wads that decide to make these hugely tall
|
{ // Fix for Deus Vult II and similar wads that decide to make these hugely tall
|
||||||
// patches with vast amounts of empty space at the bottom.
|
// patches with vast amounts of empty space at the bottom.
|
||||||
size.Y = TexMan.CheckRealHeight(tex) * size.Y / h;
|
size.Y = TexMan.CheckRealHeight(tex);
|
||||||
}
|
}
|
||||||
return y + (h + BigFont.GetHeight()/4) * CleanYfac;
|
return y + int(Size.Y), (BigFont.GetHeight() - BigFont.GetDisplacement()) * CleanYfac / 4;
|
||||||
}
|
}
|
||||||
else if (levelname.Length() > 0)
|
else if (levelname.Length() > 0)
|
||||||
{
|
{
|
||||||
|
@ -178,9 +176,9 @@ class StatusScreen abstract play version("2.5")
|
||||||
screen.DrawText(mapname.mFont, mapname.mColor, (screen.GetWidth() - lines.StringWidth(i) * CleanXfac) / 2, y + h, lines.StringAt(i), DTA_CleanNoMove, true);
|
screen.DrawText(mapname.mFont, mapname.mColor, (screen.GetWidth() - lines.StringWidth(i) * CleanXfac) / 2, y + h, lines.StringAt(i), DTA_CleanNoMove, true);
|
||||||
h += lumph;
|
h += lumph;
|
||||||
}
|
}
|
||||||
return y + h + lumph/4;
|
return y + h, (mapname.mFont.GetHeight() - mapname.mFont.GetDisplacement())/4;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0, 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//====================================================================
|
//====================================================================
|
||||||
|
@ -235,11 +233,15 @@ class StatusScreen abstract play version("2.5")
|
||||||
virtual int drawLF ()
|
virtual int drawLF ()
|
||||||
{
|
{
|
||||||
int y = TITLEY * CleanYfac;
|
int y = TITLEY * CleanYfac;
|
||||||
|
int h;
|
||||||
|
|
||||||
|
[y, h] = DrawName(y, wbs.LName0, lnametexts[0]);
|
||||||
|
|
||||||
y = DrawName(y, wbs.LName0, lnametexts[0]);
|
|
||||||
|
|
||||||
// Adjustment for different font sizes for map name and 'finished'.
|
// Adjustment for different font sizes for map name and 'finished'.
|
||||||
y -= ((mapname.mFont.GetHeight() - finished.mFont.GetHeight()) * CleanYfac) / 4;
|
let fontspace1 = finished.mFont.GetDisplacement();
|
||||||
|
let fontspace2 = ((h + (finished.mFont.GetHeight() - fontspace1)/4)) / 2;
|
||||||
|
|
||||||
|
y += max(0, fontspace2 - fontspace1) * CleanYFac;
|
||||||
|
|
||||||
// draw "Finished!"
|
// draw "Finished!"
|
||||||
|
|
||||||
|
@ -267,7 +269,16 @@ class StatusScreen abstract play version("2.5")
|
||||||
int y = TITLEY * CleanYfac;
|
int y = TITLEY * CleanYfac;
|
||||||
|
|
||||||
y = DrawPatchOrText(y, entering, enteringPatch, "$WI_ENTERING");
|
y = DrawPatchOrText(y, entering, enteringPatch, "$WI_ENTERING");
|
||||||
y += entering.mFont.GetHeight() * CleanYfac / 4;
|
let h = (entering.mFont.GetHeight() - entering.mFont.GetDisplacement()) / 4;
|
||||||
|
|
||||||
|
if (!wbs.LName1.isValid())
|
||||||
|
{
|
||||||
|
// Factor out the font's displacement here.
|
||||||
|
let fontspace1 = mapname.mFont.GetDisplacement();
|
||||||
|
let fontspace2 = ((h + (mapname.mFont.GetHeight() - fontspace1)/4)) / 2;
|
||||||
|
h = max(0, fontspace2 - fontspace1) * CleanYFac;
|
||||||
|
}
|
||||||
|
y += h * CleanYFac;
|
||||||
DrawName(y, wbs.LName1, lnametexts[1]);
|
DrawName(y, wbs.LName1, lnametexts[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue