diff options
Diffstat (limited to 'src/w32font.c')
| -rw-r--r-- | src/w32font.c | 127 |
1 files changed, 110 insertions, 17 deletions
diff --git a/src/w32font.c b/src/w32font.c index 14d49b24d9b..9a334717c12 100644 --- a/src/w32font.c +++ b/src/w32font.c | |||
| @@ -90,6 +90,8 @@ struct font_callback_data | |||
| 90 | Lisp_Object orig_font_spec; | 90 | Lisp_Object orig_font_spec; |
| 91 | /* The frame the font is being loaded on. */ | 91 | /* The frame the font is being loaded on. */ |
| 92 | Lisp_Object frame; | 92 | Lisp_Object frame; |
| 93 | /* Fonts known to support the font spec, or nil if none. */ | ||
| 94 | Lisp_Object known_fonts; | ||
| 93 | /* The list to add matches to. */ | 95 | /* The list to add matches to. */ |
| 94 | Lisp_Object list; | 96 | Lisp_Object list; |
| 95 | /* Whether to match only opentype fonts. */ | 97 | /* Whether to match only opentype fonts. */ |
| @@ -841,6 +843,25 @@ w32font_list_internal (struct frame *f, Lisp_Object font_spec, | |||
| 841 | match_data.opentype_only = opentype_only; | 843 | match_data.opentype_only = opentype_only; |
| 842 | if (opentype_only) | 844 | if (opentype_only) |
| 843 | match_data.pattern.lfOutPrecision = OUT_OUTLINE_PRECIS; | 845 | match_data.pattern.lfOutPrecision = OUT_OUTLINE_PRECIS; |
| 846 | match_data.known_fonts = Qnil; | ||
| 847 | Lisp_Object vw32_non_USB_fonts = Fsymbol_value (Qw32_non_USB_fonts), val; | ||
| 848 | if (CONSP (vw32_non_USB_fonts)) | ||
| 849 | { | ||
| 850 | Lisp_Object extra; | ||
| 851 | for (extra = AREF (font_spec, FONT_EXTRA_INDEX); | ||
| 852 | CONSP (extra); extra = XCDR (extra)) | ||
| 853 | { | ||
| 854 | Lisp_Object tem = XCAR (extra); | ||
| 855 | if (CONSP (tem) | ||
| 856 | && EQ (XCAR (tem), QCscript) | ||
| 857 | && SYMBOLP (XCDR (tem)) | ||
| 858 | && !NILP (val = assq_no_quit (XCDR (tem), vw32_non_USB_fonts))) | ||
| 859 | { | ||
| 860 | match_data.known_fonts = XCDR (val); | ||
| 861 | break; | ||
| 862 | } | ||
| 863 | } | ||
| 864 | } | ||
| 844 | 865 | ||
| 845 | if (match_data.pattern.lfFaceName[0] == '\0') | 866 | if (match_data.pattern.lfFaceName[0] == '\0') |
| 846 | { | 867 | { |
| @@ -890,6 +911,26 @@ w32font_match_internal (struct frame *f, Lisp_Object font_spec, | |||
| 890 | if (opentype_only) | 911 | if (opentype_only) |
| 891 | match_data.pattern.lfOutPrecision = OUT_OUTLINE_PRECIS; | 912 | match_data.pattern.lfOutPrecision = OUT_OUTLINE_PRECIS; |
| 892 | 913 | ||
| 914 | match_data.known_fonts = Qnil; | ||
| 915 | Lisp_Object vw32_non_USB_fonts = Fsymbol_value (Qw32_non_USB_fonts), val; | ||
| 916 | if (CONSP (vw32_non_USB_fonts)) | ||
| 917 | { | ||
| 918 | Lisp_Object extra; | ||
| 919 | for (extra = AREF (font_spec, FONT_EXTRA_INDEX); | ||
| 920 | CONSP (extra); extra = XCDR (extra)) | ||
| 921 | { | ||
| 922 | Lisp_Object tem = XCAR (extra); | ||
| 923 | if (CONSP (tem) | ||
| 924 | && EQ (XCAR (tem), QCscript) | ||
| 925 | && SYMBOLP (XCDR (tem)) | ||
| 926 | && !NILP (val = assq_no_quit (XCDR (tem), vw32_non_USB_fonts))) | ||
| 927 | { | ||
| 928 | match_data.known_fonts = XCDR (val); | ||
| 929 | break; | ||
| 930 | } | ||
| 931 | } | ||
| 932 | } | ||
| 933 | |||
| 893 | /* Prevent quitting while EnumFontFamiliesEx runs and conses the | 934 | /* Prevent quitting while EnumFontFamiliesEx runs and conses the |
| 894 | list it will return. That's because get_frame_dc acquires the | 935 | list it will return. That's because get_frame_dc acquires the |
| 895 | critical section, so we cannot quit before we release it in | 936 | critical section, so we cannot quit before we release it in |
| @@ -1511,9 +1552,13 @@ add_font_entity_to_list (ENUMLOGFONTEX *logical_font, | |||
| 1511 | 1552 | ||
| 1512 | /* Ensure a match. */ | 1553 | /* Ensure a match. */ |
| 1513 | if (!logfonts_match (&logical_font->elfLogFont, &match_data->pattern) | 1554 | if (!logfonts_match (&logical_font->elfLogFont, &match_data->pattern) |
| 1514 | || !font_matches_spec (font_type, physical_font, | 1555 | || !(font_matches_spec (font_type, physical_font, |
| 1515 | match_data->orig_font_spec, backend, | 1556 | match_data->orig_font_spec, backend, |
| 1516 | &logical_font->elfLogFont) | 1557 | &logical_font->elfLogFont) |
| 1558 | || (!NILP (match_data->known_fonts) | ||
| 1559 | && memq_no_quit | ||
| 1560 | (intern_font_name (logical_font->elfLogFont.lfFaceName), | ||
| 1561 | match_data->known_fonts))) | ||
| 1517 | || !w32font_coverage_ok (&physical_font->ntmFontSig, | 1562 | || !w32font_coverage_ok (&physical_font->ntmFontSig, |
| 1518 | match_data->pattern.lfCharSet)) | 1563 | match_data->pattern.lfCharSet)) |
| 1519 | return 1; | 1564 | return 1; |
| @@ -2214,8 +2259,9 @@ font_supported_scripts (FONTSIGNATURE * sig) | |||
| 2214 | || (subranges[2] & (mask2)) || (subranges[3] & (mask3))) \ | 2259 | || (subranges[2] & (mask2)) || (subranges[3] & (mask3))) \ |
| 2215 | supported = Fcons ((sym), supported) | 2260 | supported = Fcons ((sym), supported) |
| 2216 | 2261 | ||
| 2217 | SUBRANGE (0, Qlatin); | 2262 | /* 0: ASCII (a.k.a. "Basic Latin"), |
| 2218 | /* 1: Latin-1 supplement, 2: Latin Extended A, 3: Latin Extended B. */ | 2263 | 1: Latin-1 supplement, 2: Latin Extended A, 3: Latin Extended B, |
| 2264 | 29: Latin Extended Additional. */ | ||
| 2219 | /* Most fonts that support Latin will have good coverage of the | 2265 | /* Most fonts that support Latin will have good coverage of the |
| 2220 | Extended blocks, so in practice marking them below is not really | 2266 | Extended blocks, so in practice marking them below is not really |
| 2221 | needed, or useful: if a font claims support for, say, Latin | 2267 | needed, or useful: if a font claims support for, say, Latin |
| @@ -2224,12 +2270,11 @@ font_supported_scripts (FONTSIGNATURE * sig) | |||
| 2224 | fontset to display those few characters. But we mark these | 2270 | fontset to display those few characters. But we mark these |
| 2225 | subranges here anyway, for the marginal use cases where they | 2271 | subranges here anyway, for the marginal use cases where they |
| 2226 | might make a difference. */ | 2272 | might make a difference. */ |
| 2227 | SUBRANGE (1, Qlatin); | 2273 | MASK_ANY (0x2000000F, 0, 0, 0, Qlatin); |
| 2228 | SUBRANGE (2, Qlatin); | ||
| 2229 | SUBRANGE (3, Qlatin); | ||
| 2230 | SUBRANGE (4, Qphonetic); | 2274 | SUBRANGE (4, Qphonetic); |
| 2231 | /* 5: Spacing and tone modifiers, 6: Combining Diacritical Marks. */ | 2275 | /* 5: Spacing and tone modifiers, 6: Combining Diacritical Marks. */ |
| 2232 | SUBRANGE (7, Qgreek); | 2276 | /* 7: Greek and Coptic, 30: Greek Extended. */ |
| 2277 | MASK_ANY (0x40000080, 0, 0, 0, Qgreek); | ||
| 2233 | SUBRANGE (8, Qcoptic); | 2278 | SUBRANGE (8, Qcoptic); |
| 2234 | SUBRANGE (9, Qcyrillic); | 2279 | SUBRANGE (9, Qcyrillic); |
| 2235 | SUBRANGE (10, Qarmenian); | 2280 | SUBRANGE (10, Qarmenian); |
| @@ -2246,7 +2291,7 @@ font_supported_scripts (FONTSIGNATURE * sig) | |||
| 2246 | SUBRANGE (16, Qbengali); | 2291 | SUBRANGE (16, Qbengali); |
| 2247 | SUBRANGE (17, Qgurmukhi); | 2292 | SUBRANGE (17, Qgurmukhi); |
| 2248 | SUBRANGE (18, Qgujarati); | 2293 | SUBRANGE (18, Qgujarati); |
| 2249 | SUBRANGE (19, Qoriya); | 2294 | SUBRANGE (19, Qoriya); /* a.k.a. "Odia" */ |
| 2250 | SUBRANGE (20, Qtamil); | 2295 | SUBRANGE (20, Qtamil); |
| 2251 | SUBRANGE (21, Qtelugu); | 2296 | SUBRANGE (21, Qtelugu); |
| 2252 | SUBRANGE (22, Qkannada); | 2297 | SUBRANGE (22, Qkannada); |
| @@ -2259,8 +2304,7 @@ font_supported_scripts (FONTSIGNATURE * sig) | |||
| 2259 | /* 29: Latin Extended, 30: Greek Extended -- covered above. */ | 2304 | /* 29: Latin Extended, 30: Greek Extended -- covered above. */ |
| 2260 | /* 31: Supplemental Punctuation -- most probably be masked by | 2305 | /* 31: Supplemental Punctuation -- most probably be masked by |
| 2261 | Courier New, so fontset customization is needed. */ | 2306 | Courier New, so fontset customization is needed. */ |
| 2262 | SUBRANGE (31, Qsymbol); | 2307 | /* 31-47: Symbols (defined below). */ |
| 2263 | /* 32-47: Symbols (defined below). */ | ||
| 2264 | SUBRANGE (48, Qcjk_misc); | 2308 | SUBRANGE (48, Qcjk_misc); |
| 2265 | /* Match either 49: katakana or 50: hiragana for kana. */ | 2309 | /* Match either 49: katakana or 50: hiragana for kana. */ |
| 2266 | MASK_ANY (0, 0x00060000, 0, 0, Qkana); | 2310 | MASK_ANY (0, 0x00060000, 0, 0, Qkana); |
| @@ -2286,7 +2330,7 @@ font_supported_scripts (FONTSIGNATURE * sig) | |||
| 2286 | SUBRANGE (71, Qsyriac); | 2330 | SUBRANGE (71, Qsyriac); |
| 2287 | SUBRANGE (72, Qthaana); | 2331 | SUBRANGE (72, Qthaana); |
| 2288 | SUBRANGE (73, Qsinhala); | 2332 | SUBRANGE (73, Qsinhala); |
| 2289 | SUBRANGE (74, Qmyanmar); | 2333 | SUBRANGE (74, Qburmese); /* a.k.a. "Myanmar" */ |
| 2290 | SUBRANGE (75, Qethiopic); | 2334 | SUBRANGE (75, Qethiopic); |
| 2291 | SUBRANGE (76, Qcherokee); | 2335 | SUBRANGE (76, Qcherokee); |
| 2292 | SUBRANGE (77, Qcanadian_aboriginal); | 2336 | SUBRANGE (77, Qcanadian_aboriginal); |
| @@ -2329,6 +2373,7 @@ font_supported_scripts (FONTSIGNATURE * sig) | |||
| 2329 | SUBRANGE (99, Qhan); | 2373 | SUBRANGE (99, Qhan); |
| 2330 | SUBRANGE (100, Qsyloti_nagri); | 2374 | SUBRANGE (100, Qsyloti_nagri); |
| 2331 | SUBRANGE (101, Qlinear_b); | 2375 | SUBRANGE (101, Qlinear_b); |
| 2376 | SUBRANGE (101, Qaegean_number); | ||
| 2332 | SUBRANGE (102, Qancient_greek_number); | 2377 | SUBRANGE (102, Qancient_greek_number); |
| 2333 | SUBRANGE (103, Qugaritic); | 2378 | SUBRANGE (103, Qugaritic); |
| 2334 | SUBRANGE (104, Qold_persian); | 2379 | SUBRANGE (104, Qold_persian); |
| @@ -2338,6 +2383,7 @@ font_supported_scripts (FONTSIGNATURE * sig) | |||
| 2338 | SUBRANGE (108, Qkharoshthi); | 2383 | SUBRANGE (108, Qkharoshthi); |
| 2339 | SUBRANGE (109, Qtai_xuan_jing_symbol); | 2384 | SUBRANGE (109, Qtai_xuan_jing_symbol); |
| 2340 | SUBRANGE (110, Qcuneiform); | 2385 | SUBRANGE (110, Qcuneiform); |
| 2386 | SUBRANGE (111, Qcuneiform_numbers_and_punctuation); | ||
| 2341 | SUBRANGE (111, Qcounting_rod_numeral); | 2387 | SUBRANGE (111, Qcounting_rod_numeral); |
| 2342 | SUBRANGE (112, Qsundanese); | 2388 | SUBRANGE (112, Qsundanese); |
| 2343 | SUBRANGE (113, Qlepcha); | 2389 | SUBRANGE (113, Qlepcha); |
| @@ -2357,9 +2403,52 @@ font_supported_scripts (FONTSIGNATURE * sig) | |||
| 2357 | 2403 | ||
| 2358 | /* There isn't really a main symbol range, so include symbol if any | 2404 | /* There isn't really a main symbol range, so include symbol if any |
| 2359 | relevant range is set. */ | 2405 | relevant range is set. */ |
| 2360 | MASK_ANY (0x8000000, 0x0000FFFF, 0, 0, Qsymbol); | 2406 | MASK_ANY (0x80000000, 0x0000FFFF, 0, 0, Qsymbol); |
| 2361 | 2407 | ||
| 2362 | /* Missing: Tai Viet (U+AA80-U+AADF). */ | 2408 | /* Missing: |
| 2409 | Tai Viet | ||
| 2410 | Old Permic | ||
| 2411 | Palmyrene | ||
| 2412 | Nabatean | ||
| 2413 | Manichean | ||
| 2414 | Hanifi Rohingya | ||
| 2415 | Sogdian | ||
| 2416 | Elymaic | ||
| 2417 | Mahajani | ||
| 2418 | Khojki | ||
| 2419 | Khudawadi | ||
| 2420 | Grantha | ||
| 2421 | Newa | ||
| 2422 | Tirhuta | ||
| 2423 | Siddham | ||
| 2424 | Modi | ||
| 2425 | Takri | ||
| 2426 | Dogra | ||
| 2427 | Warang Citi | ||
| 2428 | Nandinagari | ||
| 2429 | Zanabazar Square | ||
| 2430 | Soyombo | ||
| 2431 | Pau Cin Hau | ||
| 2432 | Bhaiksuki | ||
| 2433 | Marchen | ||
| 2434 | Masaram Gondi | ||
| 2435 | Makasar | ||
| 2436 | Egyptian | ||
| 2437 | Mro | ||
| 2438 | Bassa-Vah | ||
| 2439 | Pahawh Hmong | ||
| 2440 | Medefaidrin | ||
| 2441 | Tangut | ||
| 2442 | Tangut Components | ||
| 2443 | Nushu | ||
| 2444 | Duployan Shorthand | ||
| 2445 | Ancient Greek Musical Notation | ||
| 2446 | Nyiakeng Puachue Hmong | ||
| 2447 | Wancho | ||
| 2448 | Mende Kikakui | ||
| 2449 | Adlam | ||
| 2450 | Indic Siyaq Number | ||
| 2451 | Ottoman Siyaq Number. */ | ||
| 2363 | #undef SUBRANGE | 2452 | #undef SUBRANGE |
| 2364 | #undef MASK_ANY | 2453 | #undef MASK_ANY |
| 2365 | 2454 | ||
| @@ -2698,7 +2787,7 @@ syms_of_w32font (void) | |||
| 2698 | DEFSYM (Qthai, "thai"); | 2787 | DEFSYM (Qthai, "thai"); |
| 2699 | DEFSYM (Qlao, "lao"); | 2788 | DEFSYM (Qlao, "lao"); |
| 2700 | DEFSYM (Qtibetan, "tibetan"); | 2789 | DEFSYM (Qtibetan, "tibetan"); |
| 2701 | DEFSYM (Qmyanmar, "myanmar"); | 2790 | DEFSYM (Qburmese, "burmese"); |
| 2702 | DEFSYM (Qgeorgian, "georgian"); | 2791 | DEFSYM (Qgeorgian, "georgian"); |
| 2703 | DEFSYM (Qhangul, "hangul"); | 2792 | DEFSYM (Qhangul, "hangul"); |
| 2704 | DEFSYM (Qethiopic, "ethiopic"); | 2793 | DEFSYM (Qethiopic, "ethiopic"); |
| @@ -2737,6 +2826,8 @@ syms_of_w32font (void) | |||
| 2737 | DEFSYM (Qbuginese, "buginese"); | 2826 | DEFSYM (Qbuginese, "buginese"); |
| 2738 | DEFSYM (Qbuhid, "buhid"); | 2827 | DEFSYM (Qbuhid, "buhid"); |
| 2739 | DEFSYM (Qcuneiform, "cuneiform"); | 2828 | DEFSYM (Qcuneiform, "cuneiform"); |
| 2829 | DEFSYM (Qcuneiform_numbers_and_punctuation, | ||
| 2830 | "cuneiform-numbers-and-punctuation"); | ||
| 2740 | DEFSYM (Qcypriot, "cypriot"); | 2831 | DEFSYM (Qcypriot, "cypriot"); |
| 2741 | DEFSYM (Qdeseret, "deseret"); | 2832 | DEFSYM (Qdeseret, "deseret"); |
| 2742 | DEFSYM (Qglagolitic, "glagolitic"); | 2833 | DEFSYM (Qglagolitic, "glagolitic"); |
| @@ -2745,6 +2836,7 @@ syms_of_w32font (void) | |||
| 2745 | DEFSYM (Qkharoshthi, "kharoshthi"); | 2836 | DEFSYM (Qkharoshthi, "kharoshthi"); |
| 2746 | DEFSYM (Qlimbu, "limbu"); | 2837 | DEFSYM (Qlimbu, "limbu"); |
| 2747 | DEFSYM (Qlinear_b, "linear_b"); | 2838 | DEFSYM (Qlinear_b, "linear_b"); |
| 2839 | DEFSYM (Qaegean_number, "aegean-number"); | ||
| 2748 | DEFSYM (Qold_italic, "old_italic"); | 2840 | DEFSYM (Qold_italic, "old_italic"); |
| 2749 | DEFSYM (Qold_persian, "old_persian"); | 2841 | DEFSYM (Qold_persian, "old_persian"); |
| 2750 | DEFSYM (Qosmanya, "osmanya"); | 2842 | DEFSYM (Qosmanya, "osmanya"); |
| @@ -2818,6 +2910,7 @@ versions of Windows) characters. */); | |||
| 2818 | DEFSYM (Qw32_charset_vietnamese, "w32-charset-vietnamese"); | 2910 | DEFSYM (Qw32_charset_vietnamese, "w32-charset-vietnamese"); |
| 2819 | DEFSYM (Qw32_charset_thai, "w32-charset-thai"); | 2911 | DEFSYM (Qw32_charset_thai, "w32-charset-thai"); |
| 2820 | DEFSYM (Qw32_charset_mac, "w32-charset-mac"); | 2912 | DEFSYM (Qw32_charset_mac, "w32-charset-mac"); |
| 2913 | DEFSYM (Qw32_non_USB_fonts, "w32-non-USB-fonts"); | ||
| 2821 | 2914 | ||
| 2822 | defsubr (&Sx_select_font); | 2915 | defsubr (&Sx_select_font); |
| 2823 | 2916 | ||