summaryrefslogtreecommitdiffstats
path: root/src/render/Font.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/render/Font.h')
-rw-r--r--src/render/Font.h50
1 files changed, 33 insertions, 17 deletions
diff --git a/src/render/Font.h b/src/render/Font.h
index 01d67700..73e9522a 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,18 +49,25 @@ enum
FONT_LANGSET_EFIGS,
FONT_LANGSET_RUSSIAN,
FONT_LANGSET_POLISH,
+ FONT_LANGSET_JAPANESE
LANGSET_MAX
};
#endif
+#define FONTJAP(style) (CFont::LanguageSet == FONT_LANGSET_JAPANESE ? FONT_JAPANESE : style)
+
class CFont
{
#ifdef MORE_LANGUAGES
static int16 Size[LANGSET_MAX][MAX_FONTS][193];
+public:
static uint8 LanguageSet;
+private:
static int32 Slot;
+ static CSprite2d Sprite[4];
#else
static int16 Size[MAX_FONTS][193];
+ static CSprite2d* Sprite; //[3]
#endif
static int16 NewLine;
static CSprite2d Sprite[MAX_FONTS];
@@ -71,17 +81,25 @@ 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*);
+ 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 +158,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(const CRGBA &col);
+ static void SetColor(const CRGBA &col);
+ static void SetDropColor(const 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* a1);
+ static bool IsJapanese() { return LanguageSet == FONT_LANGSET_JAPANESE; }
+ static bool IsJapaneseFont() { return IsJapanese() && (Details.style == FONT_JAPANESE || Details.style == FONT_PAGER); }
+#endif
};