/* Return a char-table whose elements are t if the font FONT_INFO
- contains a glyph for the corresponding character, and nil if not.
-
- Fixme: For the moment, this function works only for fonts whose
- glyph encoding is the same as Unicode (e.g. ISO10646-1 fonts). */
+ contains a glyph for the corresponding character, and nil if
+ not. */
Lisp_Object
x_get_font_repertory (f, font_info)
XFontStruct *font = (XFontStruct *) font_info->font;
Lisp_Object table;
int min_byte1, max_byte1, min_byte2, max_byte2;
+ int c;
+ struct charset *charset = (font_info->charset == charset_unicode
+ ? NULL : CHARSET_FROM_ID (font_info->charset));
table = Fmake_char_table (Qnil, Qnil);
{
if (from >= 0)
{
- char_table_set_range (table, from, i - 1, Qt);
+ if (! charset)
+ char_table_set_range (table, from, i - 1, Qt);
+ else
+ for (; from < i; from++)
+ {
+ c = ENCODE_CHAR (charset, from);
+ CHAR_TABLE_SET (table, c, Qt);
+ }
from = -1;
}
}
from = i;
}
if (from >= 0)
- char_table_set_range (table, from, i - 1, Qt);
+ {
+ if (! charset)
+ char_table_set_range (table, from, i - 1, Qt);
+ else
+ for (; from < i; from++)
+ {
+ c = ENCODE_CHAR (charset, from);
+ CHAR_TABLE_SET (table, c, Qt);
+ }
+ }
}
}
else
{
if (! font->per_char || font->all_chars_exist == True)
{
- int i;
+ int i, j;
- for (i = min_byte1; i <= max_byte1; i++)
- char_table_set_range (table,
- (i << 8) | min_byte2, (i << 8) | max_byte2,
- Qt);
+ if (! charset)
+ for (i = min_byte1; i <= max_byte1; i++)
+ char_table_set_range (table,
+ (i << 8) | min_byte2, (i << 8) | max_byte2,
+ Qt);
+ else
+ for (i = min_byte1; i <= max_byte1; i++)
+ for (j = min_byte2; j <= max_byte2; j++)
+ {
+ unsigned code = (i << 8) | j;
+ c = ENCODE_CHAR (charset, code);
+ }
}
else
{
{
if (from >= 0)
{
- char_table_set_range (table, (i << 8) | from,
- (i << 8) | (j - 1), Qt);
+ if (! charset)
+ char_table_set_range (table, (i << 8) | from,
+ (i << 8) | (j - 1), Qt);
+ else
+ {
+ for (; from < j; from++)
+ {
+ unsigned code = (i << 8) | from;
+ c = ENCODE_CHAR (charset, code);
+ CHAR_TABLE_SET (table, c, Qt);
+ }
+ }
from = -1;
}
}
from = j;
}
if (from >= 0)
- char_table_set_range (table, (i << 8) | from,
- (i << 8) | (j - 1), Qt);
+ {
+ if (! charset)
+ char_table_set_range (table, (i << 8) | from,
+ (i << 8) | (j - 1), Qt);
+ else
+ {
+ for (; from < j; from++)
+ {
+ unsigned code = (i << 8) | from;
+ c = ENCODE_CHAR (charset, code);
+ CHAR_TABLE_SET (table, c, Qt);
+ }
+ }
+ }
}
}
}