<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 29 June 2018 at 19:12, Lawrence D'Oliveiro <span dir="ltr"><<a href="mailto:ldo@geek-central.gen.nz" target="_blank">ldo@geek-central.gen.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">On Fri, 29 Jun 2018 18:12:40 +0800, Elias Mårtenson wrote:<br>
<br>
> When I use FcMatchPattern, the program returns DejaVuSans.ttf. If I<br>
> use FcMatchFont instead, it returns FreeMono.ttf.<br>
><br>
> The interesting thing is that none of these fonts actually contains<br>
> U+0x63A (checked by reading the "charset" value).<br>
<br>
</span>I’m not sure what the difference is, but I gather that Fontconfig never<br>
fails to return a font, as long as it can find at least one on your<br>
system.</blockquote><div><br></div><div>Indeed, and FcFontMatch does always return a font. However, which font it</div><div>actually returns changes depending on the argument I use to FcConfigSubstitute.</div><div>Sometimes, it seems as though the result I get from when kind is set to</div><div>FcMatchFont is better (using a purely subjective definition of "better") than what I</div><div>get when using FcMatchPattern. However, when I have searched for the use of</div><div>this function, people in general seem to use the latter.</div><div><br></div><div>The documentation for FcConfigSubstitute has the following to say about the</div><div>"kind" parameter, and I have frankly no idea what it means:</div><div><br></div><div><i>    "Performs the sequence of pattern modification operations, if kind is FcMatchPattern,</i></div><div><i>    then those tagged as pattern operations are applied, else if kind is FcMatchFont,</i></div><div><i>    those tagged as font operations are applied and p_pat is used for <test> elements</i></div><div><i>    with target=pattern."<br></i></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Remember that Fontconfig is all about “best effort” to match<br>
what you require, rather than “perfect match”. I think FcMatchPattern is<br>
the right one to use. You can then scan the list of candidates returned,<br>
querying their actual “charset” properties to see which one(s) are<br>
sufficient for your needs.<br></blockquote><div><br></div><div>FcMatchFont always returns only one result though.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">By the way, just checked DejaVu Sans on my system, and it does indeed<br>
have “U+063A ARABIC LETTER GHAIN”.<br></blockquote><div><br></div><div>Do it does. I've been testing with U+03C6 GREEK SMALL LETTER PHI, and it</div><div>does exist in DejaVu Sans, Fontconfig correctly finds it when I query for fonts</div><div>that contain this character, but when I use FcCharSetFirstPage and</div><div>FcCharSetNextPage, the resulting bitmaps indicates that this character does</div><div>not exist.</div><div><br></div><div>Bug in Fontconfig?</div><div><br></div><div>Regards,</div><div>Elias</div></div></div></div>