Tabular text to graphic missalined

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
ccvalley

Tabular text to graphic missalined

Post by ccvalley »

I need to convert some text files with tabular data to graphic files to add various graphic
images and then fax the result. However when I convert to graphic the tabular data is
no longer lined up. I've tried sever fonts and have looked through the board but have had
no luck. Can anyone give me a clue on this?

Code: Select all

  ____________________________________________________________________________
       DATE  CODE DOC #  P.O. NUM.        CHARGES        CREDITS       BALANCE
  ____________________________________________________________________________
     07/05/07  1  985042 26000             260.00                      260.00
     07/08/07  1  985043 27000             270.00                      530.00
     07/10/07  1  985040 24000             240.00                      770.00
     07/11/07  1  985041 25000             250.00                    1,020.00
     07/13/07  1  985045 30000             300.00                    1,320.00
     07/15/07  1  985044 29000             290.00                    1,610.00
     07/27/07  1  127118 35055             500.15                    2,110.15
     07/27/07  1  127121 35157           2,437.86                    4,548.01
     07/30/07  1  127127 35111             560.00                    5,108.01
     07/30/07  1  127139 35168           1,707.38                    6,815.39
     07/30/07  2  043021 35055                           500.15      6,315.24
     07/31/07  1  127143 35133             798.76                    7,114.00
     07/31/07  1  127155 35192             423.73                    7,537.73
     08/01/07  1  127158 35132             521.28                    8,059.01
     08/03/07  2  540011 35168                           700.00      7,359.01
     08/07/07  1  127227 35166             603.39                    7,962.40
     08/07/07  1  127238 35193             222.50                    8,184.90
     08/08/07  1  127243 35116             356.00                    8,540.90
convert -font Courier text:sample.txt sample.gif

Image

Thanks in advance
Last edited by ccvalley on 2007-09-24T13:41:56-07:00, edited 1 time in total.
ccvalley

Re: Tabular text to graphic missalined

Post by ccvalley »

Sorry, please see other post. Still need help. Thanks
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Tabular text to graphic missalined

Post by anthony »

Use a fixed width font, or generate each column separately, with appropriate gravity justification and then +append them together.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
ccvalley

Re: Tabular text to graphic missalined

Post by ccvalley »

anthony wrote:Use a fixed width font, or generate each column separately, with appropriate gravity justification and then +append them together.
Can you advise me as to which font is fixed width and how I can get it installed. I have
tried all of the font types given with "Convert -list type".

Thanks in advance
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Tabular text to graphic missalined

Post by Bonzo »

You want a "Monospaced font"; you will have to search for one but Wiki has some info http://en.wikipedia.org/wiki/Typeface#M ... _typefaces

You give no idea how you are using ImageMagick but you should be able to give the path to the font you want to use in the code.
ccvalley

Re: Tabular text to graphic missalined

Post by ccvalley »

Thanks for the replies. It led me on the path to a solution. The Courier font should be a
mono-spaced font, however the one listed via "convert -list type" does not produce the
expected result.

I'm running a linux based system (slackware) and did a "find / -name courier\*". It listed
several directories with (I guess) courier fonts. Mostly under /usr/share/texmf/fonts/.......
I tried one a random ucrb8a.pfb and it worked to perfection. I hope this helps someone
else who follows along the path.

Thanks again
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Tabular text to graphic missalined

Post by anthony »

Bonzo wrote:You give no idea how you are using ImageMagick but you should be able to give the path to the font you want to use in the code.
You only need to give a path to a font if the font has not been placed in your personal ~/.magick/type.xml file, using a command like "imagick_type_gen"
(see top level page of IM Examples).

Also for the LATEST versions of IM you need to use convert -list font instead as 'type' cleashed with the list of posible '-type' settings.

Not all Courier fonts are mono-spaced. And there has been an on going struggle between IM and BAD fonts that do not properly define themselves, though this is usually for label: and caption: font usage, rather than text:
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply