<div dir="ltr">Hi Francesco,<div><br></div><div>You might find this blogpost of mine useful:</div><div><br></div><div>  <a href="http://mces.blogspot.com/2015/05/how-to-use-custom-application-fonts.html">http://mces.blogspot.com/2015/05/how-to-use-custom-application-fonts.html</a></div><div><br></div><div>Cheers,</div><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">behdad<br><a href="http://behdad.org/" target="_blank">http://behdad.org/</a></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Feb 12, 2022 at 3:28 AM Francesco Pretto <<a href="mailto:ceztko@gmail.com">ceztko@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Fri, 11 Feb 2022 at 21:09, Lawrence D'Oliveiro<br>
<<a href="mailto:ldo@geek-central.gen.nz" target="_blank">ldo@geek-central.gen.nz</a>> wrote:<br>
><br>
> It seems to me, an application shouldn’t go messing about with a user’s<br>
> default settings. Create a custom application-specific configuration, by<br>
> all means, and base it on the default as appropriate. But don’t go<br>
> replacing the default -- leave that up to user-controlled configuration<br>
> tools.<br>
<br>
You talk about "an application" missing my use case, which I actually<br>
didn't talk about: I have a PDF manipulation library[1] that needs to<br>
use fontconfig for regular font lookups. My idea is that my library<br>
code should attempt first to check if an existing default<br>
configuration exists, and if it does it should use that. If it does<br>
not exist I want to chose to let fontconfig to default initialize one<br>
or create a custom one that fit better the purpose of my PDF library.<br>
You are probably right that I should not mess with the default<br>
configuration by pushing my custom one as the global default (even if<br>
this affects only the process where my shared library was<br>
initialized). Still a method to know the current default configuration<br>
(even if that is null) would be good to have (the mentioned<br>
FcConfigGetCurrentDirect) and allow me to better decide what to do in<br>
the library code. An "application", as you say, using my PDF library<br>
would be still able/free to push a default configuration externally,<br>
indirectly controlling the behavior of my PDF library and other user<br>
libraries using fontconfig, or it can control directly the behavior of<br>
the PDF library with regard to font lookups. I hope my use case is<br>
clear. Summarizing: I now agree with you that I should not push a<br>
custom default fontconfig configuration in my library code, but I<br>
should still be able to know if a default configuration exists or not.<br>
<br>
Regards,<br>
Francesco<br>
<br>
[1] <a href="https://github.com/pdfmm/pdfmm" rel="noreferrer" target="_blank">https://github.com/pdfmm/pdfmm</a><br>
</blockquote></div>