/[emacs]/emacs/src/fontset.c
ViewVC logotype

Diff of /emacs/src/fontset.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.64 by pj, Wed Nov 14 13:38:51 2001 UTC revision 1.65 by pj, Wed Dec 12 20:06:10 2001 UTC
# Line 55  Boston, MA 02111-1307, USA.  */ Line 55  Boston, MA 02111-1307, USA.  */
55     face is also realized for multibyte characters based on an ASCII     face is also realized for multibyte characters based on an ASCII
56     face.  All of the multibyte faces based on the same ASCII face     face.  All of the multibyte faces based on the same ASCII face
57     share the same realized fontset.     share the same realized fontset.
58      
59     A fontset object is implemented by a char-table.     A fontset object is implemented by a char-table.
60    
61     An element of a base fontset is:     An element of a base fontset is:
62          (INDEX . FONTNAME) or          (INDEX . FONTNAME) or
63          (INDEX . (FOUNDRY . REGISTRY ))          (INDEX . (FOUNDRY . REGISTRY ))
64     FONTNAME is a font name pattern for the corresponding character.     FONTNAME is a font name pattern for the corresponding character.
65     FOUNDRY and REGISTRY are respectively foundy and regisry fields of     FOUNDRY and REGISTRY are respectively foundry and registry fields of
66     a font name for the corresponding character.  INDEX specifies for     a font name for the corresponding character.  INDEX specifies for
67     which character (or generic character) the element is defined.  It     which character (or generic character) the element is defined.  It
68     may be different from an index to access this element.  For     may be different from an index to access this element.  For
# Line 71  Boston, MA 02111-1307, USA.  */ Line 71  Boston, MA 02111-1307, USA.  */
71     charset.  REGISTRY is the     charset.  REGISTRY is the
72    
73     An element of a realized fontset is FACE-ID which is a face to use     An element of a realized fontset is FACE-ID which is a face to use
74     for displaying the correspnding character.     for displaying the corresponding character.
75    
76     All single byte charaters (ASCII and 8bit-unibyte) share the same     All single byte characters (ASCII and 8bit-unibyte) share the same
77     element in a fontset.  The element is stored in the first element     element in a fontset.  The element is stored in the first element
78     of the fontset.     of the fontset.
79    
# Line 110  Boston, MA 02111-1307, USA.  */ Line 110  Boston, MA 02111-1307, USA.  */
110     These structures are hidden from the other codes than this file.     These structures are hidden from the other codes than this file.
111     The other codes handle fontsets only by their ID numbers.  They     The other codes handle fontsets only by their ID numbers.  They
112     usually use variable name `fontset' for IDs.  But, in this file, we     usually use variable name `fontset' for IDs.  But, in this file, we
113     always use varialbe name `id' for IDs, and name `fontset' for the     always use variable name `id' for IDs, and name `fontset' for the
114     actual fontset objects.     actual fontset objects.
115    
116  */  */
# Line 123  Lisp_Object Qfontset; Line 123  Lisp_Object Qfontset;
123  /* Vector containing all fontsets.  */  /* Vector containing all fontsets.  */
124  static Lisp_Object Vfontset_table;  static Lisp_Object Vfontset_table;
125    
126  /* Next possibly free fontset ID.  Usually this keeps the mininum  /* Next possibly free fontset ID.  Usually this keeps the minimum
127     fontset ID not yet used.  */     fontset ID not yet used.  */
128  static int next_fontset_id;  static int next_fontset_id;
129    
# Line 145  Lisp_Object Vvertical_centering_font_reg Line 145  Lisp_Object Vvertical_centering_font_reg
145  /* Return a pointer to struct font_info of font FONT_IDX of frame F.  */  /* Return a pointer to struct font_info of font FONT_IDX of frame F.  */
146  struct font_info *(*get_font_info_func) P_ ((FRAME_PTR f, int font_idx));  struct font_info *(*get_font_info_func) P_ ((FRAME_PTR f, int font_idx));
147    
148  /* Return a list of font names which matches PATTERN.  See the document of  /* Return a list of font names which matches PATTERN.  See the documentation
149     `x-list-fonts' for more detail.  */     of `x-list-fonts' for more details.  */
150  Lisp_Object (*list_fonts_func) P_ ((struct frame *f,  Lisp_Object (*list_fonts_func) P_ ((struct frame *f,
151                                      Lisp_Object pattern,                                      Lisp_Object pattern,
152                                      int size,                                      int size,
# Line 166  void (*set_frame_fontset_func) P_ ((FRAM Line 166  void (*set_frame_fontset_func) P_ ((FRAM
166    
167  /* To find a CCL program, fs_load_font calls this function.  /* To find a CCL program, fs_load_font calls this function.
168     The argument is a pointer to the struct font_info.     The argument is a pointer to the struct font_info.
169     This function set the memer `encoder' of the structure.  */     This function set the member `encoder' of the structure.  */
170  void (*find_ccl_program_func) P_ ((struct font_info *));  void (*find_ccl_program_func) P_ ((struct font_info *));
171    
172  /* Check if any window system is used now.  */  /* Check if any window system is used now.  */
# Line 318  make_fontset (frame, name, base) Line 318  make_fontset (frame, name, base)
318    /* Find a free slot in Vfontset_table.  Usually, next_fontset_id is    /* Find a free slot in Vfontset_table.  Usually, next_fontset_id is
319       the next available fontset ID.  So it is expected that this loop       the next available fontset ID.  So it is expected that this loop
320       terminates quickly.  In addition, as the last element of       terminates quickly.  In addition, as the last element of
321       Vfotnset_table is always nil, we don't have to check the range of       Vfontset_table is always nil, we don't have to check the range of
322       id.  */       id.  */
323    while (!NILP (AREF (Vfontset_table, id))) id++;    while (!NILP (AREF (Vfontset_table, id))) id++;
324    
325    if (id + 1 == size)    if (id + 1 == size)
326      {      {
327        Lisp_Object tem;        Lisp_Object tem;
328        int i;        int i;
329    
330        tem = Fmake_vector (make_number (size + 8), Qnil);        tem = Fmake_vector (make_number (size + 8), Qnil);
331        for (i = 0; i < size; i++)        for (i = 0; i < size; i++)
# Line 373  font_family_registry (fontname, force) Line 373  font_family_registry (fontname, force)
373    char *p = XSTRING (fontname)->data;    char *p = XSTRING (fontname)->data;
374    char *sep[15];    char *sep[15];
375    int i = 0;    int i = 0;
376      
377    while (*p && i < 15)    while (*p && i < 15)
378      if (*p++ == '-')      if (*p++ == '-')
379        {        {
# Line 390  font_family_registry (fontname, force) Line 390  font_family_registry (fontname, force)
390  }  }
391    
392    
393  /********** INTERFACES TO xfaces.c and dispextern.h **********/  /********** INTERFACES TO xfaces.c and dispextern.h **********/
394    
395  /* Return name of the fontset with ID.  */  /* Return name of the fontset with ID.  */
396    
# Line 481  face_for_char (f, face, c) Line 481  face_for_char (f, face, c)
481    /* No face is recorded for C in the fontset of FACE.  Make a new    /* No face is recorded for C in the fontset of FACE.  Make a new
482       realized face for C that has the same fontset.  */       realized face for C that has the same fontset.  */
483    face_id = lookup_face (f, face->lface, c, face);    face_id = lookup_face (f, face->lface, c, face);
484      
485    /* Record the face ID in FONTSET at the same index as the    /* Record the face ID in FONTSET at the same index as the
486       information in the base fontset.  */       information in the base fontset.  */
487    FONTSET_SET (fontset, c, make_number (face_id));    FONTSET_SET (fontset, c, make_number (face_id));
# Line 532  fontset_font_pattern (f, id, c) Line 532  fontset_font_pattern (f, id, c)
532  {  {
533    Lisp_Object fontset, elt;    Lisp_Object fontset, elt;
534    struct font_info *fontp;    struct font_info *fontp;
535      
536    elt = Qnil;    elt = Qnil;
537    if (fontset_id_valid_p (id))    if (fontset_id_valid_p (id))
538      {      {
# Line 634  fs_load_font (f, c, fontname, id, face) Line 634  fs_load_font (f, c, fontname, id, face)
634    
635    fontp->vertical_centering    fontp->vertical_centering
636      = (STRINGP (Vvertical_centering_font_regexp)      = (STRINGP (Vvertical_centering_font_regexp)
637         && (fast_c_string_match_ignore_case         && (fast_c_string_match_ignore_case
638             (Vvertical_centering_font_regexp, fontp->full_name) >= 0));             (Vvertical_centering_font_regexp, fontp->full_name) >= 0));
639    
640    if (fontp->encoding[1] != FONT_ENCODING_NOT_DECIDED)    if (fontp->encoding[1] != FONT_ENCODING_NOT_DECIDED)
# Line 828  If REGEXPP is non-nil, PATTERN is a regu Line 828  If REGEXPP is non-nil, PATTERN is a regu
828    
829  /* Return a list of base fontset names matching PATTERN on frame F.  /* Return a list of base fontset names matching PATTERN on frame F.
830     If SIZE is not 0, it is the size (maximum bound width) of fontsets     If SIZE is not 0, it is the size (maximum bound width) of fontsets
831     to be listed. */     to be listed.  */
832    
833  Lisp_Object  Lisp_Object
834  list_fontsets (f, pattern, size)  list_fontsets (f, pattern, size)
# Line 983  CHARACTER may be a charset.   In that ca Line 983  CHARACTER may be a charset.   In that ca
983  for all character in the charsets.  for all character in the charsets.
984    
985  FONTNAME may be a cons; (FAMILY . REGISTRY), where FAMILY is a family  FONTNAME may be a cons; (FAMILY . REGISTRY), where FAMILY is a family
986  name of a font, REGSITRY is a registry name of a font.  */)  name of a font, REGISTRY is a registry name of a font.  */)
987       (name, character, fontname, frame)       (name, character, fontname, frame)
988       Lisp_Object name, character, fontname, frame;       Lisp_Object name, character, fontname, frame;
989  {  {
# Line 1247  where, Line 1247  where,
1247      or a cons of two characters specifying the range of characters.      or a cons of two characters specifying the range of characters.
1248    FONT-SPEC is a fontname pattern string or a cons (FAMILY . REGISTRY),    FONT-SPEC is a fontname pattern string or a cons (FAMILY . REGISTRY),
1249      where FAMILY is a `FAMILY' field of a XLFD font name,      where FAMILY is a `FAMILY' field of a XLFD font name,
1250      REGISTRY is a `CHARSET_REGISTRY' field of a XLDF font name.      REGISTRY is a `CHARSET_REGISTRY' field of a XLFD font name.
1251      FAMILY may contain a `FOUNDARY' field at the head.      FAMILY may contain a `FOUNDRY' field at the head.
1252      REGISTRY may contain a `CHARSET_ENCODING' field at the tail.      REGISTRY may contain a `CHARSET_ENCODING' field at the tail.
1253    OPENEDs are names of fonts actually opened.    OPENEDs are names of fonts actually opened.
1254  If the ASCII font is not yet opened, SIZE and HEIGHT are 0.  If the ASCII font is not yet opened, SIZE and HEIGHT are 0.
# Line 1264  If FRAME is omitted, it defaults to the Line 1264  If FRAME is omitted, it defaults to the
1264    struct font_info *fontp = NULL;    struct font_info *fontp = NULL;
1265    int n_realized = 0;    int n_realized = 0;
1266    int i;    int i;
1267      
1268    (*check_window_system_func) ();    (*check_window_system_func) ();
1269    
1270    fontset = check_fontset_name (name);    fontset = check_fontset_name (name);
# Line 1368  If NAME is t, find a font name pattern i Line 1368  If NAME is t, find a font name pattern i
1368    
1369    return elt;    return elt;
1370  }  }
     
1371    
1372  DEFUN ("fontset-list", Ffontset_list, Sfontset_list, 0, 0, 0,  DEFUN ("fontset-list", Ffontset_list, Sfontset_list, 0, 0, 0,
1373         doc: /* Return a list of all defined fontset names.  */)         doc: /* Return a list of all defined fontset names.  */)
# Line 1471  alternate fontnames (if any) are tried i Line 1470  alternate fontnames (if any) are tried i
1470                 &Vvertical_centering_font_regexp,                 &Vvertical_centering_font_regexp,
1471                 doc: /* *Regexp matching font names that require vertical centering on display.                 doc: /* *Regexp matching font names that require vertical centering on display.
1472  When a character is displayed with such fonts, the character is displayed  When a character is displayed with such fonts, the character is displayed
1473  at the vertival center of lines.  */);  at the vertical center of lines.  */);
1474    Vvertical_centering_font_regexp = Qnil;    Vvertical_centering_font_regexp = Qnil;
1475    
1476    defsubr (&Squery_fontset);    defsubr (&Squery_fontset);

Legend:
Removed from v.1.64  
changed lines
  Added in v.1.65

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26