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

Thibaut Cuvelier dourouc05 at gmail.com
Tue Oct 29 12:26:18 UTC 2024


On Tue, 29 Oct 2024, 10:36 Pavel Sanda, <sanda at lyx.org> wrote:

> 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?
>

If I add a default case, I get a warning, because I'm covering all cases. I
can add a comment tonight.

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20241029/d95a1a54/attachment.htm>


More information about the lyx-devel mailing list