editeng/source/items/textitem.cxx | 4 +--- oox/source/export/drawingml.cxx | 5 ++--- sd/source/filter/eppt/pptx-text.cxx | 4 ++-- sw/source/core/txtnode/fntcache.cxx | 17 +++++++++++++++++ sw/source/filter/ww8/writerhelper.cxx | 8 -------- sw/source/filter/ww8/writerhelper.hxx | 12 ------------ sw/source/filter/ww8/writerwordglue.cxx | 2 +- sw/source/filter/ww8/wrtw8num.cxx | 5 +++-- unotools/inc/unotools/fontdefs.hxx | 9 +++++++++ unotools/source/misc/fontcvt.cxx | 2 +- unotools/source/misc/fontdefs.cxx | 8 ++++++++ vcl/generic/fontmanager/fontsubst.cxx | 7 +++---- vcl/generic/glyphs/gcach_ftyp.cxx | 8 ++------ vcl/source/filter/wmf/wmfwr.cxx | 6 ------ vcl/source/gdi/metaact.cxx | 6 +++--- vcl/source/gdi/outdev3.cxx | 3 +-- 16 files changed, 53 insertions(+), 53 deletions(-)
New commits: commit d04ef1f208d6a32ffa3bdb56b951f85854bca897 Author: Thomas Arnhold <tho...@arnhold.org> Date: Tue May 28 10:53:03 2013 +0200 Make use of IsStarSymbol() Reviewed-on: https://gerrit.libreoffice.org/4077 Reviewed-by: LuboÅ¡ LuÅák <l.lu...@suse.cz> Tested-by: LuboÅ¡ LuÅák <l.lu...@suse.cz> Signed-off-by: LuboÅ¡ LuÅák <l.lu...@suse.cz> Conflicts: include/unotools/fontdefs.hxx oox/source/export/drawingml.cxx sw/source/filter/ww8/writerhelper.cxx sw/source/filter/ww8/writerhelper.hxx vcl/generic/fontmanager/fontsubst.cxx vcl/generic/glyphs/gcach_ftyp.cxx vcl/source/gdi/outdev3.cxx Change-Id: I7a2e3a6f11bbaaaff50e8163e4ce3e2583b1d03c diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 0860659..8f94fa0 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -373,9 +373,7 @@ SfxPoolItem* SvxFontItem::Clone( SfxItemPool * ) const SvStream& SvxFontItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const { - sal_Bool bToBats = - GetFamilyName().EqualsIgnoreCaseAscii( "StarSymbol", 0, sizeof("StarSymbol")-1 ) || - GetFamilyName().EqualsIgnoreCaseAscii( "OpenSymbol", 0, sizeof("OpenSymbol")-1 ); + sal_Bool bToBats = IsStarSymbol( GetFamilyName() ); rStrm << (sal_uInt8) GetFamily() << (sal_uInt8) GetPitch() << (sal_uInt8)(bToBats ? RTL_TEXTENCODING_SYMBOL : GetSOStoreTextEncoding(GetCharSet())); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 082a1e7..afb9e02 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1460,8 +1460,7 @@ void DrawingML::WriteConnectorConnections( EscherConnectorListEntry& rConnectorE sal_Unicode DrawingML::SubstituteBullet( sal_Unicode cBulletId, ::com::sun::star::awt::FontDescriptor& rFontDesc ) { - if ( rFontDesc.Name.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("starsymbol")) || - rFontDesc.Name.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("opensymbol")) ) + if ( IsStarSymbol(rFontDesc.Name) ) { rtl_TextEncoding eCharSet = rFontDesc.CharSet; cBulletId = msfilter::util::bestFitOpenSymbolToMSFont(cBulletId, eCharSet, rFontDesc.Name); diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx index 83a22cb..0f86c0b 100644 --- a/sd/source/filter/eppt/pptx-text.cxx +++ b/sd/source/filter/eppt/pptx-text.cxx @@ -884,7 +884,7 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int1 case SVX_NUM_CHAR_SPECIAL : // Bullet { - if ( aFontDesc.Name.equalsIgnoreAsciiCase("starsymbol") || aFontDesc.Name.equalsIgnoreAsciiCase("opensymbol") ) + if ( IsStarSymbol(aFontDesc.Name) ) { rtl_TextEncoding eChrSet = aFontDesc.CharSet; cBulletId = msfilter::util::bestFitOpenSymbolToMSFont(cBulletId, eChrSet, aFontDesc.Name); diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx index b540868..bc39b9a 100644 --- a/sw/source/filter/ww8/writerhelper.cxx +++ b/sw/source/filter/ww8/writerhelper.cxx @@ -648,14 +648,6 @@ namespace sw } } - bool IsStarSymbol(const rtl::OUString &rFontName) - { - xub_StrLen nIndex = 0; - rtl::OUString sFamilyNm(GetNextFontToken(rFontName, nIndex)); - return (sFamilyNm.equalsIgnoreAsciiCase("starsymbol") || - sFamilyNm.equalsIgnoreAsciiCase("opensymbol")); - } - Size GetSwappedInSize(const SwNoTxtNode& rNd) { Size aGrTwipSz(rNd.GetTwipSize()); diff --git a/sw/source/filter/ww8/writerhelper.hxx b/sw/source/filter/ww8/writerhelper.hxx index f1361a8..074504d 100644 --- a/sw/source/filter/ww8/writerhelper.hxx +++ b/sw/source/filter/ww8/writerhelper.hxx @@ -730,18 +730,6 @@ namespace sw */ Polygon PolygonFromPolyPolygon(const PolyPolygon &rPolyPoly); - /** Determine if the font is the special Star|Open Symbol font - - @param rFontName - The FontName to test for being Star|Open Symbol - - @return true if this is Star|Open Symbol - - @author - <a href="mailto:c...@openoffice.org">Caolán McNamara</a> - */ - bool IsStarSymbol(const rtl::OUString &rFontName); - /** Make setting a drawing object's layer in a Writer document easy diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx index 12e9a1c..c7f2e25 100644 --- a/sw/source/filter/ww8/writerwordglue.cxx +++ b/sw/source/filter/ww8/writerwordglue.cxx @@ -311,7 +311,7 @@ namespace myImplHelpers String FindBestMSSubstituteFont(const String &rFont) { String sRet; - if (sw::util::IsStarSymbol(rFont)) + if ( IsStarSymbol(rFont) ) sRet.ASSIGN_CONST_ASC("Arial Unicode MS"); else sRet = GetSubsFontName(rFont, SUBSFONT_ONLYONE | SUBSFONT_MS); diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index d64c9bc..f8de8ca 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -28,6 +28,7 @@ #include <paratr.hxx> #include <charfmt.hxx> #include <ndtxt.hxx> +#include <unotools/fontcfg.hxx> #include <com/sun/star/i18n/ScriptType.hpp> #include <writerfilter/doctok/sprmids.hxx> @@ -386,7 +387,7 @@ void MSWordExportBase::AbstractNumberingDefinitions() sFontName = pBulletFont->GetName(); eFamily = pBulletFont->GetFamily(); - if ( sw::util::IsStarSymbol( sFontName ) ) + if ( IsStarSymbol(sFontName) ) SubstituteBullet( sNumStr, eChrSet, sFontName ); // #i86652# @@ -644,7 +645,7 @@ void WW8Export::BuildAnlvBulletBase(WW8_ANLV& rAnlv, sal_uInt8*& rpCh, String sFontName = rFont.GetName(); sal_uInt16 nFontId; - if (sw::util::IsStarSymbol(sFontName)) + if ( IsStarSymbol(sFontName) ) { /* If we are starsymbol then in ww7- mode we will always convert to a diff --git a/unotools/inc/unotools/fontdefs.hxx b/unotools/inc/unotools/fontdefs.hxx index df79a0f..c5e99ef 100644 --- a/unotools/inc/unotools/fontdefs.hxx +++ b/unotools/inc/unotools/fontdefs.hxx @@ -88,6 +88,15 @@ UNOTOOLS_DLLPUBLIC String GetNextFontToken( const String& rTokenStr, xub_StrLen& UNOTOOLS_DLLPUBLIC void GetEnglishSearchFontName( String& rName ); +/** Determine if the font is the special Star|Open Symbol font + + @param rFontName + The FontName to test for being Star|Open Symbol + + @return true if this is Star|Open Symbol +*/ +UNOTOOLS_DLLPUBLIC bool IsStarSymbol(const OUString &rFontName); + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unotools/source/misc/fontcvt.cxx b/unotools/source/misc/fontcvt.cxx index 6aaef61..4f94f71 100644 --- a/unotools/source/misc/fontcvt.cxx +++ b/unotools/source/misc/fontcvt.cxx @@ -1354,7 +1354,7 @@ sal_Unicode ConvertChar::RecodeChar( sal_Unicode cChar ) const if (!cRetVal && mpSubsFontName) { - if (!strcmp(mpSubsFontName, "OpenSymbol") || (!strcmp(mpSubsFontName, "StarSymbol"))) + if ( IsStarSymbol( OUString::createFromAscii(mpSubsFontName) ) ) { cRetVal = 0xE12C; SAL_WARN( "unotools", "Forcing a bullet substition from 0x" << diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx index 7785e807..8ef9962 100644 --- a/unotools/source/misc/fontdefs.cxx +++ b/unotools/source/misc/fontdefs.cxx @@ -583,4 +583,12 @@ int FontNameHash::operator()( const String& rStr ) const return nHash; } +bool IsStarSymbol(const OUString &rFontName) +{ + sal_uInt16 nIndex = 0; + OUString sFamilyNm(GetNextFontToken(rFontName, nIndex)); + return (sFamilyNm.equalsIgnoreAsciiCase("starsymbol") || + sFamilyNm.equalsIgnoreAsciiCase("opensymbol")); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/generic/fontmanager/fontsubst.cxx b/vcl/generic/fontmanager/fontsubst.cxx index 23ac968..af54328 100644 --- a/vcl/generic/fontmanager/fontsubst.cxx +++ b/vcl/generic/fontmanager/fontsubst.cxx @@ -33,6 +33,7 @@ #include "salprn.hxx" #include "region.h" +#include <unotools/fontdefs.hxx> #include <list> // =========================================================================== @@ -161,8 +162,7 @@ bool FcPreMatchSubstititution::FindFontSubstitute( FontSelectPattern &rFontSelDa if( rFontSelData.IsSymbolFont() ) return false; // StarSymbol is a unicode font, but it still deserves the symbol flag - if( 0 == rFontSelData.maSearchName.CompareIgnoreCaseToAscii( "starsymbol", 10) - || 0 == rFontSelData.maSearchName.CompareIgnoreCaseToAscii( "opensymbol", 10) ) + if ( IsStarSymbol(rFontSelData.maSearchName) ) return false; //see fdo#41556 and fdo#47636 @@ -230,8 +230,7 @@ bool FcGlyphFallbackSubstititution::FindFontSubstitute( FontSelectPattern& rFont if( rFontSelData.IsSymbolFont() ) return false; // StarSymbol is a unicode font, but it still deserves the symbol flag - if( 0 == rFontSelData.maSearchName.CompareIgnoreCaseToAscii( "starsymbol", 10) - || 0 == rFontSelData.maSearchName.CompareIgnoreCaseToAscii( "opensymbol", 10) ) + if ( IsStarSymbol(rFontSelData.maSearchName) ) return false; const FontSelectPattern aOut = GetFcSubstitute( rFontSelData, rMissingCodes ); diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx index ac2000d..c207529 100644 --- a/vcl/generic/glyphs/gcach_ftyp.cxx +++ b/vcl/generic/glyphs/gcach_ftyp.cxx @@ -32,6 +32,7 @@ #include <graphite2/Font.h> #include <graphite_layout.hxx> #endif +#include <unotools/fontdefs.hxx> #include "tools/poly.hxx" #include "basegfx/matrix/b2dhommatrix.hxx" @@ -929,13 +930,8 @@ void ServerFont::FetchFontMetric( ImplFontMetricData& rTo, long& rFactor ) const rTo.mnOrientation = GetFontSelData().mnOrientation; //Always consider [star]symbol as symbol fonts - if ( - (rTo.GetFamilyName().EqualsIgnoreCaseAscii("OpenSymbol")) || - (rTo.GetFamilyName().EqualsIgnoreCaseAscii("StarSymbol")) - ) - { + if ( IsStarSymbol( rTo.GetFamilyName() ) ) rTo.mbSymbolFlag = true; - } if( maSizeFT ) pFTActivateSize( maSizeFT ); diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx index c9baef6..b5cca9d 100644 --- a/vcl/source/filter/wmf/wmfwr.cxx +++ b/vcl/source/filter/wmf/wmfwr.cxx @@ -502,12 +502,6 @@ void WMFWriter::WMFRecord_Ellipse(const Rectangle & rRect) WriteRectangle(rRect); } -bool IsStarSymbol(const String &rStr) -{ - return rStr.EqualsIgnoreCaseAscii("starsymbol") || - rStr.EqualsIgnoreCaseAscii("opensymbol"); -} - void WMFWriter::WMFRecord_Escape( sal_uInt32 nEsc, sal_uInt32 nLen, const sal_Int8* pData ) { #ifdef OSL_BIGENDIAN diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index b1bc2bc..448d420 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -26,6 +26,7 @@ #include <vcl/metaact.hxx> #include <vcl/graphictools.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <unotools/fontdefs.hxx> // ======================================================================== @@ -3437,9 +3438,8 @@ MetaFontAction::MetaFontAction( const Font& rFont ) : // we change the textencoding to RTL_TEXTENCODING_UNICODE here, which seems // to be the right way; changing the textencoding at other sources // is too dangerous at the moment - if( ( ( maFont.GetName().SearchAscii( "StarSymbol" ) != STRING_NOTFOUND ) - || ( maFont.GetName().SearchAscii( "OpenSymbol" ) != STRING_NOTFOUND ) ) - && ( maFont.GetCharSet() != RTL_TEXTENCODING_UNICODE ) ) + if ( IsStarSymbol( maFont.GetName() ) + && ( maFont.GetCharSet() != RTL_TEXTENCODING_UNICODE ) ) { maFont.SetCharSet( RTL_TEXTENCODING_UNICODE ); } diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index f7640f8..3679d5a 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -745,8 +745,7 @@ PhysicalFontFace::PhysicalFontFace( const ImplDevFontAttributes& rDFA, int nMagi { // StarSymbol is a unicode font, but it still deserves the symbol flag if( !mbSymbolFlag ) - if( 0 == GetFamilyName().CompareIgnoreCaseToAscii( "starsymbol", 10) - || 0 == GetFamilyName().CompareIgnoreCaseToAscii( "opensymbol", 10) ) + if ( IsStarSymbol( GetFamilyName() ) ) mbSymbolFlag = true; } commit 46f61ee3997c4c6e1a1dca8b2986f31f0e4a6167 Author: Thomas Arnhold <tho...@arnhold.org> Date: Thu May 23 19:49:08 2013 +0200 be case-insensitive for open/starsymbol comparison Reviewed-on: https://gerrit.libreoffice.org/4015 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> Signed-off-by: LuboÅ¡ LuÅák <l.lu...@suse.cz> Conflicts: unotools/source/misc/fontcvt.cxx unotools/source/misc/fontdefs.cxx vcl/generic/glyphs/gcach_ftyp.cxx Change-Id: I7a342c809a723f5f9c03271c6145d9c367cea6de diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index d5846a0..0860659 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -374,8 +374,8 @@ SfxPoolItem* SvxFontItem::Clone( SfxItemPool * ) const SvStream& SvxFontItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const { sal_Bool bToBats = - GetFamilyName().EqualsAscii( "StarSymbol", 0, sizeof("StarSymbol")-1 ) || - GetFamilyName().EqualsAscii( "OpenSymbol", 0, sizeof("OpenSymbol")-1 ); + GetFamilyName().EqualsIgnoreCaseAscii( "StarSymbol", 0, sizeof("StarSymbol")-1 ) || + GetFamilyName().EqualsIgnoreCaseAscii( "OpenSymbol", 0, sizeof("OpenSymbol")-1 ); rStrm << (sal_uInt8) GetFamily() << (sal_uInt8) GetPitch() << (sal_uInt8)(bToBats ? RTL_TEXTENCODING_SYMBOL : GetSOStoreTextEncoding(GetCharSet())); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index d68ff6b..082a1e7 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1054,7 +1054,7 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa // instead of a Unicode encoding the encoding RTL_TEXTENCODING_SYMBOL was used. // Because there might exist a lot of damaged documemts I added this two lines // which fixes the bullet problem for the export. - if ( aFontDesc.Name == "StarSymbol" ) + if ( aFontDesc.Name.equalsIgnoreAsciiCase("StarSymbol") ) aFontDesc.CharSet = RTL_TEXTENCODING_MS_1252; } else if ( aPropName == "BulletRelSize" ) { diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx index 04578a2..83a22cb 100644 --- a/sd/source/filter/eppt/pptx-text.cxx +++ b/sd/source/filter/eppt/pptx-text.cxx @@ -798,7 +798,7 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int1 // instead of a Unicode encoding the encoding RTL_TEXTENCODING_SYMBOL was used. // Because there might exist a lot of damaged documemts I added this two lines // which fixes the bullet problem for the export. - if ( aFontDesc.Name == "StarSymbol" ) + if ( aFontDesc.Name.equalsIgnoreAsciiCase("StarSymbol") ) aFontDesc.CharSet = RTL_TEXTENCODING_MS_1252; } @@ -884,7 +884,7 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int1 case SVX_NUM_CHAR_SPECIAL : // Bullet { - if ( aFontDesc.Name.equals("starsymbol") || aFontDesc.Name.equals("opensymbol") ) + if ( aFontDesc.Name.equalsIgnoreAsciiCase("starsymbol") || aFontDesc.Name.equalsIgnoreAsciiCase("opensymbol") ) { rtl_TextEncoding eChrSet = aFontDesc.CharSet; cBulletId = msfilter::util::bestFitOpenSymbolToMSFont(cBulletId, eChrSet, aFontDesc.Name); diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx index 31aec55..ac2000d 100644 --- a/vcl/generic/glyphs/gcach_ftyp.cxx +++ b/vcl/generic/glyphs/gcach_ftyp.cxx @@ -930,8 +930,8 @@ void ServerFont::FetchFontMetric( ImplFontMetricData& rTo, long& rFactor ) const //Always consider [star]symbol as symbol fonts if ( - (rTo.GetFamilyName().EqualsAscii("OpenSymbol")) || - (rTo.GetFamilyName().EqualsAscii("StarSymbol")) + (rTo.GetFamilyName().EqualsIgnoreCaseAscii("OpenSymbol")) || + (rTo.GetFamilyName().EqualsIgnoreCaseAscii("StarSymbol")) ) { rTo.mbSymbolFlag = true; commit 85f892a3a1dbaa3c36ac3f31186eef1ec0eea464 Author: LuboÅ¡ LuÅák <l.lu...@suse.cz> Date: Fri Jun 7 11:31:05 2013 +0200 ugly workaround for external leading with symbol fonts (bnc#823626) I'd much rather find the code using external leading in Writer's layout, but this font rendering and layout stuff is so complicated. Change-Id: Iaf58af387a6727eb18f5a9d1613de3ae30d7c35e diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 3609b8b..f01aec7 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -379,6 +379,23 @@ sal_uInt16 SwFntObj::GetFontLeading( const ViewShell *pSh, const OutputDevice& r bSymbol = RTL_TEXTENCODING_SYMBOL == aMet.GetCharSet(); GuessLeading( *pSh, aMet ); nExtLeading = static_cast<sal_uInt16>(aMet.GetExtLeading()); + /* HACK: There is something wrong with Writer's bullet rendering, causing lines + with bullets to be higher than they should be. I think this is because + Writer uses font's external leading incorrect, as the vertical distance + added to every line instead of only a distance between multiple lines, + which means a single bullet has external leading added even though it + shouldn't, but frankly this is just an educated guess rather than understanding + Writer's layout (heh). + Symbol font in some documents is 'StarSymbol; Arial Unicode MS', and Windows + machines often do not have StarSymbol, falling back to Arial Unicode MS, which + has unusually high external leading. So just reset external leading for fonts + which are used to bullets, as those should not be used on multiple lines anyway, + so in correct rendering external leading should be irrelevant anyway. + Interestingly enough, bSymbol is false for 'StarSymbol; Arial Unicode MS', so + also check explicitly. + */ + if( bSymbol || IsStarSymbol( pPrtFont->GetName())) + nExtLeading = 0; } const IDocumentSettingAccess& rIDSA = *pSh->getIDocumentSettingAccess();
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits