Revert font overhaul. Back to non-replacing fonts.

This commit is contained in:
Mari the Deer 2022-04-05 12:29:16 +02:00
commit f776ab126b
39 changed files with 507 additions and 680 deletions

View file

@ -8,9 +8,11 @@ Class SWWMCreditsEntry ui
BrokenLines btext;
int width, height;
int titlecol, btextcol;
Font mSmallFont;
SWWMCreditsEntry Init( String t, String b = "", int c1 = Font.CR_SAPPHIRE, int c2 = Font.CR_WHITE, bool mari = false )
{
mSmallFont = Font.GetFont('TewiFont');
if ( mari )
{
MariHack = true;
@ -29,7 +31,7 @@ Class SWWMCreditsEntry ui
return self;
}
String b2 = StringTable.Localize(b);
btext = smallfont.BreakLines(b2,320);
btext = mSmallFont.BreakLines(b2,320);
width = CalcWidth();
height = CalcHeight();
return self;
@ -43,7 +45,7 @@ Class SWWMCreditsEntry ui
private int CalcWidth()
{
int len = smallfont.StringWidth(title);
int len = mSmallFont.StringWidth(title);
if ( !btext ) return len;
for ( int i=0; i<btext.Count(); i++ )
{
@ -57,10 +59,10 @@ Class SWWMCreditsEntry ui
{
int h = 0;
if ( MariHack ) h = 148;
h += smallfont.GetHeight();
h += mSmallFont.GetHeight();
if ( !btext ) return h;
h += 6;
h += smallfont.GetHeight()*btext.Count();
h += mSmallFont.GetHeight()*btext.Count();
return h;
}
@ -85,21 +87,21 @@ Class SWWMCreditsEntry ui
yy += 148;
Screen.DrawTexture(MariSprite[cur],false,x,yy,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
}
int w = smallfont.StringWidth(title);
int w = mSmallFont.StringWidth(title);
double xx = x-w/2;
Screen.DrawText(smallfont,titlecol,xx,yy,title,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
Screen.DrawText(mSmallFont,titlecol,xx,yy,title,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
if ( !btext ) return height;
// underline
int cw = int(ceil((w+8)/6.))*6;
xx = x-cw/2;
for ( int i=0; i<cw; i+=6 )
Screen.DrawChar(smallfont,titlecol,xx+i,yy+6,0x5F,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
yy += smallfont.GetHeight()+6;
Screen.DrawChar(mSmallFont,titlecol,xx+i,yy+6,0x5F,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
yy += mSmallFont.GetHeight()+6;
for ( int i=0; i<btext.Count(); i++ )
{
xx = x-(btext.StringWidth(i))/2;
Screen.DrawText(smallfont,btextcol,xx,yy,btext.StringAt(i),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
yy += smallfont.GetHeight();
Screen.DrawText(mSmallFont,btextcol,xx,yy,btext.StringAt(i),DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
yy += mSmallFont.GetHeight();
}
return height;
}
@ -117,6 +119,7 @@ Class SWWMCreditsMenu : GenericMenu
double hs;
Vector2 logosz;
double logow, logoh;
Font mSmallFont, mBigFont;
String oldmus;
int oldorder;
@ -138,6 +141,8 @@ Class SWWMCreditsMenu : GenericMenu
override void Init( Menu parent )
{
Super.Init(parent);
mSmallFont = Font.GetFont('TewiFont');
mBigFont = Font.GetFont('TewiFontOutline');
bgtex = TexMan.CheckForTexture("graphics/tempbg.png",TexMan.Type_Any);
UpdateSize();
logo = TexMan.CheckForTexture(swwm_oldlogo?"graphics/M_SWWM.png":"graphics/M_DEMOLITIONIST.png",TexMan.Type_Any);
@ -221,7 +226,7 @@ Class SWWMCreditsMenu : GenericMenu
spos = ss.y-logosz.y;
// calc total height
theight = int(logosz.y);
theight += 8*(SECTION_PAD+bigfont.GetHeight());
theight += 8*(SECTION_PAD+mBigFont.GetHeight()*2);
for ( int i=0; i<cdev.Size(); i++ )
{
theight += ENTRY_PAD;
@ -274,23 +279,23 @@ Class SWWMCreditsMenu : GenericMenu
if ( (y+logosz.y < 0) || (y > ss.y) ) return logosz.y;
if ( swwm_oldlogo ) Screen.DrawTexture(logo,true,x-logosz.x/2,y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
else Screen.DrawTexture(logo,true,x-logosz.x/2,y,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ScaleX,(2./3.),DTA_ScaleY,(2./3.));
Screen.DrawText(smallfont,Font.CR_SAPPHIRE,x-smallfont.StringWidth(stitle)/2,y+(logosz.y-28),stitle,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
Screen.DrawText(mSmallFont,Font.CR_SAPPHIRE,x-mSmallFont.StringWidth(stitle)/2,y+(logosz.y-28),stitle,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
// underline
int w = max(smallfont.StringWidth(stitle),smallfont.StringWidth(stitle2));
int w = max(mSmallFont.StringWidth(stitle),mSmallFont.StringWidth(stitle2));
int cw = int(ceil((w+8)/6.))*6;
double xx = x-cw/2;
for ( int i=0; i<cw; i+=6 )
Screen.DrawChar(smallfont,Font.CR_SAPPHIRE,xx+i,y+(logosz.y-22),0x5F,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
Screen.DrawText(smallfont,Font.CR_WHITE,x-smallfont.StringWidth(stitle2)/2,y+(logosz.y-9),stitle2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
Screen.DrawChar(mSmallFont,Font.CR_SAPPHIRE,xx+i,y+(logosz.y-22),0x5F,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
Screen.DrawText(mSmallFont,Font.CR_WHITE,x-mSmallFont.StringWidth(stitle2)/2,y+(logosz.y-9),stitle2,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
return logosz.y;
}
double DrawSection( double x, double y, String txt )
{
// don't draw if we're offscreen, saves time
y += SECTION_SHIFT;
if ( (y+bigfont.GetHeight() < 0) || (y > ss.y) ) return bigfont.GetHeight();
Screen.DrawText(bigfont,Font.CR_BLUE,x-bigfont.StringWidth(txt)/2,y,txt,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true);
return bigfont.GetHeight();
if ( (y+mBigFont.GetHeight()*2 < 0) || (y > ss.y) ) return mBigFont.GetHeight()*2;
Screen.DrawText(mBigFont,Font.CR_BLUE,x-mBigFont.StringWidth(txt),y,txt,DTA_VirtualWidthF,ss.x,DTA_VirtualHeightF,ss.y,DTA_KeepRatio,true,DTA_ScaleX,2,DTA_ScaleY,2);
return mBigFont.GetHeight()*2;
}
override void Drawer()
{