wordinweb 0.3.1 → 0.3.2

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 },
@@ -45364,7 +45369,9 @@ function detectMissingFonts(layout) {
45364
45369
  const viaSerif = width(`32px "${family}", serif`);
45365
45370
  const faceMissing = viaMono === mono && viaSerif === serif && mono !== serif;
45366
45371
  if (faceMissing) {
45367
- missing.push({ family, sample });
45372
+ const substitute = metricCompatibleSubstitute(family);
45373
+ const substitutePresent = !!substitute && !(width(`32px "${substitute}", monospace`) === mono && width(`32px "${substitute}", serif`) === serif);
45374
+ if (!substitutePresent) missing.push({ family, sample });
45368
45375
  continue;
45369
45376
  }
45370
45377
  const nonLatin = sample.replace(/[\u0000-ɏ]+/g, "");
@@ -55756,4 +55763,4 @@ export {
55756
55763
  cfb/cfb.js:
55757
55764
  (*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *)
55758
55765
  */
55759
- //# sourceMappingURL=chunk-FFQBNFND.js.map
55766
+ //# sourceMappingURL=chunk-D6MZHDCC.js.map