Update for spelling etc. in comments!

This commit is contained in:
Bodmer committed 2023-12-07 20:35:59 +00:00
1 parent aefcf5af63
commit d506a3c49d
197 files changed
+1006 -757

No files matched your search

@@ -61,7 +61,7 @@ void loop() {
tft.setTextColor(TFT_WHITE, TFT_BLACK); // Set the font colour AND the background colour
// so the anti-aliasing works
tft.setCursor(0, 0); // Set cursor at top left of screen
tft.setcursor(0, 0); // Set cursor at top left of screen
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@@ -102,7 +102,7 @@ void loop() {
// Get ready for the next demo while we have this font loaded
tft.fillScreen(TFT_BLACK);
tft.setCursor(0, 0); // Set cursor at top left of screen
tft.setcursor(0, 0); // Set cursor at top left of screen
tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.println("Wrong and right ways to");
tft.println("print changing values...");
@@ -121,17 +121,17 @@ void loop() {
// Draw changing numbers - does not work unless a filled rectangle is drawn over the old text
for (int i = 0; i <= 99; i++)
{
tft.setCursor(50, 50);
tft.setcursor(50, 50);
tft.setTextColor(TFT_GREEN, TFT_BLACK); // TFT_BLACK is used for anti-aliasing only
// By default background fill is off
tft.print(" "); // Overprinting old number with spaces DOES NOT WORK!
tft.setCursor(50, 50);
tft.setcursor(50, 50);
tft.print(i / 10.0, 1);
// Adding a parameter "true" to the setTextColor() function fills character background
// This extra parameter is only for smooth fonts!
tft.setTextColor(TFT_GREEN, TFT_BLACK, true);
tft.setCursor(50, 90);
tft.setcursor(50, 90);
tft.print(i / 10.0, 1);
delay (200);
@@ -147,7 +147,7 @@ void loop() {
tft.setTextColor(TFT_YELLOW, TFT_BLACK); // Change the font colour and the background colour
tft.setCursor(0, 0); // Set cursor at top left of screen
tft.setcursor(0, 0); // Set cursor at top left of screen
tft.println("Large font!");
@@ -11,7 +11,7 @@
This sketch uses method 3, the font characters are first plotted in a Sprite, then the
Sprite is pushed to the screen. This method is very flexible and the Sprite can be
created, deleted, resized as needed. To render anti-aliased fonts well the Sprite
needs to be 16 bit. The fonts will render in 1 bit per pixel sprites but there
needs to be 16-bit. The fonts will render in 1 bit per pixel sprites but there
will then be no anti-aliasing. Using 1 bit per pixel Sprites is however useful
to use the extended Unicode range in fonts on mono displays like ePaper.
@@ -50,7 +50,7 @@ void setup(void) {
tft.setRotation(1);
spr.setColorDepth(16); // 16 bit colour needed to show antialiased fonts
spr.setcolorDepth(16); // 16-bit colour needed to show antialiased fonts
}
void loop() {
@@ -93,7 +93,7 @@ void loop() {
tft.fillScreen(TFT_BLACK);
// Beware: Sprites are a differerent "class" to TFT, so different fonts can be loaded
// Beware: Sprites are a different "class" to TFT, so different fonts can be loaded
// in the tft and sprite instances, so load the font in the class instance you use!
// In this example this means the spr. instance.
@@ -181,8 +181,8 @@ void button(int x, int y, int num )
#define IWIDTH 40
#define IHEIGHT 25
// Create a 16 bit sprite 40 pixels wide, 25 high (2000 bytes of RAM needed)
spr.setColorDepth(16);
// Create a 16-bit sprite 40 pixels wide, 25 high (2000 bytes of RAM needed)
spr.setcolorDepth(16);
spr.createSprite(IWIDTH, IHEIGHT);
// Fill it with black (this will be the transparent colour this time)
@@ -58,7 +58,7 @@ void setup(void) {
tft.setRotation(1);
spr.setColorDepth(16); // 16 bit colour needed to show anti-aliased fonts
spr.setcolorDepth(16); // 16-bit colour needed to show anti-aliased fonts
}
void loop() {
@@ -81,7 +81,7 @@ void loop() {
spr.setTextColor(TFT_YELLOW, TFT_BLACK); // Set the sprite font colour and the background colour
tft.setCursor(xpos - 50, ypos); // Set the tft cursor position, yes tft position!
tft.setcursor(xpos - 50, ypos); // Set the tft cursor position, yes tft position!
spr.printToSprite("Small 15pt font"); // Prints to tft cursor position, tft cursor NOT moved
ypos += spr.fontHeight(); // Get the font height and move ypos down
@@ -100,14 +100,14 @@ void loop() {
spr.setTextColor(TFT_WHITE, TFT_BLUE); // Set the font colour and the background colour
tft.setCursor(xpos - 90, ypos); // Set the tft cursor position
tft.setcursor(xpos - 90, ypos); // Set the tft cursor position
spr.printToSprite("36pt font"); // Text is rendered via a minimally sized sprite
ypos += spr.fontHeight(); // Get the font height and move ypos down
// Draw changing numbers - no flicker using this plot method!
for (int i = 0; i <= 200; i++) {
tft.setCursor(10, 10);
tft.setcursor(10, 10);
// Number is converted to String type by (String) (number)
spr.printToSprite(" " + (String) (i / 100.0) + " "); // Space padding helps over-write old numbers
delay (20);
@@ -8,7 +8,7 @@
sketch in the library Tools folder. The Processing sketch can convert
TrueType fonts in *.ttf or *.otf files.
The library supports 16 bit unicode characters:
The library supports 16-bit Unicode characters:
https://en.wikipedia.org/wiki/Unicode_font
The characters supported are in the in the Basic Multilingual Plane:
@@ -60,7 +60,7 @@ void loop() {
// Set "cursor" at top left corner of display (0,0)
// (cursor will move to next line automatically during printing with 'tft.println'
// or stay on the line is there is room for the text with tft.print)
tft.setCursor(0, 0);
tft.setcursor(0, 0);
// Set the font colour to be white with a black background, set text size multiplier to 1
tft.setTextColor(TFT_WHITE, TFT_BLACK);
@@ -11,7 +11,7 @@
will return the pixel color at a position x,y on the TFT. In this sketch that
function is called gradientColor, so this line is included in setup():
tft.setCallback(gradientColor);
tft.setcallback(gradientColor);
TFT_eSPI will call this function during the rendering of the anti-aliased
font to blend the edges of each character with the returned color.
@@ -66,8 +66,8 @@ void setup(void) {
tft.begin();
tft.setCallback(gradientColor); // Switch on color callback for anti-aliased fonts
//tft.setCallback(nullptr); // Switch off callback (off by default)
tft.setcallback(gradientColor); // Switch on color callback for anti-aliased fonts
//tft.setcallback(nullptr); // Switch off callback (off by default)
tft.setRotation(1);
}
@@ -83,7 +83,7 @@ void loop() {
fillGradient(); // Put here after selecting the font so fontHeight() is already set
tft.setTextColor(TFT_WHITE); // Background color is ignored in gradient area
tft.setCursor(0, 10); // Set cursor at top left of screen
tft.setcursor(0, 10); // Set cursor at top left of screen
uint32_t t = millis();
tft.println(" Ode to a small\n lump of green\n putty I found\n in my armpit\n one midsummer\n morning ");
@@ -9,7 +9,7 @@
that will return the pixel color at a position x,y on the TFT. In this
sketch that function is called pixelColor, so this line is included:
tft.setCallback(pixelColor);
tft.setcallback(pixelColor);
TFT_eSPI will call this function during the rendering of the anti-aliased
font and use it to blend the edges of each character with the screen color.
@@ -43,8 +43,8 @@ void setup(void) {
tft.begin();
tft.setCallback(pixelColor); // Switch on color callback for anti-aliased fonts
//tft.setCallback(nullptr); // Switch off callback (off by default)
tft.setcallback(pixelColor); // Switch on color callback for anti-aliased fonts
//tft.setcallback(nullptr); // Switch off callback (off by default)
tft.setRotation(1);
}
@@ -61,7 +61,7 @@ void loop() {
tft.loadFont(AA_FONT_SMALL);
tft.setTextColor(TFT_BLACK, TFT_WHITE); // Background color is ignored if callback is set
tft.setCursor(0, 10); // Set cursor at top left of screen
tft.setcursor(0, 10); // Set cursor at top left of screen
uint32_t t = millis();
tft.println(" Ode to a small\n lump of green\n putty I found\n in my armpit\n one midsummer\n morning ");
@@ -83,7 +83,7 @@ unsigned int colour = red << 11; // Colour order is RGB 5+6+5 bits each
void rainbow_fill()
{
// The colours and state are not initialised so the start colour changes each time the funtion is called
// The colours and state are not initialised so the start colour changes each time the function is called
for (int i = 319; i >= 0; i--) {
// Draw a vertical line 1 pixel wide in the selected colour
@@ -8,14 +8,14 @@
The library expects strings to be in UTF-8 encoded format:
https://www.fileformat.info/info/unicode/utf8.htm
Creating varaibles needs to be done with care when using character arrays:
Creating variables needs to be done with care when using character arrays:
char c = 'µ'; // Wrong
char bad[4] = "5µA"; // Wrong
char good[] = "5µA"; // Good
String okay = "5µA"; // Good
This is because UTF-8 characters outside the basic Latin set occupy more than
1 byte per character! A 16 bit Unicode character occupies 3 bytes!
1 byte per character! A 16-bit Unicode character occupies 3 bytes!
*/
@@ -77,7 +77,7 @@ void loop()
tft.showFont(2000); // Note: This function moves the cursor position!
tft.fillScreen(bg);
tft.setCursor(0,0);
tft.setcursor(0,0);
tft.println(test1);
@@ -89,7 +89,7 @@ void loop()
//----------------------------------------------------------------------------
// We can have any random mix of characters in the font
String test2 = "仝倀"; // Unicodes 0x4EDD, 0x5000
String test2 = "仝倀"; // Unicode 0x4EDD, 0x5000
tft.loadFont(Unicode_Test_72);
@@ -99,7 +99,7 @@ void loop()
tft.showFont(2000); // Note: This function moves the cursor position!
tft.fillScreen(bg);
tft.setCursor(0,0);
tft.setcursor(0,0);
tft.setTextColor(TFT_CYAN, bg);
tft.println(test2);
@@ -129,7 +129,7 @@ void loop()
tft.fillScreen(bg);
tft.setTextColor(TFT_GREEN, bg);
tft.setCursor(0,0);
tft.setcursor(0,0);
tft.println("Konnichiwa");
tft.println(test3);