From aec2a9b151f395dc811eb842c6d4c8e369930c9e Mon Sep 17 00:00:00 2001 From: Darafei Praliaskouski Date: Wed, 29 May 2013 15:09:56 +0300 Subject: [PATCH] [android] Blacklisting of serif fonts --- platform/platform_unix_impl.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/platform/platform_unix_impl.cpp b/platform/platform_unix_impl.cpp index 6c11ecd16d..fec47914cf 100644 --- a/platform/platform_unix_impl.cpp +++ b/platform/platform_unix_impl.cpp @@ -6,6 +6,7 @@ #include #include +#include "../std/algorithm.hpp" #if defined(OMIM_OS_MAC) || defined(OMIM_OS_IPHONE) #include @@ -22,6 +23,8 @@ void Platform::GetSystemFontNames(FilesList & res) const "DroidSansFallback.ttf", "DroidSans.ttf", "DroidSansArabic.ttf", + "DroidSansSemc.ttf", + "DroidSansSemcCJK.ttf", "DroidNaskh-Regular.ttf", "Lohit-Bengali.ttf", "Lohit-Devanagari.ttf", @@ -35,14 +38,22 @@ void Platform::GetSystemFontNames(FilesList & res) const "DroidSansJapanese.ttf", "LTe50872.ttf", "LTe50259.ttf", + "DevanagariOTS.ttf", "DejaVuSans.ttf", "arial.ttf" }; char const * systemFontsPath[] = { "/system/fonts/", + "/usr/share/fonts/truetype/roboto/", "/usr/share/fonts/truetype/droid/", - "/usr/share/fonts/truetype/ttf-dejavu/", + "/usr/share/fonts/truetype/ttf-dejavu/" + }; + + const uint64_t fontSizeBlacklist[] = { + 183560, // Samsung Duos DroidSans + 7140172, // Serif font without Emoji + 14416824 // Serif font with Emoji }; uint64_t fileSize = 0; @@ -56,8 +67,12 @@ void Platform::GetSystemFontNames(FilesList & res) const { if (GetFileSizeByName(path, fileSize)) { - res.push_back(path); - LOG(LINFO, ("Found system font", path, "with file size", fileSize)); + uint64_t const * end = fontSizeBlacklist + ARRAY_SIZE(fontSizeBlacklist); + if (find(fontSizeBlacklist, end, fileSize) == end) + { + res.push_back(path); + LOG(LINFO, ("Found usable system font", path, "with file size", fileSize)); + } } } }