From: anthony Date: Thu, 20 Oct 2011 05:43:39 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~6785 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cfb80488a0e1a4add7c796c9eb68731441a48a37;p=imagemagick --- diff --git a/coders/ttf.c b/coders/ttf.c index 170d754d4..a3b5ba6f4 100644 --- a/coders/ttf.c +++ b/coders/ttf.c @@ -176,7 +176,19 @@ static Image *ReadTTFImage(const ImageInfo *image_info,ExceptionInfo *exception) *Text = (char *) "abcdefghijklmnopqrstuvwxyz\n" "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n" - "0123456789.:,;(*!?}^)#${%^&-+@\n"; + "0123456789.:,;(*!?}^)#${%^&-+@\n", + *Phrase = (char *) "The quick onyx goblin jumps over the lazy dwarf!"; + /* NOTE: These are Pangrams, which contain every letter in English + See http://www.artlebedev.ru/kovodstvo/sections/33/ + + "A quick brown fox jumps over the lazy dog."; + "Pack my box with five dozen liquor jugs."; + "The five boxing wizards jump quickly!"; + "Grumpy wizards make toxic brew for the evil Queen and Jack."; + + IMv6 used this well known phrase, but it is not a pangram! + "That which does not destroy me, only makes me stronger."; + */ const TypeInfo *type_info; @@ -263,22 +275,29 @@ static Image *ReadTTFImage(const ImageInfo *image_info,ExceptionInfo *exception) text=DestroyString(text); (void) FormatLocaleString(buffer,MaxTextExtent,"'\n"); ConcatenateString(&draw_info->primitive,buffer); - y+=20*(ssize_t) MultilineCensus((char *) Text)+20; - for (i=12; i <= 72; i+=6) + y+=12*(ssize_t) MultilineCensus((char *) Text); + /* FUTURE: A setting to specify the text to use */ + for (i=4; i <= 72; ) { - y+=i+12; - ConcatenateString(&draw_info->primitive," font-size 18\n"); + y += (i>12) ? i : 12; /* line spacing */ + ConcatenateString(&draw_info->primitive," font-size 12\n"); (void) FormatLocaleString(buffer,MaxTextExtent," text 10,%.20g '%.20g'\n", (double) y,(double) i); ConcatenateString(&draw_info->primitive,buffer); (void) FormatLocaleString(buffer,MaxTextExtent," font-size %.20g\n", (double) i); ConcatenateString(&draw_info->primitive,buffer); - (void) FormatLocaleString(buffer,MaxTextExtent," text 50,%.20g " - "'That which does not destroy me, only makes me stronger.'\n",(double) y); + (void) FormatLocaleString(buffer,MaxTextExtent," text 50,%.20g '%s'\n", + (double) y, Phrase); ConcatenateString(&draw_info->primitive,buffer); - if (i >= 24) + if (i <= 8) + i++; + else if (i <= 12) + i+=2; + else if (i <= 24) i+=6; + else + i+=12; } ConcatenateString(&draw_info->primitive,"pop graphic-context"); (void) DrawImage(image,draw_info,exception);