Open mojavelinux opened 2 years ago
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.
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.