Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Possible bug: Word-wrap oddity
#7
@Pete:  The glitch here is in the sheer fact that you start printing at pixel 1, instead of pixel 0, which is wrong when dealing with non-monospaced fonts.

Code: (Select All)
handle& = _NewImage(800, 600, 256)
Screen handle&

fontpath$ = Environ$("SYSTEMROOT") + "\fonts\lucon.ttf" 'Find Windows Folder Path.
font& = _LoadFont(fontpath$, 16)
_Font font&

Sleep

Cls
Print "Demo with monospace added.": Print
For i = 0 To 79
    ' With monospace added, this will print as one line.
    Color 4
    Locate 2, 10 * i: Print "*";
    Color 3
    _PrintString (10 * i, _FontHeight * 3), "*"
Next

When you run, LOCATE gives you an error on line 15 for the first character, as it refuses to print at pixel #0.  (Printstring doesn't care about this and is happy to print to such a point.)

Since you start printing characters from pixel 1 to 10...11 to 20...21 to 30...31 to 40....  you'll end up with the last pixel going on 791 to 800.... but the screen is dimensioned from 0 to 799, so you're off-screen and have to move down to the next line to print.

Adjust your print position to account for that single pixel offset (which is goofy), and then you're golden!

Code: (Select All)
handle& = _NewImage(800, 600, 256)
Screen handle&

fontpath$ = Environ$("SYSTEMROOT") + "\fonts\lucon.ttf" 'Find Windows Folder Path.
font& = _LoadFont(fontpath$, 16)
_Font font&

'Sleep

Cls
Print "Demo with monospace added.": Print
For i = 0 To 79
    ' With monospace added, this will print as one line.
    Color 4
    If i = 0 Then
        Locate 2, 1: Print "*" 'shift forward one pixel to print at LOC 1, not LOC 0.
    Else
        Locate 2, 10 * i: Print "*";
    End If
    Color 3
    _PrintString (10 * i, _FontHeight * 3), "*"
Next

It's not the lack of monospace which is screwing things up, it's the restriction that PRINT has to start on the 1st pixel, and not the 0th one when dealing with non-monsopaced fonts.
Reply


Messages In This Thread
Possible bug: Word-wrap oddity - by hanness - 05-04-2022, 06:41 AM
RE: Possible bug: Word-wrap oddity - by Pete - 05-04-2022, 08:38 AM
RE: Possible bug: Word-wrap oddity - by Pete - 05-04-2022, 09:50 AM
RE: Possible bug: Word-wrap oddity - by SMcNeill - 05-04-2022, 10:35 AM
RE: Possible bug: Word-wrap oddity - by hanness - 05-04-2022, 04:35 PM
RE: Possible bug: Word-wrap oddity - by Pete - 05-04-2022, 05:06 PM
RE: Possible bug: Word-wrap oddity - by SMcNeill - 05-04-2022, 05:50 PM
RE: Possible bug: Word-wrap oddity - by hanness - 05-04-2022, 06:15 PM
RE: Possible bug: Word-wrap oddity - by SMcNeill - 05-04-2022, 06:18 PM
RE: Possible bug: Word-wrap oddity - by Pete - 05-04-2022, 06:29 PM
RE: Possible bug: Word-wrap oddity - by SMcNeill - 05-04-2022, 06:50 PM
RE: Possible bug: Word-wrap oddity - by Pete - 05-04-2022, 09:57 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Is this a bug with Round or is it just me BarrySWTP 10 1,294 07-07-2025, 08:40 PM
Last Post: BarrySWTP
  Exiting FOR NEXT, maybe a bug? Version 4.1.0 on Linux Circlotron 4 866 05-09-2025, 02:22 AM
Last Post: Circlotron
  I have fallen in a bug or weird behaviour TempodiBasic 2 694 10-08-2024, 06:09 PM
Last Post: TempodiBasic
  3.13.1 bug report - keyboard characters swapped Circlotron 3 1,026 06-03-2024, 05:16 AM
Last Post: Circlotron
  I need input on a possible bug in v3.5.0 TerryRitchie 50 8,645 05-22-2024, 07:03 PM
Last Post: TerryRitchie

Forum Jump:


Users browsing this thread: 1 Guest(s)