Will using a custom font require installing it?
Posted
#1
(In Topic #1093)
Regular

Is it possible to do so without "installing" it to /usr/share/fonts/ + $ sudo fc-cache -v -f
For example doesn't seem to work.
It's a font containing glyph icons. So it would not make sense to install for system wide use.
Posted
Guru

have you tried installing it to ~/.local/share/fonts ?
~/.local/share/fonts will not require root privileges to install there and delete.
Possibly your program can install the font there on load, then use it, then remove it when quitting?
I just tried this and it works….
Code (gambas)
- ' Load font during _init() to ensure is loaded before other components
- tb.Text = "hello"
- tb.Height = 32
- ' Remove font file on exit
Posted
Guru

Posted
Regular

Reusing the example of BruceSteers:
Code (gambas)
- TextArea1.Text = "hello"
- TextArea1.Height = 32
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Regular

BruceSteers said
The Short answer is "Yes" a font needs to be installed, but not necessarily in the systems /usr/share/fonts/ dir
have you tried installing it to ~/.local/share/fonts ?
~/.local/share/fonts will not require root privileges to install there and delete.
Possibly your program can install the font there on load, then use it, then remove it when quitting?
I just tried this and it works….Code (gambas)
' Load font during _init() to ensure is loaded before other components tb.Text = "hello" tb.Height = 32
Yeas I like this solution thank you. And thank you for reintroducing me to ~.local/share/fonts - I had forgot it completely. And a huge plus not having to run fc-cache to use fonts in this location!
PS: I think I will skip removing the font at the end for now. But if I decide to do it, I think I will maybe use the default ramdisk location /dev/shm/ as the temporary store for the font asset and make a link pointing to it from ~.local/share/fonts - To speed things up and preserve ssd wrtite cycles.
Posted
Trainee
1 guest and 0 members have just viewed this.


