aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Rumney2007-12-20 14:28:53 +0000
committerJason Rumney2007-12-20 14:28:53 +0000
commit4f2a2ee261936956712a4a1fa46bb60f488e4560 (patch)
treed8a8faa6383760d81a6c07ee83e664050f7eee96
parent6ce70459b15aa015aa5bc80adec72e8dd8d83c63 (diff)
downloademacs-4f2a2ee261936956712a4a1fa46bb60f488e4560.tar.gz
emacs-4f2a2ee261936956712a4a1fa46bb60f488e4560.zip
(logfonts_match): Don't check adstyle here.
(font_matches_spec): Check here against physical font instead. (add_font_entity_to_list): Avoid some substitutions.
-rw-r--r--src/w32font.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/w32font.c b/src/w32font.c
index 64ecaf28e73..d8ef31ad2cb 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -853,10 +853,6 @@ logfonts_match (font, pattern)
853 || font->lfWeight > (pattern->lfWeight + 150))) 853 || font->lfWeight > (pattern->lfWeight + 150)))
854 return 0; 854 return 0;
855 855
856 if (pattern->lfPitchAndFamily & 0xF0 != FF_DONTCARE
857 && pattern->lfPitchAndFamily & 0xF0 != font->lfPitchAndFamily & 0xF0)
858 return 0;
859
860 /* Charset and face should be OK. Italic has to be checked 856 /* Charset and face should be OK. Italic has to be checked
861 against the original spec, in case we don't have any preference. */ 857 against the original spec, in case we don't have any preference. */
862 return 1; 858 return 1;
@@ -881,6 +877,16 @@ font_matches_spec (type, font, spec)
881 return 0; 877 return 0;
882 } 878 }
883 879
880 /* Check adstyle against generic family. */
881 val = AREF (spec, FONT_ADSTYLE_INDEX);
882 if (!NILP (val))
883 {
884 BYTE family = w32_generic_family (val);
885 if (family != FF_DONTCARE
886 && family != (font->ntmTm.tmPitchAndFamily & 0xF0))
887 return 0;
888 }
889
884 /* Check extra parameters. */ 890 /* Check extra parameters. */
885 for (extra = AREF (spec, FONT_EXTRA_INDEX); 891 for (extra = AREF (spec, FONT_EXTRA_INDEX);
886 CONSP (extra); extra = XCDR (extra)) 892 CONSP (extra); extra = XCDR (extra))
@@ -1021,7 +1027,17 @@ add_font_entity_to_list (logical_font, physical_font, font_type, lParam)
1021 || (physical_font->ntmTm.ntmFlags & NTMFLAGS_OPENTYPE)) 1027 || (physical_font->ntmTm.ntmFlags & NTMFLAGS_OPENTYPE))
1022 && logfonts_match (&logical_font->elfLogFont, &match_data->pattern) 1028 && logfonts_match (&logical_font->elfLogFont, &match_data->pattern)
1023 && font_matches_spec (font_type, physical_font, 1029 && font_matches_spec (font_type, physical_font,
1024 match_data->orig_font_spec)) 1030 match_data->orig_font_spec)
1031 /* Avoid substitutions involving raster fonts (eg Helv -> MS Sans Serif)
1032 We limit this to raster fonts, because the test can catch some
1033 genuine fonts (eg the full name of DejaVu Sans Mono Light is actually
1034 DejaVu Sans Mono ExtraLight). Helvetica -> Arial substitution will
1035 therefore get through this test. Since full names can be prefixed
1036 by a foundry, we accept raster fonts if the font name is found
1037 anywhere within the full name. */
1038 && (logical_font->elfLogFont.lfOutPrecision != OUT_STRING_PRECIS
1039 || strstr (logical_font->elfFullName,
1040 logical_font->elfLogFont.lfFaceName)))
1025 { 1041 {
1026 Lisp_Object entity 1042 Lisp_Object entity
1027 = w32_enumfont_pattern_entity (match_data->frame, logical_font, 1043 = w32_enumfont_pattern_entity (match_data->frame, logical_font,