diff options
Diffstat (limited to 'src/w32font.c')
| -rw-r--r-- | src/w32font.c | 218 |
1 files changed, 188 insertions, 30 deletions
diff --git a/src/w32font.c b/src/w32font.c index 985370c15c1..dab9f4c61b4 100644 --- a/src/w32font.c +++ b/src/w32font.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Font backend for the Microsoft W32 API. | 1 | /* Font backend for the Microsoft W32 API. |
| 2 | Copyright (C) 2007-2011 Free Software Foundation, Inc. | 2 | Copyright (C) 2007-2012 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is part of GNU Emacs. | 4 | This file is part of GNU Emacs. |
| 5 | 5 | ||
| @@ -145,6 +145,138 @@ struct font_callback_data | |||
| 145 | style variations if the font name is not specified. */ | 145 | style variations if the font name is not specified. */ |
| 146 | static void list_all_matching_fonts (struct font_callback_data *); | 146 | static void list_all_matching_fonts (struct font_callback_data *); |
| 147 | 147 | ||
| 148 | static BOOL g_b_init_is_w9x; | ||
| 149 | static BOOL g_b_init_get_outline_metrics_w; | ||
| 150 | static BOOL g_b_init_get_text_metrics_w; | ||
| 151 | static BOOL g_b_init_get_glyph_outline_w; | ||
| 152 | static BOOL g_b_init_get_glyph_outline_w; | ||
| 153 | |||
| 154 | typedef UINT (WINAPI * GetOutlineTextMetricsW_Proc) ( | ||
| 155 | HDC hdc, | ||
| 156 | UINT cbData, | ||
| 157 | LPOUTLINETEXTMETRICW lpotmw); | ||
| 158 | typedef BOOL (WINAPI * GetTextMetricsW_Proc) ( | ||
| 159 | HDC hdc, | ||
| 160 | LPTEXTMETRICW lptmw); | ||
| 161 | typedef DWORD (WINAPI * GetGlyphOutlineW_Proc) ( | ||
| 162 | HDC hdc, | ||
| 163 | UINT uChar, | ||
| 164 | UINT uFormat, | ||
| 165 | LPGLYPHMETRICS lpgm, | ||
| 166 | DWORD cbBuffer, | ||
| 167 | LPVOID lpvBuffer, | ||
| 168 | const MAT2 *lpmat2); | ||
| 169 | |||
| 170 | /* Several "wide" functions we use to support the font backends are | ||
| 171 | unavailable on Windows 9X, unless UNICOWS.DLL is installed (their | ||
| 172 | versions in the default libraries are non-functional stubs). On NT | ||
| 173 | and later systems, these functions are in GDI32.DLL. The following | ||
| 174 | helper function attempts to load UNICOWS.DLL on Windows 9X, and | ||
| 175 | refuses to let Emacs start up if that library is not found. On NT | ||
| 176 | and later versions, it simply loads GDI32.DLL, which should always | ||
| 177 | be available. */ | ||
| 178 | static HMODULE | ||
| 179 | w32_load_unicows_or_gdi32 (void) | ||
| 180 | { | ||
| 181 | static BOOL is_9x = 0; | ||
| 182 | OSVERSIONINFO os_ver; | ||
| 183 | HMODULE ret; | ||
| 184 | if (g_b_init_is_w9x == 0) | ||
| 185 | { | ||
| 186 | g_b_init_is_w9x = 1; | ||
| 187 | ZeroMemory (&os_ver, sizeof (OSVERSIONINFO)); | ||
| 188 | os_ver.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); | ||
| 189 | if (GetVersionEx (&os_ver)) | ||
| 190 | is_9x = (os_ver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS); | ||
| 191 | } | ||
| 192 | if (is_9x) | ||
| 193 | { | ||
| 194 | ret = LoadLibrary ("Unicows.dll"); | ||
| 195 | if (!ret) | ||
| 196 | { | ||
| 197 | int button; | ||
| 198 | |||
| 199 | button = MessageBox (NULL, | ||
| 200 | "Emacs cannot load the UNICOWS.DLL library.\n" | ||
| 201 | "This library is essential for using Emacs\n" | ||
| 202 | "on this system. You need to install it.\n\n" | ||
| 203 | "However, you can still use Emacs by invoking\n" | ||
| 204 | "it with the '-nw' command-line option.\n\n" | ||
| 205 | "Emacs will exit when you click OK.", | ||
| 206 | "Emacs cannot load UNICOWS.DLL", | ||
| 207 | MB_ICONERROR | MB_TASKMODAL | ||
| 208 | | MB_SETFOREGROUND | MB_OK); | ||
| 209 | switch (button) | ||
| 210 | { | ||
| 211 | case IDOK: | ||
| 212 | default: | ||
| 213 | exit (1); | ||
| 214 | } | ||
| 215 | } | ||
| 216 | } | ||
| 217 | else | ||
| 218 | ret = LoadLibrary ("Gdi32.dll"); | ||
| 219 | return ret; | ||
| 220 | } | ||
| 221 | |||
| 222 | /* The following 3 functions call the problematic "wide" APIs via | ||
| 223 | function pointers, to avoid linking against the non-standard | ||
| 224 | libunicows on W9X. */ | ||
| 225 | static UINT WINAPI | ||
| 226 | get_outline_metrics_w(HDC hdc, UINT cbData, LPOUTLINETEXTMETRICW lpotmw) | ||
| 227 | { | ||
| 228 | static GetOutlineTextMetricsW_Proc s_pfn_Get_Outline_Text_MetricsW = NULL; | ||
| 229 | HMODULE hm_unicows = NULL; | ||
| 230 | if (g_b_init_get_outline_metrics_w == 0) | ||
| 231 | { | ||
| 232 | g_b_init_get_outline_metrics_w = 1; | ||
| 233 | hm_unicows = w32_load_unicows_or_gdi32 (); | ||
| 234 | if (hm_unicows) | ||
| 235 | s_pfn_Get_Outline_Text_MetricsW = (GetOutlineTextMetricsW_Proc) | ||
| 236 | GetProcAddress (hm_unicows, "GetOutlineTextMetricsW"); | ||
| 237 | } | ||
| 238 | if (s_pfn_Get_Outline_Text_MetricsW == NULL) | ||
| 239 | abort (); /* cannot happen */ | ||
| 240 | return s_pfn_Get_Outline_Text_MetricsW (hdc, cbData, lpotmw); | ||
| 241 | } | ||
| 242 | |||
| 243 | static BOOL WINAPI | ||
| 244 | get_text_metrics_w(HDC hdc, LPTEXTMETRICW lptmw) | ||
| 245 | { | ||
| 246 | static GetTextMetricsW_Proc s_pfn_Get_Text_MetricsW = NULL; | ||
| 247 | HMODULE hm_unicows = NULL; | ||
| 248 | if (g_b_init_get_text_metrics_w == 0) | ||
| 249 | { | ||
| 250 | g_b_init_get_text_metrics_w = 1; | ||
| 251 | hm_unicows = w32_load_unicows_or_gdi32 (); | ||
| 252 | if (hm_unicows) | ||
| 253 | s_pfn_Get_Text_MetricsW = (GetTextMetricsW_Proc) | ||
| 254 | GetProcAddress (hm_unicows, "GetTextMetricsW"); | ||
| 255 | } | ||
| 256 | if (s_pfn_Get_Text_MetricsW == NULL) | ||
| 257 | abort (); /* cannot happen */ | ||
| 258 | return s_pfn_Get_Text_MetricsW (hdc, lptmw); | ||
| 259 | } | ||
| 260 | |||
| 261 | static DWORD WINAPI | ||
| 262 | get_glyph_outline_w (HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm, | ||
| 263 | DWORD cbBuffer, LPVOID lpvBuffer, const MAT2 *lpmat2) | ||
| 264 | { | ||
| 265 | static GetGlyphOutlineW_Proc s_pfn_Get_Glyph_OutlineW = NULL; | ||
| 266 | HMODULE hm_unicows = NULL; | ||
| 267 | if (g_b_init_get_glyph_outline_w == 0) | ||
| 268 | { | ||
| 269 | g_b_init_get_glyph_outline_w = 1; | ||
| 270 | hm_unicows = w32_load_unicows_or_gdi32 (); | ||
| 271 | if (hm_unicows) | ||
| 272 | s_pfn_Get_Glyph_OutlineW = (GetGlyphOutlineW_Proc) | ||
| 273 | GetProcAddress (hm_unicows, "GetGlyphOutlineW"); | ||
| 274 | } | ||
| 275 | if (s_pfn_Get_Glyph_OutlineW == NULL) | ||
| 276 | abort (); /* cannot happen */ | ||
| 277 | return s_pfn_Get_Glyph_OutlineW (hdc, uChar, uFormat, lpgm, cbBuffer, | ||
| 278 | lpvBuffer, lpmat2); | ||
| 279 | } | ||
| 148 | 280 | ||
| 149 | static int | 281 | static int |
| 150 | memq_no_quit (Lisp_Object elt, Lisp_Object list) | 282 | memq_no_quit (Lisp_Object elt, Lisp_Object list) |
| @@ -198,7 +330,7 @@ w32font_list (Lisp_Object frame, Lisp_Object font_spec) | |||
| 198 | 330 | ||
| 199 | /* w32 implementation of match for font backend. | 331 | /* w32 implementation of match for font backend. |
| 200 | Return a font entity most closely matching with FONT_SPEC on | 332 | Return a font entity most closely matching with FONT_SPEC on |
| 201 | FRAME. The closeness is detemined by the font backend, thus | 333 | FRAME. The closeness is determined by the font backend, thus |
| 202 | `face-font-selection-order' is ignored here. */ | 334 | `face-font-selection-order' is ignored here. */ |
| 203 | static Lisp_Object | 335 | static Lisp_Object |
| 204 | w32font_match (Lisp_Object frame, Lisp_Object font_spec) | 336 | w32font_match (Lisp_Object frame, Lisp_Object font_spec) |
| @@ -330,7 +462,7 @@ w32font_has_char (Lisp_Object entity, int c) | |||
| 330 | Return a glyph code of FONT for character C (Unicode code point). | 462 | Return a glyph code of FONT for character C (Unicode code point). |
| 331 | If FONT doesn't have such a glyph, return FONT_INVALID_CODE. | 463 | If FONT doesn't have such a glyph, return FONT_INVALID_CODE. |
| 332 | 464 | ||
| 333 | For speed, the gdi backend uses unicode (Emacs calls encode_char | 465 | For speed, the gdi backend uses Unicode (Emacs calls encode_char |
| 334 | far too often for it to be efficient). But we still need to detect | 466 | far too often for it to be efficient). But we still need to detect |
| 335 | which characters are not supported by the font. | 467 | which characters are not supported by the font. |
| 336 | */ | 468 | */ |
| @@ -488,7 +620,7 @@ w32font_text_extents (struct font *font, unsigned *code, | |||
| 488 | total_width = size.cx; | 620 | total_width = size.cx; |
| 489 | } | 621 | } |
| 490 | 622 | ||
| 491 | /* On 95/98/ME, only some unicode functions are available, so fallback | 623 | /* On 95/98/ME, only some Unicode functions are available, so fallback |
| 492 | on doing a dummy draw to find the total width. */ | 624 | on doing a dummy draw to find the total width. */ |
| 493 | if (!total_width) | 625 | if (!total_width) |
| 494 | { | 626 | { |
| @@ -654,7 +786,7 @@ w32font_free_outline (struct font *font, void *outline); | |||
| 654 | Optional. | 786 | Optional. |
| 655 | Get coordinates of the INDEXth anchor point of the glyph whose | 787 | Get coordinates of the INDEXth anchor point of the glyph whose |
| 656 | code is CODE. Store the coordinates in *X and *Y. Return 0 if | 788 | code is CODE. Store the coordinates in *X and *Y. Return 0 if |
| 657 | the operations was successfull. Otherwise return -1. | 789 | the operations was successful. Otherwise return -1. |
| 658 | static int | 790 | static int |
| 659 | w32font_anchor_point (struct font *font, unsigned code, | 791 | w32font_anchor_point (struct font *font, unsigned code, |
| 660 | int index, int *x, int *y); | 792 | int index, int *x, int *y); |
| @@ -816,11 +948,11 @@ w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity, | |||
| 816 | old_font = SelectObject (dc, hfont); | 948 | old_font = SelectObject (dc, hfont); |
| 817 | 949 | ||
| 818 | /* Try getting the outline metrics (only works for truetype fonts). */ | 950 | /* Try getting the outline metrics (only works for truetype fonts). */ |
| 819 | len = GetOutlineTextMetricsW (dc, 0, NULL); | 951 | len = get_outline_metrics_w (dc, 0, NULL); |
| 820 | if (len) | 952 | if (len) |
| 821 | { | 953 | { |
| 822 | metrics = (OUTLINETEXTMETRICW *) alloca (len); | 954 | metrics = (OUTLINETEXTMETRICW *) alloca (len); |
| 823 | if (GetOutlineTextMetricsW (dc, len, metrics)) | 955 | if (get_outline_metrics_w (dc, len, metrics)) |
| 824 | memcpy (&w32_font->metrics, &metrics->otmTextMetrics, | 956 | memcpy (&w32_font->metrics, &metrics->otmTextMetrics, |
| 825 | sizeof (TEXTMETRICW)); | 957 | sizeof (TEXTMETRICW)); |
| 826 | else | 958 | else |
| @@ -828,7 +960,7 @@ w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity, | |||
| 828 | } | 960 | } |
| 829 | 961 | ||
| 830 | if (!metrics) | 962 | if (!metrics) |
| 831 | GetTextMetricsW (dc, &w32_font->metrics); | 963 | get_text_metrics_w (dc, &w32_font->metrics); |
| 832 | 964 | ||
| 833 | w32_font->cached_metrics = NULL; | 965 | w32_font->cached_metrics = NULL; |
| 834 | w32_font->n_cache_blocks = 0; | 966 | w32_font->n_cache_blocks = 0; |
| @@ -1021,7 +1153,7 @@ w32_enumfont_pattern_entity (Lisp_Object frame, | |||
| 1021 | else | 1153 | else |
| 1022 | ASET (entity, FONT_SIZE_INDEX, make_number (0)); | 1154 | ASET (entity, FONT_SIZE_INDEX, make_number (0)); |
| 1023 | 1155 | ||
| 1024 | /* Cache unicode codepoints covered by this font, as there is no other way | 1156 | /* Cache Unicode codepoints covered by this font, as there is no other way |
| 1025 | of getting this information easily. */ | 1157 | of getting this information easily. */ |
| 1026 | if (font_type & TRUETYPE_FONTTYPE) | 1158 | if (font_type & TRUETYPE_FONTTYPE) |
| 1027 | { | 1159 | { |
| @@ -1152,14 +1284,23 @@ font_matches_spec (DWORD type, NEWTEXTMETRICEX *font, | |||
| 1152 | { | 1284 | { |
| 1153 | /* Only truetype fonts will have information about what | 1285 | /* Only truetype fonts will have information about what |
| 1154 | scripts they support. This probably means the user | 1286 | scripts they support. This probably means the user |
| 1155 | will have to force Emacs to use raster, postscript | 1287 | will have to force Emacs to use raster, PostScript |
| 1156 | or atm fonts for non-ASCII text. */ | 1288 | or ATM fonts for non-ASCII text. */ |
| 1157 | if (type & TRUETYPE_FONTTYPE) | 1289 | if (type & TRUETYPE_FONTTYPE) |
| 1158 | { | 1290 | { |
| 1159 | Lisp_Object support | 1291 | Lisp_Object support |
| 1160 | = font_supported_scripts (&font->ntmFontSig); | 1292 | = font_supported_scripts (&font->ntmFontSig); |
| 1161 | if (! memq_no_quit (val, support)) | 1293 | if (! memq_no_quit (val, support)) |
| 1162 | return 0; | 1294 | return 0; |
| 1295 | |||
| 1296 | /* Avoid using non-Japanese fonts for Japanese, even | ||
| 1297 | if they claim they are capable, due to known | ||
| 1298 | breakage in Vista and Windows 7 fonts | ||
| 1299 | (bug#6029). */ | ||
| 1300 | if (EQ (val, Qkana) | ||
| 1301 | && (font->ntmTm.tmCharSet != SHIFTJIS_CHARSET | ||
| 1302 | || !(font->ntmFontSig.fsCsb[0] & CSB_JAPANESE))) | ||
| 1303 | return 0; | ||
| 1163 | } | 1304 | } |
| 1164 | else | 1305 | else |
| 1165 | { | 1306 | { |
| @@ -1323,7 +1464,7 @@ check_face_name (LOGFONT *font, char *full_name) | |||
| 1323 | /* Helvetica is mapped to Arial in Windows, but if a Type-1 Helvetica is | 1464 | /* Helvetica is mapped to Arial in Windows, but if a Type-1 Helvetica is |
| 1324 | installed, we run into problems with the Uniscribe backend which tries | 1465 | installed, we run into problems with the Uniscribe backend which tries |
| 1325 | to avoid non-truetype fonts, and ends up mixing the Type-1 Helvetica | 1466 | to avoid non-truetype fonts, and ends up mixing the Type-1 Helvetica |
| 1326 | with Arial's characteristics, since that attempt to use Truetype works | 1467 | with Arial's characteristics, since that attempt to use TrueType works |
| 1327 | some places, but not others. */ | 1468 | some places, but not others. */ |
| 1328 | if (!xstrcasecmp (font->lfFaceName, "helvetica")) | 1469 | if (!xstrcasecmp (font->lfFaceName, "helvetica")) |
| 1329 | { | 1470 | { |
| @@ -1351,7 +1492,7 @@ check_face_name (LOGFONT *font, char *full_name) | |||
| 1351 | 1492 | ||
| 1352 | 1493 | ||
| 1353 | /* Callback function for EnumFontFamiliesEx. | 1494 | /* Callback function for EnumFontFamiliesEx. |
| 1354 | * Checks if a font matches everything we are trying to check agaist, | 1495 | * Checks if a font matches everything we are trying to check against, |
| 1355 | * and if so, adds it to a list. Both the data we are checking against | 1496 | * and if so, adds it to a list. Both the data we are checking against |
| 1356 | * and the list to which the fonts are added are passed in via the | 1497 | * and the list to which the fonts are added are passed in via the |
| 1357 | * lparam argument, in the form of a font_callback_data struct. */ | 1498 | * lparam argument, in the form of a font_callback_data struct. */ |
| @@ -1373,9 +1514,9 @@ add_font_entity_to_list (ENUMLOGFONTEX *logical_font, | |||
| 1373 | /* Skip non matching fonts. */ | 1514 | /* Skip non matching fonts. */ |
| 1374 | 1515 | ||
| 1375 | /* For uniscribe backend, consider only truetype or opentype fonts | 1516 | /* For uniscribe backend, consider only truetype or opentype fonts |
| 1376 | that have some unicode coverage. */ | 1517 | that have some Unicode coverage. */ |
| 1377 | if (match_data->opentype_only | 1518 | if (match_data->opentype_only |
| 1378 | && ((!physical_font->ntmTm.ntmFlags & NTMFLAGS_OPENTYPE | 1519 | && ((!(physical_font->ntmTm.ntmFlags & NTMFLAGS_OPENTYPE) |
| 1379 | && !(font_type & TRUETYPE_FONTTYPE)) | 1520 | && !(font_type & TRUETYPE_FONTTYPE)) |
| 1380 | || !is_unicode)) | 1521 | || !is_unicode)) |
| 1381 | return 1; | 1522 | return 1; |
| @@ -1416,7 +1557,7 @@ add_font_entity_to_list (ENUMLOGFONTEX *logical_font, | |||
| 1416 | Lisp_Object spec_charset = AREF (match_data->orig_font_spec, | 1557 | Lisp_Object spec_charset = AREF (match_data->orig_font_spec, |
| 1417 | FONT_REGISTRY_INDEX); | 1558 | FONT_REGISTRY_INDEX); |
| 1418 | 1559 | ||
| 1419 | /* iso10646-1 fonts must contain unicode mapping tables. */ | 1560 | /* iso10646-1 fonts must contain Unicode mapping tables. */ |
| 1420 | if (EQ (spec_charset, Qiso10646_1)) | 1561 | if (EQ (spec_charset, Qiso10646_1)) |
| 1421 | { | 1562 | { |
| 1422 | if (!is_unicode) | 1563 | if (!is_unicode) |
| @@ -1431,13 +1572,13 @@ add_font_entity_to_list (ENUMLOGFONTEX *logical_font, | |||
| 1431 | && !(physical_font->ntmFontSig.fsUsb[0] & 0x007F001F)) | 1572 | && !(physical_font->ntmFontSig.fsUsb[0] & 0x007F001F)) |
| 1432 | return 1; | 1573 | return 1; |
| 1433 | } | 1574 | } |
| 1434 | /* unicode-sip fonts must contain characters in unicode plane 2. | 1575 | /* unicode-sip fonts must contain characters in Unicode plane 2. |
| 1435 | so look for bit 57 (surrogates) in the Unicode subranges, plus | 1576 | so look for bit 57 (surrogates) in the Unicode subranges, plus |
| 1436 | the bits for CJK ranges that include those characters. */ | 1577 | the bits for CJK ranges that include those characters. */ |
| 1437 | else if (EQ (spec_charset, Qunicode_sip)) | 1578 | else if (EQ (spec_charset, Qunicode_sip)) |
| 1438 | { | 1579 | { |
| 1439 | if (!physical_font->ntmFontSig.fsUsb[1] & 0x02000000 | 1580 | if (!(physical_font->ntmFontSig.fsUsb[1] & 0x02000000) |
| 1440 | || !physical_font->ntmFontSig.fsUsb[1] & 0x28000000) | 1581 | || !(physical_font->ntmFontSig.fsUsb[1] & 0x28000000)) |
| 1441 | return 1; | 1582 | return 1; |
| 1442 | } | 1583 | } |
| 1443 | 1584 | ||
| @@ -1445,10 +1586,18 @@ add_font_entity_to_list (ENUMLOGFONTEX *logical_font, | |||
| 1445 | 1586 | ||
| 1446 | /* If registry was specified, ensure it is reported as the same. */ | 1587 | /* If registry was specified, ensure it is reported as the same. */ |
| 1447 | if (!NILP (spec_charset)) | 1588 | if (!NILP (spec_charset)) |
| 1448 | ASET (entity, FONT_REGISTRY_INDEX, spec_charset); | 1589 | { |
| 1449 | 1590 | /* Avoid using non-Japanese fonts for Japanese, even if they | |
| 1591 | claim they are capable, due to known breakage in Vista | ||
| 1592 | and Windows 7 fonts (bug#6029). */ | ||
| 1593 | if (logical_font->elfLogFont.lfCharSet == SHIFTJIS_CHARSET | ||
| 1594 | && !(physical_font->ntmFontSig.fsCsb[0] & CSB_JAPANESE)) | ||
| 1595 | return 1; | ||
| 1596 | else | ||
| 1597 | ASET (entity, FONT_REGISTRY_INDEX, spec_charset); | ||
| 1598 | } | ||
| 1450 | /* Otherwise if using the uniscribe backend, report ANSI and DEFAULT | 1599 | /* Otherwise if using the uniscribe backend, report ANSI and DEFAULT |
| 1451 | fonts as unicode and skip other charsets. */ | 1600 | fonts as Unicode and skip other charsets. */ |
| 1452 | else if (match_data->opentype_only) | 1601 | else if (match_data->opentype_only) |
| 1453 | { | 1602 | { |
| 1454 | if (logical_font->elfLogFont.lfCharSet == ANSI_CHARSET | 1603 | if (logical_font->elfLogFont.lfCharSet == ANSI_CHARSET |
| @@ -1491,7 +1640,7 @@ x_to_w32_charset (char * lpcs) | |||
| 1491 | if (strncmp (lpcs, "*-#", 3) == 0) | 1640 | if (strncmp (lpcs, "*-#", 3) == 0) |
| 1492 | return atoi (lpcs + 3); | 1641 | return atoi (lpcs + 3); |
| 1493 | 1642 | ||
| 1494 | /* All Windows fonts qualify as unicode. */ | 1643 | /* All Windows fonts qualify as Unicode. */ |
| 1495 | if (!strncmp (lpcs, "iso10646", 8)) | 1644 | if (!strncmp (lpcs, "iso10646", 8)) |
| 1496 | return DEFAULT_CHARSET; | 1645 | return DEFAULT_CHARSET; |
| 1497 | 1646 | ||
| @@ -1776,7 +1925,7 @@ w32_registry (LONG w32_charset, DWORD font_type) | |||
| 1776 | { | 1925 | { |
| 1777 | char *charset; | 1926 | char *charset; |
| 1778 | 1927 | ||
| 1779 | /* If charset is defaulted, charset is unicode or unknown, depending on | 1928 | /* If charset is defaulted, charset is Unicode or unknown, depending on |
| 1780 | font type. */ | 1929 | font type. */ |
| 1781 | if (w32_charset == DEFAULT_CHARSET) | 1930 | if (w32_charset == DEFAULT_CHARSET) |
| 1782 | return font_type == TRUETYPE_FONTTYPE ? Qiso10646_1 : Qunknown; | 1931 | return font_type == TRUETYPE_FONTTYPE ? Qiso10646_1 : Qunknown; |
| @@ -1916,10 +2065,10 @@ fill_in_logfont (FRAME_PTR f, LOGFONT *logfont, Lisp_Object font_spec) | |||
| 1916 | int spacing = XINT (tmp); | 2065 | int spacing = XINT (tmp); |
| 1917 | if (spacing < FONT_SPACING_MONO) | 2066 | if (spacing < FONT_SPACING_MONO) |
| 1918 | logfont->lfPitchAndFamily | 2067 | logfont->lfPitchAndFamily |
| 1919 | = logfont->lfPitchAndFamily & 0xF0 | VARIABLE_PITCH; | 2068 | = (logfont->lfPitchAndFamily & 0xF0) | VARIABLE_PITCH; |
| 1920 | else | 2069 | else |
| 1921 | logfont->lfPitchAndFamily | 2070 | logfont->lfPitchAndFamily |
| 1922 | = logfont->lfPitchAndFamily & 0xF0 | FIXED_PITCH; | 2071 | = (logfont->lfPitchAndFamily & 0xF0) | FIXED_PITCH; |
| 1923 | } | 2072 | } |
| 1924 | 2073 | ||
| 1925 | /* Process EXTRA info. */ | 2074 | /* Process EXTRA info. */ |
| @@ -1931,7 +2080,7 @@ fill_in_logfont (FRAME_PTR f, LOGFONT *logfont, Lisp_Object font_spec) | |||
| 1931 | { | 2080 | { |
| 1932 | Lisp_Object key, val; | 2081 | Lisp_Object key, val; |
| 1933 | key = XCAR (tmp), val = XCDR (tmp); | 2082 | key = XCAR (tmp), val = XCDR (tmp); |
| 1934 | /* Only use QCscript if charset is not provided, or is unicode | 2083 | /* Only use QCscript if charset is not provided, or is Unicode |
| 1935 | and a single script is specified. This is rather crude, | 2084 | and a single script is specified. This is rather crude, |
| 1936 | and is only used to narrow down the fonts returned where | 2085 | and is only used to narrow down the fonts returned where |
| 1937 | there is a definite match. Some scripts, such as latin, han, | 2086 | there is a definite match. Some scripts, such as latin, han, |
| @@ -2072,7 +2221,7 @@ font_supported_scripts (FONTSIGNATURE * sig) | |||
| 2072 | so don't need to mark them separately. */ | 2221 | so don't need to mark them separately. */ |
| 2073 | /* 1: Latin-1 supplement, 2: Latin Extended A, 3: Latin Extended B. */ | 2222 | /* 1: Latin-1 supplement, 2: Latin Extended A, 3: Latin Extended B. */ |
| 2074 | SUBRANGE (4, Qphonetic); | 2223 | SUBRANGE (4, Qphonetic); |
| 2075 | /* 5: Spacing and tone modifiers, 6: Combining Diacriticals. */ | 2224 | /* 5: Spacing and tone modifiers, 6: Combining Diacritical Marks. */ |
| 2076 | SUBRANGE (7, Qgreek); | 2225 | SUBRANGE (7, Qgreek); |
| 2077 | SUBRANGE (8, Qcoptic); | 2226 | SUBRANGE (8, Qcoptic); |
| 2078 | SUBRANGE (9, Qcyrillic); | 2227 | SUBRANGE (9, Qcyrillic); |
| @@ -2162,7 +2311,7 @@ font_supported_scripts (FONTSIGNATURE * sig) | |||
| 2162 | /* 115: Saurashtra, 116: Kayah Li, 117: Rejang. */ | 2311 | /* 115: Saurashtra, 116: Kayah Li, 117: Rejang. */ |
| 2163 | SUBRANGE (118, Qcham); | 2312 | SUBRANGE (118, Qcham); |
| 2164 | /* 119: Ancient symbols, 120: Phaistos Disc. */ | 2313 | /* 119: Ancient symbols, 120: Phaistos Disc. */ |
| 2165 | /* 121: Carian, Lycian, Lydian, 122: Dominos, Mah Jong tiles. */ | 2314 | /* 121: Carian, Lycian, Lydian, 122: Dominoes, Mahjong tiles. */ |
| 2166 | /* 123-127: Reserved. */ | 2315 | /* 123-127: Reserved. */ |
| 2167 | 2316 | ||
| 2168 | /* There isn't really a main symbol range, so include symbol if any | 2317 | /* There isn't really a main symbol range, so include symbol if any |
| @@ -2306,7 +2455,7 @@ compute_metrics (HDC dc, struct w32font_info *w32_font, unsigned int code, | |||
| 2306 | transform.eM11.value = 1; | 2455 | transform.eM11.value = 1; |
| 2307 | transform.eM22.value = 1; | 2456 | transform.eM22.value = 1; |
| 2308 | 2457 | ||
| 2309 | if (GetGlyphOutlineW (dc, code, options, &gm, 0, NULL, &transform) | 2458 | if (get_glyph_outline_w (dc, code, options, &gm, 0, NULL, &transform) |
| 2310 | != GDI_ERROR) | 2459 | != GDI_ERROR) |
| 2311 | { | 2460 | { |
| 2312 | metrics->lbearing = gm.gmptGlyphOrigin.x; | 2461 | metrics->lbearing = gm.gmptGlyphOrigin.x; |
| @@ -2581,3 +2730,12 @@ versions of Windows) characters. */); | |||
| 2581 | w32font_driver.type = Qgdi; | 2730 | w32font_driver.type = Qgdi; |
| 2582 | register_font_driver (&w32font_driver, NULL); | 2731 | register_font_driver (&w32font_driver, NULL); |
| 2583 | } | 2732 | } |
| 2733 | |||
| 2734 | void | ||
| 2735 | globals_of_w32font (void) | ||
| 2736 | { | ||
| 2737 | g_b_init_is_w9x = 0; | ||
| 2738 | g_b_init_get_outline_metrics_w = 0; | ||
| 2739 | g_b_init_get_text_metrics_w = 0; | ||
| 2740 | g_b_init_get_glyph_outline_w = 0; | ||
| 2741 | } | ||