Confusing Chr$ explanation
#32
(07-12-2023, 06:03 AM)PhilOfPerth Wrote: While experimenting with Chr$(), I find that Chr$(95) (the underscore) is the only one that is not displayed in a 16-bit screen mode. (it displays in 32 - bit mode) 
I suspect this is because the character uses the lowest row of the cell (row 8). Is this the reason? 
But Chr$ 92, 93, 103, 106, 112, 113, and 121 (mostly serif characters) all appear to use row 8, and they display in full.  Confused
Screen Mode 0 is text based exklusiv screen
SCREEN 0
or
SCREEN _NEWIMAGE(640, 400, 0)

Screen Mode 1-15 are palette based exklusiv screens.

As an example:
SCREEN 13
or
SCREEN _NEWIMAGE(320, 200, 13)

SCREEN 10
or
SCREEN _NEWIMAGE(640, 350, 10)


Screen Mode 256 is a full 256 palette based screen. Almost identical to Screen Mode 13.
SCREEN _NEWIMAGE(800, 600, 256)


Screen Mode 32 is the True color Mode
SCREEN _NEWIMAGE(800, 600, 32)

16 Bit color or High color Mode does not exist in QB64.
However, 16-bit graphics can be displayed on 32-bit.


Each screen mode has its own text width and height.
This is calculated from the screen width, screen height, font width and font height
As an example:

640 x 480 Screen

courbd.ttf in 32 height have a 22 width

640 / 22 = about 29,1 Text width on screen
480 / 32 = 15 Text height on screen

You have a 29,1 x 15 Text Screen on a 640x480 Screen with the courbd.ttf font in 32 height
An error would then occur as soon as the 'Locate' command addresses the 16th row or 30nd cell.

CHR$(95) may not be displayed because the text height may be an odd number?
Example:
320 x 200 Screen +  courbd.ttf in 32 height have a 22 width

320 / 22 = about 14,55 Text width on screen
200 / 32 = 6,25 Text height on screen

You can displayed the text with 'Locate' command.
Code: (Select All)
LOCATE 6, 14: print CHR$(95);

You can't displayed the text with normal Print for the last rows when text height have odd numbers
With the normal print command you can displayed 4 rows. With ; on the print command, you can displayed 5 rows.
When the last row is reached, the content moves up the screen, leaving the last row empty.

The font cannot be scaled to comma values. That means you need integers for it.
QB64 convert all Fonts to a new Raster fonts with fixed width and height.
A filter scales the characters down to a certain size. Could be 'Nearest Neighbor' filter.
Then some sizes of the fonts would explain that they can't be displayed.

Example by courbd.ttf

✅  show the CHR$(95)
❌  Do not show CHF$(95)

is the Font height 32, then the width is 22 ✅
is the Font height 31, then the width is 22 ✅
is the Font height 30, then the width is 22 ✅

is the Font height 29, then the width is 23 ✅
is the Font height 28, then the width is 20 ✅
is the Font height 27, then the width is 17 ✅

is the Font height 26, then the width is 18 ✅
is the Font height 25, then the width is 18 ❌
is the Font height 24, then the width is 18 ✅

is the Font height 23, then the width is 19 ✅
is the Font height 22, then the width is 19 ✅
is the Font height 21, then the width is 11 ✅

is the Font height 20, then the width is 13 ✅
is the Font height 19, then the width is 11 ✅
is the Font height 18, then the width is 18 ✅

is the Font height 17, then the width is 12 ✅
is the Font height 16, then the width is 12 ❌
is the Font height 15, then the width is 12 ❌

is the Font height 14, then the width is 10 ✅
is the Font height 13, then the width is 10 ❌
is the Font height 12, then the width is 10 ❌
is the Font height 11, then the width is 10 ✅

is the Font height 10, then the width is 8 ✅
is the Font height 9, then the width is 8 ❌
is the Font height 8, then the width is 5 ❌
is the Font height 7, then the width is 4 ✅
is the Font height 6, then the width is 4 ✅
...

Code: (Select All)
Print CHR$(95);
Uses only the memory for the character. And ends after the char.

Code: (Select All)
Print CHR$(95)
Still uses the memory for CR + LF. And only ends afterwards.

Example for the last row:
Code: (Select All)
SCREEN 13

LOCATE 1, 1: PRINT "Hello"
LOCATE 25, 1: PRINT "Hello world" ' <-- First Picture without ; and the second Picture with ;
SLEEP

First Picture without ;
The text is wrote in the 26th row, because the screen is move down. (See the right picture with background color)
[Image: print12kce9.png]  [Image: print3iuekg.png]

Second Picture with ;
[Image: print2hrcap.png]
Reply


