[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.1' - 2 commits - editeng/source include/unotools oox/source sd/source sw/source unotools/source vcl/generic vcl/source
LuboÅ¡ LuÅák
l.lunak at suse.cz
Tue Oct 22 04:09:16 PDT 2013
editeng/source/items/textitem.cxx | 4 +---
include/unotools/fontdefs.hxx | 9 +++++++++
oox/source/export/drawingml.cxx | 2 +-
sd/source/filter/eppt/pptx-text.cxx | 2 +-
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/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, 51 insertions(+), 50 deletions(-)
New commits:
commit 08472b22d101a7b9e61a937e1f2c5b6e3e43cb8c
Author: LuboÅ¡ LuÅák <l.lunak at 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
(cherry picked from commit 85f892a3a1dbaa3c36ac3f31186eef1ec0eea464)
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 80b2ea8..2468f18 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();
commit f91c9e418f76cd254cabe7f6180f444a4e6ebb4c
Author: Thomas Arnhold <thomas at 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.lunak at suse.cz>
Tested-by: LuboÅ¡ LuÅák <l.lunak at suse.cz>
(cherry picked from commit 8079f40743f86c4f7e6c9af8393ff699378a0797)
Conflicts:
editeng/source/items/textitem.cxx
sd/source/filter/eppt/pptx-text.cxx
vcl/generic/glyphs/gcach_ftyp.cxx
Change-Id: I7a2e3a6f11bbaaaff50e8163e4ce3e2583b1d03c
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index c026f1d..f9f342e 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().EqualsAscii( "StarSymbol", 0, sizeof("StarSymbol")-1 ) ||
- GetFamilyName().EqualsAscii( "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/include/unotools/fontdefs.hxx b/include/unotools/fontdefs.hxx
index 60c37d4..d1bf777 100644
--- a/include/unotools/fontdefs.hxx
+++ b/include/unotools/fontdefs.hxx
@@ -90,6 +90,15 @@ UNOTOOLS_DLLPUBLIC OUString GetNextFontToken( const OUString& rTokenStr, sal_Int
UNOTOOLS_DLLPUBLIC void GetEnglishSearchFontName( OUString& 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/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index b083112..5a9b50e 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1483,7 +1483,7 @@ void DrawingML::WriteConnectorConnections( EscherConnectorListEntry& rConnectorE
sal_Unicode DrawingML::SubstituteBullet( sal_Unicode cBulletId, ::com::sun::star::awt::FontDescriptor& rFontDesc )
{
- if ( rFontDesc.Name.equalsIgnoreAsciiCase("starsymbol") || rFontDesc.Name.equalsIgnoreAsciiCase("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 adadc44..4461468 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.equals("starsymbol") || aFontDesc.Name.equals("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 fad2d67..08c68a0 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -666,14 +666,6 @@ namespace sw
}
}
- bool IsStarSymbol(const OUString &rFontName)
- {
- sal_Int32 nIndex = 0;
- 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 52bfba7..e411ac8 100644
--- a/sw/source/filter/ww8/writerhelper.hxx
+++ b/sw/source/filter/ww8/writerhelper.hxx
@@ -747,18 +747,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:cmc at openoffice.org">Caolán McNamara</a>
- */
- bool IsStarSymbol(const 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 af662ed..e34b16c 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -317,7 +317,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 82c54c1..61ffdee 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 <doctok/sprmids.hxx>
@@ -385,7 +386,7 @@ void MSWordExportBase::AbstractNumberingDefinitions()
sFontName = pBulletFont->GetName();
eFamily = pBulletFont->GetFamily();
- if ( sw::util::IsStarSymbol( sFontName ) )
+ if ( IsStarSymbol(sFontName) )
SubstituteBullet( sNumStr, eChrSet, sFontName );
// #i86652#
@@ -642,7 +643,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/source/misc/fontcvt.cxx b/unotools/source/misc/fontcvt.cxx
index ed34a5b..6676e34 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.misc", "Forcing a bullet substition from 0x" <<
diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx
index 4132b5d..d8211a0 100644
--- a/unotools/source/misc/fontdefs.cxx
+++ b/unotools/source/misc/fontdefs.cxx
@@ -596,4 +596,12 @@ int FontNameHash::operator()( const String& rStr ) const
return nHash;
}
+bool IsStarSymbol(const OUString &rFontName)
+{
+ sal_Int32 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 900125b..22b3d83 100644
--- a/vcl/generic/fontmanager/fontsubst.cxx
+++ b/vcl/generic/fontmanager/fontsubst.cxx
@@ -32,6 +32,7 @@
#include "salprn.hxx"
#include "region.h"
+#include <unotools/fontdefs.hxx>
#include <list>
// ===========================================================================
@@ -160,8 +161,7 @@ bool FcPreMatchSubstititution::FindFontSubstitute( FontSelectPattern &rFontSelDa
if( rFontSelData.IsSymbolFont() )
return false;
// StarSymbol is a unicode font, but it still deserves the symbol flag
- if(rFontSelData.maSearchName.startsWithIgnoreAsciiCase( "starsymbol" )
- || rFontSelData.maSearchName.startsWithIgnoreAsciiCase( "opensymbol" ) )
+ if ( IsStarSymbol(rFontSelData.maSearchName) )
return false;
//see fdo#41556 and fdo#47636
@@ -229,8 +229,7 @@ bool FcGlyphFallbackSubstititution::FindFontSubstitute( FontSelectPattern& rFont
if( rFontSelData.IsSymbolFont() )
return false;
// StarSymbol is a unicode font, but it still deserves the symbol flag
- if(rFontSelData.maSearchName.startsWithIgnoreAsciiCase( "starsymbol" )
- || rFontSelData.maSearchName.startsWithIgnoreAsciiCase( "opensymbol" ) )
+ 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 e3d65d9..d75c7d2 100644
--- a/vcl/generic/glyphs/gcach_ftyp.cxx
+++ b/vcl/generic/glyphs/gcach_ftyp.cxx
@@ -33,6 +33,7 @@
#include <graphite2/Font.h>
#include <graphite_layout.hxx>
#endif
+#include <unotools/fontdefs.hxx>
#include "tools/poly.hxx"
#include "basegfx/matrix/b2dhommatrix.hxx"
@@ -920,13 +921,8 @@ void ServerFont::FetchFontMetric( ImplFontMetricData& rTo, long& rFactor ) const
rTo.mnOrientation = GetFontSelData().mnOrientation;
//Always consider [star]symbol as symbol fonts
- if (
- (rTo.GetFamilyName() == "OpenSymbol" ) ||
- (rTo.GetFamilyName() == "StarSymbol" )
- )
- {
+ if ( IsStarSymbol( rTo.GetFamilyName() ) )
rTo.SetSymbolFlag( true );
- }
if( maSizeFT )
pFTActivateSize( maSizeFT );
diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx
index 1b862ba..385c3fd 100644
--- a/vcl/source/filter/wmf/wmfwr.cxx
+++ b/vcl/source/filter/wmf/wmfwr.cxx
@@ -394,12 +394,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 ef702cc..417c9d6 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 e911761..e970c89 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -695,8 +695,7 @@ PhysicalFontFace::PhysicalFontFace( const ImplDevFontAttributes& rDFA, int nMagi
{
// StarSymbol is a unicode font, but it still deserves the symbol flag
if( !IsSymbolFont() )
- if( GetFamilyName().startsWithIgnoreAsciiCase( "starsymbol" )
- || GetFamilyName().startsWithIgnoreAsciiCase( "opensymbol" ) )
+ if ( IsStarSymbol( GetFamilyName() ) )
SetSymbolFlag( true );
}
More information about the Libreoffice-commits
mailing list