2 ; Ullrich von Bassewitz, 2009-10-30
6 .include "zeropage.inc"
7 .include "tgi-kernel.inc"
14 ;-----------------------------------------------------------------------------
15 ; void __fastcall__ tgi_settextstyle (unsigned width, unsigned height,
16 ; unsigned char dir, unsigned char font);
17 ; /* Set the style for text output. The scaling factors for width and height
18 ; * are 8.8 fixed point values. This means that $100 = 1 $200 = 2 etc.
19 ; * dir is one of the TGI_TEXT_XXX constants. font is one of the TGI_FONT_XXX
24 .proc _tgi_settextstyle
26 sta _tgi_font ; Remember the font to use
28 sta _tgi_textdir ; Remember the direction
30 ; Pop the height and run directly into tgi_textscale
36 ;-----------------------------------------------------------------------------
37 ; void __fastcall__ tgi_settextscale (unsigned width, unsigned height);
38 ; /* Set the scaling for text output. The scaling factors for width and height
39 ; * are 8.8 fixed point values. This means that $100 = 1 $200 = 2 etc.
42 .proc _tgi_settextscale
46 ldy _tgi_fontheight ; Get height of bitmap font in pixels
47 sty ptr1 ; Save for later
48 ldy #6 ; Address the height
49 jsr process_onedim ; Process height
53 jsr popax ; Get width scale into a/x
54 ldy _tgi_fontwidth ; Get width of bitmap font in pixels
55 sty ptr1 ; Save for later
56 ldy #0 ; Address the width
58 ; Process one character dimension. That means:
60 ; - Store the vector font dimension in 8.8 format
61 ; - If necessary, round up/down to next integer
62 ; - Store the bitmap font dimension in 8.8 format
63 ; - Multiply by size of bitmap char in pixels
64 ; - Store the bitmap font size in 8.8 format
69 jsr store ; Store vector font scale factor
70 bit _tgi_flags ; Fine grained scaling support avail?
73 asl a ; Round to nearest full integer
78 @L2: jsr store ; Store bitmap font scale factor
80 ; The size of the font in pixels in the selected dimension is already in ptr1
81 ; So if we call umul8x16r24 we get the size in pixels in 16.8 fixed point.
82 ; Disallowing characters larger than 256 pixels, we just drop the high byte
83 ; and remember the low 16 bit as size in 8.8 format.
85 .if (.cpu .bitand ::CPU_ISET_65SC02)
95 store: sta _tgi_textscalew,y