(hline_prop_list, box_prop_list, noop_hook): New
[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 ("white");
486   mface__default->property[MFACE_FONTSET] = msymbol ("black");
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     MSTRUCT_MALLOC (hline_prop, MERROR_FACE);
502     hline_prop->type = MFACE_HLINE_UNDER;
503     hline_prop->width = 1;
504     hline_prop->color = Mnil;
505     mface_underline = mface ();
506     mface_underline->property[MFACE_HLINE] = (void *) hline_prop;
507   }
508
509   mface_medium = mface ();
510   mface_medium->property[MFACE_WEIGHT] = (void *) msymbol ("medium");
511   mface_bold = mface ();
512   mface_bold->property[MFACE_WEIGHT] = (void *) msymbol ("bold");
513   mface_italic = mface ();
514   mface_italic->property[MFACE_STYLE] = (void *) msymbol ("i");
515   mface_bold_italic = mface_copy (mface_bold);
516   mface_bold_italic->property[MFACE_STYLE]
517     = mface_italic->property[MFACE_STYLE];
518
519   mface_xx_small = mface ();
520   mface_xx_small->property[MFACE_RATIO] = (void *) 50;
521   mface_x_small = mface ();
522   mface_x_small->property[MFACE_RATIO] = (void *) 67;
523   mface_small = mface ();
524   mface_small->property[MFACE_RATIO] = (void *) 75;
525   mface_normalsize = mface ();
526   mface_normalsize->property[MFACE_RATIO] = (void *) 100;
527   mface_large = mface ();
528   mface_large->property[MFACE_RATIO] = (void *) 120;
529   mface_x_large = mface ();
530   mface_x_large->property[MFACE_RATIO] = (void *) 150;
531   mface_xx_large = mface ();
532   mface_xx_large->property[MFACE_RATIO] = (void *) 200;
533
534   mface_black = mface ();
535   mface_black->property[MFACE_FOREGROUND] = (void *) msymbol ("black");
536   mface_white = mface ();
537   mface_white->property[MFACE_FOREGROUND] = (void *) msymbol ("white");
538   mface_red = mface ();
539   mface_red->property[MFACE_FOREGROUND] = (void *) msymbol ("red");
540   mface_green = mface ();
541   mface_green->property[MFACE_FOREGROUND] = (void *) msymbol ("green");
542   mface_blue = mface ();
543   mface_blue->property[MFACE_FOREGROUND] = (void *) msymbol ("blue");
544   mface_cyan = mface ();
545   mface_cyan->property[MFACE_FOREGROUND] = (void *) msymbol ("cyan");
546   mface_yellow = mface ();
547   mface_yellow->property[MFACE_FOREGROUND] = (void *) msymbol ("yellow");
548   mface_magenta = mface ();
549   mface_magenta->property[MFACE_FOREGROUND] = (void *) msymbol ("magenta");
550
551   work_gstring.glyphs = malloc (sizeof (MGlyph) * 2);
552   work_gstring.size = 2;
553   work_gstring.used = 0;
554   work_gstring.inc = 1;
555   return 0;
556 }
557
558 void
559 mface__fini ()
560 {
561   MPlist *plist;
562
563   M17N_OBJECT_UNREF (mface__default);
564   M17N_OBJECT_UNREF (mface_normal_video);
565   M17N_OBJECT_UNREF (mface_reverse_video);
566   M17N_OBJECT_UNREF (mface_underline);
567   M17N_OBJECT_UNREF (mface_medium);
568   M17N_OBJECT_UNREF (mface_bold);
569   M17N_OBJECT_UNREF (mface_italic);
570   M17N_OBJECT_UNREF (mface_bold_italic);
571   M17N_OBJECT_UNREF (mface_xx_small);
572   M17N_OBJECT_UNREF (mface_x_small);
573   M17N_OBJECT_UNREF (mface_small);
574   M17N_OBJECT_UNREF (mface_normalsize);
575   M17N_OBJECT_UNREF (mface_large);
576   M17N_OBJECT_UNREF (mface_x_large);
577   M17N_OBJECT_UNREF (mface_xx_large);
578   M17N_OBJECT_UNREF (mface_black);
579   M17N_OBJECT_UNREF (mface_white);
580   M17N_OBJECT_UNREF (mface_red);
581   M17N_OBJECT_UNREF (mface_green);
582   M17N_OBJECT_UNREF (mface_blue);
583   M17N_OBJECT_UNREF (mface_cyan);
584   M17N_OBJECT_UNREF (mface_yellow);
585   M17N_OBJECT_UNREF (mface_magenta);
586
587   MPLIST_DO (plist, hline_prop_list)
588     free (MPLIST_VAL (plist));
589   M17N_OBJECT_UNREF (hline_prop_list);
590   MPLIST_DO (plist, box_prop_list)
591     free (MPLIST_VAL (plist));
592   M17N_OBJECT_UNREF (box_prop_list);
593
594   free (work_gstring.glyphs);
595
596   mdebug__report_object ("Face", &face_table);
597 }
598
599 /** Return a realized face for ASCII characters from NUM number of
600     base faces pointed by FACES on the frame FRAME.  */
601
602 MRealizedFace *
603 mface__realize (MFrame *frame, MFace **faces, int num,
604                 MSymbol language, MSymbol charset, int size)
605 {
606   MRealizedFace *rface;
607   MRealizedFont *rfont;
608   MFace merged_face = *(frame->face);
609   void **props;
610   int i, j;
611   MGlyph g;
612   MFaceHookFunc func;
613
614   if (num == 0 && language == Mnil && charset == Mnil && frame->rface)
615     return frame->rface;
616
617   for (i = 0; i < MFACE_PROPERTY_MAX; i++)
618     for (j = num - 1; j >= 0; j--)
619       if (faces[j]->property[i])
620         {
621           merged_face.property[i] = faces[j]->property[i];
622           break;
623         }
624
625   if (! mplist_find_by_value (frame->face->frame_list, frame))
626     mplist_push (frame->face->frame_list, Mt, frame);
627   for (i = 0; i < num; i++)
628     if (! mplist_find_by_value (faces[i]->frame_list, frame))
629       mplist_push (faces[i]->frame_list, Mt, frame);
630
631   if (merged_face.property[MFACE_RATIO])
632     {
633       int font_size = (int) merged_face.property[MFACE_SIZE];
634
635       font_size *= (int) merged_face.property[MFACE_RATIO];
636       font_size /= 100;
637       merged_face.property[MFACE_SIZE] = (void *) font_size;
638       merged_face.property[MFACE_RATIO] = 0;
639     }
640
641   rface = find_realized_face (frame, &merged_face);
642   if (rface)
643     return rface;
644
645   MSTRUCT_CALLOC (rface, MERROR_FACE);
646   mplist_push (frame->realized_face_list, Mt, rface);
647   rface->frame = frame;
648   rface->face = merged_face;
649   props = rface->face.property;
650   rface->rfontset = mfont__realize_fontset (frame,
651                                             (MFontset *) props[MFACE_FONTSET],
652                                             &merged_face);
653   g.c = ' ';
654   num = 1;
655   rfont = mfont__lookup_fontset (rface->rfontset, &g, &num,
656                                  msymbol ("latin"), language, Mnil,
657                                  size);
658
659   if (rfont)
660     {
661       rface->rfont = rfont;
662       g.otf_encoded = 0;
663       work_gstring.glyphs[0] = g;
664       work_gstring.glyphs[0].rface = rface;
665       work_gstring.glyphs[1].code = MCHAR_INVALID_CODE;
666       work_gstring.glyphs[1].rface = rface;
667       mfont__get_metric (&work_gstring, 0, 2);
668       rface->space_width = work_gstring.glyphs[0].width;
669       rface->ascent = work_gstring.glyphs[1].ascent;
670       rface->descent = work_gstring.glyphs[1].descent;
671     }
672   else
673     {
674       rface->rfont = NULL;
675       rface->space_width = frame->space_width;
676     }
677
678   rface->hline = (MFaceHLineProp *) props[MFACE_HLINE];
679   if (rface->hline && rface->hline->width == 0)
680     rface->hline = NULL;
681   rface->box = (MFaceBoxProp *) props[MFACE_BOX];
682   if (rface->box && rface->box->width == 0)
683     rface->box = NULL;
684   rface->ascii_rface = rface;
685   mwin__realize_face (rface);
686
687   func = (MFaceHookFunc) rface->face.property[MFACE_HOOK_FUNC];
688   if (func && func != noop_hook)
689     (func) (&(rface->face), rface->info, rface->face.property[MFACE_HOOK_ARG]);
690
691   rface->non_ascii_list = mplist ();
692   if (rface->rfont)
693     {
694       MRealizedFace *nofont;
695
696       MSTRUCT_CALLOC (nofont, MERROR_FACE);
697       *nofont = *rface;
698       nofont->non_ascii_list = NULL;
699       nofont->rfont = NULL;
700       mplist_add (rface->non_ascii_list, Mt, nofont);
701     }
702
703   return rface;
704 }
705
706
707 MGlyph *
708 mface__for_chars (MSymbol script, MSymbol language, MSymbol charset,
709                   MGlyph *from_g, MGlyph *to_g, int size)
710 {
711   MRealizedFace *rface = from_g->rface->ascii_rface, *new;
712   MRealizedFont *rfont;
713   int num = to_g - from_g, i;
714   MPlist *plist;
715
716   rfont = mfont__lookup_fontset (from_g->rface->rfontset, from_g, &num,
717                                  script, language, charset, size);
718   if (! rfont)
719     {
720       if (rface->rfont)
721         MPLIST_DO (plist, rface->non_ascii_list)
722           {
723             rface = MPLIST_VAL (plist);
724             if (! rface->rfont)
725               break;
726           }
727       num = 1;
728       goto finish;
729     }
730   if (rface->rfont == rfont)
731     goto finish;
732
733   MPLIST_DO (plist, rface->non_ascii_list)
734     if (((MRealizedFace *) MPLIST_VAL (plist))->rfont == rfont)
735       break;
736   if (! MPLIST_TAIL_P (plist))
737     {
738       rface = MPLIST_VAL (plist);
739       goto finish;
740     }
741
742   MSTRUCT_MALLOC (new, MERROR_FACE);
743   mplist_push (rface->non_ascii_list, Mt, new);
744   *new = *rface;
745   rface = new;
746   rface->rfont = rfont;
747   rface->non_ascii_list = NULL;
748   work_gstring.glyphs[0].code = MCHAR_INVALID_CODE;
749   work_gstring.glyphs[0].rface = rface;
750   mfont__get_metric (&work_gstring, 0, 1);
751   rface->ascent = work_gstring.glyphs[0].ascent;
752   rface->descent = work_gstring.glyphs[0].descent;
753   
754  finish:
755   for (i = 0; i < num; i++, from_g++)
756     from_g->rface = rface;
757   return from_g;
758 }
759
760
761 void
762 mface__free_realized (MRealizedFace *rface)
763 {
764   MPlist *plist;
765
766   MPLIST_DO (plist, rface->non_ascii_list)
767     free (MPLIST_VAL (plist));
768   M17N_OBJECT_UNREF (rface->non_ascii_list);
769   mwin__free_realized_face (rface);
770   free (rface);
771 }
772
773 void
774 mface__update_frame_face (MFrame *frame)
775 {
776   frame->rface = NULL;
777   frame->rface = mface__realize (frame, NULL, 0, Mnil, Mnil, 0);
778   frame->space_width = frame->rface->space_width;
779   frame->ascent = frame->rface->ascent;
780   frame->descent = frame->rface->descent;
781 }
782
783 /*** @} */
784 #endif /* !FOR_DOXYGEN || DOXYGEN_INTERNAL_MODULE */
785
786 \f
787 /* External API  */
788 /*** @addtogroup m17nFace */
789 /*** @{ */
790 /*=*/
791
792 /***en @name Variables: Keys of face property */
793 /***ja @name ÊÑ¿ô: ¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼  */
794 /*** @{ */
795 /*=*/
796
797 /***en
798     @brief Key of a face property specifying foreground color.
799
800     The variable #Mforeground is used as a key of face property.  The
801     property value must be a symbol whose name is a color name, or
802     #Mnil.
803
804     #Mnil means that the face does not specify a foreground color.
805     Otherwise, the foreground of an M-text is drawn by the specified
806     color.  */
807
808 /***ja
809     @brief Á°·Ê¿§¤ò»ØÄꤹ¤ë¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¡¼¤Î¥­¡¼.
810
811     ÊÑ¿ô #Mforeground ¤Ï¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤È¤·¤ÆÍѤ¤¤é¤ì¤ë¡£
812     ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢¿§Ì¾¤ò̾Á°¤È¤·¤Æ»ý¤Ä¥·¥ó¥Ü¥ë¤« #Mnil ¤Ç¤¢¤ë¡£
813
814     #Mnil ¤Î¾ì¹ç¡¢Á°·Ê¿§¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð M-text ¤ÎÁ°·Ê¤Ï
815     »ØÄꤵ¤ì¤¿¿§¤Çɽ¼¨¤µ¤ì¤ë¡£  */
816
817 MSymbol Mforeground;
818
819 /***en
820     @brief Key of a face property specifying background color.
821
822     The variable #Mbackground is used as a key of face property.  The
823     property value must be a symbol whose name is a color name, or
824     #Mnil.
825
826     #Mnil means that the face does not specify a background color.
827     Otherwise, the background of an M-text is drawn by the specified
828     color.  */
829
830 /***ja
831     @brief ÇØ·Ê¿§¤ò»ØÄꤹ¤ë¤¿¤á¤Î¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¡¼¤Î¥­¡¼.
832
833     ÊÑ¿ô #Mbackground ¤Ï¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤È¤·¤ÆÍѤ¤¤é¤ì¤ë¡£
834     ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢¿§Ì¾¤ò̾Á°¤È¤·¤Æ»ý¤Ä¥·¥ó¥Ü¥ë¤« #Mnil ¤Ç¤¢¤ë¡£
835
836     #Mnil ¤Î¾ì¹ç¡¢ÇØ·Ê¿§¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð M-text ¤ÎÇطʤÏ
837     »ØÄꤵ¤ì¤¿¿§¤Çɽ¼¨¤µ¤ì¤ë¡£  */
838
839 MSymbol Mbackground;
840
841 /***en
842     @brief Key of a face property specifying video mode.
843
844     The variable #Mvideomode is used as a key of face property.  The
845     property value must be #Mnormal, #Mreverse, or #Mnil.
846
847     #Mnormal means that an M-text is drawn in normal video mode
848     (i.e. the foreground is drawn by foreground color, the background
849     is drawn by background color).
850
851     #Mreverse means that an M-text is drawn in reverse video mode
852     (i.e. the foreground is drawn by background color, the background
853     is drawn by foreground color).
854
855     #Mnil means that the face does not specify a video mode.  */
856
857 /***ja
858     @brief ¥Ó¥Ç¥ª¥â¡¼¥É¤ò»ØÄꤹ¤ë¤¿¤á¤Î¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¡¼¤Î¥­¡¼.
859
860     ÊÑ¿ô #Mvideomode ¤Ï¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤È¤·¤ÆÍѤ¤¤é¤ì¤ë¡£
861     ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢#Mnormal, #Mreverse, #Mnil ¤Î¤¤¤º¤ì¤«¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
862
863     #Mnormal ¤Î¾ì¹ç¤Ï¡¢M-text ¤Ïɸ½à¤Î¥Ó¥Ç¥ª¥â¡¼¥É¡ÊÁ°·Ê¤òÁ°·Ê¿§¤Ç¡¢ÇØ
864     ·Ê¤òÇØ·Ê¿§¤Ç¡Ë¤Çɽ¼¨¤¹¤ë¡£
865
866     #Mreverse ¤Î¾ì¹ç¤Ï¥ê¥Ð¡¼¥¹¥Ó¥Ç¥ª¥â¡¼¥É¤Ç¡ÊÁ°·Ê¤òÇØ·Ê¿§¤Ç¡¢ÇطʤòÁ°
867     ·Ê¿§¤Ç¡Ëɽ¼¨¤¹¤ë¡£
868
869     #Mnil ¤Î¾ì¹ç¤Ï¥Ó¥Ç¥ª¥â¡¼¥É¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£
870     */
871
872 MSymbol Mvideomode;
873
874 /***en
875     @brief Key of a face property specifying font size ratio.
876
877     The variable #Mratio is used as a key of face property.  The value
878     RATIO must be an integer.
879
880     The value 0 means that the face does not specify a font size
881     ratio.  Otherwise, an M-text is drawn by a font of size (FONTSIZE
882     * RATIO / 100) where FONTSIZE is a font size specified by the face
883     property #Msize.  */
884 /***ja
885     @brief ¥Õ¥©¥ó¥È¤Î¥µ¥¤¥º¤ÎÈæΨ¤ò»ØÄꤹ¤ë¤¿¤á¤Î¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¡¼¤Î¥­¡¼.
886
887     ÊÑ¿ô #Mratio ¤Ï¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤È¤·¤ÆÍѤ¤¤é¤ì¤ë¡£ÃÍ RATIO 
888     ¤ÏÀ°¿ôÃͤǤʤ¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
889
890     Ãͤ¬0¤Ê¤é¤Ð¡¢¥Õ¥©¥ó¥È¥µ¥¤¥º¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð¡¢M-text 
891     ¤Ï(FONTSIZE * RATIO / 100) ¤È¤¤¤¦¥µ¥¤¥º¤Î¥Õ¥©¥ó¥È¤Çɽ¼¨¤µ¤ì¤ë¡£¤³
892     ¤³¤Ç FONTSIZE ¤Ï¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¡¼ #Msize ¤Ç»ØÄꤵ¤ì¤¿¥µ¥¤¥º¤Ç¤¢
893     ¤ë¡£ */
894
895 MSymbol Mratio;
896
897 /***en
898     @brief Key of a face property specifying horizontal line.
899
900     The variable #Mhline is used as a key of face property.  The value
901     must be a pointer to an object of type #MFaceHLineProp, or @c
902     NULL.
903
904     The value @c NULL means that the face does not specify this
905     property.  Otherwise, an M-text is drawn with a horizontal line by
906     a way specified by the object that the value points to.  */
907
908 /***ja
909     @brief ¿åÊ¿Àþ¤ò»ØÄꤹ¤ë¤¿¤á¤Î¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¡¼¤Î¥­¡¼.
910
911     ÊÑ¿ô #Mhline ¤Ï¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤È¤·¤ÆÍѤ¤¤é¤ì¤ë¡£ÃͤϠ
912     #MFaceHLineProp ·¿¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿¤« @c NULL ¤Ç¤Ê¤¯¤Æ¤Ï¤Ê
913     ¤é¤Ê¤¤¡£
914
915     Ãͤ¬ @c NULL ¤Ê¤é¤Ð¡¢¤³¤Î¥×¥í¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤½¤¦¤Ç¤Ê¤±¤ì¤ÐÃÍ
916    ¤¬»Ø¤¹¥ª¥Ö¥¸¥§¥¯¥È¤Ë»ØÄꤵ¤ì¤¿¤è¤¦¤Ë¿åÊ¿Àþ¤òÉղ䷤ƠM-text ¤òɽ¼¨
917    ¤¹¤ë¡£*/
918
919 MSymbol Mhline;
920
921 /***en
922     @brief Key of a face property specifying box.
923
924     The variable #Mbox is used as a key of face property.  The value
925     must be a pointer to an object of type #MFaceBoxProp, or @c NULL.
926
927     The value @c NULL means that the face does not specify a box.
928     Otherwise, an M-text is drawn with a surrounding box by a way
929     specified by the object that the value points to.  */
930
931 /***ja
932     @brief °Ï¤ßÏȤò»ØÄꤹ¤ë¤¿¤á¤Î¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¡¼¤Î¥­¡¼.
933
934     ÊÑ¿ô #Mbox ¤Ï¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤È¤·¤ÆÍѤ¤¤é¤ì¤ë¡£ÃͤϠ
935     #MFaceBoxProp ·¿¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿¤« @c NULL ¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é
936     ¤Ê¤¤¡£
937
938     Ãͤ¬ @c NULL ¤Ê¤é¤Ð¡¢¤³¤Î¥×¥í¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤½¤¦¤Ç¤Ê¤±¤ì¤ÐÃÍ
939     ¤¬»Ø¤¹¥ª¥Ö¥¸¥§¥¯¥È¤Ë»ØÄꤵ¤ì¤¿¤è¤¦¤Ë°Ï¤ßÏȤòÉղ䷤ƠM-text ¤òɽ¼¨
940     ¤¹¤ë¡£*/
941
942 MSymbol Mbox;
943
944 /***en
945     @brief Key of a face property specifying fontset.
946
947     The variable #Mfontset is used as a key of face property.  The
948     value must be a pointer to an object of type #Mfontset, or @c
949     NULL.
950
951     The value @c NULL means that the face does not specify a fontset.
952     Otherwise, an M-text is drawn with a font selected from what
953     specified in the fontset.  */
954
955 /***ja
956     @brief ¥Õ¥©¥ó¥È¥»¥Ã¥È¤ò»ØÄꤹ¤ë¤¿¤á¤Î¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¡¼¤Î¥­¡¼.
957
958     ÊÑ¿ô #Mfontset ¤Ï¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤È¤·¤ÆÍѤ¤¤é¤ì¤ë¡£ÃͤϠ
959     #Mfontset ·¿¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿¤« @c NULL ¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
960
961     Ãͤ¬ @c NULL ¤Ê¤é¤Ð¡¢¥Õ¥©¥ó¥È¥»¥Ã¥È¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤½¤¦¤Ç¤Ê¤±¤ì¤ÐÃÍ
962     ¤¬»Ø¤¹¥ª¥Ö¥¸¥§¥¯¥È¤Ë»ØÄꤵ¤ì¤¿¥Õ¥©¥ó¥È¥»¥Ã¥È¤«¤éÁª¤ó¤À¥Õ¥©¥ó¥È¤Ç 
963     M-text ¤òɽ¼¨¤¹¤ë¡£*/
964     
965 MSymbol Mfontset;
966
967 /***en
968     @brief Key of a face property specifying hook.
969
970     The variable #Mhook_func is used as a key of face property.  The
971     value must be a function of type #MFaceHookFunc, or @c NULL.
972
973     The value @c NULL means that the face does not specify a hook.
974     Otherwise, the specified function is called before the face is
975     realized.  */
976 /***ja
977     @brief ¥Õ¥Ã¥¯¤ò»ØÄꤹ¤ë¤¿¤á¤Î¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¡¼¤Î¥­¡¼.
978
979     ÊÑ¿ô #Mhook_func ¤Ï¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤È¤·¤ÆÍѤ¤¤é¤ì¤ë¡£ÃͤϠ
980     #MFaceHookFunc ·¿¤Î´Ø¿ô¤« @c NULL ¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
981
982     Ãͤ¬ @c NULL ¤Ê¤é¤Ð¡¢¥Õ¥Ã¥¯¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð¥Õ¥§¡¼¥¹¤ò
983     ¼Â¸½¤¹¤ëÁ°¤Ë»ØÄꤷ¤¿´Ø¿ô¤¬¸Æ¤Ð¤ì¤ë¡£      */
984 MSymbol Mhook_func;
985
986 /***en
987     @brief Key of a face property specifying argument of hook.
988
989     The variable #Mhook_arg is used as a key of face property.  The
990     value can be anything that is passed a hook function specified by
991     the face property #Mhook_func.  */
992 /***ja
993     @brief ¥Õ¥Ã¥¯¤Î°ú¿ô¤ò»ØÄꤹ¤ë¤¿¤á¤Î¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¡¼¤Î¥­¡¼.
994
995     ÊÑ¿ô #Mhook_arg ¤Ï¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤È¤·¤ÆÍѤ¤¤é¤ì¤ë¡£ÃͤϠ
996     ²¿¤Ç¤â¤è¤¯¡¢¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£ #Mhook_func ¤Ç»ØÄꤵ¤ì¤ë´Ø¿ô¤ËÅϤµ
997     ¤ì¤ë¡£ */
998 MSymbol Mhook_arg;
999
1000 /*** @} */
1001 /*=*/
1002
1003 /*** @ingroup m17nFace */
1004 /***en @name Variables: Possible values of #Mvideomode property of face */
1005 /***ja @name ÊÑ¿ô¡§  ¥Õ¥§¡¼¥¹¤Î #Mvideomode ¥×¥í¥Ñ¥Æ¥£¤Î²Äǽ¤ÊÃÍ */
1006 /*** @{ */
1007 /*=*/
1008
1009 /***en
1010     See the documentation of the variable #Mvideomode.  */ 
1011 /***ja
1012     ÊÑ¿ô #Mvideomode ¤ÎÀâÌÀ¤ò»²¾È¤Î¤³¤È¡£  */ 
1013 MSymbol Mnormal;
1014 MSymbol Mreverse;
1015 /*** @} */
1016 /*=*/
1017
1018 /*** @ingroup m17nFace */
1019 /***en @name Variables: Predefined faces  */
1020 /***ja @name ÊÑ¿ô: ÄêµÁºÑ¤ß¥Õ¥§¡¼¥¹  */
1021 /*** @{ */
1022 /*=*/
1023
1024 /***en
1025     @brief Normal video face.
1026
1027     The variable #mface_normal_video points to a face that has the
1028     #Mvideomode property with value #Mnormal.  The other properties
1029     are not specified.  An M-text drawn with this face appear normal
1030     colors (i.e. the foreground is drawn by foreground color, and
1031     background is drawn by background color).  */
1032 /***ja
1033     @brief É¸½à¥Ó¥Ç¥ª¥Õ¥§¡¼¥¹.
1034
1035     ÊÑ¿ô #mface_normal_video ¤Ï #Mvideomode ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤ¬ #Mnormal 
1036     ¤Ç¤¢¤ë¥Õ¥§¡¼¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Â¾¤Î¥×¥í¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£
1037     ¤³¤Î¥Õ¥§¡¼¥¹¤Çɽ¼¨¤µ¤ì¤ëM-text ¤Ïɸ½à¤Î¿§ (¤¹¤Ê¤ï¤ÁÁ°·Ê¤ÏÁ°·Ê¿§¡¢
1038     ÇطʤÏÇØ·Ê¿§¡Ë¤ÇÉÁ¤«¤ì¤ë¡£  */
1039
1040 MFace *mface_normal_video;
1041
1042 /***en
1043     @brief Reverse video face.
1044
1045     The variable #mface_reverse_video points to a face that has the
1046     #Mvideomode property with value #Mreverse.  The other properties
1047     are not specified.  An M-text drawn with this face appear in
1048     reversed colors (i.e. the foreground is drawn by background
1049     color, and background is drawn by foreground color).  */
1050 /***ja
1051     @brief ¥ê¥Ð¡¼¥¹¥Ó¥Ç¥ª¥Õ¥§¡¼¥¹.
1052
1053     ÊÑ¿ô #mface_reverse_video ¤Ï #Mvideomode ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤ¬ 
1054     #Mreverse ¤Ç¤¢¤ë¥Õ¥§¡¼¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Â¾¤Î¥×¥í¥Ñ¥Æ¥£¤Ï»ØÄê
1055     ¤µ¤ì¤Ê¤¤¡£¤³¤Î¥Õ¥§¡¼¥¹¤Çɽ¼¨¤µ¤ì¤ëM-text ¤ÏÁ°·Ê¿§¤ÈÇØ·Ê¿§¤¬Æþ¤ìÂØ
1056     ¤ï¤Ã¤Æ (¤¹¤Ê¤ï¤ÁÁ°·Ê¤ÏÇØ·Ê¿§¡¢ÇطʤÏÁ°·Ê¿§¡ËÉÁ¤«¤ì¤ë¡£  */
1057
1058 MFace *mface_reverse_video;
1059
1060 /***en
1061     @brief Underline face.
1062
1063     The variable #mface_underline points to a face that has the
1064     #Mhline property with value a pointer to an object of type
1065     #MFaceHLineProp.  The members of the object are as follows:
1066
1067 @verbatim
1068     member  value
1069     -----   -----
1070     type    MFACE_HLINE_UNDER
1071     width   1
1072     color   Mnil
1073 @endverbatim
1074
1075     The other properties are not specified.  An M-text that has this
1076     face is drawn with an underline.  */ 
1077 /***ja
1078     @brief ²¼Àþ¥Õ¥§¡¼¥¹.
1079
1080     ÊÑ¿ô #mface_underline ¤Ï #Mhline ¥×¥í¥Ñ¥Æ¥¤¤ÎÃͤ¬ #MFaceHLineProp 
1081     ·¿¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¥Õ¥§¡¼¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£¥ª¥Ö
1082     ¥¸¥§¥¯¥È¤Î¥á¥ó¥Ð¤Ï°Ê²¼¤ÎÄ̤ꡣ
1083
1084 @verbatim
1085     ¥á¥ó¥Ð  ÃÍ
1086     -----   -----
1087     type    MFACE_HLINE_UNDER
1088     width   1
1089     color   Mnil
1090 @endverbatim
1091
1092     Â¾¤Î¥×¥í¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»ý¤Ä M-text ¤Ï²¼ÀþÉÕ¤­
1093     ¤Çɽ¼¨¤µ¤ì¤ë¡£*/ 
1094
1095 MFace *mface_underline;
1096
1097 /***en
1098     @brief Medium face.
1099
1100     The variable #mface_medium points to a face that has the #Mweight
1101     property with value a symbol of name "medium".  The other
1102     properties are not specified.  An M-text that has this face is
1103     drawn with a font of medium weight.  */
1104 /***ja
1105     @brief ¥ß¥Ç¥£¥¢¥à¥Õ¥§¡¼¥¹.
1106
1107     ÊÑ¿ô #mface_medium ¤Ï #Mweight ¥×¥í¥Ñ¥Æ¥¤¤ÎÃͤ¬ "medium" ¤È¤¤¤¦Ì¾
1108     Á°¤ò¤â¤Ä¥·¥ó¥Ü¥ë¤Ç¤¢¤ë¤è¤¦¤Ê¥Õ¥§¡¼¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Â¾¤Î¥×¥í
1109     ¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»ý¤Ä M-text ¤Ï¡¢¥ß¥Ç¥£¥¢¥à¥¦¥§
1110     ¥¤¥È¤Î¥Õ¥©¥ó¥È¤Çɽ¼¨¤µ¤ì¤ë¡£  */
1111 MFace *mface_medium;
1112
1113 /***en
1114     @brief Bold face.
1115
1116     The variable #mface_bold points to a face that has the #Mweight
1117     property with value a symbol of name "bold".  The other properties
1118     are not specified.  An M-text that has this face is drawn with a
1119     font of bold weight.  */
1120
1121 /***ja
1122     @brief ¥Ü¡¼¥ë¥É¥Õ¥§¡¼¥¹.
1123
1124     ÊÑ¿ô #mface_bold ¤Ï #Mweight ¥×¥í¥Ñ¥Æ¥¤¤ÎÃͤ¬ "bold" ¤È¤¤¤¦Ì¾Á°¤ò
1125     ¤â¤Ä¥·¥ó¥Ü¥ë¤Ç¤¢¤ë¤è¤¦¤Ê¥Õ¥§¡¼¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Â¾¤Î¥×¥í¥Ñ¥Æ¥£
1126     ¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»ý¤Ä M-text ¤Ï¡¢¥Ü¡¼¥ë¥É¤Î¥Õ¥©¥ó¥È¤Ç
1127     É½¼¨¤µ¤ì¤ë¡£
1128      */
1129
1130 MFace *mface_bold;
1131
1132 /***en
1133     @brief Italic face.
1134
1135     The variable #mface_italic points to a face that has the #Mstyle
1136     property with value a symbol of name "italic".  The other
1137     properties are not specified.  An M-text that has this face is
1138     drawn with a font of italic style.  */
1139
1140 /***ja
1141     @brief ¥¤¥¿¥ê¥Ã¥¯¥Õ¥§¡¼¥¹.
1142
1143     ÊÑ¿ô #mface_italic ¤Ï #Mstyle ¥×¥í¥Ñ¥Æ¥¤¤ÎÃͤ¬ "italic" ¤È¤¤¤¦Ì¾Á°
1144     ¤ò¤â¤Ä¥·¥ó¥Ü¥ë¤Ç¤¢¤ë¤è¤¦¤Ê¥Õ¥§¡¼¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Â¾¤Î¥×¥í¥Ñ
1145     ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»ý¤Ä M-text ¤Ï¡¢¥¤¥¿¥ê¥Ã¥¯ÂΤÇɽ
1146     ¼¨¤µ¤ì¤ë¡£
1147      */
1148
1149 MFace *mface_italic;
1150
1151 /***en
1152     @brief Bold italic face.
1153
1154     The variable #mface_bold_italic points to a face that has the
1155     #Mweight property with value a symbol of name "bold", and #Mstyle
1156     property with value a symbol of name "italic".  The other
1157     properties are not specified.  An M-text that has this face is
1158     drawn with a font of bold weight and italic style.  */
1159
1160 /***ja
1161     @brief ¥Ü¡¼¥ë¥É¥¤¥¿¥ê¥Ã¥¯¥Õ¥§¡¼¥¹.
1162
1163     ÊÑ¿ô #mface_bold_italic ¤Ï¡¢#Mweight ¥×¥í¥Ñ¥Æ¥¤¤ÎÃͤ¬ "bold" ¤È¤¤
1164     ¤¦Ì¾Á°¤ò¤â¤Ä¥·¥ó¥Ü¥ë¤Ç¤¢¤ê¡¢¤«¤Ä #Mstyle ¥×¥í¥Ñ¥Æ¥¤¤ÎÃͤ¬ "italic" 
1165     ¤È¤¤¤¦Ì¾Á°¤ò¤â¤Ä¥·¥ó¥Ü¥ë¤Ç¤¢¤ë¤è¤¦¤Ê¥Õ¥§¡¼¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£
1166     Â¾¤Î¥×¥í¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»ý¤Ä M-text ¤Ï¡¢¥Ü¡¼¥ë
1167     ¥É¥¤¥¿¥ê¥Ã¥¯ÂΤÇɽ¼¨¤µ¤ì¤ë¡£
1168     */
1169
1170 MFace *mface_bold_italic;
1171
1172 /***en
1173     @brief Smallest face.
1174
1175     The variable #mface_xx_small points to a face that has the #Mratio
1176     property with value 50.  The other properties are not specified.
1177     An M-text that has this face is drawn with a font whose size is
1178     50% of a normal font.  */
1179
1180 /***ja
1181     @brief ºÇ¾®¤Î¥Õ¥§¡¼¥¹.
1182
1183     ÊÑ¿ô #mface_xx_small ¤Ï¡¢#Mratio ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤ¬ 50 ¤Ç¤¢¤ë¥Õ¥§¡¼
1184     ¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Â¾¤Î¥×¥í¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤³¤Î¥Õ¥§¡¼¥¹
1185     ¤ò»ý¤Ä M-text ¤Ïɸ½à¤Î 50% ¤ÎÂ礭¤µ¤Î¥Õ¥©¥ó¥È¤òÍѤ¤¤Æɽ¼¨¤µ¤ì¤ë¡£
1186      */
1187
1188 MFace *mface_xx_small;
1189
1190 /***en
1191     @brief Smaller face.
1192
1193     The variable #mface_x_small points to a face that has the #Mratio
1194     property with value 66.  The other properties are not specified.
1195     An M-text that has this face is drawn with a font whose size is
1196     66% of a normal font.  */
1197
1198 /***ja
1199     @brief ¤â¤Ã¤È¾®¤µ¤¤¥Õ¥§¡¼¥¹.
1200
1201     ÊÑ¿ô #mface_x_small ¤Ï¡¢#Mratio ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤ¬ 66 ¤Ç¤¢¤ë¥Õ¥§¡¼
1202     ¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Â¾¤Î¥×¥í¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤³¤Î¥Õ¥§¡¼¥¹
1203     ¤ò»ý¤Ä M-text ¤Ïɸ½à¤Î 66% ¤ÎÂ礭¤µ¤Î¥Õ¥©¥ó¥È¤òÍѤ¤¤Æɽ¼¨¤µ¤ì¤ë¡£
1204      */
1205
1206 MFace *mface_x_small;
1207
1208 /***en
1209     @brief Small face.
1210
1211     The variable #mface_x_small points to a face that has the #Mratio
1212     property with value 75.  The other properties are not specified.
1213     An M-text that has this face is drawn with a font whose size is
1214     75% of a normal font.  */
1215
1216 /***ja
1217     @brief ¾®¤µ¤¤¥Õ¥§¡¼¥¹.
1218
1219     ÊÑ¿ô #mface_small ¤Ï¡¢#Mratio ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤ¬ 75 ¤Ç¤¢¤ë¥Õ¥§¡¼¥¹¤ò
1220     »Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Â¾¤Î¥×¥í¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»ý
1221     ¤Ä M-text ¤Ïɸ½à¤Î 75% ¤ÎÂ礭¤µ¤Î¥Õ¥©¥ó¥È¤òÍѤ¤¤Æɽ¼¨¤µ¤ì¤ë¡£
1222      */
1223
1224 MFace *mface_small;
1225
1226 /***en
1227     @brief Normalsize face.
1228
1229     The variable #mface_normalsize points to a face that has the
1230     #Mratio property with value 100.  The other properties are not
1231     specified.  An M-text that has this face is drawn with a font
1232     whose size is the same as a normal font.  */
1233
1234 /***ja
1235     @brief É¸½à¤ÎÂ礭¤µ¤Î¥Õ¥§¡¼¥¹.
1236
1237     ÊÑ¿ô #mface_normalsize ¤Ï¡¢#Mratio ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤ¬ 100 ¤Ç¤¢¤ë¥Õ¥§¡¼
1238     ¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Â¾¤Î¥×¥í¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤³¤Î¥Õ¥§¡¼¥¹
1239     ¤ò»ý¤Ä M-text ¤Ïɸ½à¤ÈƱ¤¸Â礭¤µ¤Î¥Õ¥©¥ó¥È¤òÍѤ¤¤Æɽ¼¨¤µ¤ì¤ë¡£
1240      */
1241
1242 MFace *mface_normalsize;
1243
1244 /***en
1245     @brief Large face.
1246
1247     The variable #mface_large points to a face that has the #Mratio
1248     property with value 120.  The other properties are not specified.
1249     An M-text that has this face is drawn with a font whose size is
1250     120% of a normal font.  */
1251
1252 /***ja
1253     @brief Â礭¤¤¥Õ¥§¡¼¥¹.
1254
1255     ÊÑ¿ô #mface_large ¤Ï¡¢#Mratio ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤ¬ 120 ¤Ç¤¢¤ë¥Õ¥§¡¼¥¹
1256     ¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Â¾¤Î¥×¥í¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò
1257     »ý¤Ä M-text ¤Ïɸ½à¤Î 120% ¤ÎÂ礭¤µ¤Î¥Õ¥©¥ó¥È¤òÍѤ¤¤Æɽ¼¨¤µ¤ì¤ë¡£
1258      */
1259
1260 MFace *mface_large;
1261
1262 /***en
1263     @brief Larger face.
1264
1265     The variable #mface_x_large points to a face that has the #Mratio
1266     property with value 150.  The other properties are not specified.
1267     An M-text that has this face is drawn with a font whose size is
1268     150% of a normal font.  */
1269
1270 /***ja
1271     @brief ¤â¤Ã¤ÈÂ礭¤¤¥Õ¥§¡¼¥¹.
1272
1273     ÊÑ¿ô #mface_x_large ¤Ï¡¢#Mratio ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤ¬ 150 ¤Ç¤¢¤ë¥Õ¥§¡¼
1274     ¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Â¾¤Î¥×¥í¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤³¤Î¥Õ¥§¡¼¥¹
1275     ¤ò»ý¤Ä M-text ¤Ïɸ½à¤Î 150% ¤ÎÂ礭¤µ¤Î¥Õ¥©¥ó¥È¤òÍѤ¤¤Æɽ¼¨¤µ¤ì¤ë¡£
1276      */
1277
1278 MFace *mface_x_large;
1279
1280 /***en
1281     @brief Largest face.
1282
1283     The variable #mface_xx_large points to a face that has the #Mratio
1284     property with value 200.  The other properties are not specified.
1285     An M-text that has this face is drawn with a font whose size is
1286     200% of a normal font.  */
1287
1288 /***ja
1289     @brief ºÇÂç¤Î¥Õ¥§¡¼¥¹.
1290
1291     ÊÑ¿ô #mface_xx_large ¤Ï¡¢#Mratio ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤ¬ 200 ¤Ç¤¢¤ë¥Õ¥§¡¼
1292     ¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Â¾¤Î¥×¥í¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤³¤Î¥Õ¥§¡¼¥¹
1293     ¤ò»ý¤Ä M-text ¤Ïɸ½à¤Î 200% ¤ÎÂ礭¤µ¤Î¥Õ¥©¥ó¥È¤òÍѤ¤¤Æɽ¼¨¤µ¤ì¤ë¡£
1294      */
1295
1296 MFace *mface_xx_large;
1297
1298 /***en
1299     @brief Black face.
1300
1301     The variable #mface_black points to a face that has the
1302     #Mforeground property with value a symbol of name "black".  The
1303     other properties are not specified.  An M-text that has this face
1304     is drawn with black foreground.  */
1305
1306 /***ja 
1307     @brief ¹õ¥Õ¥§¡¼¥¹.
1308
1309     ÊÑ¿ô #mface_black ¤Ï¡¢#Mforeground ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ "black" ¤È
1310     ¤¤¤¦Ì¾Á°¤Î¥·¥ó¥Ü¥ë¤ò»ý¤Ä¤è¤¦¤Ê¥Õ¥§¡¼¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Â¾¤Î¥×
1311     ¥í¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»ý¤Ä M-text ¤ÏÁ°·Ê¿§¤ò¹õ¤È¤·
1312     ¤Æɽ¼¨¤µ¤ì¤ë¡£     */
1313
1314 MFace *mface_black;
1315
1316 /***en
1317     @brief White face.
1318
1319     The variable #mface_white points to a face that has the
1320     #Mforeground property with value a symbol of name "white".  The
1321     other properties are not specified.  An M-text that has this face
1322     is drawn with white foreground.  */
1323
1324 /***ja
1325     @brief Çò¥Õ¥§¡¼¥¹.
1326
1327     ÊÑ¿ô #mface_white ¤Ï¡¢#Mforeground ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ "white" ¤È
1328     ¤¤¤¦Ì¾Á°¤Î¥·¥ó¥Ü¥ë¤ò»ý¤Ä¤è¤¦¤Ê¥Õ¥§¡¼¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Â¾¤Î¥×
1329     ¥í¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»ý¤Ä M-text ¤ÏÁ°·Ê¿§¤òÇò¤È¤·
1330     ¤Æɽ¼¨¤µ¤ì¤ë¡£  */
1331
1332 MFace *mface_white;
1333
1334 /***en
1335     @brief Red face.
1336
1337     The variable #mface_red points to a face that has the
1338     #Mforeground property with value a symbol of name "red".  The
1339     other properties are not specified.  An M-text that has this face
1340     is drawn with red foreground.  */
1341
1342 /***ja
1343     @brief ÀÖ¥Õ¥§¡¼¥¹.
1344
1345     ÊÑ¿ô #mface_red ¤Ï¡¢#Mforeground ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ "red" ¤È¤¤¤¦
1346     Ì¾Á°¤Î¥·¥ó¥Ü¥ë¤ò»ý¤Ä¤è¤¦¤Ê¥Õ¥§¡¼¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Â¾¤Î¥×¥í¥Ñ
1347     ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»ý¤Ä M-text ¤ÏÁ°·Ê¿§¤òÀ֤Ȥ·¤Æɽ
1348     ¼¨¤µ¤ì¤ë¡£  */
1349
1350 MFace *mface_red;
1351
1352 /***en
1353     @brief Green face.
1354
1355     The variable #mface_green points to a face that has the
1356     #Mforeground property with value a symbol of name "green".  The
1357     other properties are not specified.  An M-text that has this face
1358     is drawn with green foreground.  */
1359
1360 /***ja
1361     @brief ÎÐ¥Õ¥§¡¼¥¹.
1362
1363     ÊÑ¿ô #mface_green ¤Ï¡¢#Mforeground ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ "green" ¤È
1364     ¤¤¤¦Ì¾Á°¤Î¥·¥ó¥Ü¥ë¤ò»ý¤Ä¤è¤¦¤Ê¥Õ¥§¡¼¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Â¾¤Î¥×
1365     ¥í¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»ý¤Ä M-text ¤ÏÁ°·Ê¿§¤òÎФȤ·
1366     ¤Æɽ¼¨¤µ¤ì¤ë¡£  */
1367
1368 MFace *mface_green;
1369
1370 /***en
1371     @brief Blue face.
1372
1373     The variable #mface_blue points to a face that has the
1374     #Mforeground property with value a symbol of name "blue".  The
1375     other properties are not specified.  An M-text that has this face
1376     is drawn with blue foreground.  */
1377
1378 /***ja
1379     @brief ÀÄ¥Õ¥§¡¼¥¹.
1380
1381     ÊÑ¿ô #mface_blue ¤Ï¡¢#Mforeground ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ "blue" ¤È¤¤
1382     ¤¦Ì¾Á°¤Î¥·¥ó¥Ü¥ë¤ò»ý¤Ä¤è¤¦¤Ê¥Õ¥§¡¼¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Â¾¤Î¥×¥í
1383     ¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»ý¤Ä M-text ¤ÏÁ°·Ê¿§¤òÀĤȤ·¤Æ
1384     É½¼¨¤µ¤ì¤ë¡£  */
1385
1386 MFace *mface_blue;
1387
1388 /***en
1389     @brief Cyan face.
1390
1391     The variable #mface_cyan points to a face that has the
1392     #Mforeground property with value a symbol of name "cyan".  The
1393     other properties are not specified.  An M-text that has this face
1394     is drawn with cyan foreground.  */
1395
1396 /***ja
1397     @brief ¥·¥¢¥ó¥Õ¥§¡¼¥¹.
1398
1399     ÊÑ¿ô #mface_cyan ¤Ï¡¢#Mforeground ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ "cyan" ¤È¤¤
1400     ¤¦Ì¾Á°¤Î¥·¥ó¥Ü¥ë¤ò»ý¤Ä¤è¤¦¤Ê¥Õ¥§¡¼¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Â¾¤Î¥×¥í
1401     ¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»ý¤Ä M-text ¤ÏÁ°·Ê¿§¤ò¥·¥¢¥ó¤È
1402     ¤·¤Æɽ¼¨¤µ¤ì¤ë¡£  */
1403
1404 MFace *mface_cyan;
1405
1406 /***en
1407     @brief yellow face.
1408
1409     The variable #mface_yellow points to a face that has the
1410     #Mforeground property with value a symbol of name "yellow".  The
1411     other properties are not specified.  An M-text that has this face
1412     is drawn with yellow foreground.  */
1413
1414 /***ja
1415     @brief ²«¥Õ¥§¡¼¥¹.
1416
1417     ÊÑ¿ô #mface_yellow ¤Ï¡¢#Mforeground ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ "yellow" 
1418     ¤È¤¤¤¦Ì¾Á°¤Î¥·¥ó¥Ü¥ë¤ò»ý¤Ä¤è¤¦¤Ê¥Õ¥§¡¼¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£Â¾¤Î
1419     ¥×¥í¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»ý¤Ä M-text ¤ÏÁ°·Ê¿§¤ò²«¿§
1420     ¤È¤·¤Æɽ¼¨¤µ¤ì¤ë¡£  */
1421
1422 MFace *mface_yellow;
1423
1424 /***en
1425     @brief Magenta face.
1426
1427     The variable #mface_magenta points to a face that has the
1428     #Mforeground property with value a symbol of name "magenta".  The
1429     other properties are not specified.  An M-text that has this face
1430     is drawn with magenta foreground.  */
1431
1432 /***ja
1433     @brief ¥Þ¥¼¥ó¥¿¥Õ¥§¡¼¥¹.
1434
1435     ÊÑ¿ô #mface_magenta ¤Ï¡¢#Mforeground ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ 
1436     "magenta" ¤È¤¤¤¦Ì¾Á°¤Î¥·¥ó¥Ü¥ë¤ò»ý¤Ä¤è¤¦¤Ê¥Õ¥§¡¼¥¹¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç
1437     ¤¢¤ë¡£Â¾¤Î¥×¥í¥Ñ¥Æ¥£¤Ï»ØÄꤵ¤ì¤Ê¤¤¡£¤³¤Î¥Õ¥§¡¼¥¹¤ò»ý¤Ä M-text ¤ÏÁ°
1438     ·Ê¿§¤ò¥Þ¥¼¥ó¥¿¤È¤·¤Æɽ¼¨¤µ¤ì¤ë¡£  */
1439
1440 MFace *mface_magenta;
1441
1442 /*** @} */
1443 /*=*/
1444
1445 /***en @name Variables: The other symbols for face handling.  */
1446 /***ja @name ÊÑ¿ô: ¥Õ¥§¡¼¥¹¤ò¼è¤ê°·¤¦¤¿¤á¤Î¤½¤Î¾¤Î¥·¥ó¥Ü¥ë  */
1447 /*** @{ */
1448 /*=*/
1449
1450 /***en
1451     @brief Key of a text property specifying a face.
1452
1453     The variable #Mface is a symbol of name <tt>"face"</tt>.  A text
1454     property whose key is
1455     this symbol must have a pointer to an object
1456     of type #MFace
1457 .  This is a managing key.  */
1458
1459 /***ja
1460     @brief ¥Õ¥§¡¼¥¹¤ò»ØÄꤹ¤ë¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼.
1461
1462     ÊÑ¿ô #Mface ¤Ï <tt>"face"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Ä¥·¥ó¥Ü¥ë¤Ç¤¢¤ë¡£¤³
1463     ¤Î¥·¥ó¥Ü¥ë¤ò¥­¡¼¤È¤¹¤ë¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Ï¡¢#MFace ·¿¤Î¥ª¥Ö¥¸¥§¥¯
1464     ¥È¤Ø¤Î¥Ý¥¤¥ó¥¿¤ò»ý¤¿¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£¤³¤ì¤Ï´ÉÍý¥­¡¼¤Ç¤¢¤ë¡£  */
1465
1466 MSymbol Mface;
1467 /*=*/
1468 /*** @} */
1469 /*=*/
1470
1471 /***en
1472     @brief Create a new face.
1473
1474     The mface () function creates a new face object that specifies no
1475     property.
1476
1477     @return
1478     This function returns a pointer to the created face.  */
1479
1480 /***ja
1481     @brief ¿·¤·¤¤¥Õ¥§¡¼¥¹¤ò¤Ä¤¯¤ë.
1482
1483     ´Ø¿ô mface () ¤Ï¥×¥í¥Ñ¥Æ¥£¤ò°ìÀÚ»ý¤¿¤Ê¤¤¿·¤·¤¤¥Õ¥§¡¼¥¹¥ª¥Ö¥¸¥§¥¯¥È
1484     ¤òºî¤ë¡£
1485
1486     @return
1487     ¤³¤Î´Ø¿ô¤Ïºî¤Ã¤¿¥Õ¥§¡¼¥¹¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£  */
1488
1489 MFace *
1490 mface ()
1491 {
1492   MFace *face;
1493
1494   M17N_OBJECT (face, free_face, MERROR_FACE);
1495   face->frame_list = mplist ();
1496   M17N_OBJECT_REGISTER (face_table, face);
1497   return face;
1498 }
1499
1500 /*=*/
1501
1502 /***en
1503     @brief Make a copy of a face.
1504
1505     The mface_copy () function makes a copy of $FACE and returns a
1506     pointer to the created copy.  */
1507
1508 /***ja
1509     @brief ¥Õ¥§¡¼¥¹¤Î¥³¥Ô¡¼¤òºî¤ë.
1510
1511     ´Ø¿ô mface_copy () ¤Ï¥Õ¥§¡¼¥¹ $FACE ¤Î¥³¥Ô¡¼¤òºî¤ê¡¢¤½¤Î¥³¥Ô¡¼¤Ø¤Î
1512     ¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£  */
1513
1514 MFace *
1515 mface_copy (MFace *face)
1516 {
1517   MFace *copy;
1518
1519   MSTRUCT_CALLOC (copy, MERROR_FACE);
1520   *copy = *face;
1521   copy->control.ref_count = 1;
1522   M17N_OBJECT_REGISTER (face_table, copy);
1523   copy->frame_list = mplist ();
1524   if (copy->property[MFACE_FONTSET])
1525     M17N_OBJECT_REF (copy->property[MFACE_FONTSET]);
1526   return copy;
1527 }
1528
1529 /*=*/
1530 /***en
1531     @brief Merge faces.
1532
1533     The mface_merge () functions merges the properties of face $SRC
1534     into $DST.
1535
1536     @return
1537     This function returns $DST.  */
1538
1539 /***ja
1540     @brief ¥Õ¥§¡¼¥¹¤òÅý¹ç¤¹¤ë.
1541
1542     ´Ø¿ô mface_merge () ¤Ï¡¢¥Õ¥§¡¼¥¹ $SRC ¤Î¥×¥í¥Ñ¥Æ¥£¤ò¥Õ¥§¡¼¥¹ $DST 
1543     ¤ËÅý¹ç¤¹¤ë¡£
1544
1545     @return
1546     ¤³¤Î´Ø¿ô¤Ï $DST ¤òÊÖ¤¹¡£  */
1547
1548 MFace *
1549 mface_merge (MFace *dst, MFace *src)
1550 {
1551   int i;
1552   MPlist *plist;
1553
1554   for (i = 0; i < MFACE_PROPERTY_MAX; i++)
1555     if (src->property[i])
1556       {
1557         if (i == MFACE_FONTSET)
1558           {
1559             M17N_OBJECT_UNREF (dst->property[i]);
1560             M17N_OBJECT_REF (src->property[i]);
1561           }
1562         dst->property[i] = src->property[i];
1563       }
1564
1565   MPLIST_DO (plist, dst->frame_list)
1566     {
1567       MFrame *frame = MPLIST_VAL (plist);
1568
1569       frame->tick++;
1570       if (dst == frame->face)
1571         mface__update_frame_face (frame);
1572     }
1573
1574   return dst;
1575 }
1576
1577 /*=*/
1578
1579 /***en
1580     @brief Make a face from a font.
1581
1582     The mface_from_font () function return a newly created face while
1583     reflecting the properties of $FONT in its properties.   */
1584
1585 /***ja
1586     @brief ¥Õ¥©¥ó¥È¤«¤é¥Õ¥§¡¼¥¹¤òºî¤ë.
1587
1588     ´Ø¿ô mface_from_font () ¤Ï¥Õ¥©¥ó¥È $FONT ¤Î¥×¥í¥Ñ¥Æ¥£¤ò¥×¥í¥Ñ¥Æ¥£
1589     ¤È¤·¤Æ»ý¤Ä¿·¤·¤¤¥Õ¥§¡¼¥¹¤òºî¤ê¡¢¤½¤ì¤òÊÖ¤¹¡£  */
1590
1591 MFace *
1592 mface_from_font (MFont *font)
1593 {
1594   MFace *face = mface ();
1595
1596   face->property[MFACE_FOUNDRY] = mfont_get_prop (font, Mfoundry);
1597   face->property[MFACE_FAMILY] = mfont_get_prop (font, Mfamily);
1598   face->property[MFACE_WEIGHT] = mfont_get_prop (font, Mweight);
1599   face->property[MFACE_STYLE] = mfont_get_prop (font, Mstyle);
1600   face->property[MFACE_STRETCH] = mfont_get_prop (font, Mstretch);
1601   face->property[MFACE_ADSTYLE] = mfont_get_prop (font, Madstyle);
1602   face->property[MFACE_SIZE] = mfont_get_prop (font, Msize);
1603   return face;
1604 }
1605
1606 /*=*/
1607
1608 /***en
1609     @brief Get the value of a face property.
1610
1611     The mface_get_prop () function returns the value of the face
1612     property whose key is $KEY in face $FACE.  $KEY must be one of the
1613     followings:
1614
1615         #Mforeground, #Mbackground, #Mvideomode, #Mhline, #Mbox,
1616         #Mfoundry, #Mfamily, #Mweight, #Mstyle, #Mstretch, #Madstyle,
1617         #Msize, #Mfontset, #Mratio, #Mhook_func, #Mhook_arg
1618
1619     @return
1620     The actual type of the returned value depends of $KEY.  See
1621     documentation of the above keys.  If an error is detected, it
1622     returns @c NULL and assigns an error code to the external variable
1623     #merror_code.  */
1624
1625 /***ja
1626     @brief ¥Õ¥§¡¼¥¹¤Î¥×¥í¥Ñ¥Æ¥£¤ÎÃͤòÆÀ¤ë.
1627
1628     ´Ø¿ô mface_get_prop () ¤Ï¡¢¥Õ¥§¡¼¥¹ $FACE ¤¬»ý¤Ä¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£
1629     ¤ÎÆâ¡¢¥­¡¼¤¬ $KEY ¤Ç¤¢¤ë¤â¤Î¤ÎÃͤòÊÖ¤¹¡£$KEY ¤Ï²¼µ­¤Î¤¤¤º¤ì¤«¤Ç¤Ê
1630     ¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
1631
1632         #Mforeground, #Mbackground, #Mvideomode, #Mhline, #Mbox,
1633         #Mfoundry, #Mfamily, #Mweight, #Mstyle, #Mstretch, #Madstyle,
1634         #Msize, #Mfontset, #Mratio, #Mhook_func, #Mhook_arg
1635
1636     @return 
1637     Ìá¤êÃͤη¿¤Ï $KEY ¤Ë°Í¸¤¹¤ë¡£¾åµ­¤Î¥­¡¼¤ÎÀâÌÀ¤ò»²¾È¤¹¤ë¤³
1638     ¤È¡£¥¨¥é¡¼¤¬¸¡½Ð¤µ¤ì¤¿¾ì¹ç¤Ï @c NULL ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code 
1639     ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£  */
1640
1641 /***
1642     @seealso
1643     mface_put_prop ()
1644
1645     @errors
1646     @c MERROR_FACE  */
1647
1648 void *
1649 mface_get_prop (MFace *face, MSymbol key)
1650 {
1651   int index = (int) msymbol_get (key, M_face_prop_index) - 1;
1652
1653   if (index < 0)
1654     MERROR (MERROR_FACE, NULL);
1655   return face->property[index];
1656 }
1657
1658 /*=*/
1659
1660 /***en
1661     @brief Set a value of a face property.
1662
1663     The mface_put_prop () function assigns $VAL to the property whose
1664     key is $KEY in face $FACE.  $KEY must be one the followings:
1665
1666         #Mforeground, #Mbackground, #Mvideomode, #Mhline, #Mbox,
1667         #Mfoundry, #Mfamily, #Mweight, #Mstyle, #Mstretch, #Madstyle,
1668         #Msize, #Mfontset, #Mratio, #Mhook_func, #Mhook_arg
1669
1670     Among them, font related properties (#Mfoundry through #Msize) are
1671     used as the default values when a font in the fontset of $FACE
1672     does not specify those values.
1673
1674     The actual type of the returned value depends of $KEY.  See
1675     documentation of the above keys.
1676
1677     @return
1678     If the operation was successful, mface_put_prop () returns 0.
1679     Otherwise it returns -1 and assigns an error code to the external
1680     variable #merror_code.  */
1681
1682 /***ja
1683     @brief ¥Õ¥§¡¼¥¹¥×¥í¥Ñ¥Æ¥£¤ÎÃͤòÀßÄꤹ¤ë.
1684
1685     ´Ø¿ô mface_put_prop () ¤Ï¡¢¥Õ¥§¡¼¥¹ $FACE Æâ¤Ç¥­¡¼¤¬ $KEY ¤Ç¤¢¤ë¥×
1686     ¥í¥Ñ¥Æ¥£¤ÎÃͤò $VAL ¤ËÀßÄꤹ¤ë¡£$KEY ¤Ï°Ê²¼¤Î¤¤¤º¤ì¤«¤Ç¤Ê¤¯¤Æ¤Ï¤Ê
1687     ¤é¤Ê¤¤¡£
1688
1689         #Mforeground, #Mbackground, #Mvideomode, #Mhline, #Mbox,
1690         #Mfoundry, #Mfamily, #Mweight, #Mstyle, #Mstretch, #Madstyle,
1691         #Msize, #Mfontset, #Mratio, #Mhook_func, #Mhook_arg.
1692
1693     ¤³¤ì¤é¤Î¤¦¤Á¤Î¡¢¥Õ¥©¥ó¥È´ØÏ¢¤Î¥×¥í¥Ñ¥Æ¥£ (#Mfamily ¤«¤é #Msize 
1694     ¤Þ¤Ç) ¤Ï¡¢¥Õ¥§¡¼¥¹¤Î¥Õ¥©¥ó¥È¥»¥Ã¥ÈÃæ¤Î¥Õ¥©¥ó¥È¤Ë´Ø¤¹¤ë¥Ç¥Õ¥©¥ë¥ÈÃÍ
1695     ¤È¤Ê¤ê¡¢¸Ä¡¹¤Î¥Õ¥©¥ó¥È¤¬Ãͤò»ØÄꤷ¤Ê¤«¤Ã¤¿¾ì¹ç¤ËÍѤ¤¤é¤ì¤ë¡£
1696
1697     Ìá¤êÃͤη¿¤Ï $KEY ¤Ë°Í¸¤¹¤ë¡£¾åµ­¤Î¥­¡¼¤ÎÀâÌÀ¤ò»²¾È¤¹¤ë¤³¤È¡£
1698
1699     @return
1700     ½èÍý¤¬À®¸ù¤·¤¿¾ì¹ç¡¢mface_put_prop () ¤Ï 0 ¤òÊÖ¤¹¡£¼ºÇÔ¤·¤¿¾ì¹ç¤Ï 
1701     -1 ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£  */
1702
1703 /***
1704     @seealso
1705     mface_get_prop ()
1706
1707     @errors
1708     @c MERROR_FACE  */
1709
1710 int
1711 mface_put_prop (MFace *face, MSymbol key, void *val)
1712 {
1713   int index = (int) msymbol_get (key, M_face_prop_index) - 1;
1714   MPlist *plist;
1715
1716   if (index < 0)
1717     MERROR (MERROR_FACE, -1);
1718   if (key == Mfontset)
1719     {
1720       if (face->property[index])
1721         M17N_OBJECT_UNREF (face->property[index]);
1722       M17N_OBJECT_REF (val);
1723     }
1724   else if (key == Mhline)
1725     val = get_hline_create (val);
1726   else if (key == Mbox)
1727     val = get_box_create (val);
1728   face->property[index] = val;
1729
1730   MPLIST_DO (plist, face->frame_list)
1731     {
1732       MFrame *frame = MPLIST_VAL (plist);
1733
1734       frame->tick++;
1735       if (face == frame->face)
1736         mface__update_frame_face (frame);
1737     }
1738
1739   return 0;
1740 }
1741
1742 /*=*/
1743
1744 /***en
1745     @brief Update a face.
1746
1747     The mface_update () function update face $FACE on frame $FRAME by
1748     calling a hook function of $FACE (if any).  */
1749
1750 /***ja
1751     @brief ¥Õ¥§¡¼¥¹¤ò¹¹¿·¤¹¤ë.
1752
1753     ´Ø¿ô mface_update () ¤Ï¥Õ¥ì¡¼¥à $FRAME ¤Î¥Õ¥§¡¼¥¹ $FACE ¤ò $FACE 
1754     ¤Î¥Õ¥Ã¥¯´Ø¿ô¤ò¡Ê¤¢¤ì¤Ð¡Ë¸Æ¤ó¤Ç¹¹¿·¤¹¤ë¡£  */
1755
1756 void
1757 mface_update (MFrame *frame, MFace *face)
1758 {
1759   MFaceHookFunc func = (MFaceHookFunc) face->property[MFACE_HOOK_FUNC];
1760   MPlist *rface_list;
1761   MRealizedFace *rface;
1762
1763   if (func && func != noop_hook)
1764     {
1765       MPLIST_DO (rface_list, frame->realized_face_list)
1766         {
1767           rface = MPLIST_VAL (rface_list);
1768           if ((MFaceHookFunc) rface->face.property[MFACE_HOOK_FUNC] == func)
1769             (func) (&(rface->face), rface->face.property[MFACE_HOOK_ARG],
1770                     rface->info);
1771         }
1772     }
1773 }
1774 /*=*/
1775
1776 /*** @} */
1777 /*=*/
1778
1779 /*** @addtogroup m17nDebug */
1780 /*** @{  */
1781 /*=*/
1782
1783 /***en
1784     @brief Dump a face.
1785
1786     The mdebug_dump_face () function prints face $FACE in a human readable
1787     way to the stderr.  $INDENT specifies how many columns to indent
1788     the lines but the first one.
1789
1790     @return
1791     This function returns $FACE.  */
1792
1793 /***ja
1794     @brief ¥Õ¥§¡¼¥¹¤ò¥À¥ó¥×¤¹¤ë.
1795
1796     ´Ø¿ô mdebug_dump_face () ¤Ï¥Õ¥§¡¼¥¹ $FACE ¤ò stderr ¤Ë¿Í´Ö¤Ë²ÄÆɤÊ
1797     ·Á¤Ç°õºþ¤¹¤ë¡£ $INDENT ¤Ï£²¹ÔÌܰʹߤΥ¤¥ó¥Ç¥ó¥È¤ò»ØÄꤹ¤ë¡£
1798
1799     @return
1800     ¤³¤Î´Ø¿ô¤Ï $FACE ¤òÊÖ¤¹¡£  */
1801
1802 MFace *
1803 mdebug_dump_face (MFace *face, int indent)
1804 {
1805   char *prefix = (char *) alloca (indent + 1);
1806   MFont spec;
1807
1808   memset (prefix, 32, indent);
1809   prefix[indent] = 0;
1810   mfont__set_spec_from_face (&spec, face);
1811   fprintf (stderr, "(face font:\"");
1812   mdebug_dump_font (&spec);
1813   fprintf (stderr, "\"\n %s  fore:%s back:%s", prefix,
1814            msymbol_name ((MSymbol) face->property[MFACE_FOREGROUND]),
1815            msymbol_name ((MSymbol) face->property[MFACE_BACKGROUND]));
1816   if (face->property[MFACE_FONTSET])
1817     fprintf (stderr, " non-default-fontset");
1818   fprintf (stderr, " hline:%s", face->property[MFACE_HLINE] ? "yes" : "no");
1819   fprintf (stderr, " box:%s)", face->property[MFACE_BOX] ? "yes" : "no");
1820   return face;
1821 }
1822
1823 /*** @} */
1824
1825 /*
1826   Local Variables:
1827   coding: euc-japan
1828   End:
1829 */