diff options
author | Darafei Praliaskouski <komzpa@gmail.com> | 2013-05-03 19:22:02 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:54:23 +0300 |
commit | b2b326749bc086a4982918ab6ee97d96c6f0573b (patch) | |
tree | f991aeca5b4ce2bf36cdec27a5bbe154bd2fbd0a /platform | |
parent | 26ebb956f67aaeafa32b4c065b18a8ae048ef286 (diff) |
[bugfix] Samsung Duos LDPI fix
Diffstat (limited to 'platform')
-rw-r--r-- | platform/platform.cpp | 38 | ||||
-rw-r--r-- | platform/platform.hpp | 4 | ||||
-rw-r--r-- | platform/platform_unix_impl.cpp | 61 | ||||
-rw-r--r-- | platform/platform_win.cpp | 4 |
4 files changed, 70 insertions, 37 deletions
diff --git a/platform/platform.cpp b/platform/platform.cpp index bd5688f728..972c42d213 100644 --- a/platform/platform.cpp +++ b/platform/platform.cpp @@ -58,43 +58,7 @@ string Platform::DefaultUrlsJSON() const void Platform::GetFontNames(FilesList & res) const { - char const * fontsWhitelist[] = { - "Roboto-Regular.ttf", - "DroidSansArabic.ttf", - "DroidNaskh-Regular.ttf", - "Lohit-Bengali.ttf", - "Lohit-Devanagari.ttf", - "Lohit-Tamil.ttf", - "DroidSansThai.ttf", - "DroidSans.ttf", - "DroidSansArmenian.ttf", - "DroidSansEthiopic-Regular.ttf", - "DroidSansGeorgian.ttf", - "DroidSansHebrew-Regular.ttf", - "DroidSansHebrew.ttf", - "DroidSansJapanese.ttf", - "DroidSansFallback.ttf", - "LTe50872.ttf", - "LTe50259.ttf", - "DejaVuSans.ttf", - "arial.ttf" - }; - - char const * systemFontsPath[] = { - "/system/fonts/", - "/usr/share/fonts/truetype/droid/", - "/usr/share/fonts/truetype/ttf-dejavu/", - }; - - for (size_t i = 0; i < ARRAY_SIZE(fontsWhitelist); ++i) - { - for (size_t j = 0; j < ARRAY_SIZE(systemFontsPath); ++j) - { - string const path = string(systemFontsPath[j]) + fontsWhitelist[i]; - if (IsFileExistsByFullPath(path)) - res.push_back(path); - }; - }; + GetSystemFontNames(res); string const resourcesPaths[] = { WritableDir(), ResourcesDir() }; diff --git a/platform/platform.hpp b/platform/platform.hpp index b826dc970e..89c87ac1d9 100644 --- a/platform/platform.hpp +++ b/platform/platform.hpp @@ -129,6 +129,10 @@ public: /// @return JSON-encoded list of urls if metaserver is unreachable string DefaultUrlsJSON() const; + +private: + void GetSystemFontNames(FilesList & res) const; + }; extern Platform & GetPlatform(); diff --git a/platform/platform_unix_impl.cpp b/platform/platform_unix_impl.cpp index d16291c1e7..6c11ecd16d 100644 --- a/platform/platform_unix_impl.cpp +++ b/platform/platform_unix_impl.cpp @@ -13,6 +13,67 @@ #include <sys/vfs.h> #endif +void Platform::GetSystemFontNames(FilesList & res) const +{ +#if defined(OMIM_OS_MAC) || defined(OMIM_OS_IPHONE) +#else + char const * fontsWhitelist[] = { + "Roboto-Regular.ttf", + "DroidSansFallback.ttf", + "DroidSans.ttf", + "DroidSansArabic.ttf", + "DroidNaskh-Regular.ttf", + "Lohit-Bengali.ttf", + "Lohit-Devanagari.ttf", + "Lohit-Tamil.ttf", + "DroidSansThai.ttf", + "DroidSansArmenian.ttf", + "DroidSansEthiopic-Regular.ttf", + "DroidSansGeorgian.ttf", + "DroidSansHebrew-Regular.ttf", + "DroidSansHebrew.ttf", + "DroidSansJapanese.ttf", + "LTe50872.ttf", + "LTe50259.ttf", + "DejaVuSans.ttf", + "arial.ttf" + }; + + char const * systemFontsPath[] = { + "/system/fonts/", + "/usr/share/fonts/truetype/droid/", + "/usr/share/fonts/truetype/ttf-dejavu/", + }; + + uint64_t fileSize = 0; + + for (size_t i = 0; i < ARRAY_SIZE(fontsWhitelist); ++i) + { + for (size_t j = 0; j < ARRAY_SIZE(systemFontsPath); ++j) + { + string const path = string(systemFontsPath[j]) + fontsWhitelist[i]; + if (IsFileExistsByFullPath(path)) + { + if (GetFileSizeByName(path, fileSize)) + { + res.push_back(path); + LOG(LINFO, ("Found system font", path, "with file size", fileSize)); + } + } + } + } + + // Ignoring system fonts if broken Samsung Duos font detected + if (GetPlatform().GetFileSizeByName("/system/fonts/DroidSans.ttf", fileSize)) + { + if (fileSize == 183560) + { + res.clear(); + LOG(LINFO, ("Ignoring system fonts")); + } + } +#endif +} bool Platform::IsFileExistsByFullPath(string const & filePath) { diff --git a/platform/platform_win.cpp b/platform/platform_win.cpp index 43541563e9..e7058814e2 100644 --- a/platform/platform_win.cpp +++ b/platform/platform_win.cpp @@ -148,3 +148,7 @@ bool Platform::GetFileSizeByFullPath(string const & filePath, uint64_t & size) } return false; } + +void Platform::GetSystemFontNames(FilesList & res) const +{ +} |