You are not logged in.

#1 2020-10-25 10:16:42

SmallAndSimple
Member
Registered: 2015-11-25
Posts: 57

[SOLVED]How should I work with fonts when doing OpenGL and C?

So, I am toying around with some OpenGL and FreeType2 to get text on my screen. At some point you will need to load fonts and even after some intense Googling, it is not clear to me how Arch (or Ubuntu, or whatever) wants me to work with fonts. System fonts reside at /usr/share/fonts. Is that a pinky promise? Or is there some environment variable I should use? Or should I call fc-list from my C program to get a path? And then there is also the which font question. How can I ask my OS what the default font is?

Last edited by SmallAndSimple (2020-10-26 07:58:51)

Offline

#2 2020-10-25 11:19:32

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,363

Re: [SOLVED]How should I work with fonts when doing OpenGL and C?

I think it's a pinky promise, but what you probably rather want to do is link against fontconfig so you can just request "monospace" or "sans-serif" and get the appropriately configured font.

Offline

#3 2020-10-26 07:58:28

SmallAndSimple
Member
Registered: 2015-11-25
Posts: 57

Re: [SOLVED]How should I work with fonts when doing OpenGL and C?

Ah, libfontconfig exists! That helps a lot, thank you!

Offline

Board footer

Powered by FluxBB