You are reading a single comment by @MaBe and its replies. Click here to read the full conversation.
  • 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);
    
    

    1 Attachment

    • Bildschirmfoto 2021-05-20 um 17.17.15.jpg
About

Avatar for MaBe @MaBe started