]> git.eshelyaron.com Git - emacs.git/commitdiff
(fs_load_font): If fontp->charset is not negative,
authorKenichi Handa <handa@m17n.org>
Thu, 1 Aug 2002 05:44:09 +0000 (05:44 +0000)
committerKenichi Handa <handa@m17n.org>
Thu, 1 Aug 2002 05:44:09 +0000 (05:44 +0000)
return fontp without setting its members.

src/ChangeLog
src/fontset.c

index 2071b3507f7d35fde1bdd6ac90c9f69f7c9ed0c6..dff9ee1b9519e8b3f055538f419341916b0ef4bd 100644 (file)
@@ -1,3 +1,10 @@
+2002-08-01  Kenichi Handa  <handa@etl.go.jp>
+
+       * xterm.c (x_load_font): Initialize fontp->fontset to -1.
+
+       * fontset.c (fs_load_font): If fontp->charset is not negative,
+       return fontp without setting its members.
+
 2002-07-31  Dave Love  <fx@gnu.org>
 
        * config.in: Generated with autoheader.
index e038000e865c5b7078137d4fc699c175ff3c7e53..1c1c1b12a4a9d99f168e399b4d51ae67e4472a87 100644 (file)
@@ -234,7 +234,7 @@ static int fontset_id_valid_p P_ ((int));
 static Lisp_Object fontset_pattern_regexp P_ ((Lisp_Object));
 static void accumulate_script_ranges P_ ((Lisp_Object, Lisp_Object,
                                          Lisp_Object));
-
+static Lisp_Object find_font_encoding P_ ((char *));
 
 \f
 /********** MACROS AND FUNCTIONS TO HANDLE FONTSET **********/
@@ -792,14 +792,14 @@ make_fontset_for_ascii_face (f, base_fontset_id, face)
 
 /* Load a font named FONTNAME on frame F.  Return a pointer to the
    struct font_info of the loaded font.  If loading fails, return
-   NULL.  CHARSET_ID is an ID of charset to encode characters for this
-   font.  */
+   NULL.  CHARSET is an ID of charset to encode characters for this
+   font.  If it is -1, find one from Vfont_encoding_alist.  */
 
 struct font_info *
-fs_load_font (f, fontname, charset_id)
+fs_load_font (f, fontname, charset)
      FRAME_PTR f;
      char *fontname;
-     int charset_id;
+     int charset;
 {
   struct font_info *fontp;
 
@@ -808,16 +808,25 @@ fs_load_font (f, fontname, charset_id)
     return NULL;
 
   fontp = (*load_font_func) (f, fontname, 0);
-  if (!fontp)
-    return NULL;
+  if (! fontp || fontp->charset >= 0)
+    return fontp;
 
   fontname = fontp->full_name;
 
-  fontp->charset = charset_id;
+  if (charset < 0)
+    {
+      Lisp_Object charset_symbol;
+
+      charset_symbol = find_font_encoding (fontname);
+      if (CONSP (charset_symbol))
+       charset_symbol = XCAR (charset_symbol);
+      charset = XINT (CHARSET_SYMBOL_ID (charset_symbol));
+    }
+  fontp->charset = charset;
   fontp->vertical_centering = 0;
   fontp->font_encoder = NULL;
 
-  if (charset_id != charset_ascii)
+  if (charset != charset_ascii)
     {
       fontp->vertical_centering
        = (STRINGP (Vvertical_centering_font_regexp)
@@ -836,9 +845,9 @@ fs_load_font (f, fontname, charset_id)
 #endif
 
 \f
-/* Return ENCODING or a cons(ENCODING REPERTORY) of the font FONTNAME.
-   ENCODING is a charset symbol that specifies the encoding of the
-   font.  REPERTORY is a charset symbol or nil.  */
+/* Return ENCODING or a cons of ENCODING and REPERTORY of the font
+   FONTNAME.  ENCODING is a charset symbol that specifies the encoding
+   of the font.  REPERTORY is a charset symbol or nil.  */
 
 
 static Lisp_Object