|
我想仅patch显示中文名,而不修改下画线,该怎么修改版主的这个patch呢?
--- mozilla/gfx/src/gtk/nsFontMetricsXft.cpp.orig 2003-04-07 20:51:35.000000000 +0800
+++ mozilla/gfx/src/gtk/nsFontMetricsXft.cpp 2003-04-08 10:00:22.000000000 +0800
@@ -796,7 +796,7 @@
if (lineHeight > mEmHeight)
mLeading = lineHeight - mEmHeight;
else
- mLeading = 0;
+ mLeading = (int)(f * 3); /* 列距為 3 條 pixels */
// mMaxHeight (needs ascent and descent)
mMaxHeight = lineHeight;
@@ -834,14 +834,9 @@
mXHeight = nscoord(mXHeight * f);
// mUnderlineOffset (offset for underlines)
- val = face->underline_position >> 16;
- if (val) {
- mUnderlineOffset = NSToIntRound(val * f);
- }
- else {
- mUnderlineOffset =
+ // 底線在字的下面, 而不是疊在字的最後一條線
+ mUnderlineOffset = (int)-(f) +
-NSToIntRound(PR_MAX(1, floor(0.1 * xftFont->height + 0.5)) * f);
- }
// mUnderlineSize (thickness of an underline)
val = face->underline_thickness >> 16;
@@ -1921,8 +1916,29 @@
goto end;
PRUnichar *r = name;
- for (char *f = family; *f; ++f)
- *r++ = *f;
+ unsigned char c;
+ int pi = 0;
+ // 處理字型名稱, 可含有 UTF8
+ for (char *f = family; *f; ++f) {
+ c = *f;
+ if ((c & 0x80) == 0) {
+ *r++ = c;
+ } else if ((c & 0xf0) == 0xf0) {
+ continue;
+ } else if ((c & 0xf0) == 0xe0) {
+ pi = 2;
+ *r = c & 0xf;
+ } else if ((c & 0xe0) == 0xc0) {
+ pi = 1;
+ *r = c & 0x1f;
+ } else if (pi > 0) {
+ *r = ((*r) << 6) | (c & 0x3f);
+ if (--pi == 0) {
+ r++;
+ }
+ }
+ }
+
*r = '\0';
array[narray++] = name; |
|