let fonts = [{"font":"50px  sans-serif","text":"0-_{w."},{"font":"50px  serif","text":"0-_{w."},{"font":"50px 'Andale Mono',  sans-serif","text":"0-_{w."},{"font":"50px 'Arial Narrow',  sans-serif","text":"0-_{w."},{"font":"50px 'Arial Unicode MS',  sans-serif","text":"0-_{w."},{"font":"50px 'Batang',  sans-serif","text":"0-_{w."},{"font":"50px 'Batang',  serif","text":"0-_{w."},{"font":"50px 'Bell MT',  sans-serif","text":"0-_{w."},{"font":"50px 'Bell MT',  serif","text":"0-_{w."},{"font":"50px 'Brush Script',  sans-serif","text":"0-_{w."},{"font":"50px 'Brush Script',  serif","text":"0-_{w."},{"font":"50px 'Brush Script MT',  sans-serif","text":"0-_{w."},{"font":"50px 'Calibri',  sans-serif","text":"0-_{w."},{"font":"50px 'Calibri',  serif","text":"0-_{w."},{"font":"50px 'Charter',  sans-serif","text":"0-_{w."},{"font":"50px 'Courier',  sans-serif","text":"0-_{w."},{"font":"50px 'Courier New',  sans-serif","text":"0-_{w."},{"font":"50px 'Curlz MT',  sans-serif","text":"0-_{w."},{"font":"50px 'Curlz MT',  serif","text":"0-_{w."},{"font":"50px 'DejaVu Sans',  sans-serif","text":"0-_{w."},{"font":"50px 'DejaVu Sans',  serif","text":"0-_{w."},{"font":"50px 'DejaVu Sans Mono',  sans-serif","text":"0-_{w."},{"font":"50px 'DejaVu Sans Mono',  serif","text":"0-_{w."},{"font":"50px 'DejaVu Serif Condensed',  sans-serif","text":"0-_{w."},{"font":"50px 'DejaVu Serif Condensed',  serif","text":"0-_{w."},{"font":"50px 'Droid Sans',  sans-serif","text":"0-_{w."},{"font":"50px 'Droid Sans',  serif","text":"0-_{w."},{"font":"50px 'Droid Sans Fallback',  sans-serif","text":"0-_{w."},{"font":"50px 'Droid Sans Fallback',  serif","text":"0-_{w."},{"font":"50px 'Droid Serif',  sans-serif","text":"0-_{w."},{"font":"50px 'Droid Serif',  serif","text":"0-_{w."},{"font":"50px 'Forte',  sans-serif","text":"0-_{w."},{"font":"50px 'Forte',  serif","text":"0-_{w."},{"font":"50px 'Futura',  sans-serif","text":"0-_{w."},{"font":"50px 'Geneva',  sans-serif","text":"0-_{w."},{"font":"50px 'Hei',  sans-serif","text":"0-_{w."},{"font":"50px 'Leelawadee',  sans-serif","text":"0-_{w."},{"font":"50px 'Leelawadee',  serif","text":"0-_{w."},{"font":"50px 'Levenim MT',  sans-serif","text":"0-_{w."},{"font":"50px 'Levenim MT',  serif","text":"0-_{w."},{"font":"50px 'Liberation Sans',  sans-serif","text":"0-_{w."},{"font":"50px 'Liberation Sans',  serif","text":"0-_{w."},{"font":"50px 'Liberation Sans Narrow',  sans-serif","text":"0-_{w."},{"font":"50px 'Liberation Sans Narrow',  serif","text":"0-_{w."},{"font":"50px 'Marlett',  sans-serif","text":"0-_{w."},{"font":"50px 'Marlett',  serif","text":"0-_{w."},{"font":"50px 'Meiryo UI',  sans-serif","text":"0-_{w."},{"font":"50px 'Meiryo UI',  serif","text":"0-_{w."},{"font":"50px 'Microsoft Uighur',  sans-serif","text":"0-_{w."},{"font":"50px 'Microsoft Uighur',  serif","text":"0-_{w."},{"font":"50px 'Microsoft YaHei UI',  sans-serif","text":"0-_{w."},{"font":"50px 'Microsoft YaHei UI',  serif","text":"0-_{w."},{"font":"50px 'MS Mincho',  sans-serif","text":"0-_{w."},{"font":"50px 'MS Mincho',  serif","text":"0-_{w."},{"font":"50px 'MS UI Gothic',  sans-serif","text":"0-_{w."},{"font":"50px 'MS UI Gothic',  serif","text":"0-_{w."},{"font":"50px 'NanumGothic',  sans-serif","text":"0-_{w."},{"font":"50px 'Nirmala UI',  sans-serif","text":"0-_{w."},{"font":"50px 'Nirmala UI',  serif","text":"0-_{w."},{"font":"50px 'Palatino',  sans-serif","text":"0-_{w."},{"font":"50px 'Papyrus',  sans-serif","text":"0-_{w."},{"font":"50px 'PMingLiU',  sans-serif","text":"0-_{w."},{"font":"50px 'PMingLiU',  serif","text":"0-_{w."},{"font":"50px 'PT Serif',  sans-serif","text":"0-_{w."},{"font":"50px 'SimHei',  sans-serif","text":"0-_{w."},{"font":"50px 'SimHei',  serif","text":"0-_{w."},{"font":"50px 'STIXVariants',  sans-serif","text":"0-_{w."},{"font":"50px 'STSong',  sans-serif","text":"0-_{w."},{"font":"50px 'Traditional Arabic',  sans-serif","text":"0-_{w."},{"font":"50px 'Traditional Arabic',  serif","text":"0-_{w."},{"font":"50px 'Urdu Typesetting',  sans-serif","text":"0-_{w."},{"font":"50px 'Urdu Typesetting',  serif","text":"0-_{w."},{"font":"50px 'Verdana',  sans-serif","text":"0-_{w."},{"font":"50px 'Wingdings',  sans-serif","text":"0-_{w."},{"font":"50px 'Wingdings 3',  sans-serif","text":"0-_{w."},{"font":"50px 'Helkevtrica',  sans-serif","text":"0-_{w."},{"font":"50px 'Helkevtrica',  serif","text":"0-_{w."}]
let fontsRes = {}
console.log(fonts.length)
let canvas = document.createElement('canvas');
let ctx = canvas.getContext('2d')
ctx.textBaseline = 'top';
for (let i = 0; i < fonts.length; i++) {
    ctx.font = fonts[i].font;
    let met = ctx.measureText(fonts[i].text)
    if (fontsRes[fonts[i]]) {
        fontsRes[fonts[i].font][fonts[i].text] = {
            width: met.width,
            actualBoundingBoxAscent: met.actualBoundingBoxAscent,
            actualBoundingBoxLeft: met.actualBoundingBoxLeft,
            actualBoundingBoxRight: met.actualBoundingBoxRight,
            fontBoundingBoxAscent: met.fontBoundingBoxAscent,
        }
    }
}


