[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - vcl/quartz

2014-05-23 Thread Norbert Thiebaud
 vcl/quartz/ctlayout.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 606d51a5496f4aaeb6d955d07204db0d775def61
Author: Norbert Thiebaud 
Date:   Wed May 21 23:40:50 2014 -0500

fdo#77993 actually impact 10.6 too apparently

Change-Id: I4b3724159be64609f1e88b63ccd9275d164fcb3e
Reviewed-on: https://gerrit.libreoffice.org/9427
Tested-by: Norbert Thiebaud 
Reviewed-by: Norbert Thiebaud 

diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx
index 0b29673..0c317c4 100644
--- a/vcl/quartz/ctlayout.cxx
+++ b/vcl/quartz/ctlayout.cxx
@@ -172,7 +172,7 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs )
 // - CoreText handles spaces specially (in particular at the text end)
 if( mnTrailingSpaceCount )
 {
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1060
 // don't recreate line layout here, because this can lead to problems
 // (looks like internal issues inside early CoreText versions)
 mfTrailingSpaceWidth = CTLineGetTrailingWhitespaceWidth( mpCTLine );
@@ -218,7 +218,7 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs )
 }
 }
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1060
 CTLineRef pNewCTLine = CTLineCreateJustifiedLine( mpCTLine, 1.0, 
nPixelWidth - mfTrailingSpaceWidth );
 #else
 CTLineRef pNewCTLine = CTLineCreateJustifiedLine( mpCTLine, 1.0, 
nPixelWidth);
@@ -235,7 +235,7 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs )
 }
 CFRelease( mpCTLine );
 mpCTLine = pNewCTLine;
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1060
 mfCachedWidth = nPixelWidth;
 #else
 mfCachedWidth = nPixelWidth + mfTrailingSpaceWidth;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - vcl/quartz

2014-06-16 Thread Douglas Mencken
 vcl/quartz/ctfonts.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 48db1512eb7c6eac7e0fb5445bd81b5a491c984d
Author: Douglas Mencken 
Date:   Thu Jun 12 14:38:10 2014 -0400

workaround for kCTForegroundColorFromContextAttributeName unavailability

fixes "error: ‘kCTForegroundColorFromContextAttributeName’ was not 
declared in this scope"

see commits:
  5bc5387669bca8a0b410e295b0992fd2424a1536

Change-Id: Ifdf69ab2f9a6437d18a6d3e3f5d756beeed3ba5c
Reviewed-on: https://gerrit.libreoffice.org/9758
Reviewed-by: Noel Grandin 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit 4af1b789545bc3815f79fafed5b1806b3c08b69d)

diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index d2e3d32..38cf249 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -27,6 +27,10 @@
 #ifdef MACOSX
 #include "osx/salinst.h"
 #include "osx/saldata.hxx"
+// kCTForegroundColorFromContextAttributeName is available on 10.5, but it is 
"hidden"
+#ifndef kCTForegroundColorFromContextAttributeName
+extern const CFStringRef kCTForegroundColorFromContextAttributeName;
+#endif
 #endif
 #include "quartz/salgdi.h"
 #include "quartz/utils.h"
@@ -103,7 +107,6 @@ CoreTextStyle::CoreTextStyle( const FontSelectPattern& rFSD 
)
 // allow delayed setting the font color, i.e. after the text layout
 CFDictionarySetValue( mpStyleDict, 
kCTForegroundColorFromContextAttributeName, kCFBooleanTrue );
 
-
 #if 0 // LastResort is implicit in CoreText's font cascading
 const void* aGFBDescriptors[] = { CTFontDescriptorCreateWithNameAndSize( 
CFSTR("LastResort"), 0) }; // TODO: use the full GFB list
 const int nGfbCount = sizeof(aGFBDescriptors) / sizeof(*aGFBDescriptors);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - vcl/quartz

2014-06-17 Thread Herbert Dürr
 vcl/quartz/ctlayout.cxx |   15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

New commits:
commit af9203676b014509c04c0495d2189e04b633f6b9
Author: Herbert Dürr 
Date:   Mon Jun 2 11:30:49 2014 +

Related: #i125020# fix the calculation of the text-update rectangle...

in CoreText

