diff options
| author | Kenichi Handa | 2009-06-24 04:24:18 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2009-06-24 04:24:18 +0000 |
| commit | f084f942444b667b3f0338b32b1966da0d3e67b7 (patch) | |
| tree | 8cb9bd339ed9aa3c44318a0d5e25fdb8ebbe566a /src | |
| parent | 0da746de61f2ec6ae31da3a4f21bb6c2b8c326f9 (diff) | |
| download | emacs-f084f942444b667b3f0338b32b1966da0d3e67b7.tar.gz emacs-f084f942444b667b3f0338b32b1966da0d3e67b7.zip | |
(fontset_get_font_group): Return 0 if no font-group is
set for C.
(fontset_font): Record the availability of a font for C both in
the realized fontset of the current one and the default one.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/fontset.c | 55 |
2 files changed, 40 insertions, 22 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index ea12313667f..fa2a8ef91d5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2009-06-24 Kenichi Handa <handa@m17n.org> | ||
| 2 | |||
| 3 | * fontset.c (fontset_get_font_group): Return 0 if no font-group is | ||
| 4 | set for C. | ||
| 5 | (fontset_font): Record the availability of a font for C both in | ||
| 6 | the realized fontsets of the current one and the default one. | ||
| 7 | |||
| 1 | 2009-06-23 Dan Nicolaescu <dann@ics.uci.edu> | 8 | 2009-06-23 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 9 | ||
| 3 | * sysdep.c (child_setup_tty): Remove SIGNALS_VIA_CHARACTERS | 10 | * sysdep.c (child_setup_tty): Remove SIGNALS_VIA_CHARACTERS |
diff --git a/src/fontset.c b/src/fontset.c index 08a011306c5..f144cb1dd96 100644 --- a/src/fontset.c +++ b/src/fontset.c | |||
| @@ -459,6 +459,12 @@ reorder_font_vector (font_group, font) | |||
| 459 | XSETCAR (font_group, make_number (charset_ordered_list_tick)); | 459 | XSETCAR (font_group, make_number (charset_ordered_list_tick)); |
| 460 | } | 460 | } |
| 461 | 461 | ||
| 462 | /* Return a font-group (actually a cons (-1 . FONT-GROUP-VECTOR)) for | ||
| 463 | character C in FONTSET. If C is -1, return a fallback font-group. | ||
| 464 | If C is not -1, the value may be Qt (FONTSET doesn't have a font | ||
| 465 | for C even in the fallback group, or 0 (a font for C may be found | ||
| 466 | only in the fallback group). */ | ||
| 467 | |||
| 462 | static Lisp_Object | 468 | static Lisp_Object |
| 463 | fontset_get_font_group (Lisp_Object fontset, int c) | 469 | fontset_get_font_group (Lisp_Object fontset, int c) |
| 464 | { | 470 | { |
| @@ -480,9 +486,10 @@ fontset_get_font_group (Lisp_Object fontset, int c) | |||
| 480 | font_group = FONTSET_FALLBACK (base_fontset); | 486 | font_group = FONTSET_FALLBACK (base_fontset); |
| 481 | if (NILP (font_group)) | 487 | if (NILP (font_group)) |
| 482 | { | 488 | { |
| 489 | font_group = make_number (0); | ||
| 483 | if (c >= 0) | 490 | if (c >= 0) |
| 484 | char_table_set_range (fontset, from, to, make_number (0)); | 491 | char_table_set_range (fontset, from, to, font_group); |
| 485 | return Qnil; | 492 | return font_group; |
| 486 | } | 493 | } |
| 487 | font_group = Fcopy_sequence (font_group); | 494 | font_group = Fcopy_sequence (font_group); |
| 488 | for (i = 0; i < ASIZE (font_group); i++) | 495 | for (i = 0; i < ASIZE (font_group); i++) |
| @@ -683,7 +690,7 @@ fontset_font (fontset, c, face, id) | |||
| 683 | struct face *face; | 690 | struct face *face; |
| 684 | int id; | 691 | int id; |
| 685 | { | 692 | { |
| 686 | Lisp_Object rfont_def; | 693 | Lisp_Object rfont_def, default_rfont_def; |
| 687 | Lisp_Object base_fontset; | 694 | Lisp_Object base_fontset; |
| 688 | 695 | ||
| 689 | /* Try a font-group of FONTSET. */ | 696 | /* Try a font-group of FONTSET. */ |
| @@ -691,8 +698,8 @@ fontset_font (fontset, c, face, id) | |||
| 691 | rfont_def = fontset_find_font (fontset, c, face, id, 0); | 698 | rfont_def = fontset_find_font (fontset, c, face, id, 0); |
| 692 | if (VECTORP (rfont_def)) | 699 | if (VECTORP (rfont_def)) |
| 693 | return rfont_def; | 700 | return rfont_def; |
| 694 | if (EQ (rfont_def, Qt)) | 701 | if (NILP (rfont_def)) |
| 695 | goto no_font; | 702 | FONTSET_SET (fontset, make_number (c), make_number (0)); |
| 696 | 703 | ||
| 697 | /* Try a font-group of the default fontset. */ | 704 | /* Try a font-group of the default fontset. */ |
| 698 | base_fontset = FONTSET_BASE (fontset); | 705 | base_fontset = FONTSET_BASE (fontset); |
| @@ -702,34 +709,38 @@ fontset_font (fontset, c, face, id) | |||
| 702 | FONTSET_DEFAULT (fontset) | 709 | FONTSET_DEFAULT (fontset) |
| 703 | = make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset); | 710 | = make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset); |
| 704 | FONT_DEFERRED_LOG ("default fontset: font for", make_number (c), Qnil); | 711 | FONT_DEFERRED_LOG ("default fontset: font for", make_number (c), Qnil); |
| 705 | rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 0); | 712 | default_rfont_def |
| 706 | if (VECTORP (rfont_def)) | 713 | = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 0); |
| 707 | return rfont_def; | 714 | if (VECTORP (default_rfont_def)) |
| 708 | if (EQ (rfont_def, Qt)) | 715 | return default_rfont_def; |
| 709 | goto no_font; | 716 | if (NILP (default_rfont_def)) |
| 717 | FONTSET_SET (FONTSET_DEFAULT (fontset), make_number (c), | ||
| 718 | make_number (0)); | ||
| 710 | } | 719 | } |
| 711 | 720 | ||
| 712 | /* Try a fallback font-group of FONTSET. */ | 721 | /* Try a fallback font-group of FONTSET. */ |
| 713 | FONT_DEFERRED_LOG ("current fallback: font for", make_number (c), Qnil); | 722 | if (! EQ (rfont_def, Qt)) |
| 714 | rfont_def = fontset_find_font (fontset, c, face, id, 1); | 723 | { |
| 715 | if (VECTORP (rfont_def)) | 724 | FONT_DEFERRED_LOG ("current fallback: font for", make_number (c), Qnil); |
| 716 | return rfont_def; | 725 | rfont_def = fontset_find_font (fontset, c, face, id, 1); |
| 717 | if (EQ (rfont_def, Qt)) | 726 | if (VECTORP (rfont_def)) |
| 718 | goto no_font; | 727 | return rfont_def; |
| 728 | /* Remember that FONTSET has no font for C. */ | ||
| 729 | FONTSET_SET (fontset, make_number (c), Qt); | ||
| 730 | } | ||
| 719 | 731 | ||
| 720 | /* Try a fallback font-group of the default fontset . */ | 732 | /* Try a fallback font-group of the default fontset. */ |
| 721 | if (! EQ (base_fontset, Vdefault_fontset)) | 733 | if (! EQ (base_fontset, Vdefault_fontset) |
| 734 | && ! EQ (default_rfont_def, Qt)) | ||
| 722 | { | 735 | { |
| 723 | FONT_DEFERRED_LOG ("default fallback: font for", make_number (c), Qnil); | 736 | FONT_DEFERRED_LOG ("default fallback: font for", make_number (c), Qnil); |
| 724 | rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 1); | 737 | rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 1); |
| 725 | if (VECTORP (rfont_def)) | 738 | if (VECTORP (rfont_def)) |
| 726 | return rfont_def; | 739 | return rfont_def; |
| 740 | /* Remember that the default fontset has no font for C. */ | ||
| 741 | FONTSET_SET (FONTSET_DEFAULT (fontset), make_number (c), Qt); | ||
| 727 | } | 742 | } |
| 728 | 743 | ||
| 729 | no_font: | ||
| 730 | /* Remember that we have no font for C. */ | ||
| 731 | FONTSET_SET (fontset, make_number (c), Qt); | ||
| 732 | |||
| 733 | return Qnil; | 744 | return Qnil; |
| 734 | } | 745 | } |
| 735 | 746 | ||