diff options
| author | Karoly Lorentey | 2006-05-20 10:32:11 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2006-05-20 10:32:11 +0000 |
| commit | aabd1a8b138a7f5907c3bb0bbd40932fa7b8e9fe (patch) | |
| tree | 7db1ed5481ec4ec6b43271d0ea57c032c22f60fc /src/xfaces.c | |
| parent | 9f97e26d01003a17b861505d535c89ad73799b7e (diff) | |
| parent | 689840b9224725a0beae741aaaa325d7edb2244c (diff) | |
| download | emacs-aabd1a8b138a7f5907c3bb0bbd40932fa7b8e9fe.tar.gz emacs-aabd1a8b138a7f5907c3bb0bbd40932fa7b8e9fe.zip | |
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-285
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-286
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-287
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-288
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-102
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-558
Diffstat (limited to 'src/xfaces.c')
| -rw-r--r-- | src/xfaces.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/src/xfaces.c b/src/xfaces.c index fc2c8a768bf..15556ca88f8 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -6400,6 +6400,12 @@ better_font_p (values, font1, font2, compare_pt_p, avgwidth) | |||
| 6400 | { | 6400 | { |
| 6401 | int i; | 6401 | int i; |
| 6402 | 6402 | ||
| 6403 | /* Any font is better than no font. */ | ||
| 6404 | if (! font1) | ||
| 6405 | return 0; | ||
| 6406 | if (! font2) | ||
| 6407 | return 1; | ||
| 6408 | |||
| 6403 | for (i = 0; i < DIM (font_sort_order); ++i) | 6409 | for (i = 0; i < DIM (font_sort_order); ++i) |
| 6404 | { | 6410 | { |
| 6405 | int xlfd_idx = font_sort_order[i]; | 6411 | int xlfd_idx = font_sort_order[i]; |
| @@ -6644,29 +6650,19 @@ best_matching_font (f, attrs, fonts, nfonts, width_ratio, needs_overstrike) | |||
| 6644 | if (needs_overstrike) | 6650 | if (needs_overstrike) |
| 6645 | *needs_overstrike = 0; | 6651 | *needs_overstrike = 0; |
| 6646 | 6652 | ||
| 6647 | /* Start with the first non-scalable font in the list. */ | 6653 | best = NULL; |
| 6648 | for (i = 0; i < nfonts; ++i) | ||
| 6649 | if (!font_scalable_p (fonts + i)) | ||
| 6650 | break; | ||
| 6651 | 6654 | ||
| 6652 | /* Find the best match among the non-scalable fonts. */ | 6655 | /* Find the best match among the non-scalable fonts. */ |
| 6653 | if (i < nfonts) | 6656 | for (i = 1; i < nfonts; ++i) |
| 6654 | { | 6657 | if (!font_scalable_p (fonts + i) |
| 6655 | best = fonts + i; | 6658 | && better_font_p (specified, fonts + i, best, 1, avgwidth)) |
| 6656 | 6659 | { | |
| 6657 | for (i = 1; i < nfonts; ++i) | 6660 | best = fonts + i; |
| 6658 | if (!font_scalable_p (fonts + i) | ||
| 6659 | && better_font_p (specified, fonts + i, best, 1, avgwidth)) | ||
| 6660 | { | ||
| 6661 | best = fonts + i; | ||
| 6662 | 6661 | ||
| 6663 | exact_p = exact_face_match_p (specified, best, avgwidth); | 6662 | exact_p = exact_face_match_p (specified, best, avgwidth); |
| 6664 | if (exact_p) | 6663 | if (exact_p) |
| 6665 | break; | 6664 | break; |
| 6666 | } | 6665 | } |
| 6667 | } | ||
| 6668 | else | ||
| 6669 | best = NULL; | ||
| 6670 | 6666 | ||
| 6671 | /* Unless we found an exact match among non-scalable fonts, see if | 6667 | /* Unless we found an exact match among non-scalable fonts, see if |
| 6672 | we can find a better match among scalable fonts. */ | 6668 | we can find a better match among scalable fonts. */ |
| @@ -6690,8 +6686,7 @@ best_matching_font (f, attrs, fonts, nfonts, width_ratio, needs_overstrike) | |||
| 6690 | for (i = 0; i < nfonts; ++i) | 6686 | for (i = 0; i < nfonts; ++i) |
| 6691 | if (font_scalable_p (fonts + i)) | 6687 | if (font_scalable_p (fonts + i)) |
| 6692 | { | 6688 | { |
| 6693 | if (best == NULL | 6689 | if (better_font_p (specified, fonts + i, best, 0, 0) |
| 6694 | || better_font_p (specified, fonts + i, best, 0, 0) | ||
| 6695 | || (!non_scalable_has_exact_height_p | 6690 | || (!non_scalable_has_exact_height_p |
| 6696 | && !better_font_p (specified, best, fonts + i, 0, 0))) | 6691 | && !better_font_p (specified, best, fonts + i, 0, 0))) |
| 6697 | { | 6692 | { |
| @@ -6719,6 +6714,10 @@ best_matching_font (f, attrs, fonts, nfonts, width_ratio, needs_overstrike) | |||
| 6719 | } | 6714 | } |
| 6720 | } | 6715 | } |
| 6721 | 6716 | ||
| 6717 | /* We should have found SOME font. */ | ||
| 6718 | if (best == NULL) | ||
| 6719 | abort (); | ||
| 6720 | |||
| 6722 | if (font_scalable_p (best)) | 6721 | if (font_scalable_p (best)) |
| 6723 | font_name = build_scalable_font_name (f, best, pt); | 6722 | font_name = build_scalable_font_name (f, best, pt); |
| 6724 | else | 6723 | else |