summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2009-12-04 19:02:03 +0100
committerKurt Zenker <kz@openoffice.org>2009-12-04 19:02:03 +0100
commit2f883652c1af80075dc68b5cb439a13cd1dc4129 (patch)
treeeb108a2051ca12b6add6df0fd2d42322a94f0668
parentf68e347d71e1faae580192f3c24128463b1b0489 (diff)
parent9d63153784cc630907fa0e4347e4cb922f0eb74d (diff)
CWS-TOOLING: integrate CWS ooo32gsl07_DEV300
-rwxr-xr-xvcl/aqua/source/gdi/salatslayout.cxx30
-rw-r--r--vcl/aqua/source/gdi/salgdi.cxx10
2 files changed, 36 insertions, 4 deletions
diff --git a/vcl/aqua/source/gdi/salatslayout.cxx b/vcl/aqua/source/gdi/salatslayout.cxx
index 3021e85fed5c..1387a46c6345 100755
--- a/vcl/aqua/source/gdi/salatslayout.cxx
+++ b/vcl/aqua/source/gdi/salatslayout.cxx
@@ -70,12 +70,13 @@ private:
// to prevent ATS overflowing the Fixed16.16 values
// ATS font requests get size limited by downscaling huge fonts
// in these cases the font scale becomes something bigger than 1.0
- float mfFontScale;
+ float mfFontScale;
private:
bool InitGIA( ImplLayoutArgs* pArgs = NULL ) const;
bool GetIdealX() const;
bool GetDeltaY() const;
+ void InvalidateMeasurements();
int Fixed2Vcl( Fixed ) const; // convert ATSU-Fixed units to VCL units
int AtsuPix2Vcl( int ) const; // convert ATSU-Pixel units to VCL units
@@ -310,7 +311,7 @@ void ATSLayout::AdjustLayout( ImplLayoutArgs& rArgs )
mnTrailingSpaceWidth = rArgs.mpDXArray[ mnCharCount-1 ];
if( i > 0 )
mnTrailingSpaceWidth -= rArgs.mpDXArray[ i-1 ];
- InitGIA(); // ensure valid mpCharWidths[]
+ InitGIA(); // ensure valid mpCharWidths[], TODO: use GetIdealX() instead?
mnTrailingSpaceWidth -= Fixed2Vcl( mpCharWidths[i] );
// ignore trailing space for calculating the available width
nOrigWidth -= mnTrailingSpaceWidth;
@@ -324,11 +325,15 @@ void ATSLayout::AdjustLayout( ImplLayoutArgs& rArgs )
if( !nPixelWidth )
return;
- // HACK: justification requests which change the width by just one pixel are probably
+ // HACK: justification requests which change the width by just one pixel were probably
// #i86038# introduced by lossy conversions between integer based coordinate system
+ // => ignoring such requests has many more benefits than eventual drawbacks
if( (nOrigWidth >= nPixelWidth-1) && (nOrigWidth <= nPixelWidth+1) )
return;
+ // changing the layout will make all previous measurements invalid
+ InvalidateMeasurements();
+
ATSUAttributeTag nTags[3];
ATSUAttributeValuePtr nVals[3];
ByteCount nBytes[3];
@@ -352,7 +357,7 @@ void ATSLayout::AdjustLayout( ImplLayoutArgs& rArgs )
if( eStatus != noErr )
return;
- // check result of the justied layout
+ // update the measurements of the justified layout to match the justification request
if( rArgs.mpDXArray )
InitGIA( &rArgs );
}
@@ -1069,6 +1074,23 @@ bool ATSLayout::GetDeltaY() const
return true;
}
+// -----------------------------------------------------------------------
+
+#define DELETEAZ( X ) { delete[] X; X = NULL; }
+
+void ATSLayout::InvalidateMeasurements()
+{
+ mnGlyphCount = -1;
+ DELETEAZ( mpGlyphIds );
+ DELETEAZ( mpCharWidths );
+ DELETEAZ( mpChars2Glyphs );
+ DELETEAZ( mpGlyphs2Chars );
+ DELETEAZ( mpGlyphRTLFlags );
+ DELETEAZ( mpGlyphAdvances );
+ DELETEAZ( mpGlyphOrigAdvs );
+ DELETEAZ( mpDeltaY );
+}
+
// =======================================================================
#if 0
diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx
index eb6434100208..1c9bdda3fbdb 100644
--- a/vcl/aqua/source/gdi/salgdi.cxx
+++ b/vcl/aqua/source/gdi/salgdi.cxx
@@ -404,6 +404,16 @@ void AquaSalGraphics::initResolution( NSWindow* pWin )
DBG_ERROR( "no screen found" );
}
+ // #i107076# maintaining size-WYSIWYG-ness causes many problems for
+ // low-DPI, high-DPI or for mis-reporting devices
+ // => it is better to limit the calculation result then
+ static const int nMinDPI = 72;
+ if( (mnRealDPIX < nMinDPI) || (mnRealDPIY < nMinDPI) )
+ mnRealDPIX = mnRealDPIY = nMinDPI;
+ static const int nMaxDPI = 200;
+ if( (mnRealDPIX > nMaxDPI) || (mnRealDPIY > nMaxDPI) )
+ mnRealDPIX = mnRealDPIY = nMaxDPI;
+
// for OSX any anisotropy reported for the display resolution is best ignored (e.g. TripleHead2Go)
mnRealDPIX = mnRealDPIY = (mnRealDPIX + mnRealDPIY + 1) / 2;