Referencing fonts by path within ConTeXt
Hi, I'm interested in packaging a ConTeXt project in a self-contained way, so that the environment/component/project .tex files, the bibliography .bib file(s), and fonts used for typesetting are all provided in one place. (The goal is that others can generate the PDFs themselves from the source files as long as they have a sufficiently recent version of ConTeXt installed.) The usual ConTeXt directory structure makes sense for most of this, but it doesn't address the possibility of accessing fonts locally. I think I could do this with a script that temporarily sets the OSFONTDIR variable to the local fonts directory and then invokes ConTeXt to typeset the project-level file, but I was wondering if there is an easier way to do this from within ConTeXt. Specifically, is there a way to specify a font via a local path with font setup commands in an environment file? Thank you! Joey
Am 07.08.2021 um 22:29 schrieb Joey McCollum via ntg-context
: Hi,
I'm interested in packaging a ConTeXt project in a self-contained way, so that the environment/component/project .tex files, the bibliography .bib file(s), and fonts used for typesetting are all provided in one place. (The goal is that others can generate the PDFs themselves from the source files as long as they have a sufficiently recent version of ConTeXt installed.) The usual ConTeXt directory structure makes sense for most of this, but it doesn't address the possibility of accessing fonts locally. I think I could do this with a script that temporarily sets the OSFONTDIR variable to the local fonts directory and then invokes ConTeXt to typeset the project-level file, but I was wondering if there is an easier way to do this from within ConTeXt. Specifically, is there a way to specify a font via a local path with font setup commands in an environment file?
You can just specify your fonts in the typescript as [file:relative_path/fontname.otf]. OSFONTDIR isn’t as reliable as you need "mtxrun --script fonts --reload" after changing it (and sometimes "mtxrun --generate" before). Hraban
Joey McCollum via ntg-context schrieb am 07.08.2021 um 22:29:
Hi,
I'm interested in packaging a ConTeXt project in a self-contained way, so that the environment/component/project .tex files, the bibliography .bib file(s), and fonts used for typesetting are all provided in one place. (The goal is that others can generate the PDFs themselves from the source files as long as they have a sufficiently recent version of ConTeXt installed.) The usual ConTeXt directory structure makes sense for most of this, but it doesn't address the possibility of accessing fonts locally. I think I could do this with a script that temporarily sets the OSFONTDIR variable to the local fonts directory and then invokes ConTeXt to typeset the project-level file, but I was wondering if there is an easier way to do this from within ConTeXt. Specifically, is there a way to specify a font via a local path with font setup commands in an environment file?
You can use \usefontpath[...] to set a directory where ConTeXt searches for fonts but this works only when you use a typescript and not for \definefontfamily. Wolfgang
participants (3)
-
Henning Hraban Ramm
-
Joey McCollum
-
Wolfgang Schuster