aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa1997-02-27 07:52:23 +0000
committerKenichi Handa1997-02-27 07:52:23 +0000
commit6a7e6d80cb46817bd1ba190071c366666f991f81 (patch)
tree5e1b6895c3e0f26896f67b70599e1d4aed104ffa /src
parenta20aa7210cd4b0ef56b27b128493fb11feb7b3bd (diff)
downloademacs-6a7e6d80cb46817bd1ba190071c366666f991f81.tar.gz
emacs-6a7e6d80cb46817bd1ba190071c366666f991f81.zip
(syms_of_fontset): Intern Qfontset. Declare new lisp
variable use-default-ascent. (Vuse_default_ascent): New variable. (Ffont_info): Return also the value of default-ascent of a font. (fs_load_font): Disable updating fontsetp->height by non-ASCII character sets. This should be enabled when Emacs supports variable height lines. (fs_load_font, Fset_fontset_font): Bug fix to cope with the change of charsets to symbols.
Diffstat (limited to 'src')
-rw-r--r--src/fontset.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/src/fontset.c b/src/fontset.c
index 141ba4b0b59..93fdbfeccd1 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -33,6 +33,7 @@ Boston, MA 02111-1307, USA. */
33Lisp_Object Vglobal_fontset_alist; 33Lisp_Object Vglobal_fontset_alist;
34 34
35Lisp_Object Vfont_encoding_alist; 35Lisp_Object Vfont_encoding_alist;
36Lisp_Object Vuse_default_ascent;
36 37
37/* We had better have our own strcasecmp function because some system 38/* We had better have our own strcasecmp function because some system
38 doesn't have it. */ 39 doesn't have it. */
@@ -196,7 +197,6 @@ fs_load_font (f, font_table, charset, fontname, fontset)
196 197
197 for (tmp = XCONS (elt)->cdr; CONSP (tmp); tmp = XCONS (tmp)->cdr) 198 for (tmp = XCONS (elt)->cdr; CONSP (tmp); tmp = XCONS (tmp)->cdr)
198 if (CONSP (XCONS (tmp)->car) 199 if (CONSP (XCONS (tmp)->car)
199 && INTEGERP (XCONS (XCONS (tmp)->car)->car)
200 && ((i = get_charset_id (XCONS (XCONS (tmp)->car)->car)) 200 && ((i = get_charset_id (XCONS (XCONS (tmp)->car)->car))
201 >= 0) 201 >= 0)
202 && INTEGERP (XCONS (XCONS (tmp)->car)->cdr) 202 && INTEGERP (XCONS (XCONS (tmp)->car)->cdr)
@@ -251,8 +251,12 @@ fs_load_font (f, font_table, charset, fontname, fontset)
251 251
252 if (fontp2->size != fontp->size * CHARSET_WIDTH (i)) 252 if (fontp2->size != fontp->size * CHARSET_WIDTH (i))
253 fontsetp->font_indexes[i] = FONT_NOT_OPENED; 253 fontsetp->font_indexes[i] = FONT_NOT_OPENED;
254 /* The following code should be disabled until Emacs
255 supports variable height lines. */
256#if 0
254 else if (fontsetp->height < fontp->height) 257 else if (fontsetp->height < fontp->height)
255 fontsetp->height = fontp->height; 258 fontsetp->height = fontp->height;
259#endif
256 } 260 }
257 } 261 }
258 } 262 }
@@ -613,11 +617,12 @@ If FRAME is omitted or nil, all frames are affected.")
613 if (NILP (frame)) 617 if (NILP (frame))
614 { 618 {
615 Lisp_Object fontset_info = Fassoc (fullname, Vglobal_fontset_alist); 619 Lisp_Object fontset_info = Fassoc (fullname, Vglobal_fontset_alist);
616 Lisp_Object tem = Fassq (charset, XCONS (fontset_info)->cdr); 620 Lisp_Object tem = Fassq (charset_symbol, XCONS (fontset_info)->cdr);
617 621
618 if (NILP (tem)) 622 if (NILP (tem))
619 XCONS (fontset_info)->cdr 623 XCONS (fontset_info)->cdr
620 = Fcons (Fcons (charset, fontname), XCONS (fontset_info)->cdr); 624 = Fcons (Fcons (charset_symbol, fontname),
625 XCONS (fontset_info)->cdr);
621 else 626 else
622 XCONS (tem)->cdr = fontname; 627 XCONS (tem)->cdr = fontname;
623 } 628 }
@@ -636,13 +641,13 @@ If FRAME is omitted or nil, all frames are affected.")
636 struct fontset_info *fontsetp 641 struct fontset_info *fontsetp
637 = FRAME_FONTSET_DATA (f)->fontset_table[fontset]; 642 = FRAME_FONTSET_DATA (f)->fontset_table[fontset];
638 643
639 if (fontsetp->fontname[XINT (charset)]) 644 if (fontsetp->fontname[charset])
640 xfree (fontsetp->fontname[XINT (charset)]); 645 xfree (fontsetp->fontname[charset]);
641 fontsetp->fontname[XINT (charset)] 646 fontsetp->fontname[charset]
642 = (char *) xmalloc (XSTRING (fontname)->size + 1); 647 = (char *) xmalloc (XSTRING (fontname)->size + 1);
643 bcopy (XSTRING (fontname)->data, fontsetp->fontname[XINT (charset)], 648 bcopy (XSTRING (fontname)->data, fontsetp->fontname[charset],
644 XSTRING (fontname)->size + 1); 649 XSTRING (fontname)->size + 1);
645 fontsetp->font_indexes[XINT (charset)] = FONT_NOT_OPENED; 650 fontsetp->font_indexes[charset] = FONT_NOT_OPENED;
646 651
647 if (charset == CHARSET_ASCII) 652 if (charset == CHARSET_ASCII)
648 { 653 {
@@ -667,7 +672,7 @@ DEFUN ("font-info", Ffont_info, Sfont_info, 1, 2, 0,
667 "Return information about a font named NAME on frame FRAME.\n\ 672 "Return information about a font named NAME on frame FRAME.\n\
668If FRAME is omitted or nil, use the selected frame.\n\ 673If FRAME is omitted or nil, use the selected frame.\n\
669The returned value is a vector of OPENED-NAME, FULL-NAME, CHARSET, SIZE,\n\ 674The returned value is a vector of OPENED-NAME, FULL-NAME, CHARSET, SIZE,\n\
670 HEIGHT, BASELINE-OFFSET, and RELATIVE-COMPOSE,\n\ 675 HEIGHT, BASELINE-OFFSET, RELATIVE-COMPOSE, and DEFAULT-ASCENT,\n\
671where\n\ 676where\n\
672 OPENED-NAME is the name used for opening the font,\n\ 677 OPENED-NAME is the name used for opening the font,\n\
673 FULL-NAME is the full name of the font,\n\ 678 FULL-NAME is the full name of the font,\n\
@@ -675,7 +680,8 @@ where\n\
675 SIZE is the minimum bound width of the font,\n\ 680 SIZE is the minimum bound width of the font,\n\
676 HEIGHT is the height of the font,\n\ 681 HEIGHT is the height of the font,\n\
677 BASELINE-OFFSET is the upward offset pixels from ASCII baseline,\n\ 682 BASELINE-OFFSET is the upward offset pixels from ASCII baseline,\n\
678 RELATIVE-COMPOSE is the number controlling how to compose characters.\n\ 683 RELATIVE-COMPOSE and DEFAULT-ASCENT are the numbers controlling\n\
684 how to compose characters.\n\
679If the named font is not yet loaded, return nil.") 685If the named font is not yet loaded, return nil.")
680 (name, frame) 686 (name, frame)
681 Lisp_Object name, frame; 687 Lisp_Object name, frame;
@@ -702,7 +708,7 @@ If the named font is not yet loaded, return nil.")
702 if (!fontp) 708 if (!fontp)
703 return Qnil; 709 return Qnil;
704 710
705 info = Fmake_vector (make_number (6), Qnil); 711 info = Fmake_vector (make_number (7), Qnil);
706 712
707 XVECTOR (info)->contents[0] = build_string (fontp->name); 713 XVECTOR (info)->contents[0] = build_string (fontp->name);
708 XVECTOR (info)->contents[1] = build_string (fontp->full_name); 714 XVECTOR (info)->contents[1] = build_string (fontp->full_name);
@@ -711,6 +717,7 @@ If the named font is not yet loaded, return nil.")
711 XVECTOR (info)->contents[4] = make_number (fontp->height); 717 XVECTOR (info)->contents[4] = make_number (fontp->height);
712 XVECTOR (info)->contents[5] = make_number (fontp->baseline_offset); 718 XVECTOR (info)->contents[5] = make_number (fontp->baseline_offset);
713 XVECTOR (info)->contents[6] = make_number (fontp->relative_compose); 719 XVECTOR (info)->contents[6] = make_number (fontp->relative_compose);
720 XVECTOR (info)->contents[7] = make_number (fontp->default_ascent);
714 721
715 return info; 722 return info;
716} 723}
@@ -790,6 +797,7 @@ syms_of_fontset ()
790 /* Window system initializer should have set proper functions. */ 797 /* Window system initializer should have set proper functions. */
791 abort (); 798 abort ();
792 799
800 Qfontset = intern ("fontset");
793 staticpro (&Qfontset); 801 staticpro (&Qfontset);
794 802
795 Vcached_fontset_data = Qnil; 803 Vcached_fontset_data = Qnil;
@@ -813,6 +821,12 @@ ENCODING is one of the following integer values:\n\
813 3: code points 0xA020..0xFF7F are used."); 821 3: code points 0xA020..0xFF7F are used.");
814 Vfont_encoding_alist = Qnil; 822 Vfont_encoding_alist = Qnil;
815 823
824 DEFVAR_LISP ("use-default-ascent", &Vuse_default_ascent,
825 "Char table of characters of which ascent values should be ignored.\n\
826If an entry for a character is non-nil, the ascent value of the glyph\n\
827is assumed to be what specified by _MULE_DEFAULT_ASCENT property of a font.");
828 Vuse_default_ascent = Qnil;
829
816 defsubr (&Squery_fontset); 830 defsubr (&Squery_fontset);
817 defsubr (&Snew_fontset); 831 defsubr (&Snew_fontset);
818 defsubr (&Sset_fontset_font); 832 defsubr (&Sset_fontset_font);