[LyX/master] Math: add a structure to hold font information.

Pavel Sanda sanda at lyx.org
Tue Oct 29 09:34:55 UTC 2024


On Tue, Oct 29, 2024 at 03:31:52AM +0000, Thibaut Cuvelier wrote:
> +	std::string toMathVariantForMathML3() const
> +	{
> +		// mathvariant is the way MathML 3 encodes fonts.
> +		// Not all combinations are supported. Official list:
> +		// https://www.w3.org/TR/MathML3/chapter3.html#presm.commatt
> +		// "initial", "tailed", "looped", and "stretched" are not implemented,
> +		// as they are only useful for Arabic characters (for which LyX has no
> +		// support right now).
> +		switch (family_) {
> +		case MATH_MONOSPACE_FAMILY:
> +			return "monospace";
> +		case MATH_DOUBLE_STRUCK_FAMILY:
> +			return "double-struck";
> +		case MATH_FRAKTUR_FAMILY:
> +			return series_ == MATH_BOLD_SERIES ? "bold-fraktur" : "fraktur";
> +		case MATH_SCRIPT_FAMILY:
> +			return series_ == MATH_BOLD_SERIES ? "bold-script" : "script";
> +		case MATH_SANS_FAMILY:
> +			if (series_ == MATH_MEDIUM_SERIES) {
> +				return shape_ == MATH_UP_SHAPE ? "sans-serif" : "sans-serif-italic";
> +			}
> +			return shape_ == MATH_UP_SHAPE ? "bold-sans-serif" : "sans-serif-bold-italic";
> +		case MATH_NORMAL_FAMILY:
> +			if (series_ == MATH_MEDIUM_SERIES) {
> +				return shape_ == MATH_UP_SHAPE ? "normal" : "italic";
> +			}
> +			return shape_ == MATH_UP_SHAPE ? "bold" : "bold-italic";
> +		case MATH_SMALL_CAPS:
> +			// No valid value...
> +				return "";
> +		}

I think default switch clause with either return "" or some warning should be here?

Pavel


More information about the lyx-devel mailing list