summaryrefslogtreecommitdiffstats
path: root/libs/minikin
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2014-08-27 17:07:48 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-08-27 17:07:48 +0000
commitdf0178d7d22efabe922f5c1f90a100d2b740ebf4 (patch)
tree99280d50bd2fdfbddf0f646e931d16012b8e8f46 /libs/minikin
parent10d07727cf81c86352493e2241e17a0008c04bb5 (diff)
parent997c799e3ec6bf8adf687e29670d23d91e0f5fee (diff)
downloadandroid_frameworks_minikin-df0178d7d22efabe922f5c1f90a100d2b740ebf4.tar.gz
android_frameworks_minikin-df0178d7d22efabe922f5c1f90a100d2b740ebf4.tar.bz2
android_frameworks_minikin-df0178d7d22efabe922f5c1f90a100d2b740ebf4.zip
am 997c799e: Try Unicode decomposition for selecting fallback font
* commit '997c799e3ec6bf8adf687e29670d23d91e0f5fee': Try Unicode decomposition for selecting fallback font
Diffstat (limited to 'libs/minikin')
-rw-r--r--libs/minikin/FontCollection.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/libs/minikin/FontCollection.cpp b/libs/minikin/FontCollection.cpp
index 009584e..ca5b1d1 100644
--- a/libs/minikin/FontCollection.cpp
+++ b/libs/minikin/FontCollection.cpp
@@ -19,6 +19,9 @@
#define LOG_TAG "Minikin"
#include <cutils/log.h>
+#include "unicode/unistr.h"
+#include "unicode/unorm2.h"
+
#include "MinikinInternal.h"
#include <minikin/CmapCoverage.h>
#include <minikin/FontCollection.h>
@@ -143,7 +146,18 @@ const FontCollection::FontInstance* FontCollection::getInstanceForChar(uint32_t
}
}
}
- if (bestInstance == NULL) {
+ if (bestInstance == NULL && !mInstanceVec.empty()) {
+ UErrorCode errorCode = U_ZERO_ERROR;
+ const UNormalizer2* normalizer = unorm2_getNFDInstance(&errorCode);
+ if (U_SUCCESS(errorCode)) {
+ UChar decomposed[4];
+ int len = unorm2_getRawDecomposition(normalizer, ch, decomposed, 4, &errorCode);
+ if (U_SUCCESS(errorCode) && len > 0) {
+ int off = 0;
+ U16_NEXT_UNSAFE(decomposed, off, ch);
+ return getInstanceForChar(ch, lang, variant);
+ }
+ }
bestInstance = &mInstances[0];
}
return bestInstance;