Windows-specific Pango font identification bug

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
CatBus
Posts: 11
Joined: 2016-04-18T15:28:21-07:00
Authentication code: 1151

Windows-specific Pango font identification bug

Post by CatBus »

Any of the fonts from here seem affected: https://www.google.com/get/noto/help/cjk/

But, for specific testing, you can use NotoSansCJKtc-Medium.otf from this archive:
https://noto-website-2.storage.googleap ... hinted.zip

Create a UTF-8 file called test.txt containing the following text:

Code: Select all

<span font_desc="Noto Sans CJK TC Medium" size="10000" weight="normal" foreground="white"> </span>
And then execute:

Code: Select all

magick -background transparent pango:@test.txt output.png
On Linux, the command works fine (the test output is a blank image because the text is just a space). On Windows (Win10 64-bit), the command fails because it seems Pango cannot find the font on the system. Using ImageMagick 7.0.7 on both platforms. The same command works fine on both platforms if I change the font_desc to "Arial" or something else installed on the system, and other Windows applications can use these Noto Sans CJK fonts without issues.

I suspect there's a problem with the version of Pango integrated with the current Windows build of ImageMagick. Possibly an outdated version or porting issue.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Windows-specific Pango font identification bug

Post by fmw42 »

To be found, fonts need to be added to the type.xml file. Otherwise, try specifying the font file rather than the name. Perhaps it has to do with the spaces in the font name? Can you find the font file and its font name listed when you do

Code: Select all

magick -list font
If so, is the name as you specified it?

If not, then you need to add the font to the type.xml file.

P.S. I am not a Windows user, so know little about configuring Windows for fonts.
CatBus
Posts: 11
Joined: 2016-04-18T15:28:21-07:00
Authentication code: 1151

Re: Windows-specific Pango font identification bug

Post by CatBus »

Pango doesn't seem to use the same font libraries as the rest of ImageMagick (at least on Windows). I'm not familiar with the type.xml file though--what does it do?

For ImageMagick, the font is listed under a different name.

Font: Noto-Sans-CJK-TC-Medium
family: Noto Sans CJK TC
style: Normal
stretch: Normal
weight: 500
glyphs: c:\windows\fonts\notosanscjktc-medium.otf

Changing the name to match what's listed here (font, family, or file name) doesn't fix it under Windows, and breaks it on Linux. I have tested other fonts with spaces in the name and they work, as well as fonts with longer names (other non-CJK fonts from the Noto family).

Actually I just tried using this font with "normal" non-Pango text functions, and it works fine. So it's Pango-specific.
Post Reply