Add fontSize and fontFamily options

This commit is contained in:
Daniel Imms
2017-08-31 22:42:39 -07:00
parent c88824155f
commit 15c73ef94f
14 changed files with 107 additions and 114 deletions
+6 -5
View File
@@ -20,6 +20,11 @@ export class ForegroundRenderLayer extends BaseRenderLayer implements IDataRende
this._state.resize(terminal.cols, terminal.rows);
}
public clear(terminal: ITerminal): void {
this._state.clear();
this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);
}
public render(terminal: ITerminal, startRow: number, endRow: number): void {
const scaledCharWidth = Math.ceil(terminal.charMeasure.width) * window.devicePixelRatio;
const scaledCharHeight = Math.ceil(terminal.charMeasure.height) * window.devicePixelRatio;
@@ -31,10 +36,6 @@ export class ForegroundRenderLayer extends BaseRenderLayer implements IDataRende
return;
}
this._ctx.fillStyle = '#ffffff';
this._ctx.textBaseline = 'top';
this._ctx.font = `${16 * window.devicePixelRatio}px courier`;
for (let y = startRow; y <= endRow; y++) {
const row = y + terminal.buffer.ydisp;
const line = terminal.buffer.lines.get(row);
@@ -82,7 +83,7 @@ export class ForegroundRenderLayer extends BaseRenderLayer implements IDataRende
}
}
this.drawChar(char, code, fg, x, y, scaledCharWidth, scaledCharHeight);
this.drawChar(terminal, char, code, fg, x, y, scaledCharWidth, scaledCharHeight);
}
}
}