calculate letter space

calculate letter space

Post by Felix Kate » Sat, 26 Jan 2002 01:00:41



Hello,
I am working on a PDF writer. How can I make my writer calculate what
the width and height of a certain text line or text block will be?

Normally I use the built-in fonts like Helvetica. And, there is an
option to set the character width. However, I don't like to SET the
width but GET it before writing my PDF file ... Is there any table width
the widths of the letters?

Thank You for any help!

Felix

 
 
 

calculate letter space

Post by Aandi Inst » Sat, 26 Jan 2002 01:01:06



>Hello,
>I am working on a PDF writer. How can I make my writer calculate what
>the width and height of a certain text line or text block will be?

>Normally I use the built-in fonts like Helvetica. And, there is an
>option to set the character width. However, I don't like to SET the
>width but GET it before writing my PDF file ... Is there any table width
>the widths of the letters?

One way to get the widths is to use the AFM file for the font. This is
a simple ASCII file containing all widths.

Height is not calculated in the same way in normal (horizontal
paragraph) text. The text spacing and point size are decided in
advance, and never changed because of the actual boundary of text
(glyphs).
----------------------------------------

Please support usenet! Post replies and follow-ups, don't e-mail them.

 
 
 

calculate letter space

Post by Felix Kate » Sat, 26 Jan 2002 01:29:11


Quote:> One way to get the widths is to use the AFM file for the font. This is
> a simple ASCII file containing all widths.

Wow! Thank You. :-)

I'd like to ask you one further question:

This line I found in the helvetica afm file for the letter "g":
C 103 ; WX 556 ; N g ; B 29 -220 489 540 ;

I guess "WX 556" is the width, right? Scanning through the whole file I
also guess that 1000 is the maximum value for width?

Last thing I have to figure out is the relationship between font size
(point) and the width value of a character. What will be the width
counted in millimeters / inches of the letter "g" when I use Helvetica
10 pt?

Thanks again,
Felix

 
 
 

calculate letter space

Post by Aandi Inst » Sat, 26 Jan 2002 02:23:32



>> One way to get the widths is to use the AFM file for the font. This is
>> a simple ASCII file containing all widths.

>Wow! Thank You. :-)

>I'd like to ask you one further question:

>This line I found in the helvetica afm file for the letter "g":
>C 103 ; WX 556 ; N g ; B 29 -220 489 540 ;

>I guess "WX 556" is the width, right?

No guessing!
http://partners.adobe.com/asn/developer/pdfs/tn/5004.AFM_Spec.pdf

----------------------------------------

Please support usenet! Post replies and follow-ups, don't e-mail them.

 
 
 

1. calculate letter widths

Hi,

I am (still) working on a pdf writer and therefore have to calulate the
width of a character string *before* I place it on the page.

Aandi Inston once told me that I'd find the character widths in the
*.afm files. But some questions still remain (what the adobe afm specs
do not explain in a way I understand):

1. Where do I get the helvetica afm file from which is used in pdf files
as a default?
2. Inside the afm-file there is a section called 'StartCharMetrics'. The
width is e.g. coded like this 'WX 228'. But how do I calculate the
millimeter (or inch) size out of 'WX 288'?

I'd be happy for any hint!

 Felix

2. Correction to Business Modeling Analyst position in Cleveland, Ohio

3. calculate letter width: which fonts in pdf?

4. MS Hearts

5. Indesign 2.01: letter spacing doesn't work via paragraph styles

6. latest specs for dxf format

7. Calculating remaining stack space

8. mutt and pgp 6.5.1i

9. How to calculate Task stack space?

10. calculating disk space in perl

11. calculating coefficients for polynomial contrasts with unequal spacing

12. Calculating Disk Space and Freespace on Windows

13. UNIX file system free space, used space, total space