Re: [JAVA2D] Type 1 font measurement

2006-10-24 Thread Phil Race

Well since we don't look at the AFM file ...

-phil.

Peter B. West wrote:

We have noticed some oddity in the measurement of Type 1 fonts.
Generally speaking, the logical bounds of characters in Type1 fonts
seems to be slightly smaller than the width given in the AFM file for
that font.

As an example, I have used the luxirr.ttf serif font, converting it to a
pfb file with a corresponding afm, using the wonderful FontForge by
George Williams.

When I get the metrics or, for example "A" from the ttf file, I get a
width of 1479 in an em box of 2048 square. That is, the single-point
logical width is 1479/2048, or .7221679687.

Obtaining a GlyphVector from the single character "A" results in the
following measures of logical and visual bounds.

visual
 java.awt.geom.Rectangle2D$Float[x=0.0,y=-0.734375,w=0.71875,h=0.734375]
logical
 java.awt.geom.Rectangle2D
$Float[x=0.0,y=-0.9926758,w=0.72216797,h=1.2036133]

The logical width matches the measurement of the font in FontForge.

Converting the font to a pfb on a 1000 unit em box gives a width of 722,
reflected in the afm file. Running the same test program using the Type1
file gives:

visual
 java.awt.geom.Rectangle2D$Float[x=0.0,y=-0.734375,w=0.71875,h=0.734375]
logical
 java.awt.geom.Rectangle2D
$Float[x=0.0,y=-0.75279236,w=0.716095,h=0.9918213]

The width is .716095. This shrinkage is consistent with observations of
other Type1 files, which have not been converted from ttf, e.g. Adobe's
SY__.PFB Symbol font.

Peter

===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".


===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".


Re: [JAVA2D] Type 1 font measurement

2006-10-25 Thread Peter B. West
On Tue, 2006-10-24 at 11:16 -0700, Phil Race wrote:
> Well since we don't look at the AFM file ...
>
> -phil.
>
> Peter B. West wrote:
> ...

> > Generally speaking, the logical bounds of characters in Type1 fonts
> > seems to be slightly smaller than the width given in the AFM file for
> > that font.
...

Phil,

Plese correct me if I'm wrong, but don't the horizontal metrics in the
AFM file simply reflect the sbw or hsbw commands that are required at
the start of each CharString? For example, when I open a .pfb file,
isolated from its .afm, in FontForge, and look at individual characters,
I get values for left side bearing and for width that are consistent
with the values in the afm file for that font. This is why I'm puzzled
by the differences in Java2D.

These difference make for great difficulties in using 2D to measure text
which will be rendered by some other renderer.

Peter

===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".


Re: [JAVA2D] Type 1 font measurement

2006-11-15 Thread Peter B. West
On Wed, 2006-10-25 at 09:42 +0100, Peter B. West wrote:
> On Tue, 2006-10-24 at 11:16 -0700, Phil Race wrote:
> > Well since we don't look at the AFM file ...
> >
> > -phil.
> >
> > Peter B. West wrote:
> > ...
>
> > > Generally speaking, the logical bounds of characters in Type1 fonts
> > > seems to be slightly smaller than the width given in the AFM file for
> > > that font.
> ...
>
> Phil,
>
> Plese correct me if I'm wrong, but don't the horizontal metrics in the
> AFM file simply reflect the sbw or hsbw commands that are required at
> the start of each CharString? For example, when I open a .pfb file,
> isolated from its .afm, in FontForge, and look at individual characters,
> I get values for left side bearing and for width that are consistent
> with the values in the afm file for that font. This is why I'm puzzled
> by the differences in Java2D.
>
> These difference make for great difficulties in using 2D to measure text
> which will be rendered by some other renderer.
>
> Peter

===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".


Re: [JAVA2D] Type 1 font measurement

2006-11-15 Thread Peter B. West
On Wed, 2006-11-15 at 16:06 +, Peter B. West wrote:
> On Wed, 2006-10-25 at 09:42 +0100, Peter B. West wrote:
> > On Tue, 2006-10-24 at 11:16 -0700, Phil Race wrote:
> > > Well since we don't look at the AFM file ...
> > >
> > > -phil.
> > >
> > > Peter B. West wrote:
> > > ...
> >
> > > > Generally speaking, the logical bounds of characters in Type1 fonts
> > > > seems to be slightly smaller than the width given in the AFM file for
> > > > that font.
> > ...
> >
> > Phil,
> >
> > Plese correct me if I'm wrong, but don't the horizontal metrics in the
> > AFM file simply reflect the sbw or hsbw commands that are required at
> > the start of each CharString? For example, when I open a .pfb file,
> > isolated from its .afm, in FontForge, and look at individual characters,
> > I get values for left side bearing and for width that are consistent
> > with the values in the afm file for that font. This is why I'm puzzled
> > by the differences in Java2D.
> >
> > These difference make for great difficulties in using 2D to measure text
> > which will be rendered by some other renderer.
> >
> > Peter
>

Sorry about that. Wrong button. I was going to ask if I should bug this,
but it occurs to me that I haven't tried it in 1.6. I'll do that first,
unless you tell me that nothing has changed that is likely to affect
this.

Peter

===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".


Re: [JAVA2D] Type 1 font measurement

2006-11-15 Thread Phil Race

Worth a try. 1.6 has some Type1 hinting support that 1.5 lacked.

-phil.

Peter B. West wrote:

On Wed, 2006-11-15 at 16:06 +, Peter B. West wrote:

On Wed, 2006-10-25 at 09:42 +0100, Peter B. West wrote:

On Tue, 2006-10-24 at 11:16 -0700, Phil Race wrote:

Well since we don't look at the AFM file ...

-phil.

Peter B. West wrote:
...

Generally speaking, the logical bounds of characters in Type1 fonts
seems to be slightly smaller than the width given in the AFM file for
that font.

...

Phil,

Plese correct me if I'm wrong, but don't the horizontal metrics in the
AFM file simply reflect the sbw or hsbw commands that are required at
the start of each CharString? For example, when I open a .pfb file,
isolated from its .afm, in FontForge, and look at individual characters,
I get values for left side bearing and for width that are consistent
with the values in the afm file for that font. This is why I'm puzzled
by the differences in Java2D.

These difference make for great difficulties in using 2D to measure text
which will be rendered by some other renderer.

Peter


Sorry about that. Wrong button. I was going to ask if I should bug this,
but it occurs to me that I haven't tried it in 1.6. I'll do that first,
unless you tell me that nothing has changed that is likely to affect
this.

Peter

===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".


===
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".