Fonts

Code Examples ›› TFT ››
 visits
Parent Previous Next

DEMO VARIOUS STANDARD AND BDF FONTS

(Download)

Device = 18F67K22

Declare Xtal = 64

Declare Auto_Heap_Arrays = On

Declare Auto_Heap_Strings = On

Declare Auto_Variable_Bank_Cross = On

Declare Watchdog = OFF

Declare Warnings = Off

Declare Optimiser_Level = 3

'================ MCU =======================

$define McuType              0

'================ TFT SCREEN ================

$define TFT_IC               ILI9341

$define TftScreenWidth       320

$define TftScreenHeight      240

$define TftWidthOffset       0

$define TftHeightOffset      0

$define TftPixelCheck        0

$define TFT_COM              SPI_1

$define TFT_COM_Slow

$define TFT_COM_Fast

$define TFT_RESET            PORTC.7

$define TFT_CS               PORTF.7

$define TFT_DC               PORTC.2

$define TFT_MOSI             PORTC.5

$define _TFT_MOSI            _PORTC.5

$define TFT_MISO             PORTC.5

$define _TFT_MISO            _PORTC.5

$define TFT_SCLK             PORTC.3

$define _TFT_SCLK            _PORTC.3

Include                      "TftLib\TFT_Graphic_Lib.inc"

Include                      "TftLib\Colors\Colors.inc"

Include                      "TftLib\Drivers\Drivers.inc"

Include                      "TftLib\Drivers\ILI9341.inc"

Include                      "TftLib\System\System.inc"

Include                      "TftLib\System\System_SPI_V4.inc"

Include                      "TftLib\Shapes\Shapes.inc"

Include                      "TftLib\Shapes\Shapes_SPI_V1.inc"

'================ SD CARD ===================

$define SDCardUsed           0

'================ MEMORY ====================

$define MemoryType           0

'================ TFT TOUCH =================

$define TOUCH_IC             0

'================ SPRITES ===================

$define SpritesUsed          0

'=============== SND FONT ===================

$define FontSNDUsed          1

Include                      "TftLib\Fonts\SND\F0_SND_8x8_Basic.Inc"

Include                      "TftLib\Fonts\SND\F4_SND_16x16_Regular.Inc"

$define FontSmooth           1

$define FontMaxSpace         16

$define FontMaxPixels        16

Include                      "TftLib\Fonts\SND.inc"

Include                      "TftLib\Fonts\SND_SPI_V1.inc"

'=============== BDF FONT ===================

$define FontBDFUsed          1

Include                      "TftLib\Fonts\BDF\F2_BDF_Margarine-Regular-24.inc"

Include                      "TftLib\Fonts\BDF\F3_BDF_ProtestGuerrilla-Regular-22.inc"

Include                      "TftLib\Fonts\BDF\F4_BDF_Ranchers-Regular-23.inc"

Include                      "TftLib\Fonts\BDF\F5_BDF_Sail-Regular-25.inc"

Include                      "TftLib\Fonts\BDF\F6_BDF_Sunshiney-Regular-25.inc"

Include                      "TftLib\Fonts\BDF.inc"

Include                      "TftLib\Fonts\BDF_SPI_V1.inc"

Main:

Clear

SetCrystal()

SetPins()

TftSetUp(0,0)

TftResetScreen(AZURE)

TftSetBdfFont(2)

TftRectangleTCG(21,21, 298,218, AMETHYST, YELLOW, 1)

TftPrintBdfText(Democritus1, 22,160, 295,22, 1, ANTIQUE_RUBY,BLACK, 1, 71)

DelayMS 1500

TftRectangleTCG(21,21, 298,218, AMETHYST, YELLOW, 1)

TftPrintBdfText(Democritus2, 22,160, 295,22, 1, ANTIQUE_RUBY,BLACK, 1, 81)

DelayMS 1500

TftSetBdfFont(3)

TftRectangleTCG(21,21, 298,218, AMETHYST, YELLOW, 1)

TftPrintBdfText(Socrates1, 22,160, 295,22, 1, RED,BLACK, 1, 0)

