Mercurial > emacs
comparison src/fontset.c @ 21553:2d7afcd11b72
(find_ccl_program_func): New variable.
(fs_load_font): Call a function pointed by find_ccl_program_func
instead of finding CCL program to encode a character by itself.
(Fquery_fontset): New optional 2nd arg REGEXPP. Callers changed.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Wed, 15 Apr 1998 07:12:49 +0000 |
parents | fa9ff387d260 |
children | d6f6ac5a5df3 |
comparison
equal
deleted
inserted
replaced
21552:14f3ce59e036 | 21553:2d7afcd11b72 |
---|---|
76 | 76 |
77 /* Additional function for setting fontset or changing fontset | 77 /* Additional function for setting fontset or changing fontset |
78 contents of frame F. */ | 78 contents of frame F. */ |
79 void (*set_frame_fontset_func) P_ ((FRAME_PTR f, Lisp_Object arg, | 79 void (*set_frame_fontset_func) P_ ((FRAME_PTR f, Lisp_Object arg, |
80 Lisp_Object oldval)); | 80 Lisp_Object oldval)); |
81 | |
82 /* To find a CCL program, fs_load_font calls this function. | |
83 The argument is a pointer to the struct font_info. | |
84 This function set the memer `encoder' of the structure. */ | |
85 void (*find_ccl_program_func) P_ ((struct font_info *)); | |
81 | 86 |
82 /* Check if any window system is used now. */ | 87 /* Check if any window system is used now. */ |
83 void (*check_window_system_func) P_ ((void)); | 88 void (*check_window_system_func) P_ ((void)); |
84 | 89 |
85 struct fontset_data * | 90 struct fontset_data * |
232 } | 237 } |
233 } | 238 } |
234 } | 239 } |
235 | 240 |
236 fontp->font_encoder = (struct ccl_program *) 0; | 241 fontp->font_encoder = (struct ccl_program *) 0; |
237 for (list = Vfont_ccl_encoder_alist; CONSP (list); list = XCONS (list)->cdr) | 242 |
238 { | 243 if (find_ccl_program_func) |
239 elt = XCONS (list)->car; | 244 (*find_ccl_program_func) (fontp); |
240 if (CONSP (elt) | |
241 && STRINGP (XCONS (elt)->car) && VECTORP (XCONS (elt)->cdr) | |
242 && fast_c_string_match_ignore_case (XCONS (elt)->car, fontname) >= 0) | |
243 { | |
244 fontp->font_encoder | |
245 = (struct ccl_program *) xmalloc (sizeof (struct ccl_program)); | |
246 setup_ccl_program (fontp->font_encoder, XCONS (elt)->cdr); | |
247 break; | |
248 } | |
249 } | |
250 | 245 |
251 /* If FONTSET is specified, setup various fields of it. */ | 246 /* If FONTSET is specified, setup various fields of it. */ |
252 if (fontsetp) | 247 if (fontsetp) |
253 { | 248 { |
254 fontsetp->font_indexes[charset] = fontp->font_idx; | 249 fontsetp->font_indexes[charset] = fontp->font_idx; |
447 } | 442 } |
448 | 443 |
449 return CACHED_FONTSET_REGEX; | 444 return CACHED_FONTSET_REGEX; |
450 } | 445 } |
451 | 446 |
452 DEFUN ("query-fontset", Fquery_fontset, Squery_fontset, 1, 1, 0, | 447 DEFUN ("query-fontset", Fquery_fontset, Squery_fontset, 1, 2, 0, |
453 "Return a fontset name which matches PATTERN, nil if no matching fontset.\n\ | 448 "Return a fontset name which matches PATTERN, nil if no matching fontset.\n\ |
454 PATTERN can contain `*' or `?' as a wild card\n\ | 449 PATTERN can contain `*' or `?' as a wild card\n\ |
455 just like X's font name matching algorithm allows.") | 450 just like X's font name matching algorithm allows.\n\ |
456 (pattern) | 451 If REGEXPP is non-nil, pattern is regexp;\n\ |
457 Lisp_Object pattern; | 452 so PATTERN is considered as regular expression.") |
453 (pattern, regexpp) | |
454 Lisp_Object pattern, regexpp; | |
458 { | 455 { |
459 Lisp_Object regexp, tem; | 456 Lisp_Object regexp, tem; |
460 | 457 |
461 (*check_window_system_func) (); | 458 (*check_window_system_func) (); |
462 | 459 |
467 | 464 |
468 tem = Frassoc (pattern, Vfontset_alias_alist); | 465 tem = Frassoc (pattern, Vfontset_alias_alist); |
469 if (!NILP (tem)) | 466 if (!NILP (tem)) |
470 return Fcar (tem); | 467 return Fcar (tem); |
471 | 468 |
472 regexp = fontset_pattern_regexp (pattern); | 469 if (NILP (regexpp)) |
470 regexp = fontset_pattern_regexp (pattern); | |
471 else | |
472 regexp = pattern; | |
473 | 473 |
474 for (tem = Vglobal_fontset_alist; CONSP (tem); tem = XCONS (tem)->cdr) | 474 for (tem = Vglobal_fontset_alist; CONSP (tem); tem = XCONS (tem)->cdr) |
475 { | 475 { |
476 Lisp_Object fontset_name = XCONS (XCONS (tem)->car)->car; | 476 Lisp_Object fontset_name = XCONS (XCONS (tem)->car)->car; |
477 if (!NILP (regexp)) | 477 if (!NILP (regexp)) |
564 (*check_window_system_func) (); | 564 (*check_window_system_func) (); |
565 | 565 |
566 CHECK_STRING (name, 0); | 566 CHECK_STRING (name, 0); |
567 CHECK_LIST (fontlist, 1); | 567 CHECK_LIST (fontlist, 1); |
568 | 568 |
569 fullname = Fquery_fontset (name); | 569 fullname = Fquery_fontset (name, Qnil); |
570 if (!NILP (fullname)) | 570 if (!NILP (fullname)) |
571 error ("Fontset \"%s\" matches the existing fontset \"%s\"", | 571 error ("Fontset \"%s\" matches the existing fontset \"%s\"", |
572 XSTRING (name)->data, XSTRING (fullname)->data); | 572 XSTRING (name)->data, XSTRING (fullname)->data); |
573 | 573 |
574 /* Check the validity of FONTLIST. */ | 574 /* Check the validity of FONTLIST. */ |
619 CHECK_LIVE_FRAME (frame, 3); | 619 CHECK_LIVE_FRAME (frame, 3); |
620 | 620 |
621 if ((charset = get_charset_id (charset_symbol)) < 0) | 621 if ((charset = get_charset_id (charset_symbol)) < 0) |
622 error ("Invalid charset: %s", XSYMBOL (charset_symbol)->name->data); | 622 error ("Invalid charset: %s", XSYMBOL (charset_symbol)->name->data); |
623 | 623 |
624 fullname = Fquery_fontset (name); | 624 fullname = Fquery_fontset (name, Qnil); |
625 if (NILP (fullname)) | 625 if (NILP (fullname)) |
626 error ("Fontset \"%s\" does not exist", XSTRING (name)->data); | 626 error ("Fontset \"%s\" does not exist", XSTRING (name)->data); |
627 | 627 |
628 /* If FRAME is not specified, we must, at first, update contents of | 628 /* If FRAME is not specified, we must, at first, update contents of |
629 `global-fontset-alist' for a frame created in the future. */ | 629 `global-fontset-alist' for a frame created in the future. */ |