× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I'll toss in a couple thoughts here - maybe not exactly related to this reply, but here goes.

I have made an assumption - that there is SOMEWHERE on the system a place, an object, whatever, that defines some kind of width for each glyph or character. Are we talking character set? I'm not sure.

Now I assume this because the printing systems on our machines know where to place very character in printed output. And it is done pretty efficiently.

I looked at other AFP APIs like the open-list one Chuck cited - there's one that copies an AFP resource into a user space - IF one of those resources gives the widths by character (and these would need to be scaled for different point sizes, I assume, unless these resources have that information for each supported point size?), then there may be a way to probe a user space for that information.

There's an API to retrieve AFP info - and it can be used against the various font resources. I don't know which type of resource is what we want here.

I also like the out-of-the-box ideas about Java - is there a way to get Java to return a list of substrings that fit in a given width? This'd be nice for word-wrap. Or to return the length for a given string? That'd be useful to scale the point size.

Another o-o-t-b thought - QM forms have an option to word-wrap in a column - I've never tried it to *PRINT with proportional fonts - I don't know if it's even possible to specify fonts in QM to that level.

Another matter I may have alluded to earlier - fonts have a "width" - the manual says that this is the number of 20ths of a point wide the space character is - at least, that's what it sounded like to me. That is how many 1440ths of an inch - it seems this is taken as some kind of average for all letters.

But it can't be used for placement of the actual output - that is done with actual widths of each glyph, right?

Oh this makes my head hurt!!

Vern

On 3/19/2015 10:02 AM, John Yeung wrote:
On Thu, Mar 19, 2015 at 10:16 AM, CRPence <CRPbottle@xxxxxxxxx> wrote:
I feel somewhat less
daft for having thought that there was an API, after finding a comment in a
reply to "Vern... I had a vague recollection of an API that would retrieve
the font widths also." from
<http://archive.midrange.com/midrange-l/201309/msg00235.html>
Chuck, I don't think anyone here would ever consider you daft. Verbose
perhaps. Maybe pedantic. But never daft. ;)

Within the thread of the first message linked above [under the web search]
are the following two messages which look at least somewhat promising with
regard to an API-like approach:

<http://archive.midrange.com/midrange-l/201309/msg00253.html>
"... QGYOLAFP might be the API you were thinking of to interrogate font
widths. Never used it myself, but format HPCS0100 might be the one.
<http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Fapis%2Fqgyolafp.htm>"
It "feels weird" to me that an API would return the width of *one
character*. It just seems like a silly interface. (I would go so far
as to call it daft! ;)

Now, that's not to say it wouldn't be useful and welcomed. But looking
at the documentation for the parameter formats for that API doesn't
give me a lot of confidence. Why is the "host font character"
CHAR(10)? That feels too big for it to be expecting a literal
character (even accounting for Unicode), and two small for it to be
expecting the Unicode character name. OK, maybe IBM has its own
10-character names for characters? But then the description for "host
font character" is this:

"The host font character set specified for font substitution. This
value is blank if the qualified AFP object name is *SYSPHFCS."

So "host font character" in the format tables really ought to read
"host font character set".

<http://archive.midrange.com/midrange-l/201309/msg00236.html>
"...
Looking at the Java
documentation the getLayout method of TextMeasurer returns a TextLayout
object. And TextLayout has a getBounds method that returns a Rectangle2D.

<http://docs.oracle.com/javame/config/cdc/opt-pkgs/api/agui/jsr209/java/awt/font/TextLayout.html>
<http://docs.oracle.com/javame/config/cdc/opt-pkgs/api/agui/jsr209/java/awt/font/TextMeasurer.html>"
The Java stuff seems much more promising. If I'm reading the
documentation correctly, its interface is much more like what I'd
expect: You give it the text you want to render, and it gives you back
the dimensions of the rendered text.

Indeed, I'm quite certain I'd read about Microsoft-centric versions of
this kind of facility, relating to how Excel calculates these things.

I wouldn't expect the Java classes to be perfectly precise, especially
when used for calculating printed output, but at least there's a good
chance they would provide a useful approximation.

John Y.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.