DelayMS 1500

TftRectangleTCG(21,21, 298,218, AMETHYST, YELLOW, 1)

TftPrintBdfText(Socrates2, 22,160, 295,22, 1, RED,BLACK, 1, 0)

DelayMS 1500

TftRectangleTCG(21,21, 298,218, AMETHYST, YELLOW, 1)

TftPrintBdfText(Socrates3, 22,160, 295,22, 1, RED,BLACK, 1, 0)

DelayMS 1500

TftSetBdfFont(4)

TftRectangleTCG(21,21, 298,218, AMETHYST, YELLOW, 1)

TftPrintBdfText(Plato1, 22,160, 295,22, 1, ST_PATRICK_S_BLUE,BLACK, 1, 65)

DelayMS 1500

TftSetBdfFont(5)

TftRectangleTCG(21,21, 298,218, AMETHYST, YELLOW, 1)

TftPrintBdfText(Heraclitus1, 22,160, 295,22, 1, BYZANTIUM,BLACK, 1, 91)

DelayMS 1500

TftSetBdfFont(6)

TftRectangleTCG(21,21, 298,218, AMETHYST, YELLOW, 1)

TftPrintBdfText(Thales1, 22,160, 295,22, 1, COSMIC_COBALT,BLACK, 1, 0)

DelayMS 1500

TftSetBdfFont(6)

TftRectangleTCG(21,21, 298,218, AMETHYST, YELLOW, 1)

TftPrintBdfString("StringTEST$1234abcd$+", 40, 50, 318, 0, BLACK, BLACK, 1)

DelayMS 1500

TftResetScreen(AZURE)

TftPolygon(160,120, 100, 10, 0, 0, GREEN, 0, 0)

TftPolygon(160,120, 90, 9, 0, 0, GREEN, 0, 0)

TftPolygon(160,120, 80, 8, 0, 0, GREEN, 0, 0)

TftPolygon(160,120, 70, 7, 0, 0, GREEN, 0, 0)

TftPolygon(160,120, 60, 6, 0, 0, GREEN, 0, 0)

TftSetSndFont(0, 1)

TftPrintSndString("8x8-TEST1234abcd$+", 1, 0, 0, 1, ERIN, BLACK, 0)

TftPrintSndString("8x8-TEST1234abcd$+", 1, 0, 1, 1, ERIN, BLACK, 1)

TftPrintSndString("8x8-TEST1234abcd$+", 2, 0, 2, 1, FRENCH_VIOLET, FULVOUS, 0)

TftPrintSndString("8x8-TEST1234abcd$+", 2, 0, 3, 1, FRENCH_VIOLET, FULVOUS, 1)

TftSetSndFont(0, 0)

TftPrintSndString("8x8-TEST1234abcd$+", 2, 0, 4, 1, RED, OLD_GOLD, 0)

TftPrintSndString("8x8-TEST1234abcd$+", 2, 0, 5, 1, RED, OLD_GOLD, 1)

DelayMS 3000

TftResetScreen(AZURE)

TftPolygon(160,120, 100, 10, 0, 0, GREEN, 0, 0)

TftPolygon(160,120, 90, 9, 0, 0, GREEN, 0, 0)

TftPolygon(160,120, 80, 8, 0, 0, GREEN, 0, 0)

TftPolygon(160,120, 70, 7, 0, 0, GREEN, 0, 0)

TftPolygon(160,120, 60, 6, 0, 0, GREEN, 0, 0)

TftSetSndFont(4, 1)

TftPrintSndString("16x16-TEST1234abcd$+", 1, 0, 1, 1, ERIN, BLACK, 0)

TftPrintSndString("16x16-TEST1234abcd$+", 1, 0, 2, 1, ERIN, BLACK, 1)

TftPrintSndString("16x16+ABcd$", 2, 0, 2, 1, FRENCH_VIOLET, FULVOUS, 0)

TftPrintSndString("16x16+ABcd$", 2, 0, 3, 1, FRENCH_VIOLET, FULVOUS, 1)

