Workaround for the Mono PrivateFontCollection.AddFontFile bug

前端 未结 1 1545
予麋鹿
予麋鹿 2021-02-20 06:21

When I call the PrivateFontCollection.AddFontFile method in Mono.net It always returns a standard font-family. This bug has already been reported on several websites, but as far

相关标签:
1条回答
  • 2021-02-20 07:14

    Found this post from google. If it's any consolation, I'm experiencing the same issue with AddMemoryFont (works fine on Windows, mono gives me a generic font.) If it's any consolation, it looks like it's a problem with Mono, and not your code.

    Digging through the source, System.Windows.Drawing.PrivateFontCollection is mostly just a wrapper around GDIPlus.GdipPrivateAddFontFile, which itself is a wrapper around fontconfig's FcConfigAppFontAddFile. The reason it doesn't appear to throw any errors is that GDIplus doesn't check for a return value from fontconfig, so it seems like fontconfig isn't able to read the font for whatever reason, but GDIplus doesn't know about it, so neither does PrivateFontCollection.

    0 讨论(0)
提交回复
热议问题