Bug 116749 - Font size and font of Formula object are not kept when displaying the OLE object in Microsoft Word or Powerpoint, OOXML and ODF formated documents
Summary: Font size and font of Formula object are not kept when displaying the OLE obj...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
5.4.6.2 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: interoperability
Keywords: filter:docx, filter:pptx
Depends on:
Blocks: DOCX-Formula PPTX
  Show dependency treegraph
 
Reported: 2018-04-02 13:24 UTC by Shimi Chen
Modified: 2018-11-05 20:26 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Video showing a file in Impress, saving it as pptx and opening in PowerPoint, which shows the bug (3.34 MB, video/ogg)
2018-04-02 14:04 UTC, Shimi Chen
Details
Presentation file with a large (120 point) formula (odp) (14.84 KB, application/vnd.oasis.opendocument.presentation)
2018-04-02 14:06 UTC, Shimi Chen
Details
Same presentation file but converted by LO to pptx. Opens in PowerPoint with a small font. (20.48 KB, application/wps-office.pptx)
2018-04-02 14:08 UTC, Shimi Chen
Details
Same presentation file, after correcting the font size inside MS Office (37.95 KB, application/wps-office.pptx)
2018-04-02 17:49 UTC, Shimi Chen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Shimi Chen 2018-04-02 13:24:42 UTC
Description:
When saving a docx/pptx (MSXML) file with a large (say 60-point) formula, the font size is not kept. When opening the generated MSXML file in LibreOffice it looks okay-ish (similar size to original odp/odt, but looks a bit different because it is a streched-out 12-point font). However, in MS Office, it just appears as a small 12-point formula.

Steps to Reproduce:
1. Open Writer or Impress
2. Enter some formula (Insert->Object->Formula...)
3. Change font size of the formula to a large value (such as 60)
4. File -> Save a copy...
5. Choose pptx or docx
6. Open the MSXML file in MS Office (tested both 2013 and Online)

Actual Results:  
Formula appears small (12 points)

Expected Results:
Formula should appear big (60 points)


Reproducible: Always


User Profile Reset: Yes



Additional Info:
Version: 6.0.2.1.0+
Build ID: 6.0.2-3
CPU threads: 8; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: en-GB (en_US.utf8); Calc: group


User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0
Comment 1 subha 2018-04-02 13:35:12 UTC
@Shimi Chen
Kindly attach an image with error
Comment 2 Shimi Chen 2018-04-02 14:04:22 UTC
Created attachment 141029 [details]
Video showing a file in Impress, saving it as pptx and opening in PowerPoint, which shows the bug
Comment 3 Shimi Chen 2018-04-02 14:06:58 UTC
Created attachment 141030 [details]
Presentation file with a large (120 point) formula (odp)
Comment 4 Shimi Chen 2018-04-02 14:08:27 UTC
Created attachment 141031 [details]
Same presentation file but converted by LO to pptx. Opens in PowerPoint with a small font.
Comment 5 V Stuart Foote 2018-04-02 14:45:40 UTC
Confirming Office 2016 renders OLE formulas, *both* OOXML/ODF, created with LibreOffice at a smaller scale. Looks to always have a font substitution to Cambria Math at 18 pt. Yet even if in the LibreOffice OLE Formula edit I select Cambria/Cambria Math font at large pt. size--Office 2016 still opens it at fixed 18 pt.

LibreOffice opens either format with correct font and correct point size.

So, is this a OOXML incompatibility? Or a filter import default applied in MS Office and NOTOURBUG?

=-resting-=
Windows 10 Home 64-bit en-US with 

Version: 6.1.0.0.alpha0+ (x64)
Build ID: 655b9054bc265de377c3dc411e2ef40cdfd16dce
CPU threads: 4; OS: Windows 10.0; UI render: GL; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2018-03-27_03:21:52
Locale: en-US (en_US); Calc: CL
Comment 6 Shimi Chen 2018-04-02 17:49:19 UTC
Created attachment 141038 [details]
Same presentation file, after correcting the font size inside MS Office

Please compare the file:
/ppt/slides/slide1.xml
In both this pptx archive and the pptx  archive created by LibreOffice (previous attachment).

MS Office seems to be using the "sz" argument to set the font size of the element (in this case sz=12000, so 100*PointSize), whereas LibreOffice does not use it at all in OOXML and instead just stretches out a 12-point font to a bigger box.

If you open the previous attachment in LibreOffice you can see that the font size in the (seemingly large) formula is in fact only 12, not 120. If you open the current attachment (created by MS Office) in LO, then it fails horribly (it shows 2 separate formulas with different sizes, one of which is identified as a formula with font size of 12 and the other looks like an image, and both are visually much larger than 12).

The "sz" argument seems to be documented as part of the OOXML format:
http://officeopenxml.com/WPtextFormatting.php

But I don't get why it is 12000, should be 240 if I'm reading the definition correctly. However, I don't actually know anything about OOXML, just thought i'd try to poke inside.
Comment 7 Regina Henschel 2018-04-02 21:26:46 UTC
(In reply to V Stuart Foote from comment #5)
> Confirming Office 2016 renders OLE formulas, *both* OOXML/ODF, created with
> LibreOffice at a smaller scale.
Considering OOXML and ODF mixes independent problems: (A) font size in MathML in OpenDocument format, and (B) import/export equations from/to OOXML.

(A)
Currently LibreOffice stores these information in settings.xml. That produces similar problems in storing to flat file format, see bug 76900 and bug 63642. If it is only about font size, then attribute mathsize="120pt" or attribute style="font-size:120pt;" can be used on the root <math> element. That would have the advantage, that export to MathMl (.mml) would get it correct too. For embedded formulas enlarging the rendering via frame size should work too.  Unfortunately MS Office reads none of the solutions correctly.

(B)
As far as I see, OMML (the equation part of OOXML) does not have a distinct element or attribute for font-size in equations. But MS Office uses the common sz attribute of type ST_TextFontSize, which is indeed "hundredths of a point". (chapter 20.1.10.68 in ISO/IEC 29500-1:2026(E)). It adds a "rPr" element with "sz" attribute to each math element if needed. LibreOffice should write this attribute too.

I suggest to focus this issue on error B.