Bug 45284 - formulas in writer file exported to word are sized incorrectly
Summary: formulas in writer file exported to word are sized incorrectly
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Formula Editor (show other bugs)
Version: 3.5.0 RC2
Hardware: Other All
: medium normal
Assignee: Not Assigned
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-26 12:41 UTC by Yury
Modified: 2014-01-20 09:00 UTC (History)
5 users (show)

See Also:
i915 platform:
i915 features:


Attachments
remove appending of the hard-coded font sizes (made against git checkout) (1.09 KB, text/plain)
2012-01-26 12:41 UTC, Yury
Details
10pt equivalent of ooo's "{a123} wideslash {b456}" made in word (15.50 KB, application/msword)
2012-03-03 03:08 UTC, Yury
Details
14pt equivalent of "{a123} wideslash {b456}" made in word (15.50 KB, application/msword)
2012-03-03 03:10 UTC, Yury
Details
10pt imported with 3.5.1rc1 (33.59 KB, image/png)
2012-03-03 03:15 UTC, Yury
Details
14pt imported with 3.5.1rc1 (34.30 KB, image/png)
2012-03-03 03:16 UTC, Yury
Details
10pt imported with patched 3.5.0 (40.12 KB, image/png)
2012-03-03 03:16 UTC, Yury
Details
14pt imported with patched 3.5.0 (39.27 KB, image/png)
2012-03-03 03:17 UTC, Yury
Details

Description Yury 2012-01-26 12:41:06 UTC
Created attachment 56202 [details]
remove appending of the hard-coded font sizes (made against git checkout)

This is about formulas in writer file which is being exported (saved as) microsoft word .doc file. 

The current conversion routines in starmath/ subdir append hard-coded font sizes ("size 12" to normal content, "size 8" to super- and subscripts etc.), regardless of what is set in LibreOffice formula editor's settings. That is, of course, completely wrong approach. This way formulas are, in fact, corrupted. There are many tickets for this issue filed in OOO bugzilla, by the way.

One way of correcting this is proposed in a patch attached, pending the implementation of "completely correct" way of exporting font sizes in formulas to .doc (in ole streams attributes). This patch just removes the code which adds "size %d {" and corresponding "}".

"Works for me", as now I'm able to export many-formulas document to word's .doc and not have to *edit* each and every of those, if something other than "size 12" is required (I still have to double-click each and every of those to correct the previews, but that's another problem, albeit related).
Comment 1 sasha.libreoffice 2012-02-17 07:55:23 UTC
@ Michael
Please, take look at this bug. Appears that it contains ready patch for fixing this bug.
Comment 2 sasha.libreoffice 2012-02-29 01:23:25 UTC
@ Ivan
Please, take look at this bug. Appears that it contains ready patch for fixing
this bug.
Comment 3 Michael Stahl 2012-02-29 02:13:01 UTC
sounds plausible, but i know ~nothing about WW8;
Caolan, Cedric, Lubos: please take a look at the patch here
Comment 4 Caolán McNamara 2012-02-29 04:06:51 UTC
seeing as this is a patch to the import, I guess the problem is a round trip from .doc back to .doc again ?

Can you attach a demo document which shows the problem that this fixes. Its been a very long time since I played with the MathType format.
Comment 5 Ivan Timofeev (retired) 2012-02-29 07:16:37 UTC
Heh, since I am in the CC list... :)
The patch looks a bit weird to me: it removes the support of the SIZE record of the MTEF. However, MTEF is the format I am not familiar with, I have just downloaded the specification and looking into it right now. :)
Comment 6 Yury 2012-02-29 10:38:29 UTC
I'll attach a prepared and re-tested example tomorrow. 

And, like I said before, this patch is not a real solution, but a kludge, really. 

As I don't understand the starmath module too well myself, I've just removed ("hacked off") a provision for inserting the "size" tag, which is abused by export to Word Eq. editor AND import from Word Eq. editor routines. Personally, I can live without "size" tag (I'd rather have a global font size(s) changing control/dialog), but the effective corruption of formulas by insertion of "size 12", "size 8" is quite a PITA.
Comment 7 Yury 2012-03-03 03:08:47 UTC
Created attachment 57967 [details]
10pt equivalent of ooo's "{a123} wideslash {b456}" made in word
Comment 8 Yury 2012-03-03 03:10:58 UTC
Created attachment 57968 [details]
14pt equivalent of "{a123} wideslash {b456}" made in word
Comment 9 Yury 2012-03-03 03:15:51 UTC
Created attachment 57969 [details]
10pt imported with 3.5.1rc1
Comment 10 Yury 2012-03-03 03:16:17 UTC
Created attachment 57970 [details]
14pt imported with 3.5.1rc1
Comment 11 Yury 2012-03-03 03:16:55 UTC
Created attachment 57971 [details]
10pt imported with patched 3.5.0
Comment 12 Yury 2012-03-03 03:17:21 UTC
Created attachment 57972 [details]
14pt imported with patched 3.5.0
Comment 13 Yury 2012-03-03 03:36:01 UTC
Okay, here come the examples. Two files contain an equivalent of "{a123} wideslash {b456}" prepared in Word 2003 eqaution editor. One was composed with font size set to 10pt, another — to 14 pt. 

Please note that the overall formula's font size in examples isn't actually included into mathtype equation elements, but is put into a position preceding the equation proper. This is deduced from the binary comparison results.

Now, the import screens show where things go wrong in the mainstream LibO/OOO:

1) The formula's font size (10pt or 14pt in this case) is lost. The actual formula font size setting is in all cases 11pt (as set as default in local installation; dialog not shown), and so differs with what was actually set in Word file. This is, however, bearable.

2) What's worse, formulas get sprayed with «size 12» and «size 8» (these are arbitrary sizes taken from the array in the starmath/source/mathtype.cxx, in function MathType::Init()), which is completely unacceptable. Just imagine clearing those out in 100 formulas or so.

P.S. As a side question, I notice that, e.g., CmathOOO extension is capable of composing the formula «on the run» and inserting it with font size and face taken from paragraph style. How difficult would it be to implement: 1) *optional* setting of font size and face in imported formulas to whatever was set in imported file (say, Times New Roman and 10pt); 2) batch changing of the font faces and sizes of all formulas in LibO/OOO document; optionally, do it like it's done in KDE fonts dialog (adjust face only, or size only, etc.)?
Comment 14 Cédric Bosdonnat 2014-01-20 09:00:31 UTC
Restricted my LibreOffice hacking area


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.