xterm-addon-webgl
Advanced tools
Comparing version 0.12.0-beta.2 to 0.12.0-beta.3
@@ -252,2 +252,4 @@ "use strict"; | ||
var italic = !!this._workAttributeData.isItalic(); | ||
var underline = !!this._workAttributeData.isUnderline(); | ||
var strikethrough = !!this._workAttributeData.isStrikethrough(); | ||
var fgColor = this._workAttributeData.getFgColor(); | ||
@@ -288,2 +290,19 @@ var fgColorMode = this._workAttributeData.getFgColorMode(); | ||
this._tmpCtx.fillText(chars, padding, padding + this._config.scaledCharHeight); | ||
if (underline || strikethrough) { | ||
var lineWidth = Math.max(1, Math.floor(this._config.fontSize / 10)); | ||
var yOffset = this._tmpCtx.lineWidth % 2 === 1 ? 0.5 : 0; | ||
this._tmpCtx.lineWidth = lineWidth; | ||
this._tmpCtx.strokeStyle = this._tmpCtx.fillStyle; | ||
this._tmpCtx.beginPath(); | ||
if (underline) { | ||
this._tmpCtx.moveTo(padding, padding + this._config.scaledCharHeight - yOffset); | ||
this._tmpCtx.lineTo(padding + this._config.scaledCharWidth, padding + this._config.scaledCharHeight - yOffset); | ||
} | ||
if (strikethrough) { | ||
this._tmpCtx.moveTo(padding, padding + Math.floor(this._config.scaledCharHeight / 2) - yOffset); | ||
this._tmpCtx.lineTo(padding + this._config.scaledCharWidth, padding + Math.floor(this._config.scaledCharHeight / 2) - yOffset); | ||
} | ||
this._tmpCtx.stroke(); | ||
this._tmpCtx.closePath(); | ||
} | ||
this._tmpCtx.restore(); | ||
@@ -290,0 +309,0 @@ var imageData = this._tmpCtx.getImageData(0, 0, this._tmpCanvas.width, this._tmpCanvas.height); |
{ | ||
"name": "xterm-addon-webgl", | ||
"version": "0.12.0-beta.2", | ||
"version": "0.12.0-beta.3", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "The xterm.js authors", |
@@ -341,2 +341,4 @@ /** | ||
const italic = !!this._workAttributeData.isItalic(); | ||
const underline = !!this._workAttributeData.isUnderline(); | ||
const strikethrough = !!this._workAttributeData.isStrikethrough(); | ||
let fgColor = this._workAttributeData.getFgColor(); | ||
@@ -394,2 +396,22 @@ let fgColorMode = this._workAttributeData.getFgColorMode(); | ||
this._tmpCtx.fillText(chars, padding, padding + this._config.scaledCharHeight); | ||
// Draw underline and strikethrough | ||
if (underline || strikethrough) { | ||
const lineWidth = Math.max(1, Math.floor(this._config.fontSize / 10)); | ||
const yOffset = this._tmpCtx.lineWidth % 2 === 1 ? 0.5 : 0; // When the width is odd, draw at 0.5 position | ||
this._tmpCtx.lineWidth = lineWidth; | ||
this._tmpCtx.strokeStyle = this._tmpCtx.fillStyle; | ||
this._tmpCtx.beginPath(); | ||
if (underline) { | ||
this._tmpCtx.moveTo(padding, padding + this._config.scaledCharHeight - yOffset); | ||
this._tmpCtx.lineTo(padding + this._config.scaledCharWidth, padding + this._config.scaledCharHeight - yOffset); | ||
} | ||
if (strikethrough) { | ||
this._tmpCtx.moveTo(padding, padding + Math.floor(this._config.scaledCharHeight / 2) - yOffset); | ||
this._tmpCtx.lineTo(padding + this._config.scaledCharWidth, padding + Math.floor(this._config.scaledCharHeight / 2) - yOffset); | ||
} | ||
this._tmpCtx.stroke(); | ||
this._tmpCtx.closePath(); | ||
} | ||
this._tmpCtx.restore(); | ||
@@ -396,0 +418,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
610809
5304