wordinweb 0.3.1 → 0.3.3

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/README.md CHANGED
@@ -346,6 +346,7 @@ For your own application, source your own fonts.
346
346
  Add a separate `@font-face` rule for every weight and style you use.
347
347
 
348
348
  When the browser can't render a requested face, `onMissingFonts` reports it so you can warn the user that the on-screen layout may drift from Word.
349
+ `CollabEditor` accepts the same `onMissingFonts` callback and forwards it to the live view.
349
350
 
350
351
  ## Development
351
352
 
@@ -10498,6 +10498,11 @@ var METRIC_SUBSTITUTES = {
10498
10498
  // DECLARING ascii="MS Gothic" must keep the pre-CJK canvas fallback so its
10499
10499
  // line height stays normal — wild-athabasca's header "\u2264" run.)
10500
10500
  };
10501
+ var METRIC_COMPATIBLE = /* @__PURE__ */ new Set(["Carlito", "Caladea", "Times New Roman"]);
10502
+ function metricCompatibleSubstitute(family) {
10503
+ const substitute = METRIC_SUBSTITUTES[family.toLowerCase()];
10504
+ return substitute && METRIC_COMPATIBLE.has(substitute) ? substitute : void 0;
10505
+ }
10501
10506
  var WORD_FONT_METRICS = {
10502
10507
  calibri: { asc: 0.952148, desc: 0.268555, gap: 0 },
10503
10508
  "calibri light": { asc: 0.952148, desc: 0.268555, gap: 0 },
@@ -16739,7 +16744,7 @@ var Engine = class {
16739
16744
  "hRel" in s && s.hRel === "char" ? charX : this.colX,
16740
16745
  "vRel" in s && s.vRel === "line" ? lineY : paraTop
16741
16746
  );
16742
- if ("wrap" in s && s.wrap && s.wrap !== "none" && !("behind" in s && s.behind)) reBreak = true;
16747
+ if ("wrap" in s && s.wrap && s.wrap !== "none") reBreak = true;
16743
16748
  }
16744
16749
  if (reBreak) broken = breakNow(paraTop);
16745
16750
  };
@@ -18439,7 +18444,7 @@ var Engine = class {
18439
18444
  autofit: shape.autofitHeight ? "resizeShape" : shape.shrinkText ? "shrinkText" : "none"
18440
18445
  };
18441
18446
  }
18442
- if (shape.wrap && shape.wrap !== "none" && (!shape.behind || page.physIndex === -1)) {
18447
+ if (shape.wrap && shape.wrap !== "none") {
18443
18448
  const d = shape.dist ?? { t: 0, b: 0, l: 0, r: 0 };
18444
18449
  const list = this.floats.get(page) ?? [];
18445
18450
  list.push({
@@ -20469,7 +20474,8 @@ function distributePctColumns(grid, tableWidth, margins) {
20469
20474
  }
20470
20475
  function resolveGrid(tbl, available, overflowAllowed = false, cellMargins = 0, pctBoxAddsMargins = false) {
20471
20476
  const fixedOverflow = overflowAllowed && tbl.props.layout === "fixed";
20472
- const cap = fixedOverflow ? Number.POSITIVE_INFINITY : available;
20477
+ const pctOverflow = overflowAllowed && (tbl.props.widthPct ?? 0) > 1;
20478
+ const cap = fixedOverflow || pctOverflow ? Number.POSITIVE_INFINITY : available;
20473
20479
  const pctBase = fixedOverflow && pctBoxAddsMargins ? available + cellMargins : available;
20474
20480
  const target = Math.min(
20475
20481
  cap,
@@ -45364,7 +45370,9 @@ function detectMissingFonts(layout) {
45364
45370
  const viaSerif = width(`32px "${family}", serif`);
45365
45371
  const faceMissing = viaMono === mono && viaSerif === serif && mono !== serif;
45366
45372
  if (faceMissing) {
45367
- missing.push({ family, sample });
45373
+ const substitute = metricCompatibleSubstitute(family);
45374
+ const substitutePresent = !!substitute && !(width(`32px "${substitute}", monospace`) === mono && width(`32px "${substitute}", serif`) === serif);
45375
+ if (!substitutePresent) missing.push({ family, sample });
45368
45376
  continue;
45369
45377
  }
45370
45378
  const nonLatin = sample.replace(/[\u0000-ɏ]+/g, "");
@@ -55756,4 +55764,4 @@ export {
55756
55764
  cfb/cfb.js:
55757
55765
  (*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *)
55758
55766
  */
55759
- //# sourceMappingURL=chunk-FFQBNFND.js.map
55767
+ //# sourceMappingURL=chunk-5SLXOYCF.js.map