Re: [cc65] tgi_outtext, one more question :)

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2009-10-30 10:34:57
On Fri, Oct 30, 2009 at 01:35:50AM -0700, Fatih Aygün wrote:
> How should I interpret magx and magy when the text is vertical? Suppose
> that magx=1 and magy=2. And suppose that we're outputting the "|" character
> vertically. Should it be like a fat "-" or like a wide "-"?
>
> In other words, do magx and magy refer to scaling in terms of the screen
> or in terms of the glyphs?

You're right, the naming is confusing. So lets rename them:

    void __fastcall__ tgi_textstyle (unsigned char magwidth,
                                     unsigned char magheight,
                                     unsigned char dir);
    /* Set the style for text output. */

; ------------------------------------------------------------------------
; TEXTSTYLE: Set the style used when calling OUTTEXT. Text scaling for
; font width/height is passed in X/Y, the text direction is passed in A.
;
; Must set an error code: NO
;

> I would prefer to use the screen terms (wide "-"), it would make the upcoming
> pixel aspect ratio feature more useful to output undistorted text.

I think it's better to actually scale the font using a width/height scaling
factor:

  * Scaling doesn't change it's meaning if the direction changes. So

        textstyle (2, 3, TGI_TEXT_HORIZONTAL);

    must not be rewritten as

        textstyle (3, 2, TGI_TEXT_VERTICAL);

    just because the direction has changed. Changing the direction while using
    the same font size is still

        textstyle (3, 2, TGI_TEXT_HORIZONTAL);

    which seems logical.

  * I'm not sure how you want to scale bit fonts using the aspect ratio. But
    for the vector fonts, applying the scale to the width or height is easier,
    because each of the vectors has an Y part and an X part, and the code for
    scaling doesn't change if I use the height/width approach.

While thinking about it:

    void __fastcall__ tgi_textstyle (unsigned char magwidth,
                                     unsigned char magheight,
                                     unsigned char dir);
    /* Set the style for text output. */

may actually become

    void __fastcall__ tgi_textstyle (unsigned magwidth,
                                     unsigned magheight,
                                     unsigned char dir);
    /* Set the style for text output. */

using 8.8 fixed point values as scaling factors. However, this would have no
consequences for the driver, since the wrapper will pass rounded values to the
driver, but use the exact values for the vector fonts.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Oct 30 10:41:45 2009

This archive was generated by hypermail 2.1.8 : 2009-10-30 10:41:47 CET