question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pango Error: Fonts failed to load.

See original GitHub issue

So, basically. I’m trying to overlay an image with svg text.

const text = new Buffer( <svg height="90" width="200"><text x="45" y="65" fill="white" font-weight="bold">Some text</text></svg> );

sharp(file) .overlayWith(text) .resize(65, 65) .toFile(outputFile, (error) => { if(error){ console.log(error); } else { //do something }

When I do this, I get the following errors.

**`(sharp:7696): Pango-WARNING **: couldn’t load font “Times New Roman, Not-Rotated 12”, falling back to “Sans Not-Rotated 12”, expect ugly output.

(sharp:7696): Pango-WARNING **: couldn’t load font “Sans Not-Rotated 12”, fallin g back to “Sans Not-Rotated 12”, expect ugly output.

(sharp:7696): Pango-WARNING **: All font fallbacks failed!!!

(sharp:7696): Pango-WARNING : All font fallbacks failed!!!`

I’m not sure what I’m doing wrong. I’m rather new to programming so if someone could tell me what I’m doing wrong, I would greatly appreciate it.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
lovellcommented, Mar 17, 2018

Hello, libvips renders SVG files with librsvg, which renders fonts with pango, which searches for fonts with fontconfig, which should look in your system font directory/ies.

You haven’t said which platform you’re using, but on Linux fonts are usually in /usr/share/fonts/ and on OS X in /System/Library/Fonts or /Library/Fonts.

Do these paths exist? Do they contain the font you’re looking for, in this case “Times New Roman”?

1reaction
simeylacommented, Jun 26, 2018

I’m literally using font-family='Arial' and getting the same issue. So it’s not just that the font can’t be found. I’m running on a single machine with the same exact same overlaid SVG. The image is normally cached, but I’ve added a random cache busting timestamp.

I think it must be a resources / race condition type of issue - it’s an Angular application which auto reloads. When I refresh the app the server gets bombarded with requests from all the devices I’m testing on (iPad/iPhone/multiple browser windows/multiple images). So I think the server just can’t cope.

I’ll try to add FC_DEBUG but I’m new to NodeServices under dotnetcore and will have to lookup tomorrow how to do that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pango-WARNING **: failed to choose a font, expect ugly output
Pango may fail with this error when the font is not readable by the desktop user. Example: font installed under /usr/share/fonts/..., owned by...
Read more >
Pango-Warning – Failed to Choose a Font - Operating Systems
Am getting this error whenever am trying to access design studio, this started when I upgraded my OpenSuse from v12.3 to v13.
Read more >
convert & pango - "couldn't load font" - ImageMagick
Question: I can't seem to get "convert" usnig pango to find the appropriate fonts I enter on the command line. Summary:
Read more >
Completely broken kerning for some Microsoft TTF fonts - GitLab
The core Tahoma font has very bad/broken kerning in Pango >= 1.44. ... I would love this bug to be fixed because I...
Read more >
Dota 2 crashes - "pango-error. unable to open font file.......
The game crashes after the loading page is done. When the game loads, this error pops up and the game stops responding. Any...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found