Posts: 3,973
Threads: 177
Joined: Apr 2022
Reputation:
219
12-07-2023, 05:16 PM
(This post was last modified: 12-07-2023, 05:19 PM by bplus.)
Wow ARB was just crying about this at the other forum, embedded font files.
Are there many of these monospacers with w:h ratios at around .5-.65
I am working with Lucon (Windows name for Lucinda consolus) since Terry Ritchie advised this for QB's IDE. That works well at .61... 11x18 pixels and using 20 pixels to a row with _Printstring() , way easier on these old eyes plus fits 100 chars across screen which is an ideal max char width for program line IMHO.
b = b + ...
Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
I've found "Source Code Pro - Medium" to be great for these old eyes, especially with my laptop's ultra-high resolution.
Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
A quick screenshot of the embedded fonts currently available, all at size 20, for those folks who just happen to like pretty pictures and don't want to test things out themselves.
Posts: 476
Threads: 25
Joined: Nov 2022
Reputation:
45
(10-13-2023, 01:45 AM)SMcNeill Wrote: If you're like me, over time you've written and accumulated a zillion different little routines full of subs and functions to help do things for you. If you're also like me, when you need to be able to find those routines to make use of them again, they end up hiding from you.
I've decided it's about time that I did something about that and get my junk a little better organized -- and while I'm at it, I thought I'd share and see if anyone else wanted to jump in on the bandwagon and share their own tools in the same place so we could have a "one stop shop" for all things related to expanding QB64PE functionality.
To that end, I present: https://github.com/SteveMcNeill/QB64-Pho...on-Toolbox
At this point in time, it's very much a work-in-progress, with just ONE whole commit in its entire Github history! WOOT!! But, I hope from this one commit, you can see the general concept of what I'm shooting to accomplish here:
1) Create a simple library which can be included into any QB64 program with only one set of *.BI and *.BM include files.
2) This library has to have the functionality to allow us to ONLY load and use the subs/functions that we want with our programs. (Precompiler $IF commands allow us to do this.)
3) This library has to be Option _Explicit compatible.
4) Over time, this library will need to have documentation added for each of the routines inside it, explaining how to use those routines and what is expected from each parameter.
5) Examples and Samples of each routine will need to be created and added to the library in time, so users can simply load those files and see the routines in action.
At the moment, I've only got a handful of commands pushed into this initial commit, and I can already see that I'm going to have to do some learning in the future to make things more as I envision. (One thing I've got to work on is learning and expanding my knowledge of markup so the *.md files I'll be creating look a little nicer and more useful.)
As it is, it's the very barest of bones for a toolbox, but it's a start. Feel free to follow, or speak up to be added as a contributor. Over time, I'm hoping that this can expand and become a single go to source for all things to expand QB64PE for us.
Thanks @SMcNeill! This is very helpful and I will go through your library soon. It would also be great to have some video tutorials for your stuff - you should make some! You only have 3 on YouTube. Consider this a request to create more.
One thing you might want to check into - and I know it's a grim thought, you can nominate any other GitHub user as inheritor of your repos should you pass away. This is something I setup myself and I would recommend any of us do the same.
I'd be happy to inherit for you, if you don't have anyone else. I am in relatively decent health and 49 in a mostly non-end-of-the-world-disasters-omg place to live (Michigan, USA).
Hooray for your QB64PE Toolbox
Posts: 476
Threads: 25
Joined: Nov 2022
Reputation:
45
(12-07-2023, 04:40 PM)SMcNeill Wrote: Now added the ability to embed a small selection of fonts directly into a QB64PE program, which means they wouldn't have to rely on any external files once compiled and ran, so you don't have to worry about the end user not having the proper files on their drive to run your program glitch-free.
Basic style example is below:
Code: (Select All)
$Let INCLUDE_ALL = TRUE
$Let EMBED_COURIER_NEW = TRUE
$Let EMBED_CONSOLA = TRUE
$Let EMBED_SOURCE_CODE_PRO = TRUE
'Note that we ALSO have to specify which fonts we want to embed in our program,
'as we do above with the EMBED_COURIER_NEW = TRUE statement.
'This is because fonts can become quite large in size, and no single program
'needs to become bloated by several hundred MB as it attempts to embed fonts in itself
'that it doesn't even make use of!
'$INCLUDE:'..\Library Files\Toolbox.BI'
Screen _NewImage(800, 600, 32)
f = ReturnFont("Courier New", 20, "") ' A simple little _LOADFONT replacement
_Font f: _PrintString (0, 0), "Hello World" ' except here, we specify the font's name (not FILE NAME)
_Font 16: _FreeFont f
f = ReturnFont("Courier New", 20, "Bold") ' and we can set the style which we want for the font.
_Font f: _PrintString (0, _FontHeight), "Hello World"
_Font 16: _FreeFont f
f = ReturnFont("Courier New", 20, "Italic")
_Font f: _PrintString (0, _FontHeight * 2), "Hello World"
_Font 16: _FreeFont f
f = ReturnFont("Courier New", 20, "Bold,Italic")
_Font f: _PrintString (0, _FontHeight * 3), "Hello World"
_Font 16: _FreeFont f
f = ReturnFont("Consola", 20, "")
_Font f: _PrintString (0, _FontHeight * 5), "Hello World"
_Font 16: _FreeFont f
f = ReturnFont("Consola", 20, "Bold")
_Font f: _PrintString (0, _FontHeight * 6), "Hello World"
_Font 16: _FreeFont f
f = ReturnFont("Consola", 20, "Italic")
_Font f: _PrintString (0, _FontHeight * 7), "Hello World"
_Font 16: _FreeFont f
f = ReturnFont("Consola", 20, "Bold,Italic")
_Font f: _PrintString (0, _FontHeight * 8), "Hello World"
_Font 16: _FreeFont f
f = ReturnFont("Source Code Pro", 20, "Medium")
_Font f: _PrintString (0, _FontHeight * 10), "Hello World"
_Font 16: _FreeFont f
'$INCLUDE:'..\Library Files\Toolbox.BM'
That is a cool idea. I love the ideas you have for embeding and including like this.
Posts: 3,973
Threads: 177
Joined: Apr 2022
Reputation:
219
12-08-2023, 12:14 AM
(This post was last modified: 12-08-2023, 12:15 AM by bplus.)
Yeah getting l's not looking like 1's is good and Source Code Pro does look nice.
b = b + ...
Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
(12-08-2023, 12:14 AM)bplus Wrote: Yeah getting l's not looking like 1's is good and Source Code Pro does look nice.
A few things I always look for with regards to a programming font:
1's don't look like l's.
i's look like i's and nothing else.
0 doesn't look like O or o. (Usually a zero should have a slash through it, or a dot in the middle, or some such.)
It's got to have all 256 ASCII characters to be truly useful, as well as being monospaced and easy to read with my old eyes.
Overall, from all my various testing of different fonts, I honestly think "Deja Vu Sans Mono" is a favorite, but it has issues with PRINT and PRINTSTING clipping part of it and not displaying the whole font. (Worst thing is that at some font sizes, the underscore doesn't display as it hangs below the other characters as a means to generate an underline and thus gets clipped off.)
For all font sizes, "Source Code Pro" tends to display the best for my eyes, with "Medium" not being so bold that it appears "bloated" and hard to read at various resolutions.
Posts: 372
Threads: 23
Joined: May 2022
Reputation:
56
(12-08-2023, 12:24 AM)SMcNeill Wrote: (12-08-2023, 12:14 AM)bplus Wrote: Yeah getting l's not looking like 1's is good and Source Code Pro does look nice.
A few things I always look for with regards to a programming font:
1's don't look like l's.
i's look like i's and nothing else.
0 doesn't look like O or o. (Usually a zero should have a slash through it, or a dot in the middle, or some such.)
It's got to have all 256 ASCII characters to be truly useful, as well as being monospaced and easy to read with my old eyes.
Overall, from all my various testing of different fonts, I honestly think "Deja Vu Sans Mono" is a favorite, but it has issues with PRINT and PRINTSTING clipping part of it and not displaying the whole font. (Worst thing is that at some font sizes, the underscore doesn't display as it hangs below the other characters as a means to generate an underline and thus gets clipped off.)
For all font sizes, "Source Code Pro" tends to display the best for my eyes, with "Medium" not being so bold that it appears "bloated" and hard to read at various resolutions. Thanks Steve for sharing the "Source Code Pro" font name. I actually do like it and think it is a nice font to use on 2k+ screens. For Full HD and lower though, I am yet to find anything that beats the built-in 16 font.
Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
(12-08-2023, 02:28 AM)a740g Wrote: (12-08-2023, 12:24 AM)SMcNeill Wrote: (12-08-2023, 12:14 AM)bplus Wrote: Yeah getting l's not looking like 1's is good and Source Code Pro does look nice.
A few things I always look for with regards to a programming font:
1's don't look like l's.
i's look like i's and nothing else.
0 doesn't look like O or o. (Usually a zero should have a slash through it, or a dot in the middle, or some such.)
It's got to have all 256 ASCII characters to be truly useful, as well as being monospaced and easy to read with my old eyes.
Overall, from all my various testing of different fonts, I honestly think "Deja Vu Sans Mono" is a favorite, but it has issues with PRINT and PRINTSTING clipping part of it and not displaying the whole font. (Worst thing is that at some font sizes, the underscore doesn't display as it hangs below the other characters as a means to generate an underline and thus gets clipped off.)
For all font sizes, "Source Code Pro" tends to display the best for my eyes, with "Medium" not being so bold that it appears "bloated" and hard to read at various resolutions. Thanks Steve for sharing the "Source Code Pro" font name. I actually do like it and think it is a nice font to use on 2k+ screens. For Full HD and lower though, I am yet to find anything that beats the built-in 16 font.
I'm 100% the same. Our in-built font has always looked the best to me, in 1280p or lower screens. Unfortunately, there's no way to just scale it up easily, so it's nice to have alternatives when you want to be able to scale those font sizes quickly and easily.
BTW, I've now expanded the list of possible fonts to embed to include all the Julia Mono fonts, in their seemingly endless varieties. Bold, Extra Bold, Semi Bold, Light, Medium, Regular, all in italic and non-italic varieties. (And maybe a few other options I missed...)
Another day or two of work, at the slow pace which I put into things, and I'll have a whole assortment of programming friendly fonts that I can just $INCUDE and embed directly into a program.
Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
As you can see from the image above, I've now finished setting up all the fonts that I'm going to personally be adding to the toolbox at this time. There's 7 fonts -- all monospaced for general use in programming, and all have the full 256 ASCII character set in them, as well as several having various styles associated with them for weight or italics.
With ALL of these embedded into one single file, the file comes up to around 26MB in size -- which really isn't that bad, in my opinion, as the font files ALONE take up 48MB of space while uncompressed on my drive!!
Final code to produce and embed these fonts for the image above is right here:
Code: (Select All)
$Let INCLUDE_ALL = TRUE
$Let EMBED_COURIER_NEW = TRUE
$Let EMBED_CONSOLA = TRUE
$Let EMBED_DEJA_VU_SANS_MONO = TRUE
$Let EMBED_JULIA_MONO = TRUE
$Let EMBED_SOURCE_CODE_PRO = TRUE
$Let EMBED_LUCON = TRUE
$Let EMBED_UNIFONT = TRUE
'Note that we ALSO have to specify which fonts we want to embed in our program,
'as we do above with the EMBED_COURIER_NEW = TRUE statement.
'This is because fonts can become quite large in size, and no single program
'needs to become bloated by several hundred MB as it attempts to embed fonts in itself
'that it doesn't even make use of!
'$INCLUDE:'..\Library Files\Toolbox.BI'
Screen _NewImage(1280, 720, 32)
f = ReturnFont("Courier New", 20, "") ' A simple little _LOADFONT replacement
_Font f: _PrintString (0, 0), "Hello World - Courier New" ' except here, we specify the font's name (not FILE NAME)
_Font 16: _FreeFont f
f = ReturnFont("Courier New", 20, "Bold") ' and we can set the style which we want for the font.
_Font f: _PrintString (0, _FontHeight), "Hello World - Courier New Bold"
_Font 16: _FreeFont f
f = ReturnFont("Courier New", 20, "Italic")
_Font f: _PrintString (0, _FontHeight * 2), "Hello World - Courier New Italic"
_Font 16: _FreeFont f
f = ReturnFont("Courier New", 20, "Bold,Italic")
_Font f: _PrintString (0, _FontHeight * 3), "Hello World - Courier New Bold Italic"
_Font 16: _FreeFont f
f = ReturnFont("Consola", 20, "")
_Font f: _PrintString (0, _FontHeight * 5), "Hello World - Consola"
_Font 16: _FreeFont f
f = ReturnFont("Consola", 20, "Bold")
_Font f: _PrintString (0, _FontHeight * 6), "Hello World - Consola Bold"
_Font 16: _FreeFont f
f = ReturnFont("Consola", 20, "Italic")
_Font f: _PrintString (0, _FontHeight * 7), "Hello World - Consola Italic"
_Font 16: _FreeFont f
f = ReturnFont("Consola", 20, "Bold,Italic")
_Font f: _PrintString (0, _FontHeight * 8), "Hello World - Consola Bold Italic"
_Font 16: _FreeFont f
f = ReturnFont("Deja Vu Sans Mono", 20, "")
_Font f: _PrintString (0, _FontHeight * 10), "Hello World - Deja Vu Sans Mono"
_Font 16: _FreeFont f
f = ReturnFont("Julia Mono", 20, "Black")
_Font f: _PrintString (0, _FontHeight * 12), "Hello World - Julia Mono Black"
_Font 16: _FreeFont f
f = ReturnFont("Julia Mono", 20, "Black Italic")
_Font f: _PrintString (0, _FontHeight * 13), "Hello World - Julia Mono Black Italic"
_Font 16: _FreeFont f
f = ReturnFont("Julia Mono", 20, "Bold")
_Font f: _PrintString (0, _FontHeight * 14), "Hello World - Julia Mono Bold"
_Font 16: _FreeFont f
f = ReturnFont("Julia Mono", 20, "Bold Italic")
_Font f: _PrintString (0, _FontHeight * 15), "Hello World - Julia Mono Bold Italic"
_Font 16: _FreeFont f
f = ReturnFont("Julia Mono", 20, "Extra Bold")
_Font f: _PrintString (0, _FontHeight * 16), "Hello World - Julia Mono Extra Bold"
_Font 16: _FreeFont f
f = ReturnFont("Julia Mono", 20, "Extra Bold Italic")
_Font f: _PrintString (0, _FontHeight * 17), "Hello World - Julia Mono Extra Bold Italic"
_Font 16: _FreeFont f
f = ReturnFont("Julia Mono", 20, "Semi Bold")
_Font f: _PrintString (0, _FontHeight * 18), "Hello World - Julia Mono Semi Bold"
_Font 16: _FreeFont f
f = ReturnFont("Julia Mono", 20, "Semi Bold Italic")
_Font f: _PrintString (0, _FontHeight * 19), "Hello World - Julia Mono Semi Bold Italic"
_Font 16: _FreeFont f
f = ReturnFont("Julia Mono", 20, "Light")
_Font f: _PrintString (0, _FontHeight * 20), "Hello World - Julia Mono Light"
_Font 16: _FreeFont f
f = ReturnFont("Julia Mono", 20, "Light Italic")
_Font f: _PrintString (0, _FontHeight * 21), "Hello World - Julia Mono Light Italic"
_Font 16: _FreeFont f
f = ReturnFont("Julia Mono", 20, "Medium")
_Font f: _PrintString (0, _FontHeight * 22), "Hello World - Julia Mono Medium"
_Font 16: _FreeFont f
f = ReturnFont("Julia Mono", 20, "Medium Italic")
_Font f: _PrintString (0, _FontHeight * 23), "Hello World - Julia Mono Medium Italic"
_Font 16: _FreeFont f
f = ReturnFont("Julia Mono", 20, "")
_Font f: _PrintString (0, _FontHeight * 24), "Hello World - Julia Mono Regular"
_Font 16: _FreeFont f
f = ReturnFont("Julia Mono", 20, "Italic")
_Font f: _PrintString (0, _FontHeight * 25), "Hello World - Julia Mono Italic"
_Font 16: _FreeFont f
f = ReturnFont("Source Code Pro", 20, "Medium")
_Font f: _PrintString (600, 0), "Hello World - Source Code Pro Medium"
_Font 16: _FreeFont f
f = ReturnFont("Source Code Pro", 20, "Medium Italic")
_Font f: _PrintString (600, _FontHeight * 1), "Hello World - Source Code Pro Medium Italic"
_Font 16: _FreeFont f
f = ReturnFont("Source Code Pro", 20, "")
_Font f: _PrintString (600, _FontHeight * 2), "Hello World - Source Code Pro Regular"
_Font 16: _FreeFont f
f = ReturnFont("Source Code Pro", 20, "Italic")
_Font f: _PrintString (600, _FontHeight * 3), "Hello World - Source Code Pro Italic"
_Font 16: _FreeFont f
f = ReturnFont("Source Code Pro", 20, "Black")
_Font f: _PrintString (600, _FontHeight * 4), "Hello World - Source Code Pro Black"
_Font 16: _FreeFont f
f = ReturnFont("Source Code Pro", 20, "Black Italic")
_Font f: _PrintString (600, _FontHeight * 5), "Hello World - Source Code Pro Black Italic"
_Font 16: _FreeFont f
f = ReturnFont("Source Code Pro", 20, "Bold")
_Font f: _PrintString (600, _FontHeight * 6), "Hello World - Source Code Pro Bold"
_Font 16: _FreeFont f
f = ReturnFont("Source Code Pro", 20, "Bold Italic")
_Font f: _PrintString (600, _FontHeight * 7), "Hello World - Source Code Pro Bold Italic"
_Font 16: _FreeFont f
f = ReturnFont("Source Code Pro", 20, "Extra Bold")
_Font f: _PrintString (600, _FontHeight * 8), "Hello World - Source Code Pro Extra Bold"
_Font 16: _FreeFont f
f = ReturnFont("Source Code Pro", 20, "Extra Bold Italic")
_Font f: _PrintString (600, _FontHeight * 9), "Hello World - Source Code Pro Extra Bold Italic"
_Font 16: _FreeFont f
f = ReturnFont("Source Code Pro", 20, "Semi Bold")
_Font f: _PrintString (600, _FontHeight * 10), "Hello World - Source Code Pro Semi Bold"
_Font 16: _FreeFont f
f = ReturnFont("Source Code Pro", 20, "Semi Bold Italic")
_Font f: _PrintString (600, _FontHeight * 11), "Hello World - Source Code Pro Semi Bold Italic"
_Font 16: _FreeFont f
f = ReturnFont("Source Code Pro", 20, "Light")
_Font f: _PrintString (600, _FontHeight * 12), "Hello World - Source Code Pro Light"
_Font 16: _FreeFont f
f = ReturnFont("Source Code Pro", 20, "Light Italic")
_Font f: _PrintString (600, _FontHeight * 13), "Hello World - Source Code Pro Light Italic"
_Font 16: _FreeFont f
f = ReturnFont("Lucon", 20, "")
_Font f: _PrintString (600, _FontHeight * 15), "Hello World - Lucon"
_Font 16: _FreeFont f
f = ReturnFont("UniFont", 20, "")
_Font f: _PrintString (600, _FontHeight * 17), "Hello World - UniFont"
_Font 16: _FreeFont f
'$INCLUDE:'..\Library Files\Toolbox.BM'
Anyone interested in making use of this for their own works can find the toolbox here, along with all the other samples and utilities which it performs and enhances for us: https://github.com/SteveMcNeill/QB64-Pho...on-Toolbox
I need to update the documentation to showcase this new ability to embed fonts, but I'd think from the example above, folks should see that it's really not all that hard to implement into their own programs. Enjoy, one and all. (Or at least the one-and-all who enjoys this type of thing! )
|