summaryrefslogtreecommitdiff
path: root/core/src/fxge/apple/fx_mac_imp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fxge/apple/fx_mac_imp.cpp')
-rw-r--r--core/src/fxge/apple/fx_mac_imp.cpp149
1 files changed, 77 insertions, 72 deletions
diff --git a/core/src/fxge/apple/fx_mac_imp.cpp b/core/src/fxge/apple/fx_mac_imp.cpp
index 1bcbc9d194..9918ba97e8 100644
--- a/core/src/fxge/apple/fx_mac_imp.cpp
+++ b/core/src/fxge/apple/fx_mac_imp.cpp
@@ -8,10 +8,9 @@
#include "apple_int.h"
#if _FX_OS_ == _FX_MACOSX_
static const struct {
- const FX_CHAR* m_pName;
- const FX_CHAR* m_pSubstName;
-}
-Base14Substs[] = {
+ const FX_CHAR* m_pName;
+ const FX_CHAR* m_pSubstName;
+} Base14Substs[] = {
{"Courier", "Courier New"},
{"Courier-Bold", "Courier New Bold"},
{"Courier-BoldOblique", "Courier New Bold Italic"},
@@ -25,82 +24,88 @@ Base14Substs[] = {
{"Times-BoldItalic", "Times New Roman Bold Italic"},
{"Times-Italic", "Times New Roman Italic"},
};
-class CFX_MacFontInfo : public CFX_FolderFontInfo
-{
-public:
- virtual void* MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, int& iExact);
+class CFX_MacFontInfo : public CFX_FolderFontInfo {
+ public:
+ virtual void* MapFont(int weight,
+ FX_BOOL bItalic,
+ int charset,
+ int pitch_family,
+ const FX_CHAR* family,
+ int& iExact);
};
#define JAPAN_GOTHIC "Hiragino Kaku Gothic Pro W6"
#define JAPAN_MINCHO "Hiragino Mincho Pro W6"
-static void GetJapanesePreference(CFX_ByteString& face, int weight, int picth_family)
-{
- if (face.Find("Gothic") >= 0) {
- face = JAPAN_GOTHIC;
- return;
- }
- if (!(picth_family & FXFONT_FF_ROMAN) && weight > 400) {
- face = JAPAN_GOTHIC;
- } else {
- face = JAPAN_MINCHO;
- }
+static void GetJapanesePreference(CFX_ByteString& face,
+ int weight,
+ int picth_family) {
+ if (face.Find("Gothic") >= 0) {
+ face = JAPAN_GOTHIC;
+ return;
+ }
+ if (!(picth_family & FXFONT_FF_ROMAN) && weight > 400) {
+ face = JAPAN_GOTHIC;
+ } else {
+ face = JAPAN_MINCHO;
+ }
}
-void* CFX_MacFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* cstr_face, int& iExact)
-{
- CFX_ByteString face = cstr_face;
- int iBaseFont;
- for (iBaseFont = 0; iBaseFont < 12; iBaseFont ++)
- if (face == CFX_ByteStringC(Base14Substs[iBaseFont].m_pName)) {
- face = Base14Substs[iBaseFont].m_pSubstName;
- iExact = TRUE;
- break;
- }
- if (iBaseFont < 12) {
- return GetFont(face);
- }
- void* p;
- if (m_FontList.Lookup(face, p)) {
- return p;
- }
- if (charset == FXFONT_ANSI_CHARSET && (pitch_family & FXFONT_FF_FIXEDPITCH)) {
- return GetFont("Courier New");
- }
- if (charset == FXFONT_ANSI_CHARSET || charset == FXFONT_SYMBOL_CHARSET) {
- return NULL;
- }
- switch (charset) {
- case FXFONT_SHIFTJIS_CHARSET:
- GetJapanesePreference(face, weight, pitch_family);
- break;
- case FXFONT_GB2312_CHARSET:
- face = "STSong";
- break;
- case FXFONT_HANGEUL_CHARSET:
- face = "AppleMyungjo";
- break;
- case FXFONT_CHINESEBIG5_CHARSET:
- face = "LiSong Pro Light";
- }
- if (m_FontList.Lookup(face, p)) {
- return p;
+void* CFX_MacFontInfo::MapFont(int weight,
+ FX_BOOL bItalic,
+ int charset,
+ int pitch_family,
+ const FX_CHAR* cstr_face,
+ int& iExact) {
+ CFX_ByteString face = cstr_face;
+ int iBaseFont;
+ for (iBaseFont = 0; iBaseFont < 12; iBaseFont++)
+ if (face == CFX_ByteStringC(Base14Substs[iBaseFont].m_pName)) {
+ face = Base14Substs[iBaseFont].m_pSubstName;
+ iExact = TRUE;
+ break;
}
+ if (iBaseFont < 12) {
+ return GetFont(face);
+ }
+ void* p;
+ if (m_FontList.Lookup(face, p)) {
+ return p;
+ }
+ if (charset == FXFONT_ANSI_CHARSET && (pitch_family & FXFONT_FF_FIXEDPITCH)) {
+ return GetFont("Courier New");
+ }
+ if (charset == FXFONT_ANSI_CHARSET || charset == FXFONT_SYMBOL_CHARSET) {
return NULL;
+ }
+ switch (charset) {
+ case FXFONT_SHIFTJIS_CHARSET:
+ GetJapanesePreference(face, weight, pitch_family);
+ break;
+ case FXFONT_GB2312_CHARSET:
+ face = "STSong";
+ break;
+ case FXFONT_HANGEUL_CHARSET:
+ face = "AppleMyungjo";
+ break;
+ case FXFONT_CHINESEBIG5_CHARSET:
+ face = "LiSong Pro Light";
+ }
+ if (m_FontList.Lookup(face, p)) {
+ return p;
+ }
+ return NULL;
}
-IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault()
-{
- CFX_MacFontInfo* pInfo = new CFX_MacFontInfo;
- pInfo->AddPath("~/Library/Fonts");
- pInfo->AddPath("/Library/Fonts");
- pInfo->AddPath("/System/Library/Fonts");
- return pInfo;
+IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault() {
+ CFX_MacFontInfo* pInfo = new CFX_MacFontInfo;
+ pInfo->AddPath("~/Library/Fonts");
+ pInfo->AddPath("/Library/Fonts");
+ pInfo->AddPath("/System/Library/Fonts");
+ return pInfo;
}
-void CFX_GEModule::InitPlatform()
-{
- m_pPlatformData = new CApplePlatform;
- m_pFontMgr->SetSystemFontInfo(IFX_SystemFontInfo::CreateDefault());
+void CFX_GEModule::InitPlatform() {
+ m_pPlatformData = new CApplePlatform;
+ m_pFontMgr->SetSystemFontInfo(IFX_SystemFontInfo::CreateDefault());
}
-void CFX_GEModule::DestroyPlatform()
-{
- delete (CApplePlatform *)m_pPlatformData;
- m_pPlatformData = NULL;
+void CFX_GEModule::DestroyPlatform() {
+ delete (CApplePlatform*)m_pPlatformData;
+ m_pPlatformData = NULL;
}
#endif