How to use two kinds of fonts in x11-wm/dwm bar?

alphachi alphachi at mediaspirit.org
Sat Jan 24 08:17:08 UTC 2015


Hi! I installed x11-wm/dwm with XFT. I modified config.def.h to support CJK
chars in bar:
static const char font[] = "Noto Sans CJK SC Regular:style=Regular:size=11";
My locale setting is zh_CN.UTF-8 and everthing is fine.

Now I want to combine the two fonts - use x11-fonts/terminus-font to
display all chars it supports, and use x11-fonts/noto to display all chars
that x11-fonts/terminus-font doesn't support.

I did these things:
1. Add something in fonts.conf:
<match target="pattern">
    <test name="family">
        <string>monospace</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
        <string>Terminus</string>
        <string>Noto Sans CJK SC</string>
    </edit>
</match>
2. Modify config.def.h:
static const char font[] = "monospace:size=11";
3. Check font match:
> fc-match -s monospace
ter-112n.pcf.gz: "Terminus" "Regular"
ter-x12n.pcf.gz: "Terminus" "Regular"
NotoSansCJKsc-Regular.otf: "Noto Sans CJK SC" "Regular"
...

After this, I set the default font to monospace in Firefox and test - it's
ok. When I reinstall dwm, the default font of dwm changes to Terminus, but
all chars that should use Noto, like CJK chars, can't display correctly -
they display as many solid blocks.

I dont' know what's wrong, thanks!


More information about the freebsd-questions mailing list