First I'm very much a beginner with Python/Sphinx/rinohtype.
I'm trying to figure out how to install fonts for use with rinohtype/Sphinx, rinohtype installs some fonts but I'm looking to use the fonts installed on my Windows 10 system, like Arial, I've trawled through the rinohtype docs looking for guidance but have been unable to figure this out.
Edit: output is as follows:
rinohtype 0.5.3 (2021-06-16) Copyright (c) Brecht Machiels and contributors
This program comes with ABSOLUTELY NO WARRANTY. Its use is subject
to the terms of the GNU Affero General Public License version 3.
rendering...
References cache read from C:\Users\marjohloo\Documents\Sphinx\Test\_build\rinoh\lxr.rtc
Typeface 'Arial' is not installed; searching Google Fonts.
-> not found: please check the typeface name (case-sensitive!)
Exception occurred:
File "c:\users\marjohloo\appdata\local\programs\python\python39\lib\site-packages\rinoh\resource.py", line 42, in parse_string
raise ResourceNotFound(cls, resource_name, entry_point_name)
rinoh.resource.ResourceNotFound: (<class 'rinoh.font.Typeface'>, 'ARIAL', 'arial')
rinohtype does not yet support using system fonts (issue #75). Font support neither is properly documented yet, unfortunately (but this is a start). Your font options are currently:
You can list the installed fonts using rinoh:
rinoh --list-fonts
Specifically, for Arial, you can consider using TeX Gyre Heros font instead. The TeX Gyre font collection offers free alternatives for a number of other popular fonts, including Times, Helvetica (Arial), Courier and Palatino.
If you want the real thing instead, you can create your own font package for Arial. You can use rinoh-typeface-carlito as a template for that.
If you're using Sphinx, you do not need to create and install a Python package. You can create this fonts.py
file and import it in your Sphinx conf.py
(after sys.path.insert(0, os.path.abspath('.'))
):
from pathlib import Path
from rinoh import register_typeface
from rinoh.font import Typeface
from rinoh.font.opentype import OpenTypeFont
FONTS_DIR = Path(r'C:\Windows\Fonts')
def otf(filename, **kwargs):
return OpenTypeFont(str(FONTS_DIR / filename), **kwargs)
arial = Typeface('Arial',
otf('arial.ttf'),
otf('arialbd.ttf'),
otf('ariali.ttf'),
otf('arialbi.ttf'),
)
register_typeface('arial', arial)
I'm sure this is not straightforward for anyone who's not familiar with Python. Let me know if you need more info. This situation should improve as rinohtype matures, however.