Hmm. Maybe a stroked font is the best bet. I just had a play - it's slow, but quite interesting:
font = new Uint16Array(E.toArrayBuffer(atob("EIAKgAVFhQjFSQQKRQoGCsUJEIAERcQGDEXMBhWAC0QEDBFECgxER1IHw0jRCBSACERICwxETAvRRU8FDAUIBUUFwwVDBsQGBQdHB80HDwhQCNEIkQkPCkwKSAoFCoMJGIAVRUMKCEWKBQoGiQbHBsUGQwbDBUQFBgUIBUoFjQWQBVMFFQWRSM8ITgnOCVAKUgoUCpUJFQmTCJEIGoBXRxcH1gbVBhQHkwfRCI8JDQpLCkcKBQrECUMJwwhECAUIDAfNBk4GzgVNBQsFSQXIBUgGCQfLB5AJEgpUClYKFwrXCQqAhUVEBQUFRgXGBUUGhAYOgAtEiQRHBUUGhAeECMUJxwqJCwsMDoADRIUERwVJBooHigjJCccKhQsDDBCAiEaICUNHzQhNR8MIGoDNRU0KBEgWCAiARUmECUMJBAlFCcUJQwoagARIFggIgARJQwmECUUJBAkWgBREAgwUgAlFRgUEBkMHAwhECQYKSQpLCg4KUAkRCFEHEAZOBQsFCQUUgAZGyAULBUsKFIBERgQGhQVGBQgFDAVOBY8FEAaQBg8HzQdDClEKFIAFRRAFCgcNB08HkAdRCNEIkAkOCksKSAoFCsQJQwkUgA1FgwiSCA1FTQoUgA9FBQVEBwUHyAbLBg4HkAdRCNEIkAkOCksKSAoFCsQJQwkUgNBFTwUMBQoFRwUFBkQHhAiFCQcKSgpLCg4KkAnRCJEI0AdOBwsHCgdHB8UHhAgUgBFFRwoDRREFFIAIRUUFxAVEBsUGBwdLB44HEAiRCFEJ0AkPCkwKSAoFCsQJQwmDCAQIhgdJBw0HzwZQBtAFTwUMBQgFFIDQRo8HDQhKCEkIBgiEB8MGgwbEBUYFCQUKBU0FzwXQBhAITwkNCkoKSAoFCoQJCIBER4MHxAeFB0QHBElDCYQJRQkECQiAREeDB8QHhQdEB0VJhAlDCQQJRQnFCUMKGIDURQQIVAoagERHVgfESNYIGIDERRQIRAoSgENGAwaEBU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UHVQcQgABFQApBCgEFAgVCCkMKAwUEBUQKRQoFBQYFRgpHCgcFCAVICkkKCQUKBUoKSwoLBQwFTApNCg0FDgVOCk8KDwUQBVAKAIA=")));
function drawChar(c,ox,oy,s) {
c-=32;
if (c<0 || c>95) return 0; // no char
var i = 0;
while (c)if(font[++i]&32768) c--;
var width = font[i++]&63;
var f;
while (!((f=font[i++])&32768)) {
var x = (f&63)*s + ox;
var y = ((f>>6)&63)*s + oy;
if (f&16384) g.moveTo(x,y); else g.lineTo(x,y);
}
return width*s;
}
function drawString(str,x,y,s) {
x=x||0;
y=y||0;
s=s?(s/22):1;
str=""+str;
y -= 20*s;
for (var i=0;i<str.length;i++)
x+=drawChar(str.charCodeAt(i),x,y,s);
}
g.clear();drawString("Hello",0,0,10);g.flip();
It uses half the space of the current vector font, and it scales down really well:
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hmm. Maybe a stroked font is the best bet. I just had a play - it's slow, but quite interesting:
It uses half the space of the current vector font, and it scales down really well:
It's just a matter of making the lines bigger when the text is rendered bigger.