diff options
| author | Kenichi Handa | 1998-04-15 07:12:49 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1998-04-15 07:12:49 +0000 |
| commit | 727fb7903df0bfca302ac64abf7a7d714c515cab (patch) | |
| tree | fcad273b710b79fa61e9a0e22bc354f05b0533e2 /src/fontset.c | |
| parent | c2c8997eb30c25dd04ae658fb51fdb09f55e6939 (diff) | |
| download | emacs-727fb7903df0bfca302ac64abf7a7d714c515cab.tar.gz emacs-727fb7903df0bfca302ac64abf7a7d714c515cab.zip | |
(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.
Diffstat (limited to 'src/fontset.c')
| -rw-r--r-- | src/fontset.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/fontset.c b/src/fontset.c index 53cb240469a..0cdea26285f 100644 --- a/src/fontset.c +++ b/src/fontset.c | |||
| @@ -79,6 +79,11 @@ struct font_info *(*query_font_func) P_ ((FRAME_PTR f, char *name)); | |||
| 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 | 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 *)); | ||
| 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 | ||
| @@ -234,19 +239,9 @@ fs_load_font (f, font_table, charset, fontname, fontset) | |||
| 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) |
| @@ -449,12 +444,14 @@ fontset_pattern_regexp (pattern) | |||
| 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 | ||
| @@ -469,7 +466,10 @@ just like X's font name matching algorithm allows.") | |||
| 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 | { |
| @@ -566,7 +566,7 @@ FONTLIST is an alist of charsets vs corresponding font names.") | |||
| 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); |
| @@ -621,7 +621,7 @@ If FRAME is omitted or nil, all frames are affected.") | |||
| 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 | ||