[Libreoffice-commits] core.git: 8 commits - vcl/coretext vcl/inc vcl/quartz
Tor Lillqvist
tml at iki.fi
Sun Apr 7 16:32:35 PDT 2013
vcl/coretext/salcoretextfontutils.cxx | 16 +
vcl/coretext/salcoretextlayout.cxx | 287 +++++++++++++++++++---------------
vcl/coretext/salcoretextstyle.cxx | 22 +-
vcl/inc/coretext/common.h | 9 -
vcl/inc/coretext/salcoretextstyle.hxx | 7
vcl/inc/quartz/utils.h | 3
vcl/quartz/utils.cxx | 38 ++++
7 files changed, 247 insertions(+), 135 deletions(-)
New commits:
commit 764e8a05ca5fb2f1335c5b5e96142f651de8c640
Author: Tor Lillqvist <tml at iki.fi>
Date: Mon Apr 8 02:12:41 2013 +0300
Refactoring, no change in end result
Change-Id: I18cb4e00b86e25f299b897a1a71c1d7d68d8309d
diff --git a/vcl/coretext/salcoretextlayout.cxx b/vcl/coretext/salcoretextlayout.cxx
index 1de073f..4765076 100644
--- a/vcl/coretext/salcoretextlayout.cxx
+++ b/vcl/coretext/salcoretextlayout.cxx
@@ -53,8 +53,16 @@ public:
virtual void Simplify( bool bIsBase );
private:
+ void GetMeasurements();
void InvalidateMeasurements();
- bool InitGIA( ImplLayoutArgs &rArgs ) const;
+ void ApplyDXArray( ImplLayoutArgs& );
+ void Justify( long );
+
+#ifndef NDEBUG
+ int mnSavedMinCharPos;
+ int mnSavedEndCharPos;
+ sal_Unicode *mpSavedStr;
+#endif
QuartzSalGraphics* mpGraphics;
CoreTextStyleInfo* mpStyle;
@@ -88,6 +96,9 @@ private:
};
CoreTextLayout::CoreTextLayout(QuartzSalGraphics* graphics, CoreTextStyleInfo* style) :
+#ifndef NDEBUG
+ mpSavedStr(NULL),
+#endif
mpGraphics(graphics),
mpStyle(style),
mnCharCount(-1),
@@ -112,6 +123,11 @@ CoreTextLayout::CoreTextLayout(QuartzSalGraphics* graphics, CoreTextStyleInfo* s
CoreTextLayout::~CoreTextLayout()
{
InvalidateMeasurements();
+ SafeCFRelease(mpTypesetter);
+ SafeCFRelease(mpLine);
+#ifndef NDEBUG
+ delete[] mpSavedStr;
+#endif
SAL_INFO( "vcl.coretext.layout", "~CoreTextLayout(" << this << ")" );
}
@@ -119,16 +135,45 @@ void CoreTextLayout::AdjustLayout( ImplLayoutArgs& rArgs )
{
SAL_INFO( "vcl.coretext.layout", "AdjustLayout(" << this << ",rArgs=" << rArgs << ")" );
- InvalidateMeasurements();
+#ifndef NDEBUG
+ assert( mnSavedMinCharPos == rArgs.mnMinCharPos );
+ assert( mnSavedEndCharPos == rArgs.mnEndCharPos );
+ assert( memcmp( &mpSavedStr[mnSavedMinCharPos],
+ &rArgs.mpStr[mnSavedMinCharPos],
+ (mnSavedEndCharPos - mnSavedMinCharPos) * sizeof( sal_Unicode ) ) == 0 );
+#endif
+
SalLayout::AdjustLayout( rArgs );
- mnCharCount = mnEndCharPos - mnMinCharPos;
- InitGIA( rArgs );
+
+ // adjust positions if requested
+ if( rArgs.mpDXArray )
+ ApplyDXArray( rArgs );
+ else if( rArgs.mnLayoutWidth )
+ Justify( rArgs.mnLayoutWidth );
+ else
+ return;
}
-void CoreTextLayout::InvalidateMeasurements()
+void CoreTextLayout::ApplyDXArray( ImplLayoutArgs& rArgs )
+{
+ Justify( rArgs.mpDXArray[mnCharCount-1] );
+}
+
+void CoreTextLayout::Justify( long nNewWidth )
{
- SAL_INFO( "vcl.coretext.layout", "InvalidateMeasurements(" << this << ")" );
+ CTLineRef justifiedLine = CTLineCreateJustifiedLine( mpLine, 1.0, nNewWidth );
+ if ( !justifiedLine ) {
+ SAL_INFO( "vcl.coretext.layout", "ApplyDXArray(): CTLineCreateJustifiedLine() failed" );
+ } else {
+ CFRelease( mpLine );
+ mpLine = justifiedLine;
+ }
+
+ GetMeasurements();
+}
+void CoreTextLayout::InvalidateMeasurements()
+{
if( mpGlyphs ) {
delete[] mpGlyphs;
mpGlyphs = NULL;
@@ -149,8 +194,6 @@ void CoreTextLayout::InvalidateMeasurements()
delete[] mpGlyphPositions;
mpGlyphPositions = NULL;
}
- SafeCFRelease(mpTypesetter);
- SafeCFRelease(mpLine);
mbHasBoundRectangle = false;
}
@@ -227,25 +270,22 @@ void CoreTextLayout::DropGlyph( int /*nStart*/ )
long CoreTextLayout::FillDXArray( sal_Int32* pDXArray ) const
{
- SAL_INFO( "vcl.coretext.layout", "FillDXArray(" << this << ")" );
-
- // short circuit requests which don't need full details
+ // Short circuit requests which don't need full details
if( !pDXArray ) {
- SAL_INFO( "vcl.coretext.layout", "FillDXArray() returning GetTextWidth()" );
return GetTextWidth();
}
- // distribute the widths among the string elements
+ // Distribute the widths among the string elements
long width = 0;
float scale = mpStyle->GetFontStretchFactor();
- CGFloat accumulated_width = 0;
+ CGFloat accumulatedWidth = 0;
std::ostringstream DXArrayInfo;
for( int i = 0; i < mnCharCount; ++i ) {
- // convert and adjust for accumulated rounding errors
- accumulated_width += mpCharWidths[ i ];
+ // Convert and adjust for accumulated rounding errors
+ accumulatedWidth += mpCharWidths[ i ];
const long old_width = width;
- width = round_to_long( accumulated_width * scale );
+ width = round_to_long( accumulatedWidth * scale );
pDXArray[i] = width - old_width;
#ifdef SAL_LOG_INFO
if ( i < 7 )
@@ -255,7 +295,7 @@ long CoreTextLayout::FillDXArray( sal_Int32* pDXArray ) const
#endif
}
- SAL_INFO( "vcl.coretext.layout", "FillDXArray():" << DXArrayInfo.str() << ", result=" << width );
+ SAL_INFO( "vcl.coretext.layout", "FillDXArray(" << this << "):" << DXArrayInfo.str() << ", result=" << width );
return width;
}
@@ -454,19 +494,22 @@ void CoreTextLayout::InitFont() const
SAL_INFO( "vcl.coretext.layout", "InitFont(" << this << ")" );
}
-bool CoreTextLayout::InitGIA( ImplLayoutArgs& rArgs ) const
+bool CoreTextLayout::LayoutText( ImplLayoutArgs& rArgs)
{
- SAL_INFO( "vcl.coretext.layout", "InitGIA(" << this << "): " << mnCharCount << ":" << rArgs.mnMinCharPos << "--" << mnEndCharPos );
+ SAL_INFO( "vcl.coretext.layout", "LayoutText(" << this << ",rArgs=" << rArgs << ")" );
- if ( mnCharCount <= 0) {
- SAL_INFO( "vcl.coretext.layout", "InitGIA(): mnCharCount is non-positive, returning false" );
+ mnCharCount = rArgs.mnEndCharPos - rArgs.mnMinCharPos;
+
+ /* don't layout empty (or worse negative size) strings */
+ if(mnCharCount <= 0)
return false;
- }
- if ( mpGlyphs ) {
- SAL_INFO( "vcl.coretext.layout", "InitGIA(): mpGlyphs is non-NULL, returning true" );
- return true;
- }
+#ifndef NDEBUG
+ mnSavedMinCharPos = rArgs.mnMinCharPos;
+ mnSavedEndCharPos = rArgs.mnEndCharPos;
+ mpSavedStr = new sal_Unicode[mnCharCount];
+ memcpy( mpSavedStr, &rArgs.mpStr[mnSavedMinCharPos], mnCharCount * sizeof( sal_Unicode ) );
+#endif
// Note that unlike the ATSUI code, we store only the part of the
// buffer addressed by mnMinCharPos--mnEndCharPos. Not the whole
@@ -474,7 +517,7 @@ bool CoreTextLayout::InitGIA( ImplLayoutArgs& rArgs ) const
// mpTypesetter should be relative to mnMinCharPos.
CFStringRef string = CFStringCreateWithCharacters( NULL, &(rArgs.mpStr[rArgs.mnMinCharPos]), mnCharCount );
if ( !string ) {
- SAL_INFO( "vcl.coretext.layout", "InitGIA(): CFStringCreateWithCharacter() returned NULL, returning false" );
+ SAL_INFO( "vcl.coretext.layout", " CFStringCreateWithCharacter() returned NULL, returning false" );
return false;
}
@@ -495,36 +538,36 @@ bool CoreTextLayout::InitGIA( ImplLayoutArgs& rArgs ) const
CFRelease( string );
CFRelease( attributes );
if ( !attributed_string ) {
- SAL_INFO( "vcl.coretext.layout", "InitGIA(): CFAttributedStringCreate() returned NULL, returning false" );
+ SAL_INFO( "vcl.coretext.layout", " CFAttributedStringCreate() returned NULL, returning false" );
return false;
}
mpTypesetter = CTTypesetterCreateWithAttributedString( attributed_string );
CFRelease( attributed_string );
if ( !mpTypesetter ) {
- SAL_INFO( "vcl.coretext.layout", "InitGIA(): CTTypesetterCreateWithAttributedString() returned NULL, returning false" );
+ SAL_INFO( "vcl.coretext.layout", " CTTypesetterCreateWithAttributedString() returned NULL, returning false" );
return false;
}
mpLine = CTTypesetterCreateLine( mpTypesetter, CFRangeMake( 0, 0 ) );
if ( !mpLine ) {
- SAL_INFO( "vcl.coretext.layout", "InitGIA(): CTTypesetterCreateLine() returned NULL, returning false" );
+ SAL_INFO( "vcl.coretext.layout", " CTTypesetterCreateLine() returned NULL, returning false" );
return false;
}
- if ( rArgs.mpDXArray ) {
- CTLineRef justifiedLine = CTLineCreateJustifiedLine( mpLine, 1.0, rArgs.mpDXArray[mnCharCount-1] );
- if ( !justifiedLine ) {
- SAL_INFO( "vcl.coretext.layout", "InitGIA(): CTLineCreateJustifiedLine() failed" );
- } else {
- SAL_INFO( "vcl.coretext.layout", "InitGIA(): Created justified line" );
- CFRelease( mpLine );
- mpLine = justifiedLine;
- }
- }
-
mnGlyphCount = CTLineGetGlyphCount( mpLine );
+ GetMeasurements();
+
+ SAL_INFO( "vcl.coretext.layout", "LayoutText() returning, mnGlyphCount=" << mnGlyphCount );
+
+ return true;
+}
+
+void CoreTextLayout::GetMeasurements()
+{
+ InvalidateMeasurements();
+
mpGlyphs = new CGGlyph[ mnGlyphCount ];
mpCharWidths = new CGFloat[ mnCharCount ];
mpGlyphs2Chars = new int[ mnGlyphCount ];
@@ -603,29 +646,8 @@ bool CoreTextLayout::InitGIA( ImplLayoutArgs& rArgs ) const
}
SAL_INFO( "vcl.coretext.layout", " char widths:" << charWidthInfo.str() );
#endif
-
- SAL_INFO( "vcl.coretext.layout", "InitGIA() returning normally true" );
- return true;
}
-bool CoreTextLayout::LayoutText( ImplLayoutArgs& rArgs)
-{
- SAL_INFO( "vcl.coretext.layout", "LayoutText(" << this << ",rArgs=" << rArgs << ")" );
-
- mpStyle->SetColor();
-
- AdjustLayout( rArgs );
-
- /* don't layout empty (or worse negative size) strings */
- if(mnCharCount <= 0) {
- SAL_INFO( "vcl.coretext.layout", "LayoutText(): mnCharCount non-positive, returning false!" );
- return false;
- }
-
- SAL_INFO( "vcl.coretext.layout", "LayoutText() returning, mnGlyphCount=" << mnGlyphCount );
-
- return true;
-}
// not needed. CoreText manage fallback directly
void CoreTextLayout::MoveGlyph( int /*nStart*/, long /*nNewXPos*/ )
commit 070baa5d7036ee5d8a05d06444ce12a8dc3a0369
Author: Tor Lillqvist <tml at iki.fi>
Date: Mon Apr 8 00:52:32 2013 +0300
More hacking, still not working properly
There are still problems related to the handling of trailing spaces in
CTLines for instance.
Change-Id: If02fa5d711c2cde2d8aaf8f061f5d9f077d421f4
diff --git a/vcl/coretext/salcoretextlayout.cxx b/vcl/coretext/salcoretextlayout.cxx
index 64e0d89..1de073f 100644
--- a/vcl/coretext/salcoretextlayout.cxx
+++ b/vcl/coretext/salcoretextlayout.cxx
@@ -63,13 +63,13 @@ private:
// cached details about the resulting layout
// mutable members since these details are all lazy initialized
- mutable int mnGlyphCount; // glyph count
+ mutable int mnGlyphCount;
- mutable CGGlyph* mpGlyphs; // glyphs
- mutable int* mpCharWidths; // map relative charpos to charwidth
- mutable int* mpGlyphs2Chars; // map absolute glyphpos to absolute charpos
+ mutable CGGlyph* mpGlyphs;
+ mutable CGFloat* mpCharWidths;
+ mutable int* mpGlyphs2Chars;
- mutable CGSize* mpGlyphAdvances; // glyph advances for the justified layout
+ mutable CGSize* mpGlyphAdvances;
mutable CGPoint* mpGlyphPositions;
mutable CTTypesetterRef mpTypesetter;
@@ -106,7 +106,7 @@ CoreTextLayout::CoreTextLayout(QuartzSalGraphics* graphics, CoreTextStyleInfo* s
mnCurrentGlyphRunIndex(0),
mpRuns(NULL)
{
- SAL_INFO( "vcl.coretext.layout", "CoreTextLayout::CoreTextLayout() " << this );
+ SAL_INFO( "vcl.coretext.layout", "CoreTextLayout::CoreTextLayout() " << this << ", style=" << *style);
}
CoreTextLayout::~CoreTextLayout()
@@ -163,7 +163,7 @@ void CoreTextLayout::DrawText( SalGraphics& rGraphics ) const
return;
Point pos = GetDrawPosition(Point(0,0));
- SAL_INFO( "vcl.coretext.layout", "at pos (" << pos.X() << "," << pos.Y() <<") ctfont=" << mpStyle->GetFont() );
+ SAL_INFO( "vcl.coretext.layout", " at pos (" << pos.X() << "," << pos.Y() <<") ctfont=" << mpStyle->GetFont() );
CGFontRef cg_font = CTFontCopyGraphicsFont(mpStyle->GetFont(), NULL);
if( !cg_font ) {
@@ -221,6 +221,10 @@ void CoreTextLayout::DropGlyph( int /*nStart*/ )
{
}
+// Note that the "DX array" here is filled with individual character
+// widths, while ImplLayoutArgs::mpDXArray contains cumulative
+// character positions. Consistency is over-rated.
+
long CoreTextLayout::FillDXArray( sal_Int32* pDXArray ) const
{
SAL_INFO( "vcl.coretext.layout", "FillDXArray(" << this << ")" );
@@ -236,15 +240,22 @@ long CoreTextLayout::FillDXArray( sal_Int32* pDXArray ) const
float scale = mpStyle->GetFontStretchFactor();
CGFloat accumulated_width = 0;
+ std::ostringstream DXArrayInfo;
for( int i = 0; i < mnCharCount; ++i ) {
// convert and adjust for accumulated rounding errors
- accumulated_width += mpCharWidths[i];
+ accumulated_width += mpCharWidths[ i ];
const long old_width = width;
- width = round_to_long(accumulated_width * scale);
+ width = round_to_long( accumulated_width * scale );
pDXArray[i] = width - old_width;
+#ifdef SAL_LOG_INFO
+ if ( i < 7 )
+ DXArrayInfo << " " << pDXArray[i];
+ else if ( i == 7 )
+ DXArrayInfo << "...";
+#endif
}
- SAL_INFO( "vcl.coretext.layout", "FillDXArrar() returning " << width );
+ SAL_INFO( "vcl.coretext.layout", "FillDXArray():" << DXArrayInfo.str() << ", result=" << width );
return width;
}
@@ -447,12 +458,12 @@ bool CoreTextLayout::InitGIA( ImplLayoutArgs& rArgs ) const
{
SAL_INFO( "vcl.coretext.layout", "InitGIA(" << this << "): " << mnCharCount << ":" << rArgs.mnMinCharPos << "--" << mnEndCharPos );
- if( mnCharCount <= 0) {
+ if ( mnCharCount <= 0) {
SAL_INFO( "vcl.coretext.layout", "InitGIA(): mnCharCount is non-positive, returning false" );
return false;
}
- if( mpGlyphs ) {
+ if ( mpGlyphs ) {
SAL_INFO( "vcl.coretext.layout", "InitGIA(): mpGlyphs is non-NULL, returning true" );
return true;
}
@@ -490,13 +501,13 @@ bool CoreTextLayout::InitGIA( ImplLayoutArgs& rArgs ) const
mpTypesetter = CTTypesetterCreateWithAttributedString( attributed_string );
CFRelease( attributed_string );
- if( !mpTypesetter ) {
+ if ( !mpTypesetter ) {
SAL_INFO( "vcl.coretext.layout", "InitGIA(): CTTypesetterCreateWithAttributedString() returned NULL, returning false" );
return false;
}
mpLine = CTTypesetterCreateLine( mpTypesetter, CFRangeMake( 0, 0 ) );
- if( !mpLine ) {
+ if ( !mpLine ) {
SAL_INFO( "vcl.coretext.layout", "InitGIA(): CTTypesetterCreateLine() returned NULL, returning false" );
return false;
}
@@ -513,13 +524,9 @@ bool CoreTextLayout::InitGIA( ImplLayoutArgs& rArgs ) const
}
mnGlyphCount = CTLineGetGlyphCount( mpLine );
- SAL_INFO( "vcl.coretext.layout", "InitGIA(): CTLineGetGlyphCount() returned " << mnGlyphCount );
mpGlyphs = new CGGlyph[ mnGlyphCount ];
- mpCharWidths = new int[ mnCharCount ];
- for( int i = 0; i < mnCharCount; ++i) {
- mpCharWidths[i] = 0.0;
- }
+ mpCharWidths = new CGFloat[ mnCharCount ];
mpGlyphs2Chars = new int[ mnGlyphCount ];
mpGlyphAdvances = new CGSize[ mnGlyphCount ];
mpGlyphPositions = new CGPoint[ mnGlyphCount ];
@@ -527,56 +534,76 @@ bool CoreTextLayout::InitGIA( ImplLayoutArgs& rArgs ) const
CFArrayRef runs = CTLineGetGlyphRuns( mpLine );
CFIndex nb_runs = CFArrayGetCount( runs );
- int p = 0;
- for( CFIndex i = 0; i < nb_runs; ++i ) {
- CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex( runs, i );
- if( run ) {
- std::ostringstream glyph_info_line;
- CFIndex nb_glyphs = CTRunGetGlyphCount( run );
- if( nb_glyphs ) {
- CFRange text_range = CTRunGetStringRange( run );
- if( text_range.location != kCFNotFound && text_range.length > 0 ) {
- CFIndex indices[ nb_glyphs ];
- CGGlyph glyphs[ nb_glyphs ];
- CTRunGetStringIndices( run, CFRangeMake( 0, 0 ), indices );
- CTRunGetGlyphs( run, CFRangeMake( 0, 0 ), glyphs );
- CTRunGetPositions( run, CFRangeMake( 0, 0 ), &mpGlyphPositions[p] );
- bool is_vertical_run = false;
- CFDictionaryRef aDict = CTRunGetAttributes( run );
- if ( aDict ) {
- const CFBooleanRef aValue = (const CFBooleanRef)CFDictionaryGetValue( aDict, kCTVerticalFormsAttributeName );
- is_vertical_run = (aValue == kCFBooleanTrue) ? true : false;
- }
-
- for (CFIndex j = 0 ; j < nb_glyphs; ++p, ++j ) {
- assert ( p < mnGlyphCount );
- mpGlyphs[ p ] = glyphs[ j ];
+ CFIndex lineGlyphIx = 0;
+ for ( CFIndex runIx = 0; runIx < nb_runs; runIx++ )
+ {
+ CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex( runs, runIx );
+ if ( !run )
+ continue;
+
+ std::ostringstream glyphPositionInfo;
+ std::ostringstream glyphAdvancesInfo;
+ std::ostringstream charWidthInfo;
+
+ const CFIndex runGlyphCount = CTRunGetGlyphCount( run );
+ if ( runGlyphCount )
+ {
+ assert( lineGlyphIx + runGlyphCount <= mnGlyphCount );
+
+ const CFIndex lineRunGlyphStartIx = lineGlyphIx;
+
+ CFIndex runStringIndices[ runGlyphCount ];
+ CTRunGetStringIndices( run, CFRangeMake( 0, 0 ), runStringIndices );
+
+ CTRunGetGlyphs( run, CFRangeMake( 0, 0 ), &mpGlyphs[ lineGlyphIx ] );
+
+ CTRunGetPositions( run, CFRangeMake( 0, 0 ), &mpGlyphPositions[ lineGlyphIx ] );
+ CTRunGetAdvances( run, CFRangeMake( 0, 0 ), &mpGlyphAdvances[ lineGlyphIx ] );
+
+ bool isVerticalRun = false;
+ CFDictionaryRef aDict = CTRunGetAttributes( run );
+ if ( aDict ) {
+ const CFBooleanRef aValue = (const CFBooleanRef)CFDictionaryGetValue( aDict, kCTVerticalFormsAttributeName );
+ isVerticalRun = (aValue == kCFBooleanTrue);
+ }
+
+ for ( CFIndex runGlyphIx = 0 ; runGlyphIx < runGlyphCount; lineGlyphIx++, runGlyphIx++ )
+ {
+ const CFIndex charIx = runStringIndices[ runGlyphIx ];
+ assert( charIx < mnCharCount );
+ mpGlyphs2Chars[ lineGlyphIx ] = charIx;
+
+ mpCharWidths[ charIx ] = mpGlyphAdvances[ lineGlyphIx ].width;
+ }
#ifdef SAL_LOG_INFO
- if (j < 7)
- glyph_info_line << " " << glyphs[j] << "@(" << mpGlyphPositions[p].x << "," << mpGlyphPositions[p].y << ")";
- else if (j == 7)
- glyph_info_line << "...";
-#endif
- CFIndex k = indices[ j ];
- mpGlyphs2Chars[p] = k;
- assert( k < mnCharCount );
-
- if ( j < nb_glyphs - 1 )
- {
- mpCharWidths[ k ] += mpGlyphPositions[ p + 1 ].x - mpGlyphPositions[ p ].x;
- }
- if( p > 0)
- {
- mpGlyphAdvances[p - 1].width = mpGlyphPositions[ p ].x - mpGlyphPositions[p - 1].x;
- mpGlyphAdvances[p - 1].height = mpGlyphPositions[ p ].y - mpGlyphPositions[p - 1].y;
- }
- }
+ for ( int i = 0; i < runGlyphCount; i++ ) {
+ const int ix = lineRunGlyphStartIx + i;
+ if ( i < 7 ) {
+ glyphPositionInfo << " " << mpGlyphs[ ix ] << "@" << mpGlyphPositions[ ix ];
+ glyphAdvancesInfo << " " << mpGlyphAdvances[ ix ];
+ } else if (i == 7 ) {
+ glyphPositionInfo << "...";
+ glyphAdvancesInfo << "...";
}
- }
- SAL_INFO( "vcl.coretext.layout", " run " << run << " glyphs:" << glyph_info_line.str() );
+ }
+ SAL_INFO( "vcl.coretext.layout", " run " << runIx << ": " << runGlyphCount << " glyphs:" << glyphPositionInfo.str() );
+ SAL_INFO( "vcl.coretext.layout", " run " << runIx << ": advances:" << glyphAdvancesInfo.str() );
+#endif
}
}
+#ifdef SAL_LOG_INFO
+ std::ostringstream charWidthInfo;
+
+ for ( int ix = 0; ix < mnCharCount; ix++ ) {
+ if ( ix < 7 )
+ charWidthInfo << " " << mpCharWidths[ ix ];
+ else if ( ix == 7 )
+ charWidthInfo << "...";
+ }
+ SAL_INFO( "vcl.coretext.layout", " char widths:" << charWidthInfo.str() );
+#endif
+
SAL_INFO( "vcl.coretext.layout", "InitGIA() returning normally true" );
return true;
}
commit 1e9082ecf8c1f6ba757812cd8b6d14b24150a055
Author: Tor Lillqvist <tml at iki.fi>
Date: Mon Apr 8 00:49:46 2013 +0300
Bin some pointless SAL_INFOs
Change-Id: I5ef28eaac8eacd24f209617d68dfa23e0388bb1a
diff --git a/vcl/coretext/salcoretextstyle.cxx b/vcl/coretext/salcoretextstyle.cxx
index d01846a..a429738 100644
--- a/vcl/coretext/salcoretextstyle.cxx
+++ b/vcl/coretext/salcoretextstyle.cxx
@@ -37,7 +37,7 @@ CoreTextStyleInfo::CoreTextStyleInfo() :
CoreTextStyleInfo::~CoreTextStyleInfo()
{
- SAL_INFO( "vcl.coretext.style", "~CoreTextStyleInfo(" << this << "), font=" << m_CTFont );
+ SAL_INFO( "vcl.coretext.style", "~CoreTextStyleInfo(" << this << ")" );
SafeCFRelease(m_CTFont);
SafeCFRelease(m_CTParagraphStyle);
@@ -52,8 +52,6 @@ long CoreTextStyleInfo::GetFontStretchedSize() const
void CoreTextStyleInfo::SetFont(FontSelectPattern* requested_font)
{
- SAL_INFO( "vcl.coretext.style", "SetFont(" << this );
-
if(!requested_font)
{
SafeCFRelease(m_CTFont);
@@ -93,14 +91,10 @@ void CoreTextStyleInfo::SetFont(FontSelectPattern* requested_font)
/* FIXME: pass attribute to take into accout 'VerticalStyle' */
/* FIXME: how to deal with 'rendering options' i.e anti-aliasing, does it even matter in CoreText ? */
m_CTFont = CTFontCreateCopyWithAttributes(m_font_face->GetCTFont(), font_size, &m_matrix, NULL);
-
- SAL_INFO( "vcl.coretext.style", " font=" << m_CTFont );
}
void CoreTextStyleInfo::SetColor(SalColor color)
{
- SAL_INFO( "vcl.coretext.style", "SetColor(" << this << ",color={" << (int)SALCOLOR_RED(color) << "," << (int)SALCOLOR_GREEN(color) << "," << (int)SALCOLOR_BLUE(color) << "})" );
-
SafeCFRelease(m_color);
#ifdef IOS
// No CGColorCreateGenericRGB on iOS
@@ -115,8 +109,6 @@ void CoreTextStyleInfo::SetColor(SalColor color)
void CoreTextStyleInfo::SetColor(void)
{
- SAL_INFO( "vcl.coretext.style", "SetColor(" << this << ",none)" );
-
SafeCFRelease(m_color);
}
commit 924856e9133ff7df0e6dbad8aba2688adcbe54d9
Author: Tor Lillqvist <tml at iki.fi>
Date: Mon Apr 8 00:47:06 2013 +0300
Bin unused fields and an unimplemented method
Change-Id: Icf98fe5a41a53423f6e086e64e8e57f848b7e482
diff --git a/vcl/inc/coretext/salcoretextstyle.hxx b/vcl/inc/coretext/salcoretextstyle.hxx
index c2a0fae..84fd574 100644
--- a/vcl/inc/coretext/salcoretextstyle.hxx
+++ b/vcl/inc/coretext/salcoretextstyle.hxx
@@ -37,7 +37,6 @@ public:
long GetFontStretchedSize() const;
float GetFontStretchFactor() const { return m_stretch_factor; };
CTParagraphStyleRef GetParagraphStyle() const { return m_CTParagraphStyle; } ;
- CGSize GetSize() const;
CGColorRef GetColor() const { return m_color; } ;
void SetColor(SalColor color);
void SetColor(void);
@@ -48,8 +47,6 @@ private:
bool m_fake_italic;
CGAffineTransform m_matrix;
float m_stretch_factor;
- float m_font_scale;
- float m_fake_dpi_scale;
CTParagraphStyleRef m_CTParagraphStyle;
CTFontRef m_CTFont;
CGColorRef m_color;
commit 04bcd32641bdc961782b09db43ab35fefa70e8f8
Author: Tor Lillqvist <tml at iki.fi>
Date: Mon Apr 8 00:45:48 2013 +0300
Add SAL_INFO output operator for CoreTextStyleInfo
Change-Id: I83ffefff08fbda920d7394df336671861fcb18f7
diff --git a/vcl/coretext/salcoretextstyle.cxx b/vcl/coretext/salcoretextstyle.cxx
index 7ec73af..d01846a 100644
--- a/vcl/coretext/salcoretextstyle.cxx
+++ b/vcl/coretext/salcoretextstyle.cxx
@@ -120,4 +120,16 @@ void CoreTextStyleInfo::SetColor(void)
SafeCFRelease(m_color);
}
+std::ostream &operator <<(std::ostream& s, CoreTextStyleInfo &rStyle)
+{
+#ifndef SAL_LOG_INFO
+ (void) rStyle;
+#else
+ s << "{Font=" << rStyle.GetFont();
+ s << ",Color=" << rStyle.GetColor();
+ s << "}";
+#endif
+ return s;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/coretext/salcoretextstyle.hxx b/vcl/inc/coretext/salcoretextstyle.hxx
index f05d6d5..c2a0fae 100644
--- a/vcl/inc/coretext/salcoretextstyle.hxx
+++ b/vcl/inc/coretext/salcoretextstyle.hxx
@@ -20,6 +20,8 @@
#ifndef _VCL_CORETEXT_SALCORETEXTSTYLE_HXX
#define _VCL_CORETEXT_SALCORETEXTSTYLE_HXX
+#include <iostream>
+
#include "quartz/salgdicommon.hxx"
#include "coretext/salcoretextfontutils.hxx"
@@ -54,6 +56,8 @@ private:
CoreTextPhysicalFontFace* m_font_face;
};
+std::ostream &operator <<(std::ostream& s, CoreTextStyleInfo &rStyle);
+
#endif // _VCL_AQUA_CORETEXT_SALCORETEXTSTYLE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 0d6ed6ff7c7c6b3c85283396eb2e165446f4b95f
Author: Tor Lillqvist <tml at iki.fi>
Date: Mon Apr 8 00:41:02 2013 +0300
Add SAL_INFO output operator for CTFontRef
Change-Id: If878ae08131ab425ea958f54fc0bd5a07fc76881
diff --git a/vcl/coretext/salcoretextfontutils.cxx b/vcl/coretext/salcoretextfontutils.cxx
index 5b6b6c0..8e90557 100644
--- a/vcl/coretext/salcoretextfontutils.cxx
+++ b/vcl/coretext/salcoretextfontutils.cxx
@@ -608,4 +608,20 @@ bool CoreTextPhysicalFontFace::HasCJKSupport( void )
return m_bHasCJKSupport;
}
+std::ostream &operator <<(std::ostream& s, CTFontRef pFont)
+{
+#ifndef SAL_LOG_INFO
+ (void) pFont;
+#else
+ if (pFont) {
+ CFStringRef fontString = CTFontCopyFullName(pFont);
+ s << "{" << GetOUString(fontString) << "@" << CTFontGetSize(pFont) << "}";
+ CFRelease(fontString);
+ } else {
+ s << "NULL";
+ }
+#endif
+ return s;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/coretext/common.h b/vcl/inc/coretext/common.h
index f00ebf7..f26d48c 100644
--- a/vcl/inc/coretext/common.h
+++ b/vcl/inc/coretext/common.h
@@ -20,18 +20,19 @@
#ifndef _VCL_CORETEXT_COMMON_H
#define _VCL_CORETEXT_COMMON_H
-#include <sal/types.h>
-#include <premac.h>
+#include <iostream>
+#include <premac.h>
#ifdef MACOSX
#include <ApplicationServices/ApplicationServices.h>
#else
#include <CoreGraphics/CoreGraphics.h>
#include <CoreText/CoreText.h>
#endif
-
#include <postmac.h>
+#include <sal/types.h>
+
#include <tools/debug.hxx>
// CoreFoundation designers, in their wisdom, decided that CFRelease of NULL
@@ -45,6 +46,8 @@
#include "vcl/salgtype.hxx"
+std::ostream &operator <<(std::ostream& s, CTFontRef pFont);
+
#endif /* _VCL_CORETEXT_COMMON_H */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit e1165d62aa33624c4beae0b2eada4db8c38f9c22
Author: Tor Lillqvist <tml at iki.fi>
Date: Mon Apr 8 00:38:58 2013 +0300
Add SAL_INFO output operator for CGColorRef
Change-Id: Ie14e6ab19e43961559de21e6e82bd13f647f4e1f
diff --git a/vcl/inc/quartz/utils.h b/vcl/inc/quartz/utils.h
index a3d8a36..28cc508 100644
--- a/vcl/inc/quartz/utils.h
+++ b/vcl/inc/quartz/utils.h
@@ -42,6 +42,7 @@ NSString* CreateNSString( const OUString& );
std::ostream &operator <<(std::ostream& s, CGRect &rRect);
std::ostream &operator <<(std::ostream& s, CGPoint &rPoint);
std::ostream &operator <<(std::ostream& s, CGSize &rSize);
+std::ostream &operator <<(std::ostream& s, CGColorRef pSize);
#endif // INCLUDED_QUARTZ_UTILS_HXX
diff --git a/vcl/quartz/utils.cxx b/vcl/quartz/utils.cxx
index 9c76adc..e0c49e8 100644
--- a/vcl/quartz/utils.cxx
+++ b/vcl/quartz/utils.cxx
@@ -97,4 +97,20 @@ std::ostream &operator <<(std::ostream& s, CGSize &rSize)
return s;
}
+std::ostream &operator <<(std::ostream& s, CGColorRef pColor)
+{
+#ifndef SAL_LOG_INFO
+ (void) pColor;
+#else
+ CFStringRef colorString = CFCopyDescription(pColor);
+ if (colorString) {
+ s << GetOUString(colorString);
+ CFRelease(colorString);
+ } else {
+ s << "NULL";
+ }
+#endif
+ return s;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 1c0ef28f57769459982e4464f7c5ddd649829407
Author: Tor Lillqvist <tml at iki.fi>
Date: Sun Apr 7 19:08:50 2013 +0300
Add logging output operators for CGPoint and CGSize
Change-Id: I04ce457f002cfc0fdf3ab741a389082614035b17
diff --git a/vcl/inc/quartz/utils.h b/vcl/inc/quartz/utils.h
index ed7e233..a3d8a36 100644
--- a/vcl/inc/quartz/utils.h
+++ b/vcl/inc/quartz/utils.h
@@ -40,6 +40,8 @@ CFStringRef CreateCFString( const OUString& );
NSString* CreateNSString( const OUString& );
std::ostream &operator <<(std::ostream& s, CGRect &rRect);
+std::ostream &operator <<(std::ostream& s, CGPoint &rPoint);
+std::ostream &operator <<(std::ostream& s, CGSize &rSize);
#endif // INCLUDED_QUARTZ_UTILS_HXX
diff --git a/vcl/quartz/utils.cxx b/vcl/quartz/utils.cxx
index 390692c..9c76adc 100644
--- a/vcl/quartz/utils.cxx
+++ b/vcl/quartz/utils.cxx
@@ -72,7 +72,27 @@ std::ostream &operator <<(std::ostream& s, CGRect &rRect)
#ifndef SAL_LOG_INFO
(void) rRect;
#else
- s << (int) rRect.size.width << "x" << (int) rRect.size.height << "@(" << (int) rRect.origin.x << "," << (int) rRect.origin.y << ")";
+ s << rRect.size << "@" << rRect.origin;
+#endif
+ return s;
+}
+
+std::ostream &operator <<(std::ostream& s, CGPoint &rPoint)
+{
+#ifndef SAL_LOG_INFO
+ (void) rPoint;
+#else
+ s << "(" << rPoint.x << "," << rPoint.y << ")";
+#endif
+ return s;
+}
+
+std::ostream &operator <<(std::ostream& s, CGSize &rSize)
+{
+#ifndef SAL_LOG_INFO
+ (void) rSize;
+#else
+ s << rSize.width << "x" << rSize.height;
#endif
return s;
}
More information about the Libreoffice-commits
mailing list