TftSetSndFont(4, 0)

TftPrintSndString("16x16+ABcd$", 2, 0, 4, 1, BLACK, OLD_GOLD, 0)

TftPrintSndString("16x16+ABcd$", 2, 0, 5, 1, RED, OLD_GOLD, 1)

End

Dim Democritus1 As Flash8 = "Nothing exists except atoms and empty space, everything else is just opinion. - Democritus", 0

Dim Democritus2 As Flash8 = "It is hard to fight desire; but to control it is the sign of a reasonable man.  - Democritus", 0

Dim Socrates1 As Flash8 = "One thing I know is that I know nothing. This is the source of my wisdom. - Socrates", 0

Dim Socrates2 As Flash8 = "An unexamined life is not worth living. - Socrates", 0

Dim Socrates3 As Flash8 = "Worthless people live only to eat and drink; people of worth eat and drink only to live. - Socrates", 0

Dim Plato1 As Flash8 = "The worst of all deceptions is self-deception. - Plato", 0

Dim Heraclitus1 As Flash8 = "There is nothing permanent except change. - Heraclitus", 0

Dim Thales1 As Flash8 = "Time is the wisest of all things that are; for it brings everything to light. - Thales", 0

'Set Fosc

Proc SetCrystal()

Clear

OSCTUNE.6 = 1

DelayMS 100

EndProc

Proc SetPins()

'Set all digital

ANCON0 = 0

ANCON1 = 0

ANCON2 = 0

SSP1STAT.6 = 1

SSP1CON1 = %00100000

EndProc

Config_Start

RETEN = On        ;Enabled

INTOSCSEL = Low        ;LF-INTOSC in Low-power mode during Sleep

SOSCSEL = Dig        ;digital

XINST = OFF        ;Disabled

FOSC = EC2        ;HS oscillator (High power, 16 MHz - 25 MHz)

PLLCFG = On        ;Enabled

FCMEN = OFF        ;Disabled

IESO = OFF        ;Disabled

PWRTEN = OFF        ;Disabled

BOREN = OFF        ;Disabled in hardware, SBOREN disabled

BORV = 0        ;3.0V

BORPWR = High        ;BORMV set to high power level

WDTEN = OFF        ;WDT disabled in hardware; SWDTEN bit disabled

WDTPS = 1048576        ;1:1048576

RTCOSC = SOSCREF        ;RTCC uses SOSC

CCP2MX = PORTBE        ;RC1

MSSPMSK = MSK7        ;7 Bit address masking mode

MCLRE = On        ;MCLR Enabled, RG5 Disabled

STVREN = On        ;Enabled

BBSIZ = BB2K        ;2K word Boot Block size

Debug = OFF        ;Disabled

Cp0 = OFF        ;Disabled

CP1 = OFF        ;Disabled

CP2 = OFF        ;Disabled

CP3 = OFF        ;Disabled

CP4 = OFF        ;Disabled

CP5 = OFF        ;Disabled

CP6 = OFF        ;Disabled

CP7 = OFF        ;Disabled

CPB = OFF        ;Disabled

CPD = OFF        ;Disabled

WRT0 = OFF        ;Disabled

WRT1 = OFF        ;Disabled

WRT2 = OFF        ;Disabled

WRT3 = OFF        ;Disabled

WRT4 = OFF        ;Disabled

WRT5 = OFF        ;Disabled

WRT6 = OFF        ;Disabled

WRT7 = OFF        ;Disabled

WRTC = OFF        ;Disabled

WRTB = OFF        ;Disabled

WRTD = OFF        ;Disabled

EBRT0 = OFF        ;Disabled

EBRT1 = OFF        ;Disabled

EBRT2 = OFF        ;Disabled

EBRT3 = OFF        ;Disabled

EBRT4 = OFF        ;Disabled

EBRT5 = OFF        ;Disabled

EBRT6 = OFF        ;Disabled

EBRT7 = OFF        ;Disabled

EBRTB = OFF        ;Disabled

Config_End

Created with the Personal Edition of HelpNDoc: Create help files for the Qt Help Framework