4 Copyright (C) 1995 Free Software Foundation, Inc.
5 Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
24 #endif /* HAVE_ALLOCA_H */
31 Lisp_Object Vglobal_fontset_alist
;
33 Lisp_Object Vfont_encoding_alist
;
35 /* We had better have our own strcasecmp function because some system
37 static char my_strcasetbl
[256];
39 /* Compare two strings S0 and S1 while ignoring differences in case.
40 Return 1 if they differ, else return 0. */
42 my_strcasecmp (s0
, s1
)
43 unsigned char *s0
, *s1
;
46 if (my_strcasetbl
[*s0
++] != my_strcasetbl
[*s1
++]) return 1;
50 /* The following six are window system dependent functions. See
51 the comments in src/fontset.h for more detail. */
53 /* Return a pointer to struct font_info of font FONT_IDX of frame F. */
54 struct font_info
*(*get_font_info_func
) (/* FRAME_PTR f; int font_idx */);
56 /* Return a list of font names which matches PATTERN. See the document of
57 `x-list-fonts' for more detail. */
58 Lisp_Object (*list_fonts_func
) (/* Lisp_Object pattern, face, frame, width */);
60 /* Load a font named NAME for frame F and return a pointer to the
61 information of the loaded font. If loading is failed, return 0. */
62 struct font_info
*(*load_font_func
) (/* FRAME_PTR f; char *name */);
64 /* Return a pointer to struct font_info of a font named NAME for frame F. */
65 struct font_info
*(*query_font_func
) (/* FRAME_PTR f; char *name */);
67 /* Additional function for setting fontset or changing fontset
68 contents of frame F. */
69 void (*set_frame_fontset_func
) (/* FRAME_PTR f; Lisp_Object arg, oldval */);
71 /* Check if any window system is used now. */
72 void (*check_window_system_func
) ();
77 struct fontset_data
*fontset_data
78 = (struct fontset_data
*) xmalloc (sizeof (struct fontset_data
));
80 bzero (fontset_data
, sizeof (struct fontset_data
));
86 free_fontset_data (fontset_data
)
87 struct fontset_data
*fontset_data
;
91 for (i
= 0; i
< fontset_data
->n_fontsets
; i
++)
95 xfree (fontset_data
->fontset_table
[i
]->name
);
96 for (j
= 0; j
< MAX_CHARSET
; j
++)
97 if (fontset_data
->fontset_table
[i
]->fontname
[j
])
98 xfree (fontset_data
->fontset_table
[i
]->fontname
[j
]);
99 xfree (fontset_data
->fontset_table
[i
]);
101 xfree (fontset_data
->fontset_table
);
103 xfree (fontset_data
);
106 /* Load a font named FONTNAME for displaying CHARSET on frame F.
107 All fonts for frame F is stored in a table pointed by FONT_TABLE.
108 Return a pointer to the struct font_info of the loaded font.
109 If loading fails, return 0;
110 If FONTNAME is NULL, the name is taken from the information of FONTSET.
111 If FONTSET is given, try to load a font whose size matches that of
112 FONTSET, and, the font index is stored in the table for FONTSET. */
115 fs_load_font (f
, font_table
, charset
, fontname
, fontset
)
117 struct font_info
*font_table
;
118 int charset
, fontset
;
121 Lisp_Object font_list
;
122 Lisp_Object list
, elt
;
125 struct fontset_info
*fontsetp
= 0;
126 struct font_info
*fontp
;
128 if (fontset
>= 0 && fontset
< FRAME_FONTSET_DATA (f
)->n_fontsets
)
130 fontsetp
= FRAME_FONTSET_DATA (f
)->fontset_table
[fontset
];
131 font_idx
= fontsetp
->font_indexes
[charset
];
133 /* We have already loaded a font. */
134 return font_table
+ font_idx
;
135 else if (font_idx
== FONT_NOT_FOUND
)
136 /* We have already tried loading a font and failed. */
139 fontname
= fontsetp
->fontname
[charset
];
143 /* No way to get fontname. */
146 /* If a fontset is specified and we have already loaded some fonts
147 in the fontset, we need a font of appropriate size to be used
149 if (fontsetp
&& fontsetp
->size
)
150 size
= fontsetp
->size
* CHARSET_WIDTH (charset
);
152 fontp
= (*load_font_func
) (f
, fontname
, size
);
157 fontsetp
->font_indexes
[charset
] = FONT_NOT_FOUND
;
161 /* Fill in fields (CHARSET, ENCODING, and FONT_ENCODER) which are
162 not set by (*load_font_func). */
163 fontp
->charset
= charset
;
165 if (fontp
->encoding
[1] >= 0)
167 /* The font itself tells which code points to be used. Use this
168 encoding for all other charsets. */
171 fontp
->encoding
[0] = fontp
->encoding
[1];
172 for (i
= MIN_CHARSET_OFFICIAL_DIMENSION1
; i
< MAX_CHARSET
; i
++)
173 fontp
->encoding
[i
] = fontp
->encoding
[1];
177 /* The font itself doesn't tell which code points to be used. */
180 /* At first, set 1 (means 0xA0..0xFF) as the default. */
181 fontp
->encoding
[0] = 1;
182 for (i
= MIN_CHARSET_OFFICIAL_DIMENSION1
; i
< MAX_CHARSET
; i
++)
183 fontp
->encoding
[i
] = 1;
184 /* Then override them by a specification in Vfont_encoding_alist. */
185 for (list
= Vfont_encoding_alist
; CONSP (list
); list
= XCONS (list
)->cdr
)
187 elt
= XCONS (list
)->car
;
189 && STRINGP (XCONS (elt
)->car
) && CONSP (XCONS (elt
)->cdr
)
190 && (fast_string_match_ignore_case (XCONS (elt
)->car
, fontname
)
195 for (tmp
= XCONS (elt
)->cdr
; CONSP (tmp
); tmp
= XCONS (tmp
)->cdr
)
196 if (CONSP (XCONS (tmp
)->car
)
197 && INTEGERP (XCONS (XCONS (tmp
)->car
)->car
)
198 && ((i
= get_charset_id (XCONS (XCONS (tmp
)->car
)->car
))
200 && INTEGERP (XCONS (XCONS (tmp
)->car
)->cdr
)
201 && XFASTINT (XCONS (XCONS (tmp
)->car
)->cdr
) < 4)
203 = XFASTINT (XCONS (XCONS (tmp
)->car
)->cdr
);
208 fontp
->font_encoder
= (struct ccl_program
*) 0;
209 for (list
= Vfont_ccl_encoder_alist
; CONSP (list
); list
= XCONS (list
)->cdr
)
211 elt
= XCONS (list
)->car
;
213 && STRINGP (XCONS (elt
)->car
) && VECTORP (XCONS (elt
)->cdr
)
214 && fast_string_match_ignore_case (XCONS (elt
)->car
, fontname
) >= 0)
217 = (struct ccl_program
*) xmalloc (sizeof (struct ccl_program
));
218 setup_ccl_program (fontp
->font_encoder
, XCONS (elt
)->cdr
);
225 fontsetp
->font_indexes
[charset
] = fontp
->font_idx
;
226 if (fontsetp
->size
== 0)
227 fontsetp
->size
= fontp
->size
/ CHARSET_WIDTH (charset
);
229 if (charset
== CHARSET_ASCII
230 && fontsetp
->size
!= fontp
->size
)
232 /* When loading ASCII font of the different size from the
233 size of FONTSET, we have to update the size of FONTSET.
234 Since changing the size of FONTSET may make some fonts
235 already loaded inappropriate to be used in FONTSET, we
236 must delete the record of such fonts. In that case, we
237 also have to calculate the height of FONTSET from the
241 fontsetp
->size
= fontp
->size
;
242 fontsetp
->height
= fontp
->height
;
243 for (i
= CHARSET_ASCII
+ 1; i
< MAX_CHARSET
; i
++)
245 font_idx
= fontsetp
->font_indexes
[i
];
248 struct font_info
*fontp2
= font_table
+ font_idx
;
250 if (fontp2
->size
!= fontp
->size
* CHARSET_WIDTH (i
))
251 fontsetp
->font_indexes
[i
] = FONT_NOT_OPENED
;
252 else if (fontsetp
->height
< fontp
->height
)
253 fontsetp
->height
= fontp
->height
;
257 else if (fontsetp
->height
< fontp
->height
)
258 fontsetp
->height
= fontp
->height
;
264 /* Return ID of the fontset named NAME on frame F. */
267 fs_query_fontset (f
, name
)
271 struct fontset_data
*fontset_data
= FRAME_FONTSET_DATA (f
);
274 for (i
= 0; i
< fontset_data
->n_fontsets
; i
++)
275 if (!my_strcasecmp(name
, fontset_data
->fontset_table
[i
]->name
))
280 /* Register a fontset specified by FONTSET_INFO for frame FRAME.
281 Return the fontset ID if successfully registered, else return -1.
282 FONTSET_INFO is a cons of name of the fontset and FONTLIST, where
283 FONTLIST is an alist of charsets vs fontnames. */
286 fs_register_fontset (f
, fontset_info
)
288 Lisp_Object fontset_info
;
290 struct fontset_data
*fontset_data
= FRAME_FONTSET_DATA (f
);
291 Lisp_Object name
, fontlist
;
293 struct fontset_info
*fontsetp
;
296 if (!CONSP (fontset_info
)
297 || !STRINGP (XCONS (fontset_info
)->car
)
298 || !CONSP (XCONS (fontset_info
)->cdr
))
299 /* Invalid data in FONTSET_INFO. */
302 name
= XCONS (fontset_info
)->car
;
303 if ((fontset
= fs_query_fontset (f
, XSTRING (name
)->data
)) >= 0)
304 /* This fontset already exists on frame F. */
307 fontsetp
= (struct fontset_info
*) xmalloc (sizeof (struct fontset_info
));
309 fontsetp
->name
= (char *) xmalloc (XSTRING (name
)->size
+ 1);
310 bcopy(XSTRING (name
)->data
, fontsetp
->name
, XSTRING (name
)->size
+ 1);
312 fontsetp
->size
= fontsetp
->height
= 0;
314 for (i
= 0; i
< MAX_CHARSET
; i
++)
316 fontsetp
->fontname
[i
] = (char *) 0;
317 fontsetp
->font_indexes
[i
] = FONT_NOT_OPENED
;
320 for (fontlist
= XCONS (fontset_info
)->cdr
; CONSP (fontlist
);
321 fontlist
= XCONS (fontlist
)->cdr
)
323 Lisp_Object tem
= Fcar (fontlist
);
327 && (charset
= get_charset_id (XCONS (tem
)->car
)) >= 0
328 && STRINGP (XCONS (tem
)->cdr
))
330 fontsetp
->fontname
[charset
]
331 = (char *) xmalloc (XSTRING (XCONS (tem
)->cdr
)->size
+ 1);
332 bcopy (XSTRING (XCONS (tem
)->cdr
)->data
,
333 fontsetp
->fontname
[charset
],
334 XSTRING (XCONS (tem
)->cdr
)->size
+ 1);
337 /* Broken or invalid data structure. */
341 /* Do we need to create the table? */
342 if (fontset_data
->fontset_table_size
== 0)
344 fontset_data
->fontset_table_size
= 8;
345 fontset_data
->fontset_table
346 = (struct fontset_info
**) xmalloc (fontset_data
->fontset_table_size
347 * sizeof (struct fontset_info
*));
349 /* Do we need to grow the table? */
350 else if (fontset_data
->n_fontsets
>= fontset_data
->fontset_table_size
)
352 fontset_data
->fontset_table_size
+= 8;
353 fontset_data
->fontset_table
354 = (struct fontset_info
**) xrealloc (fontset_data
->fontset_table
,
355 fontset_data
->fontset_table_size
356 * sizeof (struct fontset_info
*));
358 fontset
= fontset_data
->n_fontsets
++;
359 fontset_data
->fontset_table
[fontset
] = fontsetp
;
364 /* Cache data used by fontset_pattern_regexp. The car part is a
365 pattern string containing at least one wild card, the cdr part is
366 the corresponding regular expression. */
367 static Lisp_Object Vcached_fontset_data
;
369 #define CACHED_FONTSET_NAME (XSTRING (XCONS (Vcached_fontset_data)->car)->data)
370 #define CACHED_FONTSET_REGEX (XCONS (Vcached_fontset_data)->cdr)
372 /* If fontset name PATTERN contains any wild card, return regular
373 expression corresponding to PATTERN. */
376 fontset_pattern_regexp (pattern
)
381 if (!index (XSTRING (pattern
)->data
, '*')
382 && !index (XSTRING (pattern
)->data
, '?'))
383 /* PATTERN does not contain any wild cards. */
385 if (XSTRING (pattern
)->size
> 8
386 && ! bcmp (XSTRING (pattern
)->data
, "fontset-", 8))
387 /* Just a nickname of a fontset is specified. */
393 if (!CONSP (Vcached_fontset_data
)
394 || strcmp (XSTRING (pattern
)->data
, CACHED_FONTSET_NAME
))
396 /* We must at first update the cached data. */
397 char *regex
= (char *) alloca (XSTRING (pattern
)->size
* 2 + 3);
398 char *p0
, *p1
= regex
;
402 /* Just prepend ".*-" to PATTERN. */
403 *p1
++= '.'; *p1
++= '*', *p1
++= '-';
404 bcopy (XSTRING (pattern
)->data
, p1
, XSTRING (pattern
)->size
);
405 p1
+= XSTRING (pattern
)->size
;
409 /* Convert "*" to ".*", "?" to ".". */
411 for (p0
= XSTRING (pattern
)->data
; *p0
; p0
++)
427 Vcached_fontset_data
= Fcons (build_string (XSTRING (pattern
)->data
),
428 build_string (regex
));
431 return CACHED_FONTSET_REGEX
;
434 DEFUN ("query-fontset", Fquery_fontset
, Squery_fontset
, 1, 1, 0,
435 "Return a fontset name which matches PATTERN, nil if no matching fontset.\n\
436 PATTERN can contain `*' or `?' as a wild card\n\
437 just like X's font name matching algorithm allows.")
441 Lisp_Object regexp
, tem
;
443 (*check_window_system_func
) ();
445 CHECK_STRING (pattern
, 0);
447 if (XSTRING (pattern
)->size
== 0)
450 regexp
= fontset_pattern_regexp (pattern
);
452 for (tem
= Vglobal_fontset_alist
; CONSP (tem
); tem
= XCONS (tem
)->cdr
)
454 Lisp_Object fontset_name
= XCONS (XCONS (tem
)->car
)->car
;
457 if (fast_string_match_ignore_case (regexp
,
458 XSTRING (fontset_name
)->data
)
464 if (!my_strcasecmp (XSTRING (pattern
)->data
,
465 XSTRING (fontset_name
)->data
))
473 Lisp_Object
Fframe_char_width ();
475 /* Return a list of names of available fontsets matching PATTERN on
476 frame F. If SIZE is not 0, it is the size (maximum bound width) of
477 fontsets to be listed. */
480 list_fontsets (f
, pattern
, size
)
486 Lisp_Object regexp
, val
;
488 regexp
= fontset_pattern_regexp (pattern
);
491 for (i
= 0; i
< FRAME_FONTSET_DATA (f
)->n_fontsets
; i
++)
493 struct fontset_info
*fontsetp
= FRAME_FONTSET_DATA (f
)->fontset_table
[i
];
494 int name_matched
= 0;
495 int size_matched
= 0;
499 if (fast_string_match_ignore_case (regexp
, fontsetp
->name
) >= 0)
504 if (!my_strcasecmp (XSTRING (pattern
)->data
, fontsetp
->name
))
510 if (!size
|| fontsetp
->size
== size
)
512 else if (fontsetp
->size
== 0)
514 /* No font of this fontset has loaded yet. Try loading
518 for (j
= 0; j
< MAX_CHARSET
; j
++)
519 if (fontsetp
->fontname
[j
])
521 if ((*load_font_func
) (f
, fontsetp
->fontname
[j
], size
))
528 val
= Fcons (build_string (fontsetp
->name
), val
);
535 DEFUN ("new-fontset", Fnew_fontset
, Snew_fontset
, 2, 2, 0,
536 "Create a new fontset NAME which contains fonts in FONTLIST.\n\
537 FONTLIST is an alist of charsets vs corresponding font names.")
539 Lisp_Object name
, fontlist
;
541 Lisp_Object fullname
, fontset_info
;
544 (*check_window_system_func
) ();
546 CHECK_STRING (name
, 0);
547 CHECK_LIST (fontlist
, 1);
549 fullname
= Fquery_fontset (name
);
550 if (!NILP (fullname
))
551 error ("Fontset \"%s\" matches the existing fontset \"%s\"",
552 XSTRING (name
)->data
, XSTRING (fullname
)->data
);
554 /* Check the validity of FONTLIST. */
555 for (tail
= fontlist
; CONSP (tail
); tail
= XCONS (tail
)->cdr
)
557 Lisp_Object tem
= XCONS (tail
)->car
;
561 || (charset
= get_charset_id (XCONS (tem
)->car
)) < 0
562 || !STRINGP (XCONS (tem
)->cdr
))
563 error ("Elements of fontlist must be a cons of charset and font name");
566 fontset_info
= Fcons (name
, fontlist
);
567 Vglobal_fontset_alist
= Fcons (fontset_info
, Vglobal_fontset_alist
);
569 /* Register this fontset for all existing frames. */
571 Lisp_Object framelist
, frame
;
573 FOR_EACH_FRAME (framelist
, frame
)
574 if (!FRAME_TERMCAP_P (XFRAME (frame
)))
575 fs_register_fontset (XFRAME (frame
), fontset_info
);
581 extern Lisp_Object
Fframe_parameters ();
582 extern Lisp_Object Qfont
;
583 Lisp_Object Qfontset
;
585 DEFUN ("set-fontset-font", Fset_fontset_font
, Sset_fontset_font
, 3, 4, 0,
586 "Set FONTNAME for a font of CHARSET in fontset NAME on frame FRAME.\n\
587 If FRAME is omitted or nil, all frames are affected.")
588 (name
, charset_symbol
, fontname
, frame
)
589 Lisp_Object name
, charset_symbol
, fontname
, frame
;
592 Lisp_Object fullname
, fontlist
;
594 (*check_window_system_func
) ();
596 CHECK_STRING (name
, 0);
597 CHECK_SYMBOL (charset_symbol
, 1);
598 CHECK_STRING (fontname
, 2);
600 CHECK_LIVE_FRAME (frame
, 3);
602 if ((charset
= get_charset_id (charset_symbol
)) < 0)
603 error ("Invalid charset: %s", XSYMBOL (charset_symbol
)->name
->data
);
605 fullname
= Fquery_fontset (name
);
607 error ("Fontset \"%s\" does not exist", XSTRING (name
)->data
);
609 /* If FRAME is not specified, we must, at first, update contents of
610 `global-fontset-alist' for a frame created in the future. */
613 Lisp_Object fontset_info
= Fassoc (fullname
, Vglobal_fontset_alist
);
614 Lisp_Object tem
= Fassq (charset
, XCONS (fontset_info
)->cdr
);
617 XCONS (fontset_info
)->cdr
618 = Fcons (Fcons (charset
, fontname
), XCONS (fontset_info
)->cdr
);
620 XCONS (tem
)->cdr
= fontname
;
623 /* Then, update information in the specified frame or all existing
626 Lisp_Object framelist
, tem
;
628 FOR_EACH_FRAME (framelist
, tem
)
629 if (!FRAME_TERMCAP_P (XFRAME (tem
))
630 && (NILP (frame
) || EQ (frame
, tem
)))
632 FRAME_PTR f
= XFRAME (tem
);
633 int fontset
= fs_query_fontset (f
, XSTRING (fullname
)->data
);
634 struct fontset_info
*fontsetp
635 = FRAME_FONTSET_DATA (f
)->fontset_table
[fontset
];
637 if (fontsetp
->fontname
[XINT (charset
)])
638 xfree (fontsetp
->fontname
[XINT (charset
)]);
639 fontsetp
->fontname
[XINT (charset
)]
640 = (char *) xmalloc (XSTRING (fontname
)->size
+ 1);
641 bcopy (XSTRING (fontname
)->data
, fontsetp
->fontname
[XINT (charset
)],
642 XSTRING (fontname
)->size
+ 1);
643 fontsetp
->font_indexes
[XINT (charset
)] = FONT_NOT_OPENED
;
645 if (charset
== CHARSET_ASCII
)
647 Lisp_Object font_param
= Fassq (Qfont
, Fframe_parameters (tem
));
649 if (set_frame_fontset_func
650 && !NILP (font_param
)
651 && !strcmp (XSTRING (fullname
)->data
,
652 XSTRING (XCONS (font_param
)->cdr
)->data
))
653 /* This fontset is the default fontset on frame TEM.
654 We may have to resize this frame because of new
656 (*set_frame_fontset_func
) (f
, fullname
, Qnil
);
664 DEFUN ("font-info", Ffont_info
, Sfont_info
, 1, 2, 0,
665 "Return information about a font named NAME on frame FRAME.\n\
666 If FRAME is omitted or nil, use the selected frame.\n\
667 The returned value is a vector of OPENED-NAME, FULL-NAME, CHARSET, SIZE,\n\
668 HEIGHT, BASELINE-OFFSET, and RELATIVE-COMPOSE,\n\
670 OPENED-NAME is the name used for opening the font,\n\
671 FULL-NAME is the full name of the font,\n\
672 CHARSET is the charset displayed by the font,\n\
673 SIZE is the minimum bound width of the font,\n\
674 HEIGHT is the height of the font,\n\
675 BASELINE-OFFSET is the upward offset pixels from ASCII baseline,\n\
676 RELATIVE-COMPOSE is the number controlling how to compose characters.\n\
677 If the named font is not yet loaded, return nil.")
679 Lisp_Object name
, frame
;
682 struct font_info
*fontp
;
685 (*check_window_system_func
) ();
687 CHECK_STRING (name
, 0);
692 CHECK_LIVE_FRAME (frame
, 1);
696 if (!query_font_func
)
697 error ("Font query function is not supported");
699 fontp
= (*query_font_func
) (f
, XSTRING (name
)->data
);
703 info
= Fmake_vector (make_number (6), Qnil
);
705 XVECTOR (info
)->contents
[0] = build_string (fontp
->name
);
706 XVECTOR (info
)->contents
[1] = build_string (fontp
->full_name
);
707 XVECTOR (info
)->contents
[2] = CHARSET_SYMBOL (fontp
->charset
);
708 XVECTOR (info
)->contents
[3] = make_number (fontp
->size
);
709 XVECTOR (info
)->contents
[4] = make_number (fontp
->height
);
710 XVECTOR (info
)->contents
[5] = make_number (fontp
->baseline_offset
);
711 XVECTOR (info
)->contents
[6] = make_number (fontp
->relative_compose
);
716 DEFUN ("fontset-info", Ffontset_info
, Sfontset_info
, 1, 2, 0,
717 "Return information about a fontset named NAME on frame FRAME.\n\
718 If FRAME is omitted or nil, use the selected frame.\n\
719 The returned value is a vector of SIZE, HEIGHT, and FONT-LIST,\n\
721 SIZE is the minimum bound width of ASCII font of the fontset,\n\
722 HEIGHT is the height of the tallest font in the fontset, and\n\
723 FONT-LIST is an alist of the format:\n\
724 (CHARSET REQUESTED-FONT-NAME LOADED-FONT-NAME).\n\
725 LOADED-FONT-NAME t means the font is not yet loaded, nil means the\n\
728 Lisp_Object name
, frame
;
732 struct fontset_info
*fontsetp
;
733 Lisp_Object info
, val
;
736 (*check_window_system_func
) ();
738 CHECK_STRING(name
, 0);
743 CHECK_LIVE_FRAME (frame
, 1);
747 fontset
= fs_query_fontset (f
, XSTRING (name
)->data
);
749 error ("Fontset \"%s\" does not exist", XSTRING (name
)->data
);
751 info
= Fmake_vector (make_number (3), Qnil
);
753 fontsetp
= FRAME_FONTSET_DATA (f
)->fontset_table
[fontset
];
755 XVECTOR (info
)->contents
[0] = make_number (fontsetp
->size
);
756 XVECTOR (info
)->contents
[1] = make_number (fontsetp
->height
);
758 for (i
= 0; i
< MAX_CHARSET
; i
++)
759 if (fontsetp
->fontname
[i
])
761 int font_idx
= fontsetp
->font_indexes
[i
];
764 if (font_idx
== FONT_NOT_OPENED
)
766 else if (font_idx
== FONT_NOT_FOUND
)
770 = build_string ((*get_font_info_func
) (f
, font_idx
)->full_name
);
771 val
= Fcons (Fcons (CHARSET_SYMBOL (i
),
772 Fcons (build_string (fontsetp
->fontname
[i
]),
773 Fcons (loaded
, Qnil
))),
776 XVECTOR (info
)->contents
[2] = val
;
784 for (i
= 0; i
< 256; i
++)
785 my_strcasetbl
[i
] = (i
>= 'A' && i
<= 'Z') ? i
+ 'a' - 'A' : i
;
788 /* Window system initializer should have set proper functions. */
791 staticpro (&Qfontset
);
793 Vcached_fontset_data
= Qnil
;
794 staticpro (&Vcached_fontset_data
);
796 DEFVAR_LISP ("global-fontset-alist", &Vglobal_fontset_alist
,
797 "Internal data for fontset. Not for external use.\n\
798 This is an alist associating fontset names with the lists of fonts\n\
799 contained in them.\n\
800 Newly created frames make their own fontset database from here.");
801 Vglobal_fontset_alist
= Qnil
;
803 DEFVAR_LISP ("font-encoding-alist", &Vfont_encoding_alist
,
804 "Alist of fontname patterns vs corresponding encoding info.\n\
805 Each element looks like (REGEXP . ENCODING-INFO),\n\
806 where ENCODING-INFO is an alist of CHARSET vs ENCODING.\n\
807 ENCODING is one of the following integer values:\n\
808 0: code points 0x20..0x7F or 0x2020..0x7F7F are used,\n\
809 1: code points 0xA0..0xFF or 0xA0A0..0xFFFF are used,\n\
810 2: code points 0x20A0..0x7FFF are used,\n\
811 3: code points 0xA020..0xFF7F are used.");
812 Vfont_encoding_alist
= Qnil
;
814 defsubr (&Squery_fontset
);
815 defsubr (&Snew_fontset
);
816 defsubr (&Sset_fontset_font
);
817 defsubr (&Sfont_info
);
818 defsubr (&Sfontset_info
);