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