-
Notifications
You must be signed in to change notification settings - Fork 499
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
Renderer crash with checklist when using non-default font #651
Comments
It's true that if the glyph is missing from the primary font and it uses the glyph from the fallback font, and the glyph has a different size, then it won't have reserved enough space and will fail to write. I think there's a setting in Prawn to tell it to try anyway or truncate. The immediate solution to this problem is to either pick a font that has the bullet glyph or to modify the font using fontforge and add it. |
I think we also talked about being able to customize the bullet glyphs. In other words, allow the character to be set per named glyph (circle, disc, square). |
Thanks @mojavelinux. By removing the fallback font I was able to get past the renderer failure and get the square box icon (i.e. glyph not found). I found in the code where the glyphs to use for checkboxes are defined, but I haven't been able to find where the glyphs that are used for source code callouts are defined. Can you point me to where the source code callout glyphs are defined? |
In addition to being able to customize the character for the bullet gyphs it would be nice to be able to set the font. For example to use the FontAwesome font for some/all glyphs. |
I've done a bit more testing (hopefully its valid testing). I'm using the Liberation Sans font installed on Fedora 24. In a LibreOffice document I'm able to insert the Unicode characters 2610 and 2611 (ctrl+shift+u+2610+enter) and the correct ballot box glyphs are inserted. However, when the same font is used in the asciidoctor-pdf theme the ballot boxes glyphs are not found. I opened the font in fontforge and the glyphs at unicode 2610 and 2611 are not defined. This leads me to think that LibreOffice is doing some kind of glyph merging?? (I'm definitely not a font expert). Any ideas are welcome. I've tried the same test in a few different fonts as well (such as Overpass) with the same result. |
Have the same problem. Trying to use DejaVu fonts gives me the "CannotFit" error when using:
Cant we just tell Prawn to autoshrink into the space available? that would make all the troubles go away... |
It's not quite that simple, but it is possible to make this work for any font. The space has to be pre-calculated to ensure that the glyph gets placed in the correct location, and on the correct page. There's just some sort of error in that calculation atm (it's entirely possible this is a rounding error). I'm confident it can be fixed. |
We'll find a solution for alpha.15. |
To achieve this, how can I help? I would like to use asciidoctor-pdf sooo badly... |
See my explanation here: #619 (comment) Simply put, it's a bug in the code. |
…ting width of string - introduce rendered_width_of_string and rendered_width_of_char methods - take width of char from fallback font into account if not glyph not present in font - calculate width of conum using correct font
A fix is now available. If you have time, please test. |
Long story short, the width_of_string method in Prawn does not check whether the font provides the glyph. Therefore, the return value is invalid when the font does not contain the width. If fallback fonts are being used, we now continue looking through the fonts to find which font will be used to render the char before taking the width. |
…ting width of string - introduce rendered_width_of_string and rendered_width_of_char methods - take width of char from fallback font into account if not glyph not present in font - calculate width of conum using correct font
When using a
base: font_family
that is not a built-in default font rendering a file with a checklist will cause the renderer to die with a CannotFit error.The theme I am using is based on the default theme and add additional fonts (such as Google Noto that I downloaded from the Git repo).
The same error is generated if the asciidoctor file contains source code callouts.
This may be related to issue #609 and/or #619.
The text was updated successfully, but these errors were encountered: