• 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);
        var w = gsmall.stringWidth(ch);
        gbig = Graphics.createArrayBuffer(charHeight, w*2, 1,{msb:true});
        for (var y=0;y<height;y++)
          for (var x=0;x<w;x++)
            if (gsmall.getPixel(x,y))
        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.setFontCustom(charData, charFrom, charWidths, charHeight);

    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 :)


Avatar for Gordon @Gordon started