(code_convert_region): Fix previous change. Adjusted
[bpt/emacs.git] / src / fontset.c
index 16fbf35..fe35268 100644 (file)
@@ -1,7 +1,6 @@
 /* Fontset handler.
-   Ver.1.0
-   Copyright (C) 1995 Free Software Foundation, Inc.
-   Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
+   Copyright (C) 1995, 1997 Electrotechnical Laboratory, JAPAN.
+   Licensed to the Free Software Foundation.
 
 This file is part of GNU Emacs.
 
@@ -33,11 +32,15 @@ Boston, MA 02111-1307, USA.  */
 Lisp_Object Vglobal_fontset_alist;
 Lisp_Object Vfont_encoding_alist;
 Lisp_Object Vuse_default_ascent;
-Lisp_Object Valternative_fontname_alist;
+Lisp_Object Vignore_relative_composition;
+Lisp_Object Valternate_fontname_alist;
 Lisp_Object Vfontset_alias_alist;
 Lisp_Object Vhighlight_wrong_size_font;
 Lisp_Object Vclip_large_size_font;
 
+/* Used as a temporary in macro FS_LOAD_FONT.  */
+int font_idx_temp;
+
 /* We had better have our own strcasecmp function because some system
    doesn't have it.  */
 static char my_strcasetbl[256];
@@ -57,25 +60,27 @@ my_strcasecmp (s0, s1)
    the comments in src/fontset.h for more detail.  */
 
 /* Return a pointer to struct font_info of font FONT_IDX of frame F.  */
-struct font_info *(*get_font_info_func) (/* FRAME_PTR f; int font_idx */);
+struct font_info *(*get_font_info_func) P_ ((FRAME_PTR f, int font_idx));
 
 /* Return a list of font names which matches PATTERN.  See the document of
    `x-list-fonts' for more detail.  */
-Lisp_Object (*list_fonts_func) (/* Lisp_Object pattern, face, frame, width */);
+Lisp_Object (*list_fonts_func) P_ ((Lisp_Object pattern, Lisp_Object face,
+                                   Lisp_Object frame, Lisp_Object width));
 
 /* Load a font named NAME for frame F and return a pointer to the
    information of the loaded font.  If loading is failed, return 0.  */
-struct font_info *(*load_font_func) (/* FRAME_PTR f; char *name */);
+struct font_info *(*load_font_func) P_ ((FRAME_PTR f, char *name, int));
 
 /* Return a pointer to struct font_info of a font named NAME for frame F.  */
-struct font_info *(*query_font_func) (/* FRAME_PTR f; char *name */);
+struct font_info *(*query_font_func) P_ ((FRAME_PTR f, char *name));
 
 /* Additional function for setting fontset or changing fontset
    contents of frame F.  */
-void (*set_frame_fontset_func) (/* FRAME_PTR f; Lisp_Object arg, oldval */);
+void (*set_frame_fontset_func) P_ ((FRAME_PTR f, Lisp_Object arg,
+                                   Lisp_Object oldval));
 
 /* Check if any window system is used now.  */
-void (*check_window_system_func) ();
+void (*check_window_system_func) P_ ((void));
 
 struct fontset_data *
 alloc_fontset_data ()
@@ -92,19 +97,22 @@ void
 free_fontset_data (fontset_data)
      struct fontset_data *fontset_data;
 {
-  int i;
-
-  for (i = 0; i < fontset_data->n_fontsets; i++)
+  if (fontset_data->fontset_table)
     {
-      int j;
+      int i;
 
-      xfree (fontset_data->fontset_table[i]->name);
-      for (j = 0; j <= MAX_CHARSET; j++)
-       if (fontset_data->fontset_table[i]->fontname[j])
-         xfree (fontset_data->fontset_table[i]->fontname[j]);
-      xfree (fontset_data->fontset_table[i]);
+      for (i = 0; i < fontset_data->n_fontsets; i++)
+       {
+         int j;
+         
+         xfree (fontset_data->fontset_table[i]->name);
+         for (j = 0; j <= MAX_CHARSET; j++)
+           if (fontset_data->fontset_table[i]->fontname[j])
+             xfree (fontset_data->fontset_table[i]->fontname[j]);
+         xfree (fontset_data->fontset_table[i]);
+       }
+      xfree (fontset_data->fontset_table);
     }
-  xfree (fontset_data->fontset_table);
 
   xfree (fontset_data);
 }
@@ -115,7 +123,10 @@ free_fontset_data (fontset_data)
    If loading fails, return 0;
    If FONTNAME is NULL, the name is taken from the information of FONTSET.
    If FONTSET is given, try to load a font whose size matches that of
