FontConfigSubstitutionRule.isFontConfigAvaiable still return false (fontconfig installed and configured)

hi all
there was a topic https://forum.aspose.com/t/fontconfigsubstitutionrule-isfontconfigavailable-returns-false-on-linux/276056 two years ago saying same thing, I have docker env, fontconfig installed, fc-match available, but still the method return false, so enable a systemwide font substitution seems not possible, we can either overwrite the substitutionlinux.xml, or coding for both words, slides, pdf for most common ms core fonts.
however, just want to confirm, is the defect fixed or not, as Im using both 24, and 25.4 (latest version), seems still not working.
FontSettings.getDefaultInstance().getSubstitutionSettings().getFontConfigSubstitution().isFontConfigAvailable() return false
thanks

@easywoods

It seems that you are experiencing an issue where the method FontConfigSubstitutionRule.isFontConfigAvailable() is returning false, even though you have confirmed that FontConfig is installed and configured in your Docker environment. This issue has been noted in previous discussions, and it appears that the behavior of this method can vary depending on the operating system.

On Linux and macOS, the FontConfigSubstitutionRule should be enabled and available. If you are running on these platforms and still encountering this issue, it may be worth checking the following:

  1. FontConfig Installation: Ensure that FontConfig is properly installed and configured in your Docker container. You can verify this by running commands like fc-list or fc-match to see if they return the expected results.

  2. Docker Configuration: Sometimes, the Docker environment may not have access to the necessary system libraries or configurations. Make sure that your Docker container has the required permissions and configurations to access FontConfig.

  3. Aspose.Words Version: You mentioned using versions 24 and 25.4. If the issue persists across these versions, it may be beneficial to check the release notes or documentation for any known issues or fixes related to font configuration.

  4. Fallback Mechanism: If FontConfig is not available, you can consider implementing a fallback mechanism by manually specifying font substitutions in your code. This can be done using the FontSettings class to set default font substitutions.

If you continue to face difficulties, I recommend checking the following related discussions for additional insights:

  • A previous topic on the same issue might provide further context or solutions that have worked for others in similar situations.

If you have any more specific details about your setup or additional error messages, feel free to share them for more targeted assistance.

Sources:
[1]: Manipulate and Substitute TrueType Fonts in C#|Aspose.Words for .NET
[2]: Common font problems and how to solve them - Aspose Documentation

@easywoods The issue reported in the mentioned thread has been fixed in 25.3 version of Aspose.Words. If possible, could you please provide the problematic Dockerfile that will allow us to reproduce the problem? We will check and provide you more information.

hi Alexey
thanks for quick response, i use debian12 docker image, also it can be reproduced directly in WSL 2.0 from windows 11.
after dig a little into, the root cause is that callingthis method cause an error as

java.io.IOException: Cannot run program "fc-match -s Arial": error=2, No such file or directory 

believe the root cause is from the code below in whichever class in aspose lib to execute bash command for “fc-match” , the class name is com.aspose.words.internal.zzXUT

ProcessBuilder var1 = new ProcessBuilder(new String[0]);
....
var1.command(var2.toString()); 

from my side when i change it to

var1.command(new String[]{"fc-match", "-s", "Arial"});

thanks

@easywoods
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-28215

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

thanks Alexey
noted that it’s for WORDSNET, assume the ticket is covering both dotnet and java version (as they are both available under linux) .

@easywoods Yes, you are right.