Bug 153041 - Empty document ODT includes unnecessary font declarations
Summary: Empty document ODT includes unnecessary font declarations
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: low minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Document-Options
  Show dependency treegraph
 
Reported: 2023-01-16 11:32 UTC by Eyal Rozenberg
Modified: 2023-05-07 19:38 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eyal Rozenberg 2023-01-16 11:32:16 UTC
If I create a new Writer document and save it, contents.xml contains:

<office:font-face-decls>
  <style:font-face style:name="David CLM" svg:font-family="&apos;David CLM&apos;"/>
  <style:font-face style:name="David CLM1" svg:font-family="&apos;David CLM&apos;"
       style:font-family-generic="system" style:font-pitch="variable"/>
  <style:font-face style:name="Liberation Sans" svg:font-family="&apos;Liberation Sans&apos;"
       style:font-family-generic="swiss" style:font-pitch="variable"/>
  <style:font-face style:name="Liberation Serif" svg:font-family="&apos;Liberation Serif&apos;"
       style:font-family-generic="roman" style:font-pitch="variable"/>
  <style:font-face style:name="Nachlieli CLM" svg:font-family="&apos;Nachlieli CLM&apos;"
       style:font-family-generic="system" style:font-pitch="variable"/>
  <style:font-face style:name="Noto Sans CJK SC" svg:font-family="&apos;Noto Sans CJK SC&apos;"
       style:font-family-generic="system" style:font-pitch="variable"/>
  <style:font-face style:name="Noto Serif CJK SC" svg:font-family="&apos;Noto Serif CJK SC&apos;"
       style:font-family-generic="system" style:font-pitch="variable"/>
</office:font-face-decls>

never mind the specifics of these font-face elements; it does not seem any of them should be present. If anything, they are relevant to the styles embedded in this document - which IIUC belong in styles.xml. In fact, styles.xml does actually have this same font-face-decls element already!

Adding it seems like a bug to me.

I'm also not sure that font-face-decls belong in contents.xml even for documents which are non-empty, and even if they have DF involving font settings - but that is for ODF experts to say.
Comment 1 Rafael Lima 2023-01-16 11:53:48 UTC
My content.xml is a bit different. It does not contain the David CLM font:

<office:font-face-decls>
    <style:font-face style:name="Liberation Sans" svg:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/>
    <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/>
    <style:font-face style:name="Noto Sans CJK SC" svg:font-family="'Noto Sans CJK SC'" style:font-family-generic="system" style:font-pitch="variable"/>
    <style:font-face style:name="Noto Sans Devanagari" svg:font-family="'Noto Sans Devanagari'" style:font-family-generic="swiss"/>
    <style:font-face style:name="Noto Sans Devanagari1" svg:font-family="'Noto Sans Devanagari'" style:font-family-generic="system" style:font-pitch="variable"/>
    <style:font-face style:name="Noto Serif CJK SC" svg:font-family="'Noto Serif CJK SC'" style:font-family-generic="system" style:font-pitch="variable"/>
</office:font-face-decls>

I also confirm that these exact same declarations appear in styles.xml as well.

However, I don't know if there's a reason for these declarations to be duplicated. All I know is that removing them will corrupt the file and it won't open in LO.
Comment 2 Eyal Rozenberg 2023-01-16 12:56:01 UTC
(In reply to Rafael Lima from comment #1)
> All I know is that removing them will corrupt the file and it
> won't open in LO.

Hmm. That sounds like it might be a separate bug. Unless there's something we're missing.
Comment 3 Tammy 2023-01-29 19:32:11 UTC
What version of LibreOffice are you using?
Are you using a Linux or Windows machine?
Comment 4 Eyal Rozenberg 2023-01-30 08:26:57 UTC
Sorry. It's:

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: ad387d5b984c6666906505d25685065f710ed55d
CPU threads: 4; OS: Linux 6.0; UI render: default; VCL: gtk3
Locale: en-IL (en_IL); UI: en-US
Comment 5 Buovjaga 2023-03-22 14:16:32 UTC
Asked in the dev chat and this is a relevant cleanup task, if someone wants to put in the research effort.
Comment 6 Eyal Rozenberg 2023-05-07 19:38:43 UTC Comment hidden (obsolete)