Scott Johnson wrote:
> 
> Here's a weird one.  I'm writing code that draws text strings on the
> screen, in different fonts, so that two strings next to each other
> will line up on the same base line even when the two strings are in
> different fonts.  I'm using the FntBaseLine API for this.  It works
> fine for all fonts on the system (plus the extra Palm VII Clipper
> fonts) ... except for the largeFont built-in font.  That one font gets
> drawn exactly one pixel off (upward) even though I know my code and my
> math is correct.

Here's a copy of a message I sent to this group almost a year ago.  I
never got a satisfactory answer as to why the OS 3.0 results are wrong,
but it appears you're seeing the same problem I did.  I eventually
kludged this by "adjusting" the FntBaseLine results based on the ROM
version number, but it's not really a good solution.  It doesn't seem
like FntBaseLine is something that would be that hard to get right.
--Mark

------------------------------------------------------------------

I'm having some trouble understanding the results I'm getting from
FntBaseLine.  I would have
thought that if I did this:
        baseline = FntBaseLine();
        WinDrawChars(str, len, x, y);
        RctSetRectangle(&rect, x+width, y+baseline-N, N, N);
        WinDrawRectangle(&rect, 0);
that this would draw the string and an N-pixel square with the bottom of
the square aligned
with the bottom of the string.  But I find that the square comes out at
various places
depending on the font and the OS I'm using.  For the stdFont the square
is aligned at the
bottom of the chars as I expected, but for the largeFont it comes out
one pixel too *low* on
OS 3, but 2 pixels too *high* on OS 2.  If I look at the results of the
font functions, I see
FntBaseLine on OS 3 returns 12 for the largeFont and 9 for the stdFont,
but on OS 2 it returns
9 for both fonts, even though as far as I can tell visually, the fonts
are the same size on
both OSes.  Am I missing something obvious?
--Mark

Reply via email to