librelogo/source/LibreLogo/LibreLogo.py | 14 +++++++++++++- lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx | 4 +--- linguistic/source/hyphdsp.cxx | 10 ++-------- linguistic/source/misc.cxx | 6 +++--- vcl/source/glyphs/graphite_layout.cxx | 14 +++++++++++--- 5 files changed, 30 insertions(+), 18 deletions(-)
New commits: commit 3e6969d8a26c443bf5729eab640de92aa95ec4ee Author: László Németh <nem...@numbertext.org> Date: Tue Feb 4 19:56:57 2014 +0100 librelogo: keep comments at translation Bug report: http://openscope.org/browse/OOO-837 Change-Id: I5c17ed6059107ec8fc12bf9f411e52b22f131065 diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py index 8fc0c0c..c1a35b1 100644 --- a/librelogo/source/LibreLogo/LibreLogo.py +++ b/librelogo/source/LibreLogo/LibreLogo.py @@ -56,7 +56,9 @@ __MM10_TO_TWIP__ = 1/(2540.0/72/20) # 0.01 mm to twentieth point __FILLCOLOR__ = 0x8000cc00 __LINEWIDTH__ = 0.5 * __PT_TO_TWIP__ __ENCODED_STRING__ = "_s_%s___" +__ENCODED_COMMENT__ = "_c_%s___" __DECODE_STRING_REGEX__ = "_s_([0-9]+)___" +__DECODE_COMMENT_REGEX__ = "_c_([0-9]+)___" __LINEBREAK__ = "#_@L_i_N_e@_#" __TURTLE__ = "turtle" __ACTUAL__ = "actual" @@ -345,8 +347,10 @@ def __translate__(arg = None): rq = '\'' + lang['RIGHTSTRING'].replace("|", "") __strings__ = [] + text = re.sub(r"^(([ \t]*[;#][^\n]*))", __encodecomment__, text) text = re.sub("(?u)([%s])([^\n%s]*)(?<!\\\\)[%s]" % (lq, rq, rq), __encodestring__, selection.getString()) text = re.sub('(?u)(?<![0-9])(")(~?\w*)', __encodestring__, text) + text = re.sub(r";(([^\n]*))", __encodecomment__, text) # translate the program to the language of the document FIXME space/tab exception = ['DECIMAL'] @@ -364,11 +368,12 @@ def __translate__(arg = None): text = re.sub(r'(?ui)(?<!:)\b(%s)\b' % lang[i], __l12n__(_.lng)[i].split("|")[0].upper(), text) text = re.sub(r"(?<=\d)[%s](?=\d)" % lang['DECIMAL'], __l12n__(_.lng)['DECIMAL'], text) - # decode strings + # decode strings and comments quoted = u"(?ui)(?<=%s)(%%s)(?=%s)" % (__l12n__(_.lng)['LEFTSTRING'][0], __l12n__(_.lng)['RIGHTSTRING'][0]) text = re.sub(__DECODE_STRING_REGEX__, __decodestring2__, text) for i in __STRCONST__: text = re.sub(quoted % lang[i], __l12n__(_.lng)[i].split("|")[0].upper(), text) + text = re.sub(__DECODE_COMMENT_REGEX__, __decodecomment__, text) selection.setString(text) # convert to paragraphs __dispatcher__(".uno:ExecuteSearch", (__getprop__("SearchItem.SearchString", r"\n"), __getprop__("SearchItem.ReplaceString", r"\n"), \ @@ -438,12 +443,19 @@ def __encodestring__(m): __strings__.append(re.sub("\\[^\\]", "", m.group(2))) return __ENCODED_STRING__ % (len(__strings__) - 1) +def __encodecomment__(m): + __strings__.append(re.sub("\\[^\\]", "", m.group(2))) + return __ENCODED_COMMENT__ % (len(__strings__) - 1) + def __decodestring__(m): return "u'%s'" % __strings__[int(m.group(1))] def __decodestring2__(m): return __l12n__(_.lng)['LEFTSTRING'][0] + __strings__[int(m.group(1))] + __l12n__(_.lng)['RIGHTSTRING'][0] +def __decodecomment__(m): + return ";" + __strings__[int(m.group(1))] + def __initialize__(): global __halt__, __thread__ __getdocument__() commit a831930986166a8c5cb231821426f5cf4d976df2 Author: László Németh <nem...@numbertext.org> Date: Tue Feb 4 19:10:44 2014 +0100 fdo#70666 fix Graphite ligature replacement at line breaks Change-Id: I5b7c149f7f419ba18bd2cc59f4e77a0b61280caa diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx index 89b6fee..bb16dd5 100644 --- a/vcl/source/glyphs/graphite_layout.cxx +++ b/vcl/source/glyphs/graphite_layout.cxx @@ -48,6 +48,10 @@ #include <unicode/ubidi.h> #include <unicode/uscript.h> +#include <vcl/unohelp.hxx> +#include <com/sun/star/i18n/XCharacterClassification.hpp> +#include <com/sun/star/i18n/UnicodeType.hpp> + // Graphite Libraries (must be after vcl headers on windows) #include <graphite_static.hxx> #include <graphite2/Segment.h> @@ -590,9 +594,13 @@ gr_segment * GraphiteLayout::CreateSegment(ImplLayoutArgs& rArgs) nSegCharLimit - rArgs.mnEndCharPos, bRtl); } } -// int numchars = gr_count_unicode_characters(gr_utf16, rArgs.mpStr + mnSegCharOffset, -// rArgs.mpStr + (rArgs.mnLength > limit + 64 ? limit + 64 : rArgs.mnLength), NULL); - int numchars = rArgs.mnEndCharPos - mnSegCharOffset; // fdo#52540, fdo#68313, FIXME + + static com::sun::star::uno::Reference< com::sun::star::i18n::XCharacterClassification > xCharClass; + if ( !xCharClass.is() ) + xCharClass = vcl::unohelper::CreateCharacterClassification(); + int numchars = rArgs.mnEndCharPos - mnSegCharOffset; // fdo#52540, fdo#68313, fdo#70666 avoid bad ligature replacement + if (xCharClass->getType(rArgs.mpStr, numchars + 1) != ::com::sun::star::i18n::UnicodeType::LOWERCASE_LETTER) + numchars += 64; if (mpFeatures) pSegment = gr_make_seg(mpFont, mpFace, 0, mpFeatures->values(), gr_utf16, rArgs.mpStr + mnSegCharOffset, numchars, bRtl); commit 604a0b7282e85c8404d0fcf6db6be0cb08463fb1 Author: László Németh <nem...@numbertext.org> Date: Tue Feb 4 10:43:49 2014 +0100 fdo#44314 Unicode hyphenation at soft hyphens with two extra char. Change-Id: I4b8eba6d8353e4207cac4a8b24d2b9f0440ce9e6 diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx index 1cb7996..567dc09 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx @@ -514,10 +514,8 @@ Reference < XHyphenatedWord > SAL_CALL Hyphenator::queryAlternativeSpelling( const ::com::sun::star::beans::PropertyValues& aProperties ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { - // FIXME: multiple character change, eg. briddzsel -> bridzs-dzsel is not supported, - // because Writer has got a layout problem here. // Firstly we allow only one plus character before the hyphen to avoid to miss the right break point: - for (int extrachar = 1; extrachar < 2; extrachar++) // temporarily i < 2 instead of i <= 2 + for (int extrachar = 1; extrachar <= 2; extrachar++) { Reference< XHyphenatedWord > xRes = hyphenate(aWord, aLocale, nIndex + 1 + extrachar, aProperties); if (xRes.is() && xRes->isAlternativeSpelling() && xRes->getHyphenationPos() == nIndex) diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx index ecc9ec2..52f55f1 100644 --- a/linguistic/source/hyphdsp.cxx +++ b/linguistic/source/hyphdsp.cxx @@ -456,15 +456,9 @@ Reference< XHyphenatedWord > SAL_CALL if (xEntry.is()) { - // FIXME: multiple character change, eg. briddzsel -> bridzs-dzsel is not supported, - // because Writer has got a layout problem here. - // Firstly we allow only one plus character before the hyphen to avoid to miss the right break point: - for (int extrachar = 1; extrachar < 2; extrachar++) // temporarily i < 2 instead of i <= 2 - { - xRes = buildHyphWord(aChkWord, xEntry, nLanguage, nIndex + 1 + extrachar); - if (xRes.is() && xRes->isAlternativeSpelling() && xRes->getHyphenationPos() == nIndex) + xRes = buildHyphWord(aChkWord, xEntry, nLanguage, nIndex + 1); + if (xRes.is() && xRes->isAlternativeSpelling() && xRes->getHyphenationPos() == nIndex) return xRes; - } } else { diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index 737f4ae..d60ec3d 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -478,11 +478,11 @@ static sal_Bool GetAltSpelling( sal_Int16 &rnChgPos, sal_Int16 &rnChgLen, OUStri ; rnChgPos = sal::static_int_cast< sal_Int16 >(nPosL); - rnChgLen = sal::static_int_cast< sal_Int16 >(nPosR - nPosL + 1); + rnChgLen = sal::static_int_cast< sal_Int16 >(nAltPosR - nPosL); DBG_ASSERT( rnChgLen >= 0, "nChgLen < 0"); sal_Int32 nTxtStart = nPosL; - sal_Int32 nTxtLen = nAltPosL - nPosL + 1; + sal_Int32 nTxtLen = nAltPosR - nPosL + 1; rRplc = aHyphenatedWord.copy( nTxtStart, nTxtLen ); } return bRes; @@ -558,7 +558,7 @@ uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars( --nPos; aLeft = rOrigWord.copy( 0, nPos ); - aRight = rOrigWord.copy( nPos + nChgLen ); + aRight = rOrigWord.copy( nPos ); // FIXME: changes at the right side aOrigHyphenatedWord = aLeft; aOrigHyphenatedWord += aRplc;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits