Page 1 of 1

label fails with Windows TTC TrueType font collection

Posted: 2012-06-30T12:03:40-07:00
by holistone
I am using iM 6.7.7-8 on Windows 7 32-bit to create simple labels using various fonts. It seems that if I specify a font that resolves to .ttf glyphs the process works, whereas if the font resolves to a .ttc font collection it fails, even through iM seems to know about the font. A partial listing from convert -list font follows:

Code: Select all

  Font: MoolBoran
    family: MoolBoran
    style: Normal
    stretch: Normal
    weight: 400
    glyphs: c:\windows\fonts\moolbor.ttf
  Font: MS-Gothic-&-MS-PGothic-&-MS-UI-Gothic
    family: MS Gothic & MS PGothic & MS UI Gothic
    style: Normal
    stretch: Normal
    weight: 400
    glyphs: c:\windows\fonts\msgothic.ttc
Given the above:

Code: Select all

convert -background #000 -fill #0F0 -pointsize 64 -font MoolBoran label:hello! test.gif
works fine, while

Code: Select all

convert -background #000 -fill #0F0 -pointsize 64 -font MS-Gothic label:hello! test.gif
fails with the message: convert.exe: unable to read font `MS-Gothic' @ warning/annotate.c/RenderType/871.

Is there something I need to change to enable iM to access the TTC font collection? Is it possible I have not specified the font correctly? Any help would be appreciated.

Re: label fails with Windows TTC TrueType font collection

Posted: 2012-06-30T12:09:59-07:00
by fmw42
I am not an expert on fonts and those acceptable to IM. I know it cannot handle all font types.

see
http://www.imagemagick.org/script/comma ... s.php#font

Perhaps you need to preface your font with

TTC:path2font

as seems to be the case for other fonts.

Other than that, you may need to hear back from the IM developers for further help.

Re: label fails with Windows TTC TrueType font collection

Posted: 2012-06-30T13:07:36-07:00
by holistone
The suggestion to use TTC: as a prefix had no effect, but specifying the complete path as

Code: Select all

convert -background #000 -fill #0F0 -pointsize 64 -font c:/windows/fonts/msgothic.ttc label:hello! test.gif
ran without error. The resultant image, however, has widely spaced characters, but that is perhaps a characteristic of the MS Gothic font which was designed for Japanese.

Re: label fails with Windows TTC TrueType font collection

Posted: 2012-06-30T13:14:20-07:00
by Bonzo
I belive later versions of IM can use an external program for text called Pango; have a search for it on the forum.

Re: label fails with Windows TTC TrueType font collection

Posted: 2012-06-30T13:50:14-07:00
by fmw42
Bonzo wrote:I belive later versions of IM can use an external program for text called Pango; have a search for it on the forum.

see
http://www.imagemagick.org/Usage/text/#pango

Re: label fails with Windows TTC TrueType font collection

Posted: 2012-06-30T14:28:38-07:00
by holistone
The link to image text handling was extremely helpful, independent of Pango http://www.imagemagick.org/Usage/text/

Some of those examples use -font mincho whereas I still need to use -font c:/windows/fonts/msmincho.ttc. Is there some setting that I am missing that allows the shorter version of the path specification for TTC font collections?

Re: label fails with Windows TTC TrueType font collection

Posted: 2012-06-30T15:18:48-07:00
by fmw42
your actual font name is either MS-Gothic-&-MS-PGothic-&-MS-UI-Gothic or msgothic. probably the former. try each of those, however. you have either used the wrong name or put a hyphen in it where it does not belong. Look at your convert -list font listing.

Re: label fails with Windows TTC TrueType font collection

Posted: 2012-06-30T15:46:05-07:00
by holistone
Thanks.

-font "MS-Gothic-&-MS-PGothic-&-MS-UI-Gothic" with required quotes does work.
-font msgothic does not.

Re: label fails with Windows TTC TrueType font collection

Posted: 2012-06-30T19:57:34-07:00
by fmw42
holistone wrote:Thanks.

-font "MS-Gothic-&-MS-PGothic-&-MS-UI-Gothic" with required quotes does work.
-font msgothic does not.

Yes, that is what I expected. But is it shorter typing this way or with the path to your font with a simpler name?

Re: label fails with Windows TTC TrueType font collection

Posted: 2012-07-04T18:44:38-07:00
by anthony
holistone wrote:Some of those examples use -font mincho whereas I still need to use -font c:/windows/fonts/msmincho.ttc. Is there some setting that I am missing that allows the shorter version of the path specification for TTC font collections?
You do not need to specify a path, if IM is configured to know what font files are available and where.
See the top level page of IM examples
http://www.imagemagick.org/Usage/#font

(I really should put this in a sub-page!)

Re: label fails with Windows TTC TrueType font collection

Posted: 2012-07-05T07:17:41-07:00
by holistone
As I stated at the start of the thread, I'm running WIndows 7, not Linux and have not installed Perl. iM already knows about the font and its location since it appears in the output from convert -list fonts as shown above in my first post.

My understanding based on experimentation and the comments here is that, without site specific customization, individual truetype fonts that appear in convert -list fonts output may be specified by -font followed either by:
  • the entire text following Font: enclosed in quotes or
  • by the full path and filename following glyph: on the last line of the font listing
For an individual truetype font .ttf the first option is clearly the most succinct. On the other hand, for truetype .ttc font collections, where the "name" is a concatenation of the individual names with "-&-", both choices are verbose. In the above example the msgothic.ttc file contains 3 fonts: MS-Gothic, MS-PGothic, and MS- UI-Gothic.

My expectation was that iM, like other programs using fonts installed on the system, would be able to locate the individual components of the font collection using their common name (MsGothic or MS-Gothic in the above example). It would be more consistent with common usage for iM to recognize the individual components of a font collection. Most users know the fonts on their system by their individual names, but do not know when they part of a collection.

Re: label fails with Windows TTC TrueType font collection

Posted: 2012-07-05T21:12:20-07:00
by anthony
Fair enough, it is TTC and not TTF. My bad for missing that point.

However one of the main points is you can edit the IM font configuration file and make a shorter name for the font ;-)

The "Font:" part is just a name by which the font is known by IM. It is just a label that some automatic generators extract from a font, and can leave it rather verbose, as you discovered.

Most of my linux, yes linux, script does is try to clean up and junk a lot of the useless 'foundary' and other verbose crap that is in the font name extracted from the font file. (For example remove "MS-" from "MS-Gothic", and make "ArialBold" just "ArialB"), you are free to do the same thing. You just need to locate the file (whcih is also listed in "convert -list font" output, and shorten it.