@lvce-editor/renderer-process 30.76.1 → 30.77.0
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.
- package/dist/rendererProcessMain.js +37 -0
- package/package.json +1 -1
|
@@ -2012,6 +2012,41 @@ const initialize = () => {
|
|
|
2012
2012
|
}
|
|
2013
2013
|
};
|
|
2014
2014
|
|
|
2015
|
+
// Measuring a prefix in isolation changes Arabic joining and ligatures. Use a
|
|
2016
|
+
// native Range within the full directional run to retain the shaping context.
|
|
2017
|
+
const measurePrefix = (text, offset, fontWeight, fontSize, fontFamily, letterSpacing, direction) => {
|
|
2018
|
+
string(text);
|
|
2019
|
+
number(offset);
|
|
2020
|
+
number(fontWeight);
|
|
2021
|
+
number(fontSize);
|
|
2022
|
+
string(fontFamily);
|
|
2023
|
+
number(letterSpacing);
|
|
2024
|
+
const element = document.createElement('span');
|
|
2025
|
+
element.style.position = 'fixed';
|
|
2026
|
+
element.style.visibility = 'hidden';
|
|
2027
|
+
element.style.whiteSpace = 'pre';
|
|
2028
|
+
element.style.fontWeight = String(fontWeight);
|
|
2029
|
+
element.style.fontSize = `${fontSize}px`;
|
|
2030
|
+
element.style.fontFamily = fontFamily;
|
|
2031
|
+
element.style.letterSpacing = `${letterSpacing}px`;
|
|
2032
|
+
element.style.direction = direction;
|
|
2033
|
+
element.style.unicodeBidi = 'bidi-override';
|
|
2034
|
+
element.textContent = text;
|
|
2035
|
+
document.body.append(element);
|
|
2036
|
+
try {
|
|
2037
|
+
if (!element.firstChild) {
|
|
2038
|
+
return 0;
|
|
2039
|
+
}
|
|
2040
|
+
const range = document.createRange();
|
|
2041
|
+
range.setStart(element.firstChild, 0);
|
|
2042
|
+
const end = Math.max(0, Math.min(text.length, Math.trunc(offset)));
|
|
2043
|
+
range.setEnd(element.firstChild, end);
|
|
2044
|
+
return range.getBoundingClientRect().width;
|
|
2045
|
+
} finally {
|
|
2046
|
+
element.remove();
|
|
2047
|
+
}
|
|
2048
|
+
};
|
|
2049
|
+
|
|
2015
2050
|
const pendingInputs = new Set();
|
|
2016
2051
|
const state$k = {
|
|
2017
2052
|
shortcut: undefined
|
|
@@ -12339,6 +12374,7 @@ const forwardRendererWorkerCommand = (method, ...params) => {
|
|
|
12339
12374
|
const handleMessagePort = async (port, rpcId) => {
|
|
12340
12375
|
const rpc = await create$A({
|
|
12341
12376
|
commandMap: {
|
|
12377
|
+
'MeasureBidi.measurePrefix': measurePrefix,
|
|
12342
12378
|
'Viewlet.forwardRendererWorkerCommand': forwardRendererWorkerCommand,
|
|
12343
12379
|
'Viewlet.queueCommands': queueCommands
|
|
12344
12380
|
},
|
|
@@ -12716,6 +12752,7 @@ const commandMap = {
|
|
|
12716
12752
|
'Location.setPathName': setPathName,
|
|
12717
12753
|
'Location.setWorkspaceUri': setWorkspaceUri,
|
|
12718
12754
|
'Main.openUri': openUri,
|
|
12755
|
+
'MeasureBidi.measurePrefix': measurePrefix,
|
|
12719
12756
|
'MeasureTextBlockHeight.measureTextBlockHeight': measureTextBlockHeight,
|
|
12720
12757
|
'MeasureTextHeight.measureTextHeight': measureTextHeight,
|
|
12721
12758
|
'Menu.focusIndex': focusIndex,
|