[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Right-justification
- Subject: Right-justification
- From: George Jansen <GJANSEN@AFLCIO.ORG>
- Date: Thu, 3 Oct 2002 09:44:57 -0400
A couple of days ago somebody had a question about right justification
of proportional fonts. My suggestion on this:
1. Load up your font widths into a table with rows approximately
<FONT, CHR, RAW_UNITS, PROPORTIONAL_UNITS>
where CHR is the ascii value: 65 = 'A', etc, RAW_UNITS are what you
cribbed from an AFM file or something like that, and PROPORTIONAL_UNITS
are (say) the RAW_UNITS(this_char)/RAW_UNITS('M').
2. Write a stored procedure taking a string, a font, and a point size,
and returning an estimated width. In Oracle, I'd create a package, with
spec something like
CREATE OR REPLACE PACKAGE sqr_font_scaling AS
FUNCTION width_in_points
(p_string IN VARCHAR2,
p_font IN VARCHAR2,
p_font_size IN NUMBER)
RETURN NUMBER;
END sqr_font_scaling;
/
This will be callable from SQL, ergo from sqr, as
BEGIN-SELECT
sqr_font_scaling.width_in_points($header,'Arial', 10)
FROM dual
END-SELECT
3. (Or maybe 0.) Explain to the incredibly fussy managers or whoever
has to have the stuff right-justified how much time this will take, and
what you could otherwise accomplish in it.
My suspicion is that a long afternoon might give you encouraging
results, and that even a stored procedure such as this might give
adequate results, given that it's not being called all the time.