Skip to content

Commit 6033856

Browse files
authored
check unicodes before convert to string
1 parent db11170 commit 6033856

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/glyph-inspector.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ <h1>Free Software</h1>
132132
var glyph = font.glyphs.get(glyphIndex),
133133
html = '<dl>';
134134
html += '<dt>glyphName</dt><dd>'+glyph.name+'</dd>';
135-
const char = String.fromCodePoint.apply(null, glyph.unicodes);
136-
html += '<dt>glyph</dt><dd style="font-family:\'OpentypeCustomFont\'">'+char+'</dd>';
137-
const hex = char.codePointAt(0).toString(16);
138-
html += '<dt>htmlCode</dt><dd>&amp;#x'+hex+';</dd>';
139-
html += '<dt>cssCode</dt><dd>content: \'\\'+hex+'\';</dd>';
140135
if (glyph.unicodes.length > 0) {
136+
const char = String.fromCodePoint.apply(null, glyph.unicodes);
137+
html += '<dt>glyph</dt><dd style="font-family:\'OpentypeCustomFont\'">'+char+'</dd>';
138+
const hex = char.codePointAt(0).toString(16);
139+
html += '<dt>htmlCode</dt><dd>&amp;#x'+hex+';</dd>';
140+
html += '<dt>cssCode</dt><dd>content: \'\\'+hex+'\';</dd>';
141141
html += '<dt>unicode</dt><dd>'+ glyph.unicodes.map(formatUnicode).join(', ') +'</dd>';
142142
}
143143
html += '<dt>index</dt><dd>'+glyph.index+'</dd>';

0 commit comments

Comments
 (0)