Not sure if this is necessary or just a bug that multilines do not follow the setFontAlign() setting?
// run this code in the emulator
var sd = require('StringDecoders');
var drawStrCenter = function(t,x,y,dy){
var ta = t.split('\n');
ta.forEach((e)=>{
g.setFontAlign(0,-1).drawString(e,x,y);
y += dy;
});
};
var drawStr = function(t,x,y){
g.drawString(t,x,y);
};
var t = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor';
var tml = sd.fitWords(t,5,20);
g.setBgColor(0xfffff).clear().setColor(0).setFont("Vector", 15).setFontAlign(0,-1);
drawStrCenter(tml,119,0,15);
drawStr(tml,119,100);
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Not sure if this is necessary or just a bug that multilines do not follow the setFontAlign() setting?
1 Attachment