aboutsummaryrefslogtreecommitdiffstats
path: root/src/xfaces.c
diff options
context:
space:
mode:
authorMiles Bader2006-06-07 18:05:10 +0000
committerMiles Bader2006-06-07 18:05:10 +0000
commitb883cdb2fefa8ea9c3b0d82eba7a9ee792f871bb (patch)
treede3804210a8cd955e0d3b9abc15679480930bc82 /src/xfaces.c
parent885b7d0991bd4b4b8f4bd1d3cd21c18a697bbce2 (diff)
parent26c9afc3239e18b03537faaea33e3e82e28099e6 (diff)
downloademacs-b883cdb2fefa8ea9c3b0d82eba7a9ee792f871bb.tar.gz
emacs-b883cdb2fefa8ea9c3b0d82eba7a9ee792f871bb.zip
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 285-296) - Update from CVS - Merge from gnus--rel--5.10 - Update from CVS: admin/FOR-RELEASE: Update refcard section. * gnus--rel--5.10 (patch 102-104) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-64
Diffstat (limited to 'src/xfaces.c')
-rw-r--r--src/xfaces.c75
1 files changed, 37 insertions, 38 deletions
diff --git a/src/xfaces.c b/src/xfaces.c
index 2b2f1620133..9adc9218f6d 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -6762,6 +6762,12 @@ better_font_p (values, font1, font2, compare_pt_p, avgwidth)
6762{ 6762{
6763 int i; 6763 int i;
6764 6764
6765 /* Any font is better than no font. */
6766 if (! font1)
6767 return 0;
6768 if (! font2)
6769 return 1;
6770
6765 for (i = 0; i < DIM (font_sort_order); ++i) 6771 for (i = 0; i < DIM (font_sort_order); ++i)
6766 { 6772 {
6767 int xlfd_idx = font_sort_order[i]; 6773 int xlfd_idx = font_sort_order[i];
@@ -7012,29 +7018,19 @@ best_matching_font (f, attrs, fonts, nfonts, width_ratio, needs_overstrike)
7012 if (needs_overstrike) 7018 if (needs_overstrike)
7013 *needs_overstrike = 0; 7019 *needs_overstrike = 0;
7014 7020
7015 /* Start with the first non-scalable font in the list. */ 7021 best = NULL;
7016 for (i = 0; i < nfonts; ++i)
7017 if (!font_scalable_p (fonts + i))
7018 break;
7019 7022
7020 /* Find the best match among the non-scalable fonts. */ 7023 /* Find the best match among the non-scalable fonts. */
7021 if (i < nfonts) 7024 for (i = 0; i < nfonts; ++i)
7022 { 7025 if (!font_scalable_p (fonts + i)
7023 best = fonts + i; 7026 && better_font_p (specified, fonts + i, best, 1, avgwidth))
7024 7027 {
7025 for (i = 1; i < nfonts; ++i) 7028 best = fonts + i;
7026 if (!font_scalable_p (fonts + i)
7027 && better_font_p (specified, fonts + i, best, 1, avgwidth))
7028 {
7029 best = fonts + i;
7030 7029
7031 exact_p = exact_face_match_p (specified, best, avgwidth); 7030 exact_p = exact_face_match_p (specified, best, avgwidth);
7032 if (exact_p) 7031 if (exact_p)
7033 break; 7032 break;
7034 } 7033 }
7035 }
7036 else
7037 best = NULL;
7038 7034
7039 /* Unless we found an exact match among non-scalable fonts, see if 7035 /* Unless we found an exact match among non-scalable fonts, see if
7040 we can find a better match among scalable fonts. */ 7036 we can find a better match among scalable fonts. */
@@ -7058,8 +7054,7 @@ best_matching_font (f, attrs, fonts, nfonts, width_ratio, needs_overstrike)
7058 for (i = 0; i < nfonts; ++i) 7054 for (i = 0; i < nfonts; ++i)
7059 if (font_scalable_p (fonts + i)) 7055 if (font_scalable_p (fonts + i))
7060 { 7056 {
7061 if (best == NULL 7057 if (better_font_p (specified, fonts + i, best, 0, 0)
7062 || better_font_p (specified, fonts + i, best, 0, 0)
7063 || (!non_scalable_has_exact_height_p 7058 || (!non_scalable_has_exact_height_p
7064 && !better_font_p (specified, best, fonts + i, 0, 0))) 7059 && !better_font_p (specified, best, fonts + i, 0, 0)))
7065 { 7060 {
@@ -7067,23 +7062,27 @@ best_matching_font (f, attrs, fonts, nfonts, width_ratio, needs_overstrike)
7067 best = fonts + i; 7062 best = fonts + i;
7068 } 7063 }
7069 } 7064 }
7065 }
7070 7066
7071 if (needs_overstrike) 7067 /* We should have found SOME font. */
7072 { 7068 if (best == NULL)
7073 enum xlfd_weight want_weight = specified[XLFD_WEIGHT]; 7069 abort ();
7074 enum xlfd_weight got_weight = best->numeric[XLFD_WEIGHT];
7075 7070
7076 if (want_weight > XLFD_WEIGHT_MEDIUM && want_weight > got_weight) 7071 if (! exact_p && needs_overstrike)
7077 { 7072 {
7078 /* We want a bold font, but didn't get one; try to use 7073 enum xlfd_weight want_weight = specified[XLFD_WEIGHT];
7079 overstriking instead to simulate bold-face. However, 7074 enum xlfd_weight got_weight = best->numeric[XLFD_WEIGHT];
7080 don't overstrike an already-bold fontn unless the 7075
7081 desired weight grossly exceeds the available weight. */ 7076 if (want_weight > XLFD_WEIGHT_MEDIUM && want_weight > got_weight)
7082 if (got_weight > XLFD_WEIGHT_MEDIUM) 7077 {
7083 *needs_overstrike = (got_weight - want_weight) > 2; 7078 /* We want a bold font, but didn't get one; try to use
7084 else 7079 overstriking instead to simulate bold-face. However,
7085 *needs_overstrike = 1; 7080 don't overstrike an already-bold fontn unless the
7086 } 7081 desired weight grossly exceeds the available weight. */
7082 if (got_weight > XLFD_WEIGHT_MEDIUM)
7083 *needs_overstrike = (got_weight - want_weight) > 2;
7084 else
7085 *needs_overstrike = 1;
7087 } 7086 }
7088 } 7087 }
7089 7088
@@ -7488,7 +7487,7 @@ realize_default_face (f)
7488 face = realize_face (c, attrs, DEFAULT_FACE_ID); 7487 face = realize_face (c, attrs, DEFAULT_FACE_ID);
7489 7488
7490#ifdef HAVE_WINDOW_SYSTEM 7489#ifdef HAVE_WINDOW_SYSTEM
7491#ifdef HAVE_X_WINDOWS 7490#ifdef HAVE_X_WINDOWS
7492 if (face->font != FRAME_FONT (f)) 7491 if (face->font != FRAME_FONT (f))
7493 /* As the font specified for the frame was not acceptable as a 7492 /* As the font specified for the frame was not acceptable as a
7494 font for the default face (perhaps because auto-scaled fonts 7493 font for the default face (perhaps because auto-scaled fonts