4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
8 * \author Jean-Marc Lasgouttes
9 * \author Angus Leeming
12 * Full author contact details are available in file CREDITS.
15 #ifndef FONT_PROPERTIES_H
16 #define FONT_PROPERTIES_H
19 #include "tex2lyx/Font.h"
22 #include "ColorCode.h"
23 #include "FontEnums.h"
45 ): family_(family
), series_(series
), shape_(shape
), size_(size
),
46 color_(color
), background_(background
), emph_(emph
),
47 underbar_(underbar
), noun_(noun
), number_(number
)
50 /// Decreases font size by one
52 /// Increases font size by one
57 FontFamily
family() const { return family_
; }
58 void setFamily(FontFamily f
) { family_
= f
; }
59 FontSeries
series() const { return series_
; }
60 void setSeries(FontSeries s
) { series_
= s
; }
61 FontShape
shape() const { return shape_
; }
62 void setShape(FontShape s
) { shape_
= s
; }
63 FontSize
size() const { return size_
; }
64 void setSize(FontSize s
) { size_
= s
; }
65 FontState
emph() const { return emph_
; }
66 void setEmph(FontState e
) { emph_
= e
; }
67 FontState
underbar() const { return underbar_
; }
68 void setUnderbar(FontState u
) { underbar_
= u
; }
69 FontState
noun() const { return noun_
; }
70 void setNoun(FontState n
) { noun_
= n
; }
71 FontState
number() const { return number_
; }
72 void setNumber(FontState n
) { number_
= n
; }
73 ColorCode
color() const { return color_
; }
74 void setColor(ColorCode c
) { color_
= c
; }
75 ColorCode
background() const { return background_
; }
76 void setBackground(ColorCode b
) { background_
= b
; }
80 void update(FontInfo
const & newfont
, bool toggleall
);
82 /** Reduce font to fall back to template where possible.
83 Equal fields are reduced to INHERIT */
84 void reduce(FontInfo
const & tmplt
);
86 /// Realize font from a template (INHERIT are realized)
87 FontInfo
& realize(FontInfo
const & tmplt
);
88 /// Is a given font fully resolved?
89 bool resolved() const;
92 ColorCode
realColor() const;
94 /// Converts logical attributes to concrete shape attribute
95 /// Try hard to inline this as it shows up with 4.6 % in the profiler.
96 FontShape
realShape() const
99 return SMALLCAPS_SHAPE
;
100 if (emph_
== FONT_ON
)
101 return (shape_
== UP_SHAPE
) ? ITALIC_SHAPE
: UP_SHAPE
;
105 bool isSymbolFont() const
123 friend bool operator==(FontInfo
const & lhs
, FontInfo
const & rhs
);
136 ColorCode background_
;
148 inline bool operator==(FontInfo
const & lhs
, FontInfo
const & rhs
)
150 return lhs
.family_
== rhs
.family_
151 && lhs
.series_
== rhs
.series_
152 && lhs
.shape_
== rhs
.shape_
153 && lhs
.size_
== rhs
.size_
154 && lhs
.color_
== rhs
.color_
155 && lhs
.background_
== rhs
.background_
156 && lhs
.emph_
== rhs
.emph_
157 && lhs
.underbar_
== rhs
.underbar_
158 && lhs
.noun_
== rhs
.noun_
159 && lhs
.number_
== rhs
.number_
;
163 inline bool operator!=(FontInfo
const & lhs
, FontInfo
const & rhs
)
165 return !operator==(lhs
, rhs
);
169 extern FontInfo
const sane_font
;
170 /// All inherit font.
171 extern FontInfo
const inherit_font
;
173 extern FontInfo
const ignore_font
;
177 #endif // TEX2LYX_FONT_H