Add code to IGlyphIdentifer, use it
It turns out that `glyph.char.charCodeAt(0)` isn't equivalent to the character's actual code because of utf-16 garbage, so this adds `glyph.code` to the `glyph` object so that we can use the `code` value, and don't need to regenerate it.
This commit is contained in:
@@ -34,7 +34,7 @@ export default class StaticCharAtlas extends BaseCharAtlas {
|
||||
}
|
||||
|
||||
private _isCached(glyph: IGlyphIdentifier, colorIndex: number): boolean {
|
||||
const isAscii = glyph.char.charCodeAt(0) < 256;
|
||||
const isAscii = glyph.code < 256;
|
||||
// A color is basic if it is one of the standard normal or bold weight
|
||||
// colors of the characters held in the char atlas. Note that this excludes
|
||||
// the normal weight _light_ color characters.
|
||||
@@ -86,7 +86,7 @@ export default class StaticCharAtlas extends BaseCharAtlas {
|
||||
|
||||
ctx.drawImage(
|
||||
this._texture,
|
||||
glyph.char.charCodeAt(0) * charAtlasCellWidth,
|
||||
glyph.code * charAtlasCellWidth,
|
||||
colorIndex * charAtlasCellHeight,
|
||||
charAtlasCellWidth,
|
||||
this._config.scaledCharHeight,
|
||||
|
||||
Reference in New Issue
Block a user