-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No Fonts installed on this device #125
Comments
Yup, same here my GitHub Action tests fail on Linux with:
|
I am seeing the same issue on my linux desktop machine. Edit: and I can confirm that simply switching the version to |
I created this PR #132, for my work fine; I used 'ubuntu-latest' in Azure-devops |
I've tried v1.2.11 and v1.2.12 on Cent OS, but I still get the same message: "No Fonts installed on this device!". I've also tried to copy a .ttf file to ~/.fonts, but then I still get the same message. Which I find strange, because the issue reported was caused by subfolders not being included. |
Your /etc/fonts/fonts.conf is not being read. |
Ok. In which folders does it look then? |
If I understand correctly, it kinda reads fonts.conf, but in a very hacky way: PdfSharpCore/PdfSharpCore/Utils/FontResolver.cs Lines 60 to 91 in 0f45719
|
Correction: It used to be hard-coded. Yea, unfortunately, it's hard to find a good documentation for what to do with the contents of fonts.conf. |
Fixed the top-directory issue, and replaced the .ttf regex with EndsWith (case-insensitive).
it should now find *.ttf fonts in ~/.fonts and all of its subdirectories. |
Question is, should we only load *.ttf, or also *.woff and *.otf. |
@darzid:
hard-coded, just in case there is no fonts.conf, or that there are no such entries. |
@jamesgurung, @pingvinen: Linux uses fontfonfig to configure the location of the fonts. |
@ststeiger Many thanks. I no longer have an issue; it was a regression in 1.2.8 that I assume was fixed in a subsequent update because everything is working fine now. 👍 I haven't closed because it looks like others are having related issues. |
I found that hard-coded directories weren't working for me, fonts inside |
@jamesgurung @notclive: Merged pinvoke of libfontconfig with pull request 151 for Linux. |
@notclive did you have to stay with the two directory deep solution? I have copied a .ttf file to usr/share/fonts but am still getting the error. I have a .net core web app running in a docker container on an AWS Linux server. Does the Docker container need to reference the font folder (usr/share/fonts) via a mount? |
@bcourtneyri: Does the container have truetype-fonts installed ? |
@ststeiger thanks for the follow up. The container itself does not. I'm considering whether to mount a volume with .ttfs to the linux server or to package the .ttf fonts within the asp net core project. Is it possible to do some sort of font resolve with packaged .ttfs? |
Sure, you can make a dll where the ttfs are an embedded resource. |
@ststeiger thanks again. I managed to it working using the sample code you provided. |
Relates to #161 |
I'm getting "No Fonts installed on this device!" error, running version 1.3.62 on .net7.0 linux container. Do I need to do any extra step or should it just work? System.IO.FileNotFoundException: No Fonts installed on this device! |
@diogoxluis I packaged the fonts into my app and referenced them from there. It worked for me as I only needed a few. |
Thanks... any pointers to how I do that? |
You just put the ttf files into a folder somewhere in your project and refer to them in the code. |
After using 1.2.6 version I'm getting "The type initializer for 'PdfSharpCore.Utils.FontResolver' threw an exception". |
Everything was running fine on 1.2.6, but since updating to 1.2.8 the default font resolver can no longer find fonts when deployed to a Linux container. It runs fine on Windows, but not when deployed using the following Dockerfile. The error is "No Fonts installed on this device".
I realise it's possible to implement a custom
IFontResolver
(although I know literally nothing about where Linux fonts are installed, so wouldn't know where to start!)Is this something that could be fixed to work by default in this scenario?
The text was updated successfully, but these errors were encountered: