mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Prototype of adding a large atlas page for overflow glyphs
Part of #5246
This commit is contained in:
@@ -75,6 +75,8 @@ export class TextureAtlas implements ITextureAtlas {
|
||||
private _workAttributeData: AttributeData = new AttributeData();
|
||||
|
||||
private _textureSize: number = 512;
|
||||
// TODO: Use actual value
|
||||
private _deviceMaxTextureSize: number = 2048;
|
||||
|
||||
public static maxAtlasPages: number | undefined;
|
||||
public static maxTextureSize: number | undefined;
|
||||
@@ -431,7 +433,7 @@ export class TextureAtlas implements ITextureAtlas {
|
||||
// Allow 1 cell width per character, with a minimum of 2 (CJK), plus some padding. This is used
|
||||
// to draw the glyph to the canvas as well as to restrict the bounding box search to ensure
|
||||
// giant ligatures (eg. =====>) don't impact overall performance.
|
||||
const allowedWidth = Math.min(this._config.deviceCellWidth * Math.max(chars.length, 2) + TMP_CANVAS_GLYPH_PADDING * 2, this._textureSize);
|
||||
const allowedWidth = Math.min(this._config.deviceCellWidth * Math.max(chars.length, 2) + TMP_CANVAS_GLYPH_PADDING * 2, this._deviceMaxTextureSize);
|
||||
if (this._tmpCanvas.width < allowedWidth) {
|
||||
this._tmpCanvas.width = allowedWidth;
|
||||
}
|
||||
@@ -772,6 +774,21 @@ export class TextureAtlas implements ITextureAtlas {
|
||||
}
|
||||
}
|
||||
|
||||
// Create a new page for oversized glyphs as they come up
|
||||
if (rasterizedGlyph.size.x > this._textureSize) {
|
||||
// TODO: Move below after page merging to ensure page limit isn't hit
|
||||
const newPage = new AtlasPage(this._document, this._deviceMaxTextureSize);
|
||||
this.pages.push(newPage);
|
||||
|
||||
// Request the model to be cleared to refresh all texture pages.
|
||||
this._requestClearModel = true;
|
||||
this._onAddTextureAtlasCanvas.fire(newPage.canvas);
|
||||
|
||||
newPage.addGlyph(rasterizedGlyph);
|
||||
activePage.fixedRows.push(newPage.currentRow);
|
||||
break;
|
||||
}
|
||||
|
||||
// Create a new page if too much vertical space would be wasted or there is not enough room
|
||||
// left in the page. The previous active row will become fixed in the process as it now has a
|
||||
// fixed height
|
||||
|
||||
Reference in New Issue
Block a user