*** empty log message ***
[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        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 already reflected in MFACE_SIZE,
54        thus is ignored.  */
55     MFACE_RATIO,
56
57     MFACE_PROPERTY_MAX
58   };
59
60 struct MFace
61 {
62   M17NObject control;
63   /* Initialized to 0, and incremented by one each the face is
64      modified.  */
65   unsigned tick;
66   void *property[MFACE_PROPERTY_MAX];
67 };
68
69
70 /** A realized face is registered in MFrame->face_list, thus it does
71     not have to be a managed object.  */
72
73 struct MRealizedFace
74 {
75   /** Frame on which this realized face is created.  */
76   MFrame *frame;
77
78   /** Properties of all stacked faces are merged into here.  */
79   MFace face;
80
81   /** From what faces this is realized.  Keys are Mface and values are
82      (MFace *).  */
83   MPlist *base_face_list;
84
85   /* Initialized to the sum of ticks of the above faces.  */
86   unsigned tick;
87
88   /* Realized font, one of <frame>->realized_font_list.  */
89   MRealizedFont *rfont;
90
91   /* Realized fontset, one of <frame>->realized_fontset_list.  */
92   MRealizedFontset *rfontset;
93
94   MSymbol layouter;
95
96   MFaceHLineProp *hline;
97
98   MFaceBoxProp *box;
99
100   /** Realized face for ASCII chars that has the same face
101       properties. */
102   MRealizedFace *ascii_rface;
103
104   /** Realized face for undisplayable chars (no font found) that has
105       the same face properties. */
106   MRealizedFace *nofont_rface;
107
108   int ascent, descent;
109   int space_width;
110
111   /** Pointer to a window system dependent object.  */
112   void *info;
113 };
114
115
116 extern MFace *mface__default;
117
118 extern MRealizedFace *mface__realize (MFrame *frame, MFace **faces, int num,
119                                       MSymbol language, MSymbol charset,
120                                       int limitted_size);
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 #endif /* _M17N_FACE_H_ */