Font Metrics

CharlieB cdbiem at nospam.net
Tue Oct 12 07:37:01 PDT 2004


Helge Blischke wrote:
> CharlieB wrote:
> >
> > Helge Blischke wrote:
> > > CharlieB wrote:
> > > >
> > > > CharlieB wrote:
> > > > > Helge Blischke wrote:
> > > > > > CharlieB wrote:
> > > > > > >
> > > > > > > In the ppd_file_t structure there is a list of availiable fonts. 35 in my case. How do I get the font metrics (or at least the char widths) for these fonts so I can generate the PostScript file?
> > > > > > >
> > > > > > > I am running Linux.
> > > > > > >
> > > > > > > Thanks in advance,
> > > > > > > Charlie
> > > > > >
> > > > > > As long as you don't use kerning, you don't need special font
> > > > > > metrics information. Everything you need is accessible to the
> > > > > > PostScript interpreter.
> > > > > >
> > > > > > What is your problem?
> > > > > >
> > > > > I want to know the widths of the chars so I can do line wrapping, etc. Is there a way to get the font metrics?
> > > >
> > > > Oh, I need underline positioning also.
> > > > >
> > > > > Thanks,
> > > > > Charlie
> > >
> > > Ok, if you won't let the PostScript interpreter do all the fancy
> > > calculations for you,
> > > you'd get the .afm files for your 35 fonts (afm means "Adobe Font
> > > Metrics"). They
> > > contain the complete metric information (including kerning tables, if
> > > applicable).
> > > But your program composing the text to be rendered must keep track of
> > > what is done
> > > with the fonts in question (encoding changes, scaling etc.).
> > >
> > > And, if you are going to rely on the built-in fonts of a printer, you
> > > *cannot* be sure
> > > that am metrics file you get reflects the exact mitrics of the font.
> > >
> > > Helge
> > Is there an easy way to get the correct afm file for the font loaded with say:
> >
> > /Times findfont
> >
> > when using cups?
> >
> > Thanks again.
> > Charlie
>
> You must know the file name of the respective afm file. "Well behaved"
> font
> vendors follow (unwritten) conventions like this:
> - let "Times-Roman" be the PostScript name of the font (i.e. the name
> you
>   use in a findfont statement).
> - Then the file containing the font program would be
>   "Times-Roman.pfa" or "Times-Roman.pfb"
> - The name of the corresponding afm file would be
>   "Times-Roman.afm"
>
> But, as you already might suspect, not all sources of fonts follow this
> convention,
> thus you simply must know ...
>
> Helge

Thanks for all your help on this, Helge. It looks like I have 2 choices if I want to know the font metrics:

1) Open a dialog box and have the user select a font. I guess I would then need to interpret the font file and draw the font manually in the PostScript file.

2) Create my own printer font.

Either way I am looking at a ton of work. God help me.

Charlie




More information about the cups mailing list