New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some SVG image previews are clipped or not rendered legibly in GB 17.6 #18
Comments
I did a spot check for these across releases and there's nothing special about the 17.6 release; these previews seem to have had issues since the first collection stored in this repository (16.7). |
Two issues are at play: As noted, some fonts (Chenla at least) don't have alpha glyphs (they do have numerical glyphs). Those fonts shouldn't be included. I believe that we should be inspecting the fonts when we generate the font collection JSON file to determine that any font included has a minimum collection of glyphs. Secondly the SVGs that are being generated (via text-to-svg) are being rendered with HEIGHT values that are too small. I'm not sure why it's too small, but the value is calculated like this:
It works for most fonts, but for a handfull of fonts the value is too small and they are shown cut off. Removing the height attribute fixes it. That MIGHT be a fix, but I'm not sure how the previews would render without a height value in the SVG preview... I can't figure out why the height is calculated incorrectly. It might be best to (for now) include an "exclusion list" of fonts that we don't want to be included in the collection. Alternately (or additionally) we could have a list of fonts for which previews aren't generated. This would fix BOTH issues as the backup font would be used for font faces with missing glyphs and the preview would render that way, and the previews that are rendered poorly would be excluded and the browser would do a better job. |
@ironprogrammer @matiasbenedetto do you think that WordPress/gutenberg#54688 captures the visibility and work that needs to be done and we can likely remove this item from the WordPress 6.5 Editor Tasks? It is slightly confusing to have an issue from an external GitHub repo ( |
@colorful-tones It seems like this is effecting the quality of a feature slated for 6.5, as without accurate previews the feature is somewhat compromised. Therefore I think it's valid to have this Issue tracked on the 6.5 board. I'd like to understand if there's been any progress towards a solution. It sounds like a complex problem to which it would be ideal to have:
|
I forgot to link my PR to this issue, but the "band-aid" solution I propose is to have an excluded list and not render previews for a collection of known offenders. |
I have looked into fixing the rendering issue but couldn't come up with a clean solution. I've tinkered with it well enough to mostly understand what the preview generation is doing, but not why the calculated height isn't correct. Part of the solution is also not rendering previews for font faces that don't have all the necessary glyphs. That's a little more straightforward, the font face can be inspected to determine it has at least alpha-numeric glyphs before rendering a preview SVG. |
Based on the outcome of the recent async Editor Triage session (#core-editor Slack link) - I'm going to move this into the In Progress column on the WordPress 6.5 Editor Tasks board. Note: there are no labels applied to this issue, because it can not be labeled, because it exists in a separate |
Good to see this one wrapped up 👏 |
This is an updated list (see WordPress/gutenberg#54688) of default font collection SVGs that are not rendered correctly or are clipped, as of Gutenberg 17.6.
Expand for a list of source SVGs...
The text was updated successfully, but these errors were encountered: