Bold print on a TFT screen.

Place code snippets and demo code here
Post Reply
AndyGadget
Posts: 63
Joined: Mon Feb 15, 2021 1:44 pm
Has thanked: 24 times
Been thanked: 54 times

Bold print on a TFT screen.

Post by AndyGadget »

I wanted bold text for a project I'll be posting here shortly, and here are a couple of function subs to emulate this on a TFT screen.
It works by double printing, with an X, Y or both offset for the 2nd print. I'll be using the X Shifted version which gives the best effect.

(Cicciocb, how do I implement syntax highlighting in this editor, as you did to my other post?)

Code: [Local Link Removed for Guests]

pause 2500

TFT.INIT 1
TFT.TEXT.FONT 4
TFT.TEXT.SIZE 1
TFT.BRIGHTNESS 255

TFT.TEXT.COL yellow
PrintAt 20,15,"This is normal text."
PrintAtBld 20,40, "This is very bold text."
PrintAtBldY 20,65, "This is Y shifted bold text."
PrintAtBldX 20,90, "This is X shifted bold text."

TFT.RECT 0,115,319,125,green,1
TFT.TEXT.COL black
PrintAt 20,120,"This is normal text."
PrintAtBld 20,145, "This is very bold text."
PrintAtBldY 20,170, "This is Y shifted bold text."
PrintAtBldX 20,195, "This is X shifted bold text."

end


sub PrintAt(x,y,t$)
  tft.text.pos x,y
  tft.print t$
end sub

sub PrintAtBld(x,y,t$)
  tft.text.pos x,y
  tft.print t$
  tft.text.pos x+1,y+1
  tft.print t$
end sub

sub PrintAtBldY(x,y,t$)
  tft.text.pos x,y
  tft.print t$
  tft.text.pos x,y+1
  tft.print t$
end sub

sub PrintAtBldX(x,y,t$)
  tft.text.pos x,y
  tft.print t$
  tft.text.pos x+1,y
  tft.print t$
end sub

cicciocb
Site Admin
Posts: 309
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 85 times
Been thanked: 197 times
Contact:

Re: Bold print on a TFT screen.

Post by cicciocb »

Hi Andy,
thanks for this nice trick!

For enabling the syntax syntax highlighting, you must just specify [code=annex) in the code block
Post Reply