Graphics.setFontCustom() firstChar

Posted on
  • For 'Graphics.setFontCustom()', one can specify the font's 'firstChar' for which the documentation states :

    firstChar - The first character in the font - usually 32 (space)

    I am in the process of including true internationalisation for a Bangle.js 2 app and as such I am designing a custom font (with multiple font pages).

    Reading the above doc, I was under the impression one could choose the 'firstChar' value freely and so I started at 0 (zero). Now it seems that character 0x0D (new line) is processed as new line, even if setFontCustom indicated the characters start at 0x00 (and 0x0D is 'just another character')...

    I didn't verify if Espruino treats other 'below 0x20' characters in a special way, but it would have saved me a lot of debug time if it had been mentioned in the documentation that 'going below 0x20' is a dangerous adventure...

    Just a suggestion to please modify the (excellent) documentation - thanks

  • @jgw,

    the fist char is used to cut out chars before the first char you actually want to provide and 'cut out /safe the space' for the chars before within a 'regular' / ASCII char set, and then only provide 10 chars, for example for numeric or other special font...

    As many other Espruino uniques, resources / frugality - and still make it - are guide for design and implementation.

    I know from (very long time) past that some systems did chose the 2nd 16 chars for all the special chard, such as Umlaute and accents, because it was still 7-bit world, and still leave the basic control chars alone.

  • Thanks - honestly I think if I'd ignored newline I would have got more upset comments from other people, but I will change the docs now to be clear that newline is treated differently :) I believe that is probably the only one though.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Graphics.setFontCustom() firstChar

Posted by Avatar for jgw @jgw

Actions