summaryrefslogtreecommitdiffstats
path: root/src/render/Font.h
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-04-29 10:26:36 +0200
committerGitHub <noreply@github.com>2020-04-29 10:26:36 +0200
commit4e630a1a38246a9dd909261cbf5fa598d43140e8 (patch)
treed12b2e77241f79bb143e91bac7e669ae96ea229b /src/render/Font.h
parentMerge pull request #498 from Sergeanur/premakestuff (diff)
parentFixes (diff)
downloadre3-4e630a1a38246a9dd909261cbf5fa598d43140e8.tar
re3-4e630a1a38246a9dd909261cbf5fa598d43140e8.tar.gz
re3-4e630a1a38246a9dd909261cbf5fa598d43140e8.tar.bz2
re3-4e630a1a38246a9dd909261cbf5fa598d43140e8.tar.lz
re3-4e630a1a38246a9dd909261cbf5fa598d43140e8.tar.xz
re3-4e630a1a38246a9dd909261cbf5fa598d43140e8.tar.zst
re3-4e630a1a38246a9dd909261cbf5fa598d43140e8.zip
Diffstat (limited to 'src/render/Font.h')
-rw-r--r--src/render/Font.h51
1 files changed, 34 insertions, 17 deletions
diff --git a/src/render/Font.h b/src/render/Font.h
index 01d67700..9b4e7132 100644
--- a/src/render/Font.h
+++ b/src/render/Font.h
@@ -31,6 +31,9 @@ enum {
FONT_BANK,
FONT_PAGER,
FONT_HEADING,
+#ifdef MORE_LANGUAGES
+ FONT_JAPANESE,
+#endif
MAX_FONTS
};
@@ -46,8 +49,13 @@ enum
FONT_LANGSET_EFIGS,
FONT_LANGSET_RUSSIAN,
FONT_LANGSET_POLISH,
+ FONT_LANGSET_JAPANESE,
LANGSET_MAX
};
+
+#define FONT_LOCALE(style) (CFont::IsJapanese() ? FONT_JAPANESE : style)
+#else
+#define FONT_LOCALE(style) (style)
#endif
class CFont
@@ -71,17 +79,28 @@ public:
static void PrintString(float x, float y, wchar *s);
static int GetNumberLines(float xstart, float ystart, wchar *s);
static void GetTextRect(CRect *rect, float xstart, float ystart, wchar *s);
+#ifdef MORE_LANGUAGES
+ static bool PrintString(float x, float y, wchar *start, wchar* &end, float spwidth, float japX);
+#else
static void PrintString(float x, float y, wchar *start, wchar *end, float spwidth);
+#endif
static float GetCharacterWidth(wchar c);
static float GetCharacterSize(wchar c);
static float GetStringWidth(wchar *s, bool spaces = false);
- static wchar *GetNextSpace(wchar *s);
- static wchar *ParseToken(wchar *s, wchar*);
+#ifdef MORE_LANGUAGES
+ static float GetStringWidth_Jap(wchar* s);
+#endif
+ static uint16 *GetNextSpace(wchar *s);
+#ifdef MORE_LANGUAGES
+ static uint16 *ParseToken(wchar *s, wchar*, bool japShit = false);
+#else
+ static uint16 *ParseToken(wchar *s, wchar*);
+#endif
static void DrawFonts(void);
- static wchar character_code(uint8 c);
+ static uint16 character_code(uint8 c);
static CFontDetails GetDetails() { return Details; }
- static void SetScale(float x, float y) { Details.scaleX = x; Details.scaleY = y; }
+ static void SetScale(float x, float y);
static void SetSlantRefPoint(float x, float y) { Details.slantRefX = x; Details.slantRefY = y; }
static void SetSlant(float s) { Details.slant = s; }
static void SetJustifyOn(void) {
@@ -140,19 +159,17 @@ public:
static void SetRightJustifyWrap(float wrap) { Details.rightJustifyWrap = wrap; }
static void SetAlphaFade(float fade) { Details.alphaFade = fade; }
static void SetDropShadowPosition(int16 pos) { Details.dropShadowPosition = pos; }
+ static void SetBackgroundColor(CRGBA col);
+ static void SetColor(CRGBA col);
+ static void SetDropColor(CRGBA col);
- // TODO: really just CRGBA but that isn't passed correctly
- static void SetBackgroundColor(const CRGBA &col) { Details.backgroundColor = col; }
- static void SetColor(const CRGBA &col) {
- Details.color = col;
- if(Details.alphaFade < 255.0f)
- Details.color.a *= Details.alphaFade/255.0f;
- }
- static void SetDropColor(const CRGBA &col) {
- Details.dropColor = col;
- if(Details.alphaFade < 255.0f)
- Details.dropColor.a *= Details.alphaFade/255.0f;
- }
-
+#ifdef MORE_LANGUAGES
static void ReloadFonts(uint8 set);
+
+ // japanese stuff
+ static bool IsAnsiCharacter(wchar* s);
+ static bool IsJapanesePunctuation(wchar* str);
+ static bool IsJapanese() { return LanguageSet == FONT_LANGSET_JAPANESE; }
+ static bool IsJapaneseFont() { return IsJapanese() && (Details.style == FONT_JAPANESE || Details.style == FONT_PAGER); }
+#endif
};