Skip to main content

Inkplate 6MOTION - Printing text

Printing text on Inkplate is simple and requires only a few functions. The library also supports custom fonts.

ℹ️
For complete examples of text printing, most Arduino projects in the library include some form of text output.

Simple text printing​

To print text, use setCursor followed by print. If you're using the default font, you may want to use setTextSize to increase the font size:

// Set the printing cursor to x=100, y=100
inkplate.setCursor(100, 100);
// Increase text size by a factor of 3 for better visibility
inkplate.setTextSize(3);
// Print the text
inkplate.print("Hi Inkplate!");

inkplate.display(); // As always, call display to render the text on the e-Paper

inkplate.setCursor()

Sets the cursor position for text printing.

Returns value: None

Function parameters:

TypeNameDescription
int16_t_xX-coordinate where text printing starts.
int16_t_yY-coordinate where text printing starts.

inkplate.setTextSize()

Increases the text size by a given factor.

Returns value: None

Function parameters:

TypeNameDescription
uint8_tsSize factor. 1 is default size, 2 is twice as large, 3 is three times larger, etc.

inkplate.print()

Prints text at the previously set cursor position. This is the standard Arduino print function used in many native Arduino objects and libraries.

Returns value: size_t, number of bytes printed.

Function parameters:

TypeNameDescription
const char *_cThe C-style string to print on the display.

Text background color​

To change the text color, use setTextColor. This function can also optionally set a background color, which prints a rectangle in that color behind the text. This can improve visibility in some cases.

inkplate.setTextColor()

Sets the color of the text. Must be called before printing.

Returns value: None

Function parameters:

TypeNameDescription
uint16_tcText color.
uint16_tbgOptional background color. Default is transparent.

Custom fonts​

The default font appears blocky as it is optimized for minimal memory usage. You can use custom fonts by downloading them from the Adafruit GFX official repository. Adafruit provides well-documented examples on using custom fonts here.

After downloading a font, place it in your sketch folder, include it, and use setFont:

// Include the Inkplate Motion Arduino Library
#include <InkplateMotion.h>
#include "FreeSerif9pt7b.h" // Include the custom font
Inkplate inkplate; // Create an Inkplate object

void setup()
{
// Initialize Inkplate
inkplate.begin(INKPLATE_BLACKWHITE);
// Set the font
inkplate.setFont(&FreeSerif9pt7b);
// Print a message
inkplate.setCursor(100, 100);
inkplate.print("Hello world!");
// Update the display
inkplate.display();
}

void loop()
{
// Do nothing
}

inkplate.setFont()

Sets a custom font for text printing. Must be called before printing.

Returns value: None

Function parameters:

TypeNameDescription
const GFXfont *fPointer to the GFXfont structure of the font to be set.

Additional text printing options​

Use setTextWrap to enable or disable automatic text wrapping when reaching the edge of the e-Paper display:

inkplate.setTextWrap()

Enables or disables automatic text wrapping.

Returns value: None

Function parameters:

TypeNameDescription
boolwTrue enables text wrapping, false disables it.