aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2004-02-13 06:40:15 +0000
committerKenichi Handa2004-02-13 06:40:15 +0000
commitcf0c289d2cc63991e89782766a0a50274490a41e (patch)
treee743fdb9b945981f8b165b9f2ac2a93fe4e3902a /src
parent328d44814c1f0f737552fa973aedb21514c47448 (diff)
downloademacs-cf0c289d2cc63991e89782766a0a50274490a41e.tar.gz
emacs-cf0c289d2cc63991e89782766a0a50274490a41e.zip
(x_get_font_repertory): Fix for non-Unicode-bmp charset.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c57
1 files changed, 36 insertions, 21 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 9bba701b8d9..4ed246183ae 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10085,8 +10085,8 @@ x_get_font_repertory (f, font_info)
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
@@ -10097,7 +10097,17 @@ x_get_font_repertory (f, font_info)
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;
@@ -10110,12 +10120,13 @@ x_get_font_repertory (f, font_info)
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;
@@ -10126,12 +10137,13 @@ x_get_font_repertory (f, font_info)
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 }
@@ -10143,17 +10155,18 @@ x_get_font_repertory (f, font_info)
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
@@ -10172,9 +10185,10 @@ x_get_font_repertory (f, font_info)
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++)
@@ -10192,15 +10206,16 @@ x_get_font_repertory (f, font_info)
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 }