(struct MRealizedFace): New member font.
[m17n/m17n-lib.git] / src / face.h
1 /* face.h -- header file for the face module.
2    Copyright (C) 2003, 2004
3      National Institute of Advanced Industrial Science and Technology (AIST)
4      Registration Number H15PRO112
5
6    This file is part of the m17n library.
7
8    The m17n library is free software; you can redistribute it and/or
9    modify it under the terms of the GNU Lesser General Public License
10    as published by the Free Software Foundation; either version 2.1 of
11    the License, or (at your option) any later version.
12
13    The m17n library is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    Lesser General Public License for more details.
17
18    You should have received a copy of the GNU Lesser General Public
19    License along with the m17n library; if not, write to the Free
20    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21    02111-1307, USA.  */
22
23 #ifndef _M17N_FACE_H_
24 #define _M17N_FACE_H_
25
26 enum MFaceProperty
27   {
28     /** The font related properties.  */
29     /* The order of MFACE_FOUNDRY to MFACE_ADSTYLE must be the same as
30        MFONT_FOUNDRY to MFONT_ADSTYLE of enum MFontProperty.  */
31     MFACE_FOUNDRY,
32     MFACE_FAMILY,
33     MFACE_WEIGHT,
34     MFACE_STYLE,
35     MFACE_STRETCH,
36     MFACE_ADSTYLE,
37     MFACE_SIZE,
38     MFACE_FONTSET,
39
40     /** The color related properties.   */
41     MFACE_FOREGROUND,
42     MFACE_BACKGROUND,
43
44     /** The other properties.   */
45     MFACE_HLINE,
46     MFACE_BOX,
47     MFACE_VIDEOMODE,
48
49     /** Extention by applications.  */
50     MFACE_HOOK_FUNC,
51     MFACE_HOOK_ARG,
52
53     /* In a realized face, this is ignored because it is already
54        reflected in MFACE_SIZE.  */
55     MFACE_RATIO,
56
57     MFACE_PROPERTY_MAX
58   };
59
60 struct MFace
61 {
62   M17NObject control;
63
64   /** Properties of the face.  */
65   void *property[MFACE_PROPERTY_MAX];
66
67   /** List of frames affected by the face modification.  */
68   MPlist *frame_list;
69 };
70
71
72 /** A realized face is registered in MFrame->face_list, thus it does
73     not have to be a managed object.  */
74
75 struct MRealizedFace
76 {
77   /** Frame on which this realized face is created.  */
78   MFrame *frame;
79
80   /** Properties of all stacked faces are merged into here.  */
81   MFace face;
82
83   /** Font explicitly specified for the face (maybe NULL).  */
84   MFont *font;
85
86   /** From what faces this is realized.  Keys are Mface and values are
87      (MFace *).  */
88   MPlist *base_face_list;
89
90   /* Realized font, one of <frame>->realized_font_list.  */
91   MRealizedFont *rfont;
92
93   /* Realized fontset, one of <frame>->realized_fontset_list.  */
94   MRealizedFontset *rfontset;
95
96   MSymbol layouter;
97
98   MFaceHLineProp *hline;
99
100   MFaceBoxProp *box;
101
102   /** Realized face for ASCII chars that has the same face
103       properties. */
104   MRealizedFace *ascii_rface;
105
106   /** List of realized faces that have the same face properties.  */
107   MPlist *non_ascii_list;
108
109   int ascent, descent;
110   int space_width;
111
112   /** Pointer to a window system dependent object.  */
113   void *info;
114 };
115
116
117 extern MFace *mface__default;
118
119 extern MRealizedFace *mface__realize (MFrame *frame, MFace **faces, int num,
120                                       int limitted_size, MFont *font);
121
122 extern MGlyph *mface__for_chars (MSymbol script, MSymbol language,
123                                  MSymbol charset, MGlyph *from_g, MGlyph *to_g,
124                                  int size);
125
126 extern void mface__free_realized (MRealizedFace *rface);
127
128 extern void mface__update_frame_face (MFrame *frame);
129
130 #endif /* _M17N_FACE_H_ */