Factor logic into registry, make matches cell-based and document

This commit is contained in:
Jeff Principe
2018-07-08 11:30:54 -07:00
parent 5e3ebbde5e
commit 63b3a6f323
11 changed files with 647 additions and 295 deletions
+2 -2
View File
@@ -36,7 +36,7 @@ interface IGlyphCacheValue {
function getGlyphCacheKey(glyph: IGlyphIdentifier): string {
const styleFlags = (glyph.bold ? 0 : 4) + (glyph.dim ? 0 : 2) + (glyph.italic ? 0 : 1);
return `${glyph.bg}_${glyph.fg}_${styleFlags}${glyph.char}`;
return `${glyph.bg}_${glyph.fg}_${styleFlags}${glyph.chars}`;
}
export default class DynamicCharAtlas extends BaseCharAtlas {
@@ -216,7 +216,7 @@ export default class DynamicCharAtlas extends BaseCharAtlas {
this._tmpCtx.globalAlpha = DIM_OPACITY;
}
// Draw the character
this._tmpCtx.fillText(glyph.char, 0, 0);
this._tmpCtx.fillText(glyph.chars, 0, 0);
this._tmpCtx.restore();
// clear the background from the character to avoid issues with drawing over the previous
+1 -1
View File
@@ -7,7 +7,7 @@ export const INVERTED_DEFAULT_COLOR = -1;
export const DIM_OPACITY = 0.5;
export interface IGlyphIdentifier {
char: string;
chars: string;
code: number;
bg: number;
fg: number;