6
convert -size 300x50 xc:none -font Arial -pointsize 20 -gravity center -draw "fill white text 1,1 \"$1\" text 0,0 \"$1\" fill black text -1,-1 \"$1\"" $WATERMARK_FILE

Above command results following error:

convert.im6: unable to read font `Arial' @ warning/annotate.c/RenderType/853.

I searched the web and find that many users saw this error, but did not find any solution. Can anyone help?

NOTE 1: Arial font is installed on my system:

$ fc-list | grep -i arial
/usr/share/fonts/truetype/msttcorefonts/Arial_Italic.ttf: Arial:style=Italic,Cursiva,kurzíva,kursiv,Πλάγια,Kursivoitu,Italique,Dőlt,Corsivo,Cursief,Kursywa,Itálico,Курсив,İtalik,Poševno,nghiêng,Etzana
/usr/share/fonts/truetype/msttcorefonts/ariblk.ttf: Arial Black:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
/usr/share/fonts/truetype/msttcorefonts/Arial.ttf: Arial:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,thường,Arrunta
/usr/share/fonts/truetype/msttcorefonts/arialbd.ttf: Arial:style=Bold,Negreta,tučné,fed,Fett,Έντονα,Negrita,Lihavoitu,Gras,Félkövér,Grassetto,Vet,Halvfet,Pogrubiony,Negrito,Полужирный,Fet,Kalın,Krepko,đậm,Lodia
/usr/share/fonts/truetype/msttcorefonts/Arial_Bold_Italic.ttf: Arial:style=Bold Italic,Negreta cursiva,tučné kurzíva,fed kursiv,Fett Kursiv,Έντονα Πλάγια,Negrita Cursiva,Lihavoitu Kursivoi,Gras Italique,Félkövér dőlt,Grassetto Corsivo,Vet Cursief,Halvfet Kursiv,Pogrubiona kursywa,Negrito Itálico,Полужирный Курсив,Tučná kurzíva,Fet Kursiv,Kalın İtalik,Krepko poševno,nghiêng đậm,Lodi etzana
/usr/share/fonts/truetype/msttcorefonts/arialbi.ttf: Arial:style=Bold Italic,Negreta cursiva,tučné kurzíva,fed kursiv,Fett Kursiv,Έντονα Πλάγια,Negrita Cursiva,Lihavoitu Kursivoi,Gras Italique,Félkövér dőlt,Grassetto Corsivo,Vet Cursief,Halvfet Kursiv,Pogrubiona kursywa,Negrito Itálico,Полужирный Курсив,Tučná kurzíva,Fet Kursiv,Kalın İtalik,Krepko poševno,nghiêng đậm,Lodi etzana
/usr/share/fonts/truetype/msttcorefonts/Arial_Black.ttf: Arial Black:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
/usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf: Arial:style=Bold,Negreta,tučné,fed,Fett,Έντονα,Negrita,Lihavoitu,Gras,Félkövér,Grassetto,Vet,Halvfet,Pogrubiony,Negrito,Полужирный,Fet,Kalın,Krepko,đậm,Lodia
/usr/share/fonts/truetype/msttcorefonts/ariali.ttf: Arial:style=Italic,Cursiva,kurzíva,kursiv,Πλάγια,Kursivoitu,Italique,Dőlt,Corsivo,Cursief,Kursywa,Itálico,Курсив,İtalik,Poševno,nghiêng,Etzana

NOTE 2: Changing the case in font name (arial instead of Arial)does not help.

NOTE 3: Using absolute font file path with complete font file name (filename.fileextension) removes the error:

convert -size 300x50 xc:none -font "/usr/share/fonts/truetype/msttcorefonts/Arial.ttf" -pointsize 20 -gravity center -draw "fill white text 1,1 \"$1\" text 0,0 \"$1\" fill black text -1,-1 \"$1\"" $WATERMARK_FILE
  • Before posting as an answer: I solved it by using absolute path to the font in question. Not sure why though. Let me know if it works :) – Jacob Vlijm Sep 13 '15 at 12:40
  • Please edit your question and post the output of fc-list | grep -i arial. The command you show worked for me with no error. Do you have Arial installed? – terdon Sep 13 '15 at 12:40
  • @terdon, on Ubuntu, this is a common issue. Never found an explanation though. – Jacob Vlijm Sep 13 '15 at 12:43
  • @JacobVlijm presumably, it's something about the name of the font in the font-cache then. Perhaps it needs lowercase arial or the name is slightly different. You also need to have the msttcorefonts installed, I think. – terdon Sep 13 '15 at 12:52
  • 1
    @terdon When I ran into it (was something for Parto: askubuntu.com/questions/552456/…) I tried everything: upper/lowercase, also all types of fonts with no luck. On some post (not AU) I ran into the suggestion to use absolute paths. Worked, without the satisfaction of understanding why. – Jacob Vlijm Sep 13 '15 at 12:57
9

Arial is not a free font. Its terms of use on open source platforms like Linux and Ubuntu make it impossible to distribute as part of an installation. You should use one of the free/open alternatives such as Liberation.

You can list the fonts you have with convert -list font. Eg:

$ convert -list font|grep Liberation-Sans
Font: Liberation-Sans-Bold
Font: Liberation-Sans-Bold-Italic
Font: Liberation-Sans-Italic
Font: Liberation-Sans-Narrow-Bold
Font: Liberation-Sans-Narrow-Bold-Italic
Font: Liberation-Sans-Narrow-Italic
Font: Liberation-Sans-Narrow-Regular
Font: Liberation-Sans-Regular
  • I can assure you, it has nothing to do with that. All fonts work if absolute paths are used. Did you try? – Jacob Vlijm Sep 13 '15 at 13:32
  • 3
    Dear meuh, it is not related to font license or copyright. It is just related to font name in my system. Your answer guided me to use $ convert -list font | grep "Font:" | grep Arial command and it resulted: Font: Arial-Black-Regular Font: Arial-Bold Font: Arial-Bold-Italic Font: Arial-Italic Font: Arial-Regular. Thus I understand that I must use "Arial-Regular" instead of "Arial" as font name. Please update your answer! – PHP Learner Sep 14 '15 at 2:23
1

I got the same problem with my Macbook today. The cause of that is a simple one.

convert uses only known fonts. All known fonts to convert are listed with this command.

convert -list font

My desired font was in ~/Library/Fonts. convert didn't list it.

I followed the instructions from Mark Setchell and was capable generating my type.xml.

The entry for my font in type.xml

<type format="ttf"
  name="MyriadPro"
  fullname="MyriadPro-Regular"
  family="Myriad Pro" 
  glyphs="/Users/vinh/Library/Fonts/myriadpro-regular.ttf"/> 

I can use the name or the absolute path to generate my image.

convert -size 300x50 xc:none -font "MyriadPro" \
  -pointsize 20 -kerning 1 -gravity center \
  -fill black -annotate 0x0+0+0 "mimacom" \
  -fill white -annotate 0x0+2+2 "mimacom" mimacom.png

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.