linebender / parley

Rich text layout library
Apache License 2.0
228 stars 28 forks source link

fontique: Fix fontconfig->opentype extra black weight map #89

Closed tomcur closed 3 months ago

tomcur commented 4 months ago

OpenType extra black is usually 950. If my understanding is correct, Fontique should map fontconfig's extra black to 950, not 1000.

See also fontique::Weight::EXTRA_BLACK

https://github.com/linebender/parley/blob/0f2608cc562d7c2eef0f34819aeb15166d542b67/fontique/src/attributes.rs#L211-L212

tomcur commented 3 months ago

The fallback is hit only in case the input weight is >=215 (fontconfig's equivalent of extra black), so I think it makes sense to default to EXTRA_BLACK in that case (instead of NORMAL or extrapolating).

I'd be happy to make the change to named weights, but can only pick it up after august 12th as I'm currently on holiday.

dfrg commented 3 months ago

We correctly map extra black to 950 in the Weight type so this change looks good to me. If you’d like to replace the magic numbers with named constants, that seems like a solid improvement.

DJMcNab commented 3 months ago

(That is the sort of small change which can be made my an approver/merger, so we don't need to wait on the PR author here)