]> git.lyx.org Git - lyx.git/blob - src/FontInfo.cpp
Merge branch 'master' of git.lyx.org:lyx
[lyx.git] / src / FontInfo.cpp
1 /**
2  * \file src/FontInfo.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  * \author Jean-Marc Lasgouttes
8  * \author Angus Leeming
9  * \author André Pönitz
10  * \author Dekel Tsur
11  *
12  * Full author contact details are available in file CREDITS.
13  */
14
15 #include <config.h>
16
17 #include "ColorSet.h"
18 #include "FontInfo.h"
19 #include "Lexer.h"
20
21 #include "support/debug.h"
22 #include "support/docstring.h"
23 #include "support/lstrings.h"
24 #include "support/RefChanger.h"
25
26 #include <ostream>
27 #include <sstream>
28
29 using namespace std;
30 using namespace lyx::support;
31
32 namespace lyx {
33
34 //
35 // Strings used to read and write .lyx format files
36 //
37 char const * LyXFamilyNames[NUM_FAMILIES + 2 /* default & error */] =
38 { "roman", "sans", "typewriter", "symbol",
39   "cmr", "cmsy", "cmm", "cmex", "msa", "msb", "eufrak", "rsfs", "stmry",
40   "wasy", "esint", "default", "error" };
41
42 char const * LyXSeriesNames[NUM_SERIES + 2 /* default & error */] =
43 { "medium", "bold", "default", "error" };
44
45 char const * LyXShapeNames[NUM_SHAPE + 2 /* default & error */] =
46 { "up", "italic", "slanted", "smallcaps", "default", "error" };
47
48 char const * LyXSizeNames[NUM_SIZE + 4 /* increase, decrease, default & error */] =
49 { "tiny", "scriptsize", "footnotesize", "small", "normal", "large",
50   "larger", "largest", "huge", "giant",
51   "increase", "decrease", "default", "error" };
52
53 char const * LyXMiscNames[5] =
54 { "off", "on", "toggle", "default", "error" };
55
56
57 FontInfo const sane_font(
58         ROMAN_FAMILY,
59         MEDIUM_SERIES,
60         UP_SHAPE,
61         FONT_SIZE_NORMAL,
62         Color_none,
63         Color_background,
64         FONT_OFF,
65         FONT_OFF,
66         FONT_OFF,
67         FONT_OFF,
68         FONT_OFF,
69         FONT_OFF,
70         FONT_OFF);
71
72 FontInfo const inherit_font(
73         INHERIT_FAMILY,
74         INHERIT_SERIES,
75         INHERIT_SHAPE,
76         FONT_SIZE_INHERIT,
77         Color_inherit,
78         Color_inherit,
79         FONT_INHERIT,
80         FONT_INHERIT,
81         FONT_INHERIT,
82         FONT_INHERIT,
83         FONT_INHERIT,
84         FONT_INHERIT,
85         FONT_OFF);
86
87 FontInfo const ignore_font(
88         IGNORE_FAMILY,
89         IGNORE_SERIES,
90         IGNORE_SHAPE,
91         FONT_SIZE_IGNORE,
92         Color_ignore,
93         Color_ignore,
94         FONT_IGNORE,
95         FONT_IGNORE,
96         FONT_IGNORE,
97         FONT_IGNORE,
98         FONT_IGNORE,
99         FONT_IGNORE,
100         FONT_IGNORE);
101
102
103 FontInfo::FontInfo()
104 {
105         *this = sane_font;
106 }
107
108
109 /// Decreases font size_ by one
110 FontInfo & FontInfo::decSize()
111 {
112         switch (size_) {
113         case FONT_SIZE_HUGER:        size_ = FONT_SIZE_HUGE;     break;
114         case FONT_SIZE_HUGE:         size_ = FONT_SIZE_LARGEST;  break;
115         case FONT_SIZE_LARGEST:      size_ = FONT_SIZE_LARGER;   break;
116         case FONT_SIZE_LARGER:       size_ = FONT_SIZE_LARGE;    break;
117         case FONT_SIZE_LARGE:        size_ = FONT_SIZE_NORMAL;   break;
118         case FONT_SIZE_NORMAL:       size_ = FONT_SIZE_SMALL;    break;
119         case FONT_SIZE_SMALL:        size_ = FONT_SIZE_FOOTNOTE; break;
120         case FONT_SIZE_FOOTNOTE:     size_ = FONT_SIZE_SCRIPT;   break;
121         case FONT_SIZE_SCRIPT:       size_ = FONT_SIZE_TINY;     break;
122         case FONT_SIZE_TINY:         break;
123         case FONT_SIZE_INCREASE:
124                 LYXERR0("Can't FontInfo::decSize on FONT_SIZE_INCREASE");
125                 break;
126         case FONT_SIZE_DECREASE:
127                 LYXERR0("Can't FontInfo::decSize on FONT_SIZE_DECREASE");
128                 break;
129         case FONT_SIZE_INHERIT:
130                 LYXERR0("Can't FontInfo::decSize on FONT_SIZE_INHERIT");
131                 break;
132         case FONT_SIZE_IGNORE:
133                 LYXERR0("Can't FontInfo::decSize on FONT_SIZE_IGNORE");
134                 break;
135         }
136         return *this;
137 }
138
139
140 /// Increases font size_ by one
141 FontInfo & FontInfo::incSize()
142 {
143         switch (size_) {
144         case FONT_SIZE_HUGER:   break;
145         case FONT_SIZE_HUGE:         size_ = FONT_SIZE_HUGER;    break;
146         case FONT_SIZE_LARGEST:      size_ = FONT_SIZE_HUGE;     break;
147         case FONT_SIZE_LARGER:       size_ = FONT_SIZE_LARGEST;  break;
148         case FONT_SIZE_LARGE:        size_ = FONT_SIZE_LARGER;   break;
149         case FONT_SIZE_NORMAL:       size_ = FONT_SIZE_LARGE;    break;
150         case FONT_SIZE_SMALL:        size_ = FONT_SIZE_NORMAL;   break;
151         case FONT_SIZE_FOOTNOTE:     size_ = FONT_SIZE_SMALL;    break;
152         case FONT_SIZE_SCRIPT:       size_ = FONT_SIZE_FOOTNOTE; break;
153         case FONT_SIZE_TINY:         size_ = FONT_SIZE_SCRIPT;   break;
154         case FONT_SIZE_INCREASE:
155                 LYXERR0("Can't FontInfo::incSize on FONT_SIZE_INCREASE");
156                 break;
157         case FONT_SIZE_DECREASE:
158                 LYXERR0("Can't FontInfo::incSize on FONT_SIZE_DECREASE");
159                 break;
160         case FONT_SIZE_INHERIT:
161                 LYXERR0("Can't FontInfo::incSize on FONT_SIZE_INHERIT");
162                 break;
163         case FONT_SIZE_IGNORE:
164                 LYXERR0("Can't FontInfo::incSize on FONT_SIZE_IGNORE");
165                 break;
166         }
167         return *this;
168 }
169
170
171 /// Reduce font to fall back to template where possible
172 void FontInfo::reduce(FontInfo const & tmplt)
173 {
174         if (family_ == tmplt.family_)
175                 family_ = INHERIT_FAMILY;
176         if (series_ == tmplt.series_)
177                 series_ = INHERIT_SERIES;
178         if (shape_ == tmplt.shape_)
179                 shape_ = INHERIT_SHAPE;
180         if (size_ == tmplt.size_)
181                 size_ = FONT_SIZE_INHERIT;
182         if (emph_ == tmplt.emph_)
183                 emph_ = FONT_INHERIT;
184         if (underbar_ == tmplt.underbar_)
185                 underbar_ = FONT_INHERIT;
186         if (strikeout_ == tmplt.strikeout_)
187                 strikeout_ = FONT_INHERIT;
188         if (uuline_ == tmplt.uuline_)
189                 uuline_ = FONT_INHERIT;
190         if (uwave_ == tmplt.uwave_)
191                 uwave_ = FONT_INHERIT;
192         if (noun_ == tmplt.noun_)
193                 noun_ = FONT_INHERIT;
194         if (color_ == tmplt.color_)
195                 color_ = Color_inherit;
196         if (background_ == tmplt.background_)
197                 background_ = Color_inherit;
198 }
199
200
201 /// Realize font from a template
202 FontInfo & FontInfo::realize(FontInfo const & tmplt)
203 {
204         if ((*this) == inherit_font) {
205                 operator=(tmplt);
206                 return *this;
207         }
208
209         if (family_ == INHERIT_FAMILY)
210                 family_ = tmplt.family_;
211
212         if (series_ == INHERIT_SERIES)
213                 series_ = tmplt.series_;
214
215         if (shape_ == INHERIT_SHAPE)
216                 shape_ = tmplt.shape_;
217
218         if (size_ == FONT_SIZE_INHERIT)
219                 size_ = tmplt.size_;
220
221         if (emph_ == FONT_INHERIT)
222                 emph_ = tmplt.emph_;
223
224         if (underbar_ == FONT_INHERIT)
225                 underbar_ = tmplt.underbar_;
226
227         if (strikeout_ == FONT_INHERIT)
228                 strikeout_ = tmplt.strikeout_;
229
230         if (uuline_ == FONT_INHERIT)
231                 uuline_ = tmplt.uuline_;
232
233         if (uwave_ == FONT_INHERIT)
234                 uwave_ = tmplt.uwave_;
235
236         if (noun_ == FONT_INHERIT)
237                 noun_ = tmplt.noun_;
238
239         if (color_ == Color_inherit)
240                 color_ = tmplt.color_;
241
242         if (background_ == Color_inherit)
243                 background_ = tmplt.background_;
244
245         return *this;
246 }
247
248
249 Changer FontInfo::changeColor(ColorCode const color, bool cond)
250 {
251         return make_change(color_, color, cond);
252 }
253
254
255 Changer FontInfo::changeShape(FontShape const shape, bool cond)
256 {
257         return make_change(shape_, shape, cond);
258 }
259
260
261 Changer FontInfo::change(FontInfo font, bool realiz, bool cond)
262 {
263         if (realiz)
264                 font.realize(*this);
265         return make_change(*this, font, cond);
266 }
267
268
269 /// Updates a misc setting according to request
270 static FontState setMisc(FontState newfont,
271         FontState org)
272 {
273         if (newfont == FONT_TOGGLE) {
274                 if (org == FONT_ON)
275                         return FONT_OFF;
276                 else if (org == FONT_OFF)
277                         return FONT_ON;
278                 else {
279                         LYXERR0("Font::setMisc: Need state"
280                                 " FONT_ON or FONT_OFF to toggle. Setting to FONT_ON");
281                         return FONT_ON;
282                 }
283         } else if (newfont == FONT_IGNORE)
284                 return org;
285         else
286                 return newfont;
287 }
288
289 /// Updates font settings according to request
290 void FontInfo::update(FontInfo const & newfont, bool toggleall)
291 {
292         if (newfont.family_ == family_ && toggleall)
293                 setFamily(INHERIT_FAMILY); // toggle 'back'
294         else if (newfont.family_ != IGNORE_FAMILY)
295                 setFamily(newfont.family_);
296         // else it's IGNORE_SHAPE
297
298         // "Old" behaviour: "Setting" bold will toggle bold on/off.
299         switch (newfont.series_) {
300         case BOLD_SERIES:
301                 // We toggle...
302                 if (series_ == BOLD_SERIES && toggleall)
303                         setSeries(MEDIUM_SERIES);
304                 else
305                         setSeries(BOLD_SERIES);
306                 break;
307         case MEDIUM_SERIES:
308         case INHERIT_SERIES:
309                 setSeries(newfont.series_);
310                 break;
311         case IGNORE_SERIES:
312                 break;
313         }
314
315         if (newfont.shape_ == shape_ && toggleall)
316                 shape_ = INHERIT_SHAPE; // toggle 'back'
317         else if (newfont.shape_ != IGNORE_SHAPE)
318                 shape_ = newfont.shape_;
319         // else it's IGNORE_SHAPE
320
321         if (newfont.size_ != FONT_SIZE_IGNORE) {
322                 if (newfont.size_ == FONT_SIZE_INCREASE)
323                         incSize();
324                 else if (newfont.size_ == FONT_SIZE_DECREASE)
325                         decSize();
326                 else
327                         size_ = newfont.size_;
328         }
329
330         setEmph(setMisc(newfont.emph_, emph_));
331         setUnderbar(setMisc(newfont.underbar_, underbar_));
332         setStrikeout(setMisc(newfont.strikeout_, strikeout_));
333         setUuline(setMisc(newfont.uuline_, uuline_));
334         setUwave(setMisc(newfont.uwave_, uwave_));
335         setNoun(setMisc(newfont.noun_, noun_));
336         setNumber(setMisc(newfont.number_, number_));
337
338         if (newfont.color_ == color_ && toggleall)
339                 setColor(Color_inherit); // toggle 'back'
340         else if (newfont.color_ != Color_ignore)
341                 setColor(newfont.color_);
342
343         if (newfont.background_ == background_ && toggleall)
344                 setBackground(Color_inherit); // toggle 'back'
345         else if (newfont.background_ != Color_ignore)
346                 setBackground(newfont.background_);
347 }
348
349 /// Is font resolved?
350 bool FontInfo::resolved() const
351 {
352         return (family_ != INHERIT_FAMILY && series_ != INHERIT_SERIES
353                 && shape_ != INHERIT_SHAPE && size_ != FONT_SIZE_INHERIT
354                 && emph_ != FONT_INHERIT && underbar_ != FONT_INHERIT
355                 && uuline_ != FONT_INHERIT && uwave_ != FONT_INHERIT
356                 && strikeout_ != FONT_INHERIT && noun_ != FONT_INHERIT
357                 && color_ != Color_inherit
358                 && background_ != Color_inherit);
359 }
360
361
362 Color FontInfo::realColor() const
363 {
364         if (paint_color_ != Color_none)
365                 return paint_color_;
366         if (color_ == Color_none)
367                 return Color_foreground;
368         return color_;
369 }
370
371
372 namespace {
373
374 void appendSep(string & s1, string const & s2)
375 {
376         if (s2.empty())
377                 return;
378         s1 += s1.empty() ? "" : "\n";
379         s1 += s2;
380 }
381
382
383 string makeCSSTag(string const & key, string const & val)
384 {
385         return key + ": " + val + ";";
386 }
387
388
389 string getFamilyCSS(FontFamily const & f)
390 {
391         switch (f) {
392         case ROMAN_FAMILY:
393                 return "serif";
394         case SANS_FAMILY:
395                 return "sans-serif";
396         case TYPEWRITER_FAMILY:
397                 return "monospace";
398         case SYMBOL_FAMILY:
399         case CMR_FAMILY:
400         case CMSY_FAMILY:
401         case CMM_FAMILY:
402         case CMEX_FAMILY:
403         case MSA_FAMILY:
404         case MSB_FAMILY:
405         case EUFRAK_FAMILY:
406         case RSFS_FAMILY:
407         case STMARY_FAMILY:
408         case WASY_FAMILY:
409         case ESINT_FAMILY:
410         case INHERIT_FAMILY:
411         case IGNORE_FAMILY:
412                 break;
413         }
414         return "";
415 }
416
417
418 string getSeriesCSS(FontSeries const & s)
419 {
420         switch (s) {
421         case MEDIUM_SERIES:
422                 return "normal";
423         case BOLD_SERIES:
424                 return "bold";
425         case INHERIT_SERIES:
426         case IGNORE_SERIES:
427                 break;
428         }
429         return "";
430 }
431
432
433 string getShapeCSS(FontShape const & s)
434 {
435         string fs = "normal";
436         string fv = "normal";
437         switch (s) {
438         case UP_SHAPE: break;
439         case ITALIC_SHAPE: fs = "italic"; break;
440         case SLANTED_SHAPE: fs = "oblique"; break;
441         case SMALLCAPS_SHAPE: fv = "small-caps"; break;
442         case IGNORE_SHAPE:
443         case INHERIT_SHAPE:
444                 fs = ""; fv = ""; break;
445         }
446         string retval;
447         if (!fs.empty())
448                 appendSep(retval, makeCSSTag("font-style", fs));
449         if (!fv.empty())
450                 appendSep(retval, makeCSSTag("font-variant", fv));
451         return retval;
452 }
453
454
455 string getSizeCSS(FontSize const & s)
456 {
457         switch (s) {
458         case FONT_SIZE_TINY:
459                 return "xx-small";
460         case FONT_SIZE_SCRIPT:
461                 return "x-small";
462         case FONT_SIZE_FOOTNOTE:
463         case FONT_SIZE_SMALL:
464                 return "small";
465         case FONT_SIZE_NORMAL:
466                 return "medium";
467         case FONT_SIZE_LARGE:
468                 return "large";
469         case FONT_SIZE_LARGER:
470         case FONT_SIZE_LARGEST:
471                 return "x-large";
472         case FONT_SIZE_HUGE:
473         case FONT_SIZE_HUGER:
474                 return "xx-large";
475         case FONT_SIZE_INCREASE:
476                 return "larger";
477         case FONT_SIZE_DECREASE:
478                 return "smaller";
479         case FONT_SIZE_IGNORE:
480         case FONT_SIZE_INHERIT:
481                 break;
482         }
483         return "";
484 }
485         
486 } // namespace anonymous
487
488
489 // FIXME This does not yet handle color
490 docstring FontInfo::asCSS() const 
491 {
492         string retval;
493         string tmp = getFamilyCSS(family_);
494         if (!tmp.empty())
495                 appendSep(retval, makeCSSTag("font-family", tmp));
496         tmp = getSeriesCSS(series_);
497         if (!tmp.empty())
498                 appendSep(retval, makeCSSTag("font-weight", tmp));
499         appendSep(retval, getShapeCSS(shape_));
500         tmp = getSizeCSS(size_);
501         if (!tmp.empty())
502                 appendSep(retval, makeCSSTag("font-size", tmp));
503         return from_ascii(retval);      
504 }
505
506
507 // Set family according to lyx format string
508 void setLyXFamily(string const & fam, FontInfo & f)
509 {
510         string const s = ascii_lowercase(fam);
511
512         int i = 0;
513         while (LyXFamilyNames[i] != s &&
514                LyXFamilyNames[i] != string("error"))
515                 ++i;
516         if (s == LyXFamilyNames[i])
517                 f.setFamily(FontFamily(i));
518         else
519                 LYXERR0("Unknown family `" << s << '\'');
520 }
521
522
523 // Set series according to lyx format string
524 void setLyXSeries(string const & ser, FontInfo & f)
525 {
526         string const s = ascii_lowercase(ser);
527
528         int i = 0;
529         while (LyXSeriesNames[i] != s &&
530                LyXSeriesNames[i] != string("error")) ++i;
531         if (s == LyXSeriesNames[i]) {
532                 f.setSeries(FontSeries(i));
533         } else
534                 LYXERR0("Unknown series `" << s << '\'');
535 }
536
537
538 // Set shape according to lyx format string
539 void setLyXShape(string const & sha, FontInfo & f)
540 {
541         string const s = ascii_lowercase(sha);
542
543         int i = 0;
544         while (LyXShapeNames[i] != s && LyXShapeNames[i] != string("error"))
545                         ++i;
546         if (s == LyXShapeNames[i])
547                 f.setShape(FontShape(i));
548         else
549                 LYXERR0("Unknown shape `" << s << '\'');
550 }
551
552
553 // Set size according to lyx format string
554 void setLyXSize(string const & siz, FontInfo & f)
555 {
556         string const s = ascii_lowercase(siz);
557         int i = 0;
558         while (LyXSizeNames[i] != s && LyXSizeNames[i] != string("error"))
559                 ++i;
560         if (s == LyXSizeNames[i]) {
561                 f.setSize(FontSize(i));
562         } else
563                 LYXERR0("Unknown size `" << s << '\'');
564 }
565
566
567 // Set size according to lyx format string
568 FontState setLyXMisc(string const & siz)
569 {
570         string const s = ascii_lowercase(siz);
571         int i = 0;
572         while (LyXMiscNames[i] != s &&
573                LyXMiscNames[i] != string("error")) ++i;
574         if (s == LyXMiscNames[i])
575                 return FontState(i);
576         LYXERR0("Unknown misc flag `" << s << '\'');
577         return FONT_OFF;
578 }
579
580
581 /// Sets color after LyX text format
582 void setLyXColor(string const & col, FontInfo & f)
583 {
584         f.setColor(lcolor.getFromLyXName(col));
585 }
586
587
588 // Read a font definition from given file in lyx format
589 // Used for layouts
590 FontInfo lyxRead(Lexer & lex, FontInfo const & fi)
591 {
592         FontInfo f = fi;
593         bool error = false;
594         bool finished = false;
595         while (!finished && lex.isOK() && !error) {
596                 lex.next();
597                 string const tok = ascii_lowercase(lex.getString());
598
599                 if (tok.empty()) {
600                         continue;
601                 } else if (tok == "endfont") {
602                         finished = true;
603                 } else if (tok == "family") {
604                         lex.next();
605                         string const ttok = lex.getString();
606                         setLyXFamily(ttok, f);
607                 } else if (tok == "series") {
608                         lex.next();
609                         string const ttok = lex.getString();
610                         setLyXSeries(ttok, f);
611                 } else if (tok == "shape") {
612                         lex.next();
613                         string const ttok = lex.getString();
614                         setLyXShape(ttok, f);
615                 } else if (tok == "size") {
616                         lex.next();
617                         string const ttok = lex.getString();
618                         setLyXSize(ttok, f);
619                 } else if (tok == "misc") {
620                         lex.next();
621                         string const ttok = ascii_lowercase(lex.getString());
622
623                         if (ttok == "no_bar") {
624                                 f.setUnderbar(FONT_OFF);
625                         } else if (ttok == "no_strikeout") {
626                                 f.setStrikeout(FONT_OFF);
627                         } else if (ttok == "no_uuline") {
628                                 f.setUuline(FONT_OFF);
629                         } else if (ttok == "no_uwave") {
630                                 f.setUwave(FONT_OFF);
631                         } else if (ttok == "no_emph") {
632                                 f.setEmph(FONT_OFF);
633                         } else if (ttok == "no_noun") {
634                                 f.setNoun(FONT_OFF);
635                         } else if (ttok == "emph") {
636                                 f.setEmph(FONT_ON);
637                         } else if (ttok == "underbar") {
638                                 f.setUnderbar(FONT_ON);
639                         } else if (ttok == "strikeout") {
640                                 f.setStrikeout(FONT_ON);
641                         } else if (ttok == "uuline") {
642                                 f.setUuline(FONT_ON);
643                         } else if (ttok == "uwave") {
644                                 f.setUwave(FONT_ON);
645                         } else if (ttok == "noun") {
646                                 f.setNoun(FONT_ON);
647                         } else {
648                                 lex.printError("Illegal misc type");
649                         }
650                 } else if (tok == "color") {
651                         lex.next();
652                         string const ttok = lex.getString();
653                         setLyXColor(ttok, f);
654                 } else {
655                         lex.printError("Unknown tag");
656                         error = true;
657                 }
658         }
659         return f;
660 }
661
662
663 void lyxWrite(ostream & os, FontInfo const & f, string const & start, int level)
664 {
665         string indent;
666         for (int i = 0; i < level; ++i)
667                 indent += '\t';
668         ostringstream oss;
669         if (f.family() != INHERIT_FAMILY)
670                 oss << indent << "\tFamily " << LyXFamilyNames[f.family()]
671                     << '\n';
672         if (f.series() != INHERIT_SERIES)
673                 oss << indent << "\tSeries " << LyXSeriesNames[f.series()]
674                     << '\n';
675         if (f.shape() != INHERIT_SHAPE)
676                 oss << indent << "\tShape " << LyXShapeNames[f.shape()]
677                     << '\n';
678         if (f.size() != FONT_SIZE_INHERIT)
679                 oss << indent << "\tSize " << LyXSizeNames[f.size()]
680                     << '\n';
681         if (f.underbar() == FONT_ON)
682                 oss << indent << "\tMisc Underbar\n";
683         else if (f.underbar() == FONT_OFF)
684                 oss << indent << "\tMisc No_Bar\n";
685         if (f.strikeout() == FONT_ON)
686                 oss << indent << "\tMisc Strikeout\n";
687         else if (f.strikeout() == FONT_OFF)
688                 oss << indent << "\tMisc No_Strikeout\n";
689         if (f.uuline() == FONT_ON)
690                 oss << indent << "\tMisc Uuline\n";
691         else if (f.uuline() == FONT_OFF)
692                 oss << indent << "\tMisc No_Uuline\n";
693         if (f.uwave() == FONT_ON)
694                 oss << indent << "\tMisc Uwave\n";
695         else if (f.uwave() == FONT_OFF)
696                 oss << indent << "\tMisc No_Uwave\n";
697         if (f.emph() == FONT_ON)
698                 oss << indent << "\tMisc Emph\n";
699         else if (f.emph() == FONT_OFF)
700                 oss << indent << "\tMisc No_Emph\n";
701         if (f.noun() == FONT_ON)
702                 oss << indent << "\tMisc Noun\n";
703         else if (f.noun() == FONT_OFF)
704                 oss << indent << "\tMisc No_Noun\n";
705         if (f.color() != Color_inherit && f.color() != Color_none)
706                 oss << indent << "\tColor " << lcolor.getLyXName(f.color())
707                     << '\n';
708         if (!oss.str().empty()) {
709                 os << indent << start << '\n'
710                    << oss.str()
711                    << indent << "EndFont\n";
712         }
713 }
714
715
716 } // namespace lyx