BurntSushi / xgbutil

A utility library to make use of the X Go Binding easier. (Implements EWMH and ICCCM specs, key binding support, etc.)
Do What The F*ck You Want To Public License
194 stars 46 forks source link

[question] Fall back fonts. #41

Open CamilleScholtz opened 7 years ago

CamilleScholtz commented 7 years ago

How would I go about loading fallback fonts, for example I'm using a ttf font that doesn't have Japanese characters, so I want a different to be used whenever there is a Japanese character.

BurntSushi commented 7 years ago

I don't understand the question. You need to load the fonts yourself.

Please provide more detail, including the code you're using.

CamilleScholtz commented 7 years ago

So I'm making a panel for X. What it does is display various stats. So first load a font: https://github.com/onodera-punpun/melonbar/blob/master/bar.go#L108-L119 and then later use that font to draw a given string: https://github.com/onodera-punpun/melonbar/blob/master/bar.go#L194-L199

Now, one of the pieces of information I display is the title of the music I'm currently listening, which often uses Japanese, Korean or Arabic characters. Now say that for example I loaded a font that has gyphs for the Latin alphabet, but not for Korean, I want it to automatically fall back on a specified font that does have Korean characters.

My excuses is this is not something actually handled by xgraphics, but by freetype!

BurntSushi commented 7 years ago

I have no idea how to solve your problem, but it doesn't seem it should be solved by xgbutil.