From: handa Date: Thu, 2 Oct 2003 22:58:02 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: REL-0-9-1~95 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=b3f58a62a115fe1f76a3f546a43b2b0514012c8e;p=m17n%2Flibotf.git *** empty log message *** --- diff --git a/README b/README index 3c23e48..1871f04 100644 --- a/README +++ b/README @@ -17,6 +17,9 @@ The library "libotf" provides the following facilites. The combination of libotf and the FreeType library (Ver.2) realizes CTL (complex text layout) by OpenType fonts. +It seems that the probject Free Type Layout provides the similar (or +better) facility as this library, but currently they have not yet +released their library. So, we have developped this library. (2) Installation diff --git a/example/otfview.c b/example/otfview.c index ab35173..d1bfcd5 100644 --- a/example/otfview.c +++ b/example/otfview.c @@ -245,10 +245,14 @@ RenderProc (Widget w, XtPointer client_data, XtPointer call_data) else if (glyph_rec.n_glyphs < 64) { int index = glyph_index + (int) client_data; - if (charmap_index >= 0) - index = FT_Get_Char_Index (face, (FT_ULong) index); - glyph_rec.glyphs[glyph_rec.n_glyphs++] = index; - update_render_area (); + + if (bitmap[index].pixmap) + { + if (charmap_index >= 0) + index = FT_Get_Char_Index (face, (FT_ULong) index); + glyph_rec.glyphs[glyph_rec.n_glyphs++] = index; + update_render_area (); + } } } @@ -423,6 +427,7 @@ main (int argc, char **argv) int err; int i; int pixel_size = DEFAULT_PIXEL_SIZE; + int display_width; { char *str = getenv ("PIXEL_SIZE"); @@ -438,6 +443,8 @@ main (int argc, char **argv) shell = XtOpenApplication (&context, "OTFView", NULL, 0, &argc, argv, NULL, shellWidgetClass, NULL, 0); display = XtDisplay (shell); + display_width = DisplayWidth (display, + XScreenNumberOfScreen (XtScreen (shell))); if (argc != 2) FATAL_ERROR ("%s\n", "Usage: otfview [ X-OPTION ... ] OTF-FILE"); @@ -464,7 +471,7 @@ main (int argc, char **argv) else if (err) FATAL_ERROR ("%s\n", "FT_New_Face: unknown error"); if ((err = FT_Set_Pixel_Sizes (face, 0, pixel_size))) - FATAL_ERROR ("%s\n", "FT_Set_Char_Size: error"); + FATAL_ERROR ("%s\n", "FT_Set_Pixel_Sizes: error"); { char title[256]; @@ -476,14 +483,24 @@ main (int argc, char **argv) XtSetValues (shell, arg, 1); } - glyph_width = ((face->bbox.xMax - face->bbox.xMin) * pixel_size / face->units_per_EM); + if (glyph_width * 16 > display_width * 0.8) + { + pixel_size = (pixel_size * display_width * 0.8 / 16 / glyph_width); + FT_Set_Pixel_Sizes (face, 0, pixel_size); + glyph_width = ((face->bbox.xMax - face->bbox.xMin) + * pixel_size / face->units_per_EM); + } glyph_height = ((face->bbox.yMax - face->bbox.yMin) * pixel_size / face->units_per_EM); + glyph_x = - (face->bbox.xMin * pixel_size / face->units_per_EM); glyph_y = face->bbox.yMax * pixel_size / face->units_per_EM; + render_width = (glyph_width + 1) * 15 + 1; + render_height = glyph_height + 2; + charmap_rec[0].platform_id = -1; charmap_rec[0].encoding_id = -1; strcpy (charmap_rec[0].name, "no charmap"); @@ -503,8 +520,6 @@ main (int argc, char **argv) strcat (charmap_rec[i + 1].name, " (apple-roman)"); } - render_width = (glyph_width + 1) * 15 + 1; - render_height = glyph_height + 2; raw_pixmap = XCreatePixmap (display, DefaultRootWindow (display), render_width, render_height, 1); seq_pixmap = XCreatePixmap (display, DefaultRootWindow (display),