[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/generic

2014-03-12 Thread Caolán McNamara
 vcl/generic/fontmanager/fontconfig.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit f000cc02ee6e75e0e610940f61c3207a105dc95c
Author: Caolán McNamara caol...@redhat.com
Date:   Wed Mar 12 15:56:15 2014 +

Resolves: fdo#50855 Nimbus Sans L missing styles

Change-Id: Ie8cdcf4ad0ffe52024fd5cfe33073abfc6aadca8
(cherry picked from commit 1e539dbf0fe3894bbf6bf1a0851163b56e37f090)
Reviewed-on: https://gerrit.libreoffice.org/8557
Reviewed-by: Norbert Thiebaud nthieb...@gmail.com
Tested-by: Norbert Thiebaud nthieb...@gmail.com

diff --git a/vcl/generic/fontmanager/fontconfig.cxx 
b/vcl/generic/fontmanager/fontconfig.cxx
index 20e7768..3d3bd81 100644
--- a/vcl/generic/fontmanager/fontconfig.cxx
+++ b/vcl/generic/fontmanager/fontconfig.cxx
@@ -529,6 +529,7 @@ void PrintFontManager::countFontconfigFonts( 
boost::unordered_mapOString, int,
 FcChar8* format = NULL;
 int slant = 0;
 int weight = 0;
+int width = 0;
 int spacing = 0;
 int nCollectionEntry = -1;
 FcBool outline = false;
@@ -538,6 +539,7 @@ void PrintFontManager::countFontconfigFonts( 
boost::unordered_mapOString, int,
 FcResult eStyleRes= rWrapper.LocalizedElementFromPattern( 
pFSet-fonts[i], style, FC_STYLE, FC_STYLELANG );
 FcResult eSlantRes= FcPatternGetInteger(pFSet-fonts[i], 
FC_SLANT, 0, slant);
 FcResult eWeightRes   = FcPatternGetInteger(pFSet-fonts[i], 
FC_WEIGHT, 0, weight);
+FcResult eWidthRes= FcPatternGetInteger(pFSet-fonts[i], 
FC_WIDTH, 0, width);
 FcResult eSpacRes = FcPatternGetInteger(pFSet-fonts[i], 
FC_SPACING, 0, spacing);
 FcResult eOutRes  = FcPatternGetBool(pFSet-fonts[i], 
FC_OUTLINE, 0, outline);
 FcResult eIndexRes= FcPatternGetInteger(pFSet-fonts[i], 
FC_INDEX, 0, nCollectionEntry);
@@ -549,11 +551,12 @@ void PrintFontManager::countFontconfigFonts( 
boost::unordered_mapOString, int,
 #if (OSL_DEBUG_LEVEL  2)
 fprintf( stderr, found font \%s\ in file %s\n
 weight = %d, slant = %d, style = \%s\\n
-spacing = %d, outline = %d, format %s\n
+width = %d, spacing = %d, outline = %d, format %s\n
  , family, file
  , eWeightRes == FcResultMatch ? weight : -1
  , eSpacRes == FcResultMatch ? slant : -1
  , eStyleRes == FcResultMatch ? (const char*) style : 
nil
+ , eWeightRes == FcResultMatch ? width : -1
  , eSpacRes == FcResultMatch ? spacing : -1
  , eOutRes == FcResultMatch ? outline : -1
  , eFormatRes == FcResultMatch ? (const char*)format : 
unknown
@@ -655,6 +658,8 @@ void PrintFontManager::countFontconfigFonts( 
boost::unordered_mapOString, int,
 }
 if( eWeightRes == FcResultMatch )
 pUpdate-m_eWeight = convertWeight(weight);
+if( eWidthRes == FcResultMatch )
+pUpdate-m_eWidth = convertWidth(width);
 if( eSpacRes == FcResultMatch )
 pUpdate-m_ePitch = convertSpacing(spacing);
 if( eSlantRes == FcResultMatch )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/generic

2013-11-25 Thread Khaled Hosny
 vcl/generic/fontmanager/fontmanager.cxx |   14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

New commits:
commit 4d174557c04a48efa5661c5e6e2c1295b68f3681
Author: Khaled Hosny khaledho...@eglug.org
Date:   Sat Nov 23 13:12:59 2013 +0200

Make TTC fonts work again

osl::File::getFileURLFromSystemPath() does not return a boolean. I
wonder how this worked before, if it worked at all.

Change-Id: Iadc0e06236f43c24cbcd42e4fd79ac9116a58c13
Reviewed-on: https://gerrit.libreoffice.org/6769
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/vcl/generic/fontmanager/fontmanager.cxx 
b/vcl/generic/fontmanager/fontmanager.cxx
index 418f480..5e92170 100644
--- a/vcl/generic/fontmanager/fontmanager.cxx
+++ b/vcl/generic/fontmanager/fontmanager.cxx
@@ -1176,20 +1176,14 @@ bool PrintFontManager::analyzeFontFile( int nDirID, 
const OString rFontFile, ::
 fprintf( stderr, ttc: %s contains %d fonts\n, 
aFullPath.getStr(), nLength );
 #endif
 
-sal_uInt64 fileSize;
+sal_uInt64 fileSize = 0;
 
 OUString aURL;
-if 
(!osl::File::getFileURLFromSystemPath(OStringToOUString(aFullPath, 
osl_getThreadTextEncoding()),
-aURL))
-{
-fileSize = 0;
-}
-else
+if 
(osl::File::getFileURLFromSystemPath(OStringToOUString(aFullPath, 
osl_getThreadTextEncoding()),
+aURL) == osl::File::E_None)
 {
 osl::File aFile(aURL);
-if (aFile.open(osl_File_OpenFlag_Read | 
osl_File_OpenFlag_NoLock) != osl::File::E_None)
-fileSize = 0;
-else
+if (aFile.open(osl_File_OpenFlag_Read | 
osl_File_OpenFlag_NoLock) == osl::File::E_None)
 {
 osl::DirectoryItem aItem;
 osl::DirectoryItem::get( aURL, aItem );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/generic

2013-11-25 Thread Khaled Hosny
 vcl/generic/print/genpspgraphics.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8b6f67c676d15a3178d268ff9974155d6e130205
Author: Khaled Hosny khaledho...@eglug.org
Date:   Sat Nov 23 13:40:50 2013 +0200

Correctly check getFileURLFromSystemPath() success

Change-Id: Iadc34171235fec2d6aafd601f62a0bff8ed5b3ee
Reviewed-on: https://gerrit.libreoffice.org/6770
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/vcl/generic/print/genpspgraphics.cxx 
b/vcl/generic/print/genpspgraphics.cxx
index 10af660..993d8d5 100644
--- a/vcl/generic/print/genpspgraphics.cxx
+++ b/vcl/generic/print/genpspgraphics.cxx
@@ -1390,7 +1390,7 @@ const void* GenPspGraphics::DoGetEmbedFontData( 
psp::fontID aFont, const sal_Ucs
 #else
 // FIXME: test me ! ...
 OUString aURL;
-if( !osl::File::getFileURLFromSystemPath( OStringToOUString( aSysPath, 
osl_getThreadTextEncoding() ), aURL ) )
+if( osl::File::getFileURLFromSystemPath( OStringToOUString( aSysPath, 
osl_getThreadTextEncoding() ), aURL ) != osl::File::E_None )
 return NULL;
 osl::File aFile( aURL );
 if( aFile.open( osl_File_OpenFlag_Read | osl_File_OpenFlag_NoLock ) != 
osl::File::E_None )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/generic

2013-11-25 Thread Khaled Hosny
 vcl/generic/print/glyphset.cxx |   12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

New commits:
commit cfcd8112c0cb459646ea8c17bd889c945e75f3a5
Author: Khaled Hosny khaledho...@eglug.org
Date:   Thu Nov 21 22:59:06 2013 +0200

fdo#67802: Fix PS printing of non-CTL text with ligatures

The GlyphSet::AddGlyphID() was messing with glyphs of characters that
can be converted to Windows-1252 encoding, discarding whatever glyph it
was asked to use and using a random glyph that is supposed to belong to
the converted character. For ligatures this means the ligature glyphs
was discarded and the glyphs for its component was used, but this broken
for just any glyph substitution.

The code makes no sense at all, apart from the fact that it is verbatim
copy of GlyphSet::AddCharID() since 9754ad8d979557ea03cbfe04708b62b698d1276c
and just happened to work because we did not enable ligatures and other
typographic features for non-CTL text before.

Change-Id: I764f0b40f8acf61eae38a9038b0666d711c04a9d
Reviewed-on: https://gerrit.libreoffice.org/6762
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/vcl/generic/print/glyphset.cxx b/vcl/generic/print/glyphset.cxx
index d22d2c8..bb43ef5 100644
--- a/vcl/generic/print/glyphset.cxx
+++ b/vcl/generic/print/glyphset.cxx
@@ -275,16 +275,14 @@ GlyphSet::AddGlyphID (
  sal_Int32* nOutGlyphSetID
  )
 {
-sal_uChar nMappedChar;
+sal_uChar nMappedChar = 0;
 
 // XXX important: avoid to reencode type1 symbol fonts
 if (mnBaseEncoding == RTL_TEXTENCODING_SYMBOL)
 nMappedChar = GetSymbolMapping (nUnicode);
-else
-nMappedChar = GetAnsiMapping (nUnicode);
 
-// create an empty glyphmap that is reserved for iso1252 encoded glyphs
-// (or -- unencoded -- symbol glyphs) and a second map that takes any other
+// create an empty glyphmap that is reserved for unencoded symbol glyphs,
+// and a second map that takes any other
 if (maGlyphList.empty())
 {
 glyph_map_t aMap, aMapp;
@@ -302,7 +300,7 @@ GlyphSet::AddGlyphID (
 // insert a new glyph in the font subset
 if (nMappedChar)
 {
-// always put iso1252 chars into the first map, map them on itself
+// always put symbol glyphs into the first map, map them on itself
 glyph_map_t aGlyphSet = maGlyphList.front();
 AddNotdef (aGlyphSet);
 
@@ -312,7 +310,7 @@ GlyphSet::AddGlyphID (
 }
 else
 {
-// other chars are just appended to the list
+// other glyphs are just appended to the list
 glyph_map_t aGlyphSet = maGlyphList.back();
 AddNotdef (aGlyphSet);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/generic vcl/source

2013-11-08 Thread Michael Stahl
 vcl/generic/glyphs/gcach_ftyp.cxx   |2 +-
 vcl/source/glyphs/graphite_features.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 583bee1ca0804c351fc8e44ee0c0442d22600d80
Author: Michael Stahl mst...@redhat.com
Date:   Wed Nov 6 13:01:55 2013 +0100

vcl: WORDS_BIGENDIAN is never defined, use OSL_BIGENDIAN

Change-Id: I5186904b9703d6c9c49ca4c3b4a62f83423b1ae1
(cherry picked from commit 94d31d9ad1513504bb1415f0cfe70be380e18b9a)
Reviewed-on: https://gerrit.libreoffice.org/6612
Reviewed-by: Miklos Vajna vmik...@collabora.co.uk
Tested-by: Miklos Vajna vmik...@collabora.co.uk

diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx 
b/vcl/generic/glyphs/gcach_ftyp.cxx
index e3d65d9..854433b 100644
--- a/vcl/generic/glyphs/gcach_ftyp.cxx
+++ b/vcl/generic/glyphs/gcach_ftyp.cxx
@@ -275,7 +275,7 @@ const void * graphiteFontTable(const void* appFaceHandle, 
unsigned int name, siz
 } TableId;
 TableId tableId;
 tableId.m_id = name;
-#ifndef WORDS_BIGENDIAN
+#ifndef OSL_BIGENDIAN
 TableId swapped;
 swapped.m_c[3] = tableId.m_c[0];
 swapped.m_c[2] = tableId.m_c[1];
diff --git a/vcl/source/glyphs/graphite_features.cxx 
b/vcl/source/glyphs/graphite_features.cxx
index ec33500..6801140 100644
--- a/vcl/source/glyphs/graphite_features.cxx
+++ b/vcl/source/glyphs/graphite_features.cxx
@@ -219,7 +219,7 @@ gr_uint32 GrFeatureParser::getCharId(const OString  id, 
size_t offset, size_t l
 {
 FeatId charId;
 charId.num = 0;
-#ifdef WORDS_BIGENDIAN
+#ifdef OSL_BIGENDIAN
 for (size_t i = 0; i  length; i++)
 {
 charId.label[i] = id[offset+i];
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/generic vcl/source

2013-11-01 Thread Khaled Hosny
 vcl/generic/glyphs/gcach_layout.cxx |   26 +-
 vcl/source/gdi/sallayout.cxx|   21 +
 2 files changed, 42 insertions(+), 5 deletions(-)

New commits:
commit bb624ea64b13250573016bad7d02395556e80458
Author: Khaled Hosny khaledho...@eglug.org
Date:   Wed Oct 30 09:34:38 2013 +0200

fdo#70968: Incorrect rendering of Devanagari short 'i' vowel

It seems that some Indic fonts assign 'mark' glyph class to combining
spacing marks (spacing not non spacing) so my reliance on the glyph
class to set the IS_DIACRITIC flags broke those fonts. This is a bandaid
to get around the issue, plus some long rant! (at this rate, I'll be
writing The VCL haters handbook pretty soon).

Change-Id: I3ff892acf746d50182573f94e7e8c3c6f9464ae0
Reviewed-on: https://gerrit.libreoffice.org/6485
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/vcl/generic/glyphs/gcach_layout.cxx 
b/vcl/generic/glyphs/gcach_layout.cxx
index 848f4cb..c8fbda7 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -475,20 +475,36 @@ bool HbLayoutEngine::layout(ServerFontLayout rLayout, 
ImplLayoutArgs rArgs)
 if (bInCluster)
 nGlyphFlags |= GlyphItem::IS_IN_CLUSTER;
 
+// The whole IS_DIACRITIC concept is a stupid hack that was
+// introduced ages ago to work around the utter brokenness of the
+// way justification adjustments are applied (the DXArray fiasco).
+// Since it is such a stupid hack, there is no sane way to directly
+// map to concepts of the outside world, so we do some rather
+// ugly hacks:
+// * If the font has a GDEF table, we check for glyphs with mark
+//   glyph class which is sensible, except that some fonts
+//   (fdo#70968) assign mark class to spacing marks (which is wrong
+//   but usually harmless), so we try to sniff what HarfBuzz thinks
+//   about this glyph by checking if it gives it a zero advance
+//   width.
+// * If the font has no GDEF table, we just check if the glyph has
+//   zero advance width, but this is stupid and can be wrong. A
+//   better way would to check the character's Unicode combining
+//   class, but unfortunately glyph gives combining marks the
+//   cluster value of its base character, so nCharPos will be
+//   pointing to the wrong character (but HarfBuzz might change
+//   this in the future).
 bool bDiacritic = false;
 if (hb_ot_layout_has_glyph_classes(mpHbFace))
 {
 // the font has GDEF table
-if (hb_ot_layout_get_glyph_class(mpHbFace, nGlyphIndex) == 
HB_OT_LAYOUT_GLYPH_CLASS_MARK)
+bool bMark = hb_ot_layout_get_glyph_class(mpHbFace, 
nGlyphIndex) == HB_OT_LAYOUT_GLYPH_CLASS_MARK;
+if (bMark  pHbPositions[i].x_advance == 0)
 bDiacritic = true;
 }
 else
 {
 // the font lacks GDEF table
-// HACK: if the resolved glyph advance is zero assume it is a
-// combining mark.  The whole IS_DIACRITIC concept is a hack to
-// fix the other hacks we use to second-guess glyph advances in
-// ApplyDXArray and the likes and it needs to die
 if (pHbPositions[i].x_advance == 0)
 bDiacritic = true;
 }
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 2340502..6b88e5c 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -1012,6 +1012,27 @@ void GenericSalLayout::AdjustLayout( ImplLayoutArgs 
rArgs )
 
 // ---
 
+// This DXArray thing is one of the stupidest ideas I have ever seen (I've been
+// told that it probably a one-to-one mapping of some Windows 3.1 API, which is
+// telling). To justify a text string, Writer calls 
OutputDevice::GetTextArray()
+// to get an array that maps input characters (not glyphs) to their absolute
+// position, GetTextArray() in turn calls SalLayout::FillDXArray() to get an
+// array of character widths that it converts to absolute positions.
+//
+// Writer would then apply justification adjustments to that array of absolute
+// character positions and return to OutputDevice, which eventually calls
+// ApplyDXArray(), which needs to extract the individual adjustments for each
+// character to apply it to corresponding glyphs, and since that information is
+// already lost it tries to do some heuristics to guess it again. Those
+// heuristics often fail, and have always been a source of all sorts of weird
+// text layout bugs, and instead of 

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/generic vcl/inc

2013-10-23 Thread Caolán McNamara
 vcl/generic/fontmanager/fontconfig.cxx |   47 +
 vcl/generic/glyphs/gcach_layout.cxx|   61 -
 vcl/inc/generic/glyphcache.hxx |5 ++
 3 files changed, 89 insertions(+), 24 deletions(-)

New commits:
commit 5a0984fd383e54c130016d15a0b72c230968c61e
Author: Caolán McNamara caol...@redhat.com
Date:   Tue Jun 4 15:48:23 2013 +0100

fdo#70741 fdo#66042 rhbz#968892: force render full grapheme with fallback 
font

Related: rhbz#968892 discard impossible languages for oriya script fallback
Related: rhbz#968892 discard impossible languages for glyph fallback
Resolves: fdo#66042 get the bounds of the current grapheme
(also includes Change-Id: I14f1bab09eb0be9c2c896a1dde45913b99aab6df)
(also includes Change-Id: I5b1808d74f0a1dd0d8b6ea22136e574c0a6e8e2a)
(also includes Change-Id: I5bb98c61d047e69d74666261b2c489d80f344502)

Change-Id: I46d8cacba2b8ca0f24e1c4ba836839387d74e1a4
Reviewed-on: https://gerrit.libreoffice.org/6398
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com
Reviewed-by: Björn Michaelsen bjoern.michael...@canonical.com

diff --git a/vcl/generic/fontmanager/fontconfig.cxx 
b/vcl/generic/fontmanager/fontconfig.cxx
index fb3bae2..20e7768 100644
--- a/vcl/generic/fontmanager/fontconfig.cxx
+++ b/vcl/generic/fontmanager/fontconfig.cxx
@@ -854,6 +854,49 @@ namespace
 #endif
 }
 
+//returns true if the given code-point couldn't possibly be in rLangTag.
+bool isImpossibleCodePointForLang(const LanguageTag rLangTag, sal_uInt32 
currentChar)
+{
+//a non-default script is set, lets believe it
+if (rLangTag.hasScript())
+return false;
+
+int32_t script = u_getIntPropertyValue(currentChar, UCHAR_SCRIPT);
+UScriptCode eScript = static_castUScriptCode(script);
+bool bIsImpossible = false;
+OUString sLang = rLangTag.getLanguage();
+switch (eScript)
+{
+//http://en.wiktionary.org/wiki/Category:Oriya_script_languages
+case USCRIPT_ORIYA:
+bIsImpossible =
+sLang != or 
+sLang != kxv;
+break;
+//http://en.wiktionary.org/wiki/Category:Telugu_script_languages
+case USCRIPT_TELUGU:
+bIsImpossible =
+sLang != te 
+sLang != gon 
+sLang != kfc;
+break;
+//http://en.wiktionary.org/wiki/Category:Bengali_script_languages
+case USCRIPT_BENGALI:
+bIsImpossible =
+sLang != bn 
+sLang != as 
+sLang != bpy 
+sLang != ctg 
+sLang != sa;
+break;
+default:
+break;
+}
+SAL_WARN_IF(bIsImpossible, vcl, Throwing away user set language of 
+ sLang   for finding a font for glyph fallback and 
autodetecting instead);
+return bIsImpossible;
+}
+
 LanguageTag getExemplerLangTagForCodePoint(sal_uInt32 currentChar)
 {
 int32_t script = u_getIntPropertyValue(currentChar, UCHAR_SCRIPT);
@@ -961,6 +1004,10 @@ bool PrintFontManager::Substitute( FontSelectPattern 
rPattern, OUString rMissi
 // also handle unicode surrogates
 const sal_uInt32 nCode = rMissingCodes.iterateCodePoints( 
nStrIndex );
 FcCharSetAddChar( unicodes, nCode );
+//if the codepoint is impossible for this lang tag, then clear it
+//and autodetect something useful
+if (!aLangAttrib.isEmpty()  
isImpossibleCodePointForLang(aLangTag, nCode))
+aLangAttrib = OString();
 //#i105784#/rhbz#527719  improve selection of fallback font
 if (aLangAttrib.isEmpty())
 {
diff --git a/vcl/generic/glyphs/gcach_layout.cxx 
b/vcl/generic/glyphs/gcach_layout.cxx
index 833cf4f..848f4cb 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -41,6 +41,10 @@
 #include unicode/uscript.h
 #include unicode/ubidi.h
 
+#include com/sun/star/lang/XMultiServiceFactory.hpp
+#include com/sun/star/i18n/CharacterIteratorMode.hpp
+#include comphelper/processfactory.hxx
+
 // ===
 // layout implementation for ServerFont
 // ===
@@ -90,23 +94,42 @@ void ServerFontLayout::AdjustLayout( ImplLayoutArgs rArgs )
 }
 }
 
-// ===
-
-static bool lcl_CharIsJoiner(sal_Unicode cChar)
+void ServerFontLayout::setNeedFallback(ImplLayoutArgs rArgs, sal_Int32 
nCharPos,
+bool bRightToLeft)
 {
-return ((cChar == 0x200C) || (cChar == 0x200D));
-}
+if (nCharPos  

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/generic

2013-10-15 Thread Caolán McNamara
 vcl/generic/fontmanager/fontmanager.cxx |   33 
 1 file changed, 33 insertions(+)

New commits:
commit 22e58528fed41b15d242eb9e85dc25c51ec01e4d
Author: Caolán McNamara caol...@redhat.com
Date:   Sat Oct 5 10:32:12 2013 +0100

CID#736943 clamp no of ttc entries to physical max

Change-Id: Ic63defe9c14c6ee2b86bd5b7730a570238ca3981
(cherry picked from commit 225539ab08043b6937fdd67d9ae308ebd4104646)
Reviewed-on: https://gerrit.libreoffice.org/6150
Reviewed-by: Michael Stahl mst...@redhat.com
Tested-by: Michael Stahl mst...@redhat.com

diff --git a/vcl/generic/fontmanager/fontmanager.cxx 
b/vcl/generic/fontmanager/fontmanager.cxx
index d3adb50..418f480 100644
--- a/vcl/generic/fontmanager/fontmanager.cxx
+++ b/vcl/generic/fontmanager/fontmanager.cxx
@@ -1175,6 +1175,39 @@ bool PrintFontManager::analyzeFontFile( int nDirID, 
const OString rFontFile, ::
 #if OSL_DEBUG_LEVEL  1
 fprintf( stderr, ttc: %s contains %d fonts\n, 
aFullPath.getStr(), nLength );
 #endif
+
+sal_uInt64 fileSize;
+
+OUString aURL;
+if 
(!osl::File::getFileURLFromSystemPath(OStringToOUString(aFullPath, 
osl_getThreadTextEncoding()),
+aURL))
+{
+fileSize = 0;
+}
+else
+{
+osl::File aFile(aURL);
+if (aFile.open(osl_File_OpenFlag_Read | 
osl_File_OpenFlag_NoLock) != osl::File::E_None)
+fileSize = 0;
+else
+{
+osl::DirectoryItem aItem;
+osl::DirectoryItem::get( aURL, aItem );
+osl::FileStatus aFileStatus( osl_FileStatus_Mask_FileSize 
);
+aItem.getFileStatus( aFileStatus );
+fileSize = aFileStatus.getFileSize();
+}
+}
+
+//Feel free to calc the exact max possible number of fonts a file
+//could contain given its physical size. But this will clamp it to
+//a sane starting point
+//http://processingjs.nihongoresources.com/the_smallest_font/
+//https://github.com/grzegorzrolek/null-ttf
+int nMaxFontsPossible = fileSize / 528;
+
+nLength = std::min(nLength, nMaxFontsPossible);
+
 for( int i = 0; i  nLength; i++ )
 {
 TrueTypeFontFile* pFont = new TrueTypeFontFile();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/generic

2013-08-23 Thread Khaled Hosny
 vcl/generic/glyphs/gcach_layout.cxx |   17 +
 1 file changed, 17 insertions(+)

New commits:
commit fbaedf8bd45d3cc4409c92a4b798d9d9788567ed
Author: Khaled Hosny khaledho...@eglug.org
Date:   Thu Aug 22 21:25:44 2013 +0200

fdo#66715: Avoid compatibility decomposition with HarfBuzz

Change-Id: Ibbf5720baf7fb507e66515104115d58597258b1d
Reviewed-on: https://gerrit.libreoffice.org/5598
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/vcl/generic/glyphs/gcach_layout.cxx 
b/vcl/generic/glyphs/gcach_layout.cxx
index 4fd4cf4..9031ab7 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -298,6 +298,22 @@ static hb_font_funcs_t* getFontFuncs(void)
 return funcs;
 }
 
+// Disabled Unicode compatibility decomposition, see fdo#66715
+static unsigned int unicodeDecomposeCompatibility(hb_unicode_funcs_t* 
/*ufuncs*/,
+  hb_codepoint_t  /*u*/,
+  hb_codepoint_t* 
/*decomposed*/,
+  void*   
/*user_data*/)
+{
+return 0;
+}
+
+static hb_unicode_funcs_t* getUnicodeFuncs(void)
+{
+static hb_unicode_funcs_t* ufuncs = 
hb_unicode_funcs_create(hb_icu_get_unicode_funcs());
+hb_unicode_funcs_set_decompose_compatibility_func(ufuncs, 
unicodeDecomposeCompatibility, NULL, NULL);
+return ufuncs;
+}
+
 class HbLayoutEngine : public ServerFontLayoutEngine
 {
 private:
@@ -384,6 +400,7 @@ bool HbLayoutEngine::layout(ServerFontLayout rLayout, 
ImplLayoutArgs rArgs)
 OString sLanguage = OUStringToOString(aLangTag.getLanguage(), 
RTL_TEXTENCODING_UTF8);
 
 hb_buffer_t *pHbBuffer = hb_buffer_create();
+hb_buffer_set_unicode_funcs(pHbBuffer, getUnicodeFuncs());
 hb_buffer_set_direction(pHbBuffer, bRightToLeft ? HB_DIRECTION_RTL: 
HB_DIRECTION_LTR);
 hb_buffer_set_script(pHbBuffer, hb_icu_script_to_script(eScriptCode));
 hb_buffer_set_language(pHbBuffer, 
hb_language_from_string(sLanguage.getStr(), -1));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/generic

2013-08-23 Thread Khaled Hosny
 vcl/generic/glyphs/gcach_layout.cxx |   13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 93e590627587f4023e03338696e35751b5a6ce52
Author: Khaled Hosny khaledho...@eglug.org
Date:   Thu Aug 22 22:57:54 2013 +0200

Don't re-create Unicode and font functions for every text run

Change-Id: I35ba21d753adfc619656d4473b214485dc00faba
Reviewed-on: https://gerrit.libreoffice.org/5599
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/vcl/generic/glyphs/gcach_layout.cxx 
b/vcl/generic/glyphs/gcach_layout.cxx
index 9031ab7..833cf4f 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -122,6 +122,9 @@ std::ostream operator (std::ostream s, ServerFont* 
pFont)
 return s;
 }
 
+static hb_font_funcs_t* pHbFontFuncs = NULL;
+static hb_unicode_funcs_t* pHbUnicodeFuncs = NULL;
+
 static hb_blob_t *getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* 
pUserData)
 {
 char pTagName[5];
@@ -353,8 +356,11 @@ bool HbLayoutEngine::layout(ServerFontLayout rLayout, 
ImplLayoutArgs rArgs)
 
 SAL_INFO(vcl.harfbuzz.layout, layout(  this  ,rArgs=  rArgs  
));
 
+if (pHbFontFuncs == NULL)
+pHbFontFuncs = getFontFuncs();
+
 hb_font_t *pHbFont = hb_font_create(mpHbFace);
-hb_font_set_funcs(pHbFont, getFontFuncs(), rFont, NULL);
+hb_font_set_funcs(pHbFont, pHbFontFuncs, rFont, NULL);
 hb_font_set_scale(pHbFont,
 ((uint64_t) aFtFace-size-metrics.x_scale * (uint64_t) 
fUnitsPerEM)  16,
 ((uint64_t) aFtFace-size-metrics.y_scale * (uint64_t) 
fUnitsPerEM)  16);
@@ -399,8 +405,11 @@ bool HbLayoutEngine::layout(ServerFontLayout rLayout, 
ImplLayoutArgs rArgs)
 LanguageTag aLangTag(rArgs.meLanguage);
 OString sLanguage = OUStringToOString(aLangTag.getLanguage(), 
RTL_TEXTENCODING_UTF8);
 
+if (pHbUnicodeFuncs == NULL)
+pHbUnicodeFuncs = getUnicodeFuncs();
+
 hb_buffer_t *pHbBuffer = hb_buffer_create();
-hb_buffer_set_unicode_funcs(pHbBuffer, getUnicodeFuncs());
+hb_buffer_set_unicode_funcs(pHbBuffer, pHbUnicodeFuncs);
 hb_buffer_set_direction(pHbBuffer, bRightToLeft ? HB_DIRECTION_RTL: 
HB_DIRECTION_LTR);
 hb_buffer_set_script(pHbBuffer, hb_icu_script_to_script(eScriptCode));
 hb_buffer_set_language(pHbBuffer, 
hb_language_from_string(sLanguage.getStr(), -1));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/generic

2013-07-31 Thread Michael Stahl
 vcl/generic/fontmanager/fontconfig.cxx |   35 +++--
 1 file changed, 21 insertions(+), 14 deletions(-)

New commits:
commit ff8a6b661dc304cb3a858facbd0dbda66ff01641
Author: Michael Stahl mst...@redhat.com
Date:   Tue Jul 30 16:11:54 2013 +0200

fdo#66715: fontconfig: try harder to ignore duplicate fonts

The thin space not being displayed correctly is caused by using the
wrong font, namely
/usr/share/fonts/liberation/LiberationSerif-Regular.ttf,
which (on Fedora 18) is version 1 and does not contain u2006 etc.
glyphs, whereas the LiberationSerif-Regular.ttf bundled with LO
is version 2 and does contain these.

There is already isPreviouslyDuplicateOrObsoleted() function to ignore
older fonts but it does not work for this case because:

1) Only the previous element was looked at, but there may be several
   fonts with different weight/slant that need to be checked.

2) The LiberationSerif-Regular.ttf differ in the lang entry.

Change-Id: I2f9e8d50a1f8155b65f8f07c9259dd988c32992a
(cherry picked from commit 1c48e4efa2369e5708798bdefb46b74a86415d00)
Reviewed-on: https://gerrit.libreoffice.org/5203
Reviewed-by: Fridrich Strba fridr...@documentfoundation.org
Tested-by: Fridrich Strba fridr...@documentfoundation.org

diff --git a/vcl/generic/fontmanager/fontconfig.cxx 
b/vcl/generic/fontmanager/fontconfig.cxx
index 1b36980..fb3bae2 100644
--- a/vcl/generic/fontmanager/fontconfig.cxx
+++ b/vcl/generic/fontmanager/fontconfig.cxx
@@ -209,30 +209,37 @@ namespace
 //on being sorted with SortFont
 bool isPreviouslyDuplicateOrObsoleted(FcFontSet *pFSet, int i)
 {
-if (i == 0)
-return false;
-
 const FcPattern *a = pFSet-fonts[i];
-const FcPattern *b = pFSet-fonts[i-1];
-
-if (compareFontNames(a, b) != 0)
-return false;
 
 FcPattern* pTestPatternA = FcPatternDuplicate(a);
 FcPatternDel(pTestPatternA, FC_FILE);
 FcPatternDel(pTestPatternA, FC_CHARSET);
 FcPatternDel(pTestPatternA, FC_CAPABILITY);
 FcPatternDel(pTestPatternA, FC_FONTVERSION);
+FcPatternDel(pTestPatternA, FC_LANG);
 
-FcPattern* pTestPatternB = FcPatternDuplicate(b);
-FcPatternDel(pTestPatternB, FC_FILE);
-FcPatternDel(pTestPatternB, FC_CHARSET);
-FcPatternDel(pTestPatternB, FC_CAPABILITY);
-FcPatternDel(pTestPatternB, FC_FONTVERSION);
+bool bIsDup(false);
 
-bool bIsDup = FcPatternEqual(pTestPatternA, pTestPatternB);
+// fdo#66715: loop for case of several font files for same font
+for (int j = i - 1; 0 = j  !bIsDup; --j)
+{
+const FcPattern *b = pFSet-fonts[j];
+
+if (compareFontNames(a, b) != 0)
+break;
+
+FcPattern* pTestPatternB = FcPatternDuplicate(b);
+FcPatternDel(pTestPatternB, FC_FILE);
+FcPatternDel(pTestPatternB, FC_CHARSET);
+FcPatternDel(pTestPatternB, FC_CAPABILITY);
+FcPatternDel(pTestPatternB, FC_FONTVERSION);
+FcPatternDel(pTestPatternB, FC_LANG);
+
+bIsDup = FcPatternEqual(pTestPatternA, pTestPatternB);
+
+FcPatternDestroy(pTestPatternB);
+}
 
-FcPatternDestroy(pTestPatternB);
 FcPatternDestroy(pTestPatternA);
 
 return bIsDup;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/generic

2013-07-11 Thread Caolán McNamara
 vcl/generic/fontmanager/fontcache.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit e533ba0e521cf1da08c6b8d1b8229d5622bddcb5
Author: Caolán McNamara caol...@redhat.com
Date:   Thu Jul 11 19:32:57 2013 +0100

Resolves: fdo#66524 string conversion gone wrong

Change-Id: Ie885514cdfaecc14ac57bb53a2da7c51274d54b0
(cherry picked from commit 019a8f3f74ec778d5fead4d2b4d47e75cf750bf7)
Reviewed-on: https://gerrit.libreoffice.org/4848
Reviewed-by: Michael Meeks michael.me...@suse.com
Tested-by: Michael Meeks michael.me...@suse.com

diff --git a/vcl/generic/fontmanager/fontcache.cxx 
b/vcl/generic/fontmanager/fontcache.cxx
index 0d14d48..0f6c677 100644
--- a/vcl/generic/fontmanager/fontcache.cxx
+++ b/vcl/generic/fontmanager/fontcache.cxx
@@ -264,10 +264,10 @@ void FontCache::read()
 do
 {
 aStream.ReadLine( aLine );
-if( aLine == FontCacheDirectory: ||
-aLine == EmptyFontCacheDirectory: )
+if( aLine.startsWith(FontCacheDirectory:) ||
+aLine.startsWith(EmptyFontCacheDirectory:) )
 {
-bool bEmpty = (aLine == Empty );
+bool bEmpty = aLine.startsWith(Empty);
 sal_Int32 nSearchIndex = bEmpty ? 24 : 19;
 
 OString aDir;
@@ -309,7 +309,7 @@ void FontCache::read()
 m_aCache[ nDir ].m_bUserOverrideOnly = bKeepOnlyUserOverridden;
 }
 }
-else if( pDir  aLine == File:)
+else if( pDir  aLine.startsWith(File:) )
 {
 OString aFile( aLine.copy( 5 ) );
 aStream.ReadLine( aLine );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/generic

2013-06-20 Thread Khaled Hosny
 vcl/generic/glyphs/gcach_ftyp.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit fa1122a42dad9d89ab608bdc0e0c4b064e431797
Author: Khaled Hosny khaledho...@eglug.org
Date:   Thu Jun 20 01:27:21 2013 +0200

Fix calculation of internal leading

Stupid me, I totally messed this up! God only knows how many non-bugs
people had to fix because of this typo.

Has the side effect of fixing fdo#64972 (among many others of course,
but this is the only one still open).

Change-Id: I9d8fdb6d37d4af9b0ac973902e469e0bd3a2408a
(cherry picked from commit 22d23d52b0f65636df3a1cb8fada9bf7de77eb78)

Signed-off-by: Caolán McNamara caol...@redhat.com

diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx 
b/vcl/generic/glyphs/gcach_ftyp.cxx
index e34b38d..e3d65d9 100644
--- a/vcl/generic/glyphs/gcach_ftyp.cxx
+++ b/vcl/generic/glyphs/gcach_ftyp.cxx
@@ -993,7 +993,7 @@ void ServerFont::FetchFontMetric( ImplFontMetricData rTo, 
long rFactor ) const
 }
 }
 
-rTo.mnIntLeading = (rTo.mnAscent + rTo.mnDescent) - 
((maFaceFT-units_per_EM + 32)  6);
+rTo.mnIntLeading = rTo.mnAscent + rTo.mnDescent - (maFaceFT-units_per_EM 
* fScale + 0.5);
 
 if( pOS2  (pOS2-version != 0x) )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/generic

2013-06-04 Thread Petr Mladek
 vcl/generic/glyphs/gcach_ftyp.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 1d34b905fad48b7aee7ccf39e33d952846f00fea
Author: Petr Mladek pmla...@suse.cz
Date:   Tue Jun 4 12:09:55 2013 +0200

Revert Fix fdo#64972 - strikethrough displays too high

It made Impress almost unusable. See the comment #6 in the bug fdo#65132.

This reverts commit 5e2d59e4b910631c802d5c7c42b7411e5a8b8db6.

diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx 
b/vcl/generic/glyphs/gcach_ftyp.cxx
index e34b38d..162ba11 100644
--- a/vcl/generic/glyphs/gcach_ftyp.cxx
+++ b/vcl/generic/glyphs/gcach_ftyp.cxx
@@ -940,6 +940,7 @@ void ServerFont::FetchFontMetric( ImplFontMetricData rTo, 
long rFactor ) const
 rTo.mnDescent = 0;
 rTo.mnExtLeading = 0;
 rTo.mnSlant = 0;
+rTo.mnIntLeading = (rTo.mnAscent + rTo.mnDescent) - 
((maFaceFT-units_per_EM + 32)  6);
 rTo.mnWidth = mnWidth;
 
 // Calculating ascender and descender:
@@ -993,8 +994,6 @@ void ServerFont::FetchFontMetric( ImplFontMetricData rTo, 
long rFactor ) const
 }
 }
 
-rTo.mnIntLeading = (rTo.mnAscent + rTo.mnDescent) - 
((maFaceFT-units_per_EM + 32)  6);
-
 if( pOS2  (pOS2-version != 0x) )
 {
 // map the panose info from the OS2 table to their VCL counterparts
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/generic

2013-05-25 Thread Khaled Hosny
 vcl/generic/glyphs/gcach_ftyp.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 5e2d59e4b910631c802d5c7c42b7411e5a8b8db6
Author: Khaled Hosny khaledho...@eglug.org
Date:   Sat May 25 13:14:59 2013 +0200

Fix fdo#64972 - strikethrough displays too high

I was calculating the leading before setting the ascent and descent,
oops.

Change-Id: Ic58ecb1a65cb33715ea06f5e3214c4acbcff1e40

diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx 
b/vcl/generic/glyphs/gcach_ftyp.cxx
index 162ba11..e34b38d 100644
--- a/vcl/generic/glyphs/gcach_ftyp.cxx
+++ b/vcl/generic/glyphs/gcach_ftyp.cxx
@@ -940,7 +940,6 @@ void ServerFont::FetchFontMetric( ImplFontMetricData rTo, 
long rFactor ) const
 rTo.mnDescent = 0;
 rTo.mnExtLeading = 0;
 rTo.mnSlant = 0;
-rTo.mnIntLeading = (rTo.mnAscent + rTo.mnDescent) - 
((maFaceFT-units_per_EM + 32)  6);
 rTo.mnWidth = mnWidth;
 
 // Calculating ascender and descender:
@@ -994,6 +993,8 @@ void ServerFont::FetchFontMetric( ImplFontMetricData rTo, 
long rFactor ) const
 }
 }
 
+rTo.mnIntLeading = (rTo.mnAscent + rTo.mnDescent) - 
((maFaceFT-units_per_EM + 32)  6);
+
 if( pOS2  (pOS2-version != 0x) )
 {
 // map the panose info from the OS2 table to their VCL counterparts
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/generic vcl/inc vcl/source

2013-05-23 Thread Khaled Hosny
 vcl/generic/glyphs/gcach_layout.cxx |   96 
 vcl/inc/generic/glyphcache.hxx  |1 
 vcl/source/gdi/sallayout.cxx|4 -
 3 files changed, 2 insertions(+), 99 deletions(-)

New commits:
commit 6a46cd31a44bd52fb9838a0d1937255a120a49ff
Author: Khaled Hosny khaledho...@eglug.org
Date:   Thu May 23 09:34:27 2013 +0200

Fix left to right full justification

I was overloading ApplyDXArray() with a HarfBuzz specific implementation
because the GenericSalLayout one was screwing right to left kerning, but
it seems to have broken left to right full justifications. Since
mnXOffset was introduced a bit earlier to fix a similar issue, it can
now be used here as well to minimize the possible side effects.

Seems to work fine for both left to right and right to left text now,
but at least one of my Arabic tests is regressing, so might need some
tweaking.

Change-Id: I1239b0ec77a4978f981a480400a6d01cda18af79

diff --git a/vcl/generic/glyphs/gcach_layout.cxx 
b/vcl/generic/glyphs/gcach_layout.cxx
index 07f9f76..6ac7fd4 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -90,102 +90,6 @@ void ServerFontLayout::AdjustLayout( ImplLayoutArgs rArgs )
 }
 }
 
-// apply adjustments to glyph advances, e.g. as a result of justification.
-void ServerFontLayout::ApplyDXArray(ImplLayoutArgs rArgs)
-{
-if (bUseHarfBuzz)
-{
-if (m_GlyphItems.empty())
-return;
-
-// determine cluster boundaries and x base offset
-const int nCharCount = rArgs.mnEndCharPos - rArgs.mnMinCharPos;
-int* pLogCluster = (int*)alloca(nCharCount * sizeof(int));
-size_t i;
-int n,p;
-long nBasePointX = -1;
-if (mnLayoutFlags  SAL_LAYOUT_FOR_FALLBACK)
-nBasePointX = 0;
-for (p = 0; p  nCharCount; ++p)
-pLogCluster[p] = -1;
-
-for (i = 0; i  m_GlyphItems.size(); ++i)
-{
-n = m_GlyphItems[i].mnCharPos - rArgs.mnMinCharPos;
-if ((n  0) || (nCharCount = n))
-continue;
-if (pLogCluster[n]  0)
-pLogCluster[n] = i;
-if (nBasePointX  0)
-nBasePointX = m_GlyphItems[i].maLinearPos.X();
-}
-// retarget unresolved pLogCluster[n] to a glyph inside the cluster
-// TODO: better do it while the deleted-glyph markers are still there
-for (n = 0; n  nCharCount; ++n)
-if ((p = pLogCluster[0]) = 0)
-break;
-if (n = nCharCount)
-return;
-for (n = 0; n  nCharCount; ++n)
-{
-if (pLogCluster[n]  0)
-pLogCluster[n] = p;
-else
-p = pLogCluster[n];
-}
-
-// calculate adjusted cluster widths
-sal_Int32* pNewGlyphWidths = (sal_Int32*)alloca(m_GlyphItems.size() * 
sizeof(sal_Int32));
-for (i = 0; i  m_GlyphItems.size(); ++i)
-pNewGlyphWidths[i] = 0;
-
-bool bRTL;
-for (int nCharPos = p = -1; rArgs.GetNextPos(nCharPos, bRTL); )
-{
-n = nCharPos - rArgs.mnMinCharPos;
-if ((n  0) || (nCharCount = n))  continue;
-
-if (pLogCluster[n] = 0)
-p = pLogCluster[n];
-if (p = 0)
-{
-long nDelta = rArgs.mpDXArray[n];
-if(n  0)
-nDelta -= rArgs.mpDXArray[n - 1];
-pNewGlyphWidths[p] += nDelta * mnUnitsPerPixel;
-}
-}
-
-// move cluster positions using the adjusted widths
-long nDelta = 0;
-for (i = 0; i  m_GlyphItems.size(); ++i)
-{
-if (m_GlyphItems[i].IsClusterStart())
-{
-// calculate original and adjusted cluster width
-int nOldClusterWidth = m_GlyphItems[i].mnNewWidth;
-int nNewClusterWidth = pNewGlyphWidths[i];
-size_t j;
-for (j = i; ++j  m_GlyphItems.size(); )
-{
-if (m_GlyphItems[j].IsClusterStart())
-break;
-if (!m_GlyphItems[j].IsDiacritic()) // #i99367# ignore 
diacritics
-nOldClusterWidth += m_GlyphItems[j].mnNewWidth;
-nNewClusterWidth += pNewGlyphWidths[j];
-}
-nDelta += nNewClusterWidth - nOldClusterWidth;
-}
-m_GlyphItems[i].mnNewWidth = pNewGlyphWidths[i];
-m_GlyphItems[i].maLinearPos.X() += nDelta;
-}
-}
-else
-{
-GenericSalLayout::ApplyDXArray(rArgs);
-}
-}
-
 // ===
 
 static bool lcl_CharIsJoiner(sal_Unicode cChar)
diff --git a/vcl/inc/generic/glyphcache.hxx b/vcl/inc/generic/glyphcache.hxx
index e03e034..a7363f9 100644

[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/generic

2013-05-21 Thread Caolán McNamara
 vcl/generic/fontmanager/fontconfig.cxx |   14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

New commits:
commit f3db0733b5007ca64a6d755f603970edc5dfd5c4
Author: Caolán McNamara caol...@redhat.com
Date:   Mon May 20 20:37:27 2013 +0100

absoletely guarantee there is no mem leak

Change-Id: If6960dea479bb8970cb94aa05a3c9d44bf60cfc5
(cherry picked from commit 1704b1200d39eba8e235ca5c13c5a931d07a98b3)

diff --git a/vcl/generic/fontmanager/fontconfig.cxx 
b/vcl/generic/fontmanager/fontconfig.cxx
index 3e23fc9..1b36980 100644
--- a/vcl/generic/fontmanager/fontconfig.cxx
+++ b/vcl/generic/fontmanager/fontconfig.cxx
@@ -806,20 +806,18 @@ namespace
 OString mapToFontConfigLangTag(const LanguageTag rLangTag)
 {
 #if defined(FC_VERSION)  (FC_VERSION = 20492)
-FcStrSet *pLangSet = FcGetLangs();
+boost::shared_ptrFcStrSet xLangSet(FcGetLangs(), FcStrSetDestroy);
 OString sLangAttrib;
 
 sLangAttrib = OUStringToOString(rLangTag.getBcp47(), 
RTL_TEXTENCODING_UTF8).toAsciiLowerCase();
-if (FcStrSetMember(pLangSet, (const FcChar8*)sLangAttrib.getStr()))
+if (FcStrSetMember(xLangSet.get(), (const 
FcChar8*)sLangAttrib.getStr()))
 {
-FcStrSetDestroy(pLangSet);
 return sLangAttrib;
 }
 
 sLangAttrib = OUStringToOString(rLangTag.getLanguageAndScript(), 
RTL_TEXTENCODING_UTF8).toAsciiLowerCase();
-if (FcStrSetMember(pLangSet, (const FcChar8*)sLangAttrib.getStr()))
+if (FcStrSetMember(xLangSet.get(), (const 
FcChar8*)sLangAttrib.getStr()))
 {
-FcStrSetDestroy(pLangSet);
 return sLangAttrib;
 }
 
@@ -829,16 +827,14 @@ namespace
 if (!sRegion.isEmpty())
 {
 sLangAttrib = sLang + OString('-') + sRegion;
-if (FcStrSetMember(pLangSet, (const FcChar8*)sLangAttrib.getStr()))
+if (FcStrSetMember(xLangSet.get(), (const 
FcChar8*)sLangAttrib.getStr()))
 {
-FcStrSetDestroy(pLangSet);
 return sLangAttrib;
 }
 }
 
-if (FcStrSetMember(pLangSet, (const FcChar8*)sLang.getStr()))
+if (FcStrSetMember(xLangSet.get(), (const FcChar8*)sLang.getStr()))
 {
-FcStrSetDestroy(pLangSet);
 return sLang;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits