[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[mgp-users-jp 01405] '-' を含むフォント名
- To: mgp-users-jp@mew.org
- Subject: [mgp-users-jp 01405] '-' を含むフォント名
- From: Keiichi SHIMA <keiichi@iijlab.net>
- Date: Thu, 19 May 2005 14:54:02 +0900 (JST)
- Delivered-to: mailing list mgp-users-jp@mew.org
- Mailing-list: contact mgp-users-jp-help@mew.org; run by ezmlm
IIJ の島です。
xft2 で '-' を含むフォント名(例えば、僕の環境の例では
DFPHSGothic-W7:style=Regular など)が誤って XLFD として認識されていた
ので、なんとかしてみました。
添付のパッチでは、':' を含むフォント名を xft2 のフォント名として認識し
ます。
より正しく動作させるには、':' を含まないけれども、'-' を含む xft2 フォ
ント名、をより正確に解析して XFLD と区別しないといけないのでしょうけど、
とりあえず ':' を含めることで現状の問題は解決しているので、ここまでし
かやっていません。
何かのお役にたてば。
---
Keiichi SHIMA
IIJ Research Laboratory <keiichi@iijlab.net>
KAME Project <keiichi@kame.net>
--- draw.c.orig Wed Sep 8 01:57:42 2004
+++ draw.c Thu May 19 14:10:00 2005
@@ -4140,6 +4140,10 @@
for (p = seed; *p; p++) {
if (*p == '-')
hyphen++;
+ if (*p == ':') {
+ hyphen = 0;
+ break;
+ }
}
switch (hyphen) {
case 0:
@@ -4870,11 +4874,23 @@
return last_xftfont;
}
- /*
- * if xfont contains "-", we believe this is a conventional xfont name
- * and try to convert it for xft
- */
- if ((p = strchr(xfont, '-')) != NULL) {
+ if ((p = strchr(xfont, ':')) != NULL) {
+ /*
+ * if xfont contsins ":", we believe this is a Xft font name
+ * with the style expression.
+ */
+ p2 = p + 1;
+ /* allow to use ":style=" syntax */
+ if ((strstr(p2, "style=") != NULL) || (strstr(p2, "STYLE=") != NULL))
+ p2 += 6;
+ *p = '\0';
+ strlcpy(font, xfont, sizeof(font));
+ strlcpy(style, p2, sizeof(style));
+ } else if ((p = strchr(xfont, '-')) != NULL) {
+ /*
+ * if xfont contains "-", we believe this is a conventional
+ * xfont name and try to convert it for xft
+ */
*p++ = 0;
strlcpy(font, xfont, sizeof(font));
if (strncmp(p, "bold-i", 6) == 0)
@@ -4883,17 +4899,8 @@
strlcpy(style, "Bold", sizeof(style));
else if ((p = strchr(p, '-')) != NULL && p[1] == 'i')
strlcpy(style, "Italic", sizeof(style));
- } else if ((p = strchr(xfont, ':')) == NULL)
+ } else
strlcpy(font, xfont, sizeof(font));
- else {
- p2 = p +1;
- /* allow to use ":style=" syntax */
- if ((strstr(p2, "style=") != NULL) || (strstr(p2, "STYLE=") != NULL))
- p2 += 6;
- *p = '\0';
- strlcpy(font, xfont, sizeof(font));
- strlcpy(style, p2, sizeof(style));
- }
if (style[0]) {
xftfont = XftFontOpen(display, screen,
XFT_FAMILY, XftTypeString, font,