From 235c1828e659b7644a76eff62d1f729a57ad6501 Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Wed, 28 Jan 2026 11:11:28 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84(export)=20improve=20heading=20line?= =?UTF-8?q?=20height?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Import heading line height mapping for PDF export to match the one used in the doc. --- .../assets/doc-export-regressions.pdf | 105 +++++++++--------- .../__tests__/app-impress/doc-export.spec.ts | 6 +- .../doc-export/blocks-mapping/headingPDF.tsx | 1 + 3 files changed, 59 insertions(+), 53 deletions(-) diff --git a/src/frontend/apps/e2e/__tests__/app-impress/assets/doc-export-regressions.pdf b/src/frontend/apps/e2e/__tests__/app-impress/assets/doc-export-regressions.pdf index 42f9f0ac..8bc0166a 100644 --- a/src/frontend/apps/e2e/__tests__/app-impress/assets/doc-export-regressions.pdf +++ b/src/frontend/apps/e2e/__tests__/app-impress/assets/doc-export-regressions.pdf @@ -192,10 +192,10 @@ endobj (react-pdf) endobj 55 0 obj -(D:20260120141652Z) +(D:20260128100716Z) endobj 56 0 obj -(chromium-1944-0-doc-export-override-content) +(chromium-8039-0-doc-export-override-content) endobj 52 0 obj << @@ -216,7 +216,7 @@ endobj 58 0 obj << /Type /FontDescriptor -/FontName /NRSKJK+Inter18pt-Regular +/FontName /FDAZSC+Inter18pt-Regular /Flags 4 /FontBBox [-742.1875 -323.242187 2579.589844 1109.375] /ItalicAngle 0 @@ -232,7 +232,7 @@ endobj << /Type /Font /Subtype /CIDFontType2 -/BaseFont /NRSKJK+Inter18pt-Regular +/BaseFont /FDAZSC+Inter18pt-Regular /CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) @@ -247,7 +247,7 @@ endobj << /Type /Font /Subtype /Type0 -/BaseFont /NRSKJK+Inter18pt-Regular +/BaseFont /FDAZSC+Inter18pt-Regular /Encoding /Identity-H /DescendantFonts [59 0 R] /ToUnicode 60 0 R @@ -256,7 +256,7 @@ endobj 62 0 obj << /Type /FontDescriptor -/FontName /XTJBQL+Inter18pt-Bold +/FontName /UEJHFC+Inter18pt-Bold /Flags 4 /FontBBox [-790.527344 -334.472656 2580.566406 1114.746094] /ItalicAngle 0 @@ -272,7 +272,7 @@ endobj << /Type /Font /Subtype /CIDFontType2 -/BaseFont /XTJBQL+Inter18pt-Bold +/BaseFont /UEJHFC+Inter18pt-Bold /CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) @@ -287,7 +287,7 @@ endobj << /Type /Font /Subtype /Type0 -/BaseFont /XTJBQL+Inter18pt-Bold +/BaseFont /UEJHFC+Inter18pt-Bold /Encoding /Identity-H /DescendantFonts [63 0 R] /ToUnicode 64 0 R @@ -296,7 +296,7 @@ endobj 66 0 obj << /Type /FontDescriptor -/FontName /EDRVHV+Inter18pt-Italic +/FontName /EUMTON+Inter18pt-Italic /Flags 68 /FontBBox [-747.558594 -323.242187 2595.703125 1109.375] /ItalicAngle -9.398804 @@ -312,7 +312,7 @@ endobj << /Type /Font /Subtype /CIDFontType2 -/BaseFont /EDRVHV+Inter18pt-Italic +/BaseFont /EUMTON+Inter18pt-Italic /CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) @@ -327,7 +327,7 @@ endobj << /Type /Font /Subtype /Type0 -/BaseFont /EDRVHV+Inter18pt-Italic +/BaseFont /EUMTON+Inter18pt-Italic /Encoding /Identity-H /DescendantFonts [67 0 R] /ToUnicode 68 0 R @@ -336,7 +336,7 @@ endobj 70 0 obj << /Type /FontDescriptor -/FontName /JIDLHQ+GeistMono-Regular +/FontName /HIJACG+GeistMono-Regular /Flags 5 /FontBBox [-1738 -247 654 1012] /ItalicAngle 0 @@ -352,7 +352,7 @@ endobj << /Type /Font /Subtype /CIDFontType2 -/BaseFont /JIDLHQ+GeistMono-Regular +/BaseFont /HIJACG+GeistMono-Regular /CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) @@ -367,7 +367,7 @@ endobj << /Type /Font /Subtype /Type0 -/BaseFont /JIDLHQ+GeistMono-Regular +/BaseFont /HIJACG+GeistMono-Regular /Encoding /Identity-H /DescendantFonts [71 0 R] /ToUnicode 72 0 R @@ -376,7 +376,7 @@ endobj 74 0 obj << /Type /FontDescriptor -/FontName /SELAIX+Inter18pt-BoldItalic +/FontName /IKVFNP+Inter18pt-BoldItalic /Flags 68 /FontBBox [-795.898437 -334.472656 2596.191406 1114.746094] /ItalicAngle -9.398804 @@ -392,7 +392,7 @@ endobj << /Type /Font /Subtype /CIDFontType2 -/BaseFont /SELAIX+Inter18pt-BoldItalic +/BaseFont /IKVFNP+Inter18pt-BoldItalic /CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) @@ -407,7 +407,7 @@ endobj << /Type /Font /Subtype /Type0 -/BaseFont /SELAIX+Inter18pt-BoldItalic +/BaseFont /IKVFNP+Inter18pt-BoldItalic /Encoding /Identity-H /DescendantFonts [75 0 R] /ToUnicode 76 0 R @@ -692,21 +692,24 @@ endstream endobj 6 0 obj << -/Length 1381 +/Length 1393 /Filter /FlateDecode >> stream -xn6,m -6CC"MmրCj*-SGHPtmn Q)v mtT(`'tꇻ?_߽CC{48!ÛY q >VtiDp2QN &+ZF>@B+zs|„+>oH*Ҡ>^ Un -+r*њ :J.qplIBV&J^TX:jP}*ğ略`iIN6TZfI?۝Ϋ%؍kdTBKMZ:_5z *JSn6#ɣxeC@68Ԗ -ܓxu δ@UŪԷETbPmszh]\3 E(n=#z=L]1qHK:E֞81Q’>Qd ixd(`uX1`H&~Hfq 8Uqf .ê^4~mf`&e -Ps_9PpKKfx]=wtQzg]2Kn߬~Vrbc#YZK oCV+؀9Gpoɶ4JUSeotH8)aRf:wzهOμZ>4jZ>k|rlfKk`ޒ1 -+0o>|$ַES{a?2 S; +ե26-WkR1vM]Dxٮ39Usњ@243 % F%Wq\ xtB{(̠I:9NmlrPGXplC"@P#΅Lg,Nc m?9M0P$L8LЫ<;ZDS13["ĒT͉}:JcCӭUiWgvuXg~I0]CI:}G43'%3 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N=8wlKT7C/Q:'6 ƏA1'\:n-gZ89)@騨l{ʫ֛Ob4}B7׾1eFFz -O} +B7ÿ'ih1=쁙h(<ɰx*g"u#yANEJg +)((/2tAӻ#$ew=:Ɓd‡0bt| lY DD?Ɯre9Ծȟk>`ۂVVퟭ7_N37 }?c>y~=Zk=ˌtpW?Lw endstream endobj 77 0 obj @@ -1325,10 +1326,10 @@ xref 0000000059 00000 n 0000005563 00000 n 0000006178 00000 n -0000026254 00000 n +0000026266 00000 n 0000001770 00000 n 0000001585 00000 n -0000033101 00000 n +0000033127 00000 n 0000002627 00000 n 0000007053 00000 n 0000007208 00000 n @@ -1336,24 +1337,24 @@ xref 0000000526 00000 n 0000000650 00000 n 0000000752 00000 n -0000032010 00000 n +0000032036 00000 n 0000000883 00000 n 0000000985 00000 n 0000001116 00000 n 0000001218 00000 n 0000001350 00000 n 0000001452 00000 n -0000037952 00000 n -0000045271 00000 n -0000054156 00000 n -0000062501 00000 n -0000071744 00000 n -0000080223 00000 n -0000082133 00000 n +0000037978 00000 n +0000045297 00000 n +0000054182 00000 n +0000062527 00000 n +0000071770 00000 n +0000080249 00000 n +0000082159 00000 n 0000024508 00000 n 0000002219 00000 n 0000002079 00000 n -0000091285 00000 n +0000091311 00000 n 0000007311 00000 n 0000007428 00000 n 0000007558 00000 n @@ -1387,23 +1388,23 @@ xref 0000006330 00000 n 0000006609 00000 n 0000024118 00000 n -0000031739 00000 n -0000032307 00000 n -0000036923 00000 n -0000044355 00000 n -0000052437 00000 n -0000061643 00000 n -0000070822 00000 n -0000079503 00000 n -0000081429 00000 n -0000083219 00000 n +0000031765 00000 n +0000032333 00000 n +0000036949 00000 n +0000044381 00000 n +0000052463 00000 n +0000061669 00000 n +0000070848 00000 n +0000079529 00000 n +0000081455 00000 n +0000083245 00000 n trailer << /Size 87 /Root 3 0 R /Info 52 0 R -/ID [<6a2a704b01cba44185a92d8d4bcaa9d7> <6a2a704b01cba44185a92d8d4bcaa9d7>] +/ID [<2f4ec8da7e87471807031f721b6c9ac2> <2f4ec8da7e87471807031f721b6c9ac2>] >> startxref -101700 +101726 %%EOF diff --git a/src/frontend/apps/e2e/__tests__/app-impress/doc-export.spec.ts b/src/frontend/apps/e2e/__tests__/app-impress/doc-export.spec.ts index 03487205..e6e76a98 100644 --- a/src/frontend/apps/e2e/__tests__/app-impress/doc-export.spec.ts +++ b/src/frontend/apps/e2e/__tests__/app-impress/doc-export.spec.ts @@ -397,7 +397,11 @@ export const comparePDFWithAssetFolder = async (download: Download) => { expect(genPage.width).toBe(refPage.width); expect(genPage.height).toBe(refPage.height); - expect(genPage.data).toStrictEqual(refPage.data); + try { + expect(genPage.data).toStrictEqual(refPage.data); + } catch { + throw new Error(`PDF page ${i + 1} screenshot does not match reference.`); + } } }; diff --git a/src/frontend/apps/impress/src/features/docs/doc-export/blocks-mapping/headingPDF.tsx b/src/frontend/apps/impress/src/features/docs/doc-export/blocks-mapping/headingPDF.tsx index 18700f72..12ebfeec 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-export/blocks-mapping/headingPDF.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-export/blocks-mapping/headingPDF.tsx @@ -57,6 +57,7 @@ export const blockMappingHeadingPDF: DocsExporterPDF['mappings']['blockMapping'] style={{ fontSize: levelFontSizeEM * FONT_SIZE * PIXELS_PER_POINT, fontWeight: 700, + lineHeight: 1.25, marginTop: `${fontSizeEM * MERGE_RATIO}px`, marginBottom: `${fontSizeEM * MERGE_RATIO}px`, }}