Project

General

Profile

Actions

Bug #128

closed

Text Base returns wrong values.

Added by Brian Flanagan almost 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Target version:
Start date:
02/05/2020
Due date:
% Done:

0%

Estimated time:
Affected version:

Description

Example: Help_79 from AMOSPro_Examples disk.

The wrong Text Base is why the Bar height is wrong (too short). Text Base should return between 6 and 18 for this example, but instead return between 0 and 2. (These values were obtained by making some modifications to Help_79, and running the code on AOZ and UAE.) The entire functional code with the modifications annotated are shown below:

Screen Open 0,640,200,16,Hires : Flash Off
Palette $0,$300,$30,$3,$330,$303,$33,$320,$FFF,$F00,$F0,$F,$FF0,$F0F,$FF,$F70
Curs Off : Cls 0 : Ink 3,0

Set Paint 1 : Gr Writing 0

Get Fonts

Do
    For S=1 To 7
        Set Text S
        For F=1 To 7
            If Mouse Key Then Exit 3
            Set Font F
            T$="AMOS Professional" : Rem Set as varible to simplify BJF
            L=Text Length(T$) : Rem BJF
            B=Text Base
            LB=Text Length(Str$(B)) : Rem Get length of B (as string).  BJF
            I=Rnd(6)+1
            Ink I,,Rnd(15)
            X=Rnd(350)+5 : Y=Rnd(175)
            Bar X,Y To X+L+8+LB,Y+B+8 : Rem Add LB to bar width.  BJF
            Ink I+8,I
            Text X+4,Y+B+4,T$+Str$(B) : Rem Append B to T$.  BJF
            Wait 10
        Next
        Wait 10
    Next
Loop

FYI: Used " : Rem " vs just " ' " to ensure code works on both AOZ and UAE.

Actions

Also available in: Atom PDF