diff options
| author | Kenichi Handa | 2009-02-04 01:48:37 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2009-02-04 01:48:37 +0000 |
| commit | f51994656d1f2ec148ca7cdeea86e930e51cfc29 (patch) | |
| tree | 66f5de35b11d2c0dae34215bbe9c4e142d7f9cfe /src/composite.c | |
| parent | d0984aff9503b9a685e67a50f0a16e8799131ede (diff) | |
| download | emacs-f51994656d1f2ec148ca7cdeea86e930e51cfc29.tar.gz emacs-f51994656d1f2ec148ca7cdeea86e930e51cfc29.zip | |
Include coding.h and termhooks.h.
(composition_gstring_p): Fix for the terminal case.
(composition_gstring_width): Likewise.
(fill_gstring_body): Likewise.
(autocmp_chars): For terminal, call Fcomposition_get_gstring with
the frame.
(composition_compute_stop_pos): Adjust cmp_it->stop_pos if point
is within a composition.
(Fcomposition_get_gstring): Fix the the terminal case.
Diffstat (limited to 'src/composite.c')
| -rw-r--r-- | src/composite.c | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/src/composite.c b/src/composite.c index dbf49592185..44fb9c43a95 100644 --- a/src/composite.c +++ b/src/composite.c | |||
| @@ -27,11 +27,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 27 | #include "lisp.h" | 27 | #include "lisp.h" |
| 28 | #include "buffer.h" | 28 | #include "buffer.h" |
| 29 | #include "character.h" | 29 | #include "character.h" |
| 30 | #include "coding.h" | ||
| 30 | #include "intervals.h" | 31 | #include "intervals.h" |
| 31 | #include "window.h" | 32 | #include "window.h" |
| 32 | #include "frame.h" | 33 | #include "frame.h" |
| 33 | #include "dispextern.h" | 34 | #include "dispextern.h" |
| 34 | #include "font.h" | 35 | #include "font.h" |
| 36 | #include "termhooks.h" | ||
| 37 | |||
| 35 | 38 | ||
| 36 | /* Emacs uses special text property `composition' to support character | 39 | /* Emacs uses special text property `composition' to support character |
| 37 | composition. A sequence of characters that have the same (i.e. eq) | 40 | composition. A sequence of characters that have the same (i.e. eq) |
| @@ -723,7 +726,8 @@ composition_gstring_p (gstring) | |||
| 723 | if (! VECTORP (header) || ASIZE (header) < 2) | 726 | if (! VECTORP (header) || ASIZE (header) < 2) |
| 724 | return 0; | 727 | return 0; |
| 725 | if (! NILP (LGSTRING_FONT (gstring)) | 728 | if (! NILP (LGSTRING_FONT (gstring)) |
| 726 | && ! FONT_OBJECT_P (LGSTRING_FONT (gstring))) | 729 | && (! FONT_OBJECT_P (LGSTRING_FONT (gstring)) |
| 730 | && ! CODING_SYSTEM_P (LGSTRING_FONT (gstring)))) | ||
| 727 | return 0; | 731 | return 0; |
| 728 | for (i = 1; i < ASIZE (LGSTRING_HEADER (gstring)); i++) | 732 | for (i = 1; i < ASIZE (LGSTRING_HEADER (gstring)); i++) |
| 729 | if (! NATNUMP (AREF (LGSTRING_HEADER (gstring), i))) | 733 | if (! NATNUMP (AREF (LGSTRING_HEADER (gstring), i))) |
| @@ -753,10 +757,19 @@ composition_gstring_width (gstring, from, to, metrics) | |||
| 753 | if (metrics) | 757 | if (metrics) |
| 754 | { | 758 | { |
| 755 | Lisp_Object font_object = LGSTRING_FONT (gstring); | 759 | Lisp_Object font_object = LGSTRING_FONT (gstring); |
| 756 | struct font *font = XFONT_OBJECT (font_object); | ||
| 757 | 760 | ||
| 758 | metrics->ascent = font->ascent; | 761 | if (FONT_OBJECT_P (font_object)) |
| 759 | metrics->descent = font->descent; | 762 | { |
| 763 | struct font *font = XFONT_OBJECT (font_object); | ||
| 764 | |||
| 765 | metrics->ascent = font->ascent; | ||
| 766 | metrics->descent = font->descent; | ||
| 767 | } | ||
| 768 | else | ||
| 769 | { | ||
| 770 | metrics->ascent = 1; | ||
| 771 | metrics->descent = 0; | ||
| 772 | } | ||
| 760 | metrics->width = metrics->lbearing = metrics->rbearing = 0; | 773 | metrics->width = metrics->lbearing = metrics->rbearing = 0; |
| 761 | } | 774 | } |
| 762 | for (glyph = &LGSTRING_GLYPH (gstring, from); from < to; from++, glyph++) | 775 | for (glyph = &LGSTRING_GLYPH (gstring, from); from < to; from++, glyph++) |
| @@ -874,7 +887,7 @@ fill_gstring_body (gstring) | |||
| 874 | LGLYPH_SET_FROM (g, i); | 887 | LGLYPH_SET_FROM (g, i); |
| 875 | LGLYPH_SET_TO (g, i); | 888 | LGLYPH_SET_TO (g, i); |
| 876 | LGLYPH_SET_CHAR (g, c); | 889 | LGLYPH_SET_CHAR (g, c); |
| 877 | if (! NILP (font_object)) | 890 | if (FONT_OBJECT_P (font_object)) |
| 878 | { | 891 | { |
| 879 | font_fill_lglyph_metrics (g, font_object); | 892 | font_fill_lglyph_metrics (g, font_object); |
| 880 | } | 893 | } |
| @@ -953,7 +966,9 @@ autocmp_chars (cft_element, charpos, bytepos, limit, win, face, string) | |||
| 953 | return unbind_to (count, Qnil); | 966 | return unbind_to (count, Qnil); |
| 954 | } | 967 | } |
| 955 | } | 968 | } |
| 969 | else | ||
| 956 | #endif /* not HAVE_WINDOW_SYSTEM */ | 970 | #endif /* not HAVE_WINDOW_SYSTEM */ |
| 971 | font_object = win->frame; | ||
| 957 | gstring = Fcomposition_get_gstring (pos, make_number (to), | 972 | gstring = Fcomposition_get_gstring (pos, make_number (to), |
| 958 | font_object, string); | 973 | font_object, string); |
| 959 | if (NILP (LGSTRING_ID (gstring))) | 974 | if (NILP (LGSTRING_ID (gstring))) |
| @@ -1007,6 +1022,8 @@ composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string) | |||
| 1007 | cmp_it->stop_pos = endpos = start; | 1022 | cmp_it->stop_pos = endpos = start; |
| 1008 | cmp_it->ch = -1; | 1023 | cmp_it->ch = -1; |
| 1009 | } | 1024 | } |
| 1025 | if (NILP (string) && PT > charpos && PT < endpos) | ||
| 1026 | cmp_it->stop_pos = PT; | ||
| 1010 | if (NILP (current_buffer->enable_multibyte_characters) | 1027 | if (NILP (current_buffer->enable_multibyte_characters) |
| 1011 | || ! FUNCTIONP (Vauto_composition_function)) | 1028 | || ! FUNCTIONP (Vauto_composition_function)) |
| 1012 | return; | 1029 | return; |
| @@ -1454,7 +1471,8 @@ DEFUN ("composition-get-gstring", Fcomposition_get_gstring, | |||
| 1454 | doc: /* Return a glyph-string for characters between FROM and TO. | 1471 | doc: /* Return a glyph-string for characters between FROM and TO. |
| 1455 | If the glyph string is for graphic display, FONT-OBJECT must be | 1472 | If the glyph string is for graphic display, FONT-OBJECT must be |
| 1456 | a font-object to use for those characters. | 1473 | a font-object to use for those characters. |
| 1457 | Otherwise (for terminal display), FONT-OBJECT must be nil. | 1474 | Otherwise (for terminal display), FONT-OBJECT must be a terminal ID, a |
| 1475 | frame, or nil for the selected frame's terminal device. | ||
| 1458 | 1476 | ||
| 1459 | If the optional 4th argument STRING is not nil, it is a string | 1477 | If the optional 4th argument STRING is not nil, it is a string |
| 1460 | containing the target characters between indices FROM and TO. | 1478 | containing the target characters between indices FROM and TO. |
| @@ -1467,7 +1485,7 @@ HEADER is a vector of this form: | |||
| 1467 | [FONT-OBJECT CHAR ...] | 1485 | [FONT-OBJECT CHAR ...] |
| 1468 | where | 1486 | where |
| 1469 | FONT-OBJECT is a font-object for all glyphs in the glyph-string, | 1487 | FONT-OBJECT is a font-object for all glyphs in the glyph-string, |
| 1470 | or nil if not yet decided. | 1488 | or the terminal coding system of the specified terminal. |
| 1471 | CHARs are characters to be composed by GLYPHs. | 1489 | CHARs are characters to be composed by GLYPHs. |
| 1472 | 1490 | ||
| 1473 | ID is an identification number of the glyph-string. It may be nil if | 1491 | ID is an identification number of the glyph-string. It may be nil if |
| @@ -1494,8 +1512,17 @@ should be ignored. */) | |||
| 1494 | 1512 | ||
| 1495 | CHECK_NATNUM (from); | 1513 | CHECK_NATNUM (from); |
| 1496 | CHECK_NATNUM (to); | 1514 | CHECK_NATNUM (to); |
| 1497 | if (! NILP (font_object)) | 1515 | if (! FONT_OBJECT_P (font_object)) |
| 1498 | CHECK_FONT_OBJECT (font_object); | 1516 | { |
| 1517 | struct coding_system *coding; | ||
| 1518 | struct terminal *terminal = get_terminal (font_object, 1); | ||
| 1519 | |||
| 1520 | coding = ((TERMINAL_TERMINAL_CODING (terminal)->common_flags | ||
| 1521 | & CODING_REQUIRE_ENCODING_MASK) | ||
| 1522 | ? TERMINAL_TERMINAL_CODING (terminal) : &safe_terminal_coding); | ||
| 1523 | font_object = CODING_ID_NAME (coding->id); | ||
| 1524 | } | ||
| 1525 | |||
| 1499 | header = fill_gstring_header (Qnil, from, to, font_object, string); | 1526 | header = fill_gstring_header (Qnil, from, to, font_object, string); |
| 1500 | gstring = gstring_lookup_cache (header); | 1527 | gstring = gstring_lookup_cache (header); |
| 1501 | if (! NILP (gstring)) | 1528 | if (! NILP (gstring)) |