console.log(JSON.stringify(fontsRes))

let imgsRes = {};

let sss = [{
    "font": "94px sans-serif",
    "fillStyle": "#000000",
    "fillText": ["😎", -1, 96],
    "imageData": [18, 90, 1, 1]
}, {
    "font": "94px sans-serif",
    "fillStyle": "#000000",
    "fillText": ["6️⃣", -1, 96],
    "imageData": [38, 77, 1, 1]
}, {
    "font": "94px sans-serif",
    "fillStyle": "#000000",
    "fillText": ["🍼", -1, 96],
    "imageData": [48, 28, 1, 1]
}, {
    "font": "94px sans-serif",
    "fillStyle": "#000000",
    "fillText": ["🏴󠁧󠁢󠁥󠁮󠁧󠁿", -1, 96],
    "imageData": [94, 23, 1, 1]
}, {
    "font": "94px sans-serif",
    "fillStyle": "#000000",
    "fillText": ["📊", -1, 96],
    "imageData": [26, 46, 1, 1]
}, {
    "font": "94px sans-serif",
    "fillStyle": "#000000",
    "fillText": ["🏴󠁧󠁢󠁥󠁮󠁧󠁿", -1, 96],
    "imageData": [47, 23, 1, 1]
}, {
    "font": "94px sans-serif",
    "fillStyle": "#000000",
    "fillText": ["㊗️", -1, 96],
    "imageData": [37, 17, 1, 1]
}, {
    "font": "94px sans-serif",
    "fillStyle": "#000000",
    "fillText": ["⛎", -1, 96],
    "imageData": [62, 28, 1, 1]
}]

let imgRes = {};
for (let i = 0; i < sss.length; i++) {

    var a = document.createElement('canvas')
    let ctx = a.getContext('2d');
    let s = sss[i];
    ctx.font = s.font;
    ctx.fillStyle = s.fillStyle;
    ctx.fillText(...s.fillText)

    let data = ctx.getImageData(...s.imageData);
    if (!imgRes[s.font]){
        imgRes[s.font] = {}
    }
    imgRes[s.font][s.imageData+''] = data.data+''

}

