× 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.



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 ...

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.