Journal nocomment's Journal: calculating chars per inch 6
I cannot seem to find an easy way to calculate chars per inch. Anyone know of a unix utility that does that? I've found a lot that can convert to a set limit (for sending to printers etc...).
More details? (Score:2)
Are you looking for something that knows the exact width of each letter for every font you use? How do you want it to calculate characters per inch? Characters per inch would have to be an average. How should this be calculate
Re: (Score:2)
Re: (Score:2)
I think I may just write some script to do it, read in the contents of the file, and print the length of the string.
got ghostscript? (Score:2)
Substitute different fonts, sizes, and text as needed.
Re: (Score:2)
Do I paste it into some ghostscript shell somewhere?
Re: (Score:2)
echo '/Times-Roman findfont 24 scalefont setfont (This is a test) stringwidth pop 72 div =' | gs -sDEVICE=nullpage -dNOPAUSE -q -
That'll work within a shell script, at least. Getting it working within a C/C++ program would involve a few more tricks (mainly to capture stdout from another program) that I've not had to puzzle through yet.