fetta 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -171,7 +171,7 @@ function measureKerningCanvas(styleSource, chars, styles) {
|
|
|
171
171
|
const char2 = chars[i + 1];
|
|
172
172
|
const pairWidth = ctx.measureText(char1 + char2).width;
|
|
173
173
|
const kerning = pairWidth - charWidths.get(char1) - charWidths.get(char2);
|
|
174
|
-
if (Math.abs(kerning) >
|
|
174
|
+
if (Math.abs(kerning) > 1e-3) {
|
|
175
175
|
kerningMap.set(i + 1, kerning);
|
|
176
176
|
}
|
|
177
177
|
}
|
|
@@ -208,7 +208,7 @@ function measureKerningDOM(container, styleSource, chars, styles) {
|
|
|
208
208
|
measurer.textContent = char1 + char2;
|
|
209
209
|
const pairWidth = measurer.getBoundingClientRect().width;
|
|
210
210
|
const kerning = pairWidth - charWidths.get(char1) - charWidths.get(char2);
|
|
211
|
-
if (Math.abs(kerning) >
|
|
211
|
+
if (Math.abs(kerning) > 1e-3) {
|
|
212
212
|
kerningMap.set(i + 1, kerning);
|
|
213
213
|
}
|
|
214
214
|
}
|
|
@@ -669,7 +669,7 @@ function performSplit(element, measuredWords, charClass, wordClass, lineClass, s
|
|
|
669
669
|
let totalKerning = 0;
|
|
670
670
|
if (kerningMap.has(1)) totalKerning += kerningMap.get(1);
|
|
671
671
|
if (kerningMap.has(2)) totalKerning += kerningMap.get(2);
|
|
672
|
-
if (Math.abs(totalKerning) >
|
|
672
|
+
if (Math.abs(totalKerning) > 1e-3 && Math.abs(totalKerning) < 20) {
|
|
673
673
|
const targetElement = (options == null ? void 0 : options.mask) === "chars" && firstCharSpan.parentElement ? firstCharSpan.parentElement : firstCharSpan;
|
|
674
674
|
targetElement.style.marginLeft = `${totalKerning}px`;
|
|
675
675
|
}
|
|
@@ -690,7 +690,7 @@ function performSplit(element, measuredWords, charClass, wordClass, lineClass, s
|
|
|
690
690
|
let totalKerning = 0;
|
|
691
691
|
if (kerningMap.has(1)) totalKerning += kerningMap.get(1);
|
|
692
692
|
if (kerningMap.has(2)) totalKerning += kerningMap.get(2);
|
|
693
|
-
if (Math.abs(totalKerning) >
|
|
693
|
+
if (Math.abs(totalKerning) > 1e-3 && Math.abs(totalKerning) < 20) {
|
|
694
694
|
const targetElement = (options == null ? void 0 : options.mask) === "words" && currWord.parentElement ? currWord.parentElement : currWord;
|
|
695
695
|
targetElement.style.marginLeft = `${totalKerning}px`;
|
|
696
696
|
}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { splitText } from './chunk-
|
|
1
|
+
export { splitText } from './chunk-IHP6LWYO.js';
|
package/dist/react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { splitText, __spreadProps, __spreadValues, normalizeToPromise } from './chunk-
|
|
1
|
+
import { splitText, __spreadProps, __spreadValues, normalizeToPromise } from './chunk-IHP6LWYO.js';
|
|
2
2
|
import { forwardRef, useRef, useCallback, useState, useLayoutEffect, useEffect, isValidElement, cloneElement } from 'react';
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
|