fontTypeMetrics() returns as single line though given multil
-
- Posts: 2
- Joined: 2011-06-26T05:47:03-07:00
- Authentication code: 8675308
fontTypeMetrics() returns as single line though given multil
fontTypeMetrics() returns metrics as single line for text "A\r\nB", for example 300*150 . But the text drawn on the image seems to be 150*300(2 lines).
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: fontTypeMetrics() returns as single line though given mu
Not surprising the newline and return characters are nor real characters but formatting controls, that applications would pull out to reposition the cursor appropriately.
Applications do not request font metrics for such characters as that does not make any sense!
font metrics are meant to find how much space individual characters and words, perhaps even the words with a default word spacing. Applications are then supposed to use that information to figure out if it needs to squeeze or expand spacing, or word-wrap words to the next line and so on. Newlines and Returns are not part of that calculation.
IM is also not a word processor, it only has minimal text to image handling. enough to allow annotation and labeling, nto for generating text pages. If this is what you need you are better off looking at some other text to raster image tool, like, Pango, TeX, LaTeX, and so on.
One method is convert your text to postscript (which means all layout decisions have already been made) and then have IM run the ghostscript program to convert that to a raster image. Or use TeX and LaTeX to generate DVI, that is just one step from either postscript, or raster images.
see IM examples, A Complete Text Processing System (alternatives)
http://www.imagemagick.org/Usage/text/#tex
Applications do not request font metrics for such characters as that does not make any sense!
font metrics are meant to find how much space individual characters and words, perhaps even the words with a default word spacing. Applications are then supposed to use that information to figure out if it needs to squeeze or expand spacing, or word-wrap words to the next line and so on. Newlines and Returns are not part of that calculation.
IM is also not a word processor, it only has minimal text to image handling. enough to allow annotation and labeling, nto for generating text pages. If this is what you need you are better off looking at some other text to raster image tool, like, Pango, TeX, LaTeX, and so on.
One method is convert your text to postscript (which means all layout decisions have already been made) and then have IM run the ghostscript program to convert that to a raster image. Or use TeX and LaTeX to generate DVI, that is just one step from either postscript, or raster images.
see IM examples, A Complete Text Processing System (alternatives)
http://www.imagemagick.org/Usage/text/#tex
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/