diff options
-rw-r--r-- | drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx | 7 | ||||
-rw-r--r-- | drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx | 4 | ||||
-rw-r--r-- | drawinglayer/source/primitive2d/textlayoutdevice.cxx | 14 | ||||
-rw-r--r-- | drawinglayer/source/primitive2d/textprimitive2d.cxx | 4 | ||||
-rw-r--r-- | drawinglayer/source/processor2d/vclprocessor2d.cxx | 2 | ||||
-rw-r--r-- | drawinglayer/util/makefile.mk | 1 | ||||
-rw-r--r-- | svx/inc/svx/svxfont.hxx | 3 | ||||
-rw-r--r-- | svx/source/dialog/fntctrl.cxx | 21 | ||||
-rw-r--r-- | svx/source/editeng/impedit2.cxx | 13 | ||||
-rw-r--r-- | svx/util/makefile.mk | 3 |
10 files changed, 57 insertions, 15 deletions
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx index 1e9dd170dd02..b9639aeacc50 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textlayoutdevice.hxx @@ -41,6 +41,7 @@ #include <tools/poly.hxx> #include <basegfx/range/b2drange.hxx> #include <vector> +#include <com/sun/star/lang/Locale.hpp> ////////////////////////////////////////////////////////////////////////////// // predefines @@ -75,8 +76,8 @@ namespace drawinglayer ~TextLayouterDevice(); void setFont(const Font& rFont); - void setFontAttributes(const FontAttributes& rFontAttributes, const basegfx::B2DHomMatrix& rTransform); - void setFontAttributes(const FontAttributes& rFontAttributes, double fFontScaleX, double fFontScaleY); + void setFontAttributes(const FontAttributes& rFontAttributes, const basegfx::B2DHomMatrix& rTransform, const ::com::sun::star::lang::Locale & rLocale); + void setFontAttributes(const FontAttributes& rFontAttributes, double fFontScaleX, double fFontScaleY, const ::com::sun::star::lang::Locale & rLocale); double getTextHeight() const; double getOverlineHeight() const; @@ -122,11 +123,13 @@ namespace drawinglayer double fFontScaleX, double fFontScaleY, double fFontRotation, + const ::com::sun::star::lang::Locale & rLocale, const OutputDevice& rOutDev); Font getVclFontFromFontAttributes( const FontAttributes& rFontAttributes, const basegfx::B2DHomMatrix& rTransform, + const ::com::sun::star::lang::Locale & rLocale, const OutputDevice& rOutDev); FontAttributes getFontAttributesFromVclFont(basegfx::B2DVector& rSize, const Font& rFont, bool bRTL, bool bBiDiStrong); diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx index 4faa85fe898c..94e92a149e50 100644 --- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx @@ -305,7 +305,7 @@ namespace drawinglayer // TextLayouterDevice is needed to get metrics for text decorations like // underline/strikeout/emphasis marks from it. For setup, the font size is needed - aTextLayouter.setFontAttributes(getFontAttributes(), rDecTrans.getScale().getX(), rDecTrans.getScale().getY()); + aTextLayouter.setFontAttributes(getFontAttributes(), rDecTrans.getScale().getX(), rDecTrans.getScale().getY(), getLocale()); // get text width double fTextWidth(0.0); @@ -526,7 +526,7 @@ namespace drawinglayer if(bNoDXArray) { // ..but only completely when no DXArray - aTextLayouter.setFontAttributes(getFontAttributes(), rDecTrans.getScale().getX(), rDecTrans.getScale().getY()); + aTextLayouter.setFontAttributes(getFontAttributes(), rDecTrans.getScale().getX(), rDecTrans.getScale().getY(),getLocale()); } // do iterate over single words diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index 23ec468d83d4..75e66a5422d2 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -41,6 +41,7 @@ #include <vcl/virdev.hxx> #include <vcl/font.hxx> #include <vcl/metric.hxx> +#include <i18npool/mslangid.hxx> #include <drawinglayer/primitive2d/textprimitive2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -165,14 +166,14 @@ namespace drawinglayer mrDevice.SetFont( rFont ); } - void TextLayouterDevice::setFontAttributes(const FontAttributes& rFontAttributes, const basegfx::B2DHomMatrix& rTransform) + void TextLayouterDevice::setFontAttributes(const FontAttributes& rFontAttributes, const basegfx::B2DHomMatrix& rTransform, const ::com::sun::star::lang::Locale & rLocale) { - setFont(getVclFontFromFontAttributes(rFontAttributes, rTransform, mrDevice)); + setFont(getVclFontFromFontAttributes(rFontAttributes, rTransform, rLocale, mrDevice)); } - void TextLayouterDevice::setFontAttributes(const FontAttributes& rFontAttributes, double fFontScaleX, double fFontScaleY) + void TextLayouterDevice::setFontAttributes(const FontAttributes& rFontAttributes, double fFontScaleX, double fFontScaleY, const ::com::sun::star::lang::Locale & rLocale) { - setFont(getVclFontFromFontAttributes(rFontAttributes, fFontScaleX, fFontScaleY, 0.0, mrDevice)); + setFont(getVclFontFromFontAttributes(rFontAttributes, fFontScaleX, fFontScaleY, 0.0, rLocale, mrDevice)); } double TextLayouterDevice::getOverlineOffset() const @@ -305,6 +306,7 @@ namespace drawinglayer Font getVclFontFromFontAttributes( const FontAttributes& rFontAttributes, const basegfx::B2DHomMatrix& rTransform, + const ::com::sun::star::lang::Locale & rLocale, const OutputDevice& rOutDev) { // decompose matrix to have position and size of text @@ -313,7 +315,7 @@ namespace drawinglayer rTransform.decompose(aScale, aTranslate, fRotate, fShearX); - return getVclFontFromFontAttributes(rFontAttributes, aScale.getX(), aScale.getY(), fRotate, rOutDev); + return getVclFontFromFontAttributes(rFontAttributes, aScale.getX(), aScale.getY(), fRotate, rLocale, rOutDev); } Font getVclFontFromFontAttributes( @@ -321,6 +323,7 @@ namespace drawinglayer double fFontScaleX, double fFontScaleY, double fFontRotation, + const ::com::sun::star::lang::Locale & rLocale, const OutputDevice& /*rOutDev*/) { sal_uInt32 nWidth(basegfx::fround(fabs(fFontScaleX))); @@ -340,6 +343,7 @@ namespace drawinglayer aRetval.SetWeight(static_cast<FontWeight>(rFontAttributes.getWeight())); aRetval.SetItalic(rFontAttributes.getItalic() ? ITALIC_NORMAL : ITALIC_NONE); aRetval.SetOutline(rFontAttributes.getOutline()); + aRetval.SetLanguage(MsLangId::convertLocaleToLanguage(rLocale)); #ifdef WIN32 // #100424# use higher precision diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx index 1b527668db2c..8188265ff8e7 100644 --- a/drawinglayer/source/primitive2d/textprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx @@ -145,7 +145,7 @@ namespace drawinglayer // prepare textlayoutdevice TextLayouterDevice aTextLayouter; - aTextLayouter.setFontAttributes(getFontAttributes(), aFontScale.getX(), aFontScale.getY()); + aTextLayouter.setFontAttributes(getFontAttributes(), aFontScale.getX(), aFontScale.getY(), getLocale()); #ifdef WIN32 // when under Windows and the font is unequally scaled, need to correct font X-Scaling factor if(bCorrectScale) @@ -308,7 +308,7 @@ namespace drawinglayer // prepare textlayoutdevice TextLayouterDevice aTextLayouter; - aTextLayouter.setFontAttributes(getFontAttributes(), aFontScale.getX(), aFontScale.getY()); + aTextLayouter.setFontAttributes(getFontAttributes(), aFontScale.getX(), aFontScale.getY(), getLocale()); // get basic text range basegfx::B2DRange aNewRange(aTextLayouter.getTextBoundRect(getText(), getTextPosition(), getTextLength())); diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 0c5299c9c99d..d6eb6e1695b2 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -189,6 +189,7 @@ namespace drawinglayer aScale.getY(), fRotate, + rTextCandidate.getLocale(), *mpOutputDevice)); if(!basegfx::fTools::equal(aScale.getX(), aScale.getY())) @@ -210,6 +211,7 @@ namespace drawinglayer aScale.getX(), aScale.getY(), fRotate, + rTextCandidate.getLocale(), *mpOutputDevice); } } diff --git a/drawinglayer/util/makefile.mk b/drawinglayer/util/makefile.mk index 3d29625cb0e6..5356ee0cef54 100644 --- a/drawinglayer/util/makefile.mk +++ b/drawinglayer/util/makefile.mk @@ -72,6 +72,7 @@ SHL1STDLIBS=\ $(CPPUHELPERLIB) \ $(CPPULIB) \ $(AVMEDIALIB) \ + $(I18NISOLANGLIB) \ $(COMPHELPERLIB) SHL1DEF= $(MISC)$/$(SHL1TARGET).def diff --git a/svx/inc/svx/svxfont.hxx b/svx/inc/svx/svxfont.hxx index b0165d73f978..cab43c06628c 100644 --- a/svx/inc/svx/svxfont.hxx +++ b/svx/inc/svx/svxfont.hxx @@ -70,7 +70,8 @@ public: inline void SetCaseMap( const SvxCaseMap eNew ) { eCaseMap = eNew; } inline LanguageType GetLanguage() const { return eLang; } - inline void SetLanguage( const LanguageType eNewLan ) { eLang = eNewLan; } + inline void SetLanguage( const LanguageType eNewLan ) + { eLang = eNewLan; Font::SetLanguage(eNewLan); } // Is-Methoden: inline BOOL IsCaseMap() const { return SVX_CASEMAP_NOT_MAPPED != eCaseMap; } diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx index 55afdd4ca2f0..5018bd28a640 100644 --- a/svx/source/dialog/fntctrl.cxx +++ b/svx/source/dialog/fntctrl.cxx @@ -36,6 +36,7 @@ #include <sfx2/printer.hxx> // SfxPrinter #include <vcl/metric.hxx> #include <vcl/svapp.hxx> +#include <unicode/uchar.h> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/i18n/XBreakIterator.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -244,7 +245,25 @@ void FontPrevWin_Impl::_CheckScript() do { nChg = (xub_StrLen)xBreak->endOfScript( aText, nChg, nScript ); - aScriptChg.Insert( nChg, nCnt ); + if (nChg < aText.Len() && nChg > 0 && + (com::sun::star::i18n::ScriptType::WEAK == + xBreak->getScriptType(aText, nChg - 1))) + { + int8_t nType = u_charType(aText.GetChar(nChg) ); + if (nType == U_NON_SPACING_MARK || nType == U_ENCLOSING_MARK || + nType == U_COMBINING_SPACING_MARK ) + { + aScriptChg.Insert( nChg - 1, nCnt ); + } + else + { + aScriptChg.Insert( nChg, nCnt ); + } + } + else + { + aScriptChg.Insert( nChg, nCnt ); + } aScriptType.Insert( nScript, nCnt ); aTextWidth.Insert( ULONG(0), nCnt++ ); diff --git a/svx/source/editeng/impedit2.cxx b/svx/source/editeng/impedit2.cxx index 1299cfd1520a..47a3aa24b3e9 100644 --- a/svx/source/editeng/impedit2.cxx +++ b/svx/source/editeng/impedit2.cxx @@ -1777,7 +1777,7 @@ void ImpEditEngine::InitScriptTypes( USHORT nPara ) ::rtl::OUString aOUText( aText ); USHORT nTextLen = (USHORT)aOUText.getLength(); - long nPos = 0; + sal_Int32 nPos = 0; short nScriptType = _xBI->getScriptType( aOUText, nPos ); rTypes.Insert( ScriptTypePosInfo( nScriptType, (USHORT)nPos, nTextLen ), rTypes.Count() ); nPos = _xBI->endOfScript( aOUText, nPos, nScriptType ); @@ -1795,6 +1795,17 @@ void ImpEditEngine::InitScriptTypes( USHORT nPara ) } else { + if ( _xBI->getScriptType( aOUText, nPos - 1 ) == i18n::ScriptType::WEAK ) + { + switch ( u_charType(aOUText.iterateCodePoints(&nPos, 0) ) ) { + case U_NON_SPACING_MARK: + case U_ENCLOSING_MARK: + case U_COMBINING_SPACING_MARK: + --nPos; + rTypes[rTypes.Count()-1].nEndPos--; + break; + } + } rTypes.Insert( ScriptTypePosInfo( nScriptType, (USHORT)nPos, nTextLen ), rTypes.Count() ); } diff --git a/svx/util/makefile.mk b/svx/util/makefile.mk index f212284fa401..a751cfdd20ac 100644 --- a/svx/util/makefile.mk +++ b/svx/util/makefile.mk @@ -175,7 +175,8 @@ SHL2STDLIBS= \ $(CPPULIB) \ $(VOSLIB) \ $(SALLIB) \ - $(JVMFWKLIB) + $(JVMFWKLIB) \ + $(ICUUCLIB) .IF "$(debug)$(dbgutil)"!="" SHL2STDLIBS += $(CPPUHELPERLIB) |