You are reading a single comment by @blogmywiki and its replies. Click here to read the full conversation.
  • var i = (col&3)+((col&~3)<<3);

    Yes, it's a bit confusing. Basically it's because the font as drawn in the string has the fonts one after the other vertically, but the custom font has them one after the other horizontally.

    If that was swapped the code would be stupidly simple.

    • col&3 is the X coordinate in each character
    • The remainder is working out where to get the Y coordinate of each character from

    There's actually a much nicer way of doing this, which the 7 segments fonts use to create themselves - the code for it is in the comments of the font: https://github.com/espruino/EspruinoDocs/blob/master/modules/Font5x7Numeric7Seg.js#L45-L62

    You could ignore all the 7 segment stuff and just load an image right onto the Graphics instance using the image converter

    Also worth checking out Matt's font converter: http://ebfc.mattbrailsford.com/

About

Avatar for blogmywiki @blogmywiki started