summaryrefslogtreecommitdiffstats
path: root/src/render/Font.cpp
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-11-19 15:21:22 +0100
committeraap <aap@papnet.eu>2020-11-19 15:21:22 +0100
commit856e424c76df4251a45c4f64e9f3102201fae236 (patch)
treec8c8180677d54bb0c9d63b347de93b2cbc9f3f52 /src/render/Font.cpp
parentno static runtime for external librw (diff)
parentMerge pull request #822 from aap/master (diff)
downloadre3-856e424c76df4251a45c4f64e9f3102201fae236.tar
re3-856e424c76df4251a45c4f64e9f3102201fae236.tar.gz
re3-856e424c76df4251a45c4f64e9f3102201fae236.tar.bz2
re3-856e424c76df4251a45c4f64e9f3102201fae236.tar.lz
re3-856e424c76df4251a45c4f64e9f3102201fae236.tar.xz
re3-856e424c76df4251a45c4f64e9f3102201fae236.tar.zst
re3-856e424c76df4251a45c4f64e9f3102201fae236.zip
Diffstat (limited to 'src/render/Font.cpp')
-rw-r--r--src/render/Font.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/render/Font.cpp b/src/render/Font.cpp
index fbcc38e4..42ddd0fb 100644
--- a/src/render/Font.cpp
+++ b/src/render/Font.cpp
@@ -942,6 +942,40 @@ 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)
+{
+#ifdef MORE_LANGUAGES
+ if (IsJapaneseFont())
+ y -= (32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY) * GetNumberLines(x, y, str);
+ else
+#endif
+ y -= (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * GetNumberLines(x, y, str);
+ PrintString(x, y, str);
+}
+
+void
+CFont::PrintOutlinedString(float x, float y, wchar *str, float outlineStrength, bool fromBottom, CRGBA outlineColor)
+{
+ CRGBA textColor = Details.color;
+ SetColor(outlineColor);
+ CVector2D offsets[] = { {1.f, 1.f}, {1.f, -1.f}, {-1.f, 1.f}, {-1.f, -1.f} };
+ for(int i = 0; i < ARRAY_SIZE(offsets); i++){
+ if (fromBottom)
+ PrintStringFromBottom(x + SCREEN_SCALE_X(offsets[i].x * outlineStrength), y + SCREEN_SCALE_Y(offsets[i].y * outlineStrength), str);
+ else
+ PrintString(x + SCREEN_SCALE_X(offsets[i].x * outlineStrength), y + SCREEN_SCALE_Y(offsets[i].y * outlineStrength), str);
+ }
+ SetColor(textColor);
+
+ if (fromBottom)
+ PrintStringFromBottom(x, y, str);
+ else
+ PrintString(x, y, str);
+}
+#endif
+
float
CFont::GetCharacterWidth(wchar c)
{