Required options

This commit is contained in:
Simon Lamon
2022-08-05 16:16:12 +00:00
parent c021571194
commit a1385f589b
17 changed files with 84 additions and 82 deletions
@@ -552,18 +552,18 @@ export class WebglRenderer extends Disposable implements IRenderer {
// Calculate the scaled cell height, if lineHeight is _not_ 1, the resulting value will be
// floored since lineHeight can never be lower then 1, this guarentees the scaled cell height
// will always be larger than scaled char height.
this.dimensions.scaledCellHeight = Math.floor(this.dimensions.scaledCharHeight * this._terminal.options.lineHeight!);
this.dimensions.scaledCellHeight = Math.floor(this.dimensions.scaledCharHeight * this._terminal.options.lineHeight);
// Calculate the y offset within a cell that glyph should draw at in order for it to be centered
// correctly within the cell.
this.dimensions.scaledCharTop = this._terminal.options.lineHeight === 1 ? 0 : Math.round((this.dimensions.scaledCellHeight - this.dimensions.scaledCharHeight) / 2);
// Calculate the scaled cell width, taking the letterSpacing into account.
this.dimensions.scaledCellWidth = this.dimensions.scaledCharWidth + Math.round(this._terminal.options.letterSpacing!);
this.dimensions.scaledCellWidth = this.dimensions.scaledCharWidth + Math.round(this._terminal.options.letterSpacing);
// Calculate the x offset with a cell that text should draw from in order for it to be centered
// correctly within the cell.
this.dimensions.scaledCharLeft = Math.floor(this._terminal.options.letterSpacing! / 2);
this.dimensions.scaledCharLeft = Math.floor(this._terminal.options.letterSpacing / 2);
// Recalculate the canvas dimensions, the scaled dimensions define the actual number of pixel in
// the canvas
@@ -32,21 +32,21 @@ export function generateConfig(scaledCellWidth: number, scaledCellHeight: number
contrastCache: colors.contrastCache
};
return {
customGlyphs: terminal.options.customGlyphs!,
customGlyphs: terminal.options.customGlyphs,
devicePixelRatio: window.devicePixelRatio,
letterSpacing: terminal.options.letterSpacing!,
lineHeight: terminal.options.lineHeight!,
letterSpacing: terminal.options.letterSpacing,
lineHeight: terminal.options.lineHeight,
scaledCellWidth,
scaledCellHeight,
scaledCharWidth,
scaledCharHeight,
fontFamily: terminal.options.fontFamily!,
fontSize: terminal.options.fontSize!,
fontWeight: terminal.options.fontWeight as FontWeight,
fontWeightBold: terminal.options.fontWeightBold as FontWeight,
allowTransparency: terminal.options.allowTransparency!,
drawBoldTextInBrightColors: terminal.options.drawBoldTextInBrightColors!,
minimumContrastRatio: terminal.options.minimumContrastRatio!,
fontFamily: terminal.options.fontFamily,
fontSize: terminal.options.fontSize,
fontWeight: terminal.options.fontWeight,
fontWeightBold: terminal.options.fontWeightBold,
allowTransparency: terminal.options.allowTransparency,
drawBoldTextInBrightColors: terminal.options.drawBoldTextInBrightColors,
minimumContrastRatio: terminal.options.minimumContrastRatio,
colors: clonedColors
};
}
@@ -213,7 +213,7 @@ export class CursorRenderLayer extends BaseRenderLayer {
private _renderBarCursor(terminal: Terminal, x: number, y: number, cell: ICellData): void {
this._ctx.save();
this._ctx.fillStyle = this._colors.cursor.css;
this._fillLeftLineAtCell(x, y, terminal.options.cursorWidth!);
this._fillLeftLineAtCell(x, y, terminal.options.cursorWidth);
this._ctx.restore();
}