0 votes
in ESPaper by (180 points)
Is it posible with the graphic lib of the ESPaper to place text allign?

As an example : allign_text(text,x,y,alligment)

text = my text string

x,y = position on the screen

alligment = (Left,Centre,Right)

Kindley regards,

Jan Kromhout


1 Answer

0 votes
by (3.5k points)
You could create your own function to do that:

void AlignText(String text, int x, int y, String alignment){
  if (alignment  == “left”) gfx.setTextAlignment(TEXT_ALIGN_LEFT);
  if (alignment  == “center”) gfx.setTextAlignment(TEXT_ALIGN_CENTER);
  if (alignment  == “right”) gfx.setTextAlignment(TEXT_ALIGN_RIGHT);
  gfx.setTextAlignment(TEXT_ALIGN_LEFT); // back to default

Welcome to ThingPulse Q&A, where you can ask questions and receive answers from other members of the community.