PAGSEG has many caveats but may work if there are not too many "office names" and there are rarely office name additions.


Some of the issues with using PAGSEG:

- Each new office name must be manually loaded as a PAGSEG (as opposed to using POSITION which can get the office name from a database field)
- PAGSEG text cannot easily be concatenated to other text
- PAGSEG is fixed - it will always land on the same place on a page. If the office name will be used in other reports, POSITION can place the name in a different position with a different size using the same input database fields.


Maybe with POSITION you can get close enough with a simple algorithm by counting the narrow letters such as "i" and the wide letters such as "w" ???


POSITION example with variable STARTING position:

R PFTEXT1R
PFTEXT1 10 POSITION(&VPOS_TX &HPOS_TX)
FONT(&FONTID_TX +
(*POINTSIZE &PNT_SZ_TX))
VPOS_TX 5S 3P
HPOS_TX 5S 3P
FONTID_TX 10 P
PNT_SZ_TX 4S 1P





-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Buck Calabro
Sent: Thursday, September 05, 2013 3:57 PM
To: midrange-l@xxxxxxxxxxxx
Subject: Re: Centering with proportional font

On 9/5/2013 4:28 PM, Roger Harman wrote:
A colleague is asking me how to center a variable length text field on a form using font 5707. It's an office name and varies during the print run.

I've done this years ago with HP fonts by building a width table and using absolute positioning with PCL.

That's going to be quite precise. Does your office name need to be
centred to a tenth of an inch? Sometimes it helps to nail down how much
effort to expend...

I've not used AFP much except for drawing forms. How do you deal with variable or relative text postioning this using AFP and proportional fonts?

A first approximation is to divide the length in half and position that
way via POSITION(). Some names will be more skewed than others. If
that's not good enough, you can always go the route of building a custom
width table and doing that calculation. But with AFP there's a third
way: Make the office name an image file as wide as the paper. Centre
the name within the image and print it at position 1 via PAGSEG. Be
advised that PAGSEG won't rotate, so if the page is rotated you'll need
a rotated image.
--buck

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.