https://bugs.documentfoundation.org/show_bug.cgi?id=166357

--- Comment #12 from Khaled Hosny <[email protected]> ---
This appears to be caused by the weight mapping in
https://git.libreoffice.org/core/+/refs/heads/master/xmloff/source/style/weighhdl.cxx#44:

FontWeightMapper const aFontWeightMap[] =
{
    { css::awt::FontWeight::DONTKNOW,              0 },
    { css::awt::FontWeight::THIN,                  100 },
    { css::awt::FontWeight::ULTRALIGHT,            150 },
    { css::awt::FontWeight::LIGHT,                 250 },
    { css::awt::FontWeight::SEMILIGHT,             350 },
    { css::awt::FontWeight::NORMAL,                400 },
    { css::awt::FontWeight::NORMAL,                450 },
    { css::awt::FontWeight::SEMIBOLD,              600 },
    { css::awt::FontWeight::BOLD,                  700 },
    { css::awt::FontWeight::ULTRABOLD,             800 },
    { css::awt::FontWeight::BLACK,                 900 },
    { css::awt::FontWeight::DONTKNOW,             1000 }
};

The numbers seems to match what is saved in the ODF fo:font-weight. The list
also has SEMILIGHT which OpenType does not have
(https://learn.microsoft.com/en-us/typography/opentype/spec/os2#usweightclass)
and missed medium weight.

Elsewhere, medium weight seems to map to css::awt::FontWeight::NORMAL, which
matches what is saved in ODF as well
https://git.libreoffice.org/core/+/refs/heads/master/vcl/source/app/unohelp.cxx#112:

    else if( ( eWeight == WEIGHT_NORMAL ) || ( eWeight == WEIGHT_MEDIUM ) )
        return css::awt::FontWeight::NORMAL;

I think fixing this requires modifying css::awt::FontWeight to support medium
weight and fixing the mapping, but this is a a “Published UNO API” (whatever
that is) and must not be changed incompatibility, and changing the mapping to
weight numbers might break existing documents, so this might also need a
compatibility flag.

Hopefully the above can be helpful for someone looking into this.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to