aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2008-08-29 07:58:40 +0000
committerKenichi Handa2008-08-29 07:58:40 +0000
commit24553805cbc1743546735d6584ad4a8b53b79fa6 (patch)
treef2dc3385d594d30dc83089e763352689bd1d488f /src
parent4eceb6f3b7d50ce8f02160658c2ce4a3bf3f0f0d (diff)
downloademacs-24553805cbc1743546735d6584ad4a8b53b79fa6.tar.gz
emacs-24553805cbc1743546735d6584ad4a8b53b79fa6.zip
(x_draw_composite_glyph_string_foreground): Adjusted for
the change of struct glyph_string. (x_draw_glyph_string): Likewise.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog148
-rw-r--r--src/xterm.c79
2 files changed, 185 insertions, 42 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 72ceb2109c2..be8e537b34e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,151 @@
12008-08-29 Kenichi Handa <handa@m17n.org>
2
3 These changes are to re-implement the automatic composition so
4 that it doesn't use text properties.
5
6 * Makefile.in (ftfont.o): Depend on composite.h.
7 (composite.o): Depend dispextern.h, font.h, frame, and window.h.
8
9 * character.h (Vunicode_category_table): Extern it.
10
11 * character.c (Vunicode_category_table): New variable.
12 (syms_of_character): DEFVAR_LISP Vunicode_category_table.
13
14 * chartab.c (optimize_sub_char_table): Perform more greedy
15 optimization.
16
17 * composite.h (enum composition_method): Delete
18 COMPOSITION_WITH_GLYPH_STRING.
19 (COMPOSITION_METHOD): Dont' check COMPOSITION_WITH_GLYPH_STRING.
20 (Vcomposition_function_table): Extern it.
21 (LGSTRING_XXX, LGLYPH_XXX): Macros moved from font.h.
22 (composition_gstring_put_cache, composition_gstring_from_id)
23 (composition_gstring_p, composition_gstring_width)
24 (composition_compute_stop_pos, composition_reseat_it)
25 (composition_update_it, composition_adjust_point): Extern them.
26 (Fcomposition_get_gstring): EXFUN it.
27
28 * composite.c: Include window.h, frame.h, dispextern.h font.h.
29 (Vcomposition_function_table)
30 (get_composition_id): Don't handle COMPOSITION_WITH_GLYPH_STRING.
31 (gstring_hash_table, gstring_work, gstring_work_headers): New
32 variables.
33 (gstring_lookup_cache, composition_gstring_put_cache)
34 (composition_gstring_from_id, composition_gstring_p)
35 (composition_gstring_width, fill_gstring_header)
36 (fill_gstring_body, autocmp_chars, composition_compute_stop_pos)
37 (composition_reseat_it, composition_update_it)
38 (composition_adjust_point, Fcomposition_get_gstring): New
39 functions.
40 (syms_of_composite): Initialize gstring_hash_table, gstrint_work,
41 and gstring_work_headers. DEFVAR_LISP composition-function-table.
42 Defsubr compostion_get_gstring.
43
44 * dispextern.h (struct glyph): New union u.cmp. Delete the member
45 cmp_id.
46 (struct glyph_string): Delete the member gidx. New members
47 cmp_id, cmp_from, and cmp_to.
48 (enum it_method): Delete GET_FROM_COMPOSITION.
49 (struct composition_it): New struct.
50 (struct it): New member cmp_it, and iterator_stack_entry.cmp_it.
51 Delete c, len, cmp_id, cmp_len in u.comp.
52
53 * font.h (enum lgstring_indices): Delete it.
54 (LGSTRING_XXX, LGLYPH_XXX): These macros moved to composite.h.
55 (enum lglyph_indices): Likewise.
56 (font_range): Extern adjusted.
57 (font_fill_lglyph_metrics): Extern it.
58
59 * font.c (QCf): New variable.
60 (check_gstring): Use LGSTRING_GLYPH_LEN, not LGSTRING_LENGTH.
61 (font_prepare_composition): Delete this function.
62 (font_range): Type and arguments changed.
63 (Ffont_make_gstring, Ffont_fill_gstring): Delete them.
64 (font_fill_lglyph_metrics): New function.
65 (Ffont_shape_text): Renamed to Ffont_shape_gstring and arguments
66 changed.
67 (syms_of_font): DEFSYM QCf. Delete defsubr for
68 Sfont_make_gstring, Sfont_fill_gstring, Sfont_shape_text. Defsubr
69 Sfont_shape_gstring.
70
71 * fontset.h (font_for_char): Extern it.
72
73 * fontset.c (font_for_char): New function.
74
75 * ftfont.c: Include composite.h.
76 (ftfont_resolve_generic_family): Add langset "en" to pattern.
77 (ftfont_shape_by_flt): Use LGSTRING_GLYPH_LEN, not
78 LGSTRING_LENGTH.
79
80 * indent.c: Include composite.h and dispextern.h.
81 (check_composition): Delete this function..
82 (scan_for_column): Handle composition by
83 composition_compute_stop_pos, composition_reseat_it, and
84 composition_update_it.
85 (compute_motion): Likewise.
86 (Fvertical_motion): Fix checking of composition.
87
88 * keyboard.c (adjust_point_for_property): Check composition by
89 composition_adjust_point.
90
91 * nsterm.m (ns_draw_glyph_string): Adjusted for the change of
92 struct glyph_string.
93
94 * term.c (encode_terminal_code): Adjusted for the change of struct
95 glyph.
96 (append_composite_glyph): Adjusted for the change of struct it and
97 struct glyph.
98 (produce_composite_glyph): Likewise.
99
100 * w32term.c (x_draw_composite_glyph_string_foreground): Adjusted
101 for the change of struct glyph_string.
102 (x_draw_glyph_string): Likewise.
103
104 * w32uniscribe.c (struct uniscribe_font_info): Include composite.h.
105 (uniscribe_shape): Use LGSTRING_GLYPH_LEN, not LGSTRING_LENGTH.
106
107 * xdisp.c: Include font.h.
108 (it_props): Delete the entry for Qauto_composed.
109 (init_iterator): Initialize it->cmp_it.id to -1.
110 (compute_stop_pos): Call composition_compute_stop_pos.
111 (face_before_or_after_it_pos): Adjusted for the change of struct
112 it.
113 (handle_auto_composed_prop): Delete it.
114 (handle_composition_prop): Handle only static composition.
115 (next_overlay_string): Remove it->method == GET_FROM_COMPOSITION
116 from xassert. Initialize it->cmp_it.stop_pos.
117 (push_it): Adjusted for the change of struct it.
118 (pop_it): Likewise.
119 (get_next_element): Delete next_element_from_composition.
120 (CHAR_COMPOSED_P): New macro.
121 (get_next_display_element): For automatic composition, get a face
122 from the font in the glyph-string.
123 (set_iterator_to_next): For GET_FROM_BUFFER and GET_FROM_STRING,
124 check composition by it->cmp_it.id. Delete GET_FROM_COMPOSITION
125 case.
126 (next_element_from_string): Check if the character at the current
127 position is composed by CHAR_COMPOSED_P.
128 (next_element_from_buffer): Likewise.
129 (next_element_from_composition): Adjusted for the change of struct
130 it. Update it->cmp_it.
131 (dump_glyph): Adjusted for the change of struct glyph.
132 (fill_composite_glyph_string): Adjusted for the change of struct
133 it and struct glyph. Don't handle automatic composition here.
134 (fill_gstring_glyph_string): New function.
135 (x_get_glyph_overhangs): Handle automatic composition.
136 (BUILD_COMPOSITE_GLYPH_STRING): Adjusted for the change of struct
137 glyph.
138 (BUILD_GSTRING_GLYPH_STRING): New macro.
139 (BUILD_GLYPH_STRINGS): Call BUILD_GSTRING_GLYPH_STRING for
140 automatic composition.
141 (append_composite_glyph): Adjusted for the change of struct it and
142 struct glyph.
143 (x_produce_glyphs): Adjusted for the change of struct it.
144
145 * xterm.c (x_draw_composite_glyph_string_foreground): Adjusted for
146 the change of struct glyph_string.
147 (x_draw_glyph_string): Likewise.
148
12008-08-29 Glenn Morris <rgm@gnu.org> 1492008-08-29 Glenn Morris <rgm@gnu.org>
2 150
3 * buffer.c (word-wrap): Doc fix. 151 * buffer.c (word-wrap): Doc fix.
diff --git a/src/xterm.c b/src/xterm.c
index b3b3d961cb9..88fb04d665e 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1312,6 +1312,7 @@ x_draw_composite_glyph_string_foreground (s)
1312 struct glyph_string *s; 1312 struct glyph_string *s;
1313{ 1313{
1314 int i, j, x; 1314 int i, j, x;
1315 struct font *font = s->font;
1315 1316
1316 /* If first glyph of S has a left box line, start drawing the text 1317 /* If first glyph of S has a left box line, start drawing the text
1317 of S to the right of that box line. */ 1318 of S to the right of that box line. */
@@ -1321,73 +1322,66 @@ x_draw_composite_glyph_string_foreground (s)
1321 else 1322 else
1322 x = s->x; 1323 x = s->x;
1323 1324
1324 /* S is a glyph string for a composition. S->gidx is the index of 1325 /* S is a glyph string for a composition. S->cmp_from is the index
1325 the first character drawn for glyphs of this composition. 1326 of the first character drawn for glyphs of this composition.
1326 S->gidx == 0 means we are drawing the very first character of 1327 S->cmp_from == 0 means we are drawing the very first character of
1327 this composition. */ 1328 this composition. */
1328 1329
1329 /* Draw a rectangle for the composition if the font for the very 1330 /* Draw a rectangle for the composition if the font for the very
1330 first character of the composition could not be loaded. */ 1331 first character of the composition could not be loaded. */
1331 if (s->font_not_found_p) 1332 if (s->font_not_found_p)
1332 { 1333 {
1333 if (s->gidx == 0) 1334 if (s->cmp_from == 0)
1334 XDrawRectangle (s->display, s->window, s->gc, x, s->y, 1335 XDrawRectangle (s->display, s->window, s->gc, x, s->y,
1335 s->width - 1, s->height - 1); 1336 s->width - 1, s->height - 1);
1336 } 1337 }
1338 else if (! s->first_glyph->u.cmp.automatic)
1339 {
1340 int y = s->ybase;
1341
1342 for (i = 0, j = s->cmp_from; i < s->nchars; i++, j++)
1343 if (COMPOSITION_GLYPH (s->cmp, j) != '\t')
1344 {
1345 int xx = x + s->cmp->offsets[j * 2];
1346 int yy = y - s->cmp->offsets[j * 2 + 1];
1347
1348 font->driver->draw (s, j, j + 1, xx, yy, 0);
1349 if (s->face->overstrike)
1350 font->driver->draw (s, j, j + 1, xx + 1, yy, 0);
1351 }
1352 }
1337 else 1353 else
1338 { 1354 {
1339 struct font *font = s->font; 1355 Lisp_Object gstring = composition_gstring_from_id (s->cmp_id);
1356 Lisp_Object glyph;
1340 int y = s->ybase; 1357 int y = s->ybase;
1341 int width = 0; 1358 int width = 0;
1342 1359
1343 if (s->cmp->method == COMPOSITION_WITH_GLYPH_STRING) 1360 for (i = j = s->cmp_from; i < s->cmp_to; i++)
1344 { 1361 {
1345 Lisp_Object gstring = AREF (XHASH_TABLE (composition_hash_table) 1362 glyph = LGSTRING_GLYPH (gstring, i);
1346 ->key_and_value, 1363 if (NILP (LGLYPH_ADJUSTMENT (glyph)))
1347 s->cmp->hash_index * 2); 1364 width += LGLYPH_WIDTH (glyph);
1348 int from; 1365 else
1349
1350 for (i = from = 0; i < s->nchars; i++)
1351 { 1366 {
1352 Lisp_Object g = LGSTRING_GLYPH (gstring, i);
1353 Lisp_Object adjustment = LGLYPH_ADJUSTMENT (g);
1354 int xoff, yoff, wadjust; 1367 int xoff, yoff, wadjust;
1355 1368
1356 if (! VECTORP (adjustment)) 1369 if (j < i)
1357 { 1370 {
1358 width += LGLYPH_WIDTH (g); 1371 font->driver->draw (s, j, i, x, y, 0);
1359 continue;
1360 }
1361 if (from < i)
1362 {
1363 font->driver->draw (s, from, i, x, y, 0);
1364 x += width; 1372 x += width;
1365 } 1373 }
1366 xoff = XINT (AREF (adjustment, 0)); 1374 xoff = LGLYPH_XOFF (glyph);
1367 yoff = XINT (AREF (adjustment, 1)); 1375 yoff = LGLYPH_YOFF (glyph);
1368 wadjust = XINT (AREF (adjustment, 2)); 1376 wadjust = LGLYPH_WADJUST (glyph);
1369
1370 font->driver->draw (s, i, i + 1, x + xoff, y + yoff, 0); 1377 font->driver->draw (s, i, i + 1, x + xoff, y + yoff, 0);
1371 x += wadjust; 1378 x += wadjust;
1372 from = i + 1; 1379 j = i + 1;
1373 width = 0; 1380 width = 0;
1374 } 1381 }
1375 if (from < i)
1376 font->driver->draw (s, from, i, x, y, 0);
1377 }
1378 else
1379 {
1380 for (i = 0, j = s->gidx; i < s->nchars; i++, j++)
1381 if (COMPOSITION_GLYPH (s->cmp, j) != '\t')
1382 {
1383 int xx = x + s->cmp->offsets[j * 2];
1384 int yy = y - s->cmp->offsets[j * 2 + 1];
1385
1386 font->driver->draw (s, j, j + 1, xx, yy, 0);
1387 if (s->face->overstrike)
1388 font->driver->draw (s, j, j + 1, xx + 1, yy, 0);
1389 }
1390 } 1382 }
1383 if (j < i)
1384 font->driver->draw (s, j, i, x, y, 0);
1391 } 1385 }
1392} 1386}
1393 1387
@@ -2701,7 +2695,8 @@ x_draw_glyph_string (s)
2701 break; 2695 break;
2702 2696
2703 case COMPOSITE_GLYPH: 2697 case COMPOSITE_GLYPH:
2704 if (s->for_overlaps || s->gidx > 0) 2698 if (s->for_overlaps || (s->cmp_from > 0
2699 && ! s->first_glyph->u.cmp.automatic))
2705 s->background_filled_p = 1; 2700 s->background_filled_p = 1;
2706 else 2701 else
2707 x_draw_glyph_string_background (s, 1); 2702 x_draw_glyph_string_background (s, 1);