aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-15 14:27:15 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-15 14:27:15 +0000
commit5a121add5e7bb191148a4e07f5ad7a1c6773ec24 (patch)
tree76c8731662a19953bc9995833e2632f4e6cbdaaa
parentc345c4279bb3394ac54c58ba0a752326a3b8d530 (diff)
add more font names to our extra-bottom-space hack
http://code.google.com/p/chromium/issues/detail?id=130842 Change cached names to be UTF8 encoded, since we now have some non-ascii names git-svn-id: http://skia.googlecode.com/svn/trunk@4264 2bbb7eff-a529-9590-31e7-b0007b416f81
-rwxr-xr-xsrc/ports/SkFontHost_win.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index f79c3eb738..1deb6b1445 100755
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -26,23 +26,35 @@
#include <objbase.h>
static int compute_extra_height(const LOGFONT& lf) {
+
static const struct {
- const char* fUCName;
+ const char* fUCName; // UTF8 encoded, ascii is upper-case
int fExtraHeight;
} gData[] = {
- { "DOTUM", 1 }, // http://code.google.com/p/chromium/issues/detail?id=130842
+ // http://code.google.com/p/chromium/issues/detail?id=130842
+ { "DOTUM", 1 },
+ { "DOTUMCHE", 1 },
+ { "\xEB\x8F\x8B\xEC\x9B\x80", 1 },
+ { "\xEB\x8F\x8B\xEC\x9B\x80\xEC\xB2\xB4", 1 },
};
- // Convert the lfFaceName into upper-case ascii, since our target
- // list is explicitly stored that way.
- char name[LF_FACESIZE];
+ /**
+ * We convert the target name into upper-case (for ascii chars) UTF8.
+ * Our database is already stored in this fashion, and it allows us to
+ * search it with straight memcmp, since everyone is in this canonical
+ * form.
+ */
- for (int i = 0; i < LF_FACESIZE - 1; ++i) {
- TCHAR c = lf.lfFaceName[i];
+ // temp storage is max # TCHARs * max expantion for UTF8 + null
+ char name[kMaxBytesInUTF8Sequence * LF_FACESIZE + 1];
+ int index = 0;
+ for (int i = 0; i < LF_FACESIZE; ++i) {
+ uint16_t c = lf.lfFaceName[i];
if (c >= 'a' && c <= 'z') {
c = c - 'a' + 'A';
}
- name[i] = (char)c;
+ size_t n = SkUTF16_ToUTF8(&c, 1, &name[index]);
+ index += n;
if (0 == c) {
break;
}