Author Topic: Slightly bigger letters  (Read 5244 times)

0 Members and 1 Guest are viewing this topic.

Offline carloscordeiro

  • Forum Regular
  • Posts: 102
    • View Profile
Slightly bigger letters
« on: October 06, 2020, 06:55:50 pm »
Hi
Good night, Bplus
I come again to ask for your help.
I wanted to know about you, which statement to make a character a little bigger on the screen.

I want to make the “Show” more lively. . .

For example:

Print “Carlos” = Standard characters - R
Print “Bplus” = Characters 2 x greater than the standard - G
Print “Qbasic 64” = Characters 2.5 x larger than the standard - B.

I searched on http://www.qb64.org/wiki/Main_Page, however I did not find the instruction that does this.

Carlos
« Last Edit: October 06, 2020, 06:57:37 pm by carloscordeiro »

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Slightly bigger letters
« Reply #1 on: October 06, 2020, 07:14:11 pm »
_LOADFONT and _FONT are the two commands you’re looking for.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline carloscordeiro

  • Forum Regular
  • Posts: 102
    • View Profile
Re: Slightly bigger letters
« Reply #2 on: October 06, 2020, 07:32:20 pm »
Ok SMcNeill, I will try with these commands to increase the letters.
Thanks for answering.

Carlos

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Slightly bigger letters
« Reply #3 on: October 06, 2020, 07:47:12 pm »
Yes, put Steve at 4x greater!  ;-))

PS let me know if you don't want to use fonts, there is another way ;)
« Last Edit: October 06, 2020, 07:55:37 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Slightly bigger letters
« Reply #4 on: October 06, 2020, 09:13:01 pm »
OK, OK here is the other way, I know you are dying to know ;)

Code: QB64: [Select]
  1. _TITLE "Text SUB demo" 'b+ 2020-10-06
  2.  
  3. SCREEN _NEWIMAGE(800, 600, 32)
  4. _DELAY .25
  5.  
  6. COLOR &HFFFF0000
  7. PRINT " Carlos" '= Standard characters - R
  8. Text 10, 26, 32, &HFF008000, "Bplus"
  9. 'PRINT "Bplus" ' = Characters 2 x greater than the standard - G
  10. Text 10, 68, 48, &HFF0000FF, "QB64"
  11. 'PRINT "QB64" '= Characters 2.5 x larger than the standard - B.
  12. Text 10, 126, 64, &HFFFFBB00, "Steve"
  13. END ' <<<<<<<<< notice color at end, same as original color setting
  14.  
  15. SUB Text (x, y, textHeight, K AS _UNSIGNED LONG, txt$)
  16.     DIM fg AS _UNSIGNED LONG, cur&, I&, multi, xlen
  17.     fg = _DEFAULTCOLOR
  18.     'screen snapshot
  19.     cur& = _DEST
  20.     I& = _NEWIMAGE(8 * LEN(txt$), 16, 32)
  21.     _DEST I&
  22.     COLOR K, _RGBA32(0, 0, 0, 0)
  23.     _PRINTSTRING (0, 0), txt$
  24.     multi = textHeight / 16
  25.     xlen = LEN(txt$) * 8 * multi
  26.     _PUTIMAGE (x, y)-STEP(xlen, textHeight), I&, cur&
  27.     COLOR fg
  28.     _FREEIMAGE I&
  29.  
  30.  

And there is another way to tilt the text 77 degrees and scale the x, y axis independently ie stretch and narrow the text.
« Last Edit: October 06, 2020, 09:15:49 pm by bplus »

Offline carloscordeiro

  • Forum Regular
  • Posts: 102
    • View Profile
Re: Slightly bigger letters
« Reply #5 on: October 07, 2020, 06:09:46 pm »
Hello Bplus

Always excited ..

You got it right, I'm dying to know;)

I want to test with the two commands that Steve taught, _LOADFONT and _FONT.

I also want other possibilities like yours, but without the SUB.

If you can submit what this code does, but without the sub I would appreciate it.

I found a code of yours that has the big letters, the way I want it.

But, I don't want a code, I wanted a few lines to show a big letter like the image of your code

Carlos
Font.jpg
* Font.jpg (Filesize: 313.55 KB, Dimensions: 955x1045, Views: 166)
« Last Edit: October 07, 2020, 06:34:15 pm by carloscordeiro »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Slightly bigger letters
« Reply #6 on: October 07, 2020, 06:40:34 pm »
Subless? How about just GOSUB?

