diff options
| author | Kenichi Handa | 2004-04-13 11:04:28 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2004-04-13 11:04:28 +0000 |
| commit | 7e1a1cd9e5576602795ce4058698c65871816271 (patch) | |
| tree | c5b304352fe2382f0af37f0e08fbd373b126724e /src | |
| parent | 801396d922d408a9e1ec2b9e7926d0b631ae9cac (diff) | |
| download | emacs-7e1a1cd9e5576602795ce4058698c65871816271.tar.gz emacs-7e1a1cd9e5576602795ce4058698c65871816271.zip | |
(fontset_font): Renamed from fontset_face. Return
value changed.
(face_suitable_for_char_p): Adjusted for the change of
fontset_font.
(face_for_char): Likewise.
(make_fontset_for_ascii_face): Fix setting of the fontset element
for ASCII.
(Finternal_char_font): Use fontset_font instead of FACE_FOR_CHAR
to get a font name.
(Ffontset_info): Adjusted for the change of fontset_font.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fontset.c | 174 |
1 files changed, 101 insertions, 73 deletions
diff --git a/src/fontset.c b/src/fontset.c index cab0124e279..368ad5a9db8 100644 --- a/src/fontset.c +++ b/src/fontset.c | |||
| @@ -85,6 +85,8 @@ EXFUN (Fclear_face_cache, 1); | |||
| 85 | where FAMILY, WEIGHT, SLANT, SWIDTH, ADSTYLE, REGISTRY, and | 85 | where FAMILY, WEIGHT, SLANT, SWIDTH, ADSTYLE, REGISTRY, and |
| 86 | FONT-NAME are strings. | 86 | FONT-NAME are strings. |
| 87 | 87 | ||
| 88 | Note: Currently WEIGHT through ADSTYLE are ignored. | ||
| 89 | |||
| 88 | ENCODING is a charset ID that can convert characters to glyph codes | 90 | ENCODING is a charset ID that can convert characters to glyph codes |
| 89 | of the corresponding font. | 91 | of the corresponding font. |
| 90 | 92 | ||
| @@ -96,23 +98,23 @@ EXFUN (Fclear_face_cache, 1); | |||
| 96 | 98 | ||
| 97 | ENCODING and REPERTORY are extracted from the variable | 99 | ENCODING and REPERTORY are extracted from the variable |
| 98 | Vfont_encoding_alist by using a font name generated from FONT-SPEC | 100 | Vfont_encoding_alist by using a font name generated from FONT-SPEC |
| 99 | (if it is a vector) or FONT-NAME as a key. | 101 | (if it is a vector) or FONT-NAME as a matching target. |
| 100 | 102 | ||
| 101 | 103 | ||
| 102 | An element of a realized fontset is nil or t, or has this form: | 104 | An element of a realized fontset is nil or t, or has this form: |
| 103 | 105 | ||
| 104 | [CHARSET-PRIORITY-LIST-TICK PREFERRED-CHARSET-ID PREFERRED-FONT-DEF | 106 | [CHARSET-ORDERED-LIST-TICK PREFERRED-CHARSET-ID |
| 105 | FONT-DEF0 FONT-DEF1 ...]. | 107 | PREFERRED-RFONT-DEF RFONT-DEF0 RFONT-DEF1 ...]. |
| 106 | 108 | ||
| 107 | FONT-DEFn has this form: | 109 | RFONT-DEFn (i.e. Realized FONT-DEF) has this form: |
| 108 | 110 | ||
| 109 | [ FACE-ID FONT-INDEX FONT-DEF ] | 111 | [ FACE-ID FONT-INDEX FONT-DEF OPENED-FONT-NAME ] |
| 110 | 112 | ||
| 111 | FONT-DEFn is automatically reordered by the current charset | 113 | RFONT-DEFn is automatically reordered by the current charset |
| 112 | priority list. | 114 | priority list. |
| 113 | 115 | ||
| 114 | The value nil means that we have not yet generated FONT-VECTOR from | 116 | The value nil means that we have not yet generated the above vector |
| 115 | the base of the fontset. | 117 | from the base of the fontset. |
| 116 | 118 | ||
| 117 | The value t means that no font is available for the corresponding | 119 | The value t means that no font is available for the corresponding |
| 118 | range of characters. | 120 | range of characters. |
| @@ -245,6 +247,7 @@ void (*check_window_system_func) P_ ((void)); | |||
| 245 | /* Prototype declarations for static functions. */ | 247 | /* Prototype declarations for static functions. */ |
| 246 | static Lisp_Object fontset_add P_ ((Lisp_Object, Lisp_Object, Lisp_Object, | 248 | static Lisp_Object fontset_add P_ ((Lisp_Object, Lisp_Object, Lisp_Object, |
| 247 | Lisp_Object)); | 249 | Lisp_Object)); |
| 250 | static Lisp_Object fontset_font P_ ((Lisp_Object, int, struct face *, int)); | ||
| 248 | static Lisp_Object make_fontset P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); | 251 | static Lisp_Object make_fontset P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); |
| 249 | static Lisp_Object fontset_pattern_regexp P_ ((Lisp_Object)); | 252 | static Lisp_Object fontset_pattern_regexp P_ ((Lisp_Object)); |
| 250 | static void accumulate_script_ranges P_ ((Lisp_Object, Lisp_Object, | 253 | static void accumulate_script_ranges P_ ((Lisp_Object, Lisp_Object, |
| @@ -413,10 +416,10 @@ fontset_add (fontset, range, elt, add) | |||
| 413 | 416 | ||
| 414 | 417 | ||
| 415 | /* Update FONTSET_ELEMENT which has this form: | 418 | /* Update FONTSET_ELEMENT which has this form: |
| 416 | [CHARSET-PRIORITY-LIST-TICK PREFERRED-CHARSET-ID INDEX | 419 | [CHARSET-ORDERED-LIST-TICK PREFERRED-CHARSET-ID PREFERRED-RFONT-DEF |
| 417 | FONT-DEF0 FONT-DEF1 ...]. | 420 | RFONT-DEF0 RFONT-DEF1 ...]. |
| 418 | Reorder FONT-DEFs according to the current order of charset | 421 | Reorder RFONT-DEFs according to the current order of charset |
| 419 | (Vcharset_ordered_list), and update CHARSET-PRIORITY-LIST-TICK to | 422 | (Vcharset_ordered_list), and update CHARSET-ORDERED-LIST-TICK to |
| 420 | the latest value. */ | 423 | the latest value. */ |
| 421 | 424 | ||
| 422 | static void | 425 | static void |
| @@ -432,7 +435,7 @@ reorder_font_vector (fontset_element) | |||
| 432 | ASET (fontset_element, 0, make_number (charset_ordered_list_tick)); | 435 | ASET (fontset_element, 0, make_number (charset_ordered_list_tick)); |
| 433 | size = ASIZE (fontset_element) - 3; | 436 | size = ASIZE (fontset_element) - 3; |
| 434 | if (size <= 1) | 437 | if (size <= 1) |
| 435 | /* No need of reordering VEC. */ | 438 | /* No need to reorder VEC. */ |
| 436 | return; | 439 | return; |
| 437 | charset_id_table = (int *) alloca (sizeof (int) * size); | 440 | charset_id_table = (int *) alloca (sizeof (int) * size); |
| 438 | new_vec = (Lisp_Object *) alloca (sizeof (Lisp_Object) * size); | 441 | new_vec = (Lisp_Object *) alloca (sizeof (Lisp_Object) * size); |
| @@ -505,12 +508,13 @@ load_font_get_repertory (f, face, font_def, fontset) | |||
| 505 | } | 508 | } |
| 506 | 509 | ||
| 507 | 510 | ||
| 508 | /* Return a face ID registerd in the realized fontset FONTSET for the | 511 | /* Return RFONT-DEF (vector) in the realized fontset FONTSET for the |
| 509 | character C. If a face is not yet set, return -1 (if FACE is NULL) | 512 | character C. If the corresponding font is not yet opened, open it |
| 510 | or realize a proper face from FACE and return it. */ | 513 | (if FACE is not NULL) or return Qnil (if FACE is NULL). |
| 514 | If no proper font is found for C, return Qnil. */ | ||
| 511 | 515 | ||
| 512 | static int | 516 | static Lisp_Object |
| 513 | fontset_face (fontset, c, face, id) | 517 | fontset_font (fontset, c, face, id) |
| 514 | Lisp_Object fontset; | 518 | Lisp_Object fontset; |
| 515 | int c; | 519 | int c; |
| 516 | struct face *face; | 520 | struct face *face; |
| @@ -532,7 +536,7 @@ fontset_face (fontset, c, face, id) | |||
| 532 | Lisp_Object range; | 536 | Lisp_Object range; |
| 533 | 537 | ||
| 534 | if (! face) | 538 | if (! face) |
| 535 | return -1; | 539 | return Qnil; |
| 536 | elt = FONTSET_REF_AND_RANGE (base_fontset, c, from, to); | 540 | elt = FONTSET_REF_AND_RANGE (base_fontset, c, from, to); |
| 537 | range = Fcons (make_number (from), make_number (to)); | 541 | range = Fcons (make_number (from), make_number (to)); |
| 538 | if (NILP (elt)) | 542 | if (NILP (elt)) |
| @@ -545,14 +549,14 @@ fontset_face (fontset, c, face, id) | |||
| 545 | } | 549 | } |
| 546 | /* Build a vector [ -1 -1 nil NEW-ELT0 NEW-ELT1 NEW-ELT2 ... ], | 550 | /* Build a vector [ -1 -1 nil NEW-ELT0 NEW-ELT1 NEW-ELT2 ... ], |
| 547 | where the first -1 is to force reordering of NEW-ELTn, | 551 | where the first -1 is to force reordering of NEW-ELTn, |
| 548 | NEW-ETLn is [nil nil AREF (elt, n)]. */ | 552 | NEW-ETLn is [nil nil AREF (elt, n) nil]. */ |
| 549 | vec = Fmake_vector (make_number (ASIZE (elt) + 3), make_number (-1)); | 553 | vec = Fmake_vector (make_number (ASIZE (elt) + 3), make_number (-1)); |
| 550 | ASET (vec, 2, Qnil); | 554 | ASET (vec, 2, Qnil); |
| 551 | for (i = 0; i < ASIZE (elt); i++) | 555 | for (i = 0; i < ASIZE (elt); i++) |
| 552 | { | 556 | { |
| 553 | Lisp_Object tmp; | 557 | Lisp_Object tmp; |
| 554 | 558 | ||
| 555 | tmp = Fmake_vector (make_number (3), Qnil); | 559 | tmp = Fmake_vector (make_number (4), Qnil); |
| 556 | ASET (tmp, 2, AREF (elt, i)); | 560 | ASET (tmp, 2, AREF (elt, i)); |
| 557 | ASET (vec, 3 + i, tmp); | 561 | ASET (vec, 3 + i, tmp); |
| 558 | } | 562 | } |
| @@ -588,7 +592,7 @@ fontset_face (fontset, c, face, id) | |||
| 588 | } | 592 | } |
| 589 | } | 593 | } |
| 590 | 594 | ||
| 591 | /* Find the first available font in the font vector VEC. */ | 595 | /* Find the first available font in the vector of RFONT-DEF. */ |
| 592 | for (; i < ASIZE (vec); i++) | 596 | for (; i < ASIZE (vec); i++) |
| 593 | { | 597 | { |
| 594 | Lisp_Object font_def; | 598 | Lisp_Object font_def; |
| @@ -596,17 +600,17 @@ fontset_face (fontset, c, face, id) | |||
| 596 | elt = AREF (vec, i); | 600 | elt = AREF (vec, i); |
| 597 | if (NILP (elt)) | 601 | if (NILP (elt)) |
| 598 | continue; | 602 | continue; |
| 599 | /* ELT == [ FACE-ID FONT-INDEX [ FONT-SPEC ENCODING REPERTORY ] ] */ | 603 | /* ELT == [ FACE-ID FONT-INDEX FONT-DEF OPENED-FONT-NAME ] */ |
| 600 | font_def = AREF (elt, 2); | ||
| 601 | if (INTEGERP (AREF (elt, 1)) && XINT (AREF (elt, 1)) < 0) | 604 | if (INTEGERP (AREF (elt, 1)) && XINT (AREF (elt, 1)) < 0) |
| 602 | /* We couldn't open this font last time. */ | 605 | /* We couldn't open this font last time. */ |
| 603 | continue; | 606 | continue; |
| 604 | 607 | ||
| 605 | if (!face && (NILP (AREF (elt, 1)) || NILP (AREF (elt, 0)))) | 608 | if (!face && NILP (AREF (elt, 1))) |
| 606 | /* We have not yet opened the font, or we have not yet made a | 609 | /* We have not yet opened the font. */ |
| 607 | realized face for the font. */ | 610 | return Qnil; |
| 608 | return -1; | ||
| 609 | 611 | ||
| 612 | font_def = AREF (elt, 2); | ||
| 613 | /* FONT_DEF == [ FONT-SPEC ENCODING REPERTORY ] */ | ||
| 610 | if (INTEGERP (AREF (font_def, 2))) | 614 | if (INTEGERP (AREF (font_def, 2))) |
| 611 | { | 615 | { |
| 612 | /* The repertory is specified by charset ID. */ | 616 | /* The repertory is specified by charset ID. */ |
| @@ -633,45 +637,42 @@ fontset_face (fontset, c, face, id) | |||
| 633 | /* We have not yet opened a font matching this spec. | 637 | /* We have not yet opened a font matching this spec. |
| 634 | Open the best matching font now and register the | 638 | Open the best matching font now and register the |
| 635 | repertory. */ | 639 | repertory. */ |
| 640 | struct font_info *font_info; | ||
| 641 | |||
| 636 | font_idx = load_font_get_repertory (f, face, font_def, fontset); | 642 | font_idx = load_font_get_repertory (f, face, font_def, fontset); |
| 637 | ASET (elt, 1, make_number (font_idx)); | 643 | ASET (elt, 1, make_number (font_idx)); |
| 638 | if (font_idx < 0) | 644 | if (font_idx < 0) |
| 639 | /* This means that we couldn't find a font matching | 645 | /* This means that we couldn't find a font matching |
| 640 | FONT_DEF. */ | 646 | FONT_DEF. */ |
| 641 | continue; | 647 | continue; |
| 648 | font_info = (*get_font_info_func) (f, font_idx); | ||
| 649 | ASET (elt, 3, build_string (font_info->full_name)); | ||
| 642 | } | 650 | } |
| 643 | 651 | ||
| 644 | slot = Fassq (AREF (elt, 1), FONTSET_REPERTORY (fontset)); | 652 | slot = Fassq (AREF (elt, 1), FONTSET_REPERTORY (fontset)); |
| 645 | if (! CONSP (slot)) | 653 | xassert (CONSP (slot)); |
| 646 | abort (); | ||
| 647 | if (NILP (CHAR_TABLE_REF (XCDR (slot), c))) | 654 | if (NILP (CHAR_TABLE_REF (XCDR (slot), c))) |
| 648 | /* This fond can't display C. */ | 655 | /* This font can't display C. */ |
| 649 | continue; | 656 | continue; |
| 650 | } | 657 | } |
| 651 | 658 | ||
| 652 | /* Now we have decided to use this font spec to display C. */ | 659 | /* Now we have decided to use this font spec to display C. */ |
| 653 | if (INTEGERP (AREF (elt, 1))) | 660 | if (! INTEGERP (AREF (elt, 1))) |
| 654 | font_idx = XINT (AREF (elt, 1)); | ||
| 655 | else | ||
| 656 | { | 661 | { |
| 657 | /* But not yet opened the best matching font. */ | 662 | /* But not yet opened the best matching font. */ |
| 663 | struct font_info *font_info; | ||
| 664 | |||
| 658 | font_idx = load_font_get_repertory (f, face, font_def, fontset); | 665 | font_idx = load_font_get_repertory (f, face, font_def, fontset); |
| 659 | ASET (elt, 1, make_number (font_idx)); | 666 | ASET (elt, 1, make_number (font_idx)); |
| 660 | if (font_idx < 0) | 667 | if (font_idx < 0) |
| 668 | /* Can't open it. Try the other one. */ | ||
| 661 | continue; | 669 | continue; |
| 670 | font_info = (*get_font_info_func) (f, font_idx); | ||
| 671 | ASET (elt, 3, build_string (font_info->full_name)); | ||
| 662 | } | 672 | } |
| 663 | 673 | ||
| 664 | /* Now we have the opened font. */ | 674 | /* Now we have the opened font. */ |
| 665 | if (NILP (AREF (elt, 0))) | 675 | return elt; |
| 666 | { | ||
| 667 | /* But not yet made a realized face that uses this font. */ | ||
| 668 | int face_id = lookup_non_ascii_face (f, font_idx, face); | ||
| 669 | |||
| 670 | ASET (elt, 0, make_number (face_id)); | ||
| 671 | } | ||
| 672 | |||
| 673 | /* Ok, this face can display C. */ | ||
| 674 | return XINT (AREF (elt, 0)); | ||
| 675 | } | 676 | } |
| 676 | 677 | ||
| 677 | try_fallback: | 678 | try_fallback: |
| @@ -691,7 +692,7 @@ fontset_face (fontset, c, face, id) | |||
| 691 | { | 692 | { |
| 692 | Lisp_Object tmp; | 693 | Lisp_Object tmp; |
| 693 | 694 | ||
| 694 | tmp = Fmake_vector (make_number (3), Qnil); | 695 | tmp = Fmake_vector (make_number (4), Qnil); |
| 695 | ASET (tmp, 2, AREF (elt, i)); | 696 | ASET (tmp, 2, AREF (elt, i)); |
| 696 | ASET (vec, 3 + i, tmp); | 697 | ASET (vec, 3 + i, tmp); |
| 697 | } | 698 | } |
| @@ -709,21 +710,9 @@ fontset_face (fontset, c, face, id) | |||
| 709 | if (NILP (FONTSET_DEFAULT (fontset))) | 710 | if (NILP (FONTSET_DEFAULT (fontset))) |
| 710 | FONTSET_DEFAULT (fontset) | 711 | FONTSET_DEFAULT (fontset) |
| 711 | = make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset); | 712 | = make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset); |
| 712 | return fontset_face (FONTSET_DEFAULT (fontset), c, face, id); | 713 | return fontset_font (FONTSET_DEFAULT (fontset), c, face, id); |
| 713 | } | ||
| 714 | |||
| 715 | /* We have tried all the fonts for C, but none of them can be opened | ||
| 716 | nor can display C. */ | ||
| 717 | if (NILP (FONTSET_NOFONT_FACE (fontset))) | ||
| 718 | { | ||
| 719 | int face_id; | ||
| 720 | |||
| 721 | if (! face) | ||
| 722 | return -1; | ||
| 723 | face_id = lookup_non_ascii_face (f, -1, face); | ||
| 724 | FONTSET_NOFONT_FACE (fontset) = make_number (face_id); | ||
| 725 | } | 714 | } |
| 726 | return XINT (FONTSET_NOFONT_FACE (fontset)); | 715 | return Qnil; |
| 727 | } | 716 | } |
| 728 | 717 | ||
| 729 | 718 | ||
| @@ -849,10 +838,13 @@ face_suitable_for_char_p (face, c) | |||
| 849 | struct face *face; | 838 | struct face *face; |
| 850 | int c; | 839 | int c; |
| 851 | { | 840 | { |
| 852 | Lisp_Object fontset; | 841 | Lisp_Object fontset, rfont_def; |
| 853 | 842 | ||
| 854 | fontset = FONTSET_FROM_ID (face->fontset); | 843 | fontset = FONTSET_FROM_ID (face->fontset); |
| 855 | return (face->id == fontset_face (fontset, c, NULL, -1)); | 844 | rfont_def = fontset_font (fontset, c, NULL, -1); |
| 845 | return (VECTORP (rfont_def) | ||
| 846 | && INTEGERP (AREF (rfont_def, 0)) | ||
| 847 | && face->id == XINT (AREF (rfont_def, 0))); | ||
| 856 | } | 848 | } |
| 857 | 849 | ||
| 858 | 850 | ||
| @@ -867,7 +859,8 @@ face_for_char (f, face, c, pos, object) | |||
| 867 | int c, pos; | 859 | int c, pos; |
| 868 | Lisp_Object object; | 860 | Lisp_Object object; |
| 869 | { | 861 | { |
| 870 | Lisp_Object fontset, charset; | 862 | Lisp_Object fontset, charset, rfont_def; |
| 863 | int face_id; | ||
| 871 | int id; | 864 | int id; |
| 872 | 865 | ||
| 873 | if (ASCII_CHAR_P (c)) | 866 | if (ASCII_CHAR_P (c)) |
| @@ -886,7 +879,26 @@ face_for_char (f, face, c, pos, object) | |||
| 886 | else if (CHARSETP (charset)) | 879 | else if (CHARSETP (charset)) |
| 887 | id = XINT (CHARSET_SYMBOL_ID (charset)); | 880 | id = XINT (CHARSET_SYMBOL_ID (charset)); |
| 888 | } | 881 | } |
| 889 | return fontset_face (fontset, c, face, id); | 882 | rfont_def = fontset_font (fontset, c, face, id); |
| 883 | if (VECTORP (rfont_def)) | ||
| 884 | { | ||
| 885 | if (NILP (AREF (rfont_def, 0))) | ||
| 886 | { | ||
| 887 | /* We have not yet made a realized face that uses this font. */ | ||
| 888 | int font_idx = XINT (AREF (rfont_def, 1)); | ||
| 889 | |||
| 890 | face_id = lookup_non_ascii_face (f, font_idx, face); | ||
| 891 | ASET (rfont_def, 0, make_number (face_id)); | ||
| 892 | } | ||
| 893 | return XINT (AREF (rfont_def, 0)); | ||
| 894 | } | ||
| 895 | |||
| 896 | if (NILP (FONTSET_NOFONT_FACE (fontset))) | ||
| 897 | { | ||
| 898 | face_id = lookup_non_ascii_face (f, -1, face); | ||
| 899 | FONTSET_NOFONT_FACE (fontset) = make_number (face_id); | ||
| 900 | } | ||
| 901 | return XINT (FONTSET_NOFONT_FACE (fontset)); | ||
| 890 | } | 902 | } |
| 891 | 903 | ||
| 892 | 904 | ||
| @@ -918,13 +930,20 @@ make_fontset_for_ascii_face (f, base_fontset_id, face) | |||
| 918 | 930 | ||
| 919 | fontset = make_fontset (frame, Qnil, base_fontset); | 931 | fontset = make_fontset (frame, Qnil, base_fontset); |
| 920 | { | 932 | { |
| 921 | Lisp_Object elt; | 933 | Lisp_Object elt, rfont_def; |
| 922 | 934 | ||
| 923 | elt = FONTSET_REF (base_fontset, 0); | 935 | elt = FONTSET_REF (base_fontset, 0); |
| 924 | elt = Fmake_vector (make_number (4), AREF (elt, 0)); | 936 | xassert (VECTORP (elt) && ASIZE (elt) > 0); |
| 937 | rfont_def = Fmake_vector (make_number (4), Qnil); | ||
| 938 | ASET (rfont_def, 0, make_number (face->id)); | ||
| 939 | ASET (rfont_def, 1, make_number (face->font_info_id)); | ||
| 940 | ASET (rfont_def, 2, AREF (elt, 0)); | ||
| 941 | ASET (rfont_def, 3, build_string (face->font_name)); | ||
| 942 | elt = Fmake_vector (make_number (4), Qnil); | ||
| 925 | ASET (elt, 0, make_number (charset_ordered_list_tick)); | 943 | ASET (elt, 0, make_number (charset_ordered_list_tick)); |
| 926 | ASET (elt, 1, make_number (face->id)); | 944 | ASET (elt, 1, make_number (charset_ascii)); |
| 927 | ASET (elt, 2, make_number (face->font_info_id)); | 945 | ASET (elt, 2, rfont_def); |
| 946 | ASET (elt, 3, rfont_def); | ||
| 928 | char_table_set_range (fontset, 0, 127, elt); | 947 | char_table_set_range (fontset, 0, 127, elt); |
| 929 | } | 948 | } |
| 930 | return XINT (FONTSET_ID (fontset)); | 949 | return XINT (FONTSET_ID (fontset)); |
| @@ -1676,6 +1695,8 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 1, 0, | |||
| 1676 | struct window *w; | 1695 | struct window *w; |
| 1677 | struct frame *f; | 1696 | struct frame *f; |
| 1678 | struct face *face; | 1697 | struct face *face; |
| 1698 | Lisp_Object charset, rfont_def; | ||
| 1699 | int charset_id; | ||
| 1679 | 1700 | ||
| 1680 | CHECK_NUMBER_COERCE_MARKER (position); | 1701 | CHECK_NUMBER_COERCE_MARKER (position); |
| 1681 | pos = XINT (position); | 1702 | pos = XINT (position); |
| @@ -1689,10 +1710,16 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 1, 0, | |||
| 1689 | w = XWINDOW (window); | 1710 | w = XWINDOW (window); |
| 1690 | f = XFRAME (w->frame); | 1711 | f = XFRAME (w->frame); |
| 1691 | face_id = face_at_buffer_position (w, pos, -1, -1, &dummy, pos + 100, 0); | 1712 | face_id = face_at_buffer_position (w, pos, -1, -1, &dummy, pos + 100, 0); |
| 1692 | face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c, pos, Qnil); | ||
| 1693 | face = FACE_FROM_ID (f, face_id); | 1713 | face = FACE_FROM_ID (f, face_id); |
| 1694 | return (face->font && face->font_name | 1714 | charset = Fget_char_property (position, Qcharset, Qnil); |
| 1695 | ? build_string (face->font_name) | 1715 | if (CHARSETP (charset)) |
| 1716 | charset_id = XINT (CHARSET_SYMBOL_ID (charset)); | ||
| 1717 | else | ||
| 1718 | charset_id = -1; | ||
| 1719 | rfont_def = fontset_font (FONTSET_FROM_ID (face->fontset), | ||
| 1720 | c, face, charset_id); | ||
| 1721 | return (VECTORP (rfont_def) && STRINGP (AREF (rfont_def, 3)) | ||
| 1722 | ? AREF (rfont_def, 3) | ||
| 1696 | : Qnil); | 1723 | : Qnil); |
| 1697 | } | 1724 | } |
| 1698 | 1725 | ||
| @@ -1798,11 +1825,12 @@ fontset. The format is the same as abobe. */) | |||
| 1798 | val = FONTSET_FALLBACK (realized[k][i]); | 1825 | val = FONTSET_FALLBACK (realized[k][i]); |
| 1799 | if (! VECTORP (val)) | 1826 | if (! VECTORP (val)) |
| 1800 | continue; | 1827 | continue; |
| 1801 | /* VAL is [int int int [FACE-ID FONT-INDEX FONT-DEF] ...]. | 1828 | /* VAL is [int int ? |
| 1829 | [FACE-ID FONT-INDEX FONT-DEF FONT-NAME] ...]. | ||
| 1802 | If a font of an element is already opened, | 1830 | If a font of an element is already opened, |
| 1803 | FONT-INDEX of the element is integer. */ | 1831 | FONT-NAME is the name of a opened font. */ |
| 1804 | for (j = 3; j < ASIZE (val); j++) | 1832 | for (j = 3; j < ASIZE (val); j++) |
| 1805 | if (INTEGERP (AREF (AREF (val, j), 0))) | 1833 | if (STRINGP (AREF (AREF (val, j), 3))) |
| 1806 | { | 1834 | { |
| 1807 | Lisp_Object font_idx; | 1835 | Lisp_Object font_idx; |
| 1808 | 1836 | ||