diff options
| author | Jason Rumney | 2008-11-23 15:08:52 +0000 |
|---|---|---|
| committer | Jason Rumney | 2008-11-23 15:08:52 +0000 |
| commit | b0857706e4bc6d09dc04f46766f6bde39a836f80 (patch) | |
| tree | 534c3b6c545ec50dee770ad423708598200e4ffd | |
| parent | a608bcbf777d126198b046c317af58cf4f373002 (diff) | |
| download | emacs-b0857706e4bc6d09dc04f46766f6bde39a836f80.tar.gz emacs-b0857706e4bc6d09dc04f46766f6bde39a836f80.zip | |
(check_face_name): New function.
(add_font_entity_to_list): Use it to filter out common substituted fonts.
| -rw-r--r-- | src/ChangeLog | 9 | ||||
| -rw-r--r-- | src/w32font.c | 46 |
2 files changed, 50 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 9d1be5d6ab5..21f54c61dfa 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2008-11-23 Jason Rumney <jasonr@gnu.org> | ||
| 2 | |||
| 3 | * w32uniscribe.c (uniscribe_encode_char): Ensure context is | ||
| 4 | restored before returning. | ||
| 5 | |||
| 6 | * w32font.c (check_face_name): New function. | ||
| 7 | (add_font_entity_to_list): Use it to filter out common substituted | ||
| 8 | fonts. | ||
| 9 | |||
| 1 | 2008-11-22 Martin Rudalics <rudalics@gmx.at> | 10 | 2008-11-22 Martin Rudalics <rudalics@gmx.at> |
| 2 | 11 | ||
| 3 | * buffer.c (Fswitch_to_buffer): Reword and mention new option | 12 | * buffer.c (Fswitch_to_buffer): Reword and mention new option |
diff --git a/src/w32font.c b/src/w32font.c index 74c74ee0750..94dad4367f6 100644 --- a/src/w32font.c +++ b/src/w32font.c | |||
| @@ -811,10 +811,8 @@ w32font_open_internal (f, font_entity, pixel_size, font_object) | |||
| 811 | } | 811 | } |
| 812 | 812 | ||
| 813 | if (!metrics) | 813 | if (!metrics) |
| 814 | { | 814 | GetTextMetricsW (dc, &w32_font->metrics); |
| 815 | GetTextMetricsW (dc, &w32_font->metrics); | 815 | |
| 816 | } | ||
| 817 | |||
| 818 | w32_font->cached_metrics = NULL; | 816 | w32_font->cached_metrics = NULL; |
| 819 | w32_font->n_cache_blocks = 0; | 817 | w32_font->n_cache_blocks = 0; |
| 820 | 818 | ||
| @@ -1300,6 +1298,40 @@ w32font_coverage_ok (coverage, charset) | |||
| 1300 | return 1; | 1298 | return 1; |
| 1301 | } | 1299 | } |
| 1302 | 1300 | ||
| 1301 | |||
| 1302 | static int | ||
| 1303 | check_face_name (font, full_name) | ||
| 1304 | LOGFONT *font; | ||
| 1305 | char *full_name; | ||
| 1306 | { | ||
| 1307 | char full_iname[LF_FULLFACESIZE+1]; | ||
| 1308 | |||
| 1309 | /* Just check for names known to cause problems, since the full name | ||
| 1310 | can contain expanded abbreviations, prefixed foundry, postfixed | ||
| 1311 | style, the latter of which sometimes differs from the style indicated | ||
| 1312 | in the shorter name (eg Lt becomes Light or even Extra Light) */ | ||
| 1313 | |||
| 1314 | /* Helvetica is mapped to Arial in Windows, but if a Type-1 Helvetica is | ||
| 1315 | installed, we run into problems with the Uniscribe backend which tries | ||
| 1316 | to avoid non-truetype fonts, and ends up mixing the Type-1 Helvetica | ||
| 1317 | with Arial's characteristics, since that attempt to use Truetype works | ||
| 1318 | some places, but not others. */ | ||
| 1319 | if (!stricmp (font->lfFaceName, "helvetica")) | ||
| 1320 | { | ||
| 1321 | strncpy (full_iname, full_name, LF_FULLFACESIZE); | ||
| 1322 | full_iname[LF_FULLFACESIZE] = 0; | ||
| 1323 | _strlwr (full_iname); | ||
| 1324 | return strstr ("helvetica", full_iname); | ||
| 1325 | } | ||
| 1326 | else if (!stricmp (font->lfFaceName, "times")) | ||
| 1327 | /* Since Times is mapped to Times New Roman, a substring | ||
| 1328 | match is not sufficient to filter out the bogus match. */ | ||
| 1329 | return stricmp (full_name, "times"); | ||
| 1330 | |||
| 1331 | return 1; | ||
| 1332 | } | ||
| 1333 | |||
| 1334 | |||
| 1303 | /* Callback function for EnumFontFamiliesEx. | 1335 | /* Callback function for EnumFontFamiliesEx. |
| 1304 | * Checks if a font matches everything we are trying to check agaist, | 1336 | * Checks if a font matches everything we are trying to check agaist, |
| 1305 | * and if so, adds it to a list. Both the data we are checking against | 1337 | * and if so, adds it to a list. Both the data we are checking against |
| @@ -1340,7 +1372,11 @@ add_font_entity_to_list (logical_font, physical_font, font_type, lParam) | |||
| 1340 | anywhere within the full name. */ | 1372 | anywhere within the full name. */ |
| 1341 | && (logical_font->elfLogFont.lfOutPrecision != OUT_STRING_PRECIS | 1373 | && (logical_font->elfLogFont.lfOutPrecision != OUT_STRING_PRECIS |
| 1342 | || strstr (logical_font->elfFullName, | 1374 | || strstr (logical_font->elfFullName, |
| 1343 | logical_font->elfLogFont.lfFaceName))) | 1375 | logical_font->elfLogFont.lfFaceName)) |
| 1376 | /* Check for well known substitutions that mess things up in the | ||
| 1377 | presence of Type-1 fonts of the same name. */ | ||
| 1378 | && (match_data->pattern.lfFaceName[0] | ||
| 1379 | && check_face_name (logical_font, logical_font->elfFullName))) | ||
| 1344 | { | 1380 | { |
| 1345 | Lisp_Object entity | 1381 | Lisp_Object entity |
| 1346 | = w32_enumfont_pattern_entity (match_data->frame, logical_font, | 1382 | = w32_enumfont_pattern_entity (match_data->frame, logical_font, |