comparison src/xterm.c @ 89828:c734f0c6c3ca

(x_get_font_repertory): Fix for non-Unicode-bmp charset.
author Kenichi Handa <handa@m17n.org>
date Fri, 13 Feb 2004 06:40:15 +0000
parents 7d1daf16ade9
children 982dd1857a87
comparison
equal deleted inserted replaced
89827:5dfe4d6f3b4a 89828:c734f0c6c3ca
10083 { 10083 {
10084 XFontStruct *font = (XFontStruct *) font_info->font; 10084 XFontStruct *font = (XFontStruct *) font_info->font;
10085 Lisp_Object table; 10085 Lisp_Object table;
10086 int min_byte1, max_byte1, min_byte2, max_byte2; 10086 int min_byte1, max_byte1, min_byte2, max_byte2;
10087 int c; 10087 int c;
10088 struct charset *charset = (font_info->charset == charset_unicode 10088 struct charset *charset = CHARSET_FROM_ID (font_info->charset);
10089 ? NULL : CHARSET_FROM_ID (font_info->charset)); 10089 int offset = CHARSET_OFFSET (charset);
10090 10090
10091 table = Fmake_char_table (Qnil, Qnil); 10091 table = Fmake_char_table (Qnil, Qnil);
10092 10092
10093 min_byte1 = font->min_byte1; 10093 min_byte1 = font->min_byte1;
10094 max_byte1 = font->max_byte1; 10094 max_byte1 = font->max_byte1;
10095 min_byte2 = font->min_char_or_byte2; 10095 min_byte2 = font->min_char_or_byte2;
10096 max_byte2 = font->max_char_or_byte2; 10096 max_byte2 = font->max_char_or_byte2;
10097 if (min_byte1 == 0 && max_byte1 == 0) 10097 if (min_byte1 == 0 && max_byte1 == 0)
10098 { 10098 {
10099 if (! font->per_char || font->all_chars_exist == True) 10099 if (! font->per_char || font->all_chars_exist == True)
10100 char_table_set_range (table, min_byte2, max_byte2, Qt); 10100 {
10101 if (offset >= 0)
10102 char_table_set_range (table, offset + min_byte2,
10103 offset + max_byte2, Qt);
10104 else
10105 for (; min_byte2 <= max_byte2; min_byte2++)
10106 {
10107 c = DECODE_CHAR (charset, min_byte2);
10108 CHAR_TABLE_SET (table, c, Qt);
10109 }
10110 }
10101 else 10111 else
10102 { 10112 {
10103 XCharStruct *pcm = font->per_char; 10113 XCharStruct *pcm = font->per_char;
10104 int from = -1; 10114 int from = -1;
10105 int i; 10115 int i;
10108 { 10118 {
10109 if (pcm->width == 0 && pcm->rbearing == pcm->lbearing) 10119 if (pcm->width == 0 && pcm->rbearing == pcm->lbearing)
10110 { 10120 {
10111 if (from >= 0) 10121 if (from >= 0)
10112 { 10122 {
10113 if (! charset) 10123 if (offset >= 0)
10114 char_table_set_range (table, from, i - 1, Qt); 10124 char_table_set_range (table, offset + from,
10125 offset + i - 1, Qt);
10115 else 10126 else
10116 for (; from < i; from++) 10127 for (; from < i; from++)
10117 { 10128 {
10118 c = ENCODE_CHAR (charset, from); 10129 c = DECODE_CHAR (charset, from);
10119 CHAR_TABLE_SET (table, c, Qt); 10130 CHAR_TABLE_SET (table, c, Qt);
10120 } 10131 }
10121 from = -1; 10132 from = -1;
10122 } 10133 }
10123 } 10134 }
10124 else if (from < 0) 10135 else if (from < 0)
10125 from = i; 10136 from = i;
10126 } 10137 }
10127 if (from >= 0) 10138 if (from >= 0)
10128 { 10139 {
10129 if (! charset) 10140 if (offset >= 0)
10130 char_table_set_range (table, from, i - 1, Qt); 10141 char_table_set_range (table, offset + from, offset + i - 1,
10142 Qt);
10131 else 10143 else
10132 for (; from < i; from++) 10144 for (; from < i; from++)
10133 { 10145 {
10134 c = ENCODE_CHAR (charset, from); 10146 c = DECODE_CHAR (charset, from);
10135 CHAR_TABLE_SET (table, c, Qt); 10147 CHAR_TABLE_SET (table, c, Qt);
10136 } 10148 }
10137 } 10149 }
10138 } 10150 }
10139 } 10151 }
10141 { 10153 {
10142 if (! font->per_char || font->all_chars_exist == True) 10154 if (! font->per_char || font->all_chars_exist == True)
10143 { 10155 {
10144 int i, j; 10156 int i, j;
10145 10157
10146 if (! charset) 10158 if (offset >= 0)
10147 for (i = min_byte1; i <= max_byte1; i++) 10159 for (i = min_byte1; i <= max_byte1; i++)
10148 char_table_set_range (table, 10160 char_table_set_range
10149 (i << 8) | min_byte2, (i << 8) | max_byte2, 10161 (table, offset + ((i << 8) | min_byte2),
10150 Qt); 10162 offset + ((i << 8) | max_byte2), Qt);
10151 else 10163 else
10152 for (i = min_byte1; i <= max_byte1; i++) 10164 for (i = min_byte1; i <= max_byte1; i++)
10153 for (j = min_byte2; j <= max_byte2; j++) 10165 for (j = min_byte2; j <= max_byte2; j++)
10154 { 10166 {
10155 unsigned code = (i << 8) | j; 10167 unsigned code = (i << 8) | j;
10156 c = ENCODE_CHAR (charset, code); 10168 c = DECODE_CHAR (charset, code);
10169 CHAR_TABLE_SET (table, c, Qt);
10157 } 10170 }
10158 } 10171 }
10159 else 10172 else
10160 { 10173 {
10161 XCharStruct *pcm = font->per_char; 10174 XCharStruct *pcm = font->per_char;
10170 { 10183 {
10171 if (pcm->width == 0 && pcm->rbearing == pcm->lbearing) 10184 if (pcm->width == 0 && pcm->rbearing == pcm->lbearing)
10172 { 10185 {
10173 if (from >= 0) 10186 if (from >= 0)
10174 { 10187 {
10175 if (! charset) 10188 if (offset >= 0)
10176 char_table_set_range (table, (i << 8) | from, 10189 char_table_set_range
10177 (i << 8) | (j - 1), Qt); 10190 (table, offset + ((i << 8) | from),
10191 offset + ((i << 8) | (j - 1)), Qt);
10178 else 10192 else
10179 { 10193 {
10180 for (; from < j; from++) 10194 for (; from < j; from++)
10181 { 10195 {
10182 unsigned code = (i << 8) | from; 10196 unsigned code = (i << 8) | from;
10190 else if (from < 0) 10204 else if (from < 0)
10191 from = j; 10205 from = j;
10192 } 10206 }
10193 if (from >= 0) 10207 if (from >= 0)
10194 { 10208 {
10195 if (! charset) 10209 if (offset >= 0)
10196 char_table_set_range (table, (i << 8) | from, 10210 char_table_set_range
10197 (i << 8) | (j - 1), Qt); 10211 (table, offset + ((i << 8) | from),
10212 offset + ((i << 8) | (j - 1)), Qt);
10198 else 10213 else
10199 { 10214 {
10200 for (; from < j; from++) 10215 for (; from < j; from++)
10201 { 10216 {
10202 unsigned code = (i << 8) | from; 10217 unsigned code = (i << 8) | from;
10203 c = ENCODE_CHAR (charset, code); 10218 c = DECODE_CHAR (charset, code);
10204 CHAR_TABLE_SET (table, c, Qt); 10219 CHAR_TABLE_SET (table, c, Qt);
10205 } 10220 }
10206 } 10221 }
10207 } 10222 }
10208 } 10223 }