@json-to-office/jto-ops 7.0.0 → 7.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -978,7 +978,7 @@ declare const FALLBACK_FONTS: {
978
978
  };
979
979
  };
980
980
  /** A 4x2 PNG: an image with an aspect ratio, and no bytes outside the process. */
981
- declare const MATRIX_IMAGE = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAYAAABytg0kAAAAFElEQVR42mNk+M9QzwAFjDAGACPuA/8fMSCgAAAAAElFTkSuQmCC";
981
+ declare const MATRIX_IMAGE = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAYAAAB/qH1jAAAAEklEQVR42mOIrt34HxkzoAsAAE/xFEFoJgXRAAAAAElFTkSuQmCC";
982
982
  /**
983
983
  * The widest number of a given length: a true minus, thousands separators
984
984
  * and one decimal, every glyph at tabular width. `−1,234,567.0` for 12.
package/dist/index.js CHANGED
@@ -2283,10 +2283,26 @@ function linedOrder(words2, lines = []) {
2283
2283
  };
2284
2284
  }
2285
2285
  function rotatedWords(words2, lines) {
2286
+ const upright = words2.filter(
2287
+ (w) => w.text.trim() !== "" && w.xMax - w.xMin >= w.yMax - w.yMin
2288
+ );
2289
+ const standsInALine = (w) => {
2290
+ const height = w.yMax - w.yMin;
2291
+ return upright.some((other) => {
2292
+ if (other === w) return false;
2293
+ const overlap = Math.min(w.yMax, other.yMax) - Math.max(w.yMin, other.yMin);
2294
+ const shorter = Math.min(height, other.yMax - other.yMin);
2295
+ if (shorter <= 0 || overlap <= shorter / 2) return false;
2296
+ const ratio = height / (other.yMax - other.yMin);
2297
+ return ratio > 0.8 && ratio < 1.25;
2298
+ });
2299
+ };
2286
2300
  const rotated = new Set(
2287
2301
  words2.map((_, i) => i).filter((i) => {
2288
2302
  const w = words2[i];
2289
- return w.text.length > 2 && w.yMax - w.yMin > 1.5 * (w.xMax - w.xMin);
2303
+ if (w.text.length <= 2) return false;
2304
+ if (w.yMax - w.yMin <= 1.5 * (w.xMax - w.xMin)) return false;
2305
+ return !standsInALine(w);
2290
2306
  })
2291
2307
  );
2292
2308
  for (const line of lines) {
@@ -3780,7 +3796,7 @@ var FALLBACK_FONTS = {
3780
3796
  heading: { family: "DejaVu Sans" },
3781
3797
  body: { family: "DejaVu Sans" }
3782
3798
  };
3783
- var MATRIX_IMAGE = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAYAAABytg0kAAAAFElEQVR42mNk+M9QzwAFjDAGACPuA/8fMSCgAAAAAElFTkSuQmCC";
3799
+ var MATRIX_IMAGE = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAYAAAB/qH1jAAAAEklEQVR42mOIrt34HxkzoAsAAE/xFEFoJgXRAAAAAElFTkSuQmCC";
3784
3800
  var WORDS = [
3785
3801
  "performance",
3786
3802
  "delivery",