0 votes
asked in ESPaper by (140 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
answered by (2.8k 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.