Tried to avoid vertical_byte:true in final image to feed it to createCustomFont but it made no difference - still see random garbage. I made following method to convert it to single buffer which is not in vertical format
function createFont(off,bs,w,h,c){
var ptr=0x60000000+off;
var f=require("Flash");
var totw=w*c; // todo take from letters
var font=Graphics.createArrayBuffer(totw,h,1);
var lg=Graphics.createArrayBuffer(w,h,1,{vertical_byte:true});
var ll=lg.buffer.length;
var x=0;
for (var i=0;i<c;i++){
lg.buffer=f.read(ll,ptr+i*bs);
lw=lg.buffer[0];lg.buffer[0]=0;
font.drawImage(lg.asImage("string"),x,0);
x+= w;//(lw>0)?lw:w;
}
return font;
}
and the result is attached, but when creating font from it like this
g.setFontCustom(ft.asImage("string"),32,16,32)
or this
g.setFontCustom(E.toString(ft.buffer),32,16,32)
it is still not right so the format is still something else.
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.
Tried to avoid vertical_byte:true in final image to feed it to createCustomFont but it made no difference - still see random garbage. I made following method to convert it to single buffer which is not in vertical format
and the result is attached, but when creating font from it like this
or this
it is still not right so the format is still something else.
1 Attachment