-   FONTSET, and, the font index is stored in the table for FONTSET.  */
+   FONTSET, and, the font index is stored in the table for FONTSET.
+
+   If you give FONTSET argument, don't call this function directry,
+   instead call macro FS_LOAD_FONT with the same argument.  */
 
 struct font_info *
 fs_load_font (f, font_table, charset, fontname, fontset)
@@ -424,7 +435,7 @@ fontset_pattern_regexp (pattern)
              *p1++ = '*';
            }
          else if (*p0 == '?')
-           *p1++ == '.';
+           *p1++ = '.';
          else
            *p1++ = *p0;
        }
@@ -713,7 +724,7 @@ If the named font is not yet loaded, return nil.")
   if (!fontp)
     return Qnil;
 
-  info = Fmake_vector (make_number (7), Qnil);
+  info = Fmake_vector (make_number (8), Qnil);
 
   XVECTOR (info)->contents[0] = build_string (fontp->name);
   XVECTOR (info)->contents[1] = build_string (fontp->full_name);
@@ -827,16 +838,27 @@ ENCODING is one of the following integer values:\n\
   Vfont_encoding_alist = Qnil;
 
   DEFVAR_LISP ("use-default-ascent", &Vuse_default_ascent,
-     "Char table of characters of which ascent values should be ignored.\n\
+     "Char table of characters whose ascent values should be ignored.\n\
 If an entry for a character is non-nil, the ascent value of the glyph\n\
-is assumed to be what specified by _MULE_DEFAULT_ASCENT property of a font.");
+is assumed to be what specified by _MULE_DEFAULT_ASCENT property of a font.\n\
+\n\
+This affects how a composite character which contains\n\
+such a character is displayed on screen.");
+  Vuse_default_ascent = Qnil;
+
+  DEFVAR_LISP ("ignore-relative-composition", &Vignore_relative_composition,
+     "Char table of characters which is not composed relatively.\n\
+If an entry for a character is non-nil, a composite character\n\
+which contains that character is displayed so that\n\
+the glyph of that character is put without considering\n\
+an ascent and descent value of a previous character.");
   Vuse_default_ascent = Qnil;
 
-  DEFVAR_LISP ("alternative-fontname-alist", &Valternative_fontname_alist,
-     "Alist of fontname vs list of the alternative fontnames.\n\
-When no font can be opened by a fontname, the corresponding\n\
-alternative fontnames are tried.");
-  Valternative_fontname_alist = Qnil;
+  DEFVAR_LISP ("alternate-fontname-alist", &Valternate_fontname_alist,
+     "Alist of fontname vs list of the alternate fontnames.\n\
+When a specified font name is not found, the corresponding\n\
+alternate fontnames (if any) are tried instead.");
+  Valternate_fontname_alist = Qnil;
 
   DEFVAR_LISP ("fontset-alias-alist", &Vfontset_alias_alist,
      "Alist of fontset names vs the aliases.");
@@ -845,21 +867,19 @@ alternative fontnames are tried.");
   DEFVAR_LISP ("highlight-wrong-size-font", &Vhighlight_wrong_size_font,
      "*Non-nil means highlight characters shown in wrong size fonts somehow.\n\
 The way to highlight them depends on window system on which Emacs runs.\n\
-On X window, a rectangle is shown around each such character.");
-  Vhighlight_wrong_size_font = Qt;
+On X11, a rectangle is shown around each such character.");
+  Vhighlight_wrong_size_font = Qnil;
 
   DEFVAR_LISP ("clip-large-size-font", &Vclip_large_size_font,
-     "*Non-nil means characters shown in large size fonts are clipped.\n\
+     "*Non-nil means characters shown in overlarge fonts are clipped.\n\
 The height of clipping area is the same as that of an ASCII character.\n\
-The width of the area is the same as that of an ASCII character or\n\
-twice wider than that of an ASCII character depending on\n\
-the width (i.e. column numbers occupied on screen) of the character set\n\
-of the character.\n\
+The width of the area is the same as that of an ASCII character,\n\
+or twice as wide, depending on the character set's column-width.\n\
 \n\
-In the case that you only have too large size font for a specific\n\
-charscter set, and clipping characters of the character set makes them\n\
-almost unreadable, you can set this variable to t to see the\n\
-characters in exchage for garbage dots left on your screen.");
+If the only font you have for a specific character set is too large,\n\
+and clipping these characters makes them hard to read,\n\
+you can set this variable to nil to display the characters without clipping.\n\
+The drawback is that you will get some garbage left on your screen.");
   Vclip_large_size_font = Qt;
 
   defsubr (&Squery_fontset);