🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #2587

Re: Character side bearings

#2587
From: Steve Phillips
Date: Mon, 23 Jul 1990 17:02
34 lines
1743 bytes
In article <2259@dino.cs.iastate.edu> hascall@cs.iastate.edu (John Hascall) writes:
>   How does one determine the left side bearing of a character (in a
>particular font)?  I am looking at section 5.5, "Font Metric Information",
>of the Red Book, (pp 95-96), which says:  "The sequence
>
>   charpath flattenpath pathbbox
>
>may be used to determine character bounding boxes and side bearings."
>
>   Well, I can see how it gives you the bounding box, but how do you
>get the (left) side bearing?
>

Render the character at 1000 points starting at (0,0):

/FontName findfont 1000 scalefont setfont
0 0 moveto
(A) charpatah flattenpath pathbbox

Now the X coordinate of the left edge of the path bounding box will
be the left sidebearing in 1000th's of an em.

What you're doing is positioning the em-square at the origin, so the
pathbbox will give you the relative position of the character outline
within the em-square.

Hope this helps...

- Steve
-- 
============================================================================
Steve Phillips                                         Tegra-Varityper, Inc.
tegra!phillips@uunet.com                               Billerica, MA
============================================================================
Technical Details
Message-ID: <1143@io.tegra.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!psuvax1!uwm.edu!wuarchive!uunet!wang!tegra!phillips
References: <2259@dino.cs.iastate.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!psuvax1!uwm.edu!wuarchive!uunet!wang!tegra!phillips
From: phillips@tegra.COM (Steve Phillips)
Newsgroups: comp.lang.postscript
Subject: Re: Character side bearings
Message-ID: <1143@io.tegra.COM>
Date: 23 Jul 90 17:02:06 GMT
References: <2259@dino.cs.iastate.edu>
Reply-To: phillips@io.UUCP (Steve Phillips)
Distribution: usa
Organization: Tegra-Varityper, Inc. Billerica, MA
Lines: 34