mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Merge pull request #5007 from Tyriar/5005
Don't rescale unless it exceeds 25% of following cell
This commit is contained in:
@@ -8,7 +8,7 @@ import { CellColorResolver } from 'browser/renderer/shared/CellColorResolver';
|
||||
import { acquireTextureAtlas } from 'browser/renderer/shared/CharAtlasCache';
|
||||
import { TEXT_BASELINE } from 'browser/renderer/shared/Constants';
|
||||
import { tryDrawCustomChar } from 'browser/renderer/shared/CustomGlyphs';
|
||||
import { isEmoji, throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
|
||||
import { allowRescaling, throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
|
||||
import { createSelectionRenderModel } from 'browser/renderer/shared/SelectionRenderModel';
|
||||
import { IRasterizedGlyph, IRenderDimensions, ISelectionRenderModel, ITextureAtlas } from 'browser/renderer/shared/Types';
|
||||
import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
|
||||
@@ -407,14 +407,7 @@ export abstract class BaseRenderLayer extends Disposable implements IRenderLayer
|
||||
// following cell (ie. the width is not 2).
|
||||
let renderWidth = glyph.size.x;
|
||||
if (this._optionsService.rawOptions.rescaleOverlappingGlyphs) {
|
||||
if (
|
||||
// Is single cell width
|
||||
width === 1 &&
|
||||
// Glyph exceeds cell bounds, + 1 to avoid hurting readability
|
||||
glyph.size.x > this._deviceCellWidth + 1 &&
|
||||
// Never rescale emoji
|
||||
code && !isEmoji(code)
|
||||
) {
|
||||
if (allowRescaling(code, width, glyph.size.x, this._deviceCellWidth)) {
|
||||
renderWidth = this._deviceCellWidth - 1; // - 1 to improve readability
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { isEmoji, throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
|
||||
import { allowRescaling, throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
|
||||
import { TextureAtlas } from 'browser/renderer/shared/TextureAtlas';
|
||||
import { IRasterizedGlyph, IRenderDimensions, ITextureAtlas } from 'browser/renderer/shared/Types';
|
||||
import { NULL_CELL_CODE } from 'common/buffer/Constants';
|
||||
@@ -281,14 +281,7 @@ export class GlyphRenderer extends Disposable {
|
||||
// Reduce scale horizontally for wide glyphs printed in cells that would overlap with the
|
||||
// following cell (ie. the width is not 2).
|
||||
if (this._optionsService.rawOptions.rescaleOverlappingGlyphs) {
|
||||
if (
|
||||
// Is single cell width
|
||||
width === 1 &&
|
||||
// Glyph exceeds cell bounds, + 1 to avoid hurting readability
|
||||
$glyph.size.x > this._dimensions.device.cell.width + 1 &&
|
||||
// Never rescale emoji
|
||||
code && !isEmoji(code)
|
||||
) {
|
||||
if (allowRescaling(code, width, $glyph.size.x, this._dimensions.device.cell.width)) {
|
||||
array[$i + 2] = (this._dimensions.device.cell.width - 1) / this._dimensions.device.canvas.width; // - 1 to improve readability
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,8 +48,9 @@ export function allowRescaling(codepoint: number | undefined, width: number, gly
|
||||
return (
|
||||
// Is single cell width
|
||||
width === 1 &&
|
||||
// Glyph exceeds cell bounds, + 1 to avoid hurting readability
|
||||
glyphSizeX > deviceCellWidth + 1 &&
|
||||
// Glyph exceeds cell bounds, add 25% to avoid hurting readability by rescaling glyphs that
|
||||
// barely overlap
|
||||
glyphSizeX > deviceCellWidth * 1.25 &&
|
||||
// Never rescale emoji
|
||||
codepoint !== undefined && !isEmoji(codepoint) &&
|
||||
// Never rescale powerline or nerd fonts
|
||||
|
||||
Reference in New Issue
Block a user