c_spk
c_spk

Reputation: 179

Force fontconfig use specific font for given glyphs

Is it possible? I use i3bar status line and want it to display some unicode glyphs, but some of them cause the whole text be vertically misaligned and thus cropped:

enter image description here

In this particular example the speaker glyph causes this. How do I force fontconfig use a different font for it? The font in the bar is Terminus, the glyph is displayed with Noto Sans Symbols2 (seems it's the default fallback). I'm pretty sure it's due to the fonts, because on my other machine the symbols is drawn with another font (Segoe UI Emoji) and no misalignment appears. I've tried this in my .config/fontconfig/fonts.conf:

<alias>                                                                                                        
  <family>Noto Sans Symbols2</family>                                                
  <prefer>                                                                 
    <family>Segoe UI Emoji</family>                                            
  </prefer>                                                                
</alias> 

But it didn't work.

Upvotes: 3

Views: 741

Answers (1)

Logan
Logan

Reputation: 197

Assuming your speaker is U+1F50A then add this <match> to your local.conf:

<match>
  <test name="charset" compare="equals">
    <charset><int>128266</int></charset>
  </test>
  <edit name="family" mode="prepend">
    <string>monospace</string>
  </edit>
</match>

You can replace the value of the tested charset with the respective glyph and the value of the edited family with the font you wish to use. See fonts-conf(5).

Upvotes: 0

Related Questions