[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/src composite.c
From: |
Kenichi Handa |
Subject: |
[Emacs-diffs] emacs/src composite.c |
Date: |
Wed, 04 Feb 2009 01:48:38 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Kenichi Handa <handa> 09/02/04 01:48:37
Modified files:
src : composite.c
Log message:
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.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/composite.c?cvsroot=emacs&r1=1.70&r2=1.71
Patches:
Index: composite.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/composite.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -b -r1.70 -r1.71
--- composite.c 8 Jan 2009 03:15:30 -0000 1.70
+++ composite.c 4 Feb 2009 01:48:37 -0000 1.71
@@ -27,11 +27,14 @@
#include "lisp.h"
#include "buffer.h"
#include "character.h"
+#include "coding.h"
#include "intervals.h"
#include "window.h"
#include "frame.h"
#include "dispextern.h"
#include "font.h"
+#include "termhooks.h"
+
/* Emacs uses special text property `composition' to support character
composition. A sequence of characters that have the same (i.e. eq)
@@ -723,7 +726,8 @@
if (! VECTORP (header) || ASIZE (header) < 2)
return 0;
if (! NILP (LGSTRING_FONT (gstring))
- && ! FONT_OBJECT_P (LGSTRING_FONT (gstring)))
+ && (! FONT_OBJECT_P (LGSTRING_FONT (gstring))
+ && ! CODING_SYSTEM_P (LGSTRING_FONT (gstring))))
return 0;
for (i = 1; i < ASIZE (LGSTRING_HEADER (gstring)); i++)
if (! NATNUMP (AREF (LGSTRING_HEADER (gstring), i)))
@@ -753,10 +757,19 @@
if (metrics)
{
Lisp_Object font_object = LGSTRING_FONT (gstring);
+
+ if (FONT_OBJECT_P (font_object))
+ {
struct font *font = XFONT_OBJECT (font_object);
metrics->ascent = font->ascent;
metrics->descent = font->descent;
+ }
+ else
+ {
+ metrics->ascent = 1;
+ metrics->descent = 0;
+ }
metrics->width = metrics->lbearing = metrics->rbearing = 0;
}
for (glyph = &LGSTRING_GLYPH (gstring, from); from < to; from++, glyph++)
@@ -874,7 +887,7 @@
LGLYPH_SET_FROM (g, i);
LGLYPH_SET_TO (g, i);
LGLYPH_SET_CHAR (g, c);
- if (! NILP (font_object))
+ if (FONT_OBJECT_P (font_object))
{
font_fill_lglyph_metrics (g, font_object);
}
@@ -953,7 +966,9 @@
return unbind_to (count, Qnil);
}
}
+ else
#endif /* not HAVE_WINDOW_SYSTEM */
+ font_object = win->frame;
gstring = Fcomposition_get_gstring (pos, make_number (to),
font_object, string);
if (NILP (LGSTRING_ID (gstring)))
@@ -1007,6 +1022,8 @@
cmp_it->stop_pos = endpos = start;
cmp_it->ch = -1;
}
+ if (NILP (string) && PT > charpos && PT < endpos)
+ cmp_it->stop_pos = PT;
if (NILP (current_buffer->enable_multibyte_characters)
|| ! FUNCTIONP (Vauto_composition_function))
return;
@@ -1454,7 +1471,8 @@
doc: /* Return a glyph-string for characters between FROM and TO.
If the glyph string is for graphic display, FONT-OBJECT must be
a font-object to use for those characters.
-Otherwise (for terminal display), FONT-OBJECT must be nil.
+Otherwise (for terminal display), FONT-OBJECT must be a terminal ID, a
+frame, or nil for the selected frame's terminal device.
If the optional 4th argument STRING is not nil, it is a string
containing the target characters between indices FROM and TO.
@@ -1467,7 +1485,7 @@
[FONT-OBJECT CHAR ...]
where
FONT-OBJECT is a font-object for all glyphs in the glyph-string,
- or nil if not yet decided.
+ or the terminal coding system of the specified terminal.
CHARs are characters to be composed by GLYPHs.
ID is an identification number of the glyph-string. It may be nil if
@@ -1494,8 +1512,17 @@
CHECK_NATNUM (from);
CHECK_NATNUM (to);
- if (! NILP (font_object))
- CHECK_FONT_OBJECT (font_object);
+ if (! FONT_OBJECT_P (font_object))
+ {
+ struct coding_system *coding;
+ struct terminal *terminal = get_terminal (font_object, 1);
+
+ coding = ((TERMINAL_TERMINAL_CODING (terminal)->common_flags
+ & CODING_REQUIRE_ENCODING_MASK)
+ ? TERMINAL_TERMINAL_CODING (terminal) : &safe_terminal_coding);
+ font_object = CODING_ID_NAME (coding->id);
+ }
+
header = fill_gstring_header (Qnil, from, to, font_object, string);
gstring = gstring_lookup_cache (header);
if (! NILP (gstring))
- [Emacs-diffs] emacs/src composite.c,
Kenichi Handa <=