@superdoc-dev/mcp 0.11.0-next.3 → 0.11.0-next.4
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/index.js +919 -659
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -219498,7 +219498,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
219498
219498
|
init_remark_gfm_BhnWr3yf_es();
|
|
219499
219499
|
});
|
|
219500
219500
|
|
|
219501
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
219501
|
+
// ../../packages/superdoc/dist/chunks/src-B1aSE-tB.es.js
|
|
219502
219502
|
function deleteProps(obj, propOrProps) {
|
|
219503
219503
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
219504
219504
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -259643,6 +259643,187 @@ function computeTabWidth(currentPos, justification, tabs, hangingIndent, firstLi
|
|
|
259643
259643
|
tabWidth = nextDefaultTabStop - currentPos;
|
|
259644
259644
|
return tabWidth;
|
|
259645
259645
|
}
|
|
259646
|
+
function isSettled(status) {
|
|
259647
|
+
return SETTLED_STATUSES.includes(status);
|
|
259648
|
+
}
|
|
259649
|
+
function normalizeFamilyKey$2(family$1) {
|
|
259650
|
+
return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
259651
|
+
}
|
|
259652
|
+
function splitStack(cssFontFamily) {
|
|
259653
|
+
return cssFontFamily.split(",").map((part) => part.trim()).filter(Boolean);
|
|
259654
|
+
}
|
|
259655
|
+
function createFontResolver() {
|
|
259656
|
+
return new FontResolver;
|
|
259657
|
+
}
|
|
259658
|
+
function resolveFontFamily2(logicalFamily) {
|
|
259659
|
+
return defaultResolver.resolveFontFamily(logicalFamily);
|
|
259660
|
+
}
|
|
259661
|
+
function resolvePhysicalFamily(cssFontFamily) {
|
|
259662
|
+
return defaultResolver.resolvePhysicalFamily(cssFontFamily);
|
|
259663
|
+
}
|
|
259664
|
+
function resolvePrimaryPhysicalFamily(family$1) {
|
|
259665
|
+
return defaultResolver.resolvePrimaryPhysicalFamily(family$1);
|
|
259666
|
+
}
|
|
259667
|
+
function getFontConfigVersion() {
|
|
259668
|
+
return fontConfigVersion;
|
|
259669
|
+
}
|
|
259670
|
+
function bumpFontConfigVersion() {
|
|
259671
|
+
return fontConfigVersion += 1;
|
|
259672
|
+
}
|
|
259673
|
+
function fourFaces(filePrefix) {
|
|
259674
|
+
return [
|
|
259675
|
+
{
|
|
259676
|
+
weight: "normal",
|
|
259677
|
+
style: "normal",
|
|
259678
|
+
file: `${filePrefix}-Regular.woff2`
|
|
259679
|
+
},
|
|
259680
|
+
{
|
|
259681
|
+
weight: "bold",
|
|
259682
|
+
style: "normal",
|
|
259683
|
+
file: `${filePrefix}-Bold.woff2`
|
|
259684
|
+
},
|
|
259685
|
+
{
|
|
259686
|
+
weight: "normal",
|
|
259687
|
+
style: "italic",
|
|
259688
|
+
file: `${filePrefix}-Italic.woff2`
|
|
259689
|
+
},
|
|
259690
|
+
{
|
|
259691
|
+
weight: "bold",
|
|
259692
|
+
style: "italic",
|
|
259693
|
+
file: `${filePrefix}-BoldItalic.woff2`
|
|
259694
|
+
}
|
|
259695
|
+
];
|
|
259696
|
+
}
|
|
259697
|
+
function family(name, filePrefix, license) {
|
|
259698
|
+
return {
|
|
259699
|
+
family: name,
|
|
259700
|
+
license,
|
|
259701
|
+
faces: fourFaces(filePrefix)
|
|
259702
|
+
};
|
|
259703
|
+
}
|
|
259704
|
+
function withTrailingSlash(base4) {
|
|
259705
|
+
return base4.endsWith("/") ? base4 : `${base4}/`;
|
|
259706
|
+
}
|
|
259707
|
+
function joinUrl(base4, file2) {
|
|
259708
|
+
return `${withTrailingSlash(base4)}${file2}`;
|
|
259709
|
+
}
|
|
259710
|
+
function weightToken(weight) {
|
|
259711
|
+
return weight === "bold" ? "700" : "400";
|
|
259712
|
+
}
|
|
259713
|
+
function bundledAssetSignature(resolve2) {
|
|
259714
|
+
const family$1 = BUNDLED_MANIFEST[0];
|
|
259715
|
+
const face = family$1?.faces[0];
|
|
259716
|
+
if (!family$1 || !face)
|
|
259717
|
+
return "";
|
|
259718
|
+
return resolve2({
|
|
259719
|
+
file: face.file,
|
|
259720
|
+
family: family$1.family,
|
|
259721
|
+
weight: weightToken(face.weight),
|
|
259722
|
+
style: face.style,
|
|
259723
|
+
source: "bundled-substitute"
|
|
259724
|
+
});
|
|
259725
|
+
}
|
|
259726
|
+
function installBundledSubstitutes(registry3, options = {}) {
|
|
259727
|
+
const resolve2 = options.resolveAssetUrl ?? ((context) => joinUrl(options.assetBaseUrl ?? defaultAssetBase, context.file));
|
|
259728
|
+
const signature = bundledAssetSignature(resolve2);
|
|
259729
|
+
const installed = installedRegistries.get(registry3);
|
|
259730
|
+
if (installed !== undefined) {
|
|
259731
|
+
if (installed !== signature)
|
|
259732
|
+
console.warn(`[superdoc] bundled fonts are already registered for this document from "${installed}"; a later fonts config resolving to "${signature}" is ignored. Use one fonts.assetBaseUrl / fonts.resolveAssetUrl per document.`);
|
|
259733
|
+
return;
|
|
259734
|
+
}
|
|
259735
|
+
installedRegistries.set(registry3, signature);
|
|
259736
|
+
for (const family$1 of BUNDLED_MANIFEST)
|
|
259737
|
+
for (const face of family$1.faces) {
|
|
259738
|
+
const context = {
|
|
259739
|
+
file: face.file,
|
|
259740
|
+
family: family$1.family,
|
|
259741
|
+
weight: weightToken(face.weight),
|
|
259742
|
+
style: face.style,
|
|
259743
|
+
source: "bundled-substitute"
|
|
259744
|
+
};
|
|
259745
|
+
registry3.register({
|
|
259746
|
+
family: family$1.family,
|
|
259747
|
+
source: `url(${resolve2(context)})`,
|
|
259748
|
+
descriptors: {
|
|
259749
|
+
weight: face.weight,
|
|
259750
|
+
style: face.style
|
|
259751
|
+
}
|
|
259752
|
+
});
|
|
259753
|
+
}
|
|
259754
|
+
}
|
|
259755
|
+
function buildFontReport(logicalFamilies, registry3, resolver2) {
|
|
259756
|
+
const seen = /* @__PURE__ */ new Set;
|
|
259757
|
+
const report = [];
|
|
259758
|
+
for (const logical of logicalFamilies) {
|
|
259759
|
+
if (!logical || seen.has(logical))
|
|
259760
|
+
continue;
|
|
259761
|
+
seen.add(logical);
|
|
259762
|
+
const { physicalFamily, reason } = resolver2 ? resolver2.resolveFontFamily(logical) : resolveFontFamily2(logical);
|
|
259763
|
+
const loadStatus = registry3.getStatus(physicalFamily);
|
|
259764
|
+
report.push({
|
|
259765
|
+
logicalFamily: logical,
|
|
259766
|
+
physicalFamily,
|
|
259767
|
+
reason,
|
|
259768
|
+
loadStatus,
|
|
259769
|
+
exportFamily: logical,
|
|
259770
|
+
missing: isSettled(loadStatus) && loadStatus !== "loaded"
|
|
259771
|
+
});
|
|
259772
|
+
}
|
|
259773
|
+
return report;
|
|
259774
|
+
}
|
|
259775
|
+
function quoteFamily(family$1) {
|
|
259776
|
+
return `"${family$1.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
259777
|
+
}
|
|
259778
|
+
function canonicalizeFontSource(source) {
|
|
259779
|
+
const match$1 = /^\s*url\(\s*([\s\S]*?)\s*\)\s*$/i.exec(source);
|
|
259780
|
+
if (!match$1)
|
|
259781
|
+
return source;
|
|
259782
|
+
let inner = match$1[1].trim();
|
|
259783
|
+
if (inner.startsWith('"') && inner.endsWith('"') || inner.startsWith("'") && inner.endsWith("'"))
|
|
259784
|
+
inner = inner.slice(1, -1);
|
|
259785
|
+
return `url(${JSON.stringify(inner)})`;
|
|
259786
|
+
}
|
|
259787
|
+
function normalizeFamilyKey$1(family$1) {
|
|
259788
|
+
return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
259789
|
+
}
|
|
259790
|
+
function normalizeWeight(weight) {
|
|
259791
|
+
if (weight === undefined)
|
|
259792
|
+
return "400";
|
|
259793
|
+
const w = String(weight).trim().toLowerCase();
|
|
259794
|
+
if (w === "bold" || w === "bolder")
|
|
259795
|
+
return "700";
|
|
259796
|
+
const n = Number(w);
|
|
259797
|
+
return Number.isFinite(n) && n >= 600 ? "700" : "400";
|
|
259798
|
+
}
|
|
259799
|
+
function normalizeStyle$1(style2) {
|
|
259800
|
+
if (!style2)
|
|
259801
|
+
return "normal";
|
|
259802
|
+
const s2 = style2.trim().toLowerCase();
|
|
259803
|
+
return s2.startsWith("italic") || s2.startsWith("oblique") ? "italic" : "normal";
|
|
259804
|
+
}
|
|
259805
|
+
function faceKeyOf$1(family$1, weight, style2) {
|
|
259806
|
+
return `${normalizeFamilyKey$1(family$1)}|${weight}|${style2}`;
|
|
259807
|
+
}
|
|
259808
|
+
function faceProbe(family$1, weight, style2, size$1) {
|
|
259809
|
+
return `${style2 === "italic" ? "italic " : ""}${weight} ${size$1} ${quoteFamily(family$1)}`;
|
|
259810
|
+
}
|
|
259811
|
+
function getFontRegistryFor(fontSet, FontFaceCtor) {
|
|
259812
|
+
if (!fontSet) {
|
|
259813
|
+
if (!domlessRegistry)
|
|
259814
|
+
domlessRegistry = new FontRegistry({});
|
|
259815
|
+
return domlessRegistry;
|
|
259816
|
+
}
|
|
259817
|
+
let registry3 = registriesByFontSet.get(fontSet);
|
|
259818
|
+
if (!registry3) {
|
|
259819
|
+
registry3 = new FontRegistry({
|
|
259820
|
+
fontSet,
|
|
259821
|
+
FontFaceCtor
|
|
259822
|
+
});
|
|
259823
|
+
registriesByFontSet.set(fontSet, registry3);
|
|
259824
|
+
}
|
|
259825
|
+
return registry3;
|
|
259826
|
+
}
|
|
259646
259827
|
function isResolvedFragmentWithBorders(item) {
|
|
259647
259828
|
return item !== undefined && item.kind === "fragment" && "paragraphBorders" in item && item.paragraphBorders !== undefined;
|
|
259648
259829
|
}
|
|
@@ -259852,178 +260033,6 @@ function renderPartialEmbeddedTable(params$1) {
|
|
|
259852
260033
|
hasSdtContainerChrome: tableResult.hasSdtContainerChrome
|
|
259853
260034
|
};
|
|
259854
260035
|
}
|
|
259855
|
-
function isSettled(status) {
|
|
259856
|
-
return SETTLED_STATUSES.includes(status);
|
|
259857
|
-
}
|
|
259858
|
-
function normalizeFamilyKey$2(family$1) {
|
|
259859
|
-
return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
259860
|
-
}
|
|
259861
|
-
function splitStack(cssFontFamily) {
|
|
259862
|
-
return cssFontFamily.split(",").map((part) => part.trim()).filter(Boolean);
|
|
259863
|
-
}
|
|
259864
|
-
function createFontResolver() {
|
|
259865
|
-
return new FontResolver;
|
|
259866
|
-
}
|
|
259867
|
-
function resolveFontFamily2(logicalFamily) {
|
|
259868
|
-
return defaultResolver.resolveFontFamily(logicalFamily);
|
|
259869
|
-
}
|
|
259870
|
-
function resolvePhysicalFamily(cssFontFamily) {
|
|
259871
|
-
return defaultResolver.resolvePhysicalFamily(cssFontFamily);
|
|
259872
|
-
}
|
|
259873
|
-
function resolvePrimaryPhysicalFamily(family$1) {
|
|
259874
|
-
return defaultResolver.resolvePrimaryPhysicalFamily(family$1);
|
|
259875
|
-
}
|
|
259876
|
-
function getFontConfigVersion() {
|
|
259877
|
-
return fontConfigVersion;
|
|
259878
|
-
}
|
|
259879
|
-
function bumpFontConfigVersion() {
|
|
259880
|
-
return fontConfigVersion += 1;
|
|
259881
|
-
}
|
|
259882
|
-
function fourFaces(filePrefix) {
|
|
259883
|
-
return [
|
|
259884
|
-
{
|
|
259885
|
-
weight: "normal",
|
|
259886
|
-
style: "normal",
|
|
259887
|
-
file: `${filePrefix}-Regular.woff2`
|
|
259888
|
-
},
|
|
259889
|
-
{
|
|
259890
|
-
weight: "bold",
|
|
259891
|
-
style: "normal",
|
|
259892
|
-
file: `${filePrefix}-Bold.woff2`
|
|
259893
|
-
},
|
|
259894
|
-
{
|
|
259895
|
-
weight: "normal",
|
|
259896
|
-
style: "italic",
|
|
259897
|
-
file: `${filePrefix}-Italic.woff2`
|
|
259898
|
-
},
|
|
259899
|
-
{
|
|
259900
|
-
weight: "bold",
|
|
259901
|
-
style: "italic",
|
|
259902
|
-
file: `${filePrefix}-BoldItalic.woff2`
|
|
259903
|
-
}
|
|
259904
|
-
];
|
|
259905
|
-
}
|
|
259906
|
-
function family(name, filePrefix, license) {
|
|
259907
|
-
return {
|
|
259908
|
-
family: name,
|
|
259909
|
-
license,
|
|
259910
|
-
faces: fourFaces(filePrefix)
|
|
259911
|
-
};
|
|
259912
|
-
}
|
|
259913
|
-
function withTrailingSlash(base4) {
|
|
259914
|
-
return base4.endsWith("/") ? base4 : `${base4}/`;
|
|
259915
|
-
}
|
|
259916
|
-
function joinUrl(base4, file2) {
|
|
259917
|
-
return `${withTrailingSlash(base4)}${file2}`;
|
|
259918
|
-
}
|
|
259919
|
-
function weightToken(weight) {
|
|
259920
|
-
return weight === "bold" ? "700" : "400";
|
|
259921
|
-
}
|
|
259922
|
-
function bundledAssetSignature(resolve2) {
|
|
259923
|
-
const family$1 = BUNDLED_MANIFEST[0];
|
|
259924
|
-
const face = family$1?.faces[0];
|
|
259925
|
-
if (!family$1 || !face)
|
|
259926
|
-
return "";
|
|
259927
|
-
return resolve2({
|
|
259928
|
-
file: face.file,
|
|
259929
|
-
family: family$1.family,
|
|
259930
|
-
weight: weightToken(face.weight),
|
|
259931
|
-
style: face.style,
|
|
259932
|
-
source: "bundled-substitute"
|
|
259933
|
-
});
|
|
259934
|
-
}
|
|
259935
|
-
function installBundledSubstitutes(registry3, options = {}) {
|
|
259936
|
-
const resolve2 = options.resolveAssetUrl ?? ((context) => joinUrl(options.assetBaseUrl ?? defaultAssetBase, context.file));
|
|
259937
|
-
const signature = bundledAssetSignature(resolve2);
|
|
259938
|
-
const installed = installedRegistries.get(registry3);
|
|
259939
|
-
if (installed !== undefined) {
|
|
259940
|
-
if (installed !== signature)
|
|
259941
|
-
console.warn(`[superdoc] bundled fonts are already registered for this document from "${installed}"; a later fonts config resolving to "${signature}" is ignored. Use one fonts.assetBaseUrl / fonts.resolveAssetUrl per document.`);
|
|
259942
|
-
return;
|
|
259943
|
-
}
|
|
259944
|
-
installedRegistries.set(registry3, signature);
|
|
259945
|
-
for (const family$1 of BUNDLED_MANIFEST)
|
|
259946
|
-
for (const face of family$1.faces) {
|
|
259947
|
-
const context = {
|
|
259948
|
-
file: face.file,
|
|
259949
|
-
family: family$1.family,
|
|
259950
|
-
weight: weightToken(face.weight),
|
|
259951
|
-
style: face.style,
|
|
259952
|
-
source: "bundled-substitute"
|
|
259953
|
-
};
|
|
259954
|
-
registry3.register({
|
|
259955
|
-
family: family$1.family,
|
|
259956
|
-
source: `url(${resolve2(context)})`,
|
|
259957
|
-
descriptors: {
|
|
259958
|
-
weight: face.weight,
|
|
259959
|
-
style: face.style
|
|
259960
|
-
}
|
|
259961
|
-
});
|
|
259962
|
-
}
|
|
259963
|
-
}
|
|
259964
|
-
function buildFontReport(logicalFamilies, registry3, resolver2) {
|
|
259965
|
-
const seen = /* @__PURE__ */ new Set;
|
|
259966
|
-
const report = [];
|
|
259967
|
-
for (const logical of logicalFamilies) {
|
|
259968
|
-
if (!logical || seen.has(logical))
|
|
259969
|
-
continue;
|
|
259970
|
-
seen.add(logical);
|
|
259971
|
-
const { physicalFamily, reason } = resolver2 ? resolver2.resolveFontFamily(logical) : resolveFontFamily2(logical);
|
|
259972
|
-
const loadStatus = registry3.getStatus(physicalFamily);
|
|
259973
|
-
report.push({
|
|
259974
|
-
logicalFamily: logical,
|
|
259975
|
-
physicalFamily,
|
|
259976
|
-
reason,
|
|
259977
|
-
loadStatus,
|
|
259978
|
-
exportFamily: logical,
|
|
259979
|
-
missing: isSettled(loadStatus) && loadStatus !== "loaded"
|
|
259980
|
-
});
|
|
259981
|
-
}
|
|
259982
|
-
return report;
|
|
259983
|
-
}
|
|
259984
|
-
function quoteFamily(family$1) {
|
|
259985
|
-
return `"${family$1.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
259986
|
-
}
|
|
259987
|
-
function normalizeFamilyKey$1(family$1) {
|
|
259988
|
-
return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
259989
|
-
}
|
|
259990
|
-
function normalizeWeight(weight) {
|
|
259991
|
-
if (weight === undefined)
|
|
259992
|
-
return "400";
|
|
259993
|
-
const w = String(weight).trim().toLowerCase();
|
|
259994
|
-
if (w === "bold" || w === "bolder")
|
|
259995
|
-
return "700";
|
|
259996
|
-
const n = Number(w);
|
|
259997
|
-
return Number.isFinite(n) && n >= 600 ? "700" : "400";
|
|
259998
|
-
}
|
|
259999
|
-
function normalizeStyle$1(style2) {
|
|
260000
|
-
if (!style2)
|
|
260001
|
-
return "normal";
|
|
260002
|
-
const s2 = style2.trim().toLowerCase();
|
|
260003
|
-
return s2.startsWith("italic") || s2.startsWith("oblique") ? "italic" : "normal";
|
|
260004
|
-
}
|
|
260005
|
-
function faceKeyOf$1(family$1, weight, style2) {
|
|
260006
|
-
return `${normalizeFamilyKey$1(family$1)}|${weight}|${style2}`;
|
|
260007
|
-
}
|
|
260008
|
-
function faceProbe(family$1, weight, style2, size$1) {
|
|
260009
|
-
return `${style2 === "italic" ? "italic " : ""}${weight} ${size$1} ${quoteFamily(family$1)}`;
|
|
260010
|
-
}
|
|
260011
|
-
function getFontRegistryFor(fontSet, FontFaceCtor) {
|
|
260012
|
-
if (!fontSet) {
|
|
260013
|
-
if (!domlessRegistry)
|
|
260014
|
-
domlessRegistry = new FontRegistry({});
|
|
260015
|
-
return domlessRegistry;
|
|
260016
|
-
}
|
|
260017
|
-
let registry3 = registriesByFontSet.get(fontSet);
|
|
260018
|
-
if (!registry3) {
|
|
260019
|
-
registry3 = new FontRegistry({
|
|
260020
|
-
fontSet,
|
|
260021
|
-
FontFaceCtor
|
|
260022
|
-
});
|
|
260023
|
-
registriesByFontSet.set(fontSet, registry3);
|
|
260024
|
-
}
|
|
260025
|
-
return registry3;
|
|
260026
|
-
}
|
|
260027
260036
|
function isDigit(ch) {
|
|
260028
260037
|
return ch >= "0" && ch <= "9";
|
|
260029
260038
|
}
|
|
@@ -267650,7 +267659,7 @@ function invalidateHeaderFooterCache(cache$2, cacheState, headerBlocks, footerBl
|
|
|
267650
267659
|
}
|
|
267651
267660
|
}
|
|
267652
267661
|
async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, options, measureBlock$1, headerFooter, previousMeasures, fontRuntime) {
|
|
267653
|
-
const fontSignature = fontRuntime?.fontSignature ?? "";
|
|
267662
|
+
const fontSignature = fontRuntime?.fontContext?.fontSignature ?? "";
|
|
267654
267663
|
const previousFontSignature = fontRuntime?.previousFontSignature ?? "";
|
|
267655
267664
|
const isSemanticFlow = options.flowMode === "semantic";
|
|
267656
267665
|
if (isSemanticFlow) {
|
|
@@ -267871,7 +267880,7 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
|
|
|
267871
267880
|
measureCache.invalidate(Array.from(tokenResult.affectedBlockIds));
|
|
267872
267881
|
const remeasureStart = performance.now();
|
|
267873
267882
|
const currentPerSectionConstraints = computePerSectionConstraints(options, currentBlocks);
|
|
267874
|
-
currentMeasures = await remeasureAffectedBlocks(currentBlocks, currentMeasures, tokenResult.affectedBlockIds, currentPerSectionConstraints, measureBlock$1, measureCache);
|
|
267883
|
+
currentMeasures = await remeasureAffectedBlocks(currentBlocks, currentMeasures, tokenResult.affectedBlockIds, currentPerSectionConstraints, measureBlock$1, fontSignature, measureCache);
|
|
267875
267884
|
const remeasureTime = performance.now() - remeasureStart;
|
|
267876
267885
|
totalRemeasureTime += remeasureTime;
|
|
267877
267886
|
perfLog$1(`[Perf] 4.3.${iteration + 1}.1 Re-measure: ${remeasureTime.toFixed(2)}ms`);
|
|
@@ -269189,7 +269198,7 @@ function buildNumberingContext(layout, sections, blockById, chapterContextCache)
|
|
|
269189
269198
|
}))
|
|
269190
269199
|
};
|
|
269191
269200
|
}
|
|
269192
|
-
async function remeasureAffectedBlocks(blocks2, measures, affectedBlockIds, perBlockConstraints, measureBlock$1, measureCache$1) {
|
|
269201
|
+
async function remeasureAffectedBlocks(blocks2, measures, affectedBlockIds, perBlockConstraints, measureBlock$1, fontSignature, measureCache$1) {
|
|
269193
269202
|
const updatedMeasures = [...measures];
|
|
269194
269203
|
for (let i4 = 0;i4 < blocks2.length; i4++) {
|
|
269195
269204
|
const block = blocks2[i4];
|
|
@@ -269199,7 +269208,7 @@ async function remeasureAffectedBlocks(blocks2, measures, affectedBlockIds, perB
|
|
|
269199
269208
|
const newMeasure = await measureBlock$1(block, perBlockConstraints[i4]);
|
|
269200
269209
|
updatedMeasures[i4] = newMeasure;
|
|
269201
269210
|
const blockConstraints = perBlockConstraints[i4];
|
|
269202
|
-
measureCache$1?.set(block, blockConstraints.maxWidth, blockConstraints.maxHeight, newMeasure);
|
|
269211
|
+
measureCache$1?.set(block, blockConstraints.maxWidth, blockConstraints.maxHeight, newMeasure, fontSignature);
|
|
269203
269212
|
} catch (error48) {
|
|
269204
269213
|
console.warn(`[incrementalLayout] Failed to re-measure block ${block.id} after token resolution:`, error48);
|
|
269205
269214
|
}
|
|
@@ -275031,8 +275040,10 @@ function clearTableAutoFitMeasurementCaches() {
|
|
|
275031
275040
|
autoFitTableResultCache.clear();
|
|
275032
275041
|
}
|
|
275033
275042
|
function buildTableCellContentMetricsCacheKey(cell2, options) {
|
|
275043
|
+
const fontContext = options.fontContext ?? DEFAULT_FONT_MEASURE_CONTEXT;
|
|
275034
275044
|
return stableSerialize({
|
|
275035
275045
|
maxWidth: Math.max(1, Math.round(options.maxWidth)),
|
|
275046
|
+
fontSignature: fontContext.fontSignature ?? "",
|
|
275036
275047
|
layoutEpoch: options.layoutEpoch ?? null,
|
|
275037
275048
|
attrs: cell2.attrs ?? null,
|
|
275038
275049
|
paragraph: cell2.paragraph ?? null,
|
|
@@ -275046,6 +275057,7 @@ function buildAutoFitTableResultCacheKey(table2, options) {
|
|
|
275046
275057
|
columnWidths: table2.columnWidths ?? null,
|
|
275047
275058
|
rowCount: table2.rows.length,
|
|
275048
275059
|
maxWidth: Math.max(1, Math.round(options.maxWidth)),
|
|
275060
|
+
fontSignature: options.fontSignature ?? "",
|
|
275049
275061
|
layoutEpoch: options.layoutEpoch ?? null,
|
|
275050
275062
|
cellMetricKeys: options.cellMetricKeys,
|
|
275051
275063
|
workingGrid: {
|
|
@@ -275085,7 +275097,12 @@ function setCachedAutoFitTableResult(cacheKey, result) {
|
|
|
275085
275097
|
autoFitTableResultCache.set(cacheKey, result);
|
|
275086
275098
|
}
|
|
275087
275099
|
async function measureTableCellContentMetrics(cell2, options) {
|
|
275088
|
-
const
|
|
275100
|
+
const fontContext = options.fontContext ?? DEFAULT_FONT_MEASURE_CONTEXT;
|
|
275101
|
+
const normalizedOptions = {
|
|
275102
|
+
...options,
|
|
275103
|
+
fontContext
|
|
275104
|
+
};
|
|
275105
|
+
const cacheKey = buildTableCellContentMetricsCacheKey(cell2, normalizedOptions);
|
|
275089
275106
|
const cached2 = tableCellMetricsCache.get(cacheKey);
|
|
275090
275107
|
if (cached2)
|
|
275091
275108
|
return cached2;
|
|
@@ -275102,7 +275119,7 @@ async function measureTableCellContentMetrics(cell2, options) {
|
|
|
275102
275119
|
let minContentWidthPx = 0;
|
|
275103
275120
|
let maxContentWidthPx = 0;
|
|
275104
275121
|
for (const block of contentBlocks) {
|
|
275105
|
-
const metrics = await measureIntrinsicBlockWidthMetrics(block,
|
|
275122
|
+
const metrics = await measureIntrinsicBlockWidthMetrics(block, normalizedOptions);
|
|
275106
275123
|
minContentWidthPx = Math.max(minContentWidthPx, metrics.minWidthPx);
|
|
275107
275124
|
maxContentWidthPx = Math.max(maxContentWidthPx, metrics.maxWidthPx);
|
|
275108
275125
|
}
|
|
@@ -275113,7 +275130,7 @@ async function measureTableCellContentMetrics(cell2, options) {
|
|
|
275113
275130
|
tableCellMetricsCache.set(cacheKey, result);
|
|
275114
275131
|
return result;
|
|
275115
275132
|
}
|
|
275116
|
-
async function measureTableAutoFitContentMetrics(table2, workingInput, fixedLayout, measureBlock$1) {
|
|
275133
|
+
async function measureTableAutoFitContentMetrics(table2, workingInput, fixedLayout, measureBlock$1, fontContext = DEFAULT_FONT_MEASURE_CONTEXT) {
|
|
275117
275134
|
const tableMeasurementBasis = Math.max(1, fixedLayout.totalWidth);
|
|
275118
275135
|
const cellMetricKeys = [];
|
|
275119
275136
|
const rowMetrics = await Promise.all(table2.rows.map(async (row2, rowIndex) => {
|
|
@@ -275124,10 +275141,14 @@ async function measureTableAutoFitContentMetrics(table2, workingInput, fixedLayo
|
|
|
275124
275141
|
const normalizedCell = normalizedRow.cells?.[cellIndex];
|
|
275125
275142
|
const span = normalizedCell?.span ?? cell2.colSpan ?? 1;
|
|
275126
275143
|
const measurementMaxWidth = resolveAutoFitCellMeasurementMaxWidth(cell2, normalizedCell, span, fixedLayout, tableMeasurementBasis, workingInput.gridColumnCount);
|
|
275127
|
-
cellMetricKeys.push(buildTableCellContentMetricsCacheKey(cell2, {
|
|
275144
|
+
cellMetricKeys.push(buildTableCellContentMetricsCacheKey(cell2, {
|
|
275145
|
+
maxWidth: measurementMaxWidth,
|
|
275146
|
+
fontContext
|
|
275147
|
+
}));
|
|
275128
275148
|
const metrics = await measureTableCellContentMetrics(cell2, {
|
|
275129
275149
|
maxWidth: measurementMaxWidth,
|
|
275130
|
-
measureBlock: measureBlock$1
|
|
275150
|
+
measureBlock: measureBlock$1,
|
|
275151
|
+
fontContext
|
|
275131
275152
|
});
|
|
275132
275153
|
return {
|
|
275133
275154
|
cellIndex,
|
|
@@ -275159,7 +275180,7 @@ async function measureTableAutoFitContentMetrics(table2, workingInput, fixedLayo
|
|
|
275159
275180
|
}
|
|
275160
275181
|
async function measureIntrinsicBlockWidthMetrics(block, options) {
|
|
275161
275182
|
if (block.kind === "paragraph")
|
|
275162
|
-
return measureParagraphIntrinsicWidthMetrics(block, options.measureBlock);
|
|
275183
|
+
return measureParagraphIntrinsicWidthMetrics(block, options.measureBlock, options.fontContext);
|
|
275163
275184
|
if (block.kind === "table")
|
|
275164
275185
|
return measureNestedTableIntrinsicWidthMetrics(block, options);
|
|
275165
275186
|
const intrinsicWidth = getIntrinsicAtomicBlockWidth(block);
|
|
@@ -275168,13 +275189,13 @@ async function measureIntrinsicBlockWidthMetrics(block, options) {
|
|
|
275168
275189
|
maxWidthPx: intrinsicWidth
|
|
275169
275190
|
};
|
|
275170
275191
|
}
|
|
275171
|
-
async function measureParagraphIntrinsicWidthMetrics(paragraph2, measureBlock$1) {
|
|
275192
|
+
async function measureParagraphIntrinsicWidthMetrics(paragraph2, measureBlock$1, fontContext) {
|
|
275172
275193
|
const maxLineWidth = (await measureBlock$1(paragraph2, {
|
|
275173
275194
|
maxWidth: NO_WRAP_MAX_WIDTH,
|
|
275174
275195
|
maxHeight: Infinity
|
|
275175
275196
|
})).lines.reduce((widest, line) => Math.max(widest, line.width), 0);
|
|
275176
275197
|
return {
|
|
275177
|
-
minWidthPx: measureParagraphMinTokenWidth(paragraph2),
|
|
275198
|
+
minWidthPx: measureParagraphMinTokenWidth(paragraph2, fontContext),
|
|
275178
275199
|
maxWidthPx: maxLineWidth
|
|
275179
275200
|
};
|
|
275180
275201
|
}
|
|
@@ -275193,7 +275214,7 @@ async function measureNestedTableIntrinsicWidthMetrics(table2, options) {
|
|
|
275193
275214
|
maxWidthPx: nestedMeasure.totalWidth
|
|
275194
275215
|
};
|
|
275195
275216
|
}
|
|
275196
|
-
function measureParagraphMinTokenWidth(paragraph2) {
|
|
275217
|
+
function measureParagraphMinTokenWidth(paragraph2, fontContext) {
|
|
275197
275218
|
let widestToken = 0;
|
|
275198
275219
|
let currentTokenWidth = 0;
|
|
275199
275220
|
const flushToken = () => {
|
|
@@ -275208,7 +275229,7 @@ function measureParagraphMinTokenWidth(paragraph2) {
|
|
|
275208
275229
|
if (isTextLikeRun(run2)) {
|
|
275209
275230
|
accumulateTextRunMinTokenWidth(run2, (width) => {
|
|
275210
275231
|
currentTokenWidth += width;
|
|
275211
|
-
}, flushToken);
|
|
275232
|
+
}, flushToken, fontContext);
|
|
275212
275233
|
continue;
|
|
275213
275234
|
}
|
|
275214
275235
|
flushToken();
|
|
@@ -275217,7 +275238,7 @@ function measureParagraphMinTokenWidth(paragraph2) {
|
|
|
275217
275238
|
continue;
|
|
275218
275239
|
}
|
|
275219
275240
|
if (run2.kind === "fieldAnnotation") {
|
|
275220
|
-
widestToken = Math.max(widestToken, measureFieldAnnotationWidth(run2));
|
|
275241
|
+
widestToken = Math.max(widestToken, measureFieldAnnotationWidth(run2, fontContext));
|
|
275221
275242
|
continue;
|
|
275222
275243
|
}
|
|
275223
275244
|
if (run2.kind === "math")
|
|
@@ -275226,8 +275247,8 @@ function measureParagraphMinTokenWidth(paragraph2) {
|
|
|
275226
275247
|
flushToken();
|
|
275227
275248
|
return widestToken;
|
|
275228
275249
|
}
|
|
275229
|
-
function accumulateTextRunMinTokenWidth(run2, appendTokenPiece, flushToken) {
|
|
275230
|
-
const font = buildFontString$1(run2);
|
|
275250
|
+
function accumulateTextRunMinTokenWidth(run2, appendTokenPiece, flushToken, fontContext) {
|
|
275251
|
+
const font = buildFontString$1(run2, fontContext);
|
|
275231
275252
|
let cursor = 0;
|
|
275232
275253
|
for (const boundary of run2.text.matchAll(TOKEN_BOUNDARY_PATTERN)) {
|
|
275233
275254
|
const boundaryStart = boundary.index ?? cursor;
|
|
@@ -275293,14 +275314,15 @@ function getCanvasContext$1() {
|
|
|
275293
275314
|
}
|
|
275294
275315
|
return canvasContext$1;
|
|
275295
275316
|
}
|
|
275296
|
-
function buildFontString$1(run2) {
|
|
275317
|
+
function buildFontString$1(run2, fontContext) {
|
|
275297
275318
|
const parts = [];
|
|
275298
275319
|
if (run2.italic)
|
|
275299
275320
|
parts.push("italic");
|
|
275300
275321
|
if (run2.bold)
|
|
275301
275322
|
parts.push("bold");
|
|
275302
275323
|
parts.push(`${normalizeFontSize$1(run2.fontSize)}px`);
|
|
275303
|
-
|
|
275324
|
+
const physicalFamily = normalizeFontFamily$1(fontContext.resolvePhysical(normalizeFontFamily$1(run2.fontFamily)));
|
|
275325
|
+
parts.push(toCssFontFamily(physicalFamily) ?? physicalFamily);
|
|
275304
275326
|
return parts.join(" ");
|
|
275305
275327
|
}
|
|
275306
275328
|
function applyTextTransform$1(text5, run2, startOffset = 0) {
|
|
@@ -275325,14 +275347,14 @@ function capitalizeText$1(text5, fullText, startOffset) {
|
|
|
275325
275347
|
}
|
|
275326
275348
|
return result;
|
|
275327
275349
|
}
|
|
275328
|
-
function measureFieldAnnotationWidth(run2) {
|
|
275350
|
+
function measureFieldAnnotationWidth(run2, fontContext) {
|
|
275329
275351
|
const fontSize = typeof run2.fontSize === "number" ? run2.fontSize : typeof run2.fontSize === "string" ? parseFloat(run2.fontSize) || DEFAULT_FIELD_ANNOTATION_FONT_SIZE$1 : DEFAULT_FIELD_ANNOTATION_FONT_SIZE$1;
|
|
275330
275352
|
const font = buildFontString$1({
|
|
275331
275353
|
fontFamily: normalizeFontFamily$1(run2.fontFamily ?? "Arial"),
|
|
275332
275354
|
fontSize,
|
|
275333
275355
|
bold: run2.bold,
|
|
275334
275356
|
italic: run2.italic
|
|
275335
|
-
});
|
|
275357
|
+
}, fontContext);
|
|
275336
275358
|
return getMeasuredTextWidth(applyTextTransform$1(run2.displayLabel || "", { text: run2.displayLabel || "" }), font, 0, getCanvasContext$1()) + (run2.highlighted === false ? 0 : FIELD_ANNOTATION_PILL_PADDING$1);
|
|
275337
275359
|
}
|
|
275338
275360
|
function isExplicitLineBreakRun(run2) {
|
|
@@ -275406,14 +275428,14 @@ function getCanvasContext() {
|
|
|
275406
275428
|
}
|
|
275407
275429
|
return canvasContext;
|
|
275408
275430
|
}
|
|
275409
|
-
function buildFontString(run2,
|
|
275431
|
+
function buildFontString(run2, fontContext) {
|
|
275410
275432
|
const parts = [];
|
|
275411
275433
|
if (run2.italic)
|
|
275412
275434
|
parts.push("italic");
|
|
275413
275435
|
if (run2.bold)
|
|
275414
275436
|
parts.push("bold");
|
|
275415
275437
|
parts.push(`${run2.fontSize}px`);
|
|
275416
|
-
const physicalFamily = resolvePhysical(run2.fontFamily);
|
|
275438
|
+
const physicalFamily = fontContext.resolvePhysical(run2.fontFamily);
|
|
275417
275439
|
if (measurementConfig.mode === "deterministic")
|
|
275418
275440
|
parts.push(measurementConfig.fonts.fallbackStack.length > 0 ? measurementConfig.fonts.fallbackStack.join(", ") : measurementConfig.fonts.deterministicFamily);
|
|
275419
275441
|
else
|
|
@@ -275478,17 +275500,17 @@ function calculateEmptyParagraphMetrics(fontSize, spacing, fontInfo) {
|
|
|
275478
275500
|
function lineHeightFontSize(run2) {
|
|
275479
275501
|
return resolveBaseFontSizeForVerticalText(run2.fontSize, run2);
|
|
275480
275502
|
}
|
|
275481
|
-
function getFontInfoFromRun(run2) {
|
|
275503
|
+
function getFontInfoFromRun(run2, fontContext) {
|
|
275482
275504
|
return {
|
|
275483
|
-
fontFamily: normalizeFontFamily(run2.fontFamily),
|
|
275505
|
+
fontFamily: normalizeFontFamily(fontContext.resolvePhysical(run2.fontFamily)),
|
|
275484
275506
|
fontSize: normalizeFontSize2(lineHeightFontSize(run2)),
|
|
275485
275507
|
bold: run2.bold,
|
|
275486
275508
|
italic: run2.italic
|
|
275487
275509
|
};
|
|
275488
275510
|
}
|
|
275489
|
-
function updateMaxFontInfo(currentMaxSize, currentMaxInfo, newRun) {
|
|
275511
|
+
function updateMaxFontInfo(currentMaxSize, currentMaxInfo, newRun, fontContext) {
|
|
275490
275512
|
if (lineHeightFontSize(newRun) >= currentMaxSize)
|
|
275491
|
-
return getFontInfoFromRun(newRun);
|
|
275513
|
+
return getFontInfoFromRun(newRun, fontContext);
|
|
275492
275514
|
return currentMaxInfo;
|
|
275493
275515
|
}
|
|
275494
275516
|
function isTextRun$22(run2) {
|
|
@@ -275506,7 +275528,7 @@ function isLineBreakRun(run2) {
|
|
|
275506
275528
|
function isFieldAnnotationRun(run2) {
|
|
275507
275529
|
return run2.kind === "fieldAnnotation";
|
|
275508
275530
|
}
|
|
275509
|
-
function measureTabAlignmentGroup(startRunIndex, runs2, ctx$1, decimalSeparator = ".",
|
|
275531
|
+
function measureTabAlignmentGroup(startRunIndex, runs2, ctx$1, decimalSeparator = ".", fontContext) {
|
|
275510
275532
|
const result = {
|
|
275511
275533
|
totalWidth: 0,
|
|
275512
275534
|
runs: [],
|
|
@@ -275527,7 +275549,7 @@ function measureTabAlignmentGroup(startRunIndex, runs2, ctx$1, decimalSeparator
|
|
|
275527
275549
|
const textRun = run2;
|
|
275528
275550
|
const text5 = textRun.text || "";
|
|
275529
275551
|
if (text5.length > 0) {
|
|
275530
|
-
const { font } = buildFontString(textRun,
|
|
275552
|
+
const { font } = buildFontString(textRun, fontContext);
|
|
275531
275553
|
const width = measureRunWidth(text5, font, ctx$1, textRun, 0);
|
|
275532
275554
|
let beforeDecimalWidth;
|
|
275533
275555
|
if (!foundDecimal) {
|
|
@@ -275581,7 +275603,7 @@ function measureTabAlignmentGroup(startRunIndex, runs2, ctx$1, decimalSeparator
|
|
|
275581
275603
|
fontSize,
|
|
275582
275604
|
bold: run2.bold,
|
|
275583
275605
|
italic: run2.italic
|
|
275584
|
-
},
|
|
275606
|
+
}, fontContext);
|
|
275585
275607
|
const pillWidth = (run2.displayLabel ? measureRunWidth(run2.displayLabel, font, ctx$1, run2, 0) : 0) + FIELD_ANNOTATION_PILL_PADDING;
|
|
275586
275608
|
result.runs.push({
|
|
275587
275609
|
runIndex: i4,
|
|
@@ -275597,25 +275619,25 @@ function measureTabAlignmentGroup(startRunIndex, runs2, ctx$1, decimalSeparator
|
|
|
275597
275619
|
}
|
|
275598
275620
|
return result;
|
|
275599
275621
|
}
|
|
275600
|
-
async function measureBlock(block, constraints,
|
|
275622
|
+
async function measureBlock(block, constraints, fontContext = DEFAULT_FONT_MEASURE_CONTEXT) {
|
|
275601
275623
|
const normalized = normalizeConstraints(constraints);
|
|
275602
275624
|
if (block.kind === "drawing")
|
|
275603
275625
|
return measureDrawingBlock(block, normalized);
|
|
275604
275626
|
if (block.kind === "image")
|
|
275605
275627
|
return measureImageBlock(block, normalized);
|
|
275606
275628
|
if (block.kind === "list")
|
|
275607
|
-
return measureListBlock(block, normalized,
|
|
275629
|
+
return measureListBlock(block, normalized, fontContext);
|
|
275608
275630
|
if (block.kind === "table")
|
|
275609
|
-
return measureTableBlock(block, normalized,
|
|
275631
|
+
return measureTableBlock(block, normalized, fontContext);
|
|
275610
275632
|
if (block.kind === "sectionBreak")
|
|
275611
275633
|
return { kind: "sectionBreak" };
|
|
275612
275634
|
if (block.kind === "pageBreak")
|
|
275613
275635
|
return { kind: "pageBreak" };
|
|
275614
275636
|
if (block.kind === "columnBreak")
|
|
275615
275637
|
return { kind: "columnBreak" };
|
|
275616
|
-
return measureParagraphBlock(block, normalized.maxWidth,
|
|
275638
|
+
return measureParagraphBlock(block, normalized.maxWidth, fontContext);
|
|
275617
275639
|
}
|
|
275618
|
-
async function measureParagraphBlock(block, maxWidth,
|
|
275640
|
+
async function measureParagraphBlock(block, maxWidth, fontContext) {
|
|
275619
275641
|
const ctx$1 = getCanvasContext();
|
|
275620
275642
|
const wordLayout = block.attrs?.wordLayout;
|
|
275621
275643
|
const firstTextRunWithSize = block.runs.find((run2) => isTextRun$22(run2) && ("fontSize" in run2) && run2.fontSize != null);
|
|
@@ -275628,7 +275650,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
275628
275650
|
fontSize: wordLayout.marker.run.fontSize ?? fallbackFontSize,
|
|
275629
275651
|
bold: wordLayout.marker.run.bold,
|
|
275630
275652
|
italic: wordLayout.marker.run.italic
|
|
275631
|
-
},
|
|
275653
|
+
}, fontContext);
|
|
275632
275654
|
const markerText = wordLayout.marker.markerText ?? "";
|
|
275633
275655
|
const glyphWidth = markerText ? measureText(markerText, markerFont, ctx$1) : 0;
|
|
275634
275656
|
const gutter = typeof wordLayout.marker.gutterWidthPx === "number" && isFinite(wordLayout.marker.gutterWidthPx) && wordLayout.marker.gutterWidthPx >= 0 ? wordLayout.marker.gutterWidthPx : 8;
|
|
@@ -275661,7 +275683,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
275661
275683
|
fontSize: marker.run?.fontSize ?? fallbackFontSize,
|
|
275662
275684
|
bold: marker.run?.bold ?? false,
|
|
275663
275685
|
italic: marker.run?.italic ?? false
|
|
275664
|
-
},
|
|
275686
|
+
}, fontContext);
|
|
275665
275687
|
return measureText(markerText, markerFont, ctx$1);
|
|
275666
275688
|
}) ?? textStartPx;
|
|
275667
275689
|
if (typeof effectiveTextStartPx === "number" && effectiveTextStartPx > indentLeft)
|
|
@@ -275685,14 +275707,14 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
275685
275707
|
if (!dropCapDescriptor.run || !dropCapDescriptor.run.text || !dropCapDescriptor.lines)
|
|
275686
275708
|
console.warn("Invalid drop cap descriptor - missing required fields:", dropCapDescriptor);
|
|
275687
275709
|
else {
|
|
275688
|
-
const dropCapMeasured = measureDropCap(ctx$1, dropCapDescriptor, spacing,
|
|
275710
|
+
const dropCapMeasured = measureDropCap(ctx$1, dropCapDescriptor, spacing, fontContext);
|
|
275689
275711
|
dropCapMeasure = dropCapMeasured;
|
|
275690
275712
|
dropCapDescriptor.measuredWidth = dropCapMeasured.width;
|
|
275691
275713
|
dropCapDescriptor.measuredHeight = dropCapMeasured.height;
|
|
275692
275714
|
}
|
|
275693
275715
|
const emptyParagraphRun = normalizedRuns.length === 1 && isEmptyTextRun2(normalizedRuns[0]) && !isEmptySdtPlaceholderRun(normalizedRuns[0]) ? normalizedRuns[0] : null;
|
|
275694
275716
|
if (emptyParagraphRun) {
|
|
275695
|
-
const metrics = calculateEmptyParagraphMetrics(emptyParagraphRun.fontSize ?? DEFAULT_PARAGRAPH_FONT_SIZE, spacing, getFontInfoFromRun(emptyParagraphRun));
|
|
275717
|
+
const metrics = calculateEmptyParagraphMetrics(emptyParagraphRun.fontSize ?? DEFAULT_PARAGRAPH_FONT_SIZE, spacing, getFontInfoFromRun(emptyParagraphRun, fontContext));
|
|
275696
275718
|
const emptyLine = {
|
|
275697
275719
|
fromRun: 0,
|
|
275698
275720
|
fromChar: 0,
|
|
@@ -275729,7 +275751,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
275729
275751
|
...markerInfo ? { marker: markerInfo } : {}
|
|
275730
275752
|
};
|
|
275731
275753
|
}
|
|
275732
|
-
const fallbackFontInfo = firstTextRunWithSize ? getFontInfoFromRun(firstTextRunWithSize) : undefined;
|
|
275754
|
+
const fallbackFontInfo = firstTextRunWithSize ? getFontInfoFromRun(firstTextRunWithSize, fontContext) : undefined;
|
|
275733
275755
|
let currentLine = null;
|
|
275734
275756
|
const getEffectiveWidth = (baseWidth) => {
|
|
275735
275757
|
if (dropCapMeasure && lines.length < dropCapMeasure.lines && dropCapMeasure.mode === "drop")
|
|
@@ -275910,7 +275932,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
275910
275932
|
if (lineToTrim.fromRun === lineToTrim.toRun && sliceText.trim().length === 0)
|
|
275911
275933
|
return;
|
|
275912
275934
|
const keptText = sliceText.slice(0, Math.max(0, sliceText.length - trimCount));
|
|
275913
|
-
const { font } = buildFontString(lastRun,
|
|
275935
|
+
const { font } = buildFontString(lastRun, fontContext);
|
|
275914
275936
|
const fullWidth = measureRunWidth(sliceText, font, ctx$1, lastRun, sliceStart);
|
|
275915
275937
|
const keptWidth = keptText.length > 0 ? measureRunWidth(keptText, font, ctx$1, lastRun, sliceStart) : 0;
|
|
275916
275938
|
const delta = Math.max(0, fullWidth - keptWidth);
|
|
@@ -276057,7 +276079,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276057
276079
|
toChar: 1,
|
|
276058
276080
|
width: 0,
|
|
276059
276081
|
maxFontSize: lastFontSize,
|
|
276060
|
-
maxFontInfo: hasSeenTextRun ? undefined : fallbackFontInfo ?? getFontInfoFromRun(run2),
|
|
276082
|
+
maxFontInfo: hasSeenTextRun ? undefined : fallbackFontInfo ?? getFontInfoFromRun(run2, fontContext),
|
|
276061
276083
|
maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
|
|
276062
276084
|
segments: [],
|
|
276063
276085
|
spaceCount: 0
|
|
@@ -276107,7 +276129,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276107
276129
|
if (stop) {
|
|
276108
276130
|
validateTabStopVal(stop);
|
|
276109
276131
|
if (stop.val === "end" || stop.val === "center" || stop.val === "decimal") {
|
|
276110
|
-
const groupMeasure = measureTabAlignmentGroup(runIndex + 1, runsToProcess, ctx$1, decimalSeparator,
|
|
276132
|
+
const groupMeasure = measureTabAlignmentGroup(runIndex + 1, runsToProcess, ctx$1, decimalSeparator, fontContext);
|
|
276111
276133
|
if (groupMeasure.totalWidth > 0) {
|
|
276112
276134
|
const relativeTarget = clampedTarget - effectiveIndent;
|
|
276113
276135
|
let groupStartX;
|
|
@@ -276283,7 +276305,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276283
276305
|
if (isFieldAnnotationRun(run2)) {
|
|
276284
276306
|
const displayText = applyTextTransform(run2.displayLabel || "", run2);
|
|
276285
276307
|
const annotationFontSize = typeof run2.fontSize === "number" ? run2.fontSize : typeof run2.fontSize === "string" ? parseFloat(run2.fontSize) || DEFAULT_FIELD_ANNOTATION_FONT_SIZE : DEFAULT_FIELD_ANNOTATION_FONT_SIZE;
|
|
276286
|
-
const annotationFontFamily = run2.fontFamily || "Arial, sans-serif";
|
|
276308
|
+
const annotationFontFamily = fontContext.resolvePhysical(run2.fontFamily || "Arial, sans-serif");
|
|
276287
276309
|
const fontWeight = run2.bold ? "bold" : "normal";
|
|
276288
276310
|
ctx$1.font = `${run2.italic ? "italic" : "normal"} ${fontWeight} ${annotationFontSize}px ${annotationFontFamily}`;
|
|
276289
276311
|
const textWidth = displayText ? ctx$1.measureText(displayText).width : 0;
|
|
@@ -276384,7 +276406,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276384
276406
|
continue;
|
|
276385
276407
|
}
|
|
276386
276408
|
if (isEmptySdtPlaceholderRun(run2)) {
|
|
276387
|
-
const placeholderFont = buildFontString(run2,
|
|
276409
|
+
const placeholderFont = buildFontString(run2, fontContext).font;
|
|
276388
276410
|
const placeholderText = applyTextTransform(EMPTY_SDT_PLACEHOLDER_TEXT, run2);
|
|
276389
276411
|
const measuredPlaceholderWidth = getMeasuredTextWidth(placeholderText, placeholderFont, run2.letterSpacing ?? 0, ctx$1);
|
|
276390
276412
|
const fallbackPlaceholderWidth = placeholderText.length * run2.fontSize * 0.45;
|
|
@@ -276397,7 +276419,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276397
276419
|
toChar: 0,
|
|
276398
276420
|
width: placeholderWidth,
|
|
276399
276421
|
maxFontSize: lineHeightFontSize(run2),
|
|
276400
|
-
maxFontInfo: getFontInfoFromRun(run2),
|
|
276422
|
+
maxFontInfo: getFontInfoFromRun(run2, fontContext),
|
|
276401
276423
|
maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
|
|
276402
276424
|
segments: [{
|
|
276403
276425
|
runIndex,
|
|
@@ -276430,7 +276452,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276430
276452
|
toChar: 0,
|
|
276431
276453
|
width: placeholderWidth,
|
|
276432
276454
|
maxFontSize: lineHeightFontSize(run2),
|
|
276433
|
-
maxFontInfo: getFontInfoFromRun(run2),
|
|
276455
|
+
maxFontInfo: getFontInfoFromRun(run2, fontContext),
|
|
276434
276456
|
maxWidth: getEffectiveWidth(bodyContentWidth),
|
|
276435
276457
|
segments: [{
|
|
276436
276458
|
runIndex,
|
|
@@ -276444,7 +276466,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276444
276466
|
currentLine.toRun = runIndex;
|
|
276445
276467
|
currentLine.toChar = 0;
|
|
276446
276468
|
currentLine.width = roundValue(currentLine.width + boundarySpacing + placeholderWidth);
|
|
276447
|
-
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2);
|
|
276469
|
+
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2, fontContext);
|
|
276448
276470
|
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, lineHeightFontSize(run2));
|
|
276449
276471
|
appendSegment(currentLine.segments, runIndex, 0, 0, placeholderWidth);
|
|
276450
276472
|
}
|
|
@@ -276456,7 +276478,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276456
276478
|
}
|
|
276457
276479
|
lastFontSize = run2.fontSize;
|
|
276458
276480
|
hasSeenTextRun = true;
|
|
276459
|
-
const { font } = buildFontString(run2,
|
|
276481
|
+
const { font } = buildFontString(run2, fontContext);
|
|
276460
276482
|
const tabSegments = run2.text.split("\t");
|
|
276461
276483
|
let charPosInRun = 0;
|
|
276462
276484
|
for (let segmentIndex = 0;segmentIndex < tabSegments.length; segmentIndex++) {
|
|
@@ -276476,7 +276498,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276476
276498
|
toChar: spacesEndChar,
|
|
276477
276499
|
width: spacesWidth,
|
|
276478
276500
|
maxFontSize: lineHeightFontSize(run2),
|
|
276479
|
-
maxFontInfo: getFontInfoFromRun(run2),
|
|
276501
|
+
maxFontInfo: getFontInfoFromRun(run2, fontContext),
|
|
276480
276502
|
maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
|
|
276481
276503
|
segments: [{
|
|
276482
276504
|
runIndex,
|
|
@@ -276508,7 +276530,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276508
276530
|
toChar: spacesEndChar,
|
|
276509
276531
|
width: spacesWidth,
|
|
276510
276532
|
maxFontSize: lineHeightFontSize(run2),
|
|
276511
|
-
maxFontInfo: getFontInfoFromRun(run2),
|
|
276533
|
+
maxFontInfo: getFontInfoFromRun(run2, fontContext),
|
|
276512
276534
|
maxWidth: getEffectiveWidth(bodyContentWidth),
|
|
276513
276535
|
segments: [{
|
|
276514
276536
|
runIndex,
|
|
@@ -276522,7 +276544,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276522
276544
|
currentLine.toRun = runIndex;
|
|
276523
276545
|
currentLine.toChar = spacesEndChar;
|
|
276524
276546
|
currentLine.width = roundValue(currentLine.width + boundarySpacing + spacesWidth);
|
|
276525
|
-
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2);
|
|
276547
|
+
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2, fontContext);
|
|
276526
276548
|
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, lineHeightFontSize(run2));
|
|
276527
276549
|
appendSegment(currentLine.segments, runIndex, spacesStartChar, spacesEndChar, spacesWidth);
|
|
276528
276550
|
currentLine.spaceCount += spacesLength;
|
|
@@ -276575,7 +276597,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276575
276597
|
toChar: spaceEndChar,
|
|
276576
276598
|
width: singleSpaceWidth,
|
|
276577
276599
|
maxFontSize: lineHeightFontSize(run2),
|
|
276578
|
-
maxFontInfo: getFontInfoFromRun(run2),
|
|
276600
|
+
maxFontInfo: getFontInfoFromRun(run2, fontContext),
|
|
276579
276601
|
maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
|
|
276580
276602
|
segments: [{
|
|
276581
276603
|
runIndex,
|
|
@@ -276609,7 +276631,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276609
276631
|
toChar: spaceEndChar,
|
|
276610
276632
|
width: singleSpaceWidth,
|
|
276611
276633
|
maxFontSize: lineHeightFontSize(run2),
|
|
276612
|
-
maxFontInfo: getFontInfoFromRun(run2),
|
|
276634
|
+
maxFontInfo: getFontInfoFromRun(run2, fontContext),
|
|
276613
276635
|
maxWidth: getEffectiveWidth(bodyContentWidth),
|
|
276614
276636
|
segments: [{
|
|
276615
276637
|
runIndex,
|
|
@@ -276623,7 +276645,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276623
276645
|
currentLine.toRun = runIndex;
|
|
276624
276646
|
currentLine.toChar = spaceEndChar;
|
|
276625
276647
|
currentLine.width = roundValue(currentLine.width + boundarySpacing$1 + singleSpaceWidth);
|
|
276626
|
-
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2);
|
|
276648
|
+
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2, fontContext);
|
|
276627
276649
|
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, lineHeightFontSize(run2));
|
|
276628
276650
|
let spaceExplicitX;
|
|
276629
276651
|
let spacePrecedingTabEndX;
|
|
@@ -276679,7 +276701,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276679
276701
|
currentLine.toChar = chunkEndChar;
|
|
276680
276702
|
currentLine.width = roundValue(currentLine.width + chunk.width);
|
|
276681
276703
|
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, lineHeightFontSize(run2));
|
|
276682
|
-
currentLine.maxFontInfo = getFontInfoFromRun(run2);
|
|
276704
|
+
currentLine.maxFontInfo = getFontInfoFromRun(run2, fontContext);
|
|
276683
276705
|
currentLine.segments.push({
|
|
276684
276706
|
runIndex,
|
|
276685
276707
|
fromChar: chunkStartChar,
|
|
@@ -276718,7 +276740,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276718
276740
|
toChar: chunkEndChar,
|
|
276719
276741
|
width: chunk.width,
|
|
276720
276742
|
maxFontSize: lineHeightFontSize(run2),
|
|
276721
|
-
maxFontInfo: getFontInfoFromRun(run2),
|
|
276743
|
+
maxFontInfo: getFontInfoFromRun(run2, fontContext),
|
|
276722
276744
|
maxWidth: getEffectiveWidth(contentWidth),
|
|
276723
276745
|
segments: [{
|
|
276724
276746
|
runIndex,
|
|
@@ -276738,7 +276760,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276738
276760
|
charPosInRun = wordEndWithSpace;
|
|
276739
276761
|
} else {
|
|
276740
276762
|
const chunkLineMaxWidth = getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : contentWidth);
|
|
276741
|
-
const metrics = calculateTypographyMetrics(run2.fontSize, spacing, getFontInfoFromRun(run2));
|
|
276763
|
+
const metrics = calculateTypographyMetrics(run2.fontSize, spacing, getFontInfoFromRun(run2, fontContext));
|
|
276742
276764
|
const chunkLine = {
|
|
276743
276765
|
fromRun: runIndex,
|
|
276744
276766
|
fromChar: chunkStartChar,
|
|
@@ -276770,7 +276792,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276770
276792
|
toChar: wordEndNoSpace,
|
|
276771
276793
|
width: wordOnlyWidth,
|
|
276772
276794
|
maxFontSize: lineHeightFontSize(run2),
|
|
276773
|
-
maxFontInfo: getFontInfoFromRun(run2),
|
|
276795
|
+
maxFontInfo: getFontInfoFromRun(run2, fontContext),
|
|
276774
276796
|
maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
|
|
276775
276797
|
segments: [{
|
|
276776
276798
|
runIndex,
|
|
@@ -276838,7 +276860,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276838
276860
|
toChar: wordEndNoSpace,
|
|
276839
276861
|
width: wordOnlyWidth,
|
|
276840
276862
|
maxFontSize: lineHeightFontSize(run2),
|
|
276841
|
-
maxFontInfo: getFontInfoFromRun(run2),
|
|
276863
|
+
maxFontInfo: getFontInfoFromRun(run2, fontContext),
|
|
276842
276864
|
maxWidth: getEffectiveWidth(bodyContentWidth),
|
|
276843
276865
|
segments: [{
|
|
276844
276866
|
runIndex,
|
|
@@ -276864,7 +276886,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276864
276886
|
if (shouldIncludeDelimiterSpace && currentLine.width + boundarySpacing + wordOnlyWidth + spaceWidth > currentLine.maxWidth - WIDTH_FUDGE_PX$1) {
|
|
276865
276887
|
currentLine.toChar = wordEndNoSpace;
|
|
276866
276888
|
currentLine.width = roundValue(currentLine.width + boundarySpacing + wordOnlyWidth);
|
|
276867
|
-
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2);
|
|
276889
|
+
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2, fontContext);
|
|
276868
276890
|
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, lineHeightFontSize(run2));
|
|
276869
276891
|
let explicitXHere;
|
|
276870
276892
|
if (inActiveTabGroup && activeTabGroup) {
|
|
@@ -276900,7 +276922,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276900
276922
|
if (compressedWidth != null)
|
|
276901
276923
|
currentLine.naturalWidth = roundValue(totalWidthWithWord);
|
|
276902
276924
|
currentLine.width = roundValue(targetWidth);
|
|
276903
|
-
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2);
|
|
276925
|
+
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2, fontContext);
|
|
276904
276926
|
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, lineHeightFontSize(run2));
|
|
276905
276927
|
appendSegment(currentLine.segments, runIndex, wordStartChar, newToChar, wordCommitWidth, explicitX, wordIndex === 0 ? consumeSegmentPrecedingTabEndX() : undefined);
|
|
276906
276928
|
if (shouldIncludeDelimiterSpace)
|
|
@@ -276930,7 +276952,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276930
276952
|
toChar: charPosInRun,
|
|
276931
276953
|
width: 0,
|
|
276932
276954
|
maxFontSize: lineHeightFontSize(run2),
|
|
276933
|
-
maxFontInfo: getFontInfoFromRun(run2),
|
|
276955
|
+
maxFontInfo: getFontInfoFromRun(run2, fontContext),
|
|
276934
276956
|
maxWidth: getEffectiveWidth(lines.length === 0 ? initialAvailableWidth : bodyContentWidth),
|
|
276935
276957
|
segments: [],
|
|
276936
276958
|
spaceCount: 0
|
|
@@ -276946,7 +276968,7 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
276946
276968
|
currentLine.width = roundValue(currentLine.width + tabAdvance);
|
|
276947
276969
|
if (stop?.source === "explicit")
|
|
276948
276970
|
currentLine.hasExplicitTabStops = true;
|
|
276949
|
-
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2);
|
|
276971
|
+
currentLine.maxFontInfo = updateMaxFontInfo(currentLine.maxFontSize, currentLine.maxFontInfo, run2, fontContext);
|
|
276950
276972
|
currentLine.maxFontSize = Math.max(currentLine.maxFontSize, lineHeightFontSize(run2));
|
|
276951
276973
|
currentLine.toRun = runIndex;
|
|
276952
276974
|
currentLine.toChar = charPosInRun;
|
|
@@ -277010,9 +277032,9 @@ async function measureParagraphBlock(block, maxWidth, resolvePhysical = resolveP
|
|
|
277010
277032
|
...dropCapMeasure ? { dropCap: dropCapMeasure } : {}
|
|
277011
277033
|
};
|
|
277012
277034
|
}
|
|
277013
|
-
async function measureTableBlock(block, constraints,
|
|
277035
|
+
async function measureTableBlock(block, constraints, fontContext) {
|
|
277014
277036
|
const workingInput = buildAutoFitWorkingGridInput(block, { maxWidth: typeof constraints === "number" ? constraints : constraints.maxWidth });
|
|
277015
|
-
const columnWidths = await resolveRuntimeTableColumnWidths(block, workingInput);
|
|
277037
|
+
const columnWidths = await resolveRuntimeTableColumnWidths(block, workingInput, fontContext);
|
|
277016
277038
|
const gridColumnCount = columnWidths.length;
|
|
277017
277039
|
const calculateCellWidth = (startCol, colspan) => {
|
|
277018
277040
|
let width = 0;
|
|
@@ -277063,7 +277085,7 @@ async function measureTableBlock(block, constraints, resolvePhysical = resolvePh
|
|
|
277063
277085
|
const measure = await measureBlock(block$1, {
|
|
277064
277086
|
maxWidth: contentWidth$1,
|
|
277065
277087
|
maxHeight: Infinity
|
|
277066
|
-
},
|
|
277088
|
+
}, fontContext);
|
|
277067
277089
|
blockMeasures.push(measure);
|
|
277068
277090
|
const blockHeight = "totalHeight" in measure ? measure.totalHeight : ("height" in measure) ? measure.height : 0;
|
|
277069
277091
|
if ((block$1.kind === "image" || block$1.kind === "drawing") && block$1.anchor?.isAnchored === true && (block$1.wrap?.type ?? "Inline") !== "Inline")
|
|
@@ -277151,14 +277173,15 @@ async function measureTableBlock(block, constraints, resolvePhysical = resolvePh
|
|
|
277151
277173
|
tableBorderWidths: borderWidthH > 0 || borderWidthV > 0 ? tableBorderWidths : undefined
|
|
277152
277174
|
};
|
|
277153
277175
|
}
|
|
277154
|
-
async function resolveRuntimeTableColumnWidths(block, workingInput) {
|
|
277176
|
+
async function resolveRuntimeTableColumnWidths(block, workingInput, fontContext) {
|
|
277155
277177
|
const fixedLayout = computeFixedTableColumnWidths(workingInput);
|
|
277156
277178
|
if (workingInput.layoutMode === "fixed")
|
|
277157
277179
|
return fixedLayout.columnWidths;
|
|
277158
|
-
const { contentMetrics, cellMetricKeys } = await buildMeasuredAutoFitContentMetrics(block, workingInput, fixedLayout);
|
|
277180
|
+
const { contentMetrics, cellMetricKeys } = await buildMeasuredAutoFitContentMetrics(block, workingInput, fixedLayout, fontContext);
|
|
277159
277181
|
const cacheKey = buildAutoFitTableResultCacheKey(block, {
|
|
277160
277182
|
maxWidth: workingInput.maxTableWidth,
|
|
277161
277183
|
cellMetricKeys,
|
|
277184
|
+
fontSignature: fontContext.fontSignature,
|
|
277162
277185
|
workingInput,
|
|
277163
277186
|
fixedLayout
|
|
277164
277187
|
});
|
|
@@ -277176,8 +277199,9 @@ async function resolveRuntimeTableColumnWidths(block, workingInput) {
|
|
|
277176
277199
|
});
|
|
277177
277200
|
return result.columnWidths;
|
|
277178
277201
|
}
|
|
277179
|
-
async function buildMeasuredAutoFitContentMetrics(block, workingInput, fixedLayout) {
|
|
277180
|
-
const
|
|
277202
|
+
async function buildMeasuredAutoFitContentMetrics(block, workingInput, fixedLayout, fontContext) {
|
|
277203
|
+
const measureBlockWithFontContext = (childBlock, childConstraints) => measureBlock(childBlock, childConstraints, fontContext);
|
|
277204
|
+
const contentMetrics = await measureTableAutoFitContentMetrics(block, workingInput, fixedLayout, measureBlockWithFontContext, fontContext);
|
|
277181
277205
|
return {
|
|
277182
277206
|
contentMetrics,
|
|
277183
277207
|
cellMetricKeys: contentMetrics.cellMetricKeys
|
|
@@ -277291,7 +277315,7 @@ function normalizeConstraints(constraints) {
|
|
|
277291
277315
|
return { maxWidth: constraints };
|
|
277292
277316
|
return constraints;
|
|
277293
277317
|
}
|
|
277294
|
-
async function measureListBlock(block, constraints,
|
|
277318
|
+
async function measureListBlock(block, constraints, fontContext) {
|
|
277295
277319
|
const ctx$1 = getCanvasContext();
|
|
277296
277320
|
const items = [];
|
|
277297
277321
|
let totalHeight = 0;
|
|
@@ -277310,12 +277334,12 @@ async function measureListBlock(block, constraints, resolvePhysical = resolvePhy
|
|
|
277310
277334
|
bold: marker.run.bold,
|
|
277311
277335
|
italic: marker.run.italic,
|
|
277312
277336
|
letterSpacing: marker.run.letterSpacing
|
|
277313
|
-
},
|
|
277337
|
+
}, fontContext);
|
|
277314
277338
|
markerTextWidth = marker.markerText ? measureText(marker.markerText, markerFont, ctx$1) : 0;
|
|
277315
277339
|
markerWidth = 0;
|
|
277316
277340
|
indentLeft = wordLayout.indentLeftPx ?? 0;
|
|
277317
277341
|
} else {
|
|
277318
|
-
const { font: markerFont } = buildFontString(getPrimaryRun(item.paragraph),
|
|
277342
|
+
const { font: markerFont } = buildFontString(getPrimaryRun(item.paragraph), fontContext);
|
|
277319
277343
|
const markerText = item.marker.text ?? "";
|
|
277320
277344
|
markerTextWidth = markerText ? measureText(markerText, markerFont, ctx$1) : 0;
|
|
277321
277345
|
indentLeft = resolveIndentLeft(item);
|
|
@@ -277323,7 +277347,7 @@ async function measureListBlock(block, constraints, resolvePhysical = resolvePhy
|
|
|
277323
277347
|
markerWidth = Math.max(24, markerTextWidth + 8, indentHanging);
|
|
277324
277348
|
}
|
|
277325
277349
|
const paragraphWidth = Math.max(1, constraints.maxWidth - indentLeft - markerWidth);
|
|
277326
|
-
const paragraphMeasure = await measureParagraphBlock(item.paragraph, paragraphWidth,
|
|
277350
|
+
const paragraphMeasure = await measureParagraphBlock(item.paragraph, paragraphWidth, fontContext);
|
|
277327
277351
|
totalHeight += paragraphMeasure.totalHeight;
|
|
277328
277352
|
items.push({
|
|
277329
277353
|
itemId: item.id,
|
|
@@ -277374,15 +277398,18 @@ async function layoutPerRIdHeaderFooters(headerFooterInput, layout, sectionMetad
|
|
|
277374
277398
|
async function layoutBlocksByRId(kind, blocksByRId, referencedRIds, constraints, pageResolver, layoutsByRId, fontResolver) {
|
|
277375
277399
|
if (!blocksByRId || referencedRIds.size === 0)
|
|
277376
277400
|
return;
|
|
277377
|
-
const resolvePhysical = fontResolver ? (css) => fontResolver.resolvePhysicalFamily(css) : undefined;
|
|
277378
277401
|
const fontSignature = fontResolver?.signature ?? "";
|
|
277402
|
+
const fontMeasureContext = fontResolver ? {
|
|
277403
|
+
resolvePhysical: (css) => fontResolver.resolvePhysicalFamily(css),
|
|
277404
|
+
fontSignature
|
|
277405
|
+
} : undefined;
|
|
277379
277406
|
for (const [rId, blocks2] of blocksByRId) {
|
|
277380
277407
|
if (!referencedRIds.has(rId))
|
|
277381
277408
|
continue;
|
|
277382
277409
|
if (!blocks2 || blocks2.length === 0)
|
|
277383
277410
|
continue;
|
|
277384
277411
|
try {
|
|
277385
|
-
const batchResult = await layoutHeaderFooterWithCache({ default: blocks2 }, constraints, (block, c) => measureBlock(block, c,
|
|
277412
|
+
const batchResult = await layoutHeaderFooterWithCache({ default: blocks2 }, constraints, (block, c) => measureBlock(block, c, fontMeasureContext), undefined, undefined, pageResolver, kind, fontSignature);
|
|
277386
277413
|
if (batchResult.default)
|
|
277387
277414
|
layoutsByRId.set(rId, {
|
|
277388
277415
|
kind,
|
|
@@ -277431,15 +277458,18 @@ function adjustFramePositionsForContentWidth(layout, blocks2, effectiveWidth, co
|
|
|
277431
277458
|
async function layoutWithPerSectionConstraints(kind, blocksByRId, sectionMetadata, fallbackConstraints, pageResolver, layoutsByRId, fontResolver) {
|
|
277432
277459
|
if (!blocksByRId)
|
|
277433
277460
|
return;
|
|
277434
|
-
const resolvePhysical = fontResolver ? (css) => fontResolver.resolvePhysicalFamily(css) : undefined;
|
|
277435
277461
|
const fontSignature = fontResolver?.signature ?? "";
|
|
277462
|
+
const fontMeasureContext = fontResolver ? {
|
|
277463
|
+
resolvePhysical: (css) => fontResolver.resolvePhysicalFamily(css),
|
|
277464
|
+
fontSignature
|
|
277465
|
+
} : undefined;
|
|
277436
277466
|
const groups = buildSectionAwareHeaderFooterMeasurementGroups(kind, blocksByRId, sectionMetadata, fallbackConstraints);
|
|
277437
277467
|
for (const group of groups) {
|
|
277438
277468
|
const blocks2 = blocksByRId.get(group.rId);
|
|
277439
277469
|
if (!blocks2 || blocks2.length === 0)
|
|
277440
277470
|
continue;
|
|
277441
277471
|
try {
|
|
277442
|
-
const batchResult = await layoutHeaderFooterWithCache({ default: blocks2 }, group.sectionConstraints, (block, c) => measureBlock(block, c,
|
|
277472
|
+
const batchResult = await layoutHeaderFooterWithCache({ default: blocks2 }, group.sectionConstraints, (block, c) => measureBlock(block, c, fontMeasureContext), undefined, undefined, pageResolver, kind, fontSignature);
|
|
277443
277473
|
if (batchResult.default)
|
|
277444
277474
|
for (const sectionIndex of group.sectionIndices) {
|
|
277445
277475
|
const contentWidth = buildSectionContentWidth(sectionMetadata.find((s2) => s2.sectionIndex === sectionIndex), fallbackConstraints);
|
|
@@ -278089,6 +278119,16 @@ function defaultInvalidate() {
|
|
|
278089
278119
|
clearTextMeasurementCaches();
|
|
278090
278120
|
measureCache.clear();
|
|
278091
278121
|
}
|
|
278122
|
+
function toCssFontSource(url2) {
|
|
278123
|
+
return /^\s*url\(/i.test(url2) ? url2 : `url(${JSON.stringify(url2)})`;
|
|
278124
|
+
}
|
|
278125
|
+
function defaultScheduleMicrotask(callback) {
|
|
278126
|
+
if (typeof queueMicrotask === "function") {
|
|
278127
|
+
queueMicrotask(callback);
|
|
278128
|
+
return;
|
|
278129
|
+
}
|
|
278130
|
+
Promise.resolve().then(callback);
|
|
278131
|
+
}
|
|
278092
278132
|
function faceKey(req) {
|
|
278093
278133
|
return `${req.family.toLowerCase()}|${req.weight}|${req.style}`;
|
|
278094
278134
|
}
|
|
@@ -299242,7 +299282,370 @@ menclose::after {
|
|
|
299242
299282
|
const minReadablePx = getMinimumReadableTextStartPx(markerContentEndPx, gutterWidthPx);
|
|
299243
299283
|
return Math.max(nextTabStopPx, minReadablePx);
|
|
299244
299284
|
}
|
|
299245
|
-
},
|
|
299285
|
+
}, SETTLED_STATUSES, BUNDLED_SUBSTITUTES, FontResolver = class {
|
|
299286
|
+
#overrides = /* @__PURE__ */ new Map;
|
|
299287
|
+
#version = 0;
|
|
299288
|
+
#cachedSignature = null;
|
|
299289
|
+
map(logicalFamily, physicalFamily) {
|
|
299290
|
+
const key2 = normalizeFamilyKey$2(logicalFamily);
|
|
299291
|
+
const physical = physicalFamily?.trim();
|
|
299292
|
+
if (!key2 || !physical)
|
|
299293
|
+
return;
|
|
299294
|
+
if (this.#overrides.get(key2) === physical)
|
|
299295
|
+
return;
|
|
299296
|
+
if ((BUNDLED_SUBSTITUTES[key2] ?? logicalFamily.trim()) === physical) {
|
|
299297
|
+
if (this.#overrides.delete(key2)) {
|
|
299298
|
+
this.#version += 1;
|
|
299299
|
+
this.#cachedSignature = null;
|
|
299300
|
+
}
|
|
299301
|
+
return;
|
|
299302
|
+
}
|
|
299303
|
+
this.#overrides.set(key2, physical);
|
|
299304
|
+
this.#version += 1;
|
|
299305
|
+
this.#cachedSignature = null;
|
|
299306
|
+
}
|
|
299307
|
+
unmap(logicalFamily) {
|
|
299308
|
+
if (this.#overrides.delete(normalizeFamilyKey$2(logicalFamily))) {
|
|
299309
|
+
this.#version += 1;
|
|
299310
|
+
this.#cachedSignature = null;
|
|
299311
|
+
}
|
|
299312
|
+
}
|
|
299313
|
+
reset() {
|
|
299314
|
+
if (this.#overrides.size === 0)
|
|
299315
|
+
return;
|
|
299316
|
+
this.#overrides.clear();
|
|
299317
|
+
this.#version += 1;
|
|
299318
|
+
this.#cachedSignature = null;
|
|
299319
|
+
}
|
|
299320
|
+
get version() {
|
|
299321
|
+
return this.#version;
|
|
299322
|
+
}
|
|
299323
|
+
get signature() {
|
|
299324
|
+
if (this.#cachedSignature !== null)
|
|
299325
|
+
return this.#cachedSignature;
|
|
299326
|
+
this.#cachedSignature = this.#overrides.size === 0 ? "" : JSON.stringify([...this.#overrides.entries()].sort(([a2], [b$1]) => a2 < b$1 ? -1 : a2 > b$1 ? 1 : 0));
|
|
299327
|
+
return this.#cachedSignature;
|
|
299328
|
+
}
|
|
299329
|
+
#physicalFor(bareFamily) {
|
|
299330
|
+
const key2 = normalizeFamilyKey$2(bareFamily);
|
|
299331
|
+
const override = this.#overrides.get(key2);
|
|
299332
|
+
if (override)
|
|
299333
|
+
return {
|
|
299334
|
+
physical: override,
|
|
299335
|
+
reason: "custom_mapping"
|
|
299336
|
+
};
|
|
299337
|
+
const bundled = BUNDLED_SUBSTITUTES[key2];
|
|
299338
|
+
if (bundled)
|
|
299339
|
+
return {
|
|
299340
|
+
physical: bundled,
|
|
299341
|
+
reason: "bundled_substitute"
|
|
299342
|
+
};
|
|
299343
|
+
return {
|
|
299344
|
+
physical: bareFamily,
|
|
299345
|
+
reason: "as_requested"
|
|
299346
|
+
};
|
|
299347
|
+
}
|
|
299348
|
+
resolveFontFamily(logicalFamily) {
|
|
299349
|
+
const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
|
|
299350
|
+
const { physical, reason } = this.#physicalFor(primary);
|
|
299351
|
+
return {
|
|
299352
|
+
logicalFamily,
|
|
299353
|
+
physicalFamily: physical,
|
|
299354
|
+
reason
|
|
299355
|
+
};
|
|
299356
|
+
}
|
|
299357
|
+
resolvePhysicalFamily(cssFontFamily) {
|
|
299358
|
+
if (!cssFontFamily)
|
|
299359
|
+
return cssFontFamily;
|
|
299360
|
+
const parts = splitStack(cssFontFamily);
|
|
299361
|
+
if (parts.length === 0)
|
|
299362
|
+
return cssFontFamily;
|
|
299363
|
+
const { physical, reason } = this.#physicalFor(parts[0]);
|
|
299364
|
+
if (reason === "as_requested")
|
|
299365
|
+
return cssFontFamily;
|
|
299366
|
+
return [physical, ...parts.slice(1)].join(", ");
|
|
299367
|
+
}
|
|
299368
|
+
resolvePrimaryPhysicalFamily(family$1) {
|
|
299369
|
+
const primary = splitStack(family$1)[0] ?? family$1;
|
|
299370
|
+
return this.#physicalFor(primary).physical;
|
|
299371
|
+
}
|
|
299372
|
+
resolvePhysicalFamilies(families) {
|
|
299373
|
+
const out = /* @__PURE__ */ new Set;
|
|
299374
|
+
for (const family$1 of families)
|
|
299375
|
+
if (family$1)
|
|
299376
|
+
out.add(this.resolvePrimaryPhysicalFamily(family$1));
|
|
299377
|
+
return [...out];
|
|
299378
|
+
}
|
|
299379
|
+
}, defaultResolver, DEFAULT_FONT_MEASURE_CONTEXT, fontConfigVersion = 0, BUNDLED_MANIFEST, defaultAssetBase = "/fonts/", installedRegistries, DEFAULT_FONT_LOAD_TIMEOUT_MS = 3000, DEFAULT_PROBE_SIZE = "16px", FontRegistry = class {
|
|
299380
|
+
#fontSet;
|
|
299381
|
+
#FontFaceCtor;
|
|
299382
|
+
#probeSize;
|
|
299383
|
+
#scheduleTimeout;
|
|
299384
|
+
#cancelTimeout;
|
|
299385
|
+
#managed = /* @__PURE__ */ new Map;
|
|
299386
|
+
#status = /* @__PURE__ */ new Map;
|
|
299387
|
+
#sources = /* @__PURE__ */ new Map;
|
|
299388
|
+
#warnedFailures = /* @__PURE__ */ new Set;
|
|
299389
|
+
#inflight = /* @__PURE__ */ new Map;
|
|
299390
|
+
#faceStatus = /* @__PURE__ */ new Map;
|
|
299391
|
+
#faceInflight = /* @__PURE__ */ new Map;
|
|
299392
|
+
#faceSources = /* @__PURE__ */ new Map;
|
|
299393
|
+
#facesByFamily = /* @__PURE__ */ new Map;
|
|
299394
|
+
#warnedFaceFailures = /* @__PURE__ */ new Set;
|
|
299395
|
+
constructor(options = {}) {
|
|
299396
|
+
this.#fontSet = options.fontSet ?? null;
|
|
299397
|
+
this.#FontFaceCtor = options.FontFaceCtor ?? null;
|
|
299398
|
+
this.#probeSize = options.probeSize ?? DEFAULT_PROBE_SIZE;
|
|
299399
|
+
this.#scheduleTimeout = options.scheduleTimeout ?? ((cb, ms) => globalThis.setTimeout(cb, ms));
|
|
299400
|
+
this.#cancelTimeout = options.cancelTimeout ?? ((handle3) => globalThis.clearTimeout(handle3));
|
|
299401
|
+
}
|
|
299402
|
+
register(descriptor) {
|
|
299403
|
+
const { family: family$1, source, descriptors: descriptors2 } = descriptor;
|
|
299404
|
+
const identitySource = typeof source === "string" ? canonicalizeFontSource(source) : source;
|
|
299405
|
+
const key2 = faceKeyOf$1(family$1, normalizeWeight(descriptors2?.weight), normalizeStyle$1(descriptors2?.style));
|
|
299406
|
+
if (typeof identitySource === "string") {
|
|
299407
|
+
const existingSource = this.#faceSources.get(key2);
|
|
299408
|
+
if (existingSource === identitySource)
|
|
299409
|
+
return {
|
|
299410
|
+
family: family$1,
|
|
299411
|
+
status: this.getStatus(family$1),
|
|
299412
|
+
changed: false
|
|
299413
|
+
};
|
|
299414
|
+
if (existingSource !== undefined)
|
|
299415
|
+
throw new Error(`[superdoc] font face "${key2}" is already registered from a different source ("${existingSource}"); a registered face's source cannot be replaced`);
|
|
299416
|
+
}
|
|
299417
|
+
if (this.#FontFaceCtor && this.#fontSet) {
|
|
299418
|
+
const face = new this.#FontFaceCtor(family$1, source, descriptors2);
|
|
299419
|
+
this.#fontSet.add(face);
|
|
299420
|
+
this.#managed.set(family$1, face);
|
|
299421
|
+
}
|
|
299422
|
+
if (typeof source === "string") {
|
|
299423
|
+
const list5 = this.#sources.get(family$1) ?? [];
|
|
299424
|
+
if (!list5.includes(source))
|
|
299425
|
+
list5.push(source);
|
|
299426
|
+
this.#sources.set(family$1, list5);
|
|
299427
|
+
}
|
|
299428
|
+
if (!this.#status.has(family$1))
|
|
299429
|
+
this.#status.set(family$1, "unloaded");
|
|
299430
|
+
this.#trackFace(family$1, key2);
|
|
299431
|
+
if (!this.#faceStatus.has(key2))
|
|
299432
|
+
this.#faceStatus.set(key2, "unloaded");
|
|
299433
|
+
if (typeof identitySource === "string" && !this.#faceSources.has(key2))
|
|
299434
|
+
this.#faceSources.set(key2, identitySource);
|
|
299435
|
+
return {
|
|
299436
|
+
family: family$1,
|
|
299437
|
+
status: this.getStatus(family$1),
|
|
299438
|
+
changed: true
|
|
299439
|
+
};
|
|
299440
|
+
}
|
|
299441
|
+
#trackFace(family$1, key2) {
|
|
299442
|
+
const fam = normalizeFamilyKey$1(family$1);
|
|
299443
|
+
const set3 = this.#facesByFamily.get(fam) ?? /* @__PURE__ */ new Set;
|
|
299444
|
+
set3.add(key2);
|
|
299445
|
+
this.#facesByFamily.set(fam, set3);
|
|
299446
|
+
}
|
|
299447
|
+
isManaged(family$1) {
|
|
299448
|
+
return this.#managed.has(family$1);
|
|
299449
|
+
}
|
|
299450
|
+
getStatus(family$1) {
|
|
299451
|
+
const statuses = [];
|
|
299452
|
+
const faceKeys = this.#facesByFamily.get(normalizeFamilyKey$1(family$1));
|
|
299453
|
+
if (faceKeys)
|
|
299454
|
+
for (const k$1 of faceKeys)
|
|
299455
|
+
statuses.push(this.#faceStatus.get(k$1) ?? "unloaded");
|
|
299456
|
+
const legacy = this.#status.get(family$1);
|
|
299457
|
+
if (legacy)
|
|
299458
|
+
statuses.push(legacy);
|
|
299459
|
+
if (statuses.length === 0)
|
|
299460
|
+
return "unloaded";
|
|
299461
|
+
for (const s2 of [
|
|
299462
|
+
"failed",
|
|
299463
|
+
"timed_out",
|
|
299464
|
+
"fallback_used",
|
|
299465
|
+
"loaded",
|
|
299466
|
+
"loading",
|
|
299467
|
+
"unloaded"
|
|
299468
|
+
])
|
|
299469
|
+
if (statuses.includes(s2))
|
|
299470
|
+
return s2;
|
|
299471
|
+
return "unloaded";
|
|
299472
|
+
}
|
|
299473
|
+
isAvailable(family$1) {
|
|
299474
|
+
if (!this.#fontSet)
|
|
299475
|
+
return false;
|
|
299476
|
+
try {
|
|
299477
|
+
return this.#fontSet.check(`${this.#probeSize} ${quoteFamily(family$1)}`);
|
|
299478
|
+
} catch {
|
|
299479
|
+
return false;
|
|
299480
|
+
}
|
|
299481
|
+
}
|
|
299482
|
+
awaitFace(family$1, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
|
|
299483
|
+
if (this.#status.get(family$1) === "loaded")
|
|
299484
|
+
return Promise.resolve({
|
|
299485
|
+
family: family$1,
|
|
299486
|
+
status: "loaded"
|
|
299487
|
+
});
|
|
299488
|
+
const existing = this.#inflight.get(family$1);
|
|
299489
|
+
if (existing)
|
|
299490
|
+
return existing;
|
|
299491
|
+
const probe = this.#loadOne(family$1, timeoutMs).finally(() => {
|
|
299492
|
+
this.#inflight.delete(family$1);
|
|
299493
|
+
});
|
|
299494
|
+
this.#inflight.set(family$1, probe);
|
|
299495
|
+
return probe;
|
|
299496
|
+
}
|
|
299497
|
+
async awaitFaces(families, options = {}) {
|
|
299498
|
+
const unique$2 = [...new Set(families)];
|
|
299499
|
+
const timeoutMs = options.timeoutMs ?? 3000;
|
|
299500
|
+
return Promise.all(unique$2.map((family$1) => this.awaitFace(family$1, timeoutMs)));
|
|
299501
|
+
}
|
|
299502
|
+
getRequiredFaces(families, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
|
|
299503
|
+
return [...new Set(families)].map((family$1) => ({
|
|
299504
|
+
family: family$1,
|
|
299505
|
+
status: this.getStatus(family$1),
|
|
299506
|
+
ready: this.awaitFace(family$1, timeoutMs)
|
|
299507
|
+
}));
|
|
299508
|
+
}
|
|
299509
|
+
getStates() {
|
|
299510
|
+
return [...this.#status.entries()].map(([family$1, status]) => ({
|
|
299511
|
+
family: family$1,
|
|
299512
|
+
status
|
|
299513
|
+
}));
|
|
299514
|
+
}
|
|
299515
|
+
getFaceStatus(request) {
|
|
299516
|
+
return this.#faceStatus.get(faceKeyOf$1(request.family, request.weight, request.style)) ?? "unloaded";
|
|
299517
|
+
}
|
|
299518
|
+
awaitFaceRequest(request, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
|
|
299519
|
+
const key2 = faceKeyOf$1(request.family, request.weight, request.style);
|
|
299520
|
+
if (this.#faceStatus.get(key2) === "loaded")
|
|
299521
|
+
return Promise.resolve({
|
|
299522
|
+
request,
|
|
299523
|
+
status: "loaded"
|
|
299524
|
+
});
|
|
299525
|
+
const existing = this.#faceInflight.get(key2);
|
|
299526
|
+
if (existing)
|
|
299527
|
+
return existing;
|
|
299528
|
+
const probe = this.#loadOneFace(request, key2, timeoutMs).finally(() => {
|
|
299529
|
+
this.#faceInflight.delete(key2);
|
|
299530
|
+
});
|
|
299531
|
+
this.#faceInflight.set(key2, probe);
|
|
299532
|
+
return probe;
|
|
299533
|
+
}
|
|
299534
|
+
async awaitFaceRequests(requests, options = {}) {
|
|
299535
|
+
const timeoutMs = options.timeoutMs ?? 3000;
|
|
299536
|
+
const seen = /* @__PURE__ */ new Set;
|
|
299537
|
+
const unique$2 = [];
|
|
299538
|
+
for (const r$1 of requests) {
|
|
299539
|
+
const key2 = faceKeyOf$1(r$1.family, r$1.weight, r$1.style);
|
|
299540
|
+
if (seen.has(key2))
|
|
299541
|
+
continue;
|
|
299542
|
+
seen.add(key2);
|
|
299543
|
+
unique$2.push(r$1);
|
|
299544
|
+
}
|
|
299545
|
+
return Promise.all(unique$2.map((r$1) => this.awaitFaceRequest(r$1, timeoutMs)));
|
|
299546
|
+
}
|
|
299547
|
+
async#loadOneFace(request, key2, timeoutMs) {
|
|
299548
|
+
this.#trackFace(request.family, key2);
|
|
299549
|
+
const fontSet = this.#fontSet;
|
|
299550
|
+
if (!fontSet) {
|
|
299551
|
+
this.#faceStatus.set(key2, "fallback_used");
|
|
299552
|
+
return {
|
|
299553
|
+
request,
|
|
299554
|
+
status: "fallback_used"
|
|
299555
|
+
};
|
|
299556
|
+
}
|
|
299557
|
+
this.#faceStatus.set(key2, "loading");
|
|
299558
|
+
const probe = faceProbe(request.family, request.weight, request.style, this.#probeSize);
|
|
299559
|
+
const TIMEOUT = Symbol("timeout");
|
|
299560
|
+
let handle3;
|
|
299561
|
+
const timeout$1 = new Promise((resolve2) => {
|
|
299562
|
+
handle3 = this.#scheduleTimeout(() => resolve2(TIMEOUT), timeoutMs);
|
|
299563
|
+
});
|
|
299564
|
+
try {
|
|
299565
|
+
const settled = await Promise.race([fontSet.load(probe), timeout$1]);
|
|
299566
|
+
if (settled === TIMEOUT) {
|
|
299567
|
+
this.#faceStatus.set(key2, "timed_out");
|
|
299568
|
+
return {
|
|
299569
|
+
request,
|
|
299570
|
+
status: "timed_out"
|
|
299571
|
+
};
|
|
299572
|
+
}
|
|
299573
|
+
const status = settled.length > 0 ? "loaded" : "fallback_used";
|
|
299574
|
+
this.#faceStatus.set(key2, status);
|
|
299575
|
+
return {
|
|
299576
|
+
request,
|
|
299577
|
+
status
|
|
299578
|
+
};
|
|
299579
|
+
} catch {
|
|
299580
|
+
this.#faceStatus.set(key2, "failed");
|
|
299581
|
+
this.#warnFaceFailureOnce(request, key2);
|
|
299582
|
+
return {
|
|
299583
|
+
request,
|
|
299584
|
+
status: "failed"
|
|
299585
|
+
};
|
|
299586
|
+
} finally {
|
|
299587
|
+
this.#cancelTimeout(handle3);
|
|
299588
|
+
}
|
|
299589
|
+
}
|
|
299590
|
+
#warnFaceFailureOnce(request, key2) {
|
|
299591
|
+
if (this.#warnedFaceFailures.has(key2))
|
|
299592
|
+
return;
|
|
299593
|
+
this.#warnedFaceFailures.add(key2);
|
|
299594
|
+
const src = this.#faceSources.get(key2);
|
|
299595
|
+
const detail = src ? ` from ${src}` : "";
|
|
299596
|
+
console.warn(`[superdoc] font face failed to load: "${request.family}" ${request.weight} ${request.style}${detail}. Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
|
|
299597
|
+
}
|
|
299598
|
+
async#loadOne(family$1, timeoutMs) {
|
|
299599
|
+
const fontSet = this.#fontSet;
|
|
299600
|
+
if (!fontSet) {
|
|
299601
|
+
this.#status.set(family$1, "fallback_used");
|
|
299602
|
+
return {
|
|
299603
|
+
family: family$1,
|
|
299604
|
+
status: "fallback_used"
|
|
299605
|
+
};
|
|
299606
|
+
}
|
|
299607
|
+
this.#status.set(family$1, "loading");
|
|
299608
|
+
const probe = `${this.#probeSize} ${quoteFamily(family$1)}`;
|
|
299609
|
+
const TIMEOUT = Symbol("timeout");
|
|
299610
|
+
let handle3;
|
|
299611
|
+
const timeout$1 = new Promise((resolve2) => {
|
|
299612
|
+
handle3 = this.#scheduleTimeout(() => resolve2(TIMEOUT), timeoutMs);
|
|
299613
|
+
});
|
|
299614
|
+
try {
|
|
299615
|
+
const settled = await Promise.race([fontSet.load(probe), timeout$1]);
|
|
299616
|
+
if (settled === TIMEOUT) {
|
|
299617
|
+
this.#status.set(family$1, "timed_out");
|
|
299618
|
+
return {
|
|
299619
|
+
family: family$1,
|
|
299620
|
+
status: "timed_out"
|
|
299621
|
+
};
|
|
299622
|
+
}
|
|
299623
|
+
const status = settled.length > 0 ? "loaded" : "fallback_used";
|
|
299624
|
+
this.#status.set(family$1, status);
|
|
299625
|
+
return {
|
|
299626
|
+
family: family$1,
|
|
299627
|
+
status
|
|
299628
|
+
};
|
|
299629
|
+
} catch {
|
|
299630
|
+
this.#status.set(family$1, "failed");
|
|
299631
|
+
this.#warnLoadFailureOnce(family$1);
|
|
299632
|
+
return {
|
|
299633
|
+
family: family$1,
|
|
299634
|
+
status: "failed"
|
|
299635
|
+
};
|
|
299636
|
+
} finally {
|
|
299637
|
+
this.#cancelTimeout(handle3);
|
|
299638
|
+
}
|
|
299639
|
+
}
|
|
299640
|
+
#warnLoadFailureOnce(family$1) {
|
|
299641
|
+
if (this.#warnedFailures.has(family$1))
|
|
299642
|
+
return;
|
|
299643
|
+
this.#warnedFailures.add(family$1);
|
|
299644
|
+
const sources = this.#sources.get(family$1);
|
|
299645
|
+
const detail = sources && sources.length ? ` from ${sources.join(", ")}` : "";
|
|
299646
|
+
console.warn(`[superdoc] font asset failed to load for "${family$1}"${detail}. Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
|
|
299647
|
+
}
|
|
299648
|
+
}, registriesByFontSet, domlessRegistry = null, hashParagraphBorder$2 = (border) => {
|
|
299246
299649
|
const parts = [];
|
|
299247
299650
|
if (border.style !== undefined)
|
|
299248
299651
|
parts.push(`s:${border.style}`);
|
|
@@ -299559,7 +299962,7 @@ menclose::after {
|
|
|
299559
299962
|
if (typeof value !== "number" || !Number.isFinite(value) || value < 0)
|
|
299560
299963
|
return;
|
|
299561
299964
|
return value;
|
|
299562
|
-
}, resolvePainterMarkerTextWidth = (markerTextWidthPx, marker) => getFiniteNonNegativeNumber(markerTextWidthPx) ?? getFiniteNonNegativeNumber(marker.glyphWidthPx) ?? getFiniteNonNegativeNumber(marker.markerBoxWidthPx) ?? 0, resolvePainterListMarkerGeometry = ({ wordLayout, indentLeftPx, hangingIndentPx, firstLineIndentPx, markerTextWidthPx }) => resolveListMarkerGeometry(wordLayout, indentLeftPx, firstLineIndentPx, hangingIndentPx, (_markerText, marker) => resolvePainterMarkerTextWidth(markerTextWidthPx, marker)), resolvePainterListTextStartPx = ({ wordLayout, indentLeftPx, hangingIndentPx, firstLineIndentPx, markerTextWidthPx }) => resolveListTextStartPx(wordLayout, indentLeftPx, firstLineIndentPx, hangingIndentPx, (_markerText, marker) => resolvePainterMarkerTextWidth(markerTextWidthPx, marker)), isMarkerSuffix = (suffix) => suffix === "tab" || suffix === "space" || suffix === "nothing", createListMarkerElement = (doc$12, markerText, run2, sourceAnchor) => {
|
|
299965
|
+
}, resolvePainterMarkerTextWidth = (markerTextWidthPx, marker) => getFiniteNonNegativeNumber(markerTextWidthPx) ?? getFiniteNonNegativeNumber(marker.glyphWidthPx) ?? getFiniteNonNegativeNumber(marker.markerBoxWidthPx) ?? 0, resolvePainterListMarkerGeometry = ({ wordLayout, indentLeftPx, hangingIndentPx, firstLineIndentPx, markerTextWidthPx }) => resolveListMarkerGeometry(wordLayout, indentLeftPx, firstLineIndentPx, hangingIndentPx, (_markerText, marker) => resolvePainterMarkerTextWidth(markerTextWidthPx, marker)), resolvePainterListTextStartPx = ({ wordLayout, indentLeftPx, hangingIndentPx, firstLineIndentPx, markerTextWidthPx }) => resolveListTextStartPx(wordLayout, indentLeftPx, firstLineIndentPx, hangingIndentPx, (_markerText, marker) => resolvePainterMarkerTextWidth(markerTextWidthPx, marker)), isMarkerSuffix = (suffix) => suffix === "tab" || suffix === "space" || suffix === "nothing", createListMarkerElement = (doc$12, markerText, run2, sourceAnchor, resolvePhysical = resolvePhysicalFamily) => {
|
|
299563
299966
|
const markerContainer = doc$12.createElement("span");
|
|
299564
299967
|
markerContainer.classList.add(DOM_CLASS_NAMES.LIST_MARKER);
|
|
299565
299968
|
markerContainer.style.display = "inline-block";
|
|
@@ -299568,7 +299971,8 @@ menclose::after {
|
|
|
299568
299971
|
markerEl.classList.add("superdoc-paragraph-marker");
|
|
299569
299972
|
markerEl.textContent = markerText;
|
|
299570
299973
|
markerEl.style.pointerEvents = "none";
|
|
299571
|
-
|
|
299974
|
+
const cssFontFamily = toCssFontFamily(run2.fontFamily) ?? run2.fontFamily ?? "";
|
|
299975
|
+
markerEl.style.fontFamily = resolvePhysical(cssFontFamily);
|
|
299572
299976
|
if (run2.fontSize != null)
|
|
299573
299977
|
markerEl.style.fontSize = `${run2.fontSize}px`;
|
|
299574
299978
|
markerEl.style.fontWeight = run2.bold ? "bold" : "";
|
|
@@ -299586,7 +299990,7 @@ menclose::after {
|
|
|
299586
299990
|
applySourceAnchorDataset(markerEl, sourceAnchor);
|
|
299587
299991
|
return markerContainer;
|
|
299588
299992
|
}, renderLegacyListMarker = (params$1) => {
|
|
299589
|
-
const { doc: doc$12, lineEl, wordLayout, markerLayout, markerMeasure, markerTextWidthPx, indentLeftPx, hangingIndentPx, firstLineIndentPx, isRtl, sourceAnchor } = params$1;
|
|
299993
|
+
const { doc: doc$12, lineEl, wordLayout, markerLayout, markerMeasure, markerTextWidthPx, indentLeftPx, hangingIndentPx, firstLineIndentPx, isRtl, sourceAnchor, resolvePhysical = resolvePhysicalFamily } = params$1;
|
|
299590
299994
|
const markerTextWidth = markerTextWidthPx ?? markerMeasure?.markerTextWidth ?? 0;
|
|
299591
299995
|
const markerGeometry = markerLayout?.justification === "left" && wordLayout?.firstLineIndentMode !== true && typeof markerTextWidth === "number" && Number.isFinite(markerTextWidth) && markerTextWidth >= 0 ? resolvePainterListMarkerGeometry({
|
|
299592
299996
|
wordLayout,
|
|
@@ -299623,7 +300027,7 @@ menclose::after {
|
|
|
299623
300027
|
lineEl.style.paddingLeft = `${anchorPoint}px`;
|
|
299624
300028
|
if (markerLayout?.run?.vanish)
|
|
299625
300029
|
return;
|
|
299626
|
-
const markerContainer = createListMarkerElement(doc$12, markerLayout?.markerText ?? "", markerLayout?.run ?? {}, sourceAnchor);
|
|
300030
|
+
const markerContainer = createListMarkerElement(doc$12, markerLayout?.markerText ?? "", markerLayout?.run ?? {}, sourceAnchor, resolvePhysical);
|
|
299627
300031
|
markerContainer.style.position = "relative";
|
|
299628
300032
|
if (markerJustification === "right") {
|
|
299629
300033
|
markerContainer.style.position = "absolute";
|
|
@@ -299644,14 +300048,14 @@ menclose::after {
|
|
|
299644
300048
|
prependMarkerSuffix(doc$12, lineEl, isMarkerSuffix(suffix) ? suffix : undefined, suffixWidthPx, markerLayout?.run?.fontSize);
|
|
299645
300049
|
lineEl.prepend(markerContainer);
|
|
299646
300050
|
}, renderResolvedListMarker = (params$1) => {
|
|
299647
|
-
const { doc: doc$12, lineEl, marker, isRtl, sourceAnchor } = params$1;
|
|
300051
|
+
const { doc: doc$12, lineEl, marker, isRtl, sourceAnchor, resolvePhysical = resolvePhysicalFamily } = params$1;
|
|
299648
300052
|
if (isRtl)
|
|
299649
300053
|
lineEl.style.paddingRight = `${marker.firstLinePaddingLeftPx}px`;
|
|
299650
300054
|
else
|
|
299651
300055
|
lineEl.style.paddingLeft = `${marker.firstLinePaddingLeftPx}px`;
|
|
299652
300056
|
if (marker.vanish)
|
|
299653
300057
|
return;
|
|
299654
|
-
const markerContainer = createListMarkerElement(doc$12, marker.text, marker.run, marker.sourceAnchor ?? sourceAnchor);
|
|
300058
|
+
const markerContainer = createListMarkerElement(doc$12, marker.text, marker.run, marker.sourceAnchor ?? sourceAnchor, resolvePhysical);
|
|
299655
300059
|
markerContainer.style.position = "relative";
|
|
299656
300060
|
if (marker.justification === "right") {
|
|
299657
300061
|
markerContainer.style.position = "absolute";
|
|
@@ -299919,7 +300323,7 @@ menclose::after {
|
|
|
299919
300323
|
skipJustifyOverride: (resolvedLine?.skipJustify ?? false) || hasMultipleExplicitPositionedSegments
|
|
299920
300324
|
}) ? Math.max(lineWidth, availableWidth) : lineWidth;
|
|
299921
300325
|
}, renderResolvedLines = (params$1) => {
|
|
299922
|
-
const { frameEl, block, resolvedContent: content3, markerTextWidth, renderLine: renderLine$1, captureLineSnapshot, convertFinalParagraphMark, lineTopOffset = 0, sourceAnchor } = params$1;
|
|
300326
|
+
const { frameEl, block, resolvedContent: content3, markerTextWidth, renderLine: renderLine$1, captureLineSnapshot, convertFinalParagraphMark, lineTopOffset = 0, sourceAnchor, resolvePhysical = resolvePhysicalFamily } = params$1;
|
|
299923
300327
|
const renderedLines = [];
|
|
299924
300328
|
const resolvedMarker = content3.marker;
|
|
299925
300329
|
const expandedRunsForBlock = expandRunsForInlineNewlines(block.runs);
|
|
@@ -299949,7 +300353,8 @@ menclose::after {
|
|
|
299949
300353
|
lineEl,
|
|
299950
300354
|
marker: resolvedMarker,
|
|
299951
300355
|
isRtl,
|
|
299952
|
-
sourceAnchor
|
|
300356
|
+
sourceAnchor,
|
|
300357
|
+
resolvePhysical
|
|
299953
300358
|
});
|
|
299954
300359
|
if (convertFinalParagraphMark && index2 === content3.lines.length - 1 && !content3.continuesOnNext)
|
|
299955
300360
|
convertParagraphMarkToCellMark(lineEl);
|
|
@@ -299972,7 +300377,7 @@ menclose::after {
|
|
|
299972
300377
|
renderedLines
|
|
299973
300378
|
};
|
|
299974
300379
|
}, renderMeasuredLines = (params$1) => {
|
|
299975
|
-
const { doc: doc$12, frameEl, block, measure, containerKind, width, localStartLine, localEndLine, linesOverride, lineIndexOffset = 0, continuesFromPrev, continuesOnNext, markerWidth, markerTextWidth, wordLayout, renderLine: renderLine$1, captureLineSnapshot, convertFinalParagraphMark, lineTopOffset = 0, sourceAnchor } = params$1;
|
|
300380
|
+
const { doc: doc$12, frameEl, block, measure, containerKind, width, localStartLine, localEndLine, linesOverride, lineIndexOffset = 0, continuesFromPrev, continuesOnNext, markerWidth, markerTextWidth, wordLayout, renderLine: renderLine$1, captureLineSnapshot, convertFinalParagraphMark, lineTopOffset = 0, sourceAnchor, resolvePhysical = resolvePhysicalFamily } = params$1;
|
|
299976
300381
|
const lines = linesOverride ?? measure.lines ?? [];
|
|
299977
300382
|
const paraIndent = block.attrs?.indent;
|
|
299978
300383
|
const paraIndentLeft = paraIndent?.left ?? 0;
|
|
@@ -300046,7 +300451,8 @@ menclose::after {
|
|
|
300046
300451
|
hangingIndentPx: markerHanging,
|
|
300047
300452
|
firstLineIndentPx: markerFirstLine,
|
|
300048
300453
|
isRtl,
|
|
300049
|
-
sourceAnchor
|
|
300454
|
+
sourceAnchor,
|
|
300455
|
+
resolvePhysical
|
|
300050
300456
|
});
|
|
300051
300457
|
} else
|
|
300052
300458
|
applyParagraphLineIndentation({
|
|
@@ -300200,7 +300606,7 @@ menclose::after {
|
|
|
300200
300606
|
hasSdtContainerChrome
|
|
300201
300607
|
};
|
|
300202
300608
|
}, renderTableCell = (deps) => {
|
|
300203
|
-
const { doc: doc$12, x, y: y$1, rowHeight, cellMeasure, cell: cell2, borders, useDefaultBorder, renderLine: renderLine$1, captureLineSnapshot, renderDrawingContent, context, applySdtDataset: applySdtDataset$1, chrome: chrome2, ancestorContainerKey, ancestorContainerSdt, ancestorContainerKeys, ancestorContainerSdts, onSdtContainerChrome, tableIndent, isRtl, cellWidth, fromLine, toLine } = deps;
|
|
300609
|
+
const { doc: doc$12, x, y: y$1, rowHeight, cellMeasure, cell: cell2, borders, useDefaultBorder, renderLine: renderLine$1, captureLineSnapshot, renderDrawingContent, context, applySdtDataset: applySdtDataset$1, chrome: chrome2, ancestorContainerKey, ancestorContainerSdt, ancestorContainerKeys, ancestorContainerSdts, onSdtContainerChrome, tableIndent, isRtl, cellWidth, fromLine, toLine, resolvePhysical } = deps;
|
|
300204
300610
|
const padding = cell2?.attrs?.padding || {
|
|
300205
300611
|
top: 0,
|
|
300206
300612
|
left: 4,
|
|
@@ -300452,6 +300858,7 @@ menclose::after {
|
|
|
300452
300858
|
},
|
|
300453
300859
|
contentControlsChrome: chrome2,
|
|
300454
300860
|
applySdtDataset: applySdtDataset$1,
|
|
300861
|
+
resolvePhysical,
|
|
300455
300862
|
renderLine: ({ block: block$1, line, lineIndex, isLastLine, resolvedListTextStartPx }) => renderLine$1(block$1, line, {
|
|
300456
300863
|
...context,
|
|
300457
300864
|
section: "body"
|
|
@@ -300628,7 +301035,7 @@ menclose::after {
|
|
|
300628
301035
|
left: baseBorders.left
|
|
300629
301036
|
};
|
|
300630
301037
|
}, renderTableRow = (deps) => {
|
|
300631
|
-
const { doc: doc$12, container, rowIndex, y: y$1, rowMeasure, row: row2, totalRows, tableBorders, columnWidths, allRowHeights, tableIndent, isRtl, context, renderLine: renderLine$1, captureLineSnapshot, renderDrawingContent, applySdtDataset: applySdtDataset$1, ancestorContainerKey, ancestorContainerSdt, ancestorContainerKeys, ancestorContainerSdts, onSdtContainerChrome, continuesFromPrev, continuesOnNext, partialRow, cellSpacingPx = 0, chrome: chrome2 } = deps;
|
|
301038
|
+
const { doc: doc$12, container, rowIndex, y: y$1, rowMeasure, row: row2, totalRows, tableBorders, columnWidths, allRowHeights, tableIndent, isRtl, context, renderLine: renderLine$1, captureLineSnapshot, renderDrawingContent, applySdtDataset: applySdtDataset$1, ancestorContainerKey, ancestorContainerSdt, ancestorContainerKeys, ancestorContainerSdts, onSdtContainerChrome, continuesFromPrev, continuesOnNext, partialRow, cellSpacingPx = 0, chrome: chrome2, resolvePhysical } = deps;
|
|
300632
301039
|
const totalCols = columnWidths.length;
|
|
300633
301040
|
const calculateXPosition = (gridColumnStart) => {
|
|
300634
301041
|
let x = cellSpacingPx;
|
|
@@ -300715,12 +301122,13 @@ menclose::after {
|
|
|
300715
301122
|
tableIndent,
|
|
300716
301123
|
isRtl,
|
|
300717
301124
|
cellWidth: computedCellWidth > 0 ? computedCellWidth : undefined,
|
|
300718
|
-
chrome: chrome2
|
|
301125
|
+
chrome: chrome2,
|
|
301126
|
+
resolvePhysical
|
|
300719
301127
|
});
|
|
300720
301128
|
container.appendChild(cellElement);
|
|
300721
301129
|
}
|
|
300722
301130
|
}, renderTableFragment = (deps) => {
|
|
300723
|
-
const { doc: doc$12, fragment, block, measure, cellSpacingPx, effectiveColumnWidths, chrome: chrome2, context, sdtBoundary, ancestorContainerKey, ancestorContainerSdt, ancestorContainerKeys, ancestorContainerSdts, onSdtContainerChrome, renderLine: renderLine$1, captureLineSnapshot, renderDrawingContent, applyFragmentFrame, applySdtDataset: applySdtDataset$1, applyContainerSdtDataset: applyContainerSdtDataset$1, applyStyles: applyStyles$3 } = deps;
|
|
301131
|
+
const { doc: doc$12, fragment, block, measure, cellSpacingPx, effectiveColumnWidths, chrome: chrome2, context, sdtBoundary, ancestorContainerKey, ancestorContainerSdt, ancestorContainerKeys, ancestorContainerSdts, onSdtContainerChrome, renderLine: renderLine$1, captureLineSnapshot, renderDrawingContent, applyFragmentFrame, applySdtDataset: applySdtDataset$1, applyContainerSdtDataset: applyContainerSdtDataset$1, applyStyles: applyStyles$3, resolvePhysical } = deps;
|
|
300724
301132
|
if (!doc$12) {
|
|
300725
301133
|
console.error("DomPainter: document is not available");
|
|
300726
301134
|
if (typeof document !== "undefined") {
|
|
@@ -300902,7 +301310,8 @@ menclose::after {
|
|
|
300902
301310
|
chrome: chrome2,
|
|
300903
301311
|
continuesFromPrev: false,
|
|
300904
301312
|
continuesOnNext: false,
|
|
300905
|
-
cellSpacingPx
|
|
301313
|
+
cellSpacingPx,
|
|
301314
|
+
resolvePhysical
|
|
300906
301315
|
});
|
|
300907
301316
|
y$1 += rowMeasure.height + cellSpacingPx;
|
|
300908
301317
|
}
|
|
@@ -301020,7 +301429,8 @@ menclose::after {
|
|
|
301020
301429
|
continuesFromPrev: isFirstRenderedBodyRow && fragment.continuesFromPrev === true,
|
|
301021
301430
|
continuesOnNext: isLastRenderedBodyRow && fragment.continuesOnNext === true,
|
|
301022
301431
|
partialRow: partialRowData,
|
|
301023
|
-
cellSpacingPx
|
|
301432
|
+
cellSpacingPx,
|
|
301433
|
+
resolvePhysical
|
|
301024
301434
|
});
|
|
301025
301435
|
y$1 += actualRowHeight + cellSpacingPx;
|
|
301026
301436
|
}
|
|
@@ -301238,7 +301648,7 @@ menclose::after {
|
|
|
301238
301648
|
else
|
|
301239
301649
|
delete el.dataset.continuesOnNext;
|
|
301240
301650
|
}, isMinimalWordLayout$2 = (value) => isMinimalWordLayout(value), renderParagraphFragment = (params$1) => {
|
|
301241
|
-
const { doc: doc$12, fragment, sdtBoundary, betweenInfo, resolvedItem, applyStyles: applyStyles$3, applyResolvedFragmentFrame, applyFragmentFrame, applySdtDataset: applySdtDataset$1, applyContainerSdtDataset: applyContainerSdtDataset$1, renderLine: renderLine$1, captureLineSnapshot, createErrorPlaceholder, contentControlsChrome } = params$1;
|
|
301651
|
+
const { doc: doc$12, fragment, sdtBoundary, betweenInfo, resolvedItem, applyStyles: applyStyles$3, applyResolvedFragmentFrame, applyFragmentFrame, applySdtDataset: applySdtDataset$1, applyContainerSdtDataset: applyContainerSdtDataset$1, renderLine: renderLine$1, captureLineSnapshot, createErrorPlaceholder, contentControlsChrome, resolvePhysical = resolvePhysicalFamily } = params$1;
|
|
301242
301652
|
try {
|
|
301243
301653
|
if (!doc$12)
|
|
301244
301654
|
throw new Error("DomPainter: document is not available");
|
|
@@ -301297,7 +301707,8 @@ menclose::after {
|
|
|
301297
301707
|
sdtBoundary,
|
|
301298
301708
|
applySdtDataset: applySdtDataset$1,
|
|
301299
301709
|
applyContainerSdtDataset: applyContainerSdtDataset$1,
|
|
301300
|
-
|
|
301710
|
+
resolvePhysical,
|
|
301711
|
+
renderDropCap: (descriptor, dropCapMeasure) => renderDropCap(doc$12, descriptor, dropCapMeasure, resolvePhysical),
|
|
301301
301712
|
renderLine: renderLine$1,
|
|
301302
301713
|
captureLineSnapshot: (lineEl, options) => {
|
|
301303
301714
|
captureLineSnapshot(lineEl, {
|
|
@@ -301316,12 +301727,12 @@ menclose::after {
|
|
|
301316
301727
|
});
|
|
301317
301728
|
return createErrorPlaceholder(fragment.blockId, error48);
|
|
301318
301729
|
}
|
|
301319
|
-
}, renderDropCap = (doc$12, descriptor, measure) => {
|
|
301730
|
+
}, renderDropCap = (doc$12, descriptor, measure, resolvePhysical = resolvePhysicalFamily) => {
|
|
301320
301731
|
const { run: run2, mode } = descriptor;
|
|
301321
301732
|
const dropCapEl = doc$12.createElement("span");
|
|
301322
301733
|
dropCapEl.classList.add("superdoc-drop-cap");
|
|
301323
301734
|
dropCapEl.textContent = run2.text;
|
|
301324
|
-
dropCapEl.style.fontFamily = run2.fontFamily;
|
|
301735
|
+
dropCapEl.style.fontFamily = resolvePhysical(run2.fontFamily);
|
|
301325
301736
|
dropCapEl.style.fontSize = `${run2.fontSize}px`;
|
|
301326
301737
|
if (run2.bold)
|
|
301327
301738
|
dropCapEl.style.fontWeight = "bold";
|
|
@@ -301414,344 +301825,7 @@ menclose::after {
|
|
|
301414
301825
|
const visualTextEndOffset = lineEl.dir === "rtl" || lineEl.style.direction === "rtl" ? alignmentOffset : alignmentOffset + lineWidth;
|
|
301415
301826
|
mark2.style.left = `${Math.max(0, leftOffsetPx + visualTextEndOffset)}px`;
|
|
301416
301827
|
lineEl.appendChild(mark2);
|
|
301417
|
-
},
|
|
301418
|
-
#overrides = /* @__PURE__ */ new Map;
|
|
301419
|
-
#version = 0;
|
|
301420
|
-
map(logicalFamily, physicalFamily) {
|
|
301421
|
-
const key2 = normalizeFamilyKey$2(logicalFamily);
|
|
301422
|
-
const physical = physicalFamily?.trim();
|
|
301423
|
-
if (!key2 || !physical)
|
|
301424
|
-
return;
|
|
301425
|
-
if (this.#overrides.get(key2) === physical)
|
|
301426
|
-
return;
|
|
301427
|
-
this.#overrides.set(key2, physical);
|
|
301428
|
-
this.#version += 1;
|
|
301429
|
-
}
|
|
301430
|
-
unmap(logicalFamily) {
|
|
301431
|
-
if (this.#overrides.delete(normalizeFamilyKey$2(logicalFamily)))
|
|
301432
|
-
this.#version += 1;
|
|
301433
|
-
}
|
|
301434
|
-
reset() {
|
|
301435
|
-
if (this.#overrides.size === 0)
|
|
301436
|
-
return;
|
|
301437
|
-
this.#overrides.clear();
|
|
301438
|
-
this.#version += 1;
|
|
301439
|
-
}
|
|
301440
|
-
get version() {
|
|
301441
|
-
return this.#version;
|
|
301442
|
-
}
|
|
301443
|
-
get signature() {
|
|
301444
|
-
if (this.#overrides.size === 0)
|
|
301445
|
-
return "";
|
|
301446
|
-
return JSON.stringify([...this.#overrides.entries()].sort(([a2], [b$1]) => a2 < b$1 ? -1 : a2 > b$1 ? 1 : 0));
|
|
301447
|
-
}
|
|
301448
|
-
#physicalFor(bareFamily) {
|
|
301449
|
-
const key2 = normalizeFamilyKey$2(bareFamily);
|
|
301450
|
-
const override = this.#overrides.get(key2);
|
|
301451
|
-
if (override)
|
|
301452
|
-
return {
|
|
301453
|
-
physical: override,
|
|
301454
|
-
reason: "custom_mapping"
|
|
301455
|
-
};
|
|
301456
|
-
const bundled = BUNDLED_SUBSTITUTES[key2];
|
|
301457
|
-
if (bundled)
|
|
301458
|
-
return {
|
|
301459
|
-
physical: bundled,
|
|
301460
|
-
reason: "bundled_substitute"
|
|
301461
|
-
};
|
|
301462
|
-
return {
|
|
301463
|
-
physical: bareFamily,
|
|
301464
|
-
reason: "as_requested"
|
|
301465
|
-
};
|
|
301466
|
-
}
|
|
301467
|
-
resolveFontFamily(logicalFamily) {
|
|
301468
|
-
const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
|
|
301469
|
-
const { physical, reason } = this.#physicalFor(primary);
|
|
301470
|
-
return {
|
|
301471
|
-
logicalFamily,
|
|
301472
|
-
physicalFamily: physical,
|
|
301473
|
-
reason
|
|
301474
|
-
};
|
|
301475
|
-
}
|
|
301476
|
-
resolvePhysicalFamily(cssFontFamily) {
|
|
301477
|
-
if (!cssFontFamily)
|
|
301478
|
-
return cssFontFamily;
|
|
301479
|
-
const parts = splitStack(cssFontFamily);
|
|
301480
|
-
if (parts.length === 0)
|
|
301481
|
-
return cssFontFamily;
|
|
301482
|
-
const { physical, reason } = this.#physicalFor(parts[0]);
|
|
301483
|
-
if (reason === "as_requested")
|
|
301484
|
-
return cssFontFamily;
|
|
301485
|
-
return [physical, ...parts.slice(1)].join(", ");
|
|
301486
|
-
}
|
|
301487
|
-
resolvePrimaryPhysicalFamily(family$1) {
|
|
301488
|
-
const primary = splitStack(family$1)[0] ?? family$1;
|
|
301489
|
-
return this.#physicalFor(primary).physical;
|
|
301490
|
-
}
|
|
301491
|
-
resolvePhysicalFamilies(families) {
|
|
301492
|
-
const out = /* @__PURE__ */ new Set;
|
|
301493
|
-
for (const family$1 of families)
|
|
301494
|
-
if (family$1)
|
|
301495
|
-
out.add(this.resolvePrimaryPhysicalFamily(family$1));
|
|
301496
|
-
return [...out];
|
|
301497
|
-
}
|
|
301498
|
-
}, defaultResolver, fontConfigVersion = 0, BUNDLED_MANIFEST, defaultAssetBase = "/fonts/", installedRegistries, DEFAULT_FONT_LOAD_TIMEOUT_MS = 3000, DEFAULT_PROBE_SIZE = "16px", FontRegistry = class {
|
|
301499
|
-
#fontSet;
|
|
301500
|
-
#FontFaceCtor;
|
|
301501
|
-
#probeSize;
|
|
301502
|
-
#scheduleTimeout;
|
|
301503
|
-
#cancelTimeout;
|
|
301504
|
-
#managed = /* @__PURE__ */ new Map;
|
|
301505
|
-
#status = /* @__PURE__ */ new Map;
|
|
301506
|
-
#sources = /* @__PURE__ */ new Map;
|
|
301507
|
-
#warnedFailures = /* @__PURE__ */ new Set;
|
|
301508
|
-
#inflight = /* @__PURE__ */ new Map;
|
|
301509
|
-
#faceStatus = /* @__PURE__ */ new Map;
|
|
301510
|
-
#faceInflight = /* @__PURE__ */ new Map;
|
|
301511
|
-
#faceSources = /* @__PURE__ */ new Map;
|
|
301512
|
-
#facesByFamily = /* @__PURE__ */ new Map;
|
|
301513
|
-
#warnedFaceFailures = /* @__PURE__ */ new Set;
|
|
301514
|
-
constructor(options = {}) {
|
|
301515
|
-
this.#fontSet = options.fontSet ?? null;
|
|
301516
|
-
this.#FontFaceCtor = options.FontFaceCtor ?? null;
|
|
301517
|
-
this.#probeSize = options.probeSize ?? DEFAULT_PROBE_SIZE;
|
|
301518
|
-
this.#scheduleTimeout = options.scheduleTimeout ?? ((cb, ms) => globalThis.setTimeout(cb, ms));
|
|
301519
|
-
this.#cancelTimeout = options.cancelTimeout ?? ((handle3) => globalThis.clearTimeout(handle3));
|
|
301520
|
-
}
|
|
301521
|
-
register(descriptor) {
|
|
301522
|
-
const { family: family$1, source, descriptors: descriptors2 } = descriptor;
|
|
301523
|
-
if (this.#FontFaceCtor && this.#fontSet) {
|
|
301524
|
-
const face = new this.#FontFaceCtor(family$1, source, descriptors2);
|
|
301525
|
-
this.#fontSet.add(face);
|
|
301526
|
-
this.#managed.set(family$1, face);
|
|
301527
|
-
}
|
|
301528
|
-
if (typeof source === "string") {
|
|
301529
|
-
const list5 = this.#sources.get(family$1) ?? [];
|
|
301530
|
-
if (!list5.includes(source))
|
|
301531
|
-
list5.push(source);
|
|
301532
|
-
this.#sources.set(family$1, list5);
|
|
301533
|
-
}
|
|
301534
|
-
if (!this.#status.has(family$1))
|
|
301535
|
-
this.#status.set(family$1, "unloaded");
|
|
301536
|
-
const key2 = faceKeyOf$1(family$1, normalizeWeight(descriptors2?.weight), normalizeStyle$1(descriptors2?.style));
|
|
301537
|
-
this.#trackFace(family$1, key2);
|
|
301538
|
-
if (!this.#faceStatus.has(key2))
|
|
301539
|
-
this.#faceStatus.set(key2, "unloaded");
|
|
301540
|
-
if (typeof source === "string" && !this.#faceSources.has(key2))
|
|
301541
|
-
this.#faceSources.set(key2, source);
|
|
301542
|
-
return {
|
|
301543
|
-
family: family$1,
|
|
301544
|
-
status: this.getStatus(family$1)
|
|
301545
|
-
};
|
|
301546
|
-
}
|
|
301547
|
-
#trackFace(family$1, key2) {
|
|
301548
|
-
const fam = normalizeFamilyKey$1(family$1);
|
|
301549
|
-
const set3 = this.#facesByFamily.get(fam) ?? /* @__PURE__ */ new Set;
|
|
301550
|
-
set3.add(key2);
|
|
301551
|
-
this.#facesByFamily.set(fam, set3);
|
|
301552
|
-
}
|
|
301553
|
-
isManaged(family$1) {
|
|
301554
|
-
return this.#managed.has(family$1);
|
|
301555
|
-
}
|
|
301556
|
-
getStatus(family$1) {
|
|
301557
|
-
const statuses = [];
|
|
301558
|
-
const faceKeys = this.#facesByFamily.get(normalizeFamilyKey$1(family$1));
|
|
301559
|
-
if (faceKeys)
|
|
301560
|
-
for (const k$1 of faceKeys)
|
|
301561
|
-
statuses.push(this.#faceStatus.get(k$1) ?? "unloaded");
|
|
301562
|
-
const legacy = this.#status.get(family$1);
|
|
301563
|
-
if (legacy)
|
|
301564
|
-
statuses.push(legacy);
|
|
301565
|
-
if (statuses.length === 0)
|
|
301566
|
-
return "unloaded";
|
|
301567
|
-
for (const s2 of [
|
|
301568
|
-
"failed",
|
|
301569
|
-
"timed_out",
|
|
301570
|
-
"fallback_used",
|
|
301571
|
-
"loaded",
|
|
301572
|
-
"loading",
|
|
301573
|
-
"unloaded"
|
|
301574
|
-
])
|
|
301575
|
-
if (statuses.includes(s2))
|
|
301576
|
-
return s2;
|
|
301577
|
-
return "unloaded";
|
|
301578
|
-
}
|
|
301579
|
-
isAvailable(family$1) {
|
|
301580
|
-
if (!this.#fontSet)
|
|
301581
|
-
return false;
|
|
301582
|
-
try {
|
|
301583
|
-
return this.#fontSet.check(`${this.#probeSize} ${quoteFamily(family$1)}`);
|
|
301584
|
-
} catch {
|
|
301585
|
-
return false;
|
|
301586
|
-
}
|
|
301587
|
-
}
|
|
301588
|
-
awaitFace(family$1, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
|
|
301589
|
-
if (this.#status.get(family$1) === "loaded")
|
|
301590
|
-
return Promise.resolve({
|
|
301591
|
-
family: family$1,
|
|
301592
|
-
status: "loaded"
|
|
301593
|
-
});
|
|
301594
|
-
const existing = this.#inflight.get(family$1);
|
|
301595
|
-
if (existing)
|
|
301596
|
-
return existing;
|
|
301597
|
-
const probe = this.#loadOne(family$1, timeoutMs).finally(() => {
|
|
301598
|
-
this.#inflight.delete(family$1);
|
|
301599
|
-
});
|
|
301600
|
-
this.#inflight.set(family$1, probe);
|
|
301601
|
-
return probe;
|
|
301602
|
-
}
|
|
301603
|
-
async awaitFaces(families, options = {}) {
|
|
301604
|
-
const unique$2 = [...new Set(families)];
|
|
301605
|
-
const timeoutMs = options.timeoutMs ?? 3000;
|
|
301606
|
-
return Promise.all(unique$2.map((family$1) => this.awaitFace(family$1, timeoutMs)));
|
|
301607
|
-
}
|
|
301608
|
-
getRequiredFaces(families, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
|
|
301609
|
-
return [...new Set(families)].map((family$1) => ({
|
|
301610
|
-
family: family$1,
|
|
301611
|
-
status: this.getStatus(family$1),
|
|
301612
|
-
ready: this.awaitFace(family$1, timeoutMs)
|
|
301613
|
-
}));
|
|
301614
|
-
}
|
|
301615
|
-
getStates() {
|
|
301616
|
-
return [...this.#status.entries()].map(([family$1, status]) => ({
|
|
301617
|
-
family: family$1,
|
|
301618
|
-
status
|
|
301619
|
-
}));
|
|
301620
|
-
}
|
|
301621
|
-
getFaceStatus(request) {
|
|
301622
|
-
return this.#faceStatus.get(faceKeyOf$1(request.family, request.weight, request.style)) ?? "unloaded";
|
|
301623
|
-
}
|
|
301624
|
-
awaitFaceRequest(request, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
|
|
301625
|
-
const key2 = faceKeyOf$1(request.family, request.weight, request.style);
|
|
301626
|
-
if (this.#faceStatus.get(key2) === "loaded")
|
|
301627
|
-
return Promise.resolve({
|
|
301628
|
-
request,
|
|
301629
|
-
status: "loaded"
|
|
301630
|
-
});
|
|
301631
|
-
const existing = this.#faceInflight.get(key2);
|
|
301632
|
-
if (existing)
|
|
301633
|
-
return existing;
|
|
301634
|
-
const probe = this.#loadOneFace(request, key2, timeoutMs).finally(() => {
|
|
301635
|
-
this.#faceInflight.delete(key2);
|
|
301636
|
-
});
|
|
301637
|
-
this.#faceInflight.set(key2, probe);
|
|
301638
|
-
return probe;
|
|
301639
|
-
}
|
|
301640
|
-
async awaitFaceRequests(requests, options = {}) {
|
|
301641
|
-
const timeoutMs = options.timeoutMs ?? 3000;
|
|
301642
|
-
const seen = /* @__PURE__ */ new Set;
|
|
301643
|
-
const unique$2 = [];
|
|
301644
|
-
for (const r$1 of requests) {
|
|
301645
|
-
const key2 = faceKeyOf$1(r$1.family, r$1.weight, r$1.style);
|
|
301646
|
-
if (seen.has(key2))
|
|
301647
|
-
continue;
|
|
301648
|
-
seen.add(key2);
|
|
301649
|
-
unique$2.push(r$1);
|
|
301650
|
-
}
|
|
301651
|
-
return Promise.all(unique$2.map((r$1) => this.awaitFaceRequest(r$1, timeoutMs)));
|
|
301652
|
-
}
|
|
301653
|
-
async#loadOneFace(request, key2, timeoutMs) {
|
|
301654
|
-
this.#trackFace(request.family, key2);
|
|
301655
|
-
const fontSet = this.#fontSet;
|
|
301656
|
-
if (!fontSet) {
|
|
301657
|
-
this.#faceStatus.set(key2, "fallback_used");
|
|
301658
|
-
return {
|
|
301659
|
-
request,
|
|
301660
|
-
status: "fallback_used"
|
|
301661
|
-
};
|
|
301662
|
-
}
|
|
301663
|
-
this.#faceStatus.set(key2, "loading");
|
|
301664
|
-
const probe = faceProbe(request.family, request.weight, request.style, this.#probeSize);
|
|
301665
|
-
const TIMEOUT = Symbol("timeout");
|
|
301666
|
-
let handle3;
|
|
301667
|
-
const timeout$1 = new Promise((resolve2) => {
|
|
301668
|
-
handle3 = this.#scheduleTimeout(() => resolve2(TIMEOUT), timeoutMs);
|
|
301669
|
-
});
|
|
301670
|
-
try {
|
|
301671
|
-
const settled = await Promise.race([fontSet.load(probe), timeout$1]);
|
|
301672
|
-
if (settled === TIMEOUT) {
|
|
301673
|
-
this.#faceStatus.set(key2, "timed_out");
|
|
301674
|
-
return {
|
|
301675
|
-
request,
|
|
301676
|
-
status: "timed_out"
|
|
301677
|
-
};
|
|
301678
|
-
}
|
|
301679
|
-
const status = settled.length > 0 ? "loaded" : "fallback_used";
|
|
301680
|
-
this.#faceStatus.set(key2, status);
|
|
301681
|
-
return {
|
|
301682
|
-
request,
|
|
301683
|
-
status
|
|
301684
|
-
};
|
|
301685
|
-
} catch {
|
|
301686
|
-
this.#faceStatus.set(key2, "failed");
|
|
301687
|
-
this.#warnFaceFailureOnce(request, key2);
|
|
301688
|
-
return {
|
|
301689
|
-
request,
|
|
301690
|
-
status: "failed"
|
|
301691
|
-
};
|
|
301692
|
-
} finally {
|
|
301693
|
-
this.#cancelTimeout(handle3);
|
|
301694
|
-
}
|
|
301695
|
-
}
|
|
301696
|
-
#warnFaceFailureOnce(request, key2) {
|
|
301697
|
-
if (this.#warnedFaceFailures.has(key2))
|
|
301698
|
-
return;
|
|
301699
|
-
this.#warnedFaceFailures.add(key2);
|
|
301700
|
-
const src = this.#faceSources.get(key2);
|
|
301701
|
-
const detail = src ? ` from ${src}` : "";
|
|
301702
|
-
console.warn(`[superdoc] font face failed to load: "${request.family}" ${request.weight} ${request.style}${detail}. Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
|
|
301703
|
-
}
|
|
301704
|
-
async#loadOne(family$1, timeoutMs) {
|
|
301705
|
-
const fontSet = this.#fontSet;
|
|
301706
|
-
if (!fontSet) {
|
|
301707
|
-
this.#status.set(family$1, "fallback_used");
|
|
301708
|
-
return {
|
|
301709
|
-
family: family$1,
|
|
301710
|
-
status: "fallback_used"
|
|
301711
|
-
};
|
|
301712
|
-
}
|
|
301713
|
-
this.#status.set(family$1, "loading");
|
|
301714
|
-
const probe = `${this.#probeSize} ${quoteFamily(family$1)}`;
|
|
301715
|
-
const TIMEOUT = Symbol("timeout");
|
|
301716
|
-
let handle3;
|
|
301717
|
-
const timeout$1 = new Promise((resolve2) => {
|
|
301718
|
-
handle3 = this.#scheduleTimeout(() => resolve2(TIMEOUT), timeoutMs);
|
|
301719
|
-
});
|
|
301720
|
-
try {
|
|
301721
|
-
const settled = await Promise.race([fontSet.load(probe), timeout$1]);
|
|
301722
|
-
if (settled === TIMEOUT) {
|
|
301723
|
-
this.#status.set(family$1, "timed_out");
|
|
301724
|
-
return {
|
|
301725
|
-
family: family$1,
|
|
301726
|
-
status: "timed_out"
|
|
301727
|
-
};
|
|
301728
|
-
}
|
|
301729
|
-
const status = settled.length > 0 ? "loaded" : "fallback_used";
|
|
301730
|
-
this.#status.set(family$1, status);
|
|
301731
|
-
return {
|
|
301732
|
-
family: family$1,
|
|
301733
|
-
status
|
|
301734
|
-
};
|
|
301735
|
-
} catch {
|
|
301736
|
-
this.#status.set(family$1, "failed");
|
|
301737
|
-
this.#warnLoadFailureOnce(family$1);
|
|
301738
|
-
return {
|
|
301739
|
-
family: family$1,
|
|
301740
|
-
status: "failed"
|
|
301741
|
-
};
|
|
301742
|
-
} finally {
|
|
301743
|
-
this.#cancelTimeout(handle3);
|
|
301744
|
-
}
|
|
301745
|
-
}
|
|
301746
|
-
#warnLoadFailureOnce(family$1) {
|
|
301747
|
-
if (this.#warnedFailures.has(family$1))
|
|
301748
|
-
return;
|
|
301749
|
-
this.#warnedFailures.add(family$1);
|
|
301750
|
-
const sources = this.#sources.get(family$1);
|
|
301751
|
-
const detail = sources && sources.length ? ` from ${sources.join(", ")}` : "";
|
|
301752
|
-
console.warn(`[superdoc] font asset failed to load for "${family$1}"${detail}. Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
|
|
301753
|
-
}
|
|
301754
|
-
}, registriesByFontSet, domlessRegistry = null, DEFAULT_SUPERSCRIPT_RAISE_RATIO = 0.33, DEFAULT_SUBSCRIPT_LOWER_RATIO = 0.14, underlineThicknessPx = (fontSize) => Math.max(1, Math.round(fontSize / 14)), hasVerticalPositioning = (run2) => normalizeBaselineShift(run2.baselineShift) != null || run2.vertAlign === "superscript" || run2.vertAlign === "subscript", applyRunVerticalPositioning = (element3, run2) => {
|
|
301828
|
+
}, DEFAULT_SUPERSCRIPT_RAISE_RATIO = 0.33, DEFAULT_SUBSCRIPT_LOWER_RATIO = 0.14, underlineThicknessPx = (fontSize) => Math.max(1, Math.round(fontSize / 14)), hasVerticalPositioning = (run2) => normalizeBaselineShift(run2.baselineShift) != null || run2.vertAlign === "superscript" || run2.vertAlign === "subscript", applyRunVerticalPositioning = (element3, run2) => {
|
|
301755
301829
|
if (hasVerticalPositioning(run2))
|
|
301756
301830
|
element3.style.lineHeight = "1";
|
|
301757
301831
|
const explicitBaselineShift = normalizeBaselineShift(run2.baselineShift);
|
|
@@ -301955,8 +302029,10 @@ menclose::after {
|
|
|
301955
302029
|
annotation.style.height = `${run2.size.height}px`;
|
|
301956
302030
|
}
|
|
301957
302031
|
}
|
|
301958
|
-
|
|
301959
|
-
|
|
302032
|
+
{
|
|
302033
|
+
const resolvePhysical = context.resolvePhysical ?? resolvePhysicalFamily;
|
|
302034
|
+
annotation.style.fontFamily = resolvePhysical(run2.fontFamily || "Arial, sans-serif");
|
|
302035
|
+
}
|
|
301960
302036
|
{
|
|
301961
302037
|
const fontSize = run2.fontSize ? typeof run2.fontSize === "number" ? `${run2.fontSize}pt` : run2.fontSize : BROWSER_DEFAULT_FONT_SIZE;
|
|
301962
302038
|
annotation.style.fontSize = fontSize;
|
|
@@ -304667,6 +304743,7 @@ menclose::after {
|
|
|
304667
304743
|
applyFragmentFrame: (el, paraFragment) => this.applyFragmentFrame(el, paraFragment, context.section, context.story),
|
|
304668
304744
|
applySdtDataset,
|
|
304669
304745
|
applyContainerSdtDataset,
|
|
304746
|
+
resolvePhysical: this.options.resolvePhysical,
|
|
304670
304747
|
renderLine: ({ block, line, availableWidth, lineIndex, skipJustify, preExpandedRuns, resolvedListTextStartPx, indentOffsetOverride, paragraphMarkLeftOffsetOverride }) => this.renderLine(block, line, context, availableWidth, lineIndex, skipJustify, preExpandedRuns, resolvedListTextStartPx, indentOffsetOverride, paragraphMarkLeftOffsetOverride),
|
|
304671
304748
|
captureLineSnapshot: (lineEl, options) => {
|
|
304672
304749
|
this.capturePaintSnapshotLine(lineEl, context, {
|
|
@@ -305439,7 +305516,8 @@ menclose::after {
|
|
|
305439
305516
|
applyFragmentFrame: applyFragmentFrameWithSection,
|
|
305440
305517
|
applySdtDataset,
|
|
305441
305518
|
applyContainerSdtDataset,
|
|
305442
|
-
applyStyles
|
|
305519
|
+
applyStyles,
|
|
305520
|
+
resolvePhysical: this.options.resolvePhysical
|
|
305443
305521
|
});
|
|
305444
305522
|
if (resolvedItem) {
|
|
305445
305523
|
this.applyResolvedFragmentFrame(el, resolvedItem, fragment, context.section, context.story);
|
|
@@ -312915,14 +312993,14 @@ menclose::after {
|
|
|
312915
312993
|
if (value === ",")
|
|
312916
312994
|
return ",";
|
|
312917
312995
|
return DEFAULT_DECIMAL_SEPARATOR2;
|
|
312918
|
-
}, DROP_CAP_PADDING_PX = 4, measureDropCap = (ctx$1, descriptor, spacing,
|
|
312996
|
+
}, DROP_CAP_PADDING_PX = 4, measureDropCap = (ctx$1, descriptor, spacing, fontContext) => {
|
|
312919
312997
|
const { run: run2, lines, mode } = descriptor;
|
|
312920
312998
|
const { font } = buildFontString({
|
|
312921
312999
|
fontFamily: run2.fontFamily,
|
|
312922
313000
|
fontSize: run2.fontSize,
|
|
312923
313001
|
bold: run2.bold,
|
|
312924
313002
|
italic: run2.italic
|
|
312925
|
-
},
|
|
313003
|
+
}, fontContext);
|
|
312926
313004
|
ctx$1.font = font;
|
|
312927
313005
|
const displayText = applyTextTransform(run2.text, run2);
|
|
312928
313006
|
const metrics = ctx$1.measureText(displayText);
|
|
@@ -314863,14 +314941,22 @@ menclose::after {
|
|
|
314863
314941
|
this.#lastSummary = summarize(results);
|
|
314864
314942
|
return this.#lastSummary;
|
|
314865
314943
|
}
|
|
314866
|
-
|
|
314944
|
+
notifyDocumentFontConfigChanged(options) {
|
|
314867
314945
|
this.#fontConfigVersion += 1;
|
|
314868
|
-
bumpFontConfigVersion();
|
|
314869
314946
|
this.#resetRequiredAndSeen();
|
|
314870
314947
|
this.#lateLoadScheduler.cancel();
|
|
314871
|
-
|
|
314948
|
+
if (options?.availabilityChanged) {
|
|
314949
|
+
bumpFontConfigVersion();
|
|
314950
|
+
this.#invalidateCaches();
|
|
314951
|
+
}
|
|
314872
314952
|
this.#requestReflow();
|
|
314873
314953
|
}
|
|
314954
|
+
invalidateCachesForConfigRegistration() {
|
|
314955
|
+
this.#invalidateCaches();
|
|
314956
|
+
}
|
|
314957
|
+
resolveRegistry() {
|
|
314958
|
+
return this.#resolveContext().registry;
|
|
314959
|
+
}
|
|
314874
314960
|
resetForDocumentChange() {
|
|
314875
314961
|
this.#lateLoadScheduler.cancel();
|
|
314876
314962
|
this.#resetRequiredAndSeen();
|
|
@@ -314952,7 +315038,139 @@ menclose::after {
|
|
|
314952
315038
|
#flushLateFontLoads() {
|
|
314953
315039
|
this.#requestReflow();
|
|
314954
315040
|
}
|
|
314955
|
-
}, FACE_STATUS_PRIORITY,
|
|
315041
|
+
}, FACE_STATUS_PRIORITY, DocumentFontController = class {
|
|
315042
|
+
#resolver;
|
|
315043
|
+
#getGate;
|
|
315044
|
+
#onDocumentFontConfigApplied;
|
|
315045
|
+
#scheduleMicrotask;
|
|
315046
|
+
#runtimeReflowQueued = false;
|
|
315047
|
+
#runtimeReflowToken = 0;
|
|
315048
|
+
#runtimeAvailabilityChanged = false;
|
|
315049
|
+
constructor(deps) {
|
|
315050
|
+
this.#resolver = deps.resolver;
|
|
315051
|
+
this.#getGate = deps.getGate;
|
|
315052
|
+
this.#onDocumentFontConfigApplied = deps.onDocumentFontConfigApplied;
|
|
315053
|
+
this.#scheduleMicrotask = deps.scheduleMicrotask ?? defaultScheduleMicrotask;
|
|
315054
|
+
}
|
|
315055
|
+
map(mappings) {
|
|
315056
|
+
if (this.#applyMappings(mappings))
|
|
315057
|
+
this.#queueRuntimeReflow();
|
|
315058
|
+
}
|
|
315059
|
+
unmap(families) {
|
|
315060
|
+
const before = this.#resolver.signature;
|
|
315061
|
+
for (const family$1 of Array.isArray(families) ? families : [families])
|
|
315062
|
+
this.#resolver.unmap(family$1);
|
|
315063
|
+
this.#reflowIfChanged(before);
|
|
315064
|
+
}
|
|
315065
|
+
reset() {
|
|
315066
|
+
this.#cancelPendingRuntimeReflow();
|
|
315067
|
+
this.#resolver.reset();
|
|
315068
|
+
}
|
|
315069
|
+
dispose() {
|
|
315070
|
+
this.#cancelPendingRuntimeReflow();
|
|
315071
|
+
}
|
|
315072
|
+
applyInitialConfig(config3) {
|
|
315073
|
+
this.#cancelPendingRuntimeReflow();
|
|
315074
|
+
if (!config3)
|
|
315075
|
+
return;
|
|
315076
|
+
const registered$1 = this.#registerFamilies(config3.families);
|
|
315077
|
+
this.#applyMappings(config3.map);
|
|
315078
|
+
if (registered$1)
|
|
315079
|
+
this.#getGate()?.invalidateCachesForConfigRegistration();
|
|
315080
|
+
}
|
|
315081
|
+
add(families) {
|
|
315082
|
+
let committed = false;
|
|
315083
|
+
try {
|
|
315084
|
+
this.#registerFamilies(families, () => {
|
|
315085
|
+
committed = true;
|
|
315086
|
+
});
|
|
315087
|
+
} finally {
|
|
315088
|
+
if (committed) {
|
|
315089
|
+
this.#runtimeAvailabilityChanged = true;
|
|
315090
|
+
this.#queueRuntimeReflow();
|
|
315091
|
+
}
|
|
315092
|
+
}
|
|
315093
|
+
}
|
|
315094
|
+
#registerFamilies(families, onFaceRegistered) {
|
|
315095
|
+
if (!families?.length)
|
|
315096
|
+
return false;
|
|
315097
|
+
const registry3 = this.#getGate()?.resolveRegistry();
|
|
315098
|
+
if (!registry3)
|
|
315099
|
+
throw new Error("[superdoc] fonts.add: the font registry is not ready yet");
|
|
315100
|
+
let changed = false;
|
|
315101
|
+
for (const entry of families) {
|
|
315102
|
+
const family$1 = entry?.family;
|
|
315103
|
+
const faces = entry?.faces;
|
|
315104
|
+
if (typeof family$1 !== "string" || !family$1.trim())
|
|
315105
|
+
throw new Error('[superdoc] fonts.add: each family needs a non-empty "family" name');
|
|
315106
|
+
if (!Array.isArray(faces) || faces.length === 0)
|
|
315107
|
+
throw new Error(`[superdoc] fonts.add: family "${family$1}" needs at least one face in "faces"`);
|
|
315108
|
+
for (const face of faces) {
|
|
315109
|
+
if (!face || typeof face.source !== "string" || !face.source.trim())
|
|
315110
|
+
throw new Error(`[superdoc] fonts.add: family "${family$1}" has a face with no "source" URL`);
|
|
315111
|
+
if (registry3.register({
|
|
315112
|
+
family: family$1,
|
|
315113
|
+
source: toCssFontSource(face.source),
|
|
315114
|
+
descriptors: {
|
|
315115
|
+
weight: face.weight == null ? undefined : String(face.weight),
|
|
315116
|
+
style: face.style
|
|
315117
|
+
}
|
|
315118
|
+
}).changed) {
|
|
315119
|
+
changed = true;
|
|
315120
|
+
onFaceRegistered?.();
|
|
315121
|
+
}
|
|
315122
|
+
}
|
|
315123
|
+
}
|
|
315124
|
+
return changed;
|
|
315125
|
+
}
|
|
315126
|
+
async preload(families) {
|
|
315127
|
+
if (!Array.isArray(families))
|
|
315128
|
+
throw new Error('[superdoc] fonts.preload expects an array of logical family names, e.g. preload(["Georgia"])');
|
|
315129
|
+
const registry3 = this.#getGate()?.resolveRegistry();
|
|
315130
|
+
if (!registry3)
|
|
315131
|
+
throw new Error("[superdoc] fonts.preload: the font registry is not ready yet");
|
|
315132
|
+
const requests = families.map((logical) => ({
|
|
315133
|
+
family: this.#resolver.resolvePrimaryPhysicalFamily(logical),
|
|
315134
|
+
weight: "400",
|
|
315135
|
+
style: "normal"
|
|
315136
|
+
}));
|
|
315137
|
+
await registry3.awaitFaceRequests(requests);
|
|
315138
|
+
}
|
|
315139
|
+
#reflowIfChanged(signatureBefore) {
|
|
315140
|
+
if (this.#resolver.signature !== signatureBefore)
|
|
315141
|
+
this.#queueRuntimeReflow();
|
|
315142
|
+
}
|
|
315143
|
+
#applyMappings(mappings) {
|
|
315144
|
+
if (!mappings)
|
|
315145
|
+
return false;
|
|
315146
|
+
const before = this.#resolver.signature;
|
|
315147
|
+
for (const [logicalFamily, physicalFamily] of Object.entries(mappings))
|
|
315148
|
+
this.#resolver.map(logicalFamily, physicalFamily);
|
|
315149
|
+
return this.#resolver.signature !== before;
|
|
315150
|
+
}
|
|
315151
|
+
#queueRuntimeReflow() {
|
|
315152
|
+
if (this.#runtimeReflowQueued)
|
|
315153
|
+
return;
|
|
315154
|
+
this.#runtimeReflowQueued = true;
|
|
315155
|
+
const token$1 = ++this.#runtimeReflowToken;
|
|
315156
|
+
this.#scheduleMicrotask(() => {
|
|
315157
|
+
if (!this.#runtimeReflowQueued || token$1 !== this.#runtimeReflowToken)
|
|
315158
|
+
return;
|
|
315159
|
+
this.#runtimeReflowQueued = false;
|
|
315160
|
+
const availabilityChanged = this.#runtimeAvailabilityChanged;
|
|
315161
|
+
this.#runtimeAvailabilityChanged = false;
|
|
315162
|
+
this.#onDocumentFontConfigApplied();
|
|
315163
|
+
this.#getGate()?.notifyDocumentFontConfigChanged({ availabilityChanged });
|
|
315164
|
+
});
|
|
315165
|
+
}
|
|
315166
|
+
#cancelPendingRuntimeReflow() {
|
|
315167
|
+
this.#runtimeAvailabilityChanged = false;
|
|
315168
|
+
if (!this.#runtimeReflowQueued)
|
|
315169
|
+
return;
|
|
315170
|
+
this.#runtimeReflowQueued = false;
|
|
315171
|
+
this.#runtimeReflowToken += 1;
|
|
315172
|
+
}
|
|
315173
|
+
}, DEFAULT_SEMANTIC_FOOTNOTE_HEADING_STYLE, NATIVE_SELECTION_STYLES = `
|
|
314956
315174
|
/* Hide native browser selection on layout engine content.
|
|
314957
315175
|
* We render our own selection overlay via PresentationEditor's #localSelectionLayer
|
|
314958
315176
|
* for precise control over selection geometry across pages and zoom levels. */
|
|
@@ -315029,7 +315247,7 @@ menclose::after {
|
|
|
315029
315247
|
return;
|
|
315030
315248
|
console.log(...args$1);
|
|
315031
315249
|
}, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions, TRACKED_MARK_NAMES;
|
|
315032
|
-
var
|
|
315250
|
+
var init_src_B1aSE_tB_es = __esm(() => {
|
|
315033
315251
|
init_rolldown_runtime_Bg48TavK_es();
|
|
315034
315252
|
init_SuperConverter_B9mZiCO9_es();
|
|
315035
315253
|
init_jszip_C49i9kUs_es();
|
|
@@ -341904,6 +342122,33 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
341904
342122
|
"wave",
|
|
341905
342123
|
"doubleWave"
|
|
341906
342124
|
]);
|
|
342125
|
+
SETTLED_STATUSES = [
|
|
342126
|
+
"loaded",
|
|
342127
|
+
"failed",
|
|
342128
|
+
"timed_out",
|
|
342129
|
+
"fallback_used"
|
|
342130
|
+
];
|
|
342131
|
+
BUNDLED_SUBSTITUTES = Object.freeze({
|
|
342132
|
+
calibri: "Carlito",
|
|
342133
|
+
cambria: "Caladea",
|
|
342134
|
+
arial: "Liberation Sans",
|
|
342135
|
+
"times new roman": "Liberation Serif",
|
|
342136
|
+
"courier new": "Liberation Mono"
|
|
342137
|
+
});
|
|
342138
|
+
defaultResolver = new FontResolver;
|
|
342139
|
+
DEFAULT_FONT_MEASURE_CONTEXT = Object.freeze({
|
|
342140
|
+
resolvePhysical: resolvePhysicalFamily,
|
|
342141
|
+
fontSignature: ""
|
|
342142
|
+
});
|
|
342143
|
+
BUNDLED_MANIFEST = Object.freeze([
|
|
342144
|
+
family("Carlito", "Carlito", "OFL-1.1"),
|
|
342145
|
+
family("Caladea", "Caladea", "Apache-2.0"),
|
|
342146
|
+
family("Liberation Sans", "LiberationSans", "OFL-1.1"),
|
|
342147
|
+
family("Liberation Serif", "LiberationSerif", "OFL-1.1"),
|
|
342148
|
+
family("Liberation Mono", "LiberationMono", "OFL-1.1")
|
|
342149
|
+
]);
|
|
342150
|
+
installedRegistries = /* @__PURE__ */ new WeakMap;
|
|
342151
|
+
registriesByFontSet = /* @__PURE__ */ new WeakMap;
|
|
341907
342152
|
PX_PER_PT$12 = 96 / 72;
|
|
341908
342153
|
BORDER_SIDES2 = [
|
|
341909
342154
|
"top",
|
|
@@ -341935,29 +342180,6 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
341935
342180
|
"sdtDocpartId",
|
|
341936
342181
|
"sdtDocpartInstruction"
|
|
341937
342182
|
];
|
|
341938
|
-
SETTLED_STATUSES = [
|
|
341939
|
-
"loaded",
|
|
341940
|
-
"failed",
|
|
341941
|
-
"timed_out",
|
|
341942
|
-
"fallback_used"
|
|
341943
|
-
];
|
|
341944
|
-
BUNDLED_SUBSTITUTES = Object.freeze({
|
|
341945
|
-
calibri: "Carlito",
|
|
341946
|
-
cambria: "Caladea",
|
|
341947
|
-
arial: "Liberation Sans",
|
|
341948
|
-
"times new roman": "Liberation Serif",
|
|
341949
|
-
"courier new": "Liberation Mono"
|
|
341950
|
-
});
|
|
341951
|
-
defaultResolver = new FontResolver;
|
|
341952
|
-
BUNDLED_MANIFEST = Object.freeze([
|
|
341953
|
-
family("Carlito", "Carlito", "OFL-1.1"),
|
|
341954
|
-
family("Caladea", "Caladea", "Apache-2.0"),
|
|
341955
|
-
family("Liberation Sans", "LiberationSans", "OFL-1.1"),
|
|
341956
|
-
family("Liberation Serif", "LiberationSerif", "OFL-1.1"),
|
|
341957
|
-
family("Liberation Mono", "LiberationMono", "OFL-1.1")
|
|
341958
|
-
]);
|
|
341959
|
-
installedRegistries = /* @__PURE__ */ new WeakMap;
|
|
341960
|
-
registriesByFontSet = /* @__PURE__ */ new WeakMap;
|
|
341961
342183
|
OPERATOR_CHARS = new Set([
|
|
341962
342184
|
"+",
|
|
341963
342185
|
"-",
|
|
@@ -343190,6 +343412,14 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
343190
343412
|
#selectionSync = new SelectionSyncCoordinator;
|
|
343191
343413
|
#fontGate = null;
|
|
343192
343414
|
#fontResolver = createFontResolver();
|
|
343415
|
+
#nextFontsChangedSource = null;
|
|
343416
|
+
#fontController = new DocumentFontController({
|
|
343417
|
+
resolver: this.#fontResolver,
|
|
343418
|
+
getGate: () => this.#fontGate,
|
|
343419
|
+
onDocumentFontConfigApplied: () => {
|
|
343420
|
+
this.#nextFontsChangedSource = "config-change";
|
|
343421
|
+
}
|
|
343422
|
+
});
|
|
343193
343423
|
#fontPlanBlocks = null;
|
|
343194
343424
|
#lastFontsChangedKey = null;
|
|
343195
343425
|
#lastFontsChangedPayload = null;
|
|
@@ -343476,16 +343706,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
343476
343706
|
getDocumentFonts: () => {
|
|
343477
343707
|
return this.#editor.converter?.getDocumentFonts?.() ?? [];
|
|
343478
343708
|
},
|
|
343479
|
-
requestReflow: () =>
|
|
343480
|
-
this.#layoutState = {
|
|
343481
|
-
...this.#layoutState,
|
|
343482
|
-
blocks: [],
|
|
343483
|
-
measures: [],
|
|
343484
|
-
layout: null
|
|
343485
|
-
};
|
|
343486
|
-
this.#pendingDocChange = true;
|
|
343487
|
-
this.#scheduleRerender();
|
|
343488
|
-
},
|
|
343709
|
+
requestReflow: () => this.#requestFontReflow(),
|
|
343489
343710
|
getRequiredFaces: () => planRequiredFontFaces(this.#fontPlanBlocks, this.#fontResolver),
|
|
343490
343711
|
fontResolver: this.#fontResolver,
|
|
343491
343712
|
onRegistryResolved: (registry3) => installBundledSubstitutes(registry3, {
|
|
@@ -343503,6 +343724,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
343503
343724
|
} : null;
|
|
343504
343725
|
}
|
|
343505
343726
|
});
|
|
343727
|
+
this.#fontController.applyInitialConfig(this.#options.fontAssets);
|
|
343506
343728
|
if (typeof this.#options.disableContextMenu === "boolean")
|
|
343507
343729
|
this.setContextMenuDisabled(this.#options.disableContextMenu);
|
|
343508
343730
|
this.#setupHeaderFooterSession();
|
|
@@ -344462,6 +344684,28 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
344462
344684
|
getMissingFonts() {
|
|
344463
344685
|
return this.getFontReport().filter((record3) => record3.missing).map((record3) => record3.logicalFamily);
|
|
344464
344686
|
}
|
|
344687
|
+
mapFonts(mappings) {
|
|
344688
|
+
this.#fontController.map(mappings);
|
|
344689
|
+
}
|
|
344690
|
+
unmapFonts(families) {
|
|
344691
|
+
this.#fontController.unmap(families);
|
|
344692
|
+
}
|
|
344693
|
+
addFonts(families) {
|
|
344694
|
+
this.#fontController.add(families);
|
|
344695
|
+
}
|
|
344696
|
+
async preloadFonts(families) {
|
|
344697
|
+
await this.#fontController.preload(families);
|
|
344698
|
+
}
|
|
344699
|
+
#requestFontReflow() {
|
|
344700
|
+
this.#layoutState = {
|
|
344701
|
+
...this.#layoutState,
|
|
344702
|
+
blocks: [],
|
|
344703
|
+
measures: [],
|
|
344704
|
+
layout: null
|
|
344705
|
+
};
|
|
344706
|
+
this.#pendingDocChange = true;
|
|
344707
|
+
this.#scheduleRerender();
|
|
344708
|
+
}
|
|
344465
344709
|
#emitFontsChangedIfChanged(summary) {
|
|
344466
344710
|
const gate = this.#fontGate;
|
|
344467
344711
|
if (!gate)
|
|
@@ -344472,6 +344716,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
344472
344716
|
return;
|
|
344473
344717
|
const isInitial = this.#lastFontsChangedKey === null;
|
|
344474
344718
|
this.#lastFontsChangedKey = key2;
|
|
344719
|
+
const pendingSource = this.#nextFontsChangedSource;
|
|
344720
|
+
this.#nextFontsChangedSource = null;
|
|
344721
|
+
const source = isInitial ? "initial" : pendingSource ?? "late-load";
|
|
344475
344722
|
let resolutions;
|
|
344476
344723
|
try {
|
|
344477
344724
|
resolutions = gate.getReport();
|
|
@@ -344489,7 +344736,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
344489
344736
|
fallbackUsed: 0,
|
|
344490
344737
|
results: []
|
|
344491
344738
|
},
|
|
344492
|
-
source
|
|
344739
|
+
source,
|
|
344493
344740
|
version: version$1
|
|
344494
344741
|
};
|
|
344495
344742
|
this.#lastFontsChangedPayload = payload;
|
|
@@ -344500,6 +344747,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
344500
344747
|
getLastFontsChangedPayload() {
|
|
344501
344748
|
return this.#lastFontsChangedPayload;
|
|
344502
344749
|
}
|
|
344750
|
+
#resetFontReportStateForDocumentChange() {
|
|
344751
|
+
this.#nextFontsChangedSource = null;
|
|
344752
|
+
this.#lastFontsChangedKey = null;
|
|
344753
|
+
this.#lastFontsChangedPayload = null;
|
|
344754
|
+
}
|
|
344503
344755
|
getLayoutOptions() {
|
|
344504
344756
|
return { ...this.#layoutOptions };
|
|
344505
344757
|
}
|
|
@@ -345368,6 +345620,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
345368
345620
|
this.#postPaintPipeline.destroy();
|
|
345369
345621
|
this.#proofingManager?.dispose();
|
|
345370
345622
|
this.#proofingManager = null;
|
|
345623
|
+
this.#fontController.dispose();
|
|
345371
345624
|
this.#fontGate?.dispose();
|
|
345372
345625
|
this.#fontGate = null;
|
|
345373
345626
|
if (this.#cursorUpdateTimer !== null) {
|
|
@@ -345728,7 +345981,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
345728
345981
|
});
|
|
345729
345982
|
const handleDocumentReplaced = () => {
|
|
345730
345983
|
this.#fontGate?.resetForDocumentChange();
|
|
345731
|
-
this.#
|
|
345984
|
+
this.#fontController.reset();
|
|
345985
|
+
this.#layoutFontSignature = "";
|
|
345986
|
+
this.#fontController.applyInitialConfig(this.#options.fontAssets);
|
|
345987
|
+
this.#resetFontReportStateForDocumentChange();
|
|
345732
345988
|
this.#refreshHeaderFooterStructureThenRerender({ purgeCachedEditors: true });
|
|
345733
345989
|
};
|
|
345734
345990
|
this.#editor.on("documentReplaced", handleDocumentReplaced);
|
|
@@ -346856,6 +347112,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
346856
347112
|
const resolvePhysical = (css) => this.#fontResolver.resolvePhysicalFamily(css);
|
|
346857
347113
|
const fontSignature = this.#fontResolver.signature;
|
|
346858
347114
|
const previousFontSignature = this.#layoutFontSignature;
|
|
347115
|
+
const fontMeasureContext = {
|
|
347116
|
+
resolvePhysical,
|
|
347117
|
+
fontSignature
|
|
347118
|
+
};
|
|
346859
347119
|
let layout;
|
|
346860
347120
|
let measures;
|
|
346861
347121
|
let resolvedLayout;
|
|
@@ -346879,8 +347139,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
346879
347139
|
} catch {}
|
|
346880
347140
|
try {
|
|
346881
347141
|
const incrementalLayoutStart = perfNow();
|
|
346882
|
-
const result = await incrementalLayout(previousBlocks, previousLayout, blocksForLayout, layoutOptions, (block, constraints) => measureBlock(block, constraints,
|
|
346883
|
-
|
|
347142
|
+
const result = await incrementalLayout(previousBlocks, previousLayout, blocksForLayout, layoutOptions, (block, constraints) => measureBlock(block, constraints, fontMeasureContext), headerFooterInput ?? undefined, previousMeasures, {
|
|
347143
|
+
fontContext: fontMeasureContext,
|
|
346884
347144
|
previousFontSignature
|
|
346885
347145
|
});
|
|
346886
347146
|
perfLog(`[Perf] incrementalLayout: ${(perfNow() - incrementalLayoutStart).toFixed(2)}ms`);
|
|
@@ -349732,7 +349992,7 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
|
|
|
349732
349992
|
|
|
349733
349993
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
349734
349994
|
var init_super_editor_es = __esm(() => {
|
|
349735
|
-
|
|
349995
|
+
init_src_B1aSE_tB_es();
|
|
349736
349996
|
init_SuperConverter_B9mZiCO9_es();
|
|
349737
349997
|
init_jszip_C49i9kUs_es();
|
|
349738
349998
|
init_xml_js_CqGKpaft_es();
|