Messages In This Thread
Confusing Chr$ explanation - by PhilOfPerth - 07-07-2023, 01:18 AM
RE: Confusing Chr$ explanation - by CharlieJV - 07-07-2023, 01:31 AM
RE: Confusing Chr$ explanation - by PhilOfPerth - 07-07-2023, 01:49 AM
RE: Confusing Chr$ explanation - by Space_Ghost - 07-07-2023, 01:52 AM
RE: Confusing Chr$ explanation - by mnrvovrfc - 07-08-2023, 02:49 AM
RE: Confusing Chr$ explanation - by PhilOfPerth - 07-07-2023, 03:36 AM
RE: Confusing Chr$ explanation - by Space_Ghost - 07-07-2023, 04:52 AM
RE: Confusing Chr$ explanation - by PhilOfPerth - 07-07-2023, 05:39 AM
RE: Confusing Chr$ explanation - by Space_Ghost - 07-07-2023, 06:16 AM
RE: Confusing Chr$ explanation - by PhilOfPerth - 07-08-2023, 12:47 AM
RE: Confusing Chr$ explanation - by Space_Ghost - 07-08-2023, 01:14 AM
RE: Confusing Chr$ explanation - by SagaraS - 07-08-2023, 08:52 AM
RE: Confusing Chr$ explanation - by bplus - 07-08-2023, 02:05 PM
RE: Confusing Chr$ explanation - by Space_Ghost - 07-08-2023, 03:59 PM
RE: Confusing Chr$ explanation - by SagaraS - 07-08-2023, 07:35 PM
RE: Confusing Chr$ explanation - by TempodiBasic - 07-08-2023, 09:30 PM
RE: Confusing Chr$ explanation - by mnrvovrfc - 07-08-2023, 10:44 PM
RE: Confusing Chr$ explanation - by PhilOfPerth - 07-09-2023, 02:49 AM
RE: Confusing Chr$ explanation - by TempodiBasic - 07-09-2023, 03:10 PM
RE: Confusing Chr$ explanation - by PhilOfPerth - 07-09-2023, 04:22 AM
RE: Confusing Chr$ explanation - by Space_Ghost - 07-09-2023, 07:43 AM
RE: Confusing Chr$ explanation - by RhoSigma - 07-09-2023, 08:05 AM
RE: Confusing Chr$ explanation - by TempodiBasic - 07-09-2023, 03:48 PM
RE: Confusing Chr$ explanation - by PhilOfPerth - 07-10-2023, 01:29 AM
RE: Confusing Chr$ explanation - by SagaraS - 07-09-2023, 08:12 AM
RE: Confusing Chr$ explanation - by SagaraS - 07-09-2023, 11:50 AM
RE: Confusing Chr$ explanation - by TempodiBasic - 07-09-2023, 04:40 PM
RE: Confusing Chr$ explanation - by SagaraS - 07-10-2023, 11:23 AM
RE: Confusing Chr$ explanation - by mnrvovrfc - 07-10-2023, 03:34 PM
RE: Confusing Chr$ explanation - by mnrvovrfc - 07-11-2023, 04:17 PM
RE: Confusing Chr$ explanation - by PhilOfPerth - 07-12-2023, 06:03 AM
RE: Confusing Chr$ explanation - by SMcNeill - 07-16-2023, 11:00 PM
RE: Confusing Chr$ explanation - by SagaraS - 07-15-2023, 08:47 AM
RE: Confusing Chr$ explanation - by PhilOfPerth - 07-16-2023, 12:18 AM
RE: Confusing Chr$ explanation - by SagaraS - 07-16-2023, 10:31 AM
RE: Confusing Chr$ explanation - by mnrvovrfc - 07-16-2023, 05:06 PM
RE: Confusing Chr$ explanation - by bplus - 07-16-2023, 05:53 PM
RE: Confusing Chr$ explanation - by mnrvovrfc - 07-16-2023, 07:35 PM
RE: Confusing Chr$ explanation - by SagaraS - 07-16-2023, 08:24 PM
RE: Confusing Chr$ explanation - by PhilOfPerth - 07-16-2023, 11:24 PM
RE: Confusing Chr$ explanation - by SMcNeill - 07-16-2023, 11:42 PM
RE: Confusing Chr$ explanation - by PhilOfPerth - 07-17-2023, 01:10 AM
RE: Confusing Chr$ explanation - by bplus - 07-17-2023, 01:18 AM
RE: Confusing Chr$ explanation - by PhilOfPerth - 07-17-2023, 01:34 AM
RE: Confusing Chr$ explanation - by bplus - 07-17-2023, 01:41 AM
RE: Confusing Chr$ explanation - by PhilOfPerth - 07-17-2023, 01:49 AM
RE: Confusing Chr$ explanation - by bplus - 07-17-2023, 02:08 AM
RE: Confusing Chr$ explanation - by PhilOfPerth - 07-17-2023, 02:33 AM



Users browsing this thread: 13 Guest(s)