mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-06 11:23:45 +00:00
InsetMathFont: harden the new switches against unexpected values.
This commit is contained in:
parent
87fb63220a
commit
110e654b67
@ -88,6 +88,7 @@ public:
|
|||||||
font.family_ = MATH_MONOSPACE_FAMILY;
|
font.family_ = MATH_MONOSPACE_FAMILY;
|
||||||
else if (tag == "textipa" || tag == "textsc" || tag == "noun")
|
else if (tag == "textipa" || tag == "textsc" || tag == "noun")
|
||||||
font.family_ = MATH_SMALL_CAPS;
|
font.family_ = MATH_SMALL_CAPS;
|
||||||
|
// Otherwise, the tag is not recognised, use the default font.
|
||||||
|
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
@ -127,6 +128,13 @@ public:
|
|||||||
span_class = "noun";
|
span_class = "noun";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// Explicitly match the cases with an empty output. This ensures that we catch at runtime
|
||||||
|
// invalid values for the enum while keeping compile-time warnings.
|
||||||
|
if (span_class.empty() && (family_ != MATH_NORMAL_FAMILY || family_ != MATH_DOUBLE_STRUCK_FAMILY)) {
|
||||||
|
LYXERR(Debug::MATHED,
|
||||||
|
"Unexpected case in MathFontInfo::toHTMLSpanClass: family_ = " << family_
|
||||||
|
<< ", series = " << series_ << ", shape = " << shape_);
|
||||||
|
}
|
||||||
|
|
||||||
if (series_ == MATH_BOLD_SERIES) {
|
if (series_ == MATH_BOLD_SERIES) {
|
||||||
if (!span_class.empty()) span_class += "-";
|
if (!span_class.empty()) span_class += "-";
|
||||||
@ -177,6 +185,12 @@ private:
|
|||||||
// No valid value...
|
// No valid value...
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Better safe than sorry.
|
||||||
|
LYXERR(Debug::MATHED,
|
||||||
|
"Unexpected case in MathFontInfo::toMathVariantForMathML3: family_ = " << family_
|
||||||
|
<< ", series = " << series_ << ", shape = " << shape_);
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string toMathVariantForMathMLCore() const
|
std::string toMathVariantForMathMLCore() const
|
||||||
|
Loading…
Reference in New Issue
Block a user