diff options
| author | Jason Rumney | 2000-03-27 20:19:49 +0000 |
|---|---|---|
| committer | Jason Rumney | 2000-03-27 20:19:49 +0000 |
| commit | 93ff43955c4d61139bdc89a2b6dd90512eb38465 (patch) | |
| tree | 1582a0e72d82121cd73160ab5a887807d485d095 /src | |
| parent | 11fd416e9fae8fe2877a58e9770da7738065f61e (diff) | |
| download | emacs-93ff43955c4d61139bdc89a2b6dd90512eb38465.tar.gz emacs-93ff43955c4d61139bdc89a2b6dd90512eb38465.zip | |
(w32_read_socket): Handle WM_MENUSELECT message.
(Vw32_charset_to_codepage_alist): Removed.
(Vw32_charset_info_alist): New variable.
(Qw32_charset_[ansi, default, symbol, shiftjis, hangul, gb2312,
chinesebig5, oem, easteurope, turkish, baltic, russian, arabic,
greek, hebrew, thai, johab, mac, unicode]): New symbols.
(x_produce_glyphs): Remove out of date #ifdef 0'd section. Replace
with TODO comment.
(w32_codepage_for_font): Use Vw32_charset_info_alist.
(syms_of_w32term): Remove Vw32_charset_to_codepage_alist.
Define Vw32_charset_info_alist and w32_charset symbols.
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32term.c | 664 |
1 files changed, 252 insertions, 412 deletions
diff --git a/src/w32term.c b/src/w32term.c index 6b1fabcd541..e2e4c168c5c 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -24,7 +24,6 @@ Boston, MA 02111-1307, USA. */ | |||
| 24 | #include <stdlib.h> | 24 | #include <stdlib.h> |
| 25 | #include "lisp.h" | 25 | #include "lisp.h" |
| 26 | #include "charset.h" | 26 | #include "charset.h" |
| 27 | #include "fontset.h" | ||
| 28 | #include "blockinput.h" | 27 | #include "blockinput.h" |
| 29 | 28 | ||
| 30 | #include "w32heap.h" | 29 | #include "w32heap.h" |
| @@ -43,6 +42,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 43 | 42 | ||
| 44 | #include "frame.h" | 43 | #include "frame.h" |
| 45 | #include "dispextern.h" | 44 | #include "dispextern.h" |
| 45 | #include "fontset.h" | ||
| 46 | #include "termhooks.h" | 46 | #include "termhooks.h" |
| 47 | #include "termopts.h" | 47 | #include "termopts.h" |
| 48 | #include "termchar.h" | 48 | #include "termchar.h" |
| @@ -174,6 +174,8 @@ extern unsigned int msh_mousewheel; | |||
| 174 | 174 | ||
| 175 | extern void free_frame_menubar (); | 175 | extern void free_frame_menubar (); |
| 176 | 176 | ||
| 177 | extern void w32_menu_display_help (HMENU menu, UINT menu_item, UINT flags); | ||
| 178 | |||
| 177 | extern Lisp_Object Vwindow_system; | 179 | extern Lisp_Object Vwindow_system; |
| 178 | 180 | ||
| 179 | #define x_any_window_to_frame x_window_to_frame | 181 | #define x_any_window_to_frame x_window_to_frame |
| @@ -287,7 +289,7 @@ int last_mouse_scroll_bar_pos; | |||
| 287 | Time last_mouse_movement_time; | 289 | Time last_mouse_movement_time; |
| 288 | 290 | ||
| 289 | /* Associative list linking character set strings to Windows codepages. */ | 291 | /* Associative list linking character set strings to Windows codepages. */ |
| 290 | Lisp_Object Vw32_charset_to_codepage_alist; | 292 | Lisp_Object Vw32_charset_info_alist; |
| 291 | 293 | ||
| 292 | /* Incremented by w32_read_socket whenever it really tries to read events. */ | 294 | /* Incremented by w32_read_socket whenever it really tries to read events. */ |
| 293 | #ifdef __STDC__ | 295 | #ifdef __STDC__ |
| @@ -392,6 +394,32 @@ static void w32_clip_to_row P_ ((struct window *, struct glyph_row *, | |||
| 392 | 394 | ||
| 393 | static Lisp_Object Qvendor_specific_keysyms; | 395 | static Lisp_Object Qvendor_specific_keysyms; |
| 394 | 396 | ||
| 397 | Lisp_Object Qw32_charset_ansi; | ||
| 398 | Lisp_Object Qw32_charset_default; | ||
| 399 | Lisp_Object Qw32_charset_symbol; | ||
| 400 | Lisp_Object Qw32_charset_shiftjis; | ||
| 401 | Lisp_Object Qw32_charset_hangul; | ||
| 402 | Lisp_Object Qw32_charset_gb2312; | ||
| 403 | Lisp_Object Qw32_charset_chinesebig5; | ||
| 404 | Lisp_Object Qw32_charset_oem; | ||
| 405 | |||
| 406 | #ifdef JOHAB_CHARSET | ||
| 407 | Lisp_Object Qw32_charset_easteurope; | ||
| 408 | Lisp_Object Qw32_charset_turkish; | ||
| 409 | Lisp_Object Qw32_charset_baltic; | ||
| 410 | Lisp_Object Qw32_charset_russian; | ||
| 411 | Lisp_Object Qw32_charset_arabic; | ||
| 412 | Lisp_Object Qw32_charset_greek; | ||
| 413 | Lisp_Object Qw32_charset_hebrew; | ||
| 414 | Lisp_Object Qw32_charset_thai; | ||
| 415 | Lisp_Object Qw32_charset_johab; | ||
| 416 | Lisp_Object Qw32_charset_mac; | ||
| 417 | #endif | ||
| 418 | |||
| 419 | #ifdef UNICODE_CHARSET | ||
| 420 | Lisp_Object Qw32_charset_unicode; | ||
| 421 | #endif | ||
| 422 | |||
| 395 | 423 | ||
| 396 | #if 0 | 424 | #if 0 |
| 397 | /* This is a function useful for recording debugging information | 425 | /* This is a function useful for recording debugging information |
| @@ -1046,7 +1074,8 @@ w32_cursor_to (vpos, hpos, y, x) | |||
| 1046 | 1074 | ||
| 1047 | static struct face *x_get_glyph_face_and_encoding P_ ((struct frame *, | 1075 | static struct face *x_get_glyph_face_and_encoding P_ ((struct frame *, |
| 1048 | struct glyph *, | 1076 | struct glyph *, |
| 1049 | wchar_t *)); | 1077 | wchar_t *, |
| 1078 | int *)); | ||
| 1050 | static struct face *x_get_char_face_and_encoding P_ ((struct frame *, int, | 1079 | static struct face *x_get_char_face_and_encoding P_ ((struct frame *, int, |
| 1051 | int, wchar_t *, int)); | 1080 | int, wchar_t *, int)); |
| 1052 | static XCharStruct *w32_per_char_metric P_ ((HDC hdc, XFontStruct *, | 1081 | static XCharStruct *w32_per_char_metric P_ ((HDC hdc, XFontStruct *, |
| @@ -1072,6 +1101,8 @@ static void x_produce_image_glyph P_ ((struct it *it)); | |||
| 1072 | ((ch) & 0x00ff) | 1101 | ((ch) & 0x00ff) |
| 1073 | 1102 | ||
| 1074 | 1103 | ||
| 1104 | /* NTEMACS_TODO: Add support for bdf fonts back in. */ | ||
| 1105 | |||
| 1075 | /* Get metrics of character CHAR2B in FONT. Value is always non-null. | 1106 | /* Get metrics of character CHAR2B in FONT. Value is always non-null. |
| 1076 | If CHAR2B is not contained in FONT, the font's default character | 1107 | If CHAR2B is not contained in FONT, the font's default character |
| 1077 | metric is returned. If unicode_p is non-zero, use unicode functions, | 1108 | metric is returned. If unicode_p is non-zero, use unicode functions, |
| @@ -1134,6 +1165,12 @@ w32_per_char_metric (hdc, font, char2b, unicode_p) | |||
| 1134 | pcm->ascent = FONT_BASE (font); | 1165 | pcm->ascent = FONT_BASE (font); |
| 1135 | pcm->descent = FONT_DESCENT (font); | 1166 | pcm->descent = FONT_DESCENT (font); |
| 1136 | 1167 | ||
| 1168 | if (pcm->width == 0 && (pcm->rbearing - pcm->lbearing) == 0) | ||
| 1169 | { | ||
| 1170 | xfree (pcm); | ||
| 1171 | pcm = NULL; | ||
| 1172 | } | ||
| 1173 | |||
| 1137 | return pcm; | 1174 | return pcm; |
| 1138 | } | 1175 | } |
| 1139 | 1176 | ||
| @@ -1246,12 +1283,8 @@ x_get_char_face_and_encoding (f, c, face_id, char2b, multibyte_p) | |||
| 1246 | /* Unibyte case. We don't have to encode, but we have to make | 1283 | /* Unibyte case. We don't have to encode, but we have to make |
| 1247 | sure to use a face suitable for unibyte. */ | 1284 | sure to use a face suitable for unibyte. */ |
| 1248 | *char2b = BUILD_WCHAR_T (0, c); | 1285 | *char2b = BUILD_WCHAR_T (0, c); |
| 1249 | 1286 | face_id = FACE_FOR_CHAR (f, face, c); | |
| 1250 | if (!FACE_SUITABLE_FOR_CHARSET_P (face, -1)) | 1287 | face = FACE_FROM_ID (f, face_id); |
| 1251 | { | ||
| 1252 | face_id = FACE_FOR_CHARSET (f, face_id, -1); | ||
| 1253 | face = FACE_FROM_ID (f, face_id); | ||
| 1254 | } | ||
| 1255 | } | 1288 | } |
| 1256 | else if (c < 128 && face_id < BASIC_FACE_ID_SENTINEL) | 1289 | else if (c < 128 && face_id < BASIC_FACE_ID_SENTINEL) |
| 1257 | { | 1290 | { |
| @@ -1269,32 +1302,14 @@ x_get_char_face_and_encoding (f, c, face_id, char2b, multibyte_p) | |||
| 1269 | *char2b = BUILD_WCHAR_T (c1, c2); | 1302 | *char2b = BUILD_WCHAR_T (c1, c2); |
| 1270 | else | 1303 | else |
| 1271 | *char2b = BUILD_WCHAR_T (0, c1); | 1304 | *char2b = BUILD_WCHAR_T (0, c1); |
| 1272 | |||
| 1273 | /* Get the face for displaying C. If `face' is not suitable for | ||
| 1274 | charset, get the one that fits. (This can happen for the | ||
| 1275 | translations of a composition where the glyph | ||
| 1276 | specifies a face for the first component, but the other | ||
| 1277 | components have a different charset.) */ | ||
| 1278 | if (!FACE_SUITABLE_FOR_CHARSET_P (face, charset)) | ||
| 1279 | { | ||
| 1280 | face_id = FACE_FOR_CHARSET (f, face_id, charset); | ||
| 1281 | face = FACE_FROM_ID (f, face_id); | ||
| 1282 | } | ||
| 1283 | 1305 | ||
| 1284 | /* Maybe encode the character in *CHAR2B. */ | 1306 | /* Maybe encode the character in *CHAR2B. */ |
| 1285 | if (charset != CHARSET_ASCII) | 1307 | if (face->font != NULL) |
| 1286 | { | 1308 | { |
| 1287 | struct font_info *font_info | 1309 | struct font_info *font_info |
| 1288 | = FONT_INFO_FROM_ID (f, face->font_info_id); | 1310 | = FONT_INFO_FROM_ID (f, face->font_info_id); |
| 1289 | if (font_info) | 1311 | if (font_info) |
| 1290 | { | ||
| 1291 | x_encode_char (c, char2b, font_info); | 1312 | x_encode_char (c, char2b, font_info); |
| 1292 | #if 0 /* NTEMACS_TODO: Isn't this undoing what we just did? Investigate. */ | ||
| 1293 | if (charset == charset_latin_iso8859_1) | ||
| 1294 | *char2b = BUILD_WCHAR_T (BYTE1 (*char2b), | ||
| 1295 | BYTE2 (*char2b) | 0x80); | ||
| 1296 | #endif | ||
| 1297 | } | ||
| 1298 | } | 1313 | } |
| 1299 | } | 1314 | } |
| 1300 | 1315 | ||
| @@ -1306,21 +1321,34 @@ x_get_char_face_and_encoding (f, c, face_id, char2b, multibyte_p) | |||
| 1306 | } | 1321 | } |
| 1307 | 1322 | ||
| 1308 | 1323 | ||
| 1324 | /* Determine if a font is double byte. */ | ||
| 1325 | int w32_font_is_double_byte (XFontStruct *font) | ||
| 1326 | { | ||
| 1327 | /* NTEMACS_TODO: Determine this properly using GetFontLanguageInfo | ||
| 1328 | or similar. Returning 1 might work, as we use Unicode anyway. */ | ||
| 1329 | return 1; | ||
| 1330 | } | ||
| 1331 | |||
| 1332 | |||
| 1309 | /* Get face and two-byte form of character glyph GLYPH on frame F. | 1333 | /* Get face and two-byte form of character glyph GLYPH on frame F. |
| 1310 | The encoding of GLYPH->u.ch is returned in *CHAR2B. Value is | 1334 | The encoding of GLYPH->u.ch is returned in *CHAR2B. Value is |
| 1311 | a pointer to a realized face that is ready for display. */ | 1335 | a pointer to a realized face that is ready for display. */ |
| 1312 | 1336 | ||
| 1313 | static INLINE struct face * | 1337 | static INLINE struct face * |
| 1314 | x_get_glyph_face_and_encoding (f, glyph, char2b) | 1338 | x_get_glyph_face_and_encoding (f, glyph, char2b, two_byte_p) |
| 1315 | struct frame *f; | 1339 | struct frame *f; |
| 1316 | struct glyph *glyph; | 1340 | struct glyph *glyph; |
| 1317 | wchar_t *char2b; | 1341 | wchar_t *char2b; |
| 1342 | int *two_byte_p; | ||
| 1318 | { | 1343 | { |
| 1319 | struct face *face; | 1344 | struct face *face; |
| 1320 | 1345 | ||
| 1321 | xassert (glyph->type == CHAR_GLYPH); | 1346 | xassert (glyph->type == CHAR_GLYPH); |
| 1322 | face = FACE_FROM_ID (f, glyph->face_id); | 1347 | face = FACE_FROM_ID (f, glyph->face_id); |
| 1323 | 1348 | ||
| 1349 | if (two_byte_p) | ||
| 1350 | *two_byte_p = 0; | ||
| 1351 | |||
| 1324 | if (!glyph->multibyte_p) | 1352 | if (!glyph->multibyte_p) |
| 1325 | { | 1353 | { |
| 1326 | /* Unibyte case. We don't have to encode, but we have to make | 1354 | /* Unibyte case. We don't have to encode, but we have to make |
| @@ -1353,11 +1381,8 @@ x_get_glyph_face_and_encoding (f, glyph, char2b) | |||
| 1353 | if (font_info) | 1381 | if (font_info) |
| 1354 | { | 1382 | { |
| 1355 | x_encode_char (glyph->u.ch, char2b, font_info); | 1383 | x_encode_char (glyph->u.ch, char2b, font_info); |
| 1356 | #if 0 /* NTEMACS_TODO: Isn't this undoing what we just did? Investigate. */ | 1384 | if (two_byte_p) |
| 1357 | if (charset == charset_latin_iso8859_1) | 1385 | *two_byte_p = w32_font_is_double_byte (font_info->font); |
| 1358 | *char2b = BUILD_WCHAR_T (BYTE1 (*char2b), | ||
| 1359 | BYTE2 (*char2b) | 0x80); | ||
| 1360 | #endif | ||
| 1361 | } | 1386 | } |
| 1362 | } | 1387 | } |
| 1363 | } | 1388 | } |
| @@ -1402,6 +1427,7 @@ x_append_glyph (it) | |||
| 1402 | glyph->multibyte_p = it->multibyte_p; | 1427 | glyph->multibyte_p = it->multibyte_p; |
| 1403 | glyph->overlaps_vertically_p = (it->phys_ascent > it->ascent | 1428 | glyph->overlaps_vertically_p = (it->phys_ascent > it->ascent |
| 1404 | || it->phys_descent > it->descent); | 1429 | || it->phys_descent > it->descent); |
| 1430 | glyph->glyph_not_available_p = it->glyph_not_available_p; | ||
| 1405 | ++it->glyph_row->used[area]; | 1431 | ++it->glyph_row->used[area]; |
| 1406 | } | 1432 | } |
| 1407 | } | 1433 | } |
| @@ -1748,35 +1774,48 @@ static void | |||
| 1748 | x_produce_glyphs (it) | 1774 | x_produce_glyphs (it) |
| 1749 | struct it *it; | 1775 | struct it *it; |
| 1750 | { | 1776 | { |
| 1777 | it->glyph_not_available_p = 0; | ||
| 1778 | |||
| 1751 | if (it->what == IT_CHARACTER) | 1779 | if (it->what == IT_CHARACTER) |
| 1752 | { | 1780 | { |
| 1753 | wchar_t char2b; | 1781 | wchar_t char2b; |
| 1754 | XFontStruct *font; | 1782 | XFontStruct *font; |
| 1755 | struct face *face; | 1783 | struct face *face = FACE_FROM_ID (it->f, it->face_id); |
| 1756 | XCharStruct *pcm; | 1784 | XCharStruct *pcm; |
| 1757 | int font_not_found_p; | 1785 | int font_not_found_p; |
| 1758 | struct font_info *font_info; | 1786 | struct font_info *font_info; |
| 1759 | int boff; /* baseline offset */ | 1787 | int boff; /* baseline offset */ |
| 1760 | HDC hdc; | 1788 | HDC hdc; |
| 1761 | 1789 | ||
| 1762 | hdc = get_frame_dc (it->f); | 1790 | hdc = get_frame_dc (it->f); |
| 1763 | 1791 | ||
| 1764 | /* Maybe translate single-byte characters to multibyte. */ | 1792 | /* Maybe translate single-byte characters to multibyte, or the |
| 1793 | other way. */ | ||
| 1765 | it->char_to_display = it->c; | 1794 | it->char_to_display = it->c; |
| 1766 | if (unibyte_display_via_language_environment | 1795 | if (!ASCII_BYTE_P (it->c)) |
| 1767 | && SINGLE_BYTE_CHAR_P (it->c) | 1796 | { |
| 1768 | && (it->c >= 0240 | 1797 | if (unibyte_display_via_language_environment |
| 1769 | || (it->c >= 0200 | 1798 | && SINGLE_BYTE_CHAR_P (it->c) |
| 1770 | && !NILP (Vnonascii_translation_table)))) | 1799 | && (it->c >= 0240 |
| 1771 | { | 1800 | || !NILP (Vnonascii_translation_table))) |
| 1772 | it->char_to_display = unibyte_char_to_multibyte (it->c); | 1801 | { |
| 1773 | it->charset = CHAR_CHARSET (it->char_to_display); | 1802 | it->char_to_display = unibyte_char_to_multibyte (it->c); |
| 1774 | } | 1803 | it->face_id = FACE_FOR_CHAR (it->f, face, it->char_to_display); |
| 1804 | face = FACE_FROM_ID (it->f, it->face_id); | ||
| 1805 | } | ||
| 1806 | else if (!SINGLE_BYTE_CHAR_P (it->c) | ||
| 1807 | && !it->multibyte_p) | ||
| 1808 | { | ||
| 1809 | it->char_to_display = multibyte_char_to_unibyte (it->c, Qnil); | ||
| 1810 | it->face_id = FACE_FOR_CHAR (it->f, face, it->char_to_display); | ||
| 1811 | face = FACE_FROM_ID (it->f, it->face_id); | ||
| 1812 | } | ||
| 1813 | } | ||
| 1775 | 1814 | ||
| 1776 | /* Get face and font to use. Encode IT->char_to_display. */ | 1815 | /* Get font to use. Encode IT->char_to_display. */ |
| 1777 | face = x_get_char_face_and_encoding (it->f, it->char_to_display, | 1816 | x_get_char_face_and_encoding (it->f, it->char_to_display, |
| 1778 | it->face_id, &char2b, | 1817 | it->face_id, &char2b, |
| 1779 | it->multibyte_p); | 1818 | it->multibyte_p); |
| 1780 | font = face->font; | 1819 | font = face->font; |
| 1781 | 1820 | ||
| 1782 | /* When no suitable font found, use the default font. */ | 1821 | /* When no suitable font found, use the default font. */ |
| @@ -1863,6 +1902,7 @@ x_produce_glyphs (it) | |||
| 1863 | if (pcm->lbearing < 0 | 1902 | if (pcm->lbearing < 0 |
| 1864 | || pcm->rbearing > pcm->width) | 1903 | || pcm->rbearing > pcm->width) |
| 1865 | it->glyph_row->contains_overlapping_glyphs_p = 1; | 1904 | it->glyph_row->contains_overlapping_glyphs_p = 1; |
| 1905 | xfree (pcm); | ||
| 1866 | } | 1906 | } |
| 1867 | } | 1907 | } |
| 1868 | else if (it->char_to_display == '\n') | 1908 | else if (it->char_to_display == '\n') |
| @@ -1908,33 +1948,31 @@ x_produce_glyphs (it) | |||
| 1908 | default font and calculate the width of the character | 1948 | default font and calculate the width of the character |
| 1909 | from the charset width; this is what old redisplay code | 1949 | from the charset width; this is what old redisplay code |
| 1910 | did. */ | 1950 | did. */ |
| 1911 | if (font_not_found_p) | 1951 | pcm = w32_per_char_metric (hdc, font, &char2b, 1); |
| 1912 | { | ||
| 1913 | wchar_t dummy = BUILD_WCHAR_T (0, 'X'); | ||
| 1914 | 1952 | ||
| 1915 | /* Get some metrics for the default font. */ | 1953 | if (font_not_found_p || !pcm) |
| 1916 | pcm = w32_per_char_metric (hdc, font, &dummy, 0); | 1954 | { |
| 1955 | int charset = CHAR_CHARSET (it->char_to_display); | ||
| 1917 | 1956 | ||
| 1918 | /* Ignore the width obtained above, and use the average | 1957 | it->glyph_not_available_p = 1; |
| 1919 | width of a character in the default font. */ | 1958 | it->pixel_width = (FONT_WIDTH (FRAME_FONT (it->f)) |
| 1920 | it->pixel_width = FONT_WIDTH (font) | 1959 | * CHARSET_WIDTH (charset)); |
| 1921 | * CHARSET_WIDTH (it->charset); | 1960 | it->phys_ascent = FONT_BASE (font) + boff; |
| 1922 | } | 1961 | it->phys_descent = FONT_DESCENT (font) - boff; |
| 1923 | else | 1962 | } |
| 1924 | { | 1963 | else |
| 1925 | pcm = w32_per_char_metric (hdc, font, &char2b, 1); | 1964 | { |
| 1926 | it->pixel_width = pcm->width; | 1965 | it->phys_ascent = pcm->ascent + boff; |
| 1966 | it->phys_descent = pcm->descent - boff; | ||
| 1967 | if (it->glyph_row | ||
| 1968 | && (pcm->lbearing < 0 | ||
| 1969 | || pcm->rbearing > pcm->width)) | ||
| 1970 | it->glyph_row->contains_overlapping_glyphs_p = 1; | ||
| 1927 | } | 1971 | } |
| 1928 | 1972 | ||
| 1929 | it->nglyphs = 1; | 1973 | it->nglyphs = 1; |
| 1930 | it->ascent = FONT_BASE (font) + boff; | 1974 | it->ascent = FONT_BASE (font) + boff; |
| 1931 | it->descent = FONT_DESCENT (font) - boff; | 1975 | it->descent = FONT_DESCENT (font) - boff; |
| 1932 | it->phys_ascent = pcm->ascent + boff; | ||
| 1933 | it->phys_descent = pcm->descent - boff; | ||
| 1934 | if (it->glyph_row | ||
| 1935 | && (pcm->lbearing < 0 | ||
| 1936 | || pcm->rbearing > pcm->width)) | ||
| 1937 | it->glyph_row->contains_overlapping_glyphs_p = 1; | ||
| 1938 | 1976 | ||
| 1939 | if (face->box != FACE_NO_BOX) | 1977 | if (face->box != FACE_NO_BOX) |
| 1940 | { | 1978 | { |
| @@ -1957,249 +1995,14 @@ x_produce_glyphs (it) | |||
| 1957 | 1995 | ||
| 1958 | if (it->glyph_row) | 1996 | if (it->glyph_row) |
| 1959 | x_append_glyph (it); | 1997 | x_append_glyph (it); |
| 1998 | |||
| 1999 | xfree (pcm); | ||
| 1960 | } | 2000 | } |
| 1961 | release_frame_dc (it->f, hdc); | 2001 | release_frame_dc (it->f, hdc); |
| 1962 | } | 2002 | } |
| 1963 | else if (it->what == IT_COMPOSITION) | 2003 | else if (it->what == IT_COMPOSITION) |
| 1964 | { | 2004 | { |
| 1965 | #if 0 /* NTEMACS_TODO: Composite glyphs. */ | 2005 | /* NTEMACS_TODO: Composite glyphs. */ |
| 1966 | /* Note: A composition is represented as one glyph in the | ||
| 1967 | glyph matrix. There are no padding glyphs. */ | ||
| 1968 | XChar2b char2b; | ||
| 1969 | XFontStruct *font; | ||
| 1970 | struct face *face; | ||
| 1971 | XCharStruct *pcm; | ||
| 1972 | int font_not_found_p; | ||
| 1973 | struct font_info *font_info; | ||
| 1974 | int boff; /* baseline offset */ | ||
| 1975 | struct composition *cmp = composition_table[it->cmp_id]; | ||
| 1976 | |||
| 1977 | /* Maybe translate single-byte characters to multibyte. */ | ||
| 1978 | it->char_to_display = it->c; | ||
| 1979 | if (unibyte_display_via_language_environment | ||
| 1980 | && SINGLE_BYTE_CHAR_P (it->c) | ||
| 1981 | && (it->c >= 0240 | ||
| 1982 | || (it->c >= 0200 | ||
| 1983 | && !NILP (Vnonascii_translation_table)))) | ||
| 1984 | { | ||
| 1985 | it->char_to_display = unibyte_char_to_multibyte (it->c); | ||
| 1986 | it->charset = CHAR_CHARSET (it->char_to_display); | ||
| 1987 | } | ||
| 1988 | |||
| 1989 | /* Get face and font to use. Encode IT->char_to_display. */ | ||
| 1990 | face = x_get_char_face_and_encoding (it->f, it->char_to_display, | ||
| 1991 | it->face_id, &char2b, | ||
| 1992 | it->multibyte_p); | ||
| 1993 | font = face->font; | ||
| 1994 | |||
| 1995 | /* When no suitable font found, use the default font. */ | ||
| 1996 | font_not_found_p = font == NULL; | ||
| 1997 | if (font_not_found_p) | ||
| 1998 | { | ||
| 1999 | font = FRAME_FONT (it->f); | ||
| 2000 | boff = it->f->output_data.x->baseline_offset; | ||
| 2001 | font_info = NULL; | ||
| 2002 | } | ||
| 2003 | else | ||
| 2004 | { | ||
| 2005 | font_info = FONT_INFO_FROM_ID (it->f, face->font_info_id); | ||
| 2006 | boff = font_info->baseline_offset; | ||
| 2007 | if (font_info->vertical_centering) | ||
| 2008 | boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff; | ||
| 2009 | } | ||
| 2010 | |||
| 2011 | /* There are no padding glyphs, so there is only one glyph to | ||
| 2012 | produce for the composition. Important is that pixel_width, | ||
| 2013 | ascent and descent are the values of what is drawn by | ||
| 2014 | draw_glyphs (i.e. the values of the overall glyphs composed). */ | ||
| 2015 | it->nglyphs = 1; | ||
| 2016 | |||
| 2017 | /* If we have not yet calculated pixel size data of glyphs of | ||
| 2018 | the composition for the current face font, calculate them | ||
| 2019 | now. Theoretically, we have to check all fonts for the | ||
| 2020 | glyphs, but that requires much time and memory space. So, | ||
| 2021 | here we check only the font of the first glyph. This leads | ||
| 2022 | to incorrect display very rarely, and C-l (recenter) can | ||
| 2023 | correct the display anyway. */ | ||
| 2024 | if (cmp->font != (void *) font) | ||
| 2025 | { | ||
| 2026 | /* Ascent and descent of the font of the first character of | ||
| 2027 | this composition (adjusted by baseline offset). Ascent | ||
| 2028 | and descent of overall glyphs should not be less than | ||
| 2029 | them respectively. */ | ||
| 2030 | int font_ascent = font->ascent + boff; | ||
| 2031 | int font_descent = font->descent - boff; | ||
| 2032 | /* Bounding box of the overall glyphs. */ | ||
| 2033 | int leftmost, rightmost, lowest, highest; | ||
| 2034 | int i; | ||
| 2035 | |||
| 2036 | cmp->font = (void *) font; | ||
| 2037 | |||
| 2038 | /* Initialize the bounding box. */ | ||
| 2039 | pcm = x_per_char_metric (font, &char2b); | ||
| 2040 | leftmost = 0; | ||
| 2041 | rightmost = pcm->width; | ||
| 2042 | lowest = - pcm->descent + boff; | ||
| 2043 | highest = pcm->ascent + boff; | ||
| 2044 | if (font_info | ||
| 2045 | && font_info->default_ascent | ||
| 2046 | && CHAR_TABLE_P (Vuse_default_ascent) | ||
| 2047 | && !NILP (Faref (Vuse_default_ascent, | ||
| 2048 | make_number (it->char_to_display)))) | ||
| 2049 | highest = font_info->default_ascent + boff; | ||
| 2050 | |||
| 2051 | /* Draw the first glyph at the normal position. It may be | ||
| 2052 | shifted to right later if some other glyphs are drawn at | ||
| 2053 | the left. */ | ||
| 2054 | cmp->offsets[0] = 0; | ||
| 2055 | cmp->offsets[1] = boff; | ||
| 2056 | |||
| 2057 | /* Set cmp->offsets for the remaining glyphs. */ | ||
| 2058 | for (i = 1; i < cmp->glyph_len; i++) | ||
| 2059 | { | ||
| 2060 | int left, right, btm, top; | ||
| 2061 | int ch = COMPOSITION_GLYPH (cmp, i); | ||
| 2062 | |||
| 2063 | face = x_get_char_face_and_encoding (it->f, ch, | ||
| 2064 | it->face_id, &char2b, | ||
| 2065 | it->multibyte_p); | ||
| 2066 | font = face->font; | ||
| 2067 | if (font == NULL) | ||
| 2068 | { | ||
| 2069 | font = FRAME_FONT (it->f); | ||
| 2070 | boff = it->f->output_data.x->baseline_offset; | ||
| 2071 | font_info = NULL; | ||
| 2072 | } | ||
| 2073 | else | ||
| 2074 | { | ||
| 2075 | font_info | ||
| 2076 | = FONT_INFO_FROM_ID (it->f, face->font_info_id); | ||
| 2077 | boff = font_info->baseline_offset; | ||
| 2078 | if (font_info->vertical_centering) | ||
| 2079 | boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff; | ||
| 2080 | } | ||
| 2081 | |||
| 2082 | pcm = x_per_char_metric (font, &char2b); | ||
| 2083 | |||
| 2084 | if (cmp->method != COMPOSITION_WITH_RULE_ALTCHARS) | ||
| 2085 | { | ||
| 2086 | /* Relative composition with or without | ||
| 2087 | alternate chars. */ | ||
| 2088 | left = (leftmost + rightmost - pcm->width) / 2; | ||
| 2089 | btm = - pcm->descent + boff; | ||
| 2090 | if (font_info && font_info->relative_compose | ||
| 2091 | && (! CHAR_TABLE_P (Vignore_relative_composition) | ||
| 2092 | || NILP (Faref (Vignore_relative_composition, | ||
| 2093 | make_number (ch))))) | ||
| 2094 | { | ||
| 2095 | |||
| 2096 | if (- pcm->descent | ||
| 2097 | >= font_info->relative_compose) | ||
| 2098 | /* One extra pixel between two glyphs. */ | ||
| 2099 | btm = highest + 1; | ||
| 2100 | else if (pcm->ascent <= 0) | ||
| 2101 | /* One extra pixel between two glyphs. */ | ||
| 2102 | btm = lowest - 1 - pcm->ascent - pcm->descent; | ||
| 2103 | } | ||
| 2104 | } | ||
| 2105 | else | ||
| 2106 | { | ||
| 2107 | /* A composition rule is specified by an integer | ||
| 2108 | value that encodes global and new reference | ||
| 2109 | points (GREF and NREF). GREF and NREF are | ||
| 2110 | specified by numbers as below: | ||
| 2111 | |||
| 2112 | 0---1---2 -- ascent | ||
| 2113 | | | | ||
| 2114 | | | | ||
| 2115 | | | | ||
| 2116 | 9--10--11 -- center | ||
| 2117 | | | | ||
| 2118 | ---3---4---5--- baseline | ||
| 2119 | | | | ||
| 2120 | 6---7---8 -- descent | ||
| 2121 | */ | ||
| 2122 | int rule = COMPOSITION_RULE (cmp, i); | ||
| 2123 | int gref, nref, grefx, grefy, nrefx, nrefy; | ||
| 2124 | |||
| 2125 | COMPOSITION_DECODE_RULE (rule, gref, nref); | ||
| 2126 | grefx = gref % 3, nrefx = nref % 3; | ||
| 2127 | grefy = gref / 3, nrefy = nref / 3; | ||
| 2128 | |||
| 2129 | left = (leftmost | ||
| 2130 | + grefx * (rightmost - leftmost) / 2 | ||
| 2131 | - nrefx * pcm->width / 2); | ||
| 2132 | btm = ((grefy == 0 ? highest | ||
| 2133 | : grefy == 1 ? 0 | ||
| 2134 | : grefy == 2 ? lowest | ||
| 2135 | : (highest + lowest) / 2) | ||
| 2136 | - (nrefy == 0 ? pcm->ascent + pcm->descent | ||
| 2137 | : nrefy == 1 ? pcm->descent - boff | ||
| 2138 | : nrefy == 2 ? 0 | ||
| 2139 | : (pcm->ascent + pcm->descent) / 2)); | ||
| 2140 | } | ||
| 2141 | |||
| 2142 | cmp->offsets[i * 2] = left; | ||
| 2143 | cmp->offsets[i * 2 + 1] = btm + pcm->descent; | ||
| 2144 | |||
| 2145 | /* Update the bounding box of the overall glyphs. */ | ||
| 2146 | right = left + pcm->width; | ||
| 2147 | top = btm + pcm->descent + pcm->ascent; | ||
| 2148 | if (left < leftmost) | ||
| 2149 | leftmost = left; | ||
| 2150 | if (right > rightmost) | ||
| 2151 | rightmost = right; | ||
| 2152 | if (top > highest) | ||
| 2153 | highest = top; | ||
| 2154 | if (btm < lowest) | ||
| 2155 | lowest = btm; | ||
| 2156 | } | ||
| 2157 | |||
| 2158 | /* If there are glyphs whose x-offsets are negative, | ||
| 2159 | shift all glyphs to the right and make all x-offsets | ||
| 2160 | non-negative. */ | ||
| 2161 | if (leftmost < 0) | ||
| 2162 | { | ||
| 2163 | for (i = 0; i < cmp->glyph_len; i++) | ||
| 2164 | cmp->offsets[i * 2] -= leftmost; | ||
| 2165 | rightmost -= leftmost; | ||
| 2166 | } | ||
| 2167 | |||
| 2168 | cmp->pixel_width = rightmost; | ||
| 2169 | cmp->ascent = highest; | ||
| 2170 | cmp->descent = - lowest; | ||
| 2171 | if (cmp->ascent < font_ascent) | ||
| 2172 | cmp->ascent = font_ascent; | ||
| 2173 | if (cmp->descent < font_descent) | ||
| 2174 | cmp->descent = font_descent; | ||
| 2175 | } | ||
| 2176 | |||
| 2177 | it->pixel_width = cmp->pixel_width; | ||
| 2178 | it->ascent = it->phys_ascent = cmp->ascent; | ||
| 2179 | it->descent = it->phys_descent = cmp->descent; | ||
| 2180 | |||
| 2181 | if (face->box != FACE_NO_BOX) | ||
| 2182 | { | ||
| 2183 | int thick = face->box_line_width; | ||
| 2184 | it->ascent += thick; | ||
| 2185 | it->descent += thick; | ||
| 2186 | |||
| 2187 | if (it->start_of_box_run_p) | ||
| 2188 | it->pixel_width += thick; | ||
| 2189 | if (it->end_of_box_run_p) | ||
| 2190 | it->pixel_width += thick; | ||
| 2191 | } | ||
| 2192 | |||
| 2193 | /* If face has an overline, add the height of the overline | ||
| 2194 | (1 pixel) and a 1 pixel margin to the character height. */ | ||
| 2195 | if (face->overline_p) | ||
| 2196 | it->ascent += 2; | ||
| 2197 | |||
| 2198 | take_vertical_position_into_account (it); | ||
| 2199 | |||
| 2200 | if (it->glyph_row) | ||
| 2201 | x_append_composite_glyph (it); | ||
| 2202 | #endif | ||
| 2203 | } | 2006 | } |
| 2204 | else if (it->what == IT_IMAGE) | 2007 | else if (it->what == IT_IMAGE) |
| 2205 | x_produce_image_glyph (it); | 2008 | x_produce_image_glyph (it); |
| @@ -2233,7 +2036,7 @@ x_estimate_mode_line_height (f, face_id) | |||
| 2233 | if (FRAME_FACE_CACHE (f)) | 2036 | if (FRAME_FACE_CACHE (f)) |
| 2234 | { | 2037 | { |
| 2235 | struct face *face = FACE_FROM_ID (f, face_id); | 2038 | struct face *face = FACE_FROM_ID (f, face_id); |
| 2236 | if (face) | 2039 | if (face && face->font) |
| 2237 | height = FONT_HEIGHT (face->font) + 2 * face->box_line_width; | 2040 | height = FONT_HEIGHT (face->font) + 2 * face->box_line_width; |
| 2238 | } | 2041 | } |
| 2239 | 2042 | ||
| @@ -2270,9 +2073,8 @@ w32_codepage_for_font (char *fontname) | |||
| 2270 | *end = '\0'; | 2073 | *end = '\0'; |
| 2271 | } | 2074 | } |
| 2272 | 2075 | ||
| 2273 | codepage = Fcdr (Fassoc (build_string(charset), | 2076 | codepage = Fcdr (Fcdr (Fassoc (build_string(charset), |
| 2274 | Vw32_charset_to_codepage_alist)); | 2077 | Vw32_charset_info_alist))); |
| 2275 | |||
| 2276 | if (INTEGERP (codepage)) | 2078 | if (INTEGERP (codepage)) |
| 2277 | return XINT (codepage); | 2079 | return XINT (codepage); |
| 2278 | else | 2080 | else |
| @@ -2349,9 +2151,6 @@ struct glyph_string | |||
| 2349 | wchar_t *char2b; | 2151 | wchar_t *char2b; |
| 2350 | int nchars; | 2152 | int nchars; |
| 2351 | 2153 | ||
| 2352 | /* Character set of this glyph string. */ | ||
| 2353 | int charset; | ||
| 2354 | |||
| 2355 | /* A face-override for drawing cursors, mouse face and similar. */ | 2154 | /* A face-override for drawing cursors, mouse face and similar. */ |
| 2356 | enum draw_glyphs_face hl; | 2155 | enum draw_glyphs_face hl; |
| 2357 | 2156 | ||
| @@ -2422,16 +2221,16 @@ void W32_TEXTOUT(s, x, y,chars,nchars) | |||
| 2422 | wchar_t * chars; | 2221 | wchar_t * chars; |
| 2423 | int nchars; | 2222 | int nchars; |
| 2424 | { | 2223 | { |
| 2425 | int charset_dim = CHARSET_DIMENSION (s->charset); | 2224 | /* NTEMACS_TODO: Find way to figure out charset_dim. */ |
| 2426 | 2225 | /* int charset_dim = CHARSET_DIMENSION (s->charset); */ | |
| 2427 | if (s->gc->font->bdf) | 2226 | if (s->gc->font->bdf) |
| 2428 | w32_BDF_TextOut (s->gc->font->bdf, s->hdc, | 2227 | w32_BDF_TextOut (s->gc->font->bdf, s->hdc, |
| 2429 | x, y, (char *) chars, charset_dim, nchars, 0); | 2228 | x, y, (char *) chars, 1 /* charset_dim */, nchars, 0); |
| 2430 | else if (s->two_byte_p) | 2229 | else if (s->two_byte_p) |
| 2431 | ExtTextOutW (s->hdc, x, y, 0, NULL, chars, nchars, NULL); | 2230 | ExtTextOutW (s->hdc, x, y, 0, NULL, chars, nchars, NULL); |
| 2432 | else | 2231 | else |
| 2433 | ExtTextOut (s->hdc, x, y, 0, NULL, (char *) chars, | 2232 | ExtTextOut (s->hdc, x, y, 0, NULL, (char *) chars, |
| 2434 | nchars * charset_dim, NULL); | 2233 | nchars /* * charset_dim */, NULL); |
| 2435 | } | 2234 | } |
| 2436 | 2235 | ||
| 2437 | #if 0 | 2236 | #if 0 |
| @@ -2634,10 +2433,12 @@ x_set_mouse_face_gc (s) | |||
| 2634 | struct glyph_string *s; | 2433 | struct glyph_string *s; |
| 2635 | { | 2434 | { |
| 2636 | int face_id; | 2435 | int face_id; |
| 2436 | struct face *face; | ||
| 2637 | 2437 | ||
| 2638 | /* What face has to be used for the mouse face? */ | 2438 | /* What face has to be used for the mouse face? */ |
| 2639 | face_id = FRAME_W32_DISPLAY_INFO (s->f)->mouse_face_face_id; | 2439 | face_id = FRAME_W32_DISPLAY_INFO (s->f)->mouse_face_face_id; |
| 2640 | face_id = FACE_FOR_CHARSET (s->f, face_id, s->charset); | 2440 | face = FACE_FROM_ID (s->f, face_id); |
| 2441 | face_id = FACE_FOR_CHAR (s->f, face, s->first_glyph->u.ch); | ||
| 2641 | s->face = FACE_FROM_ID (s->f, face_id); | 2442 | s->face = FACE_FROM_ID (s->f, face_id); |
| 2642 | PREPARE_FACE_FOR_DISPLAY (s->f, s->face); | 2443 | PREPARE_FACE_FOR_DISPLAY (s->f, s->face); |
| 2643 | 2444 | ||
| @@ -2887,19 +2688,19 @@ w32_get_glyph_overhangs (hdc, glyph, f, left, right, unicode_p) | |||
| 2887 | struct face *face; | 2688 | struct face *face; |
| 2888 | struct font_info *font_info; | 2689 | struct font_info *font_info; |
| 2889 | wchar_t char2b; | 2690 | wchar_t char2b; |
| 2890 | 2691 | XCharStruct *pcm; | |
| 2891 | face = x_get_glyph_face_and_encoding (f, glyph, &char2b); | 2692 | |
| 2693 | face = x_get_glyph_face_and_encoding (f, glyph, &char2b, NULL); | ||
| 2892 | font = face->font; | 2694 | font = face->font; |
| 2893 | font_info = FONT_INFO_FROM_ID (f, face->font_info_id); | 2695 | font_info = FONT_INFO_FROM_ID (f, face->font_info_id); |
| 2894 | if (font) | 2696 | if (font |
| 2697 | && (pcm = w32_per_char_metric (hdc, font, &char2b, unicode_p))) | ||
| 2895 | { | 2698 | { |
| 2896 | XCharStruct *pcm = w32_per_char_metric (hdc, font, &char2b, | ||
| 2897 | unicode_p); | ||
| 2898 | |||
| 2899 | if (pcm->rbearing > pcm->width) | 2699 | if (pcm->rbearing > pcm->width) |
| 2900 | *right = pcm->rbearing - pcm->width; | 2700 | *right = pcm->rbearing - pcm->width; |
| 2901 | if (pcm->lbearing < 0) | 2701 | if (pcm->lbearing < 0) |
| 2902 | *left = -pcm->lbearing; | 2702 | *left = -pcm->lbearing; |
| 2703 | xfree (pcm); | ||
| 2903 | } | 2704 | } |
| 2904 | } | 2705 | } |
| 2905 | } | 2706 | } |
| @@ -3228,6 +3029,9 @@ w32_alloc_lighter_color (f, color, factor, delta) | |||
| 3228 | max (0, min (0xff, delta + GetGValue (*color))), | 3029 | max (0, min (0xff, delta + GetGValue (*color))), |
| 3229 | max (0, min (0xff, delta + GetBValue (*color)))); | 3030 | max (0, min (0xff, delta + GetBValue (*color)))); |
| 3230 | 3031 | ||
| 3032 | /* NTEMACS_TODO: Map to palette and retry with delta if same? */ | ||
| 3033 | /* NTEMACS_TODO: Free colors (if using palette)? */ | ||
| 3034 | |||
| 3231 | if (new == *color) | 3035 | if (new == *color) |
| 3232 | return 0; | 3036 | return 0; |
| 3233 | 3037 | ||
| @@ -3259,6 +3063,8 @@ w32_setup_relief_color (f, relief, factor, delta, default_pixel) | |||
| 3259 | COLORREF background = di->relief_background; | 3063 | COLORREF background = di->relief_background; |
| 3260 | struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); | 3064 | struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
| 3261 | 3065 | ||
| 3066 | /* NTEMACS_TODO: Free colors (if using palette)? */ | ||
| 3067 | |||
| 3262 | /* Allocate new color. */ | 3068 | /* Allocate new color. */ |
| 3263 | xgcv.foreground = default_pixel; | 3069 | xgcv.foreground = default_pixel; |
| 3264 | pixel = background; | 3070 | pixel = background; |
| @@ -4125,6 +3931,7 @@ x_fill_glyph_string (s, face_id, start, end, overlaps_p) | |||
| 4125 | { | 3931 | { |
| 4126 | struct glyph *glyph, *last; | 3932 | struct glyph *glyph, *last; |
| 4127 | int voffset; | 3933 | int voffset; |
| 3934 | int glyph_not_available_p; | ||
| 4128 | 3935 | ||
| 4129 | xassert (s->f == XFRAME (s->w->frame)); | 3936 | xassert (s->f == XFRAME (s->w->frame)); |
| 4130 | xassert (s->nchars == 0); | 3937 | xassert (s->nchars == 0); |
| @@ -4135,18 +3942,22 @@ x_fill_glyph_string (s, face_id, start, end, overlaps_p) | |||
| 4135 | glyph = s->row->glyphs[s->area] + start; | 3942 | glyph = s->row->glyphs[s->area] + start; |
| 4136 | last = s->row->glyphs[s->area] + end; | 3943 | last = s->row->glyphs[s->area] + end; |
| 4137 | voffset = glyph->voffset; | 3944 | voffset = glyph->voffset; |
| 4138 | 3945 | ||
| 3946 | glyph_not_available_p = glyph->glyph_not_available_p; | ||
| 3947 | |||
| 4139 | while (glyph < last | 3948 | while (glyph < last |
| 4140 | && glyph->type == CHAR_GLYPH | 3949 | && glyph->type == CHAR_GLYPH |
| 4141 | && glyph->voffset == voffset | 3950 | && glyph->voffset == voffset |
| 4142 | /* Same face id implies same charset, nowadays. */ | 3951 | /* Same face id implies same font, nowadays. */ |
| 4143 | && glyph->face_id == face_id) | 3952 | && glyph->face_id == face_id |
| 3953 | && glyph->glyph_not_available_p == glyph_not_available_p) | ||
| 4144 | { | 3954 | { |
| 3955 | int two_byte_p; | ||
| 3956 | |||
| 4145 | s->face = x_get_glyph_face_and_encoding (s->f, glyph, | 3957 | s->face = x_get_glyph_face_and_encoding (s->f, glyph, |
| 4146 | s->char2b + s->nchars); | 3958 | s->char2b + s->nchars, |
| 4147 | if (BYTE2(s->char2b[s->nchars]) != 0) | 3959 | &two_byte_p); |
| 4148 | s->two_byte_p = 1; | 3960 | s->two_byte_p = two_byte_p; |
| 4149 | |||
| 4150 | ++s->nchars; | 3961 | ++s->nchars; |
| 4151 | xassert (s->nchars <= end - start); | 3962 | xassert (s->nchars <= end - start); |
| 4152 | s->width += glyph->pixel_width; | 3963 | s->width += glyph->pixel_width; |
| @@ -4160,7 +3971,7 @@ x_fill_glyph_string (s, face_id, start, end, overlaps_p) | |||
| 4160 | but record the fact that we couldn't load it in | 3971 | but record the fact that we couldn't load it in |
| 4161 | S->font_not_found_p so that we can draw rectangles for the | 3972 | S->font_not_found_p so that we can draw rectangles for the |
| 4162 | characters of the glyph string. */ | 3973 | characters of the glyph string. */ |
| 4163 | if (s->font == NULL) | 3974 | if (s->font == NULL || glyph_not_available_p) |
| 4164 | { | 3975 | { |
| 4165 | s->font_not_found_p = 1; | 3976 | s->font_not_found_p = 1; |
| 4166 | s->font = FRAME_FONT (s->f); | 3977 | s->font = FRAME_FONT (s->f); |
| @@ -4337,13 +4148,11 @@ x_set_glyph_string_background_width (s, start, last_x) | |||
| 4337 | wchar_t *char2b; \ | 4148 | wchar_t *char2b; \ |
| 4338 | \ | 4149 | \ |
| 4339 | c = (ROW)->glyphs[AREA][START].u.ch; \ | 4150 | c = (ROW)->glyphs[AREA][START].u.ch; \ |
| 4340 | charset = CHAR_CHARSET (c); \ | ||
| 4341 | face_id = (ROW)->glyphs[AREA][START].face_id; \ | 4151 | face_id = (ROW)->glyphs[AREA][START].face_id; \ |
| 4342 | s = (struct glyph_string *) alloca (sizeof *s); \ | 4152 | s = (struct glyph_string *) alloca (sizeof *s); \ |
| 4343 | char2b = (wchar_t *) alloca ((END - START) * sizeof *char2b); \ | 4153 | char2b = (wchar_t *) alloca ((END - START) * sizeof *char2b); \ |
| 4344 | w32_init_glyph_string (s, hdc, char2b, W, ROW, AREA, START, HL); \ | 4154 | w32_init_glyph_string (s, hdc, char2b, W, ROW, AREA, START, HL); \ |
| 4345 | x_append_glyph_string (&HEAD, &TAIL, s); \ | 4155 | x_append_glyph_string (&HEAD, &TAIL, s); \ |
| 4346 | s->charset = charset; \ | ||
| 4347 | s->x = (X); \ | 4156 | s->x = (X); \ |
| 4348 | START = x_fill_glyph_string (s, face_id, START, END, \ | 4157 | START = x_fill_glyph_string (s, face_id, START, END, \ |
| 4349 | OVERLAPS_P); \ | 4158 | OVERLAPS_P); \ |
| @@ -4364,6 +4173,7 @@ x_set_glyph_string_background_width (s, start, last_x) | |||
| 4364 | do { \ | 4173 | do { \ |
| 4365 | int cmp_id = (ROW)->glyphs[AREA][START].u.cmp_id; \ | 4174 | int cmp_id = (ROW)->glyphs[AREA][START].u.cmp_id; \ |
| 4366 | int face_id = (ROW)->glyphs[AREA][START].face_id; \ | 4175 | int face_id = (ROW)->glyphs[AREA][START].face_id; \ |
| 4176 | struct face *base_face = FACE_FROM_ID (XFRAME (w->frame), face_id); \ | ||
| 4367 | struct composition *cmp = composition_table[cmp_id]; \ | 4177 | struct composition *cmp = composition_table[cmp_id]; \ |
| 4368 | int glyph_len = cmp->glyph_len; \ | 4178 | int glyph_len = cmp->glyph_len; \ |
| 4369 | wchar_t *char2b; \ | 4179 | wchar_t *char2b; \ |
| @@ -4371,14 +4181,17 @@ x_set_glyph_string_background_width (s, start, last_x) | |||
| 4371 | struct glyph_string *first_s = NULL; \ | 4181 | struct glyph_string *first_s = NULL; \ |
| 4372 | int n; \ | 4182 | int n; \ |
| 4373 | \ | 4183 | \ |
| 4184 | base_face = base_face->ascii_face; \ | ||
| 4374 | char2b = (wchar_t *) alloca ((sizeof *char2b) * glyph_len); \ | 4185 | char2b = (wchar_t *) alloca ((sizeof *char2b) * glyph_len); \ |
| 4375 | faces = (struct face **) alloca ((sizeof *faces) * glyph_len); \ | 4186 | faces = (struct face **) alloca ((sizeof *faces) * glyph_len); \ |
| 4376 | /* At first, fill in `char2b' and `faces'. */ \ | 4187 | /* At first, fill in `char2b' and `faces'. */ \ |
| 4377 | for (n = 0; n < glyph_len; n++) \ | 4188 | for (n = 0; n < glyph_len; n++) \ |
| 4378 | { \ | 4189 | { \ |
| 4379 | int c = COMPOSITION_GLYPH (cmp, n); \ | 4190 | int c = COMPOSITION_GLYPH (cmp, n); \ |
| 4380 | faces[n] = x_get_char_face_and_encoding (XFRAME (w->frame), c, \ | 4191 | int this_face_id = FACE_FOR_CHAR (XFRAME (w->frame), base_face, c); \ |
| 4381 | face_id, char2b + n, 1); \ | 4192 | faces[n] = FACE_FROM_ID (XFRAME (w->frame), this_face_id); \ |
| 4193 | x_get_char_face_and_encoding (XFRAME (w->frame), c, \ | ||
| 4194 | this_face_id, char2b + n, 1); \ | ||
| 4382 | } \ | 4195 | } \ |
| 4383 | \ | 4196 | \ |
| 4384 | /* Make glyph_strings for each glyph sequence that is drawable by \ | 4197 | /* Make glyph_strings for each glyph sequence that is drawable by \ |
| @@ -4390,7 +4203,6 @@ x_set_glyph_string_background_width (s, start, last_x) | |||
| 4390 | x_append_glyph_string (&(HEAD), &(TAIL), s); \ | 4203 | x_append_glyph_string (&(HEAD), &(TAIL), s); \ |
| 4391 | s->cmp = cmp; \ | 4204 | s->cmp = cmp; \ |
| 4392 | s->gidx = n; \ | 4205 | s->gidx = n; \ |
| 4393 | s->charset = 0; \ | ||
| 4394 | s->x = (X); \ | 4206 | s->x = (X); \ |
| 4395 | \ | 4207 | \ |
| 4396 | if (n == 0) \ | 4208 | if (n == 0) \ |
| @@ -6025,7 +5837,7 @@ note_mouse_highlight (f, x, y) | |||
| 6025 | if (popup_activated ()) | 5837 | if (popup_activated ()) |
| 6026 | return; | 5838 | return; |
| 6027 | 5839 | ||
| 6028 | if (disable_mouse_highlight) | 5840 | if (disable_mouse_highlight || !f->glyphs_initialized_p) |
| 6029 | return; | 5841 | return; |
| 6030 | 5842 | ||
| 6031 | dpyinfo->mouse_face_mouse_x = x; | 5843 | dpyinfo->mouse_face_mouse_x = x; |
| @@ -7900,6 +7712,16 @@ w32_read_socket (sd, bufp, numchars, expected) | |||
| 7900 | } | 7712 | } |
| 7901 | break; | 7713 | break; |
| 7902 | 7714 | ||
| 7715 | case WM_MENUSELECT: | ||
| 7716 | { | ||
| 7717 | HMENU menu = (HMENU) msg.msg.lParam; | ||
| 7718 | UINT menu_item = (UINT) LOWORD (msg.msg.wParam); | ||
| 7719 | UINT flags = (UINT) HIWORD (msg.msg.wParam); | ||
| 7720 | |||
| 7721 | w32_menu_display_help (menu, menu_item, flags); | ||
| 7722 | } | ||
| 7723 | break; | ||
| 7724 | |||
| 7903 | case WM_DROPFILES: | 7725 | case WM_DROPFILES: |
| 7904 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 7726 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
| 7905 | 7727 | ||
| @@ -8818,8 +8640,7 @@ x_new_font (f, fontname) | |||
| 8818 | register char *fontname; | 8640 | register char *fontname; |
| 8819 | { | 8641 | { |
| 8820 | struct font_info *fontp | 8642 | struct font_info *fontp |
| 8821 | = fs_load_font (f, FRAME_W32_FONT_TABLE (f), CHARSET_ASCII, | 8643 | = FS_LOAD_FONT (f, 0, fontname, -1); |
| 8822 | fontname, -1); | ||
| 8823 | 8644 | ||
| 8824 | if (!fontp) | 8645 | if (!fontp) |
| 8825 | return Qnil; | 8646 | return Qnil; |
| @@ -8861,9 +8682,9 @@ x_new_fontset (f, fontsetname) | |||
| 8861 | struct frame *f; | 8682 | struct frame *f; |
| 8862 | char *fontsetname; | 8683 | char *fontsetname; |
| 8863 | { | 8684 | { |
| 8864 | int fontset = fs_query_fontset (f, fontsetname); | 8685 | int fontset = fs_query_fontset (build_string (fontsetname), 0); |
| 8865 | struct fontset_info *fontsetp; | ||
| 8866 | Lisp_Object result; | 8686 | Lisp_Object result; |
| 8687 | char *fontname; | ||
| 8867 | 8688 | ||
| 8868 | if (fontset < 0) | 8689 | if (fontset < 0) |
| 8869 | return Qnil; | 8690 | return Qnil; |
| @@ -8871,15 +8692,9 @@ x_new_fontset (f, fontsetname) | |||
| 8871 | if (FRAME_FONTSET (f) == fontset) | 8692 | if (FRAME_FONTSET (f) == fontset) |
| 8872 | /* This fontset is already set in frame F. There's nothing more | 8693 | /* This fontset is already set in frame F. There's nothing more |
| 8873 | to do. */ | 8694 | to do. */ |
| 8874 | return build_string (fontsetname); | 8695 | return fontset_name (fontset); |
| 8875 | 8696 | ||
| 8876 | fontsetp = FRAME_FONTSET_DATA (f)->fontset_table[fontset]; | 8697 | result = x_new_font (f, (XSTRING (fontset_ascii (fontset))->data)); |
| 8877 | |||
| 8878 | if (!fontsetp->fontname[CHARSET_ASCII]) | ||
| 8879 | /* This fontset doesn't contain ASCII font. */ | ||
| 8880 | return Qnil; | ||
| 8881 | |||
| 8882 | result = x_new_font (f, fontsetp->fontname[CHARSET_ASCII]); | ||
| 8883 | 8698 | ||
| 8884 | if (!STRINGP (result)) | 8699 | if (!STRINGP (result)) |
| 8885 | /* Can't load ASCII font. */ | 8700 | /* Can't load ASCII font. */ |
| @@ -8887,8 +8702,6 @@ x_new_fontset (f, fontsetname) | |||
| 8887 | 8702 | ||
| 8888 | /* Since x_new_font doesn't update any fontset information, do it now. */ | 8703 | /* Since x_new_font doesn't update any fontset information, do it now. */ |
| 8889 | FRAME_FONTSET(f) = fontset; | 8704 | FRAME_FONTSET(f) = fontset; |
| 8890 | FS_LOAD_FONT (f, FRAME_W32_FONT_TABLE (f), | ||
| 8891 | CHARSET_ASCII, XSTRING (result)->data, fontset); | ||
| 8892 | 8705 | ||
| 8893 | return build_string (fontsetname); | 8706 | return build_string (fontsetname); |
| 8894 | } | 8707 | } |
| @@ -9901,64 +9714,91 @@ NT uses Unicode internally anyway, so this flag will probably have no\n\ | |||
| 9901 | affect on NT machines."); | 9714 | affect on NT machines."); |
| 9902 | w32_enable_unicode_output = 1; | 9715 | w32_enable_unicode_output = 1; |
| 9903 | 9716 | ||
| 9904 | DEFVAR_LISP ("w32-charset-to-codepage-alist", | 9717 | /* VIETNAMESE_CHARSET is not defined in some versions of MSVC. */ |
| 9905 | &Vw32_charset_to_codepage_alist, | 9718 | #ifndef VIETNAMESE_CHARSET |
| 9906 | "Alist linking character sets to Windows Codepages."); | 9719 | #define VIETNAMESE_CHARSET 163 |
| 9907 | Vw32_charset_to_codepage_alist = Qnil; | 9720 | #endif |
| 9908 | /* Initialise the alist with some defaults. */ | 9721 | |
| 9909 | XSETFASTINT (codepage, 936); | 9722 | DEFVAR_LISP ("w32-charset-info-alist", |
| 9910 | store_in_alist (&Vw32_charset_to_codepage_alist, | 9723 | &Vw32_charset_info_alist, |
| 9911 | build_string ("gb2312"), codepage); | 9724 | "Alist linking Emacs character sets to Windows fonts\n\ |
| 9912 | XSETFASTINT (codepage, 950); | 9725 | and codepages. Each entry should be of the form:\n\ |
| 9913 | store_in_alist (&Vw32_charset_to_codepage_alist, | 9726 | \n\ |
| 9914 | build_string ("big5"), codepage); | 9727 | (CHARSET_NAME . (WINDOWS_CHARSET . CODEPAGE))\n\ |
| 9915 | XSETFASTINT (codepage, 949); | 9728 | \n\ |
| 9916 | store_in_alist (&Vw32_charset_to_codepage_alist, | 9729 | where CHARSET_NAME is a string used in font names to identify the charset,\n\ |
| 9917 | build_string ("ksc5601.1987"), codepage); | 9730 | WINDOWS_CHARSET is a symbol that can be one of:\n\ |
| 9918 | XSETFASTINT (codepage, 1361); | 9731 | w32-charset-ansi, w32-charset-default, w32-charset-symbol,\n\ |
| 9919 | store_in_alist (&Vw32_charset_to_codepage_alist, | 9732 | w32-charset-shiftjis, w32-charset-hangul, w32-charset-gb2312,\n\ |
| 9920 | build_string ("ksc5601.1992"), codepage); | 9733 | w32-charset-chinesebig5, " |
| 9921 | XSETFASTINT (codepage, 932); | 9734 | #ifdef JOHAB_CHARSET |
| 9922 | store_in_alist (&Vw32_charset_to_codepage_alist, | 9735 | "w32-charset-johab, w32-charset-hebrew,\n\ |
| 9923 | build_string ("jisx0208-sjis"), codepage); | 9736 | w32-charset-arabic, w32-charset-greek, w32-charset-turkish,\n\ |
| 9924 | XSETFASTINT (codepage, 874); | 9737 | w32-charset-vietnamese, w32-charset-thai, w32-charset-easteurope,\n\ |
| 9925 | store_in_alist (&Vw32_charset_to_codepage_alist, | 9738 | w32-charset-russian, w32-charset-mac, w32-charset-baltic,\n" |
| 9926 | build_string ("tis620"), codepage); | 9739 | #endif |
| 9927 | XSETFASTINT (codepage, 20866); | 9740 | #ifdef UNICODE_CHARSET |
| 9928 | store_in_alist (&Vw32_charset_to_codepage_alist, | 9741 | "w32-charset-unicode, " |
| 9929 | build_string ("koi8-r"), codepage); | 9742 | #endif |
| 9930 | /* iso8859-13 is not yet officially adopted, but it is conveniently | 9743 | "or w32-charset-oem.\n\ |
| 9931 | covered by CP 1257. */ | 9744 | CODEPAGE should be an integer specifying the codepage that should be used\n\ |
| 9932 | XSETFASTINT (codepage, 1257); | 9745 | to display the character set, t to do no translation and output as Unicode,\n\ |
| 9933 | store_in_alist (&Vw32_charset_to_codepage_alist, | 9746 | or nil to do no translation and output as 8 bit (or multibyte on far-east\n\ |
| 9934 | build_string ("iso8859-13"), codepage); | 9747 | versions of Windows) characters."); |
| 9935 | XSETFASTINT (codepage, 1254); | 9748 | Vw32_charset_info_alist = Qnil; |
| 9936 | store_in_alist (&Vw32_charset_to_codepage_alist, | 9749 | |
| 9937 | build_string ("iso8859-9"), codepage); | 9750 | staticpro (&Qw32_charset_ansi); |
| 9938 | XSETFASTINT (codepage, 1255); | 9751 | Qw32_charset_ansi = intern ("w32-charset-ansi"); |
| 9939 | store_in_alist (&Vw32_charset_to_codepage_alist, | 9752 | staticpro (&Qw32_charset_symbol); |
| 9940 | build_string ("iso8859-8"), codepage); | 9753 | Qw32_charset_symbol = intern ("w32-charset-symbol"); |
| 9941 | XSETFASTINT (codepage, 28597); | 9754 | staticpro (&Qw32_charset_shiftjis); |
| 9942 | store_in_alist (&Vw32_charset_to_codepage_alist, | 9755 | Qw32_charset_shiftjis = intern ("w32-charset-shiftjis"); |
| 9943 | build_string ("iso8859-7"), codepage); | 9756 | staticpro (&Qw32_charset_hangul); |
| 9944 | XSETFASTINT (codepage, 28596); | 9757 | Qw32_charset_hangul = intern ("w32-charset-hangul"); |
| 9945 | store_in_alist (&Vw32_charset_to_codepage_alist, | 9758 | staticpro (&Qw32_charset_chinesebig5); |
| 9946 | build_string ("iso8859-6"), codepage); | 9759 | Qw32_charset_chinesebig5 = intern ("w32-charset-chinesebig5"); |
| 9947 | XSETFASTINT (codepage, 28595); | 9760 | staticpro (&Qw32_charset_gb2312); |
| 9948 | store_in_alist (&Vw32_charset_to_codepage_alist, | 9761 | Qw32_charset_gb2312 = intern ("w32-charset-gb2312"); |
| 9949 | build_string ("iso8859-5"), codepage); | 9762 | staticpro (&Qw32_charset_oem); |
| 9950 | XSETFASTINT (codepage, 28594); | 9763 | Qw32_charset_oem = intern ("w32-charset-oem"); |
| 9951 | store_in_alist (&Vw32_charset_to_codepage_alist, | 9764 | |
| 9952 | build_string ("iso8859-4"), codepage); | 9765 | #ifdef JOHAB_CHARSET |
| 9953 | XSETFASTINT (codepage, 28593); | 9766 | { |
| 9954 | store_in_alist (&Vw32_charset_to_codepage_alist, | 9767 | static int w32_extra_charsets_defined = 1; |
| 9955 | build_string ("iso8859-3"), codepage); | 9768 | DEFVAR_BOOL ("w32-extra-charsets-defined", w32_extra_charsets_defined, ""); |
| 9956 | XSETFASTINT (codepage, 28592); | 9769 | |
| 9957 | store_in_alist (&Vw32_charset_to_codepage_alist, | 9770 | staticpro (&Qw32_charset_johab); |
| 9958 | build_string ("iso8859-2"), codepage); | 9771 | Qw32_charset_johab = intern ("w32-charset-johab"); |
| 9959 | XSETFASTINT (codepage, 1252); | 9772 | staticpro (&Qw32_charset_easteurope); |
| 9960 | store_in_alist (&Vw32_charset_to_codepage_alist, | 9773 | Qw32_charset_easteurope = intern ("w32-charset-easteurope"); |
| 9961 | build_string ("iso8859-1"), codepage); | 9774 | staticpro (&Qw32_charset_turkish); |
| 9775 | Qw32_charset_turkish = intern ("w32-charset-turkish"); | ||
| 9776 | staticpro (&Qw32_charset_baltic); | ||
| 9777 | Qw32_charset_baltic = intern ("w32-charset-baltic"); | ||
| 9778 | staticpro (&Qw32_charset_russian); | ||
| 9779 | Qw32_charset_russian = intern ("w32-charset-russian"); | ||
| 9780 | staticpro (&Qw32_charset_arabic); | ||
| 9781 | Qw32_charset_arabic = intern ("w32-charset-arabic"); | ||
| 9782 | staticpro (&Qw32_charset_greek); | ||
| 9783 | Qw32_charset_greek = intern ("w32-charset-greek"); | ||
| 9784 | staticpro (&Qw32_charset_hebrew); | ||
| 9785 | Qw32_charset_hebrew = intern ("w32-charset-hebrew"); | ||
| 9786 | staticpro (&Qw32_charset_thai); | ||
| 9787 | Qw32_charset_thai = intern ("w32-charset-thai"); | ||
| 9788 | staticpro (&Qw32_charset_mac); | ||
| 9789 | Qw32_charset_mac = intern ("w32-charset-mac"); | ||
| 9790 | } | ||
| 9791 | #endif | ||
| 9792 | |||
| 9793 | #ifdef UNICODE_CHARSET | ||
| 9794 | { | ||
| 9795 | static int w32_unicode_charset_defined = 1; | ||
| 9796 | DEFVAR_BOOL ("w32-unicode-charset-defined", | ||
| 9797 | w32_unicode_charset_defined, ""); | ||
| 9798 | |||
| 9799 | staticpro (&Qw32_charset_unicode); | ||
| 9800 | Qw32_charset_unicode = intern ("w32-charset-unicode"); | ||
| 9801 | #endif | ||
| 9962 | 9802 | ||
| 9963 | staticpro (&help_echo); | 9803 | staticpro (&help_echo); |
| 9964 | help_echo = Qnil; | 9804 | help_echo = Qnil; |