diff --git a/docs/glyph-inspector.html b/docs/glyph-inspector.html index 60732306..6ee06890 100644 --- a/docs/glyph-inspector.html +++ b/docs/glyph-inspector.html @@ -4,7 +4,8 @@ - + +

opentype.js

@@ -130,8 +131,12 @@

Free Software

} var glyph = font.glyphs.get(glyphIndex), html = '
'; - html += '
name
'+glyph.name+'
'; - + html += '
glyphName
'+glyph.name+'
'; + const char = String.fromCodePoint.apply(null, glyph.unicodes); + html += '
glyph
'+char+'
'; + const hex = char.codePointAt(0).toString(16); + html += '
htmlCode
&#x'+hex+';
'; + html += '
cssCode
content: \'\\'+hex+'\';
'; if (glyph.unicodes.length > 0) { html += '
unicode
'+ glyph.unicodes.map(formatUnicode).join(', ') +'
'; } @@ -412,6 +417,15 @@

Free Software

const data = await file.arrayBuffer(); onFontLoaded(opentype.parse(isWoff2 ? Module.decompress(data) : data)); showErrorMessage(''); + const styleTag = document.getElementById("OpentypeCustomFontTag"); + const blob = new Blob([data], { type: 'application/octet-stream' }); + const url = URL.createObjectURL(blob); + styleTag.innerHTML = ` + @font-face { + font-family: 'OpentypeCustomFont'; + src: url(${url}); + } + `.trim(); } catch (err) { showErrorMessage(err.toString()); }