View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0013471 | Scribus | Language Tools | public | 2015-10-25 18:40 | 2015-11-03 01:35 |
Reporter | Kunda | Assigned To | jghali | ||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | closed | Resolution | fixed | ||
Product Version | 1.5.1svn | ||||
Fixed in Version | 1.4.6.svn | ||||
Summary | 0013471: Fix for broken hyphenation language selection | ||||
Description | I discovered a problem in Scribus 1.4.5 where the hyphenation language from the document isn't used after the document is loaded. This is because ScribusMainWindow::loadDoc calls doc->setGUI - which creates the hyphenator - before the document is loaded. At that stage the language will default to the global settings. Furthermore, FileLoader::postLoad resets the hyphenator language to the document language *without reloading the dict*, leaving the hyphenator in an inconsistent state. As for why my global setting was incorrect, I got a new computer a while back and due to Debian's packaging didn't have the correct hyphen dicts installed at first. I'm guessing the global setting has some kind of fallback in case the stored language isn't found on application startup, but I didn't delve into it. The attached patch fixes the document language problem by moving hyphenator creation to a later stage, after the language has been set up. I also took the liberty of removing the offending block of code in the beginning of postLoad since it seems redundant now. The author, Mikko Rasa, has tested patch on 1.5.1svn and patch is successful I haven't tested this patch yet. | ||||
Additional Information | See http://lists.scribus.net/pipermail/scribus-dev/2015-October/002615.html | ||||
Tags | No tags attached. | ||||
Patch | Yes | ||||
|
fix_hyphen_language.patch (2,796 bytes)
diff -ur scribus-1.4.5.orig/scribus/fileloader.cpp scribus-1.4.5/scribus/fileloader.cpp --- scribus-1.4.5.orig/scribus/fileloader.cpp 2014-11-15 03:27:12.000000000 +0200 +++ scribus-1.4.5/scribus/fileloader.cpp 2015-10-25 14:13:18.071109000 +0200 @@ -361,18 +361,6 @@ bool FileLoader::postLoad(ScribusDoc* currDoc) { - //CB #3749 We have to set these up in post load as each format will load into the doc itself - //settings. As the hyphenator was created in the doc constructor, it needs to be updated. - //FIXME: Remove these duplicate settings altogether - if (currDoc->docHyphenator!=0) - { - currDoc->docHyphenator->Automatic=currDoc->Automatic; - currDoc->docHyphenator->AutoCheck=currDoc->AutoCheck; - currDoc->docHyphenator->Language=currDoc->Language; - currDoc->docHyphenator->MinWordLen=currDoc->MinWordLen; - currDoc->docHyphenator->HyCount=currDoc->HyCount; - } - ReplacedFonts = currDoc->AllFonts->getSubstitutions(ReplacedFonts.keys()); if (ReplacedFonts.count() != 0) { diff -ur scribus-1.4.5.orig/scribus/scribus.cpp scribus-1.4.5/scribus/scribus.cpp --- scribus-1.4.5.orig/scribus/scribus.cpp 2014-12-21 13:31:54.000000000 +0200 +++ scribus-1.4.5/scribus/scribus.cpp 2015-10-25 14:08:14.168742300 +0200 @@ -2322,6 +2322,7 @@ view = tempView; tempDoc->setCurrentPage(tempDoc->Pages->at(0)); tempDoc->setGUI(requiresGUI, this, tempView); + tempDoc->createHyphenator(); if (requiresGUI) { tempDoc->docHyphenator->ignoredWords = prefsManager->appPrefs.ignoredWords; @@ -4164,6 +4165,7 @@ doc->setName(FName); doc->setMasterPageMode(false); doc->Language = GetLang(doc->Language); + doc->createHyphenator(); HaveNewDoc(); // propertiesPalette->Cpal->ChooseGrad(0); // propertiesPalette->updateCList(); diff -ur scribus-1.4.5.orig/scribus/scribusdoc.cpp scribus-1.4.5/scribus/scribusdoc.cpp --- scribus-1.4.5.orig/scribus/scribusdoc.cpp 2015-01-15 21:39:01.000000000 +0200 +++ scribus-1.4.5/scribus/scribusdoc.cpp 2015-10-24 16:29:32.020930700 +0300 @@ -635,6 +635,11 @@ m_ScMW=mw; //FIXME: stop using m_View m_View=view; +} + + +void ScribusDoc::createHyphenator() +{ docHyphenator=new Hyphenator(m_ScMW, this); Q_CHECK_PTR(docHyphenator); } diff -ur scribus-1.4.5.orig/scribus/scribusdoc.h scribus-1.4.5/scribus/scribusdoc.h --- scribus-1.4.5.orig/scribus/scribusdoc.h 2015-01-15 21:39:01.000000000 +0200 +++ scribus-1.4.5/scribus/scribusdoc.h 2015-10-24 16:29:32.030931000 +0300 @@ -135,6 +135,7 @@ ScribusView* view() const; ScribusMainWindow* scMW() const {return m_ScMW;} void setGUI(bool hasgui, ScribusMainWindow* mw, ScribusView* view); + void createHyphenator(); /** * @brief Return the guarded object associated with the document |
|
>> The author, Mikko Rasa, has tested patch on 1.5.1svn [...] Not that much apparently. Patch triggers a crash when creating a new doc. |
|
Doh, the 1.4.5 version worked, but apparently I made an error when transcribing the patch to 1.5.0 and then to svn and neglected to fully test that version. I'll attach a fixed patch. |
|
fix_hyphen_language_svn.patch (2,559 bytes)
Index: scribus/fileloader.cpp =================================================================== --- scribus/fileloader.cpp (revision 20495) +++ scribus/fileloader.cpp (working copy) @@ -425,18 +425,6 @@ bool FileLoader::postLoad(ScribusDoc* currDoc) { - //CB #3749 We have to set these up in post load as each format will load into the doc itself - //settings. As the hyphenator was created in the doc constructor, it needs to be updated. - //FIXME: Remove these duplicate settings altogether - if (currDoc->docHyphenator!=0) - { - currDoc->docHyphenator->Automatic=currDoc->hyphAutomatic(); - currDoc->docHyphenator->AutoCheck=currDoc->hyphAutoCheck(); - currDoc->docHyphenator->Language=currDoc->hyphLanguage(); - currDoc->docHyphenator->MinWordLen=currDoc->hyphMinimumWordLength(); - currDoc->docHyphenator->HyCount=currDoc->hyphConsecutiveLines(); - } - ReplacedFonts = currDoc->AllFonts->getSubstitutions(ReplacedFonts.keys()); if (ReplacedFonts.isEmpty()) return true; Index: scribus/scribus.cpp =================================================================== --- scribus/scribus.cpp (revision 20495) +++ scribus/scribus.cpp (working copy) @@ -2262,6 +2262,7 @@ view = tempView; tempDoc->setCurrentPage(tempDoc->Pages->at(0)); tempDoc->setGUI(requiresGUI, this, tempView); + tempDoc->createHyphenator(); if (requiresGUI) { tempDoc->docHyphenator->ignoredWords = prefsManager->appPrefs.hyphPrefs.ignoredWords; @@ -3701,6 +3702,7 @@ doc->setName(FName); doc->setMasterPageMode(false); //IL doc->setHyphLanguage(GetLang(doc->hyphLanguage())); + doc->createHyphenator(); HaveNewDoc(); // propertiesPalette->Cpal->showGradient(0); // propertiesPalette->updateCList(); Index: scribus/scribusdoc.cpp =================================================================== --- scribus/scribusdoc.cpp (revision 20495) +++ scribus/scribusdoc.cpp (working copy) @@ -883,6 +883,10 @@ m_ScMW = mw; //FIXME: stop using m_View m_View = view; +} + +void ScribusDoc::createHyphenator() +{ if (m_hasGUI) { docHyphenator = new Hyphenator(m_ScMW, this); Index: scribus/scribusdoc.h =================================================================== --- scribus/scribusdoc.h (revision 20495) +++ scribus/scribusdoc.h (working copy) @@ -115,6 +115,7 @@ ScribusView* view() const; ScribusMainWindow* scMW() const {return m_ScMW;} void setGUI(bool hasgui, ScribusMainWindow* mw, ScribusView* view); + void createHyphenator(); /** * @brief Return the guarded object associated with the document |
|
Tdb has provided and attached a new patch "fix_hyphen_language_svn.patch". As a consequence, I delete wrong previous "fix_hyphen_language_150.patch". |
|
Applied, thanks! |
|
Committed by jghali in r20496/7 Patched (backported + trunk) by Mikko Rasa Thanks |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-10-25 18:40 | Kunda | New Issue | |
2015-10-25 18:40 | Kunda | File Added: fix_hyphen_language_150.patch | |
2015-10-25 18:40 | Kunda | File Added: fix_hyphen_language.patch | |
2015-10-25 19:28 | JLuc | Patch | No => Yes |
2015-10-25 19:28 | JLuc | Description Updated | |
2015-10-25 19:28 | JLuc | Additional Information Updated | |
2015-10-25 23:44 | jghali | Note Added: 0036931 | |
2015-10-26 06:51 | tdb | Note Added: 0036941 | |
2015-10-26 06:51 | tdb | File Added: fix_hyphen_language_svn.patch | |
2015-10-26 19:05 | JLuc | Note Added: 0036949 | |
2015-10-26 19:05 | JLuc | File Deleted: fix_hyphen_language_150.patch | |
2015-10-26 21:50 | jghali | Note Added: 0036955 | |
2015-10-26 21:50 | jghali | Status | new => resolved |
2015-10-26 21:50 | jghali | Fixed in Version | => 1.4.6.svn |
2015-10-26 21:50 | jghali | Resolution | open => fixed |
2015-10-26 21:50 | jghali | Assigned To | => jghali |
2015-10-26 21:53 | jghali | Summary | [PATCH] Fix for broken hyphenation language selection => Fix for broken hyphenation language selection |
2015-11-03 01:35 | Kunda | Note Added: 0037164 | |
2015-11-03 01:35 | Kunda | Status | resolved => closed |