Code: QB64: [Select]
  1. _TITLE "Text SUB demo" 'b+ 2020-10-06 / Modified by Pete using GOSUBs instead of SUB.
  2. SCREEN _NEWIMAGE(800, 600, 32)
  3. _DELAY .25
  4.  
  5. COLOR &HFFFF0000
  6. PRINT " Carlos" '= Standard characters - R
  7. x = 10: y = 26: textHeight = 32: K = &HFF008000: txt$ = "Bplus": GOSUB text
  8. 'PRINT "Bplus" ' = Characters 2 x greater than the standard - G
  9. x = 10: y = 68: textHeight = 48: K = &HFF0000FF: txt$ = "QB64": GOSUB text
  10. 'PRINT "QB64" '= Characters 2.5 x larger than the standard - B.
  11. x = 10: y = 126: textHeight = 64: K = &HFFFFBB00: txt$ = "Pete!": GOSUB text
  12. END ' <<<<<<<<< notice color at end, same as original color setting
  13.  
  14. text:
  15. DIM fg AS _UNSIGNED LONG, cur&, I&, multi, xlen
  16. 'screen snapshot
  17. cur& = _DEST
  18. I& = _NEWIMAGE(8 * LEN(txt$), 16, 32)
  19. COLOR K, _RGBA32(0, 0, 0, 0)
  20. _PRINTSTRING (0, 0), txt$
  21. multi = textHeight / 16
  22. xlen = LEN(txt$) * 8 * multi
  23. _PUTIMAGE (x, y)-STEP(xlen, textHeight), I&, cur&
  24.  
« Last Edit: October 07, 2020, 06:41:57 pm by Pete »
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline carloscordeiro

  • Forum Regular
  • Posts: 102
    • View Profile
Re: Slightly bigger letters
« Reply #7 on: October 07, 2020, 06:42:22 pm »
Another code from Steve.

I just wanted these big letters, preferably bold and without SUB. Something simple.
Font_Steve.jpg
* Font_Steve.jpg (Filesize: 141.69 KB, Dimensions: 969x1053, Views: 170)

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Slightly bigger letters
« Reply #8 on: October 07, 2020, 07:00:49 pm »
_LOADFONT and _FONT are what I use, because they work in SCREEN 0. The only screen anyone would ever need.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline carloscordeiro

  • Forum Regular
  • Posts: 102
    • View Profile
Re: Slightly bigger letters
« Reply #9 on: October 07, 2020, 07:03:14 pm »
 
Font_Pete.jpg
Pete, I'll take the simplest.

Yours doesn't have SUB, it's a good option.
« Last Edit: October 07, 2020, 07:09:24 pm by carloscordeiro »

Offline carloscordeiro

  • Forum Regular
  • Posts: 102
    • View Profile
Re: Slightly bigger letters
« Reply #10 on: October 07, 2020, 07:04:47 pm »
Pete do you have how to post an example of _LOADFONT and _FONT and how can I modify the font size and color?

Appreciate.

Offline carloscordeiro

  • Forum Regular
  • Posts: 102
    • View Profile
Re: Slightly bigger letters
« Reply #11 on: October 07, 2020, 07:36:19 pm »
The simplest really is _LOADFONT and _FONT.
I found a 3d example of Steve.
I took the first lines as an example.
It's great, I'll research how to insert the color.
_loadfont.jpg
* _loadfont.jpg (Filesize: 145.71 KB, Dimensions: 1011x1015, Views: 154)
Código Steve.jpg
* Código Steve.jpg (Filesize: 203.95 KB, Dimensions: 841x1059, Views: 145)

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Slightly bigger letters
« Reply #12 on: October 07, 2020, 07:44:48 pm »
The wiki has several examples of _LOADFONT.

Easiest demo is simply:


SCREEN _NEWIMAGE(640, 480, 32)
f = _LOADFONT("cyberbit.ttf", 72, “MONOSPACE”)
_FONT f
PRINT “HELLO WORLD”

For color, just use a COLOR _RGB(red, green. blue) statement where neede.
« Last Edit: October 07, 2020, 07:49:08 pm by SMcNeill »
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline carloscordeiro

  • Forum Regular
  • Posts: 102
    • View Profile
Re: Slightly bigger letters
« Reply #13 on: October 07, 2020, 08:27:56 pm »
Ok Steve, I was searching the wiki, I also found the colors.

Thanks Steve, Bplus and Pete who presented options.

If Bplus wakes up funny, he will post some more. :)
Exemplo.jpg
* Exemplo.jpg (Filesize: 204.29 KB, Dimensions: 997x1013, Views: 167)

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Slightly bigger letters
« Reply #14 on: October 07, 2020, 11:04:14 pm »
The simplest really is _LOADFONT and _FONT.
I found a 3d example of Steve.
...


Agree absolutely! You can load a number of different sizes of same font.

Quote
It's great, I'll research how to insert the color.

Just use a COLOR statement, simple. For 3d effect alter color as you layer over and offset the text.


The code to the snapshot in Reply #5 is only necessary for cool FX effects with text.

« Last Edit: October 07, 2020, 11:06:41 pm by bplus »