diff options
| author | Kenichi Handa | 2003-10-06 11:23:25 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2003-10-06 11:23:25 +0000 |
| commit | 0e3dd87aae8b4a587c885f35a84781a545f7dd58 (patch) | |
| tree | 51a904d4ac9b1d256a9054640558d896fcb33bfe /src | |
| parent | f7a9f116b0f28e71717c155a9e4450fce4d9a1d1 (diff) | |
| download | emacs-0e3dd87aae8b4a587c885f35a84781a545f7dd58.tar.gz emacs-0e3dd87aae8b4a587c885f35a84781a545f7dd58.zip | |
(x_get_font_repertory): Handle the case that the
encoding of font is other than Unicode.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 77 |
1 files changed, 62 insertions, 15 deletions
diff --git a/src/xterm.c b/src/xterm.c index d02655c3892..c31318c88f4 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -10066,10 +10066,8 @@ x_find_ccl_program (fontp) | |||
| 10066 | 10066 | ||
| 10067 | 10067 | ||
| 10068 | /* Return a char-table whose elements are t if the font FONT_INFO | 10068 | /* Return a char-table whose elements are t if the font FONT_INFO |
| 10069 | contains a glyph for the corresponding character, and nil if not. | 10069 | contains a glyph for the corresponding character, and nil if |
| 10070 | 10070 | not. */ | |
| 10071 | Fixme: For the moment, this function works only for fonts whose | ||
| 10072 | glyph encoding is the same as Unicode (e.g. ISO10646-1 fonts). */ | ||
| 10073 | 10071 | ||
| 10074 | Lisp_Object | 10072 | Lisp_Object |
| 10075 | x_get_font_repertory (f, font_info) | 10073 | x_get_font_repertory (f, font_info) |
| @@ -10079,6 +10077,9 @@ x_get_font_repertory (f, font_info) | |||
| 10079 | XFontStruct *font = (XFontStruct *) font_info->font; | 10077 | XFontStruct *font = (XFontStruct *) font_info->font; |
| 10080 | Lisp_Object table; | 10078 | Lisp_Object table; |
| 10081 | int min_byte1, max_byte1, min_byte2, max_byte2; | 10079 | int min_byte1, max_byte1, min_byte2, max_byte2; |
| 10080 | int c; | ||
| 10081 | struct charset *charset = (font_info->charset == charset_unicode | ||
| 10082 | ? NULL : CHARSET_FROM_ID (font_info->charset)); | ||
| 10082 | 10083 | ||
| 10083 | table = Fmake_char_table (Qnil, Qnil); | 10084 | table = Fmake_char_table (Qnil, Qnil); |
| 10084 | 10085 | ||
| @@ -10102,7 +10103,14 @@ x_get_font_repertory (f, font_info) | |||
| 10102 | { | 10103 | { |
| 10103 | if (from >= 0) | 10104 | if (from >= 0) |
| 10104 | { | 10105 | { |
| 10105 | char_table_set_range (table, from, i - 1, Qt); | 10106 | if (! charset) |
| 10107 | char_table_set_range (table, from, i - 1, Qt); | ||
| 10108 | else | ||
| 10109 | for (; from < i; from++) | ||
| 10110 | { | ||
| 10111 | c = ENCODE_CHAR (charset, from); | ||
| 10112 | CHAR_TABLE_SET (table, c, Qt); | ||
| 10113 | } | ||
| 10106 | from = -1; | 10114 | from = -1; |
| 10107 | } | 10115 | } |
| 10108 | } | 10116 | } |
| @@ -10110,19 +10118,36 @@ x_get_font_repertory (f, font_info) | |||
| 10110 | from = i; | 10118 | from = i; |
| 10111 | } | 10119 | } |
| 10112 | if (from >= 0) | 10120 | if (from >= 0) |
| 10113 | char_table_set_range (table, from, i - 1, Qt); | 10121 | { |
| 10122 | if (! charset) | ||
| 10123 | char_table_set_range (table, from, i - 1, Qt); | ||
| 10124 | else | ||
| 10125 | for (; from < i; from++) | ||
| 10126 | { | ||
| 10127 | c = ENCODE_CHAR (charset, from); | ||
| 10128 | CHAR_TABLE_SET (table, c, Qt); | ||
| 10129 | } | ||
| 10130 | } | ||
| 10114 | } | 10131 | } |
| 10115 | } | 10132 | } |
| 10116 | else | 10133 | else |
| 10117 | { | 10134 | { |
| 10118 | if (! font->per_char || font->all_chars_exist == True) | 10135 | if (! font->per_char || font->all_chars_exist == True) |
| 10119 | { | 10136 | { |
| 10120 | int i; | 10137 | int i, j; |
| 10121 | 10138 | ||
| 10122 | for (i = min_byte1; i <= max_byte1; i++) | 10139 | if (! charset) |
| 10123 | char_table_set_range (table, | 10140 | for (i = min_byte1; i <= max_byte1; i++) |
| 10124 | (i << 8) | min_byte2, (i << 8) | max_byte2, | 10141 | char_table_set_range (table, |
| 10125 | Qt); | 10142 | (i << 8) | min_byte2, (i << 8) | max_byte2, |
| 10143 | Qt); | ||
| 10144 | else | ||
| 10145 | for (i = min_byte1; i <= max_byte1; i++) | ||
| 10146 | for (j = min_byte2; j <= max_byte2; j++) | ||
| 10147 | { | ||
| 10148 | unsigned code = (i << 8) | j; | ||
| 10149 | c = ENCODE_CHAR (charset, code); | ||
| 10150 | } | ||
| 10126 | } | 10151 | } |
| 10127 | else | 10152 | else |
| 10128 | { | 10153 | { |
| @@ -10140,8 +10165,18 @@ x_get_font_repertory (f, font_info) | |||
| 10140 | { | 10165 | { |
| 10141 | if (from >= 0) | 10166 | if (from >= 0) |
| 10142 | { | 10167 | { |
| 10143 | char_table_set_range (table, (i << 8) | from, | 10168 | if (! charset) |
| 10144 | (i << 8) | (j - 1), Qt); | 10169 | char_table_set_range (table, (i << 8) | from, |
| 10170 | (i << 8) | (j - 1), Qt); | ||
| 10171 | else | ||
| 10172 | { | ||
| 10173 | for (; from < j; from++) | ||
| 10174 | { | ||
| 10175 | unsigned code = (i << 8) | from; | ||
| 10176 | c = ENCODE_CHAR (charset, code); | ||
| 10177 | CHAR_TABLE_SET (table, c, Qt); | ||
| 10178 | } | ||
| 10179 | } | ||
| 10145 | from = -1; | 10180 | from = -1; |
| 10146 | } | 10181 | } |
| 10147 | } | 10182 | } |
| @@ -10149,8 +10184,20 @@ x_get_font_repertory (f, font_info) | |||
| 10149 | from = j; | 10184 | from = j; |
| 10150 | } | 10185 | } |
| 10151 | if (from >= 0) | 10186 | if (from >= 0) |
| 10152 | char_table_set_range (table, (i << 8) | from, | 10187 | { |
| 10153 | (i << 8) | (j - 1), Qt); | 10188 | if (! charset) |
| 10189 | char_table_set_range (table, (i << 8) | from, | ||
| 10190 | (i << 8) | (j - 1), Qt); | ||
| 10191 | else | ||
| 10192 | { | ||
| 10193 | for (; from < j; from++) | ||
| 10194 | { | ||
| 10195 | unsigned code = (i << 8) | from; | ||
| 10196 | c = ENCODE_CHAR (charset, code); | ||
| 10197 | CHAR_TABLE_SET (table, c, Qt); | ||
| 10198 | } | ||
| 10199 | } | ||
| 10200 | } | ||
| 10154 | } | 10201 | } |
| 10155 | } | 10202 | } |
| 10156 | } | 10203 | } |