Mercurial > hg > xemacs-beta
comparison src/objects-tty.c @ 70:131b0175ea99 r20-0b30
Import from CVS: tag r20-0b30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:02:59 +0200 |
parents | 859a2309aef8 |
children | 3d6bfa290dbd |
comparison
equal
deleted
inserted
replaced
69:804d1389bcd6 | 70:131b0175ea99 |
---|---|
25 #include "lisp.h" | 25 #include "lisp.h" |
26 | 26 |
27 #include "console-tty.h" | 27 #include "console-tty.h" |
28 #include "insdel.h" | 28 #include "insdel.h" |
29 #include "objects-tty.h" | 29 #include "objects-tty.h" |
30 #ifdef MULE | |
31 #include "device.h" | |
32 #include "mule-charset.h" | |
33 #endif | |
30 | 34 |
31 /* An alist mapping from color names to a cons of (FG-STRING, BG-STRING). */ | 35 /* An alist mapping from color names to a cons of (FG-STRING, BG-STRING). */ |
32 Lisp_Object Vtty_color_alist; | 36 Lisp_Object Vtty_color_alist; |
33 #if 0 /* This stuff doesn't quite work yet */ | 37 #if 0 /* This stuff doesn't quite work yet */ |
34 Lisp_Object Vtty_dynamic_color_fg; | 38 Lisp_Object Vtty_dynamic_color_fg; |
220 if (strncmp ((CONST char *) str, "normal", 6)) | 224 if (strncmp ((CONST char *) str, "normal", 6)) |
221 return 0; | 225 return 0; |
222 str += 6; | 226 str += 6; |
223 if (*str) | 227 if (*str) |
224 { | 228 { |
229 #ifdef MULE | |
230 if (*str != '/') | |
231 return 0; | |
232 str++; | |
233 charset = Ffind_charset (intern ((CONST char *) str)); | |
234 if (NILP (charset)) | |
235 return 0; | |
236 #else | |
225 return 0; | 237 return 0; |
238 #endif | |
226 } | 239 } |
227 | 240 |
228 /* Don't allocate the data until we're sure that we will succeed. */ | 241 /* Don't allocate the data until we're sure that we will succeed. */ |
229 f->data = malloc_type (struct tty_font_instance_data); | 242 f->data = malloc_type (struct tty_font_instance_data); |
230 FONT_INSTANCE_TTY_CHARSET (f) = charset; | 243 FONT_INSTANCE_TTY_CHARSET (f) = charset; |
244 #ifdef MULE | |
245 if (CHARSETP (charset)) | |
246 f->width = XCHARSET_COLUMNS (charset); | |
247 else | |
248 #endif | |
231 f->width = 1; | 249 f->width = 1; |
232 | 250 |
233 f->proportional_p = 0; | 251 f->proportional_p = 0; |
234 f->ascent = f->height = 1; | 252 f->ascent = f->height = 1; |
235 f->descent = 0; | 253 f->descent = 0; |
261 static Lisp_Object | 279 static Lisp_Object |
262 tty_list_fonts (Lisp_Object pattern, Lisp_Object device) | 280 tty_list_fonts (Lisp_Object pattern, Lisp_Object device) |
263 { | 281 { |
264 return list1 (build_string ("normal")); | 282 return list1 (build_string ("normal")); |
265 } | 283 } |
284 | |
285 #ifdef MULE | |
286 | |
287 static int | |
288 tty_font_spec_matches_charset (struct device *d, Lisp_Object charset, | |
289 CONST Bufbyte *nonreloc, Lisp_Object reloc, | |
290 Bytecount offset, Bytecount length) | |
291 { | |
292 CONST Bufbyte *the_nonreloc = nonreloc; | |
293 | |
294 if (!the_nonreloc) | |
295 the_nonreloc = XSTRING_DATA (reloc); | |
296 fixup_internal_substring (nonreloc, reloc, offset, &length); | |
297 the_nonreloc += offset; | |
298 | |
299 if (UNBOUNDP (charset)) | |
300 return !memchr (the_nonreloc, '/', length); | |
301 the_nonreloc = memchr (the_nonreloc, '/', length); | |
302 if (!the_nonreloc) | |
303 return 0; | |
304 the_nonreloc++; | |
305 { | |
306 struct Lisp_String *s = | |
307 symbol_name (XSYMBOL (XCHARSET_NAME (charset))); | |
308 return !strcmp ((CONST char *) the_nonreloc, | |
309 (CONST char *) string_data (s)); | |
310 } | |
311 } | |
312 | |
313 /* find a font spec that matches font spec FONT and also matches | |
314 (the registry of) CHARSET. */ | |
315 static Lisp_Object | |
316 tty_find_charset_font (Lisp_Object device, Lisp_Object font, | |
317 Lisp_Object charset) | |
318 { | |
319 Bufbyte *fontname = XSTRING_DATA (font); | |
320 | |
321 if (strchr ((CONST char *) fontname, '/')) | |
322 { | |
323 if (tty_font_spec_matches_charset (XDEVICE (device), charset, 0, | |
324 font, 0, -1)) | |
325 return font; | |
326 return Qnil; | |
327 } | |
328 | |
329 if (UNBOUNDP (charset)) | |
330 return font; | |
331 | |
332 return concat3 (font, build_string ("/"), | |
333 Fsymbol_name (XCHARSET_NAME (charset))); | |
334 } | |
335 | |
336 #endif /* MULE */ | |
266 | 337 |
267 | 338 |
268 /************************************************************************/ | 339 /************************************************************************/ |
269 /* initialization */ | 340 /* initialization */ |
270 /************************************************************************/ | 341 /************************************************************************/ |
297 CONSOLE_HAS_METHOD (tty, initialize_font_instance); | 368 CONSOLE_HAS_METHOD (tty, initialize_font_instance); |
298 CONSOLE_HAS_METHOD (tty, mark_font_instance); | 369 CONSOLE_HAS_METHOD (tty, mark_font_instance); |
299 CONSOLE_HAS_METHOD (tty, print_font_instance); | 370 CONSOLE_HAS_METHOD (tty, print_font_instance); |
300 CONSOLE_HAS_METHOD (tty, finalize_font_instance); | 371 CONSOLE_HAS_METHOD (tty, finalize_font_instance); |
301 CONSOLE_HAS_METHOD (tty, list_fonts); | 372 CONSOLE_HAS_METHOD (tty, list_fonts); |
373 #ifdef MULE | |
374 CONSOLE_HAS_METHOD (tty, font_spec_matches_charset); | |
375 CONSOLE_HAS_METHOD (tty, find_charset_font); | |
376 #endif | |
302 } | 377 } |
303 | 378 |
304 void | 379 void |
305 vars_of_objects_tty (void) | 380 vars_of_objects_tty (void) |
306 { | 381 { |