UNPKG

@thi.ng/webgl-msdf

Version:

Multi-channel SDF font rendering & basic text layout for WebGL

21 lines (20 loc) 492 B
const convertGlyphs = (raw) => ({ fontFace: raw.info.face, fontSize: raw.info.size, lineHeight: raw.common.lineHeight, baseLine: raw.common.base, tex: raw.pages[0], size: [raw.common.scaleW, raw.common.scaleH], chars: raw.chars.reduce((acc, ch) => { acc[String.fromCharCode(ch.id)] = { pos: [ch.x, ch.y], offset: [ch.xoffset, ch.yoffset], size: [ch.width, ch.height], step: ch.xadvance }; return acc; }, {}) }); export { convertGlyphs };