title: How to set font per Unicode range / codepoint in fontconfig?
body: <p>I recently figured out how to use <code>fontconfig</code> on Linux to set system default fonts for serif, sans-serif and monospaced fonts;  basically, you save an XML configuration file to <code>~/.config/fontconfig/fonts.conf</code> with the following content:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;!DOCTYPE fontconfig SYSTEM "fonts.dtd"&gt;
  &lt;fontconfig&gt;
  
  &lt;match&gt;
    &lt;test qual="any" name="family"&gt;&lt;string&gt;serif&lt;/string&gt;&lt;/test&gt;
    &lt;edit name="family" binding="strong" mode="prepend_first"&gt;
      &lt;string&gt;Gentium&lt;/string&gt;
      &lt;string&gt;Sun-ExtA&lt;/string&gt;
      &lt;string&gt;HanaMinA&lt;/string&gt;
      &lt;string&gt;HanaMinB&lt;/string&gt;
      &lt;/edit&gt;
    &lt;/match&gt;
  
  &lt;/fontconfig&gt;
  </code></pre>
  
  <p>The <code>binding="strong" mode="prepend_first"</code> attributes ensure that the matching rules take precedence over other settings, and the sequence of font names ensure that where a font doesn't contain a given code point / character, the next font in the list is tried (this list applies top-to-bottom; IMHO it should really be a later-binds-stronger logic, but whatever). </p>
  
  <p>The great thing about this configuration is that it works in text editors and terminal emulators alike.</p>
  
  <p>However, there's still a nag: there are many cases where a given font does contain a given glyph, but another font would be preferrable for that codepoint; for example, <code>Sun-ExtA</code> is a great default font for CJK characters, but it also covers lots and lots of non-CJK characters and has a few problematic glyphs. </p>
  
  <p>Suppose I don't like the appearance of <code>〇 U+3007 IDEOGRAPHIC NUMBER ZERO</code> in <code>Sun-ExtA</code> and would rather use <code>HanaMinA</code> for it, how could I do that with <code>fontconfig</code>? Obviously I can't just prioritize the entry for <code>HanaMinA</code> over <code>Sun-ExtA</code>, as that would affect <em>all</em> of the glyphs that are contained in both fonts.</p>
  
  <p>My hunch is that there <em>should</em> be a solution involving elements <code>&lt;charset&gt;</code> (according to the 
  <a href="https://www.freedesktop.org/software/fontconfig/fontconfig-user.html" rel="noreferrer">fontconfig user documentation</a>, "This element holds at least one  element of an Unicode code point or more") and/or <code>&lt;range&gt;</code> ("This element holds the two  elements of a range representation"—presumably to denote a range of Unicode code points). I couldn't find a single example how to use these elements, though. </p>
  
  <p><strong>Is it possible to configure fontconfig to use a specific font for a single Unicode code point or a range of codepoints?</strong></p>