by doing the calculation before CTLineDraw() updates the text position.
Requesting the update early is possible because that update region is
not used until AquaSalInstance::Yield().
(cherry picked from commit ee042661b996fd00d5504caf4f4be60f77bf880f)

Conflicts:
vcl/aqua/source/gdi/ctlayout.cxx

(cherry picked from commit d2bbef3d3d6c7be096175ddbdb788ece5067f5fc)

Conflicts:
vcl/quartz/ctlayout.cxx

Change-Id: I317a2068071a2f6d33f34c81e104e30beedc33db
Reviewed-on: https://gerrit.libreoffice.org/9628
Tested-by: Christian Lohmaier 
Reviewed-by: Christian Lohmaier 

diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx
index a39f00e..1d96f90 100644
--- a/vcl/quartz/ctlayout.cxx
+++ b/vcl/quartz/ctlayout.cxx
@@ -344,13 +344,8 @@ void CTLayout::drawCTLine(AquaSalGraphics& rAquaGraphics, 
CTLineRef ctline, cons
 
 CGContextSetTextPosition( rAquaGraphics.mrContext, aTextPos.x, aTextPos.y 
);
 
-// set the text color as fill color (see 
kCTForegroundColorFromContextAttributeName)
-CGContextSetFillColor( rAquaGraphics.mrContext, 
rAquaGraphics.maTextColor.AsArray() );
-
-// draw the text
-CTLineDraw( ctline, rAquaGraphics.mrContext );
 #ifndef IOS
-// request an update of the changed window area
+// request an update of the to-be-changed window area
 if( rAquaGraphics.IsWindowGraphics() )
 {
 const CGRect aInkRect = CTLineGetImageBounds( mpCTLine, 
rAquaGraphics.mrContext );
@@ -358,6 +353,14 @@ void CTLayout::drawCTLine(AquaSalGraphics& rAquaGraphics, 
CTLineRef ctline, cons
 rAquaGraphics.RefreshRect( aRefreshRect );
 }
 #endif
+
+// set the text color as fill color (see 
kCTForegroundColorFromContextAttributeName)
+CGContextSetFillColor( rAquaGraphics.mrContext, 
rAquaGraphics.maTextColor.AsArray() );
+
+SAL_INFO( "vcl.ct", "CTLineDraw(" << ctline << "," << 
rAquaGraphics.mrContext << ")" );
+// draw the text
+CTLineDraw( ctline, rAquaGraphics.mrContext );
+
 // restore the original graphic context transformations
 CGContextRestoreGState( rAquaGraphics.mrContext );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - vcl/quartz

2014-06-17 Thread Herbert Dürr
 vcl/quartz/salgdiutils.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit c26817f9d576893e4b45b3432837b4f1c949098c
Author: Herbert Dürr 
Date:   Mon Jun 2 11:47:23 2014 +

Resolves: #i125020# fix rounding error in AquaSalGraphics::RefreshRect()

Rounding left and width down can accumulate a rounding error of almost two 
in
the calculation of right. The existing code compensates for this by 
increasing
the width by two, but since left has been decremented by one to accommodate 
for
antialiasing artifacts this compensation is one to few by itself and two to 
few
when accounting for antialiasing artifacts on the right. Y-pos and height 
have
the same problems and get the matching fix.

(cherry picked from commit 073ec69fb970830d39c8700317ee74dbbdfd1fda)
(cherry picked from commit ee9dd6c086f7bda615d5b28d3319a83ce1673607)

Change-Id: Ia394859035d59c76c67b6b0d53ddc6cf88582bfe
Reviewed-on: https://gerrit.libreoffice.org/9626
Tested-by: Christian Lohmaier 
Reviewed-by: Christian Lohmaier 

