kordoc 4.24.3 → 4.24.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/README.md +5 -5
- package/dist/{-Q56U3KCA.js → -WND2HWVH.js} +11 -11
- package/dist/{chunk-3EWXRIPH.js → chunk-3LSHLWTX.js} +3 -3
- package/dist/{chunk-HNX2I7D6.js → chunk-44E52JJ7.js} +2 -2
- package/dist/{chunk-XNNMMYFO.js → chunk-47MTLP4U.js} +2 -2
- package/dist/{chunk-42FSKT7R.js → chunk-4XVL3OBP.js} +2 -2
- package/dist/{chunk-OAOM7IEI.js → chunk-5AHG3XY3.js} +11 -11
- package/dist/{chunk-6ZRZLV3J.cjs → chunk-6A4KYMQR.cjs} +2 -2
- package/dist/{chunk-6ZRZLV3J.cjs.map → chunk-6A4KYMQR.cjs.map} +1 -1
- package/dist/{chunk-EWCJCWTT.js → chunk-6CPBNK5O.js} +2 -2
- package/dist/{chunk-FZT34MUI.js → chunk-A5JDO52L.js} +4 -4
- package/dist/{chunk-4X73CGIL.js → chunk-AKIJTKEA.js} +2 -2
- package/dist/{chunk-YG4YOPK6.cjs → chunk-BODFTRWA.cjs} +3 -3
- package/dist/{chunk-YG4YOPK6.cjs.map → chunk-BODFTRWA.cjs.map} +1 -1
- package/dist/{chunk-XAZ5RGVG.js → chunk-BYYZUFPC.js} +11 -8
- package/dist/chunk-BYYZUFPC.js.map +1 -0
- package/dist/{chunk-Q2QKRE4P.js → chunk-D4YWVZHD.js} +2 -2
- package/dist/{chunk-33NZN73M.js → chunk-DTADAHJD.js} +2 -2
- package/dist/{chunk-XZOAE2Q7.js → chunk-E7N6BUJT.js} +12 -9
- package/dist/chunk-E7N6BUJT.js.map +1 -0
- package/dist/{chunk-I2QETSZN.js → chunk-FK3JPTHI.js} +2 -2
- package/dist/{chunk-AEEQN6L3.js → chunk-GGVHKYKZ.js} +2 -2
- package/dist/{chunk-PMX5CPK5.js → chunk-JHUW5PKO.js} +8 -7
- package/dist/chunk-JHUW5PKO.js.map +1 -0
- package/dist/{chunk-VFEI2GIE.cjs → chunk-KFQNG2EA.cjs} +3 -3
- package/dist/{chunk-VFEI2GIE.cjs.map → chunk-KFQNG2EA.cjs.map} +1 -1
- package/dist/{chunk-PHZDAHZC.js → chunk-LBOXKGAH.js} +3 -3
- package/dist/{chunk-JILIA5EV.cjs → chunk-LJ7U7MFN.cjs} +31 -28
- package/dist/chunk-LJ7U7MFN.cjs.map +1 -0
- package/dist/{chunk-W6O7KBOD.js → chunk-MC4DPT4I.js} +2 -2
- package/dist/{chunk-KXHNIHLC.js → chunk-MMPBJGWQ.js} +2 -2
- package/dist/{chunk-NKDPCALC.js → chunk-QTJTBCTZ.js} +4 -4
- package/dist/{chunk-N65EY5BI.cjs → chunk-TPKP3WQU.cjs} +6 -6
- package/dist/{chunk-N65EY5BI.cjs.map → chunk-TPKP3WQU.cjs.map} +1 -1
- package/dist/{chunk-EEXIFCXC.js → chunk-VBY3JQL2.js} +2 -2
- package/dist/{chunk-TZ753B6A.js → chunk-WMDGGQXJ.js} +2 -2
- package/dist/{chunk-HTG3VVET.cjs → chunk-WN5X4DT3.cjs} +24 -24
- package/dist/{chunk-HTG3VVET.cjs.map → chunk-WN5X4DT3.cjs.map} +1 -1
- package/dist/{chunk-HU7POUBS.js → chunk-YBCW544D.js} +2 -2
- package/dist/{chunk-J45OVEUM.js → chunk-YEYNBH5W.js} +112 -23
- package/dist/chunk-YEYNBH5W.js.map +1 -0
- package/dist/chunks-2UDUNVGQ.js +10 -0
- package/dist/cli.js +30 -30
- package/dist/{formula-2BPHF6O7.cjs → formula-6DJAY3KI.cjs} +9 -9
- package/dist/{formula-2BPHF6O7.cjs.map → formula-6DJAY3KI.cjs.map} +1 -1
- package/dist/{formula-IREEAC4T.js → formula-MPBZ7OMN.js} +3 -3
- package/dist/{formula-EA5GDCUD.js → formula-NA3LD35B.js} +4 -4
- package/dist/{image-ocr-LGOFUS3O.js → image-ocr-6TGDXUAS.js} +9 -9
- package/dist/{image-ocr-CCTE7HX3.cjs → image-ocr-REM4LZKX.cjs} +17 -17
- package/dist/{image-ocr-CCTE7HX3.cjs.map → image-ocr-REM4LZKX.cjs.map} +1 -1
- package/dist/{image-ocr-JQJC5HWK.js → image-ocr-THA5BASF.js} +6 -6
- package/dist/index.cjs +740 -650
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +118 -28
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +23 -23
- package/dist/{model-bundle-YW62Y6UD.js → model-bundle-3YDTJ6EQ.js} +5 -5
- package/dist/{models-AAL3IS2R.js → models-M7AX7VIN.js} +5 -5
- package/dist/{parse-worker-v2-3JAHV7NY.js → parse-worker-v2-3ZMFWDFW.js} +12 -12
- package/dist/{parser-HE45CCSG.cjs → parser-GIDYL5LH.cjs} +158 -158
- package/dist/{parser-HE45CCSG.cjs.map → parser-GIDYL5LH.cjs.map} +1 -1
- package/dist/{parser-ZBP5GOQK.js → parser-MNNJSFEZ.js} +9 -9
- package/dist/{parser-4FCKKJ2N.js → parser-TD4VZDGY.js} +12 -12
- package/dist/{pdf-ocr-HFAEOA7W.js → pdf-ocr-5HEVZKG5.js} +6 -6
- package/dist/{pdf-ocr-Q4TPGDDI.js → pdf-ocr-6BAOQ6CY.js} +9 -9
- package/dist/pdf-ocr-NOSNTEDS.cjs +31 -0
- package/dist/{pdf-ocr-7MDCLWAA.cjs.map → pdf-ocr-NOSNTEDS.cjs.map} +1 -1
- package/dist/{profile-io-EDQTKLLL.js → profile-io-H4WQIGN6.js} +3 -3
- package/dist/{rasterize-VD2XGHUJ.js → rasterize-EOPWJWBO.js} +3 -3
- package/dist/{redact-doc-TBIBQJCT.js → redact-doc-BBZVAA3I.js} +11 -11
- package/dist/{render-J5KAZAQH.js → render-ZZ4CGJ6J.js} +7 -7
- package/dist/seal-RRYFKTEQ.js +10 -0
- package/dist/{setup-5LYHCQRU.js → setup-UIPKBNLA.js} +3 -3
- package/dist/visual-DLLRTF6C.js +21 -0
- package/dist/{watch-YP4IWM75.js → watch-OXQ6O5HD.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-J45OVEUM.js.map +0 -1
- package/dist/chunk-JILIA5EV.cjs.map +0 -1
- package/dist/chunk-PMX5CPK5.js.map +0 -1
- package/dist/chunk-XAZ5RGVG.js.map +0 -1
- package/dist/chunk-XZOAE2Q7.js.map +0 -1
- package/dist/chunks-REYSCBPB.js +0 -10
- package/dist/pdf-ocr-7MDCLWAA.cjs +0 -31
- package/dist/seal-H2JNAZU7.js +0 -10
- package/dist/visual-7EO6GR3M.js +0 -21
- /package/dist/{-Q56U3KCA.js.map → -WND2HWVH.js.map} +0 -0
- /package/dist/{chunk-3EWXRIPH.js.map → chunk-3LSHLWTX.js.map} +0 -0
- /package/dist/{chunk-HNX2I7D6.js.map → chunk-44E52JJ7.js.map} +0 -0
- /package/dist/{chunk-XNNMMYFO.js.map → chunk-47MTLP4U.js.map} +0 -0
- /package/dist/{chunk-42FSKT7R.js.map → chunk-4XVL3OBP.js.map} +0 -0
- /package/dist/{chunk-OAOM7IEI.js.map → chunk-5AHG3XY3.js.map} +0 -0
- /package/dist/{chunk-EWCJCWTT.js.map → chunk-6CPBNK5O.js.map} +0 -0
- /package/dist/{chunk-FZT34MUI.js.map → chunk-A5JDO52L.js.map} +0 -0
- /package/dist/{chunk-4X73CGIL.js.map → chunk-AKIJTKEA.js.map} +0 -0
- /package/dist/{chunk-Q2QKRE4P.js.map → chunk-D4YWVZHD.js.map} +0 -0
- /package/dist/{chunk-33NZN73M.js.map → chunk-DTADAHJD.js.map} +0 -0
- /package/dist/{chunk-I2QETSZN.js.map → chunk-FK3JPTHI.js.map} +0 -0
- /package/dist/{chunk-AEEQN6L3.js.map → chunk-GGVHKYKZ.js.map} +0 -0
- /package/dist/{chunk-PHZDAHZC.js.map → chunk-LBOXKGAH.js.map} +0 -0
- /package/dist/{chunk-W6O7KBOD.js.map → chunk-MC4DPT4I.js.map} +0 -0
- /package/dist/{chunk-KXHNIHLC.js.map → chunk-MMPBJGWQ.js.map} +0 -0
- /package/dist/{chunk-NKDPCALC.js.map → chunk-QTJTBCTZ.js.map} +0 -0
- /package/dist/{chunk-EEXIFCXC.js.map → chunk-VBY3JQL2.js.map} +0 -0
- /package/dist/{chunk-TZ753B6A.js.map → chunk-WMDGGQXJ.js.map} +0 -0
- /package/dist/{chunk-HU7POUBS.js.map → chunk-YBCW544D.js.map} +0 -0
- /package/dist/{chunks-REYSCBPB.js.map → chunks-2UDUNVGQ.js.map} +0 -0
- /package/dist/{formula-IREEAC4T.js.map → formula-MPBZ7OMN.js.map} +0 -0
- /package/dist/{formula-EA5GDCUD.js.map → formula-NA3LD35B.js.map} +0 -0
- /package/dist/{image-ocr-LGOFUS3O.js.map → image-ocr-6TGDXUAS.js.map} +0 -0
- /package/dist/{image-ocr-JQJC5HWK.js.map → image-ocr-THA5BASF.js.map} +0 -0
- /package/dist/{model-bundle-YW62Y6UD.js.map → model-bundle-3YDTJ6EQ.js.map} +0 -0
- /package/dist/{models-AAL3IS2R.js.map → models-M7AX7VIN.js.map} +0 -0
- /package/dist/{parse-worker-v2-3JAHV7NY.js.map → parse-worker-v2-3ZMFWDFW.js.map} +0 -0
- /package/dist/{parser-ZBP5GOQK.js.map → parser-MNNJSFEZ.js.map} +0 -0
- /package/dist/{parser-4FCKKJ2N.js.map → parser-TD4VZDGY.js.map} +0 -0
- /package/dist/{pdf-ocr-HFAEOA7W.js.map → pdf-ocr-5HEVZKG5.js.map} +0 -0
- /package/dist/{pdf-ocr-Q4TPGDDI.js.map → pdf-ocr-6BAOQ6CY.js.map} +0 -0
- /package/dist/{profile-io-EDQTKLLL.js.map → profile-io-H4WQIGN6.js.map} +0 -0
- /package/dist/{rasterize-VD2XGHUJ.js.map → rasterize-EOPWJWBO.js.map} +0 -0
- /package/dist/{redact-doc-TBIBQJCT.js.map → redact-doc-BBZVAA3I.js.map} +0 -0
- /package/dist/{render-J5KAZAQH.js.map → render-ZZ4CGJ6J.js.map} +0 -0
- /package/dist/{seal-H2JNAZU7.js.map → seal-RRYFKTEQ.js.map} +0 -0
- /package/dist/{setup-5LYHCQRU.js.map → setup-UIPKBNLA.js.map} +0 -0
- /package/dist/{visual-7EO6GR3M.js.map → visual-DLLRTF6C.js.map} +0 -0
- /package/dist/{watch-YP4IWM75.js.map → watch-OXQ6O5HD.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
visibleText
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-44E52JJ7.js";
|
|
5
5
|
|
|
6
6
|
// src/script-tags.ts
|
|
7
7
|
var LITERAL_TAG = /<(?=\/?(?:u|sup|sub)>)/g;
|
|
@@ -328,4 +328,4 @@ export {
|
|
|
328
328
|
HEADING_RATIO_H2,
|
|
329
329
|
HEADING_RATIO_H3
|
|
330
330
|
};
|
|
331
|
-
//# sourceMappingURL=chunk-
|
|
331
|
+
//# sourceMappingURL=chunk-YBCW544D.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
loadSharp,
|
|
4
4
|
rasterizePageSvg
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-D4YWVZHD.js";
|
|
6
6
|
import {
|
|
7
7
|
inlineImagesIntoMarkdown
|
|
8
8
|
} from "./chunk-VKVDMH7X.js";
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
HEADING_RATIO_H3,
|
|
17
17
|
tidyScriptTags,
|
|
18
18
|
unframeLayoutTables
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-YBCW544D.js";
|
|
20
20
|
import {
|
|
21
21
|
MAX_COLS,
|
|
22
22
|
MAX_ROWS,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
mapPuaText,
|
|
33
33
|
markNonLayoutTable,
|
|
34
34
|
romanNumeral
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-44E52JJ7.js";
|
|
36
36
|
import {
|
|
37
37
|
DEFAULT_CHAR,
|
|
38
38
|
DEFAULT_PARA_GEOM,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
hwpxAppMajor,
|
|
47
47
|
parseRenderStyles,
|
|
48
48
|
readZipEntry
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-JHUW5PKO.js";
|
|
50
50
|
import {
|
|
51
51
|
KordocError,
|
|
52
52
|
compareSectionPaths,
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
precheckZipSize,
|
|
55
55
|
sanitizeHref,
|
|
56
56
|
toArrayBuffer
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-6CPBNK5O.js";
|
|
58
58
|
|
|
59
59
|
// src/render/svg-render.ts
|
|
60
60
|
import JSZip from "jszip";
|
|
@@ -185,7 +185,8 @@ function solveRowHeights(cells, rowCount, maxTotal = Number.POSITIVE_INFINITY, s
|
|
|
185
185
|
}
|
|
186
186
|
const last = rowCount - 1, over = total - maxTotal;
|
|
187
187
|
const lastCells = cells.filter((c) => c.rowAddr + c.rowSpan - 1 === last);
|
|
188
|
-
|
|
188
|
+
const spanH = (c) => h.slice(c.rowAddr, c.rowAddr + c.rowSpan).reduce((t, x) => t + x, 0);
|
|
189
|
+
if (shrinkLast && over > 0 && last >= 0 && lastCells.length && lastCells.every((c) => c.contentH != null && c.contentH <= (c.rowSpan === 1 ? h[last] : spanH(c)) - over)) h[last] -= over;
|
|
189
190
|
return h;
|
|
190
191
|
}
|
|
191
192
|
|
|
@@ -11456,7 +11457,7 @@ function cellContentExtent(cell, memo) {
|
|
|
11456
11457
|
const pushed = baseV - (Math.max(0, vo) + num(om, "top") + o.height + num(om, "bottom"));
|
|
11457
11458
|
const anchor = pushed >= (paraStart > 0 ? paraStart - 100 : -100) ? pushed : baseV - (memo?.paraGeom?.get(p.getAttribute("paraPrIDRef") ?? "")?.spaceBefore ?? 0);
|
|
11458
11459
|
const oh = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, memo)) : o.height;
|
|
11459
|
-
ext = Math.max(ext, anchor + num(om, "top") + Math.max(0, vo) + oh);
|
|
11460
|
+
ext = Math.max(ext, anchor + num(om, "top") + Math.max(0, vo) + oh + num(om, "bottom"));
|
|
11460
11461
|
}
|
|
11461
11462
|
}
|
|
11462
11463
|
memo?.cell.set(cell.el, ext);
|
|
@@ -11523,7 +11524,7 @@ function measureTableRowHeights(tbl, memo) {
|
|
|
11523
11524
|
const rows = solveRowHeights(
|
|
11524
11525
|
// 여러 행 칸은 내용(+ 칸 여백)이 저장 높이보다 크면 내용 높이로 — 솔버가 모자란 만큼 그 칸 마지막 행을 키운다
|
|
11525
11526
|
// (같은 판 PDF: 두 줄 든 2행 병합 칸 내용 2882 > 저장 2564 → 둘째 행이 318 자라고 첫 행은 그대로)
|
|
11526
|
-
cells.map((c) => ({ rowAddr: c.ra, rowSpan: c.rs, height: (c.rs > 1 ? Math.max(c.h, cellContentExtent(c, memo) + c.marginT + c.marginB) : c.h) - sp * (c.rs - 1), contentH:
|
|
11527
|
+
cells.map((c) => ({ rowAddr: c.ra, rowSpan: c.rs, height: (c.rs > 1 ? Math.max(c.h, cellContentExtent(c, memo) + c.marginT + c.marginB) : c.h) - sp * (c.rs - 1), contentH: cellContentExtent(c, memo) + c.marginT + c.marginB })),
|
|
11527
11528
|
nRows,
|
|
11528
11529
|
num(findChildByLocalName(tbl, "sz"), "height") - (sp > 0 ? sp * (nRows + 1) : 0) || Number.POSITIVE_INFINITY,
|
|
11529
11530
|
!inCell(tbl) && !cells.some((c) => c.ra + c.rs === nRows && splitSaved(c))
|
|
@@ -13072,6 +13073,53 @@ function flowEndNotes(root, bodyH) {
|
|
|
13072
13073
|
});
|
|
13073
13074
|
}
|
|
13074
13075
|
|
|
13076
|
+
// src/render/font-env.ts
|
|
13077
|
+
function hasKoPubSubst(headXml) {
|
|
13078
|
+
return /<hh:font\b[^>]*\bface="KoPub[^"]*"[^>]*\btype="TTF"[^>]*>\s*<hh:substFont\b/.test(headXml);
|
|
13079
|
+
}
|
|
13080
|
+
function lineStarts(root) {
|
|
13081
|
+
const out = [];
|
|
13082
|
+
for (const p of Array.from(root.getElementsByTagName("hp:p"))) {
|
|
13083
|
+
const lsa = elements(p).find((e) => ln(e) === "linesegarray");
|
|
13084
|
+
const segs = lsa ? elements(lsa).filter((e) => ln(e) === "lineseg") : [];
|
|
13085
|
+
out.push(segs.length >= 2 ? segs.map((s) => s.getAttribute("textpos") ?? "0").join(",") : null);
|
|
13086
|
+
}
|
|
13087
|
+
return out;
|
|
13088
|
+
}
|
|
13089
|
+
function matchCount(xml, saved, styles) {
|
|
13090
|
+
const root = createXmlParser().parseFromString(xml, "text/xml").documentElement;
|
|
13091
|
+
const pagePr = root.getElementsByTagName("hp:pagePr")[0];
|
|
13092
|
+
if (!pagePr) return 0;
|
|
13093
|
+
const margin = pagePr.getElementsByTagName("hp:margin")[0];
|
|
13094
|
+
let PW = num(pagePr, "width", 59528), PH = num(pagePr, "height", 84188);
|
|
13095
|
+
if (pagePr.getAttribute("landscape") === "NARROWLY" && PW < PH) [PW, PH] = [PH, PW];
|
|
13096
|
+
const gutterTB = pagePr.getAttribute("gutterType") === "TOP_BOTTOM", gutter = num(margin ?? null, "gutter", 0);
|
|
13097
|
+
const BODY_W = PW - num(margin ?? null, "left", 8504) - num(margin ?? null, "right", 8504) - (gutterTB ? 0 : gutter);
|
|
13098
|
+
const BODY_H = PH - num(margin ?? null, "top", 5668) - num(margin ?? null, "header", 0) - num(margin ?? null, "bottom", 4252) - num(margin ?? null, "footer", 0) - (gutterTB ? gutter : 0);
|
|
13099
|
+
for (const p of Array.from(root.getElementsByTagName("hp:p"))) {
|
|
13100
|
+
const lsa = elements(p).find((e) => ln(e) === "linesegarray");
|
|
13101
|
+
if (lsa) p.removeChild(lsa);
|
|
13102
|
+
}
|
|
13103
|
+
reflowSection(root, styles, { BODY_W, BODY_H });
|
|
13104
|
+
const got = lineStarts(root);
|
|
13105
|
+
let n = 0;
|
|
13106
|
+
saved.forEach((s, i) => {
|
|
13107
|
+
if (s !== null && s === got[i]) n++;
|
|
13108
|
+
});
|
|
13109
|
+
return n;
|
|
13110
|
+
}
|
|
13111
|
+
function kopubSubstituted(secXmls, base, alt) {
|
|
13112
|
+
let a = 0, b = 0, seen = 0;
|
|
13113
|
+
for (const xml of secXmls) {
|
|
13114
|
+
const saved = lineStarts(createXmlParser().parseFromString(xml, "text/xml").documentElement);
|
|
13115
|
+
a += matchCount(xml, saved, base);
|
|
13116
|
+
b += matchCount(xml, saved, alt);
|
|
13117
|
+
seen += saved.filter((x) => x !== null).length;
|
|
13118
|
+
if (seen >= 60) break;
|
|
13119
|
+
}
|
|
13120
|
+
return b >= a + 5 && b > a * 1.1;
|
|
13121
|
+
}
|
|
13122
|
+
|
|
13075
13123
|
// src/render/scene.ts
|
|
13076
13124
|
function regionId(type, seq) {
|
|
13077
13125
|
return `${type}-${String(seq).padStart(6, "0")}`;
|
|
@@ -13499,11 +13547,11 @@ function planTableRows(tbl, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan, n
|
|
|
13499
13547
|
continue;
|
|
13500
13548
|
}
|
|
13501
13549
|
}
|
|
13502
|
-
if (splittable && y + h > pageBottom) {
|
|
13550
|
+
if (splittable && y + h + outB > pageBottom) {
|
|
13503
13551
|
const from = /* @__PURE__ */ new Map();
|
|
13504
13552
|
const lines = new Map(rowCells.map((c) => [c.el, cellLines(c)]));
|
|
13505
|
-
while (y + h > pageBottom && BODY_H > rowY[hdrRows]) {
|
|
13506
|
-
const avail = pageBottom - y;
|
|
13553
|
+
while (y + h + outB > pageBottom && BODY_H > rowY[hdrRows]) {
|
|
13554
|
+
const avail = pageBottom - y - outB;
|
|
13507
13555
|
let rem = 0, placed = false, allFit = true, blocked = false;
|
|
13508
13556
|
const cuts = [];
|
|
13509
13557
|
for (const c of rowCells) {
|
|
@@ -14649,30 +14697,53 @@ function planLines(m, styles, numText = "") {
|
|
|
14649
14697
|
}
|
|
14650
14698
|
}
|
|
14651
14699
|
const stretch = align === "JUSTIFY" || align === "DISTRIBUTE" || align === "DISTRIBUTE_SPACE";
|
|
14652
|
-
let spaceAdd = 0, spaceFrom = fixedTo;
|
|
14700
|
+
let spaceAdd = 0, spaceFrom = fixedTo, charAdd = 0;
|
|
14701
|
+
const squeeze = (spFrom) => {
|
|
14702
|
+
const short = nat.text - lastSp - avail;
|
|
14703
|
+
let nSp = 0, cap = 0, nG = 0;
|
|
14704
|
+
for (let k = spFrom; k < textEnd; k++) {
|
|
14705
|
+
const c = m.chars[k];
|
|
14706
|
+
if (c.ch === " ") {
|
|
14707
|
+
nSp++;
|
|
14708
|
+
cap += charW(c, styles, m.chars[k - 1]) * 0.2;
|
|
14709
|
+
} else if (c.ch && !c.tab) nG++;
|
|
14710
|
+
}
|
|
14711
|
+
if (nSp > 0) {
|
|
14712
|
+
spaceAdd = -Math.min(short, cap) / nSp;
|
|
14713
|
+
spaceFrom = spFrom;
|
|
14714
|
+
}
|
|
14715
|
+
if (short > cap && nG > 0) charAdd = -(short - (nSp > 0 ? cap : 0)) / nG;
|
|
14716
|
+
};
|
|
14653
14717
|
if (nat.text > 0 && stretch && (!isLast || align === "DISTRIBUTE" || align === "DISTRIBUTE_SPACE")) {
|
|
14654
14718
|
let nSp = 0, spFrom = fixedTo;
|
|
14655
|
-
while (spFrom < textEnd && (m.chars[spFrom].ch === " " || m.chars[spFrom].ch === "")) spFrom++;
|
|
14719
|
+
while (spFrom < textEnd && (m.chars[spFrom].ch === " " || m.chars[spFrom].ch === "") && !m.chars[spFrom].ctrl) spFrom++;
|
|
14656
14720
|
for (let k = spFrom; k < textEnd; k++) if (m.chars[k].ch === " ") nSp++;
|
|
14657
14721
|
if (nSp > 0 && align !== "DISTRIBUTE") {
|
|
14658
14722
|
spaceAdd = (avail - nat.text + lastSp) / nSp;
|
|
14659
14723
|
spaceFrom = spFrom;
|
|
14724
|
+
if (spaceAdd < 0) squeeze(spFrom);
|
|
14660
14725
|
} else scale = avail > 0 ? avail / nat.text : 1;
|
|
14661
14726
|
} else if (nat.text + nat.obj > 0 && (isLast || !stretch)) {
|
|
14662
14727
|
const w = nat.text + nat.obj - lastSp;
|
|
14663
14728
|
if (align === "CENTER") xoff = Math.max(0, (lineW - w) / 2);
|
|
14664
14729
|
else if (align === "RIGHT") xoff = Math.max(0, lineW - w);
|
|
14665
14730
|
}
|
|
14731
|
+
if (spaceAdd === 0 && charAdd === 0 && scale === 1 && nat.text - lastSp > avail) {
|
|
14732
|
+
let spFrom = fixedTo;
|
|
14733
|
+
while (spFrom < textEnd && (m.chars[spFrom].ch === " " || m.chars[spFrom].ch === "") && !m.chars[spFrom].ctrl) spFrom++;
|
|
14734
|
+
squeeze(spFrom);
|
|
14735
|
+
}
|
|
14666
14736
|
if (!Number.isFinite(scale) || scale <= 0) scale = 1;
|
|
14667
14737
|
scale = Math.min(4, Math.max(0.25, scale));
|
|
14668
|
-
plans.push({ seg, xoff: xoff + lead, scale, spaceAdd, spFrom: spaceFrom, start, end, tabs, fixedTo, textEnd, ...i === 0 && bu ? { bullet: { ch: bu.ch, w: bulletW, prId: bu.charPrId ?? firstPr } } : {} });
|
|
14738
|
+
plans.push({ seg, xoff: xoff + lead, scale, spaceAdd, spFrom: spaceFrom, ...charAdd ? { charAdd } : {}, start, end, tabs, fixedTo, textEnd, ...i === 0 && bu ? { bullet: { ch: bu.ch, w: bulletW, prId: bu.charPrId ?? firstPr } } : {} });
|
|
14669
14739
|
}
|
|
14670
14740
|
return plans;
|
|
14671
14741
|
}
|
|
14672
14742
|
function advanceTo(m, styles, plan, upto) {
|
|
14673
14743
|
let x = 0;
|
|
14674
14744
|
for (let i = plan.start; i < upto && i < m.chars.length; i++) {
|
|
14675
|
-
|
|
14745
|
+
const c = m.chars[i], inStretch = i >= plan.spFrom && i < plan.textEnd;
|
|
14746
|
+
x += c.tab ? plan.tabs.get(i) ?? 0 : charW(c, styles, m.chars[i - 1]) * (i < plan.fixedTo ? 1 : plan.scale) + (inStretch && c.ch === " " ? plan.spaceAdd : 0) + (inStretch && plan.charAdd && c.ch && c.ch !== " " ? plan.charAdd : 0);
|
|
14676
14747
|
}
|
|
14677
14748
|
for (const o of m.objs) if (o.inline && o.index >= plan.start && o.index < upto) x += o.omL + o.width + o.omR;
|
|
14678
14749
|
return x;
|
|
@@ -14790,7 +14861,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
14790
14861
|
return n;
|
|
14791
14862
|
};
|
|
14792
14863
|
const renderSeg = (text, cx, hit) => {
|
|
14793
|
-
const sw = measure(text) * scale + (plan.spaceAdd && i >= plan.fixedTo ? plan.spaceAdd * spacesIn(text) : 0);
|
|
14864
|
+
const sw = measure(text) * scale + (plan.spaceAdd && i >= plan.fixedTo ? plan.spaceAdd * spacesIn(text) : 0) + (plan.charAdd && i >= plan.fixedTo ? plan.charAdd * [...text].filter((ch) => ch !== " ").length : 0);
|
|
14794
14865
|
if (st.shade) emit(ctx, `<rect x="${pt2(cx)}" y="${pt2(glyphY(st.height) - Math.round(st.height * 0.85))}" width="${pt2(sw)}" height="${pt2(st.height)}" fill="${escapeXml(st.shade)}"/>`);
|
|
14795
14866
|
if (hit) {
|
|
14796
14867
|
emit(ctx, `<rect x="${pt2(cx)}" y="${pt2(oy + seg.vertpos)}" width="${pt2(sw)}" height="${pt2(seg.textheight)}" fill="#ffd54f" fill-opacity="0.45"/>`);
|
|
@@ -14872,11 +14943,15 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
14872
14943
|
let anchorLineV;
|
|
14873
14944
|
let anchorLineH = 0;
|
|
14874
14945
|
let anchorSeg;
|
|
14875
|
-
|
|
14876
|
-
|
|
14877
|
-
|
|
14878
|
-
|
|
14879
|
-
|
|
14946
|
+
let anchorK = -1;
|
|
14947
|
+
plans.forEach((pl, k) => {
|
|
14948
|
+
if (pl.start <= o.index) {
|
|
14949
|
+
anchorLineV = pl.seg.vertpos;
|
|
14950
|
+
anchorLineH = pl.seg.textheight;
|
|
14951
|
+
anchorSeg = pl.seg;
|
|
14952
|
+
anchorK = k;
|
|
14953
|
+
}
|
|
14954
|
+
});
|
|
14880
14955
|
let objBaseV = baseV;
|
|
14881
14956
|
const pTop = depth === 0 ? ctx.paraTops?.get(p) : void 0;
|
|
14882
14957
|
const wrapA = o.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM";
|
|
@@ -14895,6 +14970,11 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
14895
14970
|
let stay = tbFloats < 2 && !m.objs.some((q) => q.inline) && !m.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "");
|
|
14896
14971
|
const sbA = m.paraPrId != null ? ctx.styles.paraGeom.get(m.paraPrId)?.spaceBefore ?? 0 : 0;
|
|
14897
14972
|
if (stay && wrapA === "TOP_AND_BOTTOM" && linePushedBy(o, anchorLineV ?? baseV, pTop ?? (depth > 0 ? cellParaTop(p, ctx.styles.paraGeom) : void 0))) stay = false;
|
|
14973
|
+
let carried;
|
|
14974
|
+
if (segPages && anchorK > 0 && segPages[anchorK] !== segPages[0] && segPages[anchorK - 1] === segPages[0] && wrapA === "TOP_AND_BOTTOM" && (findChildByLocalName(o.el, "pos")?.getAttribute("vertRelTo") ?? "PARA") === "PARA") {
|
|
14975
|
+
const s0 = plans[anchorK - 1].seg;
|
|
14976
|
+
carried = s0.vertpos + s0.textheight + (s0.spacing ?? 0);
|
|
14977
|
+
}
|
|
14898
14978
|
const firstLine = anchorLineV === void 0 || anchorLineV === baseV;
|
|
14899
14979
|
let { x, y } = anchorObject(
|
|
14900
14980
|
o,
|
|
@@ -14911,6 +14991,10 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
14911
14991
|
// 문단 중간 글자 앵커인데 첫 줄부터 앵커 줄만큼 좁게 저장됐으면 개체는 문단 위에 있다(같은 판 한컴 PDF: 둘째 줄 앵커 사진, 네 줄 모두 34602)
|
|
14912
14992
|
m.chars.slice(o.index).some((c) => c.ch.trim() !== "") && !!anchorSeg && plans.length > 0 && plans[0].seg !== anchorSeg && Math.abs(plans[0].seg.horzsize - anchorSeg.horzsize) <= 100 && anchorSeg.horzpos + anchorSeg.horzsize < aw - 1e3 ? "top" : m.chars.slice(o.index).some((c) => c.ch.trim() !== "") ? "mid" : "end"
|
|
14913
14993
|
);
|
|
14994
|
+
if (carried !== void 0) {
|
|
14995
|
+
const posC = findChildByLocalName(o.el, "pos"), rawC = num(posC, "vertOffset");
|
|
14996
|
+
y = oy + carried + num(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, rawC >= 2 ** 31 ? rawC - 2 ** 32 : rawC);
|
|
14997
|
+
}
|
|
14914
14998
|
let stackTop = depth === 0 ? pTop ?? 0 : cellParaTop(p, ctx.styles.paraGeom);
|
|
14915
14999
|
if (tbFloats >= 2 && wrapA === "TOP_AND_BOTTOM" && stackTop !== void 0) {
|
|
14916
15000
|
if (!tbStack) {
|
|
@@ -15819,7 +15903,8 @@ async function renderHwpxInternal(input, options) {
|
|
|
15819
15903
|
const verFile = zip.file("version.xml");
|
|
15820
15904
|
const verXml = verFile ? await readZipEntry(verFile, "text") : void 0;
|
|
15821
15905
|
const appMajor = hwpxAppMajor(verXml), appBuild = hwpxAppBuild(verXml);
|
|
15822
|
-
const
|
|
15906
|
+
const headXml = headFile ? await readZipEntry(headFile, "text") : void 0;
|
|
15907
|
+
let styles = headXml ? parseRenderStyles(headXml, { appMajor, appBuild }) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
|
|
15823
15908
|
if (!headFile) warnings.push("header.xml \uC5C6\uC74C \u2014 \uAE30\uBCF8 \uC2A4\uD0C0\uC77C\uB85C \uB80C\uB354");
|
|
15824
15909
|
const secXmls = [];
|
|
15825
15910
|
for (const f of secFiles) {
|
|
@@ -15827,6 +15912,10 @@ async function renderHwpxInternal(input, options) {
|
|
|
15827
15912
|
if (xml.length > MAX_DECOMPRESS_SIZE) throw new KordocError("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
15828
15913
|
secXmls.push(xml);
|
|
15829
15914
|
}
|
|
15915
|
+
if (headXml && hasKoPubSubst(headXml)) {
|
|
15916
|
+
const alt = parseRenderStyles(headXml, { appMajor, appBuild, substKoPub: true });
|
|
15917
|
+
if (kopubSubstituted(secXmls, styles, alt)) styles = alt;
|
|
15918
|
+
}
|
|
15830
15919
|
const masterPages = /* @__PURE__ */ new Map();
|
|
15831
15920
|
const masterXmls = [];
|
|
15832
15921
|
for (const file of zip.file(/Contents\/masterpage[^/]*\.xml$/i)) {
|
|
@@ -20086,4 +20175,4 @@ export {
|
|
|
20086
20175
|
cropRect,
|
|
20087
20176
|
extractRenderedRegions
|
|
20088
20177
|
};
|
|
20089
|
-
//# sourceMappingURL=chunk-
|
|
20178
|
+
//# sourceMappingURL=chunk-YEYNBH5W.js.map
|