From caa7d3177c691a83ba3642737eb58c1fe5eb600f Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 16 Jan 2021 16:05:27 +0200 Subject: Use of sized bool types for CFont --- src/render/Font.cpp | 159 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 144 insertions(+), 15 deletions(-) (limited to 'src/render/Font.cpp') diff --git a/src/render/Font.cpp b/src/render/Font.cpp index 8c183641..7eed0933 100644 --- a/src/render/Font.cpp +++ b/src/render/Font.cpp @@ -34,7 +34,7 @@ UnicodeStrlen(const wchar *str) } CFontDetails CFont::Details; -int16 CFont::NewLine; +bool16 CFont::NewLine; CSprite2d CFont::Sprite[MAX_FONTS]; #ifdef MORE_LANGUAGES @@ -454,7 +454,7 @@ CFont::InitPerFrame(void) CSprite2d::GetBank(15, Sprite[3].m_pTexture); #endif SetDropShadowPosition(0); - NewLine = 0; + NewLine = false; #ifdef BUTTON_ICONS PS2Symbol = BUTTON_NONE; #endif @@ -1048,7 +1048,6 @@ CFont::PrintString(float x, float y, wchar *start, wchar *end, float spwidth) } #endif -#ifdef XBOX_SUBTITLES void CFont::PrintStringFromBottom(float x, float y, wchar *str) { @@ -1061,6 +1060,7 @@ CFont::PrintStringFromBottom(float x, float y, wchar *str) PrintString(x, y, str); } +#ifdef XBOX_SUBTITLES void CFont::PrintOutlinedString(float x, float y, wchar *str, float outlineStrength, bool fromBottom, CRGBA outlineColor) { @@ -1263,7 +1263,6 @@ CFont::GetStringWidth(wchar *s, bool spaces) return w; } - #ifdef MORE_LANGUAGES float CFont::GetStringWidth_Jap(wchar* s) @@ -1384,7 +1383,7 @@ CFont::ParseToken(wchar *s, wchar*) switch(*s){ case 'N': case 'n': - NewLine = 1; + NewLine = true; break; case 'b': SetColor(CRGBA(128, 167, 243, 255)); break; case 'g': SetColor(CRGBA(95, 160, 106, 255)); break; @@ -1430,14 +1429,6 @@ CFont::DrawFonts(void) #endif } -wchar -CFont::character_code(uint8 c) -{ - if(c < 128) - return c; - return foreign_table[c-128]; -} - void CFont::SetScale(float x, float y) @@ -1453,9 +1444,16 @@ CFont::SetScale(float x, float y) } void -CFont::SetBackgroundColor(CRGBA col) +CFont::SetSlantRefPoint(float x, float y) { - Details.backgroundColor = col; + Details.slantRefX = x; + Details.slantRefY = y; +} + +void +CFont::SetSlant(float s) +{ + Details.slant = s; } void @@ -1466,6 +1464,123 @@ CFont::SetColor(CRGBA col) Details.color.a *= Details.alphaFade / 255.0f; } +void +CFont::SetJustifyOn(void) +{ + Details.justify = true; + Details.centre = false; + Details.rightJustify = false; +} + +void +CFont::SetJustifyOff(void) +{ + Details.justify = false; + Details.rightJustify = false; +} + +void +CFont::SetCentreOn(void) +{ + Details.centre = true; + Details.justify = false; + Details.rightJustify = false; +} + +void +CFont::SetCentreOff(void) +{ + Details.centre = false; +} + +void +CFont::SetWrapx(float x) +{ + Details.wrapX = x; +} + +void +CFont::SetCentreSize(float s) +{ + Details.centreSize = s; +} + +void +CFont::SetBackgroundOn(void) +{ + Details.background = true; +} + +void +CFont::SetBackgroundOff(void) +{ + Details.background = false; +} + +void +CFont::SetBackgroundColor(CRGBA col) +{ + Details.backgroundColor = col; +} + +void +CFont::SetBackGroundOnlyTextOn(void) +{ + Details.backgroundOnlyText = true; +} + +void +CFont::SetBackGroundOnlyTextOff(void) +{ + Details.backgroundOnlyText = false; +} + +void +CFont::SetRightJustifyOn(void) +{ + Details.rightJustify = true; + Details.justify = false; + Details.centre = false; +} + +void +CFont::SetRightJustifyOff(void) +{ + Details.rightJustify = false; + Details.justify = false; + Details.centre = false; +} + +void +CFont::SetPropOn(void) +{ + Details.proportional = true; +} + +void +CFont::SetPropOff(void) +{ + Details.proportional = false; +} + +void +CFont::SetFontStyle(int16 style) +{ + Details.style = style; +} + +void +CFont::SetRightJustifyWrap(float wrap) +{ + Details.rightJustifyWrap = wrap; +} + +void +CFont::SetAlphaFade(float fade) +{ + Details.alphaFade = fade; +} + void CFont::SetDropColor(CRGBA col) { @@ -1473,3 +1588,17 @@ CFont::SetDropColor(CRGBA col) if (Details.alphaFade < 255.0f) Details.dropColor.a *= Details.alphaFade / 255.0f; } + +void +CFont::SetDropShadowPosition(int16 pos) +{ + Details.dropShadowPosition = pos; +} + +wchar +CFont::character_code(uint8 c) +{ + if(c < 128) + return c; + return foreign_table[c-128]; +} \ No newline at end of file -- cgit v1.2.3