diff --git a/vcl/quartz/salgdiutils.cxx b/vcl/quartz/salgdiutils.cxx
index c251203..704fef5 100644
--- a/vcl/quartz/salgdiutils.cxx
+++ b/vcl/quartz/salgdiutils.cxx
@@ -182,10 +182,13 @@ void AquaSalGraphics::RefreshRect(float lX, float lY, 
float lWidth, float lHeigh
 {
 // update a little more around the designated rectangle
 // this helps with antialiased rendering
+// Rounding down x and width can accumulate a rounding error of up to 2
+// The decrementing of x, the rounding error and the antialiasing 
border
+// require that the width and the height need to be increased by four
 const Rectangle aVclRect(Point(static_cast(lX-1),
 static_cast(lY-1) ),
- Size(  static_cast(lWidth+2),
-static_cast(lHeight+2) ) );
+ Size(  static_cast(lWidth+4),
+static_cast(lHeight+4) ) );
 mpFrame->maInvalidRect.Union( aVclRect );
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - vcl/quartz

2014-07-01 Thread Herbert Dürr
 vcl/quartz/ctlayout.cxx |   35 +++
 1 file changed, 27 insertions(+), 8 deletions(-)

New commits:
commit 4adebd56d21cf104dca28a62c7015466a7a0c357
Author: Herbert Dürr 
Date:   Tue May 20 12:00:50 2014 +

Resolves: #i124935# fix expanded/condensed text breaking...

in the CoreText engine

the concept of an extra-width per code-unit was obsolete at least since apps
supported unicode with its different normalization forms, diacritical marks,
surrogate-pairs, non-printing characters such as ZWJ/ZWNJ/RLM, etc.  so of
course modern engines like CoreText don't aid this typographical crime.

The fix here extends the CTLayout::GetTextBreak() method to handle the 
obsolete
semantic of per code-unit extra-widths by successively approximating the 
number
of involved code-units.
(cherry picked from commit a9b9ceff86f35be1eeff5f251d24e338db760a1e)

Conflicts:
vcl/aqua/source/gdi/ctlayout.cxx

Change-Id: I52a7f7488a9e8a303ed7271df2a24a3c85098ce3
(cherry picked from commit 687f0c9300d499b78deea2890b4c2019adb2d67d)
Reviewed-on: https://gerrit.libreoffice.org/9627
Reviewed-by: Christian Lohmaier 
Tested-by: Christian Lohmaier 

diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx
index 1d96f90..f0cdc8a 100644
--- a/vcl/quartz/ctlayout.cxx
+++ b/vcl/quartz/ctlayout.cxx
@@ -569,20 +569,39 @@ long CTLayout::FillDXArray( sal_Int32* pDXArray ) const
 return nPixWidth;
 }
 
-sal_Int32 CTLayout::GetTextBreak( long nMaxWidth, long /*nCharExtra*/, int 
nFactor ) const
+sal_Int32 CTLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor 
) const
 {
 if( !mpCTLine )
 return -1;
 
 CTTypesetterRef aCTTypeSetter = CTTypesetterCreateWithAttributedString( 
mpAttrString );
-const double fCTMaxWidth = (double)nMaxWidth / nFactor;
-CFIndex nIndex = CTTypesetterSuggestClusterBreak( aCTTypeSetter, 0, 
fCTMaxWidth );
-CFRelease( aCTTypeSetter );
-
-if( nIndex >= mnCharCount )
-return -1;
+CFIndex nBestGuess = (nCharExtra >= 0) ? 0 : mnCharCount;
+for( int i = 1; i <= mnCharCount; i *= 2 )
+{
+// guess the target width considering char-extra expansion/condensation
+const double nTargetWidth = nMaxWidth - nBestGuess * nCharExtra;
+const double fCTMaxWidth = nTargetWidth / nFactor;
+// calculate the breaking index for the guessed target width
+const CFIndex nNewIndex = CTTypesetterSuggestClusterBreak( 
aCTTypeSetter, 0, fCTMaxWidth );
+if( nNewIndex >= mnCharCount ) {
+CFRelease( aCTTypeSetter );
+return -1;
+}
+// check if the original extra-width guess was good
+if( !nCharExtra )
+nBestGuess = nNewIndex;
+if( nBestGuess == nNewIndex )
+break;
+// prepare another round for a different number of characters
+CFIndex nNewGuess = (nNewIndex + nBestGuess + 1) / 2;
+if( nNewGuess == nBestGuess )
+nNewGuess += (nNewIndex > nBestGuess) ? +1 : -1;
+nBestGuess = nNewGuess;
+}
 
-nIndex += mnMinCharPos;
+// suggest the best fitting cluster break as breaking position
+CFRelease( aCTTypeSetter );
+const int nIndex = nBestGuess + mnMinCharPos;
 return nIndex;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits