• Ok, so this is more for your interest than anything else. Using an Espruino Pico with a PCD8544 display, this code actually creates a new double-size font (with spaces) on the Espruino itself:

    A5.write(0); // GND
    A7.write(1); // VCC
    
    var charFrom = 32;
    var charTo = 126;
    var charHeight;
    var charWidths, charData;
    
    function doFont() {
      var height = 6;
      var gbig;
      var gsmall = Graphics.createArrayBuffer(height*2, height, 1);
      var totalWidth = 0;
      for (var i=charFrom;i<=charTo;i++)
        totalWidth += gsmall.stringWidth(String.fromCharCode(i­)*2);
      charWidths = "";
      charHeight = height*2;
      charData = "";
      for (i=charFrom;i<=charTo;i++) {
        console.log("Char "+i);
        var ch = String.fromCharCode(i);
        gsmall.clear();
        gsmall.drawString(ch);
        var w = gsmall.stringWidth(ch);
        gbig = Graphics.createArrayBuffer(charHeight, w*2, 1,{msb:true});
        gbig.setRotation(3,true);
        for (var y=0;y<height;y++)
          for (var x=0;x<w;x++)
            if (gsmall.getPixel(x,y))
              gbig.fillRect(x*2,y*2,x*2+1,y*2+1);
        charWidths+=String.fromCharCode(gbig.get­Width());
        charData += E.toString(gbig.buffer);
      }  
    }
    
    
    // Setup SPI
    var spi = new SPI();
    spi.setup({ sck:B1, mosi:B10 });
    // Initialise the LCD
    var g = require("PCD8544").connect(spi,B13,B14,B­15, function() {
      // When it's initialised, clear it and write some text
      g.clear();
      doFont();
      g.setFontCustom(charData, charFrom, charWidths, charHeight);
      g.drawString("Hello",0,0);
      g.flip();
    });
    

    You could then re-encode it with btoa and make your own custom font again.

    It'll only work if width*height of each character in the new font is a multiple of 8, but for your case that should be fine.

    You should be able to modify that to just print your existing font (not doubling the size) while also adding a blank column.

    Honestly though - I'd just use the code I linked above and change the number for padding :)

About

Avatar for Gordon @Gordon started