5ad2e1cea1 exposed a
latent bug when matching font weights that do not exactly
match any of the canonical weights in the system .
It seems that when we registered the font with FontManager,
it would modify the font weight to match a system weight,
while we now get raw values from the font instead.
So for Roboto Medium, for instance, we would now get
0.2 instead of 0.23, and since our conversion logic
would convert everything between Light (-0.4) to
Medium (0.23) to QFont::Normal, we would regard this
as normal weight instead of medium.
But on a linear scale, it makes more sense to match
to the closest canonical weight instead of requiring
exact matches.
Note that the definition says that the middle between
two weights should tend upwards, therefore we do the
comparisons in decreasing order.
[ChangeLog][QtGui][Text] Fixed matching of non-regular
font weights for application fonts on macOS.
Task-number: QTBUG-61520
Change-Id: Ieda4927c2c69ec72125257340cf06c683b031d05
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>