You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a theme uses custom fonts, it's mandatory to set the the pdf-fontsdir attribute. Otherwise, the converter will not be able to locate the font files. This requirement makes it slightly more difficult to create a custom theme. The converter should instead provide a reasonable fallback if this attribute is not set.
There are several ways which this could be done.
First, the theme could expand the token THEMES_DIR at the beginning of the font path in the theme, much like it does for the GEM_FONTS_DIR token. The THEMES_DIR token would resolve to the value of the pdf-themesdir attribute (which defaults to the directory of the main theme file that was loaded).
font:
catalog:
Lato: THEMES_DIR/Lato-Regular.ttf
Second, the default pdf-fontsdir could be changed from GEM_FONTS_DIR to {pdf-themesdir};GEM_FONTS_DIR, where {pdf-themesdir} represents the value of the pdf-themesdir attribute. When this default is used, relative font paths in the theme are resolved from the themes dir (the directory of the theme file) first before being resolved from the installed gem. The user will still be able to override this default by setting the pdf-fontsdir attribute. And this won't affect built-in themes, which use the GEM_FONTS_DIR token explicitly to refer to paths inside the gem.
For completeness, we could also consider allowing the attribute reference {pdf-themesdir} to be used in the value of pdf-fontsdir when set from the CLI or API (e.g., -a pdf-fontsdir={pdf-themesdir}/fonts). Though that's not really addressing the original issue.
The text was updated successfully, but these errors were encountered:
I'm also thinking that the pdf-fontsdir should expand to the current directory if the value is empty. Right now, this value is interpreted as GEM_FONTS_DIR. However, that's not very logical.
Hi, I think this may be related.
I have a mac, asciidoctor installed via HomeBrew. if I try to modify the size of fonts for the outputted pdf through the yaml file nothing really happens. If I try to change fonts (I thought that maybe the fonts didn't support the sizes), I get the error: "No such file or directory - Geneva.ttf not found in GEM_FONTS_DIR". I have no idea which directory that is, if it's a shell variable or something related to Ruby or gem (which i don't have really a clear idea of what they are). So I tried to set pdf-fontsdir with -a pdf-fontsdir="/System/Library/Fonts/,GEM_FONTS_DIR" to use the system fonts and this way doesn't give any errors (but still the size of the fonts don't change).
Would be cool if pdf-fontsdir is set at least to use the fonts that are installed on the computer by default.
If you need help using Asciidoctor PDF, please direct your question to https://chat.asciidoctor.org. The only comments here should be how to design and implement a solution to the specified request.
@life888888 Yes I tried both ; and , with " and without. I actually tried many other things too without luck. @mojavelinux Yes, I wanted to give some context. Thanks for the link with the chat.
I think it could make sense to have a default that for fontsdir that allows to use the broader set available on the user system.
I think the documentation could be improved regarding GEM_FONTS_DIR, how it's set and what actually is.
When a theme uses custom fonts, it's mandatory to set the the
pdf-fontsdir
attribute. Otherwise, the converter will not be able to locate the font files. This requirement makes it slightly more difficult to create a custom theme. The converter should instead provide a reasonable fallback if this attribute is not set.There are several ways which this could be done.
First, the theme could expand the token
THEMES_DIR
at the beginning of the font path in the theme, much like it does for theGEM_FONTS_DIR
token. TheTHEMES_DIR
token would resolve to the value of thepdf-themesdir
attribute (which defaults to the directory of the main theme file that was loaded).Second, the default
pdf-fontsdir
could be changed fromGEM_FONTS_DIR
to{pdf-themesdir};GEM_FONTS_DIR
, where{pdf-themesdir}
represents the value of thepdf-themesdir
attribute. When this default is used, relative font paths in the theme are resolved from the themes dir (the directory of the theme file) first before being resolved from the installed gem. The user will still be able to override this default by setting thepdf-fontsdir
attribute. And this won't affect built-in themes, which use theGEM_FONTS_DIR
token explicitly to refer to paths inside the gem.For completeness, we could also consider allowing the attribute reference
{pdf-themesdir}
to be used in the value ofpdf-fontsdir
when set from the CLI or API (e.g.,-a pdf-fontsdir={pdf-themesdir}/fonts
). Though that's not really addressing the original issue.The text was updated successfully, but these errors were encountered: