X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/d295ed3c494def337a1dd0a23d5c25db040826a8..cd987aaa0a8254a701886b3c32c269b09025c7a1:/src/fontset.h diff --git a/src/fontset.h b/src/fontset.h index 2df41aa0b7..a436028091 100644 --- a/src/fontset.h +++ b/src/fontset.h @@ -1,6 +1,9 @@ /* Header for fontset handler. - Copyright (C) 1995, 1997 Electrotechnical Laboratory, JAPAN. - Licensed to the Free Software Foundation. + Copyright (C) 1998, 2002, 2003, 2004, 2005, + 2006 Free Software Foundation, Inc. + Copyright (C) 1995, 1997, 2000 + National Institute of Advanced Industrial Science and Technology (AIST) + Registration Number H14PRO021 This file is part of GNU Emacs. @@ -16,15 +19,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Emacs; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ -#ifndef _FONTSET_H -#define _FONTSET_H - -/* - -#define GENERIC_FONT_PTR void +#ifndef EMACS_FONTSET_H +#define EMACS_FONTSET_H /* This data type is used for the font_table field of window system depending data area (e.g. struct x_display_info on X window). */ @@ -47,15 +46,31 @@ struct font_info /* Charset of characters displayed by the font. */ int charset; +#ifdef WINDOWSNT + /* Codepage of characters that will be displayed by the font. */ + int codepage; +#endif + /* Maximum bound width over all existing characters of the font. On X window, this is same as (font->max_bounds.width) */ int size; - /* Height of the font. On X window, this is same as (font->ascent - + font->descent). */ + /* Height of the font. On X window, this is the same as + (font->ascent + font->descent). */ int height; - /* Encodings of the font indexed by CHARSET. The value an integer + /* Width of the space glyph of the font. */ + int space_width; + + /* Average width of glyphs in the font. */ + int average_width; + + /* 1 iff `vertical-centering-font-regexp' matches this font name. + In this case, we render characters at vartical center positions + of lines. */ + int vertical_centering; + + /* Encodings of the font indexed by CHARSET. The value is one of 0, 1, 2, or 3: 0: code points 0x20..0x7F or 0x2020..0x7F7F are used 1: code points 0xA0..0xFF or 0xA0A0..0xFFFF are used @@ -69,7 +84,10 @@ struct font_info consult `font-encoding-alist' to get of the corresponding charset whose default value is defined in lisp/fontset.el. Since there's no charset whose id is 1, we use encoding[1] to store the - encoding information decided by the font itself. */ + encoding information decided by the font itself. + + If the member `font_encoder' is not NULL, this member is ignored. + */ unsigned char encoding[MAX_CHARSET + 1]; /* The baseline position of a font is normally `ascent' value of the @@ -88,7 +106,7 @@ struct font_info `ascent'. In other words, the value indicates how many bits higher we should draw a character of the font than normal ASCII text for a better looking. - + We also have to consider the fact that the concept of `baseline' differs among languages to which each character belongs. For instance, baseline should be at the bottom most position of all @@ -125,50 +143,13 @@ struct font_info struct ccl_program *font_encoder; }; -/* A value which may appear in the member encoding of struch font_info - indicating that a font itself doesn't tell which encoding to be - used. */ -#define FONT_ENCODING_NOT_DECIDED 4 - -#define FONT_NOT_OPENED -1 -#define FONT_NOT_FOUND -2 - -struct fontset_info -{ - /* Name of the fontset. */ - char *name; - - /* Size of the fontset. This is the same as the size of ASCII font - of this fontset. */ - int size; - - /* Height of the tallest font in the fontset. */ - int height; - - /* Table of font name for each character set. */ - char *fontname[MAX_CHARSET + 1]; - - /* Table of index numbers of fonts indexed by charset. If a font is - not yet loaded, the value is -1 (FONT_NOT_OPENED). If font - loading is failed, the value is -2 (FONT_NOT_FOUND). */ - int font_indexes[MAX_CHARSET + 1]; -}; - -/* This data type is used for the fontset_data field of struct frame. */ +/* A value which may appear in the member `encoding' of struch + font_info indicating that a font itself doesn't tell which encoding + to be used. */ +#define FONT_ENCODING_NOT_DECIDED 255 -struct fontset_data -{ - /* A table of pointers to all the fontsets. */ - struct fontset_info **fontset_table; - - /* The current capacity of fontset_table. */ - int fontset_table_size; - - /* The number of fontsets actually stored in fontset_table. - fontset_table[n] is used and valid iff 0 <= n < n_fontsets. - 0 <= n_fontsets <= fontset_table_size. */ - int n_fontsets; -}; +/* Forward declaration for prototypes. */ +struct frame; /* The following six are window system dependent functions. Initialization routine of each window system should set appropriate @@ -176,58 +157,95 @@ struct fontset_data x_term_init does this. */ /* Return a pointer to struct font_info of font FONT_IDX of frame F. */ -extern struct font_info *(*get_font_info_func) (/* FRAME_PTR f; - int font_idx */); +extern struct font_info *(*get_font_info_func) P_ ((struct frame *f, + int font_idx)); /* Return a list of font names which matches PATTERN. See the document of `x-list-fonts' for more detail. */ -extern Lisp_Object (*list_fonts_func) (/* Lisp_Object pattern, face, frame, - width */); +extern Lisp_Object (*list_fonts_func) P_ ((struct frame *f, + Lisp_Object pattern, + int size, + int maxnames)); /* Load a font named NAME for frame F and return a pointer to the information of the loaded font. If loading is failed, return -1. */ -extern struct font_info *(*load_font_func) (/* FRAME_PTR f; char *name */); +extern struct font_info *(*load_font_func) P_ ((struct frame *f, + char *name, int)); /* Return a pointer to struct font_info of a font named NAME for frame F. If no such font is loaded, return NULL. */ -extern struct font_info *(*query_font_func) (/* FRAME_PTR f; char *name */); +extern struct font_info *(*query_font_func) P_ ((struct frame *f, char *name)); /* Additional function for setting fontset or changing fontset contents of frame F. This function may change the coordinate of the frame. */ -extern void (*set_frame_fontset_func) (/* FRAME_PTR f; Lisp_Object arg, oldval */); +extern void (*set_frame_fontset_func) P_ ((struct frame *f, Lisp_Object arg, + Lisp_Object oldval)); -/* Check if any window system is used now. */ -extern void (*check_window_system_func) (); +/* To find a CCL program, fs_load_font calls this function. + The argument is a pointer to the struct font_info. + This function set the memer `encoder' of the structure. */ +extern void (*find_ccl_program_func) P_ ((struct font_info *)); -extern struct fontset_data *alloc_fontset_data (); -extern void free_fontset_data (); -extern struct font_info *fs_load_font (); -extern Lisp_Object list_fontsets (); -extern Lisp_Object Vglobal_fontset_alist; +/* Check if any window system is used now. */ +extern void (*check_window_system_func) P_ ((void)); + +struct face; + +extern void free_face_fontset P_ ((FRAME_PTR, struct face *)); +extern Lisp_Object fontset_font_pattern P_ ((FRAME_PTR, int, int)); +extern int face_suitable_for_char_p P_ ((struct face *, int)); +extern int face_for_char P_ ((FRAME_PTR, struct face *, int)); +extern int make_fontset_for_ascii_face P_ ((FRAME_PTR, int)); +extern void set_default_ascii_font P_ ((Lisp_Object)); +extern struct font_info *fs_load_font P_ ((struct frame *, int, char *, int, + struct face *)); +extern int fs_query_fontset P_ ((Lisp_Object, int)); +EXFUN (Fquery_fontset, 2); +extern Lisp_Object list_fontsets P_ ((struct frame *, Lisp_Object, int)); extern Lisp_Object Qfontset; -extern Lisp_Object Vuse_default_ascent; -extern Lisp_Object Valternative_fontname_alist; -extern Lisp_Object Vhighlight_wrong_size_font; -extern Lisp_Object Vclip_large_size_font; - -extern int font_idx_temp; - -/* Load a font named FONTNAME for displaying CHARSET on frame F. - All fonts for frame F is stored in a table pointed by FONT_TABLE. - Return a pointer to the struct font_info of the loaded font. - 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. */ - -#define FS_LOAD_FONT(f, font_table, charset, fontname, fontset) \ - (fontset >= 0 && fontset < FRAME_FONTSET_DATA (f)->n_fontsets \ - && (font_idx_temp = (FRAME_FONTSET_DATA (f) \ - ->fontset_table[fontset]->font_indexes[charset]), \ - font_idx_temp >= 0) \ - ? font_table + font_idx_temp \ - : fs_load_font (f, font_table, charset, fontname, fontset)) - -#endif /* _FONTSET_H */ +extern Lisp_Object Vuse_default_ascent; +extern Lisp_Object Vignore_relative_composition; +extern Lisp_Object Valternate_fontname_alist; +extern Lisp_Object Vfontset_alias_alist; +extern Lisp_Object Vvertical_centering_font_regexp; + +/* Load a font named FONTNAME for displaying character C. All fonts + for frame F is stored in a table pointed by FONT_TABLE. Return a + pointer to the struct font_info of the loaded font. 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. */ + +#define FS_LOAD_FONT(f, c, fontname, fontset) \ + fs_load_font (f, c, fontname, fontset, NULL) + +#define FS_LOAD_FACE_FONT(f, c, fontname, face) \ + fs_load_font (f, c, fontname, -1, face) + +/* Return an immutable id for font_info FONT_INFO on frame F. The + reason for this macro is hat one cannot hold pointers to font_info + structures in other data structures, because the table is + reallocated in x_list_fonts. */ + +#define FONT_INFO_ID(F, FONT_INFO) \ + (FONT_INFO) - (FRAME_X_DISPLAY_INFO ((F))->font_table) + +/* Given a font_info id ID, return a pointer to the font_info + structure on frame F. If ID is invalid, return null. */ + +#define FONT_INFO_FROM_ID(F, ID) \ + (((ID) >= 0 && (ID) < FRAME_X_DISPLAY_INFO ((F))->font_table_size) \ + ? (FRAME_X_DISPLAY_INFO ((F))->font_table + (ID)) \ + : 0) + +extern Lisp_Object fontset_name P_ ((int)); +extern Lisp_Object fontset_ascii P_ ((int)); +extern int fontset_height P_ ((int)); + +#endif /* EMACS_FONTSET_H */ + +/* arch-tag: c27cef7b-3cab-488a-8398-7a4daa96bb77 + (do not change this comment) */