diff options
Diffstat (limited to 'core/fxge')
-rw-r--r-- | core/fxge/android/cfpf_skiafontmgr.cpp | 4 | ||||
-rw-r--r-- | core/fxge/apple/fx_mac_imp.cpp | 4 | ||||
-rw-r--r-- | core/fxge/cfx_folderfontinfo.cpp | 8 | ||||
-rw-r--r-- | core/fxge/cfx_font.cpp | 2 | ||||
-rw-r--r-- | core/fxge/cfx_fontmapper.cpp | 6 | ||||
-rw-r--r-- | core/fxge/cfx_renderdevice.cpp | 2 | ||||
-rw-r--r-- | core/fxge/fx_ge_linux.cpp | 15 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_device.cpp | 33 |
8 files changed, 40 insertions, 34 deletions
diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp index 23fcd5bbec..3cee6decac 100644 --- a/core/fxge/android/cfpf_skiafontmgr.cpp +++ b/core/fxge/android/cfpf_skiafontmgr.cpp @@ -194,13 +194,13 @@ bool FPF_SkiaIsCJK(uint8_t uCharset) { bool FPF_SkiaMaybeSymbol(const CFX_ByteStringC& bsFacename) { CFX_ByteString bsName(bsFacename); bsName.MakeLower(); - return bsName.Find("symbol") > -1; + return bsName.Find("symbol") != FX_STRNPOS; } bool FPF_SkiaMaybeArabic(const CFX_ByteStringC& bsFacename) { CFX_ByteString bsName(bsFacename); bsName.MakeLower(); - return bsName.Find("arabic") > -1; + return bsName.Find("arabic") != FX_STRNPOS; } const uint32_t g_FPFSkiaFontCharsets[] = { diff --git a/core/fxge/apple/fx_mac_imp.cpp b/core/fxge/apple/fx_mac_imp.cpp index 78fe16459c..54aac7bfa6 100644 --- a/core/fxge/apple/fx_mac_imp.cpp +++ b/core/fxge/apple/fx_mac_imp.cpp @@ -52,7 +52,7 @@ const char JAPAN_GOTHIC[] = "Hiragino Kaku Gothic Pro W6"; const char JAPAN_MINCHO[] = "Hiragino Mincho Pro W6"; void GetJapanesePreference(CFX_ByteString* face, int weight, int pitch_family) { - if (face->Find("Gothic") >= 0) { + if (face->Find("Gothic") != FX_STRNPOS) { *face = JAPAN_GOTHIC; return; } @@ -82,7 +82,7 @@ void* CFX_MacFontInfo::MapFont(int weight, // Times New Roman. A more sophisticated approach would be to find all the // fonts in |m_FontList| with |face| in the name, and examine the fonts to // see which best matches the requested characteristics. - if (face.Find("Bold") == -1 && face.Find("Italic") == -1) { + if (face.Find("Bold") == FX_STRNPOS && face.Find("Italic") == FX_STRNPOS) { CFX_ByteString new_face = face; if (weight > 400) new_face += " Bold"; diff --git a/core/fxge/cfx_folderfontinfo.cpp b/core/fxge/cfx_folderfontinfo.cpp index 12e7dd25fc..f16722c4d6 100644 --- a/core/fxge/cfx_folderfontinfo.cpp +++ b/core/fxge/cfx_folderfontinfo.cpp @@ -251,11 +251,11 @@ void CFX_FolderFontInfo::ReportFace(const CFX_ByteString& path, m_pMapper->AddInstalledFont(facename, FX_CHARSET_ANSI); pInfo->m_Charsets |= CHARSET_FLAG_ANSI; pInfo->m_Styles = 0; - if (style.Find("Bold") > -1) + if (style.Find("Bold") != FX_STRNPOS) pInfo->m_Styles |= FXFONT_BOLD; - if (style.Find("Italic") > -1 || style.Find("Oblique") > -1) + if (style.Find("Italic") != FX_STRNPOS || style.Find("Oblique") != FX_STRNPOS) pInfo->m_Styles |= FXFONT_ITALIC; - if (facename.Find("Serif") > -1) + if (facename.Find("Serif") != FX_STRNPOS) pInfo->m_Styles |= FXFONT_SERIF; m_FontList[facename] = std::move(pInfo); @@ -289,7 +289,7 @@ void* CFX_FolderFontInfo::FindFont(int weight, continue; int32_t index = bsName.Find(family); - if (bMatchName && index < 0) + if (bMatchName && index == FX_STRNPOS) continue; int32_t iSimilarValue = diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp index a8e271dd9a..1fd08f2676 100644 --- a/core/fxge/cfx_font.cpp +++ b/core/fxge/cfx_font.cpp @@ -447,7 +447,7 @@ bool CFX_Font::IsItalic() const { CFX_ByteString str(FXFT_Get_Face_Style_Name(m_Face)); str.MakeLower(); - return str.Find("italic") != -1; + return str.Find("italic") != FX_STRNPOS; } bool CFX_Font::IsBold() const { diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp index 4c0073ab73..b8ffe047a3 100644 --- a/core/fxge/cfx_fontmapper.cpp +++ b/core/fxge/cfx_fontmapper.cpp @@ -172,7 +172,7 @@ const struct CODEPAGE_MAP { int CompareFontFamilyString(const void* key, const void* element) { CFX_ByteString str_key((const char*)key); const AltFontFamily* family = reinterpret_cast<const AltFontFamily*>(element); - if (str_key.Find(family->m_pFontName) != -1) + if (str_key.Find(family->m_pFontName) != FX_STRNPOS) return 0; return FXSYS_stricmp(reinterpret_cast<const char*>(key), family->m_pFontName); } @@ -187,8 +187,8 @@ CFX_ByteString TT_NormalizeName(const char* family) { norm.Remove(' '); norm.Remove('-'); norm.Remove(','); - int pos = norm.Find('+'); - if (pos > 0) + FX_STRSIZE pos = norm.Find('+'); + if (pos != 0 && pos != FX_STRNPOS) norm = norm.Left(pos); norm.MakeLower(); return norm; diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp index 279e720d1e..310a16512c 100644 --- a/core/fxge/cfx_renderdevice.cpp +++ b/core/fxge/cfx_renderdevice.cpp @@ -337,7 +337,7 @@ bool ShouldDrawDeviceText(const CFX_Font* pFont, uint32_t text_flags) { return false; const CFX_ByteString bsPsName = pFont->GetPsName(); - if (bsPsName.Find("+ZJHL") != -1) + if (bsPsName.Find("+ZJHL") != FX_STRNPOS) return false; if (bsPsName == "CNAAJI+cmex10") diff --git a/core/fxge/fx_ge_linux.cpp b/core/fxge/fx_ge_linux.cpp index d9fac3f54c..0552f1c58c 100644 --- a/core/fxge/fx_ge_linux.cpp +++ b/core/fxge/fx_ge_linux.cpp @@ -45,17 +45,18 @@ size_t GetJapanesePreference(const char* facearr, int weight, int pitch_family) { CFX_ByteString face = facearr; - if (face.Find("Gothic") >= 0 || - face.Find("\x83\x53\x83\x56\x83\x62\x83\x4e") >= 0) { - if (face.Find("PGothic") >= 0 || - face.Find("\x82\x6f\x83\x53\x83\x56\x83\x62\x83\x4e") >= 0) { + if (face.Find("Gothic") != FX_STRNPOS || + face.Find("\x83\x53\x83\x56\x83\x62\x83\x4e") != FX_STRNPOS) { + if (face.Find("PGothic") != FX_STRNPOS || + face.Find("\x82\x6f\x83\x53\x83\x56\x83\x62\x83\x4e") != FX_STRNPOS) { return 0; } return 1; } - if (face.Find("Mincho") >= 0 || face.Find("\x96\xbe\x92\xa9") >= 0) { - if (face.Find("PMincho") >= 0 || - face.Find("\x82\x6f\x96\xbe\x92\xa9") >= 0) { + if (face.Find("Mincho") != FX_STRNPOS || + face.Find("\x96\xbe\x92\xa9") != FX_STRNPOS) { + if (face.Find("PMincho") != FX_STRNPOS || + face.Find("\x82\x6f\x96\xbe\x92\xa9") != FX_STRNPOS) { return 2; } return 3; diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index 4427755cf5..b707a76c08 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -503,7 +503,7 @@ void* CFX_Win32FallbackFontInfo::MapFont(int weight, void CFX_Win32FontInfo::GetGBPreference(CFX_ByteString& face, int weight, int picth_family) { - if (face.Find("KaiTi") >= 0 || face.Find("\xbf\xac") >= 0) { + if (face.Find("KaiTi") != FX_STRNPOS || face.Find("\xbf\xac") != FX_STRNPOS) { if (m_KaiTi.IsEmpty()) { m_KaiTi = FindFont("KaiTi"); if (m_KaiTi.IsEmpty()) { @@ -511,7 +511,8 @@ void CFX_Win32FontInfo::GetGBPreference(CFX_ByteString& face, } } face = m_KaiTi; - } else if (face.Find("FangSong") >= 0 || face.Find("\xb7\xc2\xcb\xce") >= 0) { + } else if (face.Find("FangSong") != FX_STRNPOS || + face.Find("\xb7\xc2\xcb\xce") != FX_STRNPOS) { if (m_FangSong.IsEmpty()) { m_FangSong = FindFont("FangSong"); if (m_FangSong.IsEmpty()) { @@ -519,9 +520,11 @@ void CFX_Win32FontInfo::GetGBPreference(CFX_ByteString& face, } } face = m_FangSong; - } else if (face.Find("SimSun") >= 0 || face.Find("\xcb\xce") >= 0) { + } else if (face.Find("SimSun") != FX_STRNPOS || + face.Find("\xcb\xce") != FX_STRNPOS) { face = "SimSun"; - } else if (face.Find("SimHei") >= 0 || face.Find("\xba\xda") >= 0) { + } else if (face.Find("SimHei") != FX_STRNPOS || + face.Find("\xba\xda") != FX_STRNPOS) { face = "SimHei"; } else if (!(picth_family & FF_ROMAN) && weight > 550) { face = "SimHei"; @@ -533,15 +536,16 @@ void CFX_Win32FontInfo::GetGBPreference(CFX_ByteString& face, void CFX_Win32FontInfo::GetJapanesePreference(CFX_ByteString& face, int weight, int picth_family) { - if (face.Find("Gothic") >= 0 || - face.Find("\x83\x53\x83\x56\x83\x62\x83\x4e") >= 0) { - if (face.Find("PGothic") >= 0 || - face.Find("\x82\x6f\x83\x53\x83\x56\x83\x62\x83\x4e") >= 0) { + if (face.Find("Gothic") != FX_STRNPOS || + face.Find("\x83\x53\x83\x56\x83\x62\x83\x4e") != FX_STRNPOS) { + if (face.Find("PGothic") != FX_STRNPOS || + face.Find("\x82\x6f\x83\x53\x83\x56\x83\x62\x83\x4e") != FX_STRNPOS) { face = "MS PGothic"; - } else if (face.Find("UI Gothic") >= 0) { + } else if (face.Find("UI Gothic") != FX_STRNPOS) { face = "MS UI Gothic"; } else { - if (face.Find("HGSGothicM") >= 0 || face.Find("HGMaruGothicMPRO") >= 0) { + if (face.Find("HGSGothicM") != FX_STRNPOS || + face.Find("HGMaruGothicMPRO") != FX_STRNPOS) { face = "MS PGothic"; } else { face = "MS Gothic"; @@ -549,9 +553,10 @@ void CFX_Win32FontInfo::GetJapanesePreference(CFX_ByteString& face, } return; } - if (face.Find("Mincho") >= 0 || face.Find("\x96\xbe\x92\xa9") >= 0) { - if (face.Find("PMincho") >= 0 || - face.Find("\x82\x6f\x96\xbe\x92\xa9") >= 0) { + if (face.Find("Mincho") != FX_STRNPOS || + face.Find("\x96\xbe\x92\xa9") != FX_STRNPOS) { + if (face.Find("PMincho") != FX_STRNPOS || + face.Find("\x82\x6f\x96\xbe\x92\xa9") != FX_STRNPOS) { face = "MS PMincho"; } else { face = "MS Mincho"; @@ -635,7 +640,7 @@ void* CFX_Win32FontInfo::MapFont(int weight, face = "Gulim"; break; case FX_CHARSET_ChineseTraditional: - if (face.Find("MSung") >= 0) { + if (face.Find("MSung") != FX_STRNPOS) { face = "MingLiU"; } else { face = "PMingLiU"; |