*** empty log message ***
[m17n/m17n-lib.git] / src / face.c
1 /* face.c -- 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 /***en
24     @addtogroup m17nFace
25     @brief A face is an object to control appearance of M-text.
26
27     A @e face is an object of the type #MFace and controls how to
28     draw M-texts.  A face has a fixed number of @e face @e properties.
29     Like other types of properties, a face property consists of a key
30     and a value.  A key is one of the following symbols:
31
32     #Mforeground, #Mbackground, #Mvideomode, #Mhline, #Mbox,
33     #Mfoundry, #Mfamily, #Mweight, #Mstyle, #Mstretch, #Madstyle,
34     #Msize, #Mfontset, #Mratio, #Mhook_func, #Mhook_arg
35
36     "The face property that belongs to face F and whose key is @c xxx"
37     may be shortened to "the xxx property of F".
38
39     The M-text drawing functions first search an M-text for the text
40     property whose key is the symbol #Mface, then draw the M-text
41     using the value of that text property.  This value must be a
42     pointer to a face object.
43
44     If there are multiple text properties whose key is @c Mface, and
45     they are not conflicting one another, properties of those faces
46     are merged and used.
47
48     If no faces specify a certain property, the value of the default
49     face is used.  */
50
51 /***ja
52     @addtogroup m17nFace
53     @brief ¥Õ¥§¡¼¥¹¤È¤Ï¡¢M-text ¤Îɽ¼¨¤òÀ©¸æ¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤¢¤ë
54
55     @e ¥Õ¥§¡¼¥¹ ¤Ï #MFace ·¿¤Î¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤¢¤ê¡¢M-text ¤Îɽ¼¨ÊýË¡
56     ¤òÀ©¸æ¤¹¤ë¡£¥Õ¥§¡¼¥¹¤Ï¸ÇÄê¸Ä¿ô¤Î @e ¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£ ¤ò»ý¤Ä¡£
57     ¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤Ï¥­¡¼¤ÈÃͤ«¤é¤Ê¤ë¡£¥­¡¼¤Ï¥·¥ó¥Ü¥ë¤Ç¤¢¤ê¡¢
58
59         #Mforeground, #Mbackground, #Mvideomode, #Mhline, #Mbox,
60         #Mfoundry, #Mfamily, #Mweight, #Mstyle, #Mstretch, #Madstyle,
61         #Msize, #Mfontset, #Mratio, #Mhook_func, #Mhook_arg
62
63     ¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ë¡£¥­¡¼¤¬ #Mfontset ¤Ê¤é¤ÐÃͤϥե©¥ó¥È¥»¥Ã¥È¤Ø¤Î
64     ¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£¥­¡¼¤¬ #Msize ¤Ê¤é¤ÐÃͤÏÀ°¿ô¤Ç¤¢¤ë¡£¥­¡¼¤¬¤½¤ì°Ê
65     ³°¤Ê¤é¤ÐÃͤϥ·¥ó¥Ü¥ë¤Ç¤¢¤ë¡£¡Ö¥Õ¥§¡¼¥¹ F ¤Î¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤Î¤¦
66     ¤Á¥­¡¼¤¬ @c Mxxx ¤Ç¤¢¤ë¤â¤Î¡×¤Î¤³¤È¤ò´Êñ¤Ë¡ÖF ¤Î xxx ¥×¥í¥Ñ¥Æ¥£¡×
67     ¤È¸Æ¤Ö¤³¤È¤¬¤¢¤ë¡£
68
69     Foreground ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢Á°·Ê¿§¤òɽ¤ï¤¹¡£
70
71     Background ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢ÇØ·Ê¿§¤òɽ¤ï¤¹¡£
72
73     Reverse ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢Á°·Ê¿§¤ÈÇØ·Ê¿§¤òÆþ¤ìÂؤ¨¤ë¤³¤È¤òɽ¤ï¤¹¡£
74
75     Underline ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢²¼Àþ¤ò°ú¤¯¤«Èݤ«¤òɽ¤ï¤¹¡£
76
77     Box ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢°Ï¤ßÏȤòɽ¼¨¤¹¤ë¤«Èݤ«¤òɽ¤ï¤¹¡£
78
79     Fontset ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢»ÈÍѤ¹¤ë¥Õ¥©¥ó¥È¥»¥Ã¥È¤òɽ¤ï¤¹¡£
80
81     Family ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢»ÈÍѤ¹¤ë¥Õ¥©¥ó¥È¤Î family ¥×¥í¥Ñ¥Æ¥£¤Î¥Ç
82     ¥Õ¥©¥ë¥ÈÃͤòɽ¤ï¤¹¡£
83
84     Weight ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢»ÈÍѤ¹¤ë¥Õ¥©¥ó¥È¤Î weight ¥×¥í¥Ñ¥Æ¥£¤Î¥Ç
85     ¥Õ¥©¥ë¥ÈÃͤòɽ¤ï¤¹¡£
86
87     Style ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢»ÈÍѤ¹¤ë¥Õ¥©¥ó¥È¤Î style ¥×¥í¥Ñ¥Æ¥£¤Î¥Ç¥Õ¥©
88     ¥ë¥ÈÃͤòɽ¤ï¤¹¡£
89
90     Stretch ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢»ÈÍѤ¹¤ë¥Õ¥©¥ó¥È¤Î stretch ¥×¥í¥Ñ¥Æ¥£¤Î
91     ¥Ç¥Õ¥©¥ë¥ÈÃͤòɽ¤ï¤¹¡£
92
93     Adstyle ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢»ÈÍѤ¹¤ë¥Õ¥©¥ó¥È¤Î adstyle ¥×¥í¥Ñ¥Æ¥£¤Î
94     ¥Ç¥Õ¥©¥ë¥ÈÃͤòɽ¤ï¤¹¡£
95
96     Size ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢»ÈÍѤ¹¤ë¥Õ¥©¥ó¥È¤Î size ¥×¥í¥Ñ¥Æ¥£¤Î¥Ç¥Õ¥©
97     ¥ë¥ÈÃͤòɽ¤ï¤¹¡£
98
99     M-text ¤Îɽ¼¨¤Ë´Ø¤¹¤ë m17n-win API ¤Î´Ø¿ô¤Ï¡¢¤Þ¤ººÇ½é¤Ë¤½¤Î M-text 
100     ¤«¤é¥­¡¼¤¬¥·¥ó¥Ü¥ë #Mface ¤Ç¤¢¤ë¤è¤¦¤Ê¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤òµá¤á¡¢
101     ¼¡¤Ë¤½¤ÎÃͤ˽¾¤Ã¤Æ M-text ¤òɽ¼¨¤¹¤ë¡£¤³¤ÎÃͤϥե§¡¼¥¹¥ª¥Ö¥¸¥§¥¯¥È
102     ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
103
104     ¤â¤· M-text ¤¬¡¢#Mface ¤ò¥­¡¼¤È¤¹¤ë¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤òÊ£¿ô»ý¤Ã
105     ¤Æ¤ª¤ê¡¢¤«¤Ä¤½¤ì¤é¤ÎÃͤδ֤˾×Æͤ¬¤Ê¤¤¤Ê¤é¤Ð¡¢¥Õ¥§¡¼¥¹¾ðÊó¤ÏÁȤ߹ç
106     ¤ï¤µ¤ì¤ÆÍѤ¤¤é¤ì¤ë¡£¾×Æͤ¬¤¢¤ë¾ì¹ç¤Ï¡¢ºÇ¾åÁؤΥե§¡¼¥¹¤¬ÍѤ¤¤é¤ì¤ë¡£
107
108     ¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ÎºÇ¸å¤Î6¸Ä¡¢¤¹¤Ê¤ï¤Á family, weight, sytle,
109     stretch, adstyle ¤ª¤è¤Ó size ¤ÎÃͤϠfontset Ãæ¤Î¥Õ¥©¥ó¥È¤¬¤½¤ì¤é¤ò
110     »ØÄꤷ¤Æ¤¤¤Ê¤¤¾ì¹ç¤Î¥Ç¥Õ¥©¥ë¥È¤È¤·¤ÆÍѤ¤¤é¤ì¤ë¡£
111
112     ¤¢¤ë¥Æ¥­¥¹¥È°À­¤¬¤É¤Î¥Õ¥§¡¼¥¹¤Ë¤è¤Ã¤Æ¤â»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ï¡¢¥Ç
113     ¥Õ¥©¥ë¥È¥Õ¥§¡¼¥¹¤ÎÃͤ¬ÍѤ¤¤é¤ì¤ë¡£  */
114
115 /*=*/
116
117 #if !defined (FOR_DOXYGEN) || defined (DOXYGEN_INTERNAL_MODULE)
118 /*** @addtogroup m17nInternal
119      @{ */
120
121 #include <stdio.h>
122 #include <stdlib.h>
123 #include <string.h>
124 #include <ctype.h>
125
126 #include "m17n-gui.h"
127 #include "m17n-misc.h"
128 #include "internal.h"
129 #include "charset.h"
130 #include "symbol.h"
131 #include "plist.h"
132 #include "mtext.h"
133 #include "textprop.h"
134 #include "internal-gui.h"
135 #include "face.h"
136 #include "font.h"
137 #include "fontset.h"
138
139 static M17NObjectArray face_table;
140
141 static MSymbol Mlatin;
142
143 static MSymbol M_face_prop_index;
144
145 /** Find a realized face registered on FRAME that is realized from
146     FACE and using font RFONT.  If RFONT is NULL, find any that
147     matches FACE.  */
148
149 static MRealizedFace *
150 find_realized_face (MFrame *frame, MFace *face, MRealizedFont *rfont)
151 {
152   MPlist *rface_list;
153   MRealizedFace *rface;
154   int i;
155
156   MPLIST_DO (rface_list, frame->realized_face_list)
157     {
158       rface = MPLIST_VAL (rface_list);
159       if (! rfont
160           || rface->rfont == rfont)
161         {
162           for (i = 0; i < MFACE_RATIO; i++)
163             if (rface->face.property[i] != face->property[i])
164               break;
165           if (i == MFACE_RATIO)
166             return rface;
167         }
168     }
169   return NULL;
170 }
171
172 static void
173 free_face (void *object)
174 {
175   MFace *face = (MFace *) object;
176
177   if (face->property[MFACE_FONTSET])
178     M17N_OBJECT_UNREF (face->property[MFACE_FONTSET]);
179   if (face->property[MFACE_HLINE])
180     free (face->property[MFACE_HLINE]);
181   if (face->property[MFACE_BOX])
182     free (face->property[MFACE_BOX]);
183   M17N_OBJECT_UNREGISTER (face_table, face);
184   free (object);
185 }
186
187
188 static MPlist *
189 serialize_hline (MPlist *plist, MFaceHLineProp *hline)
190 {
191   MPlist *pl = mplist ();
192
193   mplist_add (pl, Minteger, (void *) hline->type);
194   mplist_add (pl, Minteger, (void *) hline->width);
195   mplist_add (pl, Msymbol, hline->color);
196   plist = mplist_add (plist, Mplist, pl);
197   M17N_OBJECT_UNREF (pl);
198   return plist;
199 }
200
201 static MPlist *
202 serialize_box (MPlist *plist, MFaceBoxProp *box)
203 {
204   MPlist *pl = mplist ();
205
206   mplist_add (pl, Minteger, (void *) box->width);
207   mplist_add (pl, Minteger, (void *) box->inner_hmargin);
208   mplist_add (pl, Minteger, (void *) box->inner_vmargin);
209   mplist_add (pl, Minteger, (void *) box->outer_hmargin);
210   mplist_add (pl, Minteger, (void *) box->outer_vmargin);
211   mplist_add (pl, Msymbol, box->color_top);
212   mplist_add (pl, Msymbol, box->color_bottom);
213   mplist_add (pl, Msymbol, box->color_left);
214   mplist_add (pl, Msymbol, box->color_right);
215   plist = mplist_add (plist, Mplist, pl);
216   M17N_OBJECT_UNREF (pl);
217   return plist;
218 }
219
220 static MPlist *
221 serialize_face (void *val)
222 {
223   MFace *face = val;
224   MPlist *plist = mplist (), *pl = plist;
225   int i;
226   struct {
227     MSymbol *key;
228     MSymbol *type;
229     MPlist *(*func) (MPlist *plist, void *val);
230   } serializer[MFACE_PROPERTY_MAX]
231       = { { &Mfoundry,          &Msymbol },
232           { &Mfamily,           &Msymbol },
233           { &Mweight,           &Msymbol },
234           { &Mstyle,            &Msymbol },
235           { &Mstretch,          &Msymbol },
236           { &Madstyle,          &Msymbol },
237           { &Msize,             &Minteger },
238           { &Mfontset,          NULL },
239           { &Mforeground,       &Msymbol },
240           { &Mbackground,       &Msymbol },
241           { &Mhline,            NULL },
242           { &Mbox,              NULL },
243           { &Mvideomode,        &Msymbol },
244           { NULL,               NULL}, /* MFACE_HOOK_FUNC */
245           { NULL,               NULL}, /* MFACE_HOOK_ARG */
246           { &Mratio,            &Minteger } };
247   
248   for (i = 0; i < MFACE_PROPERTY_MAX; i++)
249     if (face->property[i] && serializer[i].key)
250       {
251         pl = mplist_add (pl, Msymbol, *serializer[i].key);
252         if (serializer[i].type)
253           pl = mplist_add (pl, *serializer[i].type, face->property[i]);
254         else if (i == MFACE_FONTSET)
255           pl = mplist_add (pl, Msymbol, mfontset_name ((MFontset *)
256                                                        face->property[i]));
257         else if (i == MFACE_HLINE)
258           pl = serialize_hline (pl, (MFaceHLineProp *) face->property[i]);
259         else if (i == MFACE_BOX)
260           pl = serialize_box (pl, (MFaceBoxProp *) face->property[i]);
261       }
262
263   return plist;
264 }
265
266 static void *
267 deserialize_hline (MPlist *plist)
268 {
269   MFaceHLineProp hline, *hline_ret;
270
271   if (! MPLIST_INTEGER_P (plist))
272     MERROR (MERROR_FACE, NULL);
273   hline.type = MPLIST_INTEGER_P (plist);
274   plist = MPLIST_NEXT (plist);
275   if (! MPLIST_INTEGER_P (plist))
276     MERROR (MERROR_FACE, NULL);
277   hline.width = MPLIST_INTEGER_P (plist);
278   plist = MPLIST_NEXT (plist);
279   if (! MPLIST_SYMBOL_P (plist))
280     MERROR (MERROR_FACE, NULL);
281   hline.color = MPLIST_SYMBOL (plist);
282   MSTRUCT_MALLOC (hline_ret, MERROR_FACE);
283   *hline_ret = hline;
284   return hline_ret;
285 }
286
287 static void *
288 deserialize_box (MPlist *plist)
289 {
290   MFaceBoxProp box, *box_ret;
291
292   if (! MPLIST_INTEGER_P (plist))
293     MERROR (MERROR_FACE, NULL);
294   box.width = MPLIST_INTEGER (plist);
295   plist = MPLIST_NEXT (plist);
296   if (! MPLIST_INTEGER_P (plist))
297     MERROR (MERROR_FACE, NULL);
298   box.inner_hmargin = MPLIST_INTEGER (plist);
299   plist = MPLIST_NEXT (plist);
300   if (! MPLIST_INTEGER_P (plist))
301     MERROR (MERROR_FACE, NULL);
302   box.inner_vmargin = MPLIST_INTEGER (plist);
303   plist = MPLIST_NEXT (plist);
304   if (! MPLIST_INTEGER_P (plist))
305     MERROR (MERROR_FACE, NULL);
306   box.outer_hmargin = MPLIST_INTEGER (plist);
307   plist = MPLIST_NEXT (plist);
308   if (! MPLIST_INTEGER_P (plist))
309     MERROR (MERROR_FACE, NULL);
310   box.outer_vmargin = MPLIST_INTEGER (plist);
311   plist = MPLIST_NEXT (plist);
312   if (! MPLIST_SYMBOL_P (plist))
313     MERROR (MERROR_FACE, NULL);
314   box.color_top = MPLIST_SYMBOL (plist);
315   plist = MPLIST_NEXT (plist);
316   if (! MPLIST_SYMBOL_P (plist))
317     MERROR (MERROR_FACE, NULL);
318   box.color_bottom = MPLIST_SYMBOL (plist);
319   plist = MPLIST_NEXT (plist);
320   if (! MPLIST_SYMBOL_P (plist))
321     MERROR (MERROR_FACE, NULL);
322   box.color_left = MPLIST_SYMBOL (plist);
323   plist = MPLIST_NEXT (plist);
324   if (! MPLIST_SYMBOL_P (plist))
325     MERROR (MERROR_FACE, NULL);
326   box.color_right = MPLIST_SYMBOL (plist);
327   MSTRUCT_MALLOC (box_ret, MERROR_FACE);
328   *box_ret = box;
329   return box_ret;
330 }
331
332 static void *
333 deserialize_face (MPlist *plist)
334 {
335   MFace *face = mface ();
336
337   MPLIST_DO (plist, plist)
338     {
339       MSymbol key;
340       int index;
341       void *val;
342
343       if (! MPLIST_SYMBOL_P (plist))
344         break;
345       key = MPLIST_SYMBOL (plist);
346       index = (int) msymbol_get (key, M_face_prop_index) - 1;
347       plist = MPLIST_NEXT (plist);
348       if (MPLIST_TAIL_P (plist))
349         break;
350       if (index < 0 || index >= MFACE_PROPERTY_MAX)
351         continue;
352       if (key == Mfoundry || key == Mfamily || key == Mweight || key == Mstyle
353           || key == Mstretch || key == Madstyle
354           || key == Mforeground || key == Mbackground || key == Mvideomode)
355         {
356           if (! MPLIST_SYMBOL_P (plist))
357             continue;
358           val = MPLIST_VAL (plist);
359         }
360       else if (key == Msize || key == Mratio)
361         {
362           if (! MPLIST_INTEGER_P (plist))
363             continue;
364           val = MPLIST_VAL (plist);
365         }
366       else if (key == Mfontset)
367         {
368           if (! MPLIST_SYMBOL_P (plist))
369             continue;
370           val = mfontset (MSYMBOL_NAME (MPLIST_SYMBOL (plist)));
371         }
372       else if (key == Mhline)
373         {
374           if (! MPLIST_PLIST_P (plist))
375             continue;
376           val = deserialize_hline (MPLIST_PLIST (plist));
377         }
378       else if (key == Mbox)
379         {
380           if (! MPLIST_PLIST_P (plist))
381             continue;
382           val = deserialize_box (MPLIST_PLIST (plist));
383         }
384       face->property[index] = val;
385     }
386   return face;
387 }
388
389 \f
390
391 /* Internal API */
392
393 MFace *mface__default;
394
395 int
396 mface__init ()
397 {
398   int i;
399
400   face_table.count = 0;
401   Mface = msymbol_as_managing_key ("face");
402   msymbol_put (Mface, Mtext_prop_serializer, (void *) serialize_face);
403   msymbol_put (Mface, Mtext_prop_deserializer, (void *) deserialize_face);
404
405   Mforeground = msymbol ("foreground");
406   Mbackground = msymbol ("background");
407   Mvideomode = msymbol ("videomode");
408   Mnormal = msymbol ("normal");
409   Mreverse = msymbol ("reverse");
410   Mratio = msymbol ("ratio");
411   Mhline = msymbol ("hline");
412   Mbox = msymbol ("box");
413   Mhook_func = msymbol ("hook-func");
414   Mhook_arg = msymbol ("hook-arg");
415
416   Mlatin = msymbol ("latin");
417   M_face_prop_index = msymbol ("  face-prop-index");
418
419   {
420     struct {
421       /* Pointer to the key symbol of the face property.  */
422       MSymbol *key;
423       /* Index (enum face_property) of the face property. */
424       int index;
425     } mface_prop_data[MFACE_PROPERTY_MAX] =
426         { { &Mfoundry,          MFACE_FOUNDRY },
427           { &Mfamily,           MFACE_FAMILY },
428           { &Mweight,           MFACE_WEIGHT },
429           { &Mstyle,            MFACE_STYLE },
430           { &Mstretch,          MFACE_STRETCH },
431           { &Madstyle,          MFACE_ADSTYLE },
432           { &Msize,             MFACE_SIZE },
433           { &Mfontset,          MFACE_FONTSET },
434           { &Mforeground,       MFACE_FOREGROUND },
435           { &Mbackground,       MFACE_BACKGROUND },
436           { &Mhline,            MFACE_HLINE },
437           { &Mbox,              MFACE_BOX },
438           { &Mvideomode,        MFACE_VIDEOMODE },
439           { &Mhook_func,        MFACE_HOOK_FUNC },
440           { &Mhook_arg,         MFACE_HOOK_ARG },
441           { &Mratio,            MFACE_RATIO },
442         };
443
444     for (i = 0; i < MFACE_PROPERTY_MAX; i++)
445       /* We add one to distinguish it from no-property.  */
446       msymbol_put (*mface_prop_data[i].key, M_face_prop_index,
447                    (void *) (mface_prop_data[i].index + 1));
448   }
449
450   mface__default = mface ();
451   mface__default->property[MFACE_WEIGHT] = msymbol ("medium");
452   mface__default->property[MFACE_STYLE] = msymbol ("r");
453   mface__default->property[MFACE_STRETCH] = msymbol ("normal");
454   mface__default->property[MFACE_SIZE] = (void *) 120;
455   mface__default->property[MFACE_FONTSET] = mfontset (NULL);
456   M17N_OBJECT_REF (mface__default->property[MFACE_FONTSET]);
457   /* mface__default->property[MFACE_FOREGROUND] =msymbol ("black"); */
458   /* mface__default->property[MFACE_BACKGROUND] =msymbol ("white"); */
459
460   mface_normal_video = mface ();
461   mface_normal_video->property[MFACE_VIDEOMODE] = (void *) Mnormal;
462
463   mface_reverse_video = mface ();
464   mface_reverse_video->property[MFACE_VIDEOMODE] = (void *) Mreverse;
465
466   {
467     MFaceHLineProp *hline_prop;
468
469     MSTRUCT_MALLOC (hline_prop, MERROR_FACE);
470     hline_prop->type = MFACE_HLINE_UNDER;
471     hline_prop->width = 1;
472     hline_prop->color = Mnil;
473     mface_underline = mface ();
474     mface_underline->property[MFACE_HLINE] = (void *) hline_prop;
475   }
476
477   mface_medium = mface ();
478   mface_medium->property[MFACE_WEIGHT] = (void *) msymbol ("medium");
479   mface_bold = mface ();
480   mface_bold->property[MFACE_WEIGHT] = (void *) msymbol ("bold");
481   mface_italic = mface ();
482   mface_italic->property[MFACE_STYLE] = (void *) msymbol ("i");
483   mface_bold_italic = mface_copy (mface_bold);
484   mface_bold_italic->property[MFACE_STYLE]
485     = mface_italic->property[MFACE_STYLE];
486
487   mface_xx_small = mface ();
488   mface_xx_small->property[MFACE_RATIO] = (void *) 50;
489   mface_x_small = mface ();
490   mface_x_small->property[MFACE_RATIO] = (void *) 67;
491   mface_small = mface ();
492   mface_small->property[MFACE_RATIO] = (void *) 75;
493   mface_normalsize = mface ();
494   mface_normalsize->property[MFACE_RATIO] = (void *) 100;
495   mface_large = mface ();
496   mface_large->property[MFACE_RATIO] = (void *) 120;
497   mface_x_large = mface ();
498   mface_x_large->property[MFACE_RATIO] = (void *) 150;
499   mface_xx_large = mface ();
500   mface_xx_large->property[MFACE_RATIO] = (void *) 200;
501
502   mface_black = mface ();
503   mface_black->property[MFACE_FOREGROUND] = (void *) msymbol ("black");
504   mface_white = mface ();
505   mface_white->property[MFACE_FOREGROUND] = (void *) msymbol ("white");
506   mface_red = mface ();
507   mface_red->property[MFACE_FOREGROUND] = (void *) msymbol ("red");
508   mface_green = mface ();
509   mface_green->property[MFACE_FOREGROUND] = (void *) msymbol ("green");
510   mface_blue = mface ();
511   mface_blue->property[MFACE_FOREGROUND] = (void *) msymbol ("blue");
512   mface_cyan = mface ();
513   mface_cyan->property[MFACE_FOREGROUND] = (void *) msymbol ("cyan");
514   mface_yellow = mface ();
515   mface_yellow->property[MFACE_FOREGROUND] = (void *) msymbol ("yellow");
516   mface_magenta = mface ();
517   mface_magenta->property[MFACE_FOREGROUND] = (void *) msymbol ("magenta");
518   return 0;
519 }
520
521 void
522 mface__fini ()
523 {
524   M17N_OBJECT_UNREF (mface__default);
525   M17N_OBJECT_UNREF (mface_normal_video);
526   M17N_OBJECT_UNREF (mface_reverse_video);
527   M17N_OBJECT_UNREF (mface_underline);
528   M17N_OBJECT_UNREF (mface_medium);
529   M17N_OBJECT_UNREF (mface_bold);
530   M17N_OBJECT_UNREF (mface_italic);
531   M17N_OBJECT_UNREF (mface_bold_italic);
532   M17N_OBJECT_UNREF (mface_xx_small);
533   M17N_OBJECT_UNREF (mface_x_small);
534   M17N_OBJECT_UNREF (mface_small);
535   M17N_OBJECT_UNREF (mface_normalsize);
536   M17N_OBJECT_UNREF (mface_large);
537   M17N_OBJECT_UNREF (mface_x_large);
538   M17N_OBJECT_UNREF (mface_xx_large);
539   M17N_OBJECT_UNREF (mface_black);
540   M17N_OBJECT_UNREF (mface_white);
541   M17N_OBJECT_UNREF (mface_red);
542   M17N_OBJECT_UNREF (mface_green);
543   M17N_OBJECT_UNREF (mface_blue);
544   M17N_OBJECT_UNREF (mface_cyan);
545   M17N_OBJECT_UNREF (mface_yellow);
546   M17N_OBJECT_UNREF (mface_magenta);
547   mdebug__report_object ("Face", &face_table);
548 }
549
550 /** Return a realized face for ASCII characters from NUM number of
551     base faces pointed by FACES on the frame FRAME.  */
552
553 MRealizedFace *
554 mface__realize (MFrame *frame, MFace **faces, int num,
555                 MSymbol language, MSymbol charset, int size)
556 {
557   MRealizedFace *rface;
558   MRealizedFont *rfont;
559   MFace merged_face = *(frame->face);
560   void **props;
561   int i, j;
562   unsigned tick;
563   MGlyph g;
564
565   if (num == 0 && language == Mnil && charset == Mnil && frame->rface)
566     return frame->rface;
567
568   for (i = 0; i < MFACE_PROPERTY_MAX; i++)
569     for (j = num - 1; j >= 0; j--)
570       if (faces[j]->property[i])
571         {
572           merged_face.property[i] = faces[j]->property[i];
573           break;
574         }
575
576   for (i = 0, tick = 0; i < num; i++)
577     tick += faces[i]->tick;
578
579   if (merged_face.property[MFACE_RATIO])
580     {
581       int font_size = (int) merged_face.property[MFACE_SIZE];
582
583       font_size *= (int) merged_face.property[MFACE_RATIO];
584       font_size /= 100;
585       merged_face.property[MFACE_SIZE] = (void *) font_size;
586     }
587
588   if ((MSymbol) merged_face.property[MFACE_VIDEOMODE] == Mreverse)
589     {
590       MSymbol foreground = (MSymbol) merged_face.property[MFACE_FOREGROUND];
591       MSymbol background = (MSymbol) merged_face.property[MFACE_BACKGROUND];
592
593       merged_face.property[MFACE_FOREGROUND] = background;
594       merged_face.property[MFACE_BACKGROUND] = foreground;
595     }
596
597   rface = find_realized_face (frame, &merged_face, NULL);
598   if (rface && rface->tick == tick)
599     return rface->ascii_rface;
600
601   MSTRUCT_CALLOC (rface, MERROR_FACE);
602   rface->frame = frame;
603   rface->face = merged_face;
604   rface->tick = tick;
605   props = rface->face.property;
606
607   rface->rfontset = mfont__realize_fontset (frame,
608                                             (MFontset *) props[MFACE_FONTSET],
609                                             &merged_face);
610   g.c = ' ';
611   num = 1;
612   rfont = mfont__lookup_fontset (rface->rfontset, &g, &num,
613                                  msymbol ("latin"), language, Mnil,
614                                  size);
615
616   if (rfont)
617     {
618       rface->rfont = rfont;
619       g.otf_encoded = 0;
620       mfont__get_metric (rfont, &g);
621       rface->space_width = g.width;
622       g.code = MCHAR_INVALID_CODE;
623       mfont__get_metric (rface->rfont, &g);
624       rface->ascent = g.ascent;
625       rface->descent = g.descent;
626     }
627   else
628     {
629       rface->rfont = NULL;
630       rface->space_width = frame->space_width;
631     }
632
633   rface->hline = (MFaceHLineProp *) props[MFACE_HLINE];
634   rface->box = (MFaceBoxProp *) props[MFACE_BOX];
635   rface->ascii_rface = rface;
636   mwin__realize_face (rface);
637
638   mplist_add (frame->realized_face_list, Mt, rface);
639
640   if (rface->rfont)
641     {
642       MSTRUCT_CALLOC (rface->nofont_rface, MERROR_FACE);
643       *rface->nofont_rface = *rface;
644       rface->nofont_rface->rfont = NULL;
645     }
646   else
647     rface->nofont_rface = rface;
648
649   return rface;
650 }
651
652
653 MGlyph *
654 mface__for_chars (MSymbol script, MSymbol language, MSymbol charset,
655                   MGlyph *from_g, MGlyph *to_g, int size)
656 {
657   MRealizedFace *rface;
658   MRealizedFont *rfont;
659   int num = to_g - from_g, i;
660
661   rfont = mfont__lookup_fontset (from_g->rface->rfontset, from_g, &num,
662                                  script, language, charset, size);
663   if (! rfont)
664     {
665       from_g->rface = from_g->rface->nofont_rface;
666       return (from_g + 1);
667     }
668   rface = find_realized_face (from_g->rface->frame, &(from_g->rface->face),
669                               rfont);
670   if (! rface)
671     {
672       MSTRUCT_MALLOC (rface, MERROR_FACE);
673       *rface = *from_g->rface->ascii_rface;
674       rface->rfont = rfont;
675       {
676         MGlyph tmp;
677
678         tmp.code = MCHAR_INVALID_CODE;
679         mfont__get_metric (rfont, &tmp);
680         rface->ascent = tmp.ascent;
681         rface->descent = tmp.descent;
682       }
683       mwin__realize_face (rface);
684       mplist_add (from_g->rface->frame->realized_face_list, Mt, rface);
685     }
686
687   for (i = 0; i < num; i++, from_g++)
688     from_g->rface = rface;
689   return from_g;
690 }
691
692
693 void
694 mface__free_realized (MRealizedFace *rface)
695 {
696   mwin__free_realized_face (rface);
697   if (rface == rface->ascii_rface)
698     {
699       if (! rface->nofont_rface)
700         mdebug_hook ();
701       else
702         free (rface->nofont_rface);
703       rface->nofont_rface = NULL;
704     }
705   free (rface);
706 }
707
708 /*** @} */
709 #endif /* !FOR_DOXYGEN || DOXYGEN_INTERNAL_MODULE */
710
711 \f
712 /* External API  */
713 /*** @addtogroup m17nFace */
714 /*** @{ */
715 /*=*/
716
717 /***en @name Variables: Keys of face property */
718 /***ja @name ÊÑ¿ô: ¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ò»ØÄꤹ¤ëÄêµÁºÑ¤ß¥·¥ó¥Ü¥ë  */
719 /*** @{ */
720 /*=*/
721
722 /***en
723     @brief Key of a face property specifying foreground color.
724
725     The variable #Mforeground is used as a key of face property.  The
726     property value must be a symbol whose name is a color name, or
727     #Mnil.
728
729     #Mnil means that the face does not specify a foreground color.
730
731     Otherwise, the foreground of an M-text is drawn by the specified
732     color.  */
733
734 /***ja
735     @brief Á°·Ê¿§¤ò»ØÄꤹ¤ë¤¿¤á¤Î¥·¥ó¥Ü¥ë
736
737     ¥­¡¼¤¬ #Mforeground ¤Ç¤¢¤ë¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢¥·¥ó¥Ü¥ë @c
738     Mnil ¤Ç¤¢¤ë¤«¡¢¤¢¤ë¤¤¤Ï¿§Ì¾¤ò̾Á°¤È¤·¤Æ»ý¤Ä¥·¥ó¥Ü¥ë¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é
739     ¤Ê¤¤¡£Á°¼Ô¤Î¾ì¹ç¡¢Á°·Ê¿§¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¸å¼Ô¤Î¾ì¹ç¤Ï¤½¤Î¥·¥ó¥Ü¥ë¤Î
740     Ì¾Á°¤Î¿§¤¬Á°·Ê¿§¤È¤Ê¤ë¡£  */
741
742 MSymbol Mforeground;
743
744 /***en
745     @brief Key of a face property specifying background color.
746
747     The variable #Mbackground is used as a key of face property.  The
748     property value must be a symbol whose name is a color name, or
749     #Mnil.
750
751     #Mnil means that the face does not specify a background color.
752
753     Otherwise, the background of an M-text is drawn by the specified
754     color.  */
755
756 /***ja
757     @brief ÇØ·Ê¿§¤ò»ØÄꤹ¤ë¤¿¤á¤Î¥·¥ó¥Ü¥ë
758
759     ¥­¡¼¤¬ #Mbackground ¤Ç¤¢¤ë¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢¥·¥ó¥Ü¥ë @c
760     Mnil ¤Ç¤¢¤ë¤«¡¢¤¢¤ë¤¤¤Ï¿§Ì¾¤ò̾Á°¤È¤·¤Æ»ý¤Ä¥·¥ó¥Ü¥ë¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é
761     ¤Ê¤¤¡£Á°¼Ô¤Î¾ì¹ç¡¢ÇØ·Ê¿§¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¸å¼Ô¤Î¾ì¹ç¤Ï¤½¤Î¥·¥ó¥Ü¥ë¤Î
762     Ì¾Á°¤Î¿§¤¬ÇØ·Ê¿§¤È¤Ê¤ë¡£  */
763
764 MSymbol Mbackground;
765
766 /***en
767     @brief Key of a face property specifying video mode.
768
769     The variable #Mvideomode is used as a key of face property.  The
770     property value must be #Mnormal, #Mreverse, or #Mnil.
771
772     #Mnormal means that an M-text is drawn in normal video mode
773     (i.e. the foreground is drawn by foreground color, the background
774     is drawn by background color).
775
776     #Mreverse means that an M-text is drawn in reverse video mode
777     (i.e. the foreground is drawn by background color, the background
778     is drawn by foreground color).
779
780     #Mnil means that the face does not specify a video mode.  */
781
782 /***ja
783     @brief ¥Ó¥Ç¥ª¥â¡¼¥É¤ò»ØÄꤹ¤ë¤¿¤á¤Î¥·¥ó¥Ü¥ë
784
785     ¥­¡¼¤¬ #Mvideomode ¤Ç¤¢¤ë¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϥ·¥ó¥Ü¥ë¤Ç¤Ê¤±
786     ¤ì¤Ð¤Ê¤é¤Ê¤¤¡£¤â¤· #Mreverse ¤Î¾ì¹ç¤ÏÁ°·Ê¿§¤ÈÇطʼ￧¤òÆþ¤ìÂؤ¨
787     ¤ÆÍѤ¤¤ë¡£#Mnil ¤Î¾ì¹ç¤Ï¥Ó¥Ç¥ª¥â¡¼¥É¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤½¤ì°Ê³°¤Î¥·
788     ¥ó¥Ü¥ë¤Î¾ì¹çÁ°·Ê¿§¤ÈÇطʼ￧¤òÆþ¤ìÂؤ¨¤ò¹Ô¤Ê¤ï¤Ê¤¤¡£ */
789
790 MSymbol Mvideomode;
791
792 /***en
793     @brief Key of a face property specifying font size ratio.
794
795     The variable #Mratio is used as a key of face property.  The value
796     RATIO must be an integer.
797
798     The value @c NULL means that the face does not specify a
799     horizontal line.  Otherwise, an M-text is drawn by a font of size
800     (FONTSIZE * RATIO / 100) where FONTSIZE is a font size specified
801     by the face property #Msize.  */
802
803 MSymbol Mratio;
804
805 /***en
806     @brief Key of a face property specifying horizontal line.
807
808     The variable #Mhline is used as a key of face property.  The value
809     must be a pointer to an object of type #MFaceHLineProp, or @c
810     NULL.
811
812     The value @c NULL means that the face does not specify this
813     property.  Otherwise, an M-text is drawn with a horizontal line by
814     a way specified by the object that the value points to.  */
815
816 /***ja
817     @brief ²¼Àþ¤ò»ØÄꤹ¤ë¤¿¤á¤Î¥·¥ó¥Ü¥ë
818
819     ¥­¡¼¤¬ #Munderline ¤Ç¤¢¤ë¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢¥·¥ó¥Ü¥ë
820     #Mt, #Mnil, #Munspecified ¤Î¤¤¤º¤ì¤«¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£#Mt 
821     ¤Î¾ì¹ç¤Ï²¼ÀþÉÕ¤­¤Çɽ¼¨¤¹¤ë¡£#Mnil ¤Î¾ì¹ç¤Ï²¼Àþ¤òÉÕ¤±¤Ê¤¤¡£
822     #Munspecified ¤Î¾ì¹ç¤Ï¤É¤Á¤é¤È¤â»ØÄꤵ¤ì¤Ê¤¤¡£  */
823
824 MSymbol Mhline;
825
826 /***en
827     @brief Key of a face property specifying box.
828
829     The variable #Mbox is used as a key of face property.  The value
830     must be a pointer to an object of type #MFaceBoxProp, or @c NULL.
831
832     The value @c NULL means that the face does not specify a box.
833     Otherwise, an M-text is drawn with a surrounding box by a way
834     specified by the object that the value points to.  */
835
836 /***ja
837     @brief °Ï¤ßÏȤò»ØÄꤹ¤ë¤¿¤á¤Î¥·¥ó¥Ü¥ë
838
839     ¥­¡¼¤¬ #Mbox ¤Ç¤¢¤ë¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢¥·¥ó¥Ü¥ë #Mt, @c
840     Mnil, #Munspecified ¤Î¤¤¤º¤ì¤«¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£#Mt ¤Î¾ì¹ç
841     ¤Ï°Ï¤ßÏÈÉÕ¤­¤Çɽ¼¨¤¹¤ë¡£#Mnil ¤Î¾ì¹ç¤Ï°Ï¤ßÏȤòÉÕ¤±¤Ê¤¤¡£@c
842     Munspecified ¤Î¾ì¹ç¤Ï¤É¤Á¤é¤È¤â»ØÄꤵ¤ì¤Ê¤¤¡£  */
843
844 MSymbol Mbox;
845
846 /***en
847     @brief Key of a face property specifying fontset. 
848
849     The variable #Mfontset is used as a key of face property.  The
850     value must be a pointer to an object of type #Mfontset, or @c
851     NULL.
852
853     The value @c NULL means that the face does not specify a fontset.
854     Otherwise, an M-text is drawn with a font selected from what
855     specified in the fontset.  */
856
857 /***ja
858     @brief ¥Õ¥©¥ó¥È¥»¥Ã¥È¤ò»ØÄꤹ¤ë¤¿¤á¤Î¥·¥ó¥Ü¥ë 
859
860     ¥­¡¼¤¬ #Mfontset ¤Ç¤¢¤ë¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢¥·¥ó¥Ü¥ë @c
861     Munspecified ¤Ç¤¢¤ë¤«¡¢¤µ¤â¤Ê¤¯¤Ð¥Õ¥©¥ó¥È¥»¥Ã¥È¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤±
862     ¤ì¤Ð¤Ê¤é¤Ê¤¤¡£Á°¼Ô¤Î¾ì¹ç¤Ï¥Õ¥©¥ó¥È¥»¥Ã¥È¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¤³¤È¤ò¼¨
863     ¤·¡¢¸å¼Ô¤Î¾ì¹ç¤Ï¤½¤Î¥Ý¥¤¥ó¥¿¤Î»Ø¤¹¥Õ¥©¥ó¥È¥»¥Ã¥È¤¬¥Æ¥­¥¹¥Èɽ¼¨¤ËÍÑ
864     ¤¤¤é¤ì¤ë¡£  */
865
866 MSymbol Mfontset;
867
868 /***en
869     @brief Key of a face property specifying hook.
870
871     The variable #Mhook_func is used as a key of face property.  The
872     value must be a function of type #MFaceHookFunc, or @c NULL.
873
874     The value @c NULL means that the face does not specify a hook.
875     Otherwise, the specified function is called before the face is
876     realized.  */
877
878 MSymbol Mhook_func;
879
880 /***en
881     @brief Key of a face property specifying argument of hook.
882
883     The variable #Mhook_arg is used as a key of face property.  The
884     value can be anything that is passed a hook function specified by
885     the face property #Mhook_func.  */
886
887 MSymbol Mhook_arg;
888
889 /*** @} */
890 /*=*/
891
892 /*** @ingroup m17nFace */
893 /***en @name Variables: Possible values of #Mvideomode property of face */
894 /*** @{ */
895 /*=*/
896
897 /***en
898     See the documentation of the variable #Mvideomode.  */ 
899 MSymbol Mnormal;
900 MSymbol Mreverse;
901 /*** @} */
902 /*=*/
903
904 /*** @ingroup m17nFace */
905 /***en @name Variables: Predefined faces  */
906 /***ja @name ÊÑ¿ô: ÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹  */
907 /*** @{ */
908 /*=*/
909
910 /***en
911     @brief Normal video face
912
913     The variable #mface_normal_video points to a face that has the
914     #Mvideomode property with value #Mnormal.  The other properties
915     are not specified.  An M-text drawn with this face appear normal
916     colors (i.e. the foreground is drawn by foreground color, and
917     background is drawn by background color).  */
918
919 MFace *mface_normal_video;
920
921 /***en
922     @brief Reverse video face
923
924     The variable #mface_reverse_video points to a face that has the
925     #Mvideomode property with value #Mreverse.  The other properties
926     are not specified.  An M-text drawn with this face appear in
927     reversed colors (i.e. the foreground is drawn by background
928     color, and background is drawn by foreground color).  */
929
930 /***ja
931     @brief ¥ê¥Ð¡¼¥¹¥Õ¥§¡¼¥¹
932
933     ¥Ý¥¤¥ó¥¿ #maface_reverse ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Ï¡¢²¼
934     ¤Ë¼¨¤¹¤è¤¦¤Ê¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ò»ý¤Ä¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì
935     ¤¿ M-text ¤ÏÁ°·Ê¿§¤ÈÇØ·Ê¿§¤¬Æþ¤ìÂؤï¤ë¡£  */
936
937 MFace *mface_reverse_video;
938
939 /***en
940     @brief Underline face.
941
942     The variable #mface_underline points to a face that has the
943     #Mhline property with value a pointer to an object of type
944     #MFaceHLineProp.  The members of the object are as follows:
945
946 @verbatim
947     member  value
948     -----   -----
949     type    MFACE_HLINE_UNDER
950     width   1
951     color   Mnil
952 @endverbatim
953
954     The other properties are not specified.  An M-text that has this
955     face is drawn with an underline.  */ 
956
957 MFace *mface_underline;
958
959 /***en
960     @brief Medium face.
961
962     The variable #mface_medium points to a face that has the #Mweight
963     property with value a symbol of name "medium".  The other
964     properties are not specified.  An M-text that has this face is
965     drawn with a font of medium weight.  */
966 MFace *mface_medium;
967
968 /***en
969     @brief Bold face
970
971     The variable #mface_bold points to a face that has the #Mweight
972     property with value a symbol of name "bold".  The other properties
973     are not specified.  An M-text that has this face is drawn with a
974     font of bold weight.  */
975
976 /***ja
977     @brief ¥Ü¡¼¥ë¥É¥Õ¥§¡¼¥¹
978
979     ¥Ý¥¤¥ó¥¿ #mface_bold ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Ï¡¢weight 
980     ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ¥Ü¡¼¥ë¥ÉÂΤò°ÕÌ£¤¹¤ë¥·¥¹¥Æ¥à°Í¸¤Î¥·¥ó¥Ü¥ë¤ò»ý
981     ¤Ä¡£Â¾¤Î¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϲ¼¤Ë¼¨¤¹¤È¤ª¤ê¤Ç¤¢¤ë¡£¤³¤Î¥Õ¥§¡¼¥¹
982     ¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤Ï¥Ü¡¼¥ë¥ÉÂΤȤʤ롣  */
983
984 MFace *mface_bold;
985
986 /***en
987     @brief Italic face
988
989     The variable #mface_italic points to a face that has the #Mstyle
990     property with value a symbol of name "italic".  The other
991     properties are not specified.  An M-text that has this face is
992     drawn with a font of italic style.  */
993
994 /***ja
995     @brief ¥¤¥¿¥ê¥Ã¥¯¥Õ¥§¡¼¥¹
996
997     ¥Ý¥¤¥ó¥¿ #mface_italic ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Ï¡¢style 
998     ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ¥¤¥¿¥ê¥Ã¥¯ÂΤò°ÕÌ£¤¹¤ë¥·¥¹¥Æ¥à°Í¸¤Î¥·¥ó¥Ü¥ë¤ò
999     »ý¤Ä¡£Â¾¤Î¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϲ¼¤Ë¼¨¤¹Ä̤ê¤Ç¤¢¤ë¡£¤³¤Î¥Õ¥§¡¼¥¹
1000     ¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤Ï¥¤¥¿¥ê¥Ã¥¯ÂΤȤʤ롣  */
1001
1002 MFace *mface_italic;
1003
1004 /***en
1005     @brief Bold italic face
1006
1007     The variable #mface_bold_italic points to a face that has the
1008     #Mweight property with value a symbol of name "bold", and #Mstyle
1009     property with value a symbol of name "italic".  The other
1010     properties are not specified.  An M-text that has this face is
1011     drawn with a font of bold weight and italic style.  */
1012
1013 /***ja
1014     @brief ¥Ü¡¼¥ë¥É¥¤¥¿¥ê¥Ã¥¯¥Õ¥§¡¼¥¹
1015
1016     ¥Ý¥¤¥ó¥¿ #mface_bold_italic ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Î
1017     ¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤Ï¡¢weight ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ¥Ü¡¼¥ë¥ÉÂΤò°ÕÌ£
1018     ¤¹¤ë¥·¥¹¥Æ¥à°Í¸¤Î¥·¥ó¥Ü¥ë¤ò¡¢style ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ¥¤¥¿¥ê¥Ã¥¯
1019     ÂΤò°ÕÌ£¤¹¤ë¥·¥¹¥Æ¥à°Í¸¤Î¥·¥ó¥Ü¥ë¤ò¡¢¤½¤ì°Ê³°¤Î¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£
1020     ¤ÎÃͤȤ·¤Æ²¼¤Ë¼¨¤¹¤â¤Î¤ò¤½¤ì¤¾¤ì»ý¤Ä¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì
1021     ¤¿ M-text ¤Ï¥Ü¡¼¥ë¥É¥¤¥¿¥ê¥Ã¥¯ÂΤȤʤ롣  */
1022
1023 MFace *mface_bold_italic;
1024
1025 /***en
1026     @brief Smallest face
1027
1028     The variable #mface_xx_small points to a face that has the #Mratio
1029     property with value 50.  The other properties are not specified.
1030     An M-text that has this face is drawn with a font whose size is
1031     50% of a normal font.  */
1032
1033 /***ja
1034     @brief ºÇ¾®¤Î¥Õ¥§¡¼¥¹
1035
1036     ¥Ý¥¤¥ó¥¿ #mface_xx_small ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Ï¡¢²¼
1037     ¤Ë¼¨¤¹¤è¤¦¤Ê¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ò»ý¤Ä¡£¤³¤³¤Ç @c N ¤Ï @c
1038     mface_normalsize ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Î size ¥×¥í¥Ñ¥Æ¥£
1039     ¤ÎÃͤǤ¢¤ë¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤ÎÂ礭¤µ¤Ï¡¢ @c
1040     mface_normalsize ¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤ÎÂ礭¤µ¤Î 50% ¤Ë¤Ê¤ë¡£
1041      */
1042
1043 MFace *mface_xx_small;
1044
1045 /***en
1046     @brief Smaller face
1047
1048     The variable #mface_x_small points to a face that has the #Mratio
1049     property with value 66.  The other properties are not specified.
1050     An M-text that has this face is drawn with a font whose size is
1051     66% of a normal font.  */
1052
1053 /***ja
1054     @brief ¤è¤ê¾®¤µ¤¤¥Õ¥§¡¼¥¹
1055
1056     ¥Ý¥¤¥ó¥¿ #mface_x_small ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Ï¡¢²¼
1057     ¤Ë¼¨¤¹¤è¤¦¤Ê¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ò»ý¤Ä¡£¤³¤³¤Ç @c N ¤Ï
1058     #mface_normalsize ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Î size ¥×¥í¥Ñ¥Æ¥£
1059     ¤ÎÃͤǤ¢¤ë¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤ÎÂ礭¤µ¤Ï¡¢
1060     #mface_normalsize ¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤ÎÂ礭¤µ¤Î 66% ¤Ë¤Ê¤ë¡£
1061      */
1062
1063 MFace *mface_x_small;
1064
1065 /***en
1066     @brief Small face
1067
1068     The variable #mface_x_small points to a face that has the #Mratio
1069     property with value 75.  The other properties are not specified.
1070     An M-text that has this face is drawn with a font whose size is
1071     75% of a normal font.  */
1072
1073 /***ja
1074     @brief ¾®¤µ¤¤¥Õ¥§¡¼¥¹
1075
1076     ¥Ý¥¤¥ó¥¿ #mface_small ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Ï¡¢²¼
1077     ¤Ë¼¨¤¹¤è¤¦¤Ê¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ò»ý¤Ä¡£¤³¤³¤Ç @c N ¤Ï
1078     #mface_normalsize ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Î size ¥×¥í¥Ñ¥Æ¥£
1079     ¤ÎÃͤǤ¢¤ë¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤ÎÂ礭¤µ¤Ï¡¢
1080     #mface_normalsize ¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤ÎÂ礭¤µ¤Î 75% ¤Ë¤Ê¤ë¡£
1081      */
1082
1083 MFace *mface_small;
1084
1085 /***en
1086     @brief Normalsize face
1087
1088     The variable #mface_normalsize points to a face that has the
1089     #Mratio property with value 100.  The other properties are not
1090     specified.  An M-text that has this face is drawn with a font
1091     whose size is the same as a normal font.  */
1092
1093 /***ja
1094     @brief É¸½à¤ÎÂ礭¤µ¤Î¥Õ¥§¡¼¥¹
1095
1096     ¥Ý¥¤¥ó¥¿ #mface_normalsize ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Ï¡¢²¼¤Ë
1097     ¼¨¤¹¤è¤¦¤Ê¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ò»ý¤Ä¡£¤³¤³¤Ç @c N ¤Ï¥Ý¥¤¥ó¥È¥µ¥¤¥º¤ò
1098     É½¤ï¤¹À°¿ô¤Ç¤¢¤ë¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤ÎÂ礭¤µ¤Ï¡¢
1099     ¥Ç¥Õ¥©¥ë¥È¥Õ¥ì¡¼¥à¤Î¥Ç¥Õ¥©¥ë¥È¥Õ¥©¥ó¥È¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤Î
1100     Â礭¤µ¤ËÅù¤·¤¤¡£  */
1101
1102 MFace *mface_normalsize;
1103
1104 /***en
1105     @brief Large face
1106
1107     The variable #mface_large points to a face that has the #Mratio
1108     property with value 120.  The other properties are not specified.
1109     An M-text that has this face is drawn with a font whose size is
1110     120% of a normal font.  */
1111
1112 /***ja
1113     @brief Â礭¤¤¥Õ¥§¡¼¥¹
1114
1115     ¥Ý¥¤¥ó¥¿ #mface_large ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Ï¡¢²¼
1116     ¤Ë¼¨¤¹¤è¤¦¤Ê¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ò»ý¤Ä¡£¤³¤³¤Ç @c N ¤Ï
1117     #mface_normalsize ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Î size ¥×¥í¥Ñ¥Æ¥£
1118     ¤ÎÃͤǤ¢¤ë¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤ÎÂ礭¤µ¤Ï¡¢
1119     #mface_normalsize ¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤ÎÂ礭¤µ¤Î 120% ¤Ë¤Ê¤ë¡£
1120      */
1121
1122 MFace *mface_large;
1123
1124 /***en
1125     @brief Larger face
1126
1127     The variable #mface_x_large points to a face that has the #Mratio
1128     property with value 150.  The other properties are not specified.
1129     An M-text that has this face is drawn with a font whose size is
1130     150% of a normal font.  */
1131
1132 /***ja
1133     @brief ¤è¤êÂ礭¤¤¥Õ¥§¡¼¥¹
1134
1135     ¥Ý¥¤¥ó¥¿ #mface_x_large ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Ï¡¢²¼
1136     ¤Ë¼¨¤¹¤è¤¦¤Ê¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ò»ý¤Ä¡£¤³¤³¤Ç @c N ¤Ï
1137     #mface_normalsize ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Î size ¥×¥í¥Ñ¥Æ¥£
1138     ¤ÎÃͤǤ¢¤ë¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤ÎÂ礭¤µ¤Ï¡¢
1139     #mface_normalsize ¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤ÎÂ礭¤µ¤Î 150% ¤Ë¤Ê¤ë¡£
1140      */
1141
1142 MFace *mface_x_large;
1143
1144 /***en
1145     @brief Largest face
1146
1147     The variable #mface_xx_large points to a face that has the #Mratio
1148     property with value 200.  The other properties are not specified.
1149     An M-text that has this face is drawn with a font whose size is
1150     200% of a normal font.  */
1151
1152 /***ja
1153     @brief ºÇÂç¤Î¥Õ¥§¡¼¥¹
1154
1155     ¥Ý¥¤¥ó¥¿ #mface_xx_large ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Ï¡¢²¼
1156     ¤Ë¼¨¤¹¤è¤¦¤Ê¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ò»ý¤Ä¡£¤³¤³¤Ç @c N ¤Ï
1157     #mface_normalsize ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Î size ¥×¥í¥Ñ¥Æ¥£
1158     ¤ÎÃͤǤ¢¤ë¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤ÎÂ礭¤µ¤Ï¡¢
1159     #mface_normalsize ¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤ÎÂ礭¤µ¤Î 200% ¤Ë¤Ê¤ë¡£
1160      */
1161
1162 MFace *mface_xx_large;
1163
1164 /***en
1165     @brief Black face
1166
1167     The variable #mface_black points to a face that has the
1168     #Mforeground property with value a symbol of name "black".  The
1169     other properties are not specified.  An M-text that has this face
1170     is drawn with black foreground.  */
1171
1172 /***ja
1173     @brief ¹õ¥Õ¥§¡¼¥¹
1174
1175     ¥Ý¥¤¥ó¥¿ #mface_black ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Ï¡¢
1176     #Mforeground ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ<tt>"black"</tt> ¤È¤¤¤¦Ì¾Á°¤Î¥·¥ó¥Ü
1177     ¥ë¤ò»ý¤Ä¡£Â¾¤Î¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϲ¼¤Ë¼¨¤¹¤È¤ª¤ê¤Ç¤¢¤ë¡£¤³¤Î
1178     ¥Õ¥§¡¼¥¹¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤ÎÁ°·Ê¿§¤Ï¹õ¤Ë¤Ê¤ë¡£  */
1179
1180 MFace *mface_black;
1181
1182 /***en
1183     @brief White face
1184
1185     The variable #mface_white points to a face that has the
1186     #Mforeground property with value a symbol of name "white".  The
1187     other properties are not specified.  An M-text that has this face
1188     is drawn with white foreground.  */
1189
1190 /***ja
1191     @brief Çò¥Õ¥§¡¼¥¹
1192
1193     ¥Ý¥¤¥ó¥¿ #mface_white ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Ï¡¢
1194     foreground ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ<tt>"white"</tt> ¤È¤¤¤¦Ì¾Á°¤Î¥·¥ó¥Ü
1195     ¥ë¤ò»ý¤Ä¡£Â¾¤Î¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϲ¼¤Ë¼¨¤¹¤È¤ª¤ê¤Ç¤¢¤ë¡£¤³¤Î
1196     ¥Õ¥§¡¼¥¹¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤ÎÁ°·Ê¿§¤ÏÇò¤Ë¤Ê¤ë¡£  */
1197
1198 MFace *mface_white;
1199
1200 /***en
1201     @brief Red face
1202
1203     The variable #mface_red points to a face that has the
1204     #Mforeground property with value a symbol of name "red".  The
1205     other properties are not specified.  An M-text that has this face
1206     is drawn with red foreground.  */
1207
1208 /***ja
1209     @brief ÀÖ¥Õ¥§¡¼¥¹
1210
1211     ¥Ý¥¤¥ó¥¿ #mface_red ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Ï¡¢
1212     foreground ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ<tt>"red"</tt> ¤È¤¤¤¦Ì¾Á°¤Î¥·¥ó¥Ü
1213     ¥ë¤ò»ý¤Ä¡£Â¾¤Î¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϲ¼¤Ë¼¨¤¹¤È¤ª¤ê¤Ç¤¢¤ë¡£¤³¤Î
1214     ¥Õ¥§¡¼¥¹¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤ÎÁ°·Ê¿§¤ÏÀ֤ˤʤ롣  */
1215
1216 MFace *mface_red;
1217
1218 /***en
1219     @brief Green face
1220
1221     The variable #mface_green points to a face that has the
1222     #Mforeground property with value a symbol of name "green".  The
1223     other properties are not specified.  An M-text that has this face
1224     is drawn with green foreground.  */
1225
1226 /***ja
1227     @brief ÎÐ¥Õ¥§¡¼¥¹
1228
1229     ¥Ý¥¤¥ó¥¿ #mface_green ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Ï¡¢
1230     foreground ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ<tt>"green"</tt> ¤È¤¤¤¦Ì¾Á°¤Î¥·¥ó¥Ü
1231     ¥ë¤ò»ý¤Ä¡£Â¾¤Î¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϲ¼¤Ë¼¨¤¹¤È¤ª¤ê¤Ç¤¢¤ë¡£¤³¤Î
1232     ¥Õ¥§¡¼¥¹¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤ÎÁ°·Ê¿§¤ÏÎФˤʤ롣  */
1233
1234 MFace *mface_green;
1235
1236 /***en
1237     @brief Blue face
1238
1239     The variable #mface_blue points to a face that has the
1240     #Mforeground property with value a symbol of name "blue".  The
1241     other properties are not specified.  An M-text that has this face
1242     is drawn with blue foreground.  */
1243
1244 /***ja
1245     @brief ÀÄ¥Õ¥§¡¼¥¹
1246
1247     ¥Ý¥¤¥ó¥¿ #mface_blue ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Ï¡¢
1248     foreground ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ<tt>"blue"</tt> ¤È¤¤¤¦Ì¾Á°¤Î¥·¥ó¥Ü
1249     ¥ë¤ò»ý¤Ä¡£Â¾¤Î¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϲ¼¤Ë¼¨¤¹¤È¤ª¤ê¤Ç¤¢¤ë¡£¤³¤Î
1250     ¥Õ¥§¡¼¥¹¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤ÎÁ°·Ê¿§¤ÏÀĤˤʤ롣  */
1251
1252 MFace *mface_blue;
1253
1254 /***en
1255     @brief Cyan face
1256
1257     The variable #mface_cyan points to a face that has the
1258     #Mforeground property with value a symbol of name "cyan".  The
1259     other properties are not specified.  An M-text that has this face
1260     is drawn with cyan foreground.  */
1261
1262 /***ja
1263     @brief ¥·¥¢¥ó¥Õ¥§¡¼¥¹
1264
1265     ¥Ý¥¤¥ó¥¿ #mface_cyan ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Ï¡¢
1266     foreground ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ<tt>"cyan"</tt> ¤È¤¤¤¦Ì¾Á°¤Î¥·¥ó¥Ü
1267     ¥ë¤ò»ý¤Ä¡£Â¾¤Î¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϲ¼¤Ë¼¨¤¹¤È¤ª¤ê¤Ç¤¢¤ë¡£¤³¤Î
1268     ¥Õ¥§¡¼¥¹¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤ÎÁ°·Ê¿§¤Ï¥·¥¢¥ó¤Ë¤Ê¤ë¡£  */
1269
1270 MFace *mface_cyan;
1271
1272 /***en
1273     @brief yellow face
1274
1275     The variable #mface_yellow points to a face that has the
1276     #Mforeground property with value a symbol of name "yellow".  The
1277     other properties are not specified.  An M-text that has this face
1278     is drawn with yellow foreground.  */
1279
1280 /***ja
1281     @brief ²«¥Õ¥§¡¼¥¹
1282
1283     ¥Ý¥¤¥ó¥¿ #mface_yellow ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Ï¡¢
1284     foreground ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ<tt>"yellow"</tt> ¤È¤¤¤¦Ì¾Á°¤Î¥·¥ó¥Ü
1285     ¥ë¤ò»ý¤Ä¡£Â¾¤Î¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϲ¼¤Ë¼¨¤¹¤È¤ª¤ê¤Ç¤¢¤ë¡£¤³¤Î
1286     ¥Õ¥§¡¼¥¹¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤ÎÁ°·Ê¿§¤Ï²«¿§¤Ë¤Ê¤ë¡£  */
1287
1288 MFace *mface_yellow;
1289
1290
1291 /***en
1292     @brief Magenta face
1293
1294     The variable #mface_magenta points to a face that has the
1295     #Mforeground property with value a symbol of name "magenta".  The
1296     other properties are not specified.  An M-text that has this face
1297     is drawn with magenta foreground.  */
1298
1299 /***ja
1300     @brief ¥Þ¥¼¥ó¥¿¥Õ¥§¡¼¥¹
1301
1302     ¥Ý¥¤¥ó¥¿ #mface_magenta ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤ëÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹¤Ï¡¢
1303     foreground ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ<tt>"magenta"</tt> ¤È¤¤¤¦Ì¾Á°¤Î¥·¥ó¥Ü
1304     ¥ë¤ò»ý¤Ä¡£Â¾¤Î¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϲ¼¤Ë¼¨¤¹¤È¤ª¤ê¤Ç¤¢¤ë¡£¤³¤Î
1305     ¥Õ¥§¡¼¥¹¤ò»È¤Ã¤Æɽ¼¨¤µ¤ì¤¿ M-text ¤ÎÁ°·Ê¿§¤Ï¥Þ¥¼¥ó¥¿¤Ë¤Ê¤ë¡£  */
1306
1307 MFace *mface_magenta;
1308
1309 /*** @} */
1310 /*=*/
1311
1312 /***en @name Variables: The other symbols for face handling.  */
1313 /***ja @name ÊÑ¿ô: ¥Õ¥§¡¼¥¹¤ò¼è¤ê°·¤¦¤¿¤á¤Î¤½¤Î¾¤ÎÄêµÁºÑ¤ß¥·¥ó¥Ü¥ë  */
1314 /*** @{ */
1315 /*=*/
1316
1317 /***en
1318     @brief Key of a text property specifying a face.
1319
1320     The variable #Mface is a symbol of name <tt>"face"</tt>.  A text
1321     property whose key is this symbol must have a pointer to an object
1322     of type #MFace.  This is a managing key.  */
1323
1324 /***ja
1325     @brief ¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤È¤Ê¤ë¥·¥ó¥Ü¥ë
1326
1327     ¥·¥ó¥Ü¥ë #Mface ¤Ï <tt>"face"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Ä¡£¥­¡¼¤¬ @c
1328     Mface ¤Ç¤¢¤ë¤è¤¦¤Ê¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢¥Õ¥§¡¼¥¹¥ª¥Ö¥¸¥§¥¯¥È¤Ø
1329     ¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£  */
1330
1331 MSymbol Mface;
1332 /*=*/
1333 /*** @} */
1334 /*=*/
1335
1336 /***en
1337     @brief Create a new face.
1338
1339     The mface () function creates a new face object that specifies no
1340     property.
1341
1342     @return
1343     This function returns a pointer to the created face.  */
1344
1345 /***ja
1346     @brief ¿·¤·¤¤¥Õ¥§¡¼¥¹¤ò¤Ä¤¯¤ë 
1347
1348     ´Ø¿ô mface () ¤Ï¿·¤·¤¤¥Õ¥§¡¼¥¹¥ª¥Ö¥¸¥§¥¯¥È¤òºî¤ë¡£
1349     ºî¤é¤ì¤¿¥Õ¥§¡¼¥¹¤Î¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤Ï°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤ë¡£
1350
1351     @li ¥­¡¼ #Mfontset ¤ËÂФ¹¤ëÃͤϠ@c NULL
1352     @li ¥­¡¼ #Msize ¤ËÂФ¹¤ëÃͤϠ0
1353     @li ¤½¤Î¾¤Î¥­¡¼¤ËÂФ¹¤ëÃͤϠ#Munspecified  */
1354
1355 MFace *
1356 mface ()
1357 {
1358   MFace *face;
1359
1360   M17N_OBJECT (face, free_face, MERROR_FACE);
1361   M17N_OBJECT_REGISTER (face_table, face);
1362   return face;
1363 }
1364
1365 /*=*/
1366
1367 /***en
1368     @brief Make a copy of a face.
1369
1370     The mface_copy () function makes a copy of $FACE and returns a
1371     pointer to the created copy.  */
1372
1373 /***ja
1374     @brief ¥Õ¥§¡¼¥¹¤Î¥³¥Ô¡¼¤òºî¤ë
1375
1376     ´Ø¿ô mface_copy () ¤Ï¥Õ¥§¡¼¥¹ $FACE ¤Î¥³¥Ô¡¼¤òºî¤ê¡¢¤½¤ì¤Ø¤Î¥Ý¥¤¥ó
1377     ¥¿¤òÊÖ¤¹¡£  */
1378
1379 MFace *
1380 mface_copy (MFace *face)
1381 {
1382   MFace *copy;
1383
1384   MSTRUCT_CALLOC (copy, MERROR_FACE);
1385   *copy = *face;
1386   copy->control.ref_count = 1;
1387   M17N_OBJECT_REGISTER (face_table, copy);
1388   if (copy->property[MFACE_FONTSET])
1389     M17N_OBJECT_REF (copy->property[MFACE_FONTSET]);
1390   if (copy->property[MFACE_HLINE])
1391     {
1392       MFaceHLineProp *val;
1393
1394       MSTRUCT_MALLOC (val, MERROR_FACE); 
1395       *val = *((MFaceHLineProp *) copy->property[MFACE_HLINE]);
1396       copy->property[MFACE_HLINE] = val;
1397     }
1398   if (copy->property[MFACE_BOX])
1399     {
1400       MFaceBoxProp *val;
1401
1402       MSTRUCT_MALLOC (val, MERROR_FACE); 
1403       *val = *((MFaceBoxProp *) copy->property[MFACE_BOX]);
1404       copy->property[MFACE_BOX] = val;
1405     }
1406
1407   return copy;
1408 }
1409
1410 /*=*/
1411 /***en
1412     @brief Merge faces.
1413
1414     The mface_merge () functions merges the properties of face $SRC
1415     into $DST.
1416
1417     @return
1418     This function returns $DST.  */
1419
1420 MFace *
1421 mface_merge (MFace *dst, MFace *src)
1422 {
1423   int i;
1424
1425   for (i = 0; i < MFACE_PROPERTY_MAX; i++)
1426     if (src->property[i])
1427       {
1428         dst->property[i] = src->property[i];
1429         if (i == MFACE_FONTSET)
1430           M17N_OBJECT_REF (dst->property[i]);
1431         else if (i == MFACE_HLINE)
1432           {
1433             MFaceHLineProp *val;
1434
1435             MSTRUCT_MALLOC (val, MERROR_FACE); 
1436             *val = *((MFaceHLineProp *) dst->property[MFACE_HLINE]);
1437             dst->property[MFACE_HLINE] = val;
1438           }
1439         else if (i == MFACE_BOX)
1440           {
1441             MFaceBoxProp *val;
1442
1443             MSTRUCT_MALLOC (val, MERROR_FACE); 
1444             *val = *((MFaceBoxProp *) dst->property[MFACE_BOX]);
1445             dst->property[MFACE_BOX] = val;
1446           }
1447       }
1448   return dst;
1449 }
1450
1451 /*=*/
1452
1453 /***en
1454     @brief Make a face from a font.
1455
1456     The mface_from_font () function return a newly created face while
1457     reflecting the properties of $FONT in its properties.   */
1458
1459 MFace *
1460 mface_from_font (MFont *font)
1461 {
1462   MFace *face = mface ();
1463
1464   face->property[MFACE_FOUNDRY] = mfont_get_prop (font, Mfoundry);
1465   face->property[MFACE_FAMILY] = mfont_get_prop (font, Mfamily);
1466   face->property[MFACE_WEIGHT] = mfont_get_prop (font, Mweight);
1467   face->property[MFACE_STYLE] = mfont_get_prop (font, Mstyle);
1468   face->property[MFACE_STRETCH] = mfont_get_prop (font, Mstretch);
1469   face->property[MFACE_ADSTYLE] = mfont_get_prop (font, Madstyle);
1470   face->property[MFACE_SIZE] = mfont_get_prop (font, Msize);
1471   return face;
1472 }
1473
1474 /*=*/
1475
1476 /***en
1477     @brief Get the value of a face property.
1478
1479     The mface_get_prop () function returns the value of the face
1480     property whose key is $KEY in face $FACE.  $KEY must be one of the
1481     followings:
1482
1483         #Mforeground, #Mbackground, #Mvideomode, #Mhline, #Mbox,
1484         #Mfoundry, #Mfamily, #Mweight, #Mstyle, #Mstretch, #Madstyle,
1485         #Msize, #Mfontset, #Mratio, #Mhook_func, #Mhook_arg
1486
1487     @return
1488     The actual type of the returned value depends of $KEY.  See
1489     documentation of the above keys.  If an error is detected, it
1490     returns @c NULL and assigns an error code to the external variable
1491     #merror_code.  */
1492
1493 /***ja
1494     @brief ¥Õ¥§¡¼¥¹¤Î¥×¥í¥Ñ¥Æ¥£ÃͤòÆÀ¤ë
1495
1496     ´Ø¿ô mface_get_prop () ¤Ï¡¢¥Õ¥§¡¼¥¹ $FACE ¤¬»ý¤Ä¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£
1497     ¤ÎÆâ¡¢¥­¡¼¤¬ $KEY ¤Ç¤¢¤ë¤â¤Î¤ÎÃͤòÊÖ¤¹¡£$KEY ¤Ï²¼µ­¤Î¤¤¤º¤ì¤«¤Ç¤Ê
1498     ¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
1499
1500         #Mforeground, #Mbackground, #Mvideomode, #Mhline, #Mbox,
1501         #Mfoundry, #Mfamily, #Mweight, #Mstyle, #Mstretch, #Madstyle,
1502         #Msize, #Mfontset, #Mratio, #Mhook_func, #Mhook_arg
1503
1504     @return
1505     ¤â¤· $KEY ¤¬ #Mfontset ¤Ê¤é¤Ð¡¢mface_get_prop () ¤Ï¥Õ¥©¥ó¥È¥»¥Ã
1506     ¥È¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£¤â¤· $KEY ¤¬ #Msize ¤Ê¤é¤ÐÀ°¿ô¤òÊÖ¤¹¡£¤½¤ì
1507     °Ê³°¤Î¾ì¹ç¤Ï¥·¥ó¥Ü¥ë¤òÊÖ¤¹¡£¥¨¥é¡¼¤¬¸¡½Ð¤µ¤ì¤¿¾ì¹ç¤Ï @c NULL ¤òÊÖ
1508     ¤·¡¢³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£  */
1509
1510 /***
1511     @seealso
1512     mface_put_prop ()
1513
1514     @errors
1515     @c MERROR_FACE  */
1516
1517 void *
1518 mface_get_prop (MFace *face, MSymbol key)
1519 {
1520   int index = (int) msymbol_get (key, M_face_prop_index) - 1;
1521
1522   if (index < 0)
1523     MERROR (MERROR_FACE, NULL);
1524   return face->property[index];
1525 }
1526
1527 /*=*/
1528
1529 /***en
1530     @brief Set a value of a face face property.
1531
1532     The mface_put_prop () function assigns $VAL to the property whose
1533     key is $KEY in face $FACE.  $KEY must be one the followings:
1534
1535         #Mforeground, #Mbackground, #Mvideomode, #Mhline, #Mbox,
1536         #Mfoundry, #Mfamily, #Mweight, #Mstyle, #Mstretch, #Madstyle,
1537         #Msize, #Mfontset, #Mratio, #Mhook_func, #Mhook_arg
1538
1539     Among them, font related properties (#Mfoundry through #Msize) are
1540     used as the default values when a font in the fontset of $FACE
1541     does not specify those values.
1542
1543     The actual type of the returned value depends of $KEY.  See
1544     documentation of the above keys.
1545
1546     @return
1547     If the operation was successful, mface_put_prop returns () 0.
1548     Otherwise it returns -1 and assigns an error code to the external
1549     variable #merror_code.  */
1550
1551 /***ja
1552     @brief ¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ÎÃͤòÀßÄꤹ¤ë
1553
1554     ´Ø¿ô mface_put_prop () ¤Ï¡¢¥Õ¥§¡¼¥¹ $FACE Æâ¤Ç¥­¡¼¤¬$KEY ¤Ç¤¢¤ë¥×
1555     ¥í¥Ñ¥Æ¥£¤ÎÃͤò $VAL ¤ËÀßÄꤹ¤ë¡£$KEY ¤Ï°Ê²¼¤Î¤¤¤º¤ì¤«¤Ç¤Ê¤¯¤Æ¤Ï¤Ê
1556     ¤é¤Ê¤¤¡£
1557
1558         #Mforeground, #Mbackground, #Mvideomode, #Mhline, #Mbox,
1559         #Mfoundry, #Mfamily, #Mweight, #Mstyle, #Mstretch, #Madstyle,
1560         #Msize, #Mfontset, #Mratio, #Mhook_func, #Mhook_arg.
1561
1562     ¤³¤ì¤é¤Î¤¦¤Á¤Î¡¢¥Õ¥©¥ó¥È´ØÏ¢¤Î¥×¥í¥Ñ¥Æ¥£ (#Mfamily ¤«¤é #Msize 
1563     ¤Þ¤Ç) ¤Ï¡¢¥Õ¥§¡¼¥¹¤Î¥Õ¥©¥ó¥È¥»¥Ã¥ÈÃæ¤Î¥Õ¥©¥ó¥È¤Ë´Ø¤¹¤ë¥Ç¥Õ¥©¥ë¥ÈÃÍ
1564     ¤È¤Ê¤ë¡£
1565
1566     ¤â¤· $KEY ¤¬ #Mfontset ¤Ê¤é $VAL ¤Ï #MFontset ·¿¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç
1567     ¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£¤â¤· $KEY ¤¬ #Msize ¤Ê¤é¤Ð $VAL ¤ÏÀ°¿ô¤Ç¤Ê¤±¤ì
1568     ¤Ð¤Ê¤é¤Ê¤¤¡£$KEY ¤¬¤½¤ì°Ê³°¤Î¾ì¹ç¡¢$VAL ¤Ï¥·¥ó¥Ü¥ë¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê
1569     ¤¤¡£
1570
1571     @return
1572     ½èÍý¤¬À®¸ù¤·¤¿¾ì¹ç¡¢mface_put_prop () ¤Ï 0 ¤òÊÖ¤¹¡£¼ºÇÔ¤·¤¿¾ì¹ç¤Ï 
1573     -1 ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£  */
1574
1575 /***
1576     @seealso
1577     mface_get_prop ()
1578
1579     @errors
1580     @c MERROR_FACE  */
1581
1582 int
1583 mface_put_prop (MFace *face, MSymbol key, void *val)
1584 {
1585   int index = (int) msymbol_get (key, M_face_prop_index) - 1;
1586
1587   if (index < 0)
1588     MERROR (MERROR_FACE, -1);
1589   if (key == Mfontset)
1590     M17N_OBJECT_REF (val);
1591   else if (key == Mhline)
1592     {
1593       MFaceHLineProp *newval;
1594
1595       MSTRUCT_MALLOC (newval, MERROR_FACE);
1596       *newval = *((MFaceHLineProp *) val);
1597       val = newval;
1598     }
1599   else if (key == Mbox)
1600     {
1601       MFaceBoxProp *newval;
1602
1603       MSTRUCT_MALLOC (newval, MERROR_FACE);
1604       *newval = *((MFaceBoxProp *) val);
1605       val = newval;
1606     }
1607   face->property[index] = val;
1608   face->tick++;
1609
1610   return 0;
1611 }
1612
1613 /*=*/
1614
1615 /***en
1616     @brief Update a face.
1617
1618     The mface_update () function update $FACE on $FRAME by calling a
1619     hook function of $FACE (if any).  */
1620
1621 void
1622 mface_update (MFrame *frame, MFace *face)
1623 {
1624   MFaceHookFunc func = (MFaceHookFunc) face->property[MFACE_HOOK_FUNC];
1625   MPlist *rface_list;
1626   MRealizedFace *rface;
1627
1628   if (func)
1629     {
1630       MPLIST_DO (rface_list, frame->realized_face_list)
1631         {
1632           rface = MPLIST_VAL (rface_list);
1633           if ((MFaceHookFunc) rface->face.property[MFACE_HOOK_FUNC] == func)
1634             (func) (&(rface->face), rface->face.property[MFACE_HOOK_ARG],
1635                     rface->info);
1636         }
1637     }
1638 }
1639 /*=*/
1640
1641 /*** @} */
1642 /*=*/
1643
1644 /*** @addtogroup m17nDebug */
1645 /*** @{  */
1646 /*=*/
1647
1648 /***en
1649     @brief Dump a face
1650
1651     The mdebug_dump_face () function prints $FACE in a human readable
1652     way to the stderr.  $INDENT specifies how many columns to indent
1653     the lines but the first one.
1654
1655     @return
1656     This function returns $FACE.  */
1657
1658 MFace *
1659 mdebug_dump_face (MFace *face, int indent)
1660 {
1661   char *prefix = (char *) alloca (indent + 1);
1662   MFont spec;
1663
1664   memset (prefix, 32, indent);
1665   prefix[indent] = 0;
1666   mfont__set_spec_from_face (&spec, face);
1667   fprintf (stderr, "(face font:\"");
1668   mdebug_dump_font (&spec);
1669   fprintf (stderr, "\"\n %s  fore:%s back:%s", prefix,
1670            msymbol_name ((MSymbol) face->property[MFACE_FOREGROUND]),
1671            msymbol_name ((MSymbol) face->property[MFACE_BACKGROUND]));
1672   if (face->property[MFACE_FONTSET])
1673     fprintf (stderr, " non-default-fontset");
1674   fprintf (stderr, " hline:%s", face->property[MFACE_HLINE] ? "yes" : "no");
1675   fprintf (stderr, " box:%s)", face->property[MFACE_BOX] ? "yes" : "no");
1676   return face;
1677 }
1678
1679 /*** @} */
1680
1681 /*
1682   Local Variables:
1683   coding: euc-japan
1684   End:
1685 */