Confusing Chr$ explanation - Printable Version +- QB64 Phoenix Edition (https://staging.qb64phoenix.com) +-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://staging.qb64phoenix.com/forumdisplay.php?fid=10) +---- Thread: Confusing Chr$ explanation (/showthread.php?tid=1820) |
RE: Confusing Chr$ explanation - RhoSigma - 07-09-2023 (07-09-2023, 07:43 AM)Space_Ghost Wrote: My guess is the ALT codes with leading zeros are not part of the QB64pe compilation options.....but someone with much more knowledge can chime in to confirm or not. You should have noticed that QB64pe works with codepage 437, the copyright sign is simply not available in that set of chars. You may try whatever you want, it won't give you that sign with PRINT CHR$(169). You have to use a unicode capable custom font, MAPUNICODE the copyright sign's unicode codepoint to any ASCII char of your choice and then PRINT that remapped char. On the other hand you may use UPRINTSTRING with the respective codepoint directly, but that requires a graphic screen (text SCREEN 0 is not supported) and of course a suitable unicode custom font too. RE: Confusing Chr$ explanation - SagaraS - 07-09-2023 (07-09-2023, 04:22 AM)PhilOfPerth Wrote: I'm able to see characters for all the Alt values, but I'm unable to produce the Copyright (and some others). The Alt table says it should be Alt 0169,The copyright character does not exist in the DOS ASCII character set of code page 437. All characters from 128 to 255 are different characters than what you have in Windows + those of other countries. e.g.: Code page 437 = English https://de.wikipedia.org/wiki/Codepage_437 Character 169 / &HA9 MS DOS characters: ⌐ MS WIN Character: © Code page 850 = Western European https://de.wikipedia.org/wiki/Codepage_850 Character 169 / &HA9 MS DOS characters: ® MS WIN Character: © You must use a Unicode set for that. Create the following file CP850.CSV Code: (Select All)
The character numbered 305 in the table (which is bracketed with asterisks) is the euro character. Simply remove the stars to have the euro sign in the set. Then you can use the following in QB64: Code: (Select All)
And this would be your output: Character 169 is now ® Here a QB64 code for the complete table Code: (Select All)
Output is this: When you use the DOSBox you must change the keyboard + character set. KEYB gr 850 <- It's for german keyboard layout + codepage 850 Then have the same result in the DOSBox with the characters: In both cases you then have your copyright char in the set. Character 169 - ® Character 184 - © If you are looking for a suitable DOS TrueType font on the Internet, you can also make the characters look original. (QB64) e.g.: https://archive.org/details/ultimate_oldschool_pc_font_pack_v1.0 The output then looks like this: ("PxPlus_IBM_VGA9.ttf", 16, "MONOSPACE") RE: Confusing Chr$ explanation - SagaraS - 07-09-2023 Another possibility would be to use a raster font. But the whole thing doesn't work in Screen 0 mode. http://orangetide.com/fonts/DOS/ The File "cp850.f16" on this site is that what you search. F16 stand for 8x16 raster font. Screen mode must use 8x16 fonts. e.g.: Screen 11 or 12 Screen Mode 12 would be similar to Screen 0 or much better is Code: (Select All)
Here a picture of my raster font editor with this font. You can load this raster font into an array and have the array indexed. As a CHR$ replacement. Example: Sorry for the font comments. Originally I used the whole thing for 8x8 raster fonts. Just modified it for 8x16. Code: (Select All)
Your output will then be as follows: A raster font is much more accurate and faithful than TrueType fonts. Here's another raster font as proof. "scrwl~~~.f16" RE: Confusing Chr$ explanation - TempodiBasic - 07-09-2023 (07-08-2023, 10:44 PM)mnrvovrfc Wrote:(07-08-2023, 09:30 PM)TempodiBasic Wrote: your same code without an unuseful pause (sleep 1) and an unuseful clearscreen (CLS) plus a better output settings (;" " for PRINT statement you get this output Hi thanks to remember me that the goal can be watching a single couple ASCII number + ASCII code in a row. I have misunderstood the goal of the code posted by PhilOfPerth. @mnrvovfrc I have tried to run your code but I am in trouble. The code runs, but the output is a little window that is blank all the time while its caption is "Press [Esc] to quit". I have REMmed "System" too thinking that the program runs quickly and I am not able to see the output, but nothing to do. Also increasing _delay to 1.0 or adding a _limit 5 nothing to do, I get only that blank window. What must I do to see your output? RE: Confusing Chr$ explanation - TempodiBasic - 07-09-2023 (07-09-2023, 04:22 AM)PhilOfPerth Wrote: I'm able to see characters for all the Alt values, but I'm unable to produce the Copyright (and some others). The Alt table says it should be Alt 0169,The answer is in your same question! Being clearer, QB64pe is a QB45 clone, it is standing on ASCII table, while the forum page is a webpage that uses Unicode Table. So 0169 in ASCII (0- 255) is equal to 169 and in the ASCII table of the IDE and of the compiler is this character ┌ while 0169 in Unicode table (0196 = 00A9) is the copyright simbol © Now I do the eco of Space_ghost, SagarS and RhoSigma you can use ASCII Table external characters by using _MapUnicode to substitute an unused character with that we need. I learnt this tip from the community when I wanted to localize to my language the input/output of keywords of QB64. please think how is in trouble the hangman game when I must guess "papà" and not "papa" (Dad and not the Pope) without "à" in input/output. RE: Confusing Chr$ explanation - TempodiBasic - 07-09-2023 Hi mnrvovrfc Solved the issue with your code I change the foreground color and I got the characters! RE: Confusing Chr$ explanation - PhilOfPerth - 07-10-2023 (07-09-2023, 03:48 PM)TempodiBasic Wrote:(07-09-2023, 04:22 AM)PhilOfPerth Wrote: I'm able to see characters for all the Alt values, but I'm unable to produce the Copyright (and some others). The Alt table says it should be Alt 0169,The answer is in your same question! Being clearer, QB64pe is a QB45 clone, it is standing on ASCII table, while the forum page is a webpage that uses Unicode Table. Thanks TempodiBasic; I get it now (almost)! With the info you gave me, I was able to write the small snippet below, and this produces the Copyright and RegisteredTM symbols, and any others I need from the Unicode table. It seems I need to set the font specifically first - in my case to a Monospace font. Is this correct? I thought the default font would have worked. Code: (Select All) Screen 9 RE: Confusing Chr$ explanation - SagaraS - 07-10-2023 The problem by using TrueType Fonts is that all Fonts scaled by vector size of the font. It's not so cool. Then in Screen 9, for example, you no longer have 80 rows and 25 lines for the characters by a size of 32. Screen 9 have a 8x14 Font. You must need to change the ttf font size to 14. Then you have the 80x25 text field from screen mode. By a size of 28, you have 40x12,5 text field. So be careful! It would be perfect if you set your TTF fonts to the appropriate screen mode for an optimal result. Screen 1, 2, 7, 8, 13 = Size 8 for a 8x8 Font Set Screen 9, 10 = Size 14 for a 8x14 Font Set Screen 11, 12 = Size 16 for a 8x16 Font Set RE: Confusing Chr$ explanation - mnrvovrfc - 07-10-2023 (07-10-2023, 11:23 AM)SagaraS Wrote: The problem by using TrueType Fonts is that all Fonts scaled by vector size of the font. The problem is that the user will then want to see that much larger than SCREEN 9, like in a 4k screen. This is where raster fonts are totally undesireable nowadays, and vector-type fonts are absolute. This was demonstrated distinctly by the program I posted on this thread. Also one will need a different raster font file for each size, which could be annoying although the combined sizes could be smaller than a single OTF or TTF file. QB64 was designed in a way where SCREEN 0 was to remain more limited than using a graphics screen. That's why it could only employ monospaced fonts and there are niggles about it with _CONTROLCHAR and with code pages and more. QB64PE v3.7 was giving us a promise with _UPRINTSTRING and related functions but sadly this still doesn't give us "everything" that could be seen from the Character Map application with a "loaded" OpenType or TrueType font. RE: Confusing Chr$ explanation - mnrvovrfc - 07-11-2023 What Phil is going through here represents a crossroads for QB64. What is QB64? It's an emulation of Microsoft QuickBASIC and QBasic, right? When QBasic was released (as part of MS-DOS v5), the norm were 16-bit single-CPU computers with VGA, I think 1024x768 with many colors (not that much different from today at least with budget laptops). The system requirements were very restricted. Things depended a lot on how MS-DOS limited available memory. M$ were just trying to sell it in the U.S.A. and Canada primarily and therefore they helped created a "standard" character set which became the CP437, and the set that is seen in the QB64 IDE now, in "Tools/ASCII Chart". At that time it wasn't "let's make it easier for Asians to use our programming system!" It was "let's give the hobbyists a quick and dirty tool". Although there were a few markets in Europe and Latin America, I gather, which provided the alternative character sets. Now with modern web browsers being able to display all sorts of things, which should have been done only with graphics commands on QBasic, confusion results because QB64 has been trying so hard to remain compatible with QuickBASIC and QBasic, but it means it cannot be compatible with the modern web browsers. Then the CP437 doesn't go far enough. There's the push to be more considerate with people having other writing systems. Also the "geeks" for Linux being full of terminal graphics tricks much beyond "neofetch" and that "Matrix" movie thing. Cannot tell them, you need a graphics screen to do that, cannot do it on a text screen. Then programming in QB64 seems to be a bit of an anachronism. Programming in Python for the Linux terminal seems to become more attractive because "everybody" seems to be doing it. It should bother me but I'm happy to have this best of both worlds which is not perfect, which is like an old dog but good to have around. I discovered a "flappybird" clone for Linux done with Python, entirely in text mode in the terminal. It's terrible. The player has to crush the spacebar to get two points or so in that game LOL. In another thread there was an observation about "local" constants and how it should be sensible to allow "local" user-defined type (UDT) definitions. For that and for the CHR$() "confusion", have to change QB64 so it supports object-oriented programming and Unicode. Or use another programming system that could help that. |