@visactor/vutils
Advanced tools
Comparing version 0.19.0 to 0.19.1
@@ -6,2 +6,4 @@ import type { IBounds } from '../../../data-structure'; | ||
height: number; | ||
fontBoundingBoxAscent?: number; | ||
fontBoundingBoxDescent?: number; | ||
} | ||
@@ -8,0 +10,0 @@ export interface ITextFontParams { |
@@ -105,3 +105,5 @@ "use strict"; | ||
width: metrics.width, | ||
height: null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize | ||
height: null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize, | ||
fontBoundingBoxAscent: metrics.fontBoundingBoxAscent, | ||
fontBoundingBoxDescent: metrics.fontBoundingBoxDescent | ||
}; | ||
@@ -123,3 +125,4 @@ } | ||
(0, common_1.isNil)(size) && (size = this._measureLetterChar()), totalSize.width += size.width, | ||
totalSize.height = Math.max(totalSize.height, size.height); | ||
totalSize.height = Math.max(totalSize.height, size.height), !(0, common_1.isNil)(size.fontBoundingBoxAscent) && (totalSize.fontBoundingBoxAscent = size.fontBoundingBoxAscent), | ||
!(0, common_1.isNil)(size.fontBoundingBoxDescent) && (totalSize.fontBoundingBoxDescent = size.fontBoundingBoxDescent); | ||
} | ||
@@ -165,3 +168,5 @@ return totalSize; | ||
width: numberBounds.width / TextMeasure.NUMBERS_CHAR_SET.length, | ||
height: numberBounds.height | ||
height: numberBounds.height, | ||
fontBoundingBoxAscent: numberBounds.fontBoundingBoxAscent, | ||
fontBoundingBoxDescent: numberBounds.fontBoundingBoxDescent | ||
}; | ||
@@ -180,3 +185,5 @@ } | ||
width: alphabetBounds.width / TextMeasure.ALPHABET_CHAR_SET.length, | ||
height: alphabetBounds.height | ||
height: alphabetBounds.height, | ||
fontBoundingBoxAscent: alphabetBounds.fontBoundingBoxAscent, | ||
fontBoundingBoxDescent: alphabetBounds.fontBoundingBoxDescent | ||
}; | ||
@@ -183,0 +190,0 @@ } |
@@ -6,2 +6,4 @@ import type { IBounds } from '../../../data-structure'; | ||
height: number; | ||
fontBoundingBoxAscent?: number; | ||
fontBoundingBoxDescent?: number; | ||
} | ||
@@ -8,0 +10,0 @@ export interface ITextFontParams { |
@@ -102,3 +102,5 @@ import { isArray, isNil, isString, isValid } from "../../../common"; | ||
width: metrics.width, | ||
height: null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize | ||
height: null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize, | ||
fontBoundingBoxAscent: metrics.fontBoundingBoxAscent, | ||
fontBoundingBoxDescent: metrics.fontBoundingBoxDescent | ||
}; | ||
@@ -120,3 +122,4 @@ } | ||
isNil(size) && (size = this._measureLetterChar()), totalSize.width += size.width, | ||
totalSize.height = Math.max(totalSize.height, size.height); | ||
totalSize.height = Math.max(totalSize.height, size.height), !isNil(size.fontBoundingBoxAscent) && (totalSize.fontBoundingBoxAscent = size.fontBoundingBoxAscent), | ||
!isNil(size.fontBoundingBoxDescent) && (totalSize.fontBoundingBoxDescent = size.fontBoundingBoxDescent); | ||
} | ||
@@ -162,3 +165,5 @@ return totalSize; | ||
width: numberBounds.width / TextMeasure.NUMBERS_CHAR_SET.length, | ||
height: numberBounds.height | ||
height: numberBounds.height, | ||
fontBoundingBoxAscent: numberBounds.fontBoundingBoxAscent, | ||
fontBoundingBoxDescent: numberBounds.fontBoundingBoxDescent | ||
}; | ||
@@ -177,3 +182,5 @@ } | ||
width: alphabetBounds.width / TextMeasure.ALPHABET_CHAR_SET.length, | ||
height: alphabetBounds.height | ||
height: alphabetBounds.height, | ||
fontBoundingBoxAscent: alphabetBounds.fontBoundingBoxAscent, | ||
fontBoundingBoxDescent: alphabetBounds.fontBoundingBoxDescent | ||
}; | ||
@@ -180,0 +187,0 @@ } |
{ | ||
"name": "@visactor/vutils", | ||
"version": "0.19.0", | ||
"version": "0.19.1", | ||
"main": "cjs/index.js", | ||
@@ -30,6 +30,6 @@ "module": "es/index.js", | ||
"@types/node": "*", | ||
"@internal/eslint-config": "0.0.1", | ||
"@internal/jest-config": "0.0.1", | ||
"@internal/ts-config": "0.0.1", | ||
"@internal/bundler": "0.0.1", | ||
"@internal/jest-config": "0.0.1", | ||
"@internal/eslint-config": "0.0.1" | ||
"@internal/bundler": "0.0.1" | ||
}, | ||
@@ -36,0 +36,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
1852277
17940