# HG changeset patch # User Kenichi Handa # Date 1076654415 0 # Node ID c734f0c6c3cac771900e0f9dd6bc77ad8867a93f # Parent 5dfe4d6f3b4aa5669e0fda1f8769bb269a2f75e7 (x_get_font_repertory): Fix for non-Unicode-bmp charset. diff -r 5dfe4d6f3b4a -r c734f0c6c3ca src/xterm.c --- a/src/xterm.c Fri Feb 13 02:26:48 2004 +0000 +++ b/src/xterm.c Fri Feb 13 06:40:15 2004 +0000 @@ -10085,8 +10085,8 @@ 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)); + struct charset *charset = CHARSET_FROM_ID (font_info->charset); + int offset = CHARSET_OFFSET (charset); table = Fmake_char_table (Qnil, Qnil); @@ -10097,7 +10097,17 @@ if (min_byte1 == 0 && max_byte1 == 0) { if (! font->per_char || font->all_chars_exist == True) - char_table_set_range (table, min_byte2, max_byte2, Qt); + { + if (offset >= 0) + char_table_set_range (table, offset + min_byte2, + offset + max_byte2, Qt); + else + for (; min_byte2 <= max_byte2; min_byte2++) + { + c = DECODE_CHAR (charset, min_byte2); + CHAR_TABLE_SET (table, c, Qt); + } + } else { XCharStruct *pcm = font->per_char; @@ -10110,12 +10120,13 @@ { if (from >= 0) { - if (! charset) - char_table_set_range (table, from, i - 1, Qt); + if (offset >= 0) + char_table_set_range (table, offset + from, + offset + i - 1, Qt); else for (; from < i; from++) { - c = ENCODE_CHAR (charset, from); + c = DECODE_CHAR (charset, from); CHAR_TABLE_SET (table, c, Qt); } from = -1; @@ -10126,12 +10137,13 @@ } if (from >= 0) { - if (! charset) - char_table_set_range (table, from, i - 1, Qt); + if (offset >= 0) + char_table_set_range (table, offset + from, offset + i - 1, + Qt); else for (; from < i; from++) { - c = ENCODE_CHAR (charset, from); + c = DECODE_CHAR (charset, from); CHAR_TABLE_SET (table, c, Qt); } } @@ -10143,17 +10155,18 @@ { int i, j; - if (! charset) + if (offset >= 0) for (i = min_byte1; i <= max_byte1; i++) - char_table_set_range (table, - (i << 8) | min_byte2, (i << 8) | max_byte2, - Qt); + char_table_set_range + (table, offset + ((i << 8) | min_byte2), + offset + ((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); + c = DECODE_CHAR (charset, code); + CHAR_TABLE_SET (table, c, Qt); } } else @@ -10172,9 +10185,10 @@ { if (from >= 0) { - if (! charset) - char_table_set_range (table, (i << 8) | from, - (i << 8) | (j - 1), Qt); + if (offset >= 0) + char_table_set_range + (table, offset + ((i << 8) | from), + offset + ((i << 8) | (j - 1)), Qt); else { for (; from < j; from++) @@ -10192,15 +10206,16 @@ } if (from >= 0) { - if (! charset) - char_table_set_range (table, (i << 8) | from, - (i << 8) | (j - 1), Qt); + if (offset >= 0) + char_table_set_range + (table, offset + ((i << 8) | from), + offset + ((i << 8) | (j - 1)), Qt); else { for (; from < j; from++) { unsigned code = (i << 8) | from; - c = ENCODE_CHAR (charset, code); + c = DECODE_CHAR (charset, code); CHAR_TABLE_SET (table, c, Qt); } }