Bug 126936

Summary: Writer: Embedded fonts not used (even though they are in the file)
Product: LibreOffice Reporter: admin
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: major CC: himajin100000, msdobrescu, regis.perdreau, stephane.guillou, xiscofauli
Priority: high    
Version: 5.2.7.2 release   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=141222
https://bugs.documentfoundation.org/show_bug.cgi?id=65353
https://bugs.documentfoundation.org/show_bug.cgi?id=82163
https://bugs.documentfoundation.org/show_bug.cgi?id=140003
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 113338    
Attachments: Bug 126936 sample document

Description admin 2019-08-14 23:49:30 UTC
Description:
Using the embed fonts in document option, the saved document size is much larger, so seems something is being embedded.  However, opening the document on another system without the fonts installed, the fonts are not rendered correctly at all (rendered in some Sans font).

Steps to Reproduce:
1. Create new document with some text using a specialized font that is not installed on the target system
2. Use File > Properties > Font > embed fonts in document
3. Save document and transfer to the target system without the specialized font

Actual Results:
The font that is not installed on the target system is rendered in some default Sans font

Expected Results:
Text should be rendered with the embedded fonts in the document


Reproducible: Always


User Profile Reset: No



Additional Info:
Comment 1 himajin100000 2019-08-24 17:57:52 UTC Comment hidden (obsolete)
Comment 2 himajin100000 2019-08-24 18:05:39 UTC Comment hidden (obsolete)
Comment 3 Xisco Faulí 2019-09-18 11:24:47 UTC Comment hidden (obsolete)
Comment 4 admin 2019-09-18 23:01:17 UTC
Created attachment 154273 [details]
Bug 126936 sample document
Comment 5 Dieter 2019-09-23 06:01:24 UTC
(In reply to himajin100000 from comment #1)
> Reproduced. I tested with Electroharmonix
> http://typodermicfonts.com/electroharmonix/

status NEW because of comment 1
Comment 6 himajin100000 2020-07-23 19:51:40 UTC
After a bit of further test, it became clear

the font I used, i.e. Electroharmonix , has FsType 0x0004.
and cannot be registered even as a temporary font. so, the previous comment of mine should be marked OBSOLETE.

https://opengrok.libreoffice.org/xref/core/vcl/source/gdi/embeddedfontshelper.cxx?r=b1ca0e5a#150

Next, I used GD-HighwayGothicJA-TTF 
available from https://forest.watch.impress.co.jp/library/software/gdhighway/

Note: Ads are often fraudulent. Please be sure that the filename of the file you are downloading is GDHighwayGoJA-Rev108b-TTF.zip

I installed this font and used for both ascii(in case only the Latin fonts checkbox is checked) and Japanese text ( namely 三鷹, a Japanese city with a character in the second index that made me easy to tell if the font is actually used ), and saved to an odt file.

Then, I uninstalled the font and let my own dbgutil LibreOffice build load the file to get the log.

the message I got:
warn:vcl.fonts:1448:12084:vcl/win/gdi/salfont.cxx:1206: temp font was registered but is not in enumeration: file:///C:/build/instdir/program/../user/temp/embeddedfonts/fromdocs/GD-HighwayGothicJA-TTF5.ttf

produced at 
https://opengrok.libreoffice.org/xref/core/vcl/win/gdi/salfont.cxx?r=16ab4c5c&mo=39156&fi=1203#1203

probably after trying to register the font extracted to

https://opengrok.libreoffice.org/xref/core/vcl/source/gdi/embeddedfontshelper.cxx?r=b1ca0e5a#163

Is the message I got related to the cause of this bug?
Comment 7 himajin100000 2020-07-24 13:29:51 UTC
minor typo
a character that made me easy to tell
->
a character that made it easy for me  to tell
Comment 8 Timur 2021-04-15 13:48:46 UTC
Feature unusable, that is major bug for me. Not single document problem.
Comment 9 Timur 2023-11-29 12:38:27 UTC
I retested this. 
Older attachment 154273 [details] opens on another Linux system in current LO master 24.2 showing font missing (italic in Font box). 
ODT and DOCX attachements I created in LO 24.2 open on another Linux system in LO and in MS system in MSO, showing embedded fonts as expected. They appear in font list and can be used. 

So this seems WFM and I close. Should someone retest differently, please explain.
Comment 10 msdobrescu@gmail.com 2023-11-29 12:59:05 UTC
On my system:

Version: 7.5.6.2 (X86_64) / LibreOffice Community
Build ID: 50(Build:2)
CPU threads: 16; OS: Linux 6.1; UI render: default; VCL: gtk3
Locale: ro-RO (C.UTF8); UI: en-US
Gentoo official package
Calc: threaded

It uses a substitution font, actually.

MS Word does that too, just it uses a different font (Calibri).
Comment 11 Stéphane Guillou (stragu) 2023-11-29 15:34:30 UTC
(In reply to msdobrescu@gmail.com from comment #10)
> On my system:
> It uses a substitution font, actually.
> MS Word does that too, just it uses a different font (Calibri).
Which test file did you test with? If it was your own, what version of LO did you create the file with?
Comment 12 msdobrescu@gmail.com 2023-11-29 16:23:23 UTC
I have used attachment 154273 [details].
Comment 13 Stéphane Guillou (stragu) 2023-11-29 17:13:40 UTC
Thank you.
I wouldn't test with an older file, I would try with a new file to see if recent versions behave better in embedding the fonts.

However, I can reproduce with the following steps:

1. Install Respective 2.0 font from https://www.dafont.com/respective.font
2. Create an ODT that uses the font
3. File > Properties > Font > Embed fonts in the document
4. Save and close (file is huge because of some Noto CJK fonts, but can be avoided by unticking "Asian Fonts")
5. Uninstall the font (or deactivate it, which can be done with e.g. the GKT app "Font Manager")
6. Reopen the document

Result: a fallback font is used, even though the extracted file has the corresponding TTF in the Fonts directory.
In the console, I get:

warn:xmloff:605332:605332:xmloff/source/style/XMLFontStylesContext.cxx:221: unknown element urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0 svg:font-face-format

Version: 24.2.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: 5589659829f8a1cef8ca1c8a468732105bbe231b
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded
Comment 14 V Stuart Foote 2024-01-30 15:15:25 UTC
*** Bug 159447 has been marked as a duplicate of this bug. ***
Comment 15 V Stuart Foote 2024-01-30 15:18:22 UTC
From dupe bug 159447

see attachment 192253 [details] and testing font from attachment 192254 [details]