Mercurial > emacs
comparison src/fontset.c @ 83112:30dd490f06f2
Merged in changes from CVS trunk.
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-230
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-231
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-232
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-233
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-234
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-235
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-236
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-237
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-238
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-239
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-240
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-152
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Fri, 23 Apr 2004 14:44:11 +0000 |
parents | d4d5e54871ff 450b41d3c078 |
children | e8df1878cfd1 |
comparison
equal
deleted
inserted
replaced
83111:fd147ed0d1b8 | 83112:30dd490f06f2 |
---|---|
193 static void fontset_set P_ ((Lisp_Object, int, Lisp_Object)); | 193 static void fontset_set P_ ((Lisp_Object, int, Lisp_Object)); |
194 static Lisp_Object make_fontset P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); | 194 static Lisp_Object make_fontset P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); |
195 static int fontset_id_valid_p P_ ((int)); | 195 static int fontset_id_valid_p P_ ((int)); |
196 static Lisp_Object fontset_pattern_regexp P_ ((Lisp_Object)); | 196 static Lisp_Object fontset_pattern_regexp P_ ((Lisp_Object)); |
197 static Lisp_Object font_family_registry P_ ((Lisp_Object, int)); | 197 static Lisp_Object font_family_registry P_ ((Lisp_Object, int)); |
198 static Lisp_Object regulalize_fontname P_ ((Lisp_Object)); | 198 static Lisp_Object regularize_fontname P_ ((Lisp_Object)); |
199 | 199 |
200 | 200 |
201 /********** MACROS AND FUNCTIONS TO HANDLE FONTSET **********/ | 201 /********** MACROS AND FUNCTIONS TO HANDLE FONTSET **********/ |
202 | 202 |
203 /* Return the fontset with ID. No check of ID's validness. */ | 203 /* Return the fontset with ID. No check of ID's validness. */ |
1041 | 1041 |
1042 /* Downcase FONTNAME or car and cdr of FONTNAME. If FONTNAME is a | 1042 /* Downcase FONTNAME or car and cdr of FONTNAME. If FONTNAME is a |
1043 string, maybe change FONTNAME to (FAMILY . REGISTRY). */ | 1043 string, maybe change FONTNAME to (FAMILY . REGISTRY). */ |
1044 | 1044 |
1045 static Lisp_Object | 1045 static Lisp_Object |
1046 regulalize_fontname (Lisp_Object fontname) | 1046 regularize_fontname (Lisp_Object fontname) |
1047 { | 1047 { |
1048 Lisp_Object family, registry; | 1048 Lisp_Object family, registry; |
1049 | 1049 |
1050 if (STRINGP (fontname)) | 1050 if (STRINGP (fontname)) |
1051 return font_family_registry (Fdowncase (fontname), 0); | 1051 return font_family_registry (Fdowncase (fontname), 0); |
1131 /* The arg FRAME is kept for backward compatibility. We only check | 1131 /* The arg FRAME is kept for backward compatibility. We only check |
1132 the validity. */ | 1132 the validity. */ |
1133 if (!NILP (frame)) | 1133 if (!NILP (frame)) |
1134 CHECK_LIVE_FRAME (frame); | 1134 CHECK_LIVE_FRAME (frame); |
1135 | 1135 |
1136 elt = Fcons (make_number (from), regulalize_fontname (fontname)); | 1136 elt = Fcons (make_number (from), regularize_fontname (fontname)); |
1137 for (; from <= to; from++) | 1137 for (; from <= to; from++) |
1138 FONTSET_SET (fontset, from, elt); | 1138 FONTSET_SET (fontset, from, elt); |
1139 Foptimize_char_table (fontset); | 1139 Foptimize_char_table (fontset); |
1140 | 1140 |
1141 /* If there's a realized fontset REALIZED whose parent is FONTSET, | 1141 /* If there's a realized fontset REALIZED whose parent is FONTSET, |
1210 | 1210 |
1211 | 1211 |
1212 /* Return a cons (FONT-NAME . GLYPH-CODE). | 1212 /* Return a cons (FONT-NAME . GLYPH-CODE). |
1213 FONT-NAME is the font name for the character at POSITION in the current | 1213 FONT-NAME is the font name for the character at POSITION in the current |
1214 buffer. This is computed from all the text properties and overlays | 1214 buffer. This is computed from all the text properties and overlays |
1215 that apply to POSITION. | 1215 that apply to POSITION. POSTION may be nil, in which case, |
1216 FONT-NAME is the font name for display the character CH with the | |
1217 default face. | |
1218 | |
1216 GLYPH-CODE is the glyph code in the font to use for the character. | 1219 GLYPH-CODE is the glyph code in the font to use for the character. |
1217 | 1220 |
1218 If the 2nd optional arg CH is non-nil, it is a character to check | 1221 If the 2nd optional arg CH is non-nil, it is a character to check |
1219 the font instead of the character at POSITION. | 1222 the font instead of the character at POSITION. |
1220 | 1223 |
1223 (1) The window system doesn't have a font for the character (thus | 1226 (1) The window system doesn't have a font for the character (thus |
1224 it is displayed by an empty box). | 1227 it is displayed by an empty box). |
1225 | 1228 |
1226 (2) The character code is invalid. | 1229 (2) The character code is invalid. |
1227 | 1230 |
1228 (3) The current buffer is not displayed in any window. | 1231 (3) If POSITION is not nil, and the current buffer is not displayed |
1232 in any window. | |
1229 | 1233 |
1230 In addition, the returned font name may not take into account of | 1234 In addition, the returned font name may not take into account of |
1231 such redisplay engine hooks as what used in jit-lock-mode if | 1235 such redisplay engine hooks as what used in jit-lock-mode if |
1232 POSITION is currently not visible. */ | 1236 POSITION is currently not visible. */ |
1233 | 1237 |
1238 Lisp_Object position, ch; | 1242 Lisp_Object position, ch; |
1239 { | 1243 { |
1240 int pos, pos_byte, dummy; | 1244 int pos, pos_byte, dummy; |
1241 int face_id; | 1245 int face_id; |
1242 int c, code; | 1246 int c, code; |
1243 Lisp_Object window; | |
1244 struct window *w; | |
1245 struct frame *f; | 1247 struct frame *f; |
1246 struct face *face; | 1248 struct face *face; |
1247 | 1249 |
1248 CHECK_NUMBER_COERCE_MARKER (position); | 1250 if (NILP (position)) |
1249 pos = XINT (position); | |
1250 if (pos < BEGV || pos >= ZV) | |
1251 args_out_of_range_3 (position, make_number (BEGV), make_number (ZV)); | |
1252 pos_byte = CHAR_TO_BYTE (pos); | |
1253 if (NILP (ch)) | |
1254 c = FETCH_CHAR (pos_byte); | |
1255 else | |
1256 { | 1251 { |
1257 CHECK_NATNUM (ch); | 1252 CHECK_NATNUM (ch); |
1258 c = XINT (ch); | 1253 c = XINT (ch); |
1254 f = XFRAME (selected_frame); | |
1255 face_id = DEFAULT_FACE_ID; | |
1256 } | |
1257 else | |
1258 { | |
1259 Lisp_Object window; | |
1260 struct window *w; | |
1261 | |
1262 CHECK_NUMBER_COERCE_MARKER (position); | |
1263 pos = XINT (position); | |
1264 if (pos < BEGV || pos >= ZV) | |
1265 args_out_of_range_3 (position, make_number (BEGV), make_number (ZV)); | |
1266 pos_byte = CHAR_TO_BYTE (pos); | |
1267 if (NILP (ch)) | |
1268 c = FETCH_CHAR (pos_byte); | |
1269 else | |
1270 { | |
1271 CHECK_NATNUM (ch); | |
1272 c = XINT (ch); | |
1273 } | |
1274 window = Fget_buffer_window (Fcurrent_buffer (), Qnil); | |
1275 if (NILP (window)) | |
1276 return Qnil; | |
1277 w = XWINDOW (window); | |
1278 f = XFRAME (w->frame); | |
1279 face_id = face_at_buffer_position (w, pos, -1, -1, &dummy, pos + 100, 0); | |
1259 } | 1280 } |
1260 if (! CHAR_VALID_P (c, 0)) | 1281 if (! CHAR_VALID_P (c, 0)) |
1261 return Qnil; | 1282 return Qnil; |
1262 window = Fget_buffer_window (Fcurrent_buffer (), Qnil); | |
1263 if (NILP (window)) | |
1264 return Qnil; | |
1265 w = XWINDOW (window); | |
1266 f = XFRAME (w->frame); | |
1267 face_id = face_at_buffer_position (w, pos, -1, -1, &dummy, pos + 100, 0); | |
1268 face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c); | 1283 face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c); |
1269 face = FACE_FROM_ID (f, face_id); | 1284 face = FACE_FROM_ID (f, face_id); |
1270 if (! face->font || ! face->font_name) | 1285 if (! face->font || ! face->font_name) |
1271 return Qnil; | 1286 return Qnil; |
1272 | 1287 |
1538 { | 1553 { |
1539 Lisp_Object elt, target; | 1554 Lisp_Object elt, target; |
1540 | 1555 |
1541 elt = XCAR (tail); | 1556 elt = XCAR (tail); |
1542 target = Fcar (elt); | 1557 target = Fcar (elt); |
1543 elt = Fcons (Qnil, regulalize_fontname (Fcdr (elt))); | 1558 elt = Fcons (Qnil, regularize_fontname (Fcdr (elt))); |
1544 if (! CHAR_TABLE_P (target)) | 1559 if (! CHAR_TABLE_P (target)) |
1545 { | 1560 { |
1546 int charset, c; | 1561 int charset, c; |
1547 | 1562 |
1548 CHECK_SYMBOL (target); | 1563 CHECK_SYMBOL (target); |