Rename LM_TC_* to FONT_STYLE_*

This makes code more uniform. This is typically something that is done
at end of cycle to limit backport issues later.
This commit is contained in:
Jean-Marc Lasgouttes 2019-06-14 16:42:02 +02:00
parent 6f2cd26103
commit 67215833a1
11 changed files with 66 additions and 66 deletions

View File

@ -146,19 +146,19 @@ enum FontState {
/// Math styles
enum MathStyle {
///
LM_ST_SCRIPTSCRIPT = 0,
FONT_STYLE_SCRIPTSCRIPT = 0,
///
LM_ST_SCRIPT,
FONT_STYLE_SCRIPT,
///
LM_ST_TEXT,
FONT_STYLE_TEXT,
///
LM_ST_DISPLAY,
FONT_STYLE_DISPLAY,
///
LM_ST_INHERIT,
FONT_STYLE_INHERIT,
///
LM_ST_IGNORE,
FONT_STYLE_IGNORE,
/// the text and display fonts are the same
NUM_STYLE = LM_ST_DISPLAY
NUM_STYLE = FONT_STYLE_DISPLAY
};

View File

@ -88,7 +88,7 @@ FontInfo const sane_font(
MEDIUM_SERIES,
UP_SHAPE,
FONT_SIZE_NORMAL,
LM_ST_TEXT,
FONT_STYLE_TEXT,
Color_none,
Color_background,
FONT_OFF,
@ -106,7 +106,7 @@ FontInfo const inherit_font(
INHERIT_SERIES,
INHERIT_SHAPE,
FONT_SIZE_INHERIT,
LM_ST_INHERIT,
FONT_STYLE_INHERIT,
Color_inherit,
Color_inherit,
FONT_INHERIT,
@ -124,7 +124,7 @@ FontInfo const ignore_font(
IGNORE_SERIES,
IGNORE_SHAPE,
FONT_SIZE_IGNORE,
LM_ST_IGNORE,
FONT_STYLE_IGNORE,
Color_ignore,
Color_ignore,
FONT_IGNORE,
@ -214,15 +214,15 @@ double FontInfo::realSize() const
// font packages. No attempt is made to implement the actual values from
// \DefineMathSizes.
switch (style()) {
case LM_ST_DISPLAY:
case LM_ST_TEXT:
case LM_ST_INHERIT:
case LM_ST_IGNORE:
case FONT_STYLE_DISPLAY:
case FONT_STYLE_TEXT:
case FONT_STYLE_INHERIT:
case FONT_STYLE_IGNORE:
break;
case LM_ST_SCRIPT:
case FONT_STYLE_SCRIPT:
d *= .73;
break;
case LM_ST_SCRIPTSCRIPT:
case FONT_STYLE_SCRIPTSCRIPT:
d *= .55;
break;
}
@ -243,7 +243,7 @@ void FontInfo::reduce(FontInfo const & tmplt)
if (size_ == tmplt.size_)
size_ = FONT_SIZE_INHERIT;
if (style_ == tmplt.style_)
style_ = LM_ST_INHERIT;
style_ = FONT_STYLE_INHERIT;
if (emph_ == tmplt.emph_)
emph_ = FONT_INHERIT;
if (underbar_ == tmplt.underbar_)
@ -287,7 +287,7 @@ FontInfo & FontInfo::realize(FontInfo const & tmplt)
if (size_ == FONT_SIZE_INHERIT)
size_ = tmplt.size_;
if (style_ == LM_ST_INHERIT)
if (style_ == FONT_STYLE_INHERIT)
style_ = tmplt.style_;
if (emph_ == FONT_INHERIT)
@ -411,7 +411,7 @@ void FontInfo::update(FontInfo const & newfont, bool toggleall)
size_ = newfont.size_;
}
if (newfont.style_ != LM_ST_IGNORE) {
if (newfont.style_ != FONT_STYLE_IGNORE) {
style_ = newfont.style_;
}
@ -441,7 +441,7 @@ bool FontInfo::resolved() const
{
return (family_ != INHERIT_FAMILY && series_ != INHERIT_SERIES
&& shape_ != INHERIT_SHAPE && size_ != FONT_SIZE_INHERIT
&& style_ != LM_ST_INHERIT
&& style_ != FONT_STYLE_INHERIT
&& emph_ != FONT_INHERIT && underbar_ != FONT_INHERIT
&& uuline_ != FONT_INHERIT && uwave_ != FONT_INHERIT
&& strikeout_ != FONT_INHERIT && xout_ != FONT_INHERIT

View File

@ -107,7 +107,7 @@ int MetricsBase::inPixels(Length const & len) const
fi.setFamily(SYMBOL_FAMILY);
else
// Math style is only taken into account in the case of mu
fi.setStyle(LM_ST_TEXT);
fi.setStyle(FONT_STYLE_TEXT);
return len.inPixels(textwidth, theFontMetrics(fi).em());
}
@ -186,14 +186,14 @@ Color PainterInfo::textColor(Color const & color) const
Changer MetricsBase::changeScript()
{
switch (font.style()) {
case LM_ST_DISPLAY:
case LM_ST_TEXT:
return font.changeStyle(LM_ST_SCRIPT);
case LM_ST_SCRIPT:
case LM_ST_SCRIPTSCRIPT:
return font.changeStyle(LM_ST_SCRIPTSCRIPT);
case LM_ST_INHERIT:
case LM_ST_IGNORE:
case FONT_STYLE_DISPLAY:
case FONT_STYLE_TEXT:
return font.changeStyle(FONT_STYLE_SCRIPT);
case FONT_STYLE_SCRIPT:
case FONT_STYLE_SCRIPTSCRIPT:
return font.changeStyle(FONT_STYLE_SCRIPTSCRIPT);
case FONT_STYLE_INHERIT:
case FONT_STYLE_IGNORE:
return Changer();
}
//remove Warning
@ -204,15 +204,15 @@ Changer MetricsBase::changeScript()
Changer MetricsBase::changeFrac()
{
switch (font.style()) {
case LM_ST_DISPLAY:
return font.changeStyle(LM_ST_TEXT);
case LM_ST_TEXT:
return font.changeStyle(LM_ST_SCRIPT);
case LM_ST_SCRIPT:
case LM_ST_SCRIPTSCRIPT:
return font.changeStyle(LM_ST_SCRIPTSCRIPT);
case LM_ST_INHERIT:
case LM_ST_IGNORE:
case FONT_STYLE_DISPLAY:
return font.changeStyle(FONT_STYLE_TEXT);
case FONT_STYLE_TEXT:
return font.changeStyle(FONT_STYLE_SCRIPT);
case FONT_STYLE_SCRIPT:
case FONT_STYLE_SCRIPTSCRIPT:
return font.changeStyle(FONT_STYLE_SCRIPTSCRIPT);
case FONT_STYLE_INHERIT:
case FONT_STYLE_IGNORE:
return Changer();
}
//remove Warning
@ -222,7 +222,7 @@ Changer MetricsBase::changeFrac()
Changer MetricsBase::changeArray()
{
return (font.style() == LM_ST_DISPLAY) ? font.changeStyle(LM_ST_TEXT)
return (font.style() == FONT_STYLE_DISPLAY) ? font.changeStyle(FONT_STYLE_TEXT)
: Changer();
}

View File

@ -94,7 +94,7 @@ fontinfo_[NUM_FAMILIES][NUM_SERIES][NUM_SHAPE][NUM_SIZE][NUM_STYLE];
GuiFontInfo * & fontinfo_ptr(FontInfo const & f)
{
// The display font and the text font are the same
size_t const style = (f.style() == LM_ST_DISPLAY) ? LM_ST_TEXT : f.style();
size_t const style = (f.style() == FONT_STYLE_DISPLAY) ? FONT_STYLE_TEXT : f.style();
return fontinfo_[f.family()][f.series()][f.realShape()][f.size()][style];
}

View File

@ -50,7 +50,7 @@ void InsetMathDiagram::metrics(MetricsInfo & mi, Dimension & dim) const
{
Changer dummy2 = mi.base.changeEnsureMath();
FontInfo & f = mi.base.font;
Changer dummy = (f.style() == LM_ST_DISPLAY) ? f.changeStyle(LM_ST_TEXT)
Changer dummy = (f.style() == FONT_STYLE_DISPLAY) ? f.changeStyle(FONT_STYLE_TEXT)
: Changer();
InsetMathGrid::metrics(mi, dim);
}
@ -60,7 +60,7 @@ void InsetMathDiagram::draw(PainterInfo & pi, int x, int y) const
{
Changer dummy2 = pi.base.changeEnsureMath();
FontInfo & f = pi.base.font;
Changer dummy = (f.style() == LM_ST_DISPLAY) ? f.changeStyle(LM_ST_TEXT)
Changer dummy = (f.style() == FONT_STYLE_DISPLAY) ? f.changeStyle(FONT_STYLE_TEXT)
: Changer();
InsetMathGrid::draw(pi, x, y);
}

View File

@ -243,12 +243,12 @@ void InsetMathFrac::metrics(MetricsInfo & mi, Dimension & dim) const
int const dy = axis_height(mi.base);
Changer dummy =
// \tfrac is always in text size
(kind_ == TFRAC) ? mi.base.font.changeStyle(LM_ST_SCRIPT) :
(kind_ == TFRAC) ? mi.base.font.changeStyle(FONT_STYLE_SCRIPT) :
// \cfrac and \dfrac are always in display size
(kind_ == CFRAC
|| kind_ == CFRACLEFT
|| kind_ == CFRACRIGHT
|| kind_ == DFRAC) ? mi.base.font.changeStyle(LM_ST_DISPLAY) :
|| kind_ == DFRAC) ? mi.base.font.changeStyle(FONT_STYLE_DISPLAY) :
// all others
mi.base.changeFrac();
Changer dummy2 = mi.base.changeEnsureMath();
@ -325,12 +325,12 @@ void InsetMathFrac::draw(PainterInfo & pi, int x, int y) const
int const dy = axis_height(pi.base);
Changer dummy =
// \tfrac is always in text size
(kind_ == TFRAC) ? pi.base.font.changeStyle(LM_ST_SCRIPT) :
(kind_ == TFRAC) ? pi.base.font.changeStyle(FONT_STYLE_SCRIPT) :
// \cfrac and \dfrac are always in display size
(kind_ == CFRAC
|| kind_ == CFRACLEFT
|| kind_ == CFRACRIGHT
|| kind_ == DFRAC) ? pi.base.font.changeStyle(LM_ST_DISPLAY) :
|| kind_ == DFRAC) ? pi.base.font.changeStyle(FONT_STYLE_DISPLAY) :
// all others
pi.base.changeFrac();
Dimension const dim1 = cell(1).dimension(*pi.base.bv);
@ -649,8 +649,8 @@ void InsetMathBinom::metrics(MetricsInfo & mi, Dimension & dim) const
Dimension dim0, dim1;
int const dy = axis_height(mi.base);
Changer dummy =
(kind_ == DBINOM) ? mi.base.font.changeStyle(LM_ST_DISPLAY) :
(kind_ == TBINOM) ? mi.base.font.changeStyle(LM_ST_SCRIPT) :
(kind_ == DBINOM) ? mi.base.font.changeStyle(FONT_STYLE_DISPLAY) :
(kind_ == TBINOM) ? mi.base.font.changeStyle(FONT_STYLE_SCRIPT) :
mi.base.changeFrac();
cell(0).metrics(mi, dim0);
cell(1).metrics(mi, dim1);
@ -676,8 +676,8 @@ void InsetMathBinom::draw(PainterInfo & pi, int x, int y) const
int m = x + dim.width() / 2;
{
Changer dummy =
(kind_ == DBINOM) ? pi.base.font.changeStyle(LM_ST_DISPLAY) :
(kind_ == TBINOM) ? pi.base.font.changeStyle(LM_ST_SCRIPT) :
(kind_ == DBINOM) ? pi.base.font.changeStyle(FONT_STYLE_DISPLAY) :
(kind_ == TBINOM) ? pi.base.font.changeStyle(FONT_STYLE_SCRIPT) :
pi.base.changeFrac();
// take dy both for the vertical alignment and for the spacing between
// cells

View File

@ -549,8 +549,8 @@ void InsetMathHull::metrics(MetricsInfo & mi, Dimension & dim) const
}
Changer dummy1 = mi.base.changeFontSet(standardFont());
Changer dummy2 = mi.base.font.changeStyle(display() ? LM_ST_DISPLAY
: LM_ST_TEXT);
Changer dummy2 = mi.base.font.changeStyle(display() ? FONT_STYLE_DISPLAY
: FONT_STYLE_TEXT);
// let the cells adjust themselves
InsetMathGrid::metrics(mi, dim);
@ -653,8 +653,8 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
Changer dummy0 = really_change_color ? pi.base.font.changeColor(color)
: Changer();
Changer dummy1 = pi.base.changeFontSet(standardFont());
Changer dummy2 = pi.base.font.changeStyle(display() ? LM_ST_DISPLAY
: LM_ST_TEXT);
Changer dummy2 = pi.base.font.changeStyle(display() ? FONT_STYLE_DISPLAY
: FONT_STYLE_TEXT);
int xmath = x;
BufferParams::MathNumber const math_number = buffer().params().getMathNumber();

View File

@ -545,7 +545,7 @@ void InsetMathMacroTemplate::createLook(int args) const
void InsetMathMacroTemplate::metrics(MetricsInfo & mi, Dimension & dim) const
{
Changer dummy1 = mi.base.changeFontSet("mathnormal");
Changer dummy2 = mi.base.font.changeStyle(LM_ST_TEXT);
Changer dummy2 = mi.base.font.changeStyle(FONT_STYLE_TEXT);
// valid macro?
MacroData const * macro = 0;
@ -587,7 +587,7 @@ void InsetMathMacroTemplate::draw(PainterInfo & pi, int x, int y) const
// FIXME: Calling Changer on the same object repeatedly is inefficient.
Changer dummy0 = pi.base.font.changeColor(Color_math);
Changer dummy1 = pi.base.changeFontSet("mathnormal");
Changer dummy2 = pi.base.font.changeStyle(LM_ST_TEXT);
Changer dummy2 = pi.base.font.changeStyle(FONT_STYLE_TEXT);
Dimension const dim = dimension(*pi.base.bv);

View File

@ -47,7 +47,7 @@ void mathed_root_metrics(MetricsInfo & mi, MathData const & nucleus,
Changer dummy = mi.base.changeEnsureMath();
Dimension dimr;
if (root) {
Changer script = mi.base.font.changeStyle(LM_ST_SCRIPTSCRIPT);
Changer script = mi.base.font.changeStyle(FONT_STYLE_SCRIPTSCRIPT);
// make sure that the dim is high enough for any character
root->metrics(mi, dimr, false);
}
@ -70,7 +70,7 @@ void mathed_root_metrics(MetricsInfo & mi, MathData const & nucleus,
*/
int const t = mi.base.solidLineThickness();
int const x_height = mathed_font_x_height(mi.base.font);
int const phi = (mi.base.font.style() == LM_ST_DISPLAY) ? x_height : t;
int const phi = (mi.base.font.style() == FONT_STYLE_DISPLAY) ? x_height : t;
// first part is the spacing, second part is the line width
// itself, and last one is the spacing above.
int const space_above = (t + phi / 4) + t + t;
@ -105,7 +105,7 @@ void mathed_draw_root(PainterInfo & pi, int x, int y, MathData const & nucleus,
int const wl = dim.width() - dimn.width();
// the "exponent"
if (root) {
Changer script = pi.base.font.changeStyle(LM_ST_SCRIPTSCRIPT);
Changer script = pi.base.font.changeStyle(FONT_STYLE_SCRIPTSCRIPT);
Dimension const dimr = root->dimension(*pi.base.bv);
int const root_offset = wl - 3 * w / 8 - dimr.width();
root->draw(pi, x + root_offset, y + (d - a)/2);

View File

@ -72,7 +72,7 @@ void InsetMathSymbol::metrics(MetricsInfo & mi, Dimension & dim) const
}
// set scriptable_
scriptable_ = false;
if (mi.base.font.style() == LM_ST_DISPLAY)
if (mi.base.font.style() == FONT_STYLE_DISPLAY)
if (sym_->inset == "cmex" || sym_->inset == "esint" ||
sym_->extra == "funclim" ||
(sym_->inset == "stmry" && sym_->extra == "mathop"))

View File

@ -147,14 +147,14 @@ int class_spacing(MathClass const mc1, MathClass const mc2,
// << "=" << spc_code << " @" << mb.style << endl;
if (spc_code < 0) {
switch (mb.font.style()) {
case LM_ST_DISPLAY:
case LM_ST_TEXT:
case LM_ST_IGNORE:
case LM_ST_INHERIT:
case FONT_STYLE_DISPLAY:
case FONT_STYLE_TEXT:
case FONT_STYLE_IGNORE:
case FONT_STYLE_INHERIT:
spc_code = abs(spc_code);
break;
case LM_ST_SCRIPT:
case LM_ST_SCRIPTSCRIPT:
case FONT_STYLE_SCRIPT:
case FONT_STYLE_SCRIPTSCRIPT:
spc_code = 0;
}
}