Bug 114140 - [ODF] Improve the font-face for embedded fonts included in the file
Summary: [ODF] Improve the font-face for embedded fonts included in the file
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Keywords: implementationError
Depends on:
Blocks: ODF-export-invalid Fonts-Embedded
  Show dependency treegraph
Reported: 2017-11-29 15:20 UTC by Regina Henschel
Modified: 2021-12-06 14:39 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:
Regression By:

File generated by LibreOffice with embedded fonts (2.94 MB, application/vnd.oasis.opendocument.text)
2017-11-29 15:20 UTC, Regina Henschel

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2017-11-29 15:20:46 UTC
Created attachment 138068 [details]
File generated by LibreOffice with embedded fonts

For describing and embedding this structure is used e.g. (see attached file)
  <style:font-face style:name="Cambria" svg:font-family="Cambria" style:font-family-generic="roman">
      <svg:font-face-uri xlink:href="Fonts/font3.ttf" xlink:type="simple">
        <svg:font-face-format svg:string="truetype"/>
      <svg:font-face-uri xlink:href="Fonts/font4.ttf" xlink:type="simple">
        <svg:font-face-format svg:string="truetype"/>
      <svg:font-face-uri xlink:href="Fonts/font5.ttf" xlink:type="simple">
        <svg:font-face-format svg:string="truetype"/>
      <svg:font-face-uri xlink:href="Fonts/font6.ttf" xlink:type="simple">
        <svg:font-face-format svg:string="truetype"/>

The files font3.ttf to font6.ttf contain the different font faces regular, bold, italic and bold-italic.

The ODF schema allows several <svg:font-face-uri> child elements for a <svg:font-face-src> element. The purpose of that feature is, that you can include different formats of the same font, e.g. "truetype" or "opentype" or "type-1". The format itself is then given in the <svg:font-face-format> element.

This feature is miss-used here to include different fonts into one <svg:font-face-src> element.

Problems with that:

The font descriptor attributes of the <style:font-face> element would allow a very detailed description of the font, but that is here not possible, because different fonts are in included. Consumers will not directly know, which font is to be used for e.g. italic.

At the time the file is written LibreOffice knows the font characteristics. But it does not save this information. So when opening the file, LibreOffice has to do again a detection in the font files themselves to recreate this information. That is avoidable effort.

Solution is to use for each font file its own <style:font-face> declaration.
Comment 1 Kevin Suo 2017-12-01 12:40:42 UTC
Added keyword implementationError.
Comment 2 Kevin Suo 2017-12-01 12:47:05 UTC
Changed Summary to reflect the description. Please correct me if  I Did it wrong.
Comment 3 QA Administrators 2018-12-04 03:48:20 UTC Comment hidden (obsolete)
Comment 4 Regina Henschel 2018-12-04 13:22:10 UTC
It has become worse. Now attributes loext:font-style and loext:font-weight exist as attributes of svg:font-face-uri. The correct solution would be svg:font-style and svg:font-weight as attributes of style:font-face.

Tested with Version: (x64)
Build ID: d71ea82055a6a304493c7eaa90809a348e23784d
CPU threads: 8; OS: Windows 10.0; UI render: GL; VCL: win; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2018-11-19_04:56:18
Locale: de-DE (en_US); UI-Language: en-US
Calc: threaded
Comment 5 QA Administrators 2019-12-05 04:26:25 UTC Comment hidden (obsolete)
Comment 6 Regina Henschel 2019-12-06 11:44:58 UTC
The problem still exists in Version: (x64)
Build ID: 800b6f095f95ccfb8a7ba9755292332bf97f97ad
CPU threads: 8; OS: Windows 10.0 Build 18362; UI render: default; VCL: win; 
Locale: de-DE (en_US); UI-Language: en-US
Calc: threaded
Comment 7 QA Administrators 2021-12-06 04:04:58 UTC Comment hidden (obsolete)
Comment 8 Regina Henschel 2021-12-06 14:13:04 UTC
The error still exists in Version: (x64) / LibreOffice Community
Build ID: 4ac9032163cf55c160145373e7c41741c9c339ca
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: de-DE (en_US); UI: de-DE
Calc: CL