[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][TOP]

Re: gnome-print-0.29 の日本語について


加藤です。自己フォローです。

On Fri, Oct 05, 2001 at 02:20:30AM +0900,
Etsushi Kato <ekato@xxxxxxxxxxxxxxxxx> wrote:

> gnome-print-0.25 では明朝、ゴシックとも利用できていました。0.29 でも日
> 本語が使いたかったので、RedHat Beta の gnome-print-0.29-5 を使ってみた
> のですが、ゴシック、あるいは明朝どちらか一方のフォントだけならプレビュ
> ー、PS へのアウトプットも上手くいっているのですが、二つ以上同時に使お
> うとすると、どちらか一方のフォントが四角 (□) になってしまい、うまくあ
> りません。このとき
> 
> ** CRITICAL **: file parseTT.c: line 931 (ttf2pfa): assertion `g != NULL' failed.
> 
> というエラーが出ていました。
> ソースを少し見てみたのですが、*glyph_cache の中身がどうも毎回書きかわ
> ってしまって、一つのフォントの情報しか貯めていないようです。このあたり
> は、もうパッチなどで修正されているのでしょうか?

プログラミングはあまり良くわかりませんが、適当にいじってみたところ、日
本語のフォントが二つ以上でもプレビュー、PS とも表示できるようになりま
した。

正しい修正ではないかもしれませんが、gnome-print-0.29-5 の parseTT.c に
対する変更をいちおう付けておきます。

それでは。

-- 
Etsushi Kato
ekato@xxxxxxxxxxxxxxxxx
--- gnome-print-0.29.orig/libgnomeprint/parseTT.c	Wed Oct  3 02:59:39 2001
+++ gnome-print-0.29/libgnomeprint/parseTT.c	Fri Oct  5 06:11:35 2001
@@ -633,7 +633,7 @@
 	FT_BBox bbox;
 	FT_Glyph glyph;
 	FT_Outline *outline;
-	struct glyph_face **g, *g_prev = NULL;
+	struct glyph_face **g, *g_prev = NULL, *g_first = NULL;
 	struct glyph *gl = NULL, *gl_prev = NULL;
 	gchar *name, *names[3], *str;
 	guint32 unicode = gp_unicode_from_glyph_index (glyph_index);
@@ -651,17 +651,20 @@
 			break;
 		}
 	}
+	g_first = *g;
 	while ((*g) != NULL) {
 		if (!strcmp ((*g)->filename, filename) && fn == (*g)->face) break;
 		g_prev = (*g);
 		(*g) = (*g)->next;
 	}
 	if ((*g) == NULL) {
-		(*g) = g_prev;
+		if (g_prev) {
+			g_prev->next = NULL;
+		}
 		(*g) = g_new0 (struct glyph_face, 1);
 		(*g)->filename = g_strdup (filename);
 		(*g)->face = fn;
-		(*g)->next = NULL;
+		(*g)->next = g_first;
 		(*g)->glyph = NULL;
 	} else {
 		initialized = TRUE;
@@ -710,7 +715,12 @@
 		gl->next = NULL;
 	} else {
 		for (gl = (*g)->glyph, gl_prev = gl; gl != NULL; gl_prev = gl, gl = gl->next) {
-			if (gl->char_code == unicode) return FT_Err_Ok;
+			if (gl->char_code == unicode) {
+				if (initialized) {
+					*g = g_first;
+				}
+				return FT_Err_Ok;
+			}
 		}
 		gl = gl_prev;
 		gl->next = g_new0 (struct glyph, 1);
@@ -723,6 +733,9 @@
 	else gl->name = g_strdup_printf ("_%d", unicode);
 	if ((fterr = FT_Load_Glyph (face, glyph_index, FT_LOAD_NO_BITMAP | FT_LOAD_NO_SCALE)) != FT_Err_Ok) {
 			g_warning ("Can't load glyph -- %d\n", unicode);
+			if (initialized) {
+				*g = g_first;
+			}
 			return -1;
 	}
 	met = &face->glyph->metrics;
@@ -736,6 +749,9 @@
 
 	if ((fterr = FT_Get_Glyph (face->glyph, &glyph)) != FT_Err_Ok) {
 		g_warning ("Can't access glyph -- %d\n", unicode);
+		if (initialized) {
+			*g = g_first;
+		}
 		return -1;
 	}
 	FT_Glyph_Get_CBox (glyph, ft_glyph_bbox_unscaled, &bbox);
@@ -771,6 +787,9 @@
 		outline = &face->glyph->outline;
 		if ((fterr = FT_Outline_Decompose (outline, &ft_outline_funcs, NULL)) != FT_Err_Ok) {
 			g_warning ("Can't decompose outline of glyph -- %d\n", unicode);
+			if (initialized) {
+				*g = g_first;
+			}
 			return -1;
 		}
 		if (curg->lastentry) gclosepath (curg);
@@ -795,6 +814,9 @@
 		gl->flags &= ~GF_FLOAT;
 	}
 
+	if (initialized) {
+		*g = g_first;
+	}
 	return FT_Err_Ok;
 }