Apache OpenOffice (AOO) Bugzilla – Issue 25247
font changed on import from word
Last modified: 2013-08-07 14:42:35 UTC
oo 680m22 on windows 2003- when opening the attached word file, all the fonts changed from miriam to times new roman, althugh I have miriam installed on my computer.
Created attachment 12990 [details] word file
another example can be seen in the file attached to issue #25561 : attachment #13198 [details]
adding dina as cc
DL->MRU: Could you please handle this?
MRU->MM: The CTL font of the default paragraph style has been imported as "Times New Roman" instead of "Miriam".
Please add keywords: ms_interoperability
ayaniger -> sforbes I opened the attached file in MS Word 2002 on XP, copied the document to the clipboard, pasted it into a new document, and saved it. When I opened the new document in OOo 1.1.2, Miriam appeared as Miriam, and was not changed to Times New Roman. Perhaps the problem exists only on certain versions of MS Word. On which version of MS Word was the attached document "aliza.doc" created? Alan
PS - the "attached file" that I referred to is the file "aliza.doc" that was previously attached to this issue.
* the document was sent to me by email- it was probably created with office2k * the bug is not about copy/paste from word, but about opening the document directly in OOo.
Set to target OOoLater due to lack of resources.
mmaher->flr: Yours I think
assigning to hbrinkm
Created attachment 39115 [details] Handles case where the default CTL font is not set
Created attachment 39117 [details] test documents
The problem happens when in Word the CTL font is not changed from the default in the base style. When Word sees this, it acts as if no CTL font at all was set in the base style, and instead relies on the fourth font in the document's font table (in this case Miriam) as a default CTL font for Hebrew. Word does not write a 0x4a5e parameter for the base style in this case. (It *does* write one if the font is changed to anything else.) Since the document contains no CTL font setting for the base style, this misleads OOo. When OOo imports the document, it does not see a font set for the base style, so it uses its own default CTL font, which may or may not be Miriam. The attached patch checks if the default CTL font was not set, and if so, sets the default CTL font to be the fourth entry in the document's font table. I am also attaching documents used for testing this bug. i25247_aliza_test.doc is a shortened form of the original document submitted by the reporter, sforbes. i25247_aliza_test_david.doc has the CTL font in the base style changed to David. If you hex dump this file, you'll notice that there is an extra x4a5E parameter. i25247_aliza_test_poked.doc has the name “Miriam†in the font table modified by a hex editor to be named “Niriamâ€. In this case, Word uses a fallback font, “Arialâ€. Caolan McNamara provided an enormous amount of help with this. For more details, see the discussion between Caolan and myself at : http://sw.openoffice.org/servlets/BrowseList?list=dev&by=thread&from=1496917
There may also be a need to make a similar check for CJK fonts, and add to the code: if (ftcStandardChpCJKStsh == 0) ftcStandardChpCJKStsh = 2; However, I did not check this.
patch applied and approved
I found that for certain documents, font number 3 in the font table was a Chinese font, SimSun. Because of this, the previous patch caused documents that would have otherwise been imported properly to be displayed in a Chinese font. To avoid this, I'm posting a new patch that adds a check to make sure that font number 3 is in fact Hebrew. (Is there a simple way to generalize this for all CTL languages?) Apparently, different versions of Word have different ways of writing CTL fonts in the font table.
Created attachment 40544 [details] New patch: checks for CTL font
Created attachment 40545 [details] Example Hebrew document where font table[3] isn't Hebrew
Created attachment 40556 [details] Same patch, but with a null pointer check
fixed
ready for QA
Verified fix in CWS docstatfix.
Checked fix in OO 2.2 rc build OOF680m7.