Using fonts from NPM packages other than typeface-* family requires additional changes in build.js
The page https://docs.antora.org/antora-ui-default/add-fonts/ describes how to change the fonts used by Antora default UI. The simple way is to install a package typeface-somefont
and refer the font file with
@font-face {
src: url(~typeface-somefont/files/somefont.woff) format("woff")
}
Thanks to changes introduced with #6 (closed), the tilde at the beginning directs Gulp to load files relative to NPM package. However, due to the very restrictive pattern used in gulp.d/tasks/build.js
:
**/~typeface-*/files/*
only packages whose name start with typeface-
can be loaded this way. This is often not enough, e.g. in my case I need characters outside very basic latin
character set provided by typescript-roboto
package (found in @openfonts/roboto_latin-ext
).
To allow easy (i.e. by modifying only CSS files) font selection from more packages I propose to change the pattern in build.js
. For example
**/~*/**/*.{ttf,woff*(2)}
matches anything starting with a tilde and ending with tiff, woff or woff2. I can confirm it works with currently used Roboto files from typeface-*
packages, as well as extended ones from @openfonts/roboto_latin-ext
(e.g. url(~@openfonts/roboto_latin-ext/files/roboto-latin-ext-400.woff2)
).
The potential risk is that due to leading **/
the pattern can also catch (incorrectly) something like url(http://some.host/~user/fonts/font.ttf)
(probably, not checked).