Skip to content
This repository was archived by the owner on Dec 20, 2021. It is now read-only.

changeLabelFont()

Mammad900 edited this page Nov 4, 2020 · 1 revision

changeLabelFont(page, index, value)

Summary

Changes the font (style) of a label

Parameters

  1. page (int) : The number of the page which contains the label
  2. index (int) : Index of the label relative to it's containing page.
  3. value (const GFXfont*) : A pointer to an Adafruit GFX font object. Will replace the old font.

Returns

Nothing

Example

void attention(int Page, int index){
    changeLabelFont(Page,index,&FreeSansBold9pt7b);
    delay(1000);
    changeLabelFont(Page,index,&FreeSans9pt7b);
}

Output

When attention is called, the specified label becomes bold for 1 second.

Source

    void changeLabelFont(int page, int i, const GFXfont *val) {
        if (label_font[page][i] != val) {
            HCT
            if (CurrentPage == page) {
                undrawlabel(page, i);
                label_font[page][i] = (GFXfont *)val;
                drawlabel(page, i);
            }
        }
        else
            label_font[page][i] = (GFXfont *)val;
    }

Note: HCT is a macro for making the rest of the library aware that something has changed.

Clone this wiki locally