Closed Tontyna closed 3 months ago
And TrueTypeFontFile->getWeight()
should check for $this->subfamily === 'Bold Oblique'
, too.
I suppose you are referring to the following part of the CSS specification: https://www.w3.org/TR/css-fonts-4/#font-style-prop
The implementation you describe sounds reasonable to me. Would you like to send a pull request with those changes? :)
PR in preparation ...
When
TextRenderer.prepareRenderParams()
sees afontStyle
ofitalic
oroblique
the FontRegistry only looks for a TrueTypeFontFile whereisItalic()
is True, i.e. whre the subfamily is 'Italic'.So cursive fonts like DejaVuSans-Oblique.ttf or DejaVuSans-BoldOblique.ttf are not detected and the text is rendered 'normal'.
The spec says, that 'italic' should fall back to an 'oblique' font and 'oblique' should fall back to an 'italic' one. Not talking about creating an artficially cursive simulation,
I think a
TrueTypeFontFile->isOblique()
function should be introduced andFontRegistry.findMatchingFont()
should look for the fallback. Of course, itsbool $italic
parameter has to be adapted accordingly.