[Bug 60240] New: gdi32/win32u: memory font without OS/2 table is skipped by the font engine, breaking embedded fonts of LibreOffice-generated PDFs
http://bugs.winehq.org/show_bug.cgi?id=60240 Bug ID: 60240 Summary: gdi32/win32u: memory font without OS/2 table is skipped by the font engine, breaking embedded fonts of LibreOffice-generated PDFs Product: Wine Version: 10.9 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: gdi32 Assignee: wine-bugs@list.winehq.org Reporter: exmov71@gmail.com Target Milestone: --- Distribution: --- Created attachment 81939 --> http://bugs.winehq.org/attachment.cgi?id=81939 trace, reproducer, proposed fix LibreOffice (tested with 24.8) exports PDF files with subset-embedded TrueType fonts that contain no `OS/2` table. When such a document is opened in a WPF-based viewer running under wine (in our case DevExpress Xpf.PdfViewer, .NET Framework 4.7.2), all glyphs of these fonts render as boxes/nothing. On native Windows 11 the very same document and application display correctly. WINEDEBUG=+font pinpoints the cause — dlls/win32u/freetype.c, new_ft_face(): ``` 0024:trace:font:new_ft_face Loading font from ptr 0x... size 9160, index 0 0024:trace:font:new_ft_face Font (null)/0x... lacks either an OS2, HHEA or HEAD table. Skipping this font. ``` The loader requires OS/2 **and** HHEA **and** HEAD to be present. The LibreOffice subsetter emits head/hhea but never OS/2, so every embedded font of such documents is silently dropped. Minimal reproducer (attached): * `lo.ttf` — TrueType subset extracted from a problem PDF (no OS/2 table, only a Macintosh (1,0) format-0 cmap; produced by LibreOffice); * `a_os2.ttf` — byte-identical file except a synthesized minimal OS/2 v4 table added; * `addfont_probe.cs/.csproj` — tiny C# console program calling gdi32!AddFontMemResourceEx on both files. Results under wine-11.16: ``` lo.ttf -> AddFontMemResourceEx returns NULL ("Skipping this font" in +font log) a_os2.ttf -> registered OK, fontsAdded=1 ``` Full trace excerpt attached (`wine_trace_excerpt.txt`). Note for triage: native Windows 11 applies *different* additional requirements in AddFontMemResourceEx itself (it rejects both attached files, apparently because of the missing Unicode cmap). The divergence relevant to this report is that Windows font loaders used by real applications (WPF / DirectWrite path) happily consume the OS/2-less font — the LibreOffice document renders fine on Windows 11 — while wine's loader rejects it solely because of the missing OS/2 table. Since LO-exported PDFs are extremely common, any PDF viewer relying on the Wine font engine is affected. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=60240 Ken Sharp <imwellcushtymelike@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch, testcase -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=60240 Ken Sharp <imwellcushtymelike@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|10.9 |11.16 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=60240 --- Comment #1 from Nikolay Sivov <bunglehead@gmail.com> --- If AddFontMemResourceEx() is not supposed to work for those fonts, why mentioning and testing it? Any chance you could provide a test WPF program that replicates rendering issue with such font? -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=60240 --- Comment #2 from AZh <exmov71@gmail.com> --- Created attachment 81944 --> http://bugs.winehq.org/attachment.cgi?id=81944 TestApp sources -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=60240 --- Comment #3 from AZh <exmov71@gmail.com> --- Created attachment 81945 --> http://bugs.winehq.org/attachment.cgi?id=81945 TestApp binaries part 1 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=60240 --- Comment #4 from AZh <exmov71@gmail.com> --- Created attachment 81946 --> http://bugs.winehq.org/attachment.cgi?id=81946 TestApp binaries part 2 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=60240 AZh <exmov71@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #81945|TestApp binaries part 1 |TestApp binaries part 1 description| |(1/2) -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=60240 AZh <exmov71@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #81946|TestApp binaries part 2 |TestApp binaries part 1 description| |(2/2) -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=60240 AZh <exmov71@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #81946|TestApp binaries part 1 |TestApp binaries part 2 description|(2/2) |(2/2) -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=60240 --- Comment #5 from AZh <exmov71@gmail.com> --- Created attachment 81947 --> http://bugs.winehq.org/attachment.cgi?id=81947 TestApp under WINE -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=60240 --- Comment #6 from AZh <exmov71@gmail.com> --- Created attachment 81948 --> http://bugs.winehq.org/attachment.cgi?id=81948 TestApp on Win11 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=60240 --- Comment #7 from AZh <exmov71@gmail.com> --- Added test app: * TestApp binaries - ready to run binaries, run it with provided sample `.\PdfViewerTest.exe .\test-file.pdf` * TestApp sources - run build.cmd to build the app. The .NET SDK and .Net Framework 4.7.2 are required. The build also uses the DevExpress assemblies from the binaries archive (see csproj file). * Two screenshots under WINE and Win 11 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla