Kaydet (Commit) fcf7f359 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Use SAL_INFO instead of home-grown msgs_debug

If there is a need to optionally get a thread identifier or the
function name into logging output (as msgs_debug did), we should
figure out a way to do that in some elegant fashion in the sal logging
macros instead of using some local solution in just one place in the
code.

Yes, the iOS and OS X CoreText code should be de-duplicated. Will
happen soon.
üst c228103c
......@@ -274,7 +274,7 @@ CoreTextPhysicalFontFace::CoreTextPhysicalFontFace( const ImplDevFontAttributes&
, m_bHasCJKSupport( false )
, m_bFontCapabilitiesRead( false )
{
msgs_debug(font,"retain %p as %p",font, m_CTFontRef);
SAL_INFO( "vcl.coretext.font", "retain " << font << " as " << m_CTFontRef );
}
CoreTextPhysicalFontFace::~CoreTextPhysicalFontFace()
......@@ -283,7 +283,7 @@ CoreTextPhysicalFontFace::~CoreTextPhysicalFontFace()
{
m_pCharMap->DeReference();
}
msgs_debug(font,"release font %p", m_CTFontRef);
SAL_INFO( "vcl.coretext.font", "release " << m_CTFontRef );
SafeCFRelease(m_CTFontRef);
}
......@@ -297,7 +297,7 @@ PhysicalFontFace* CoreTextPhysicalFontFace::Clone() const
if( m_CTFontRef )
{
pClone->m_CTFontRef = (CTFontRef)CFRetain(m_CTFontRef);
msgs_debug(font,"clone ref %p into %p", m_CTFontRef, pClone->m_CTFontRef);
SAL_INFO( "vcl.coretext.font", "clone " << m_CTFontRef << " into " << pClone->m_CTFontRef );
}
return pClone;
}
......
......@@ -53,14 +53,14 @@ CoreTextLayout::~CoreTextLayout()
void CoreTextLayout::AdjustLayout( ImplLayoutArgs& /*rArgs*/ )
{
msgs_debug(layout,"-->");
msgs_debug(layout,"<--");
SAL_INFO( "vcl.coretext.layout", "-->" );
SAL_INFO( "vcl.coretext.layout", "<--" );
/* TODO */
}
void CoreTextLayout::Clean()
{
msgs_debug(layout,"-->");
SAL_INFO( "vcl.coretext.layout", "-->" );
if(m_glyphs)
{
delete[] m_glyphs;
......@@ -94,12 +94,12 @@ void CoreTextLayout::Clean()
SafeCFRelease(m_typesetter);
SafeCFRelease(m_line);
m_has_bound_rec = false;
msgs_debug(layout,"<--");
SAL_INFO( "vcl.coretext.layout", "<--" );
}
void CoreTextLayout::DrawText( SalGraphics& rGraphics ) const
{
msgs_debug(layout,"-->");
SAL_INFO( "vcl.coretext.layout", "-->" );
AquaSalGraphics& gr = static_cast<AquaSalGraphics&>(rGraphics);
if(m_chars_count <= 0 || !gr.CheckContext())
{
......@@ -108,19 +108,18 @@ void CoreTextLayout::DrawText( SalGraphics& rGraphics ) const
CGContextSaveGState( gr.mrContext );
Point pos = GetDrawPosition(Point(0,0));
#if 0
msgs_debug(layout,"at pos (%ld, %ld)", pos.X(), pos.Y());
SAL_INFO( "vcl.coretext.layout", "at pos (" << pos.X() << "," << pos.Y() << ")" );
CGContextSetTextMatrix(gr.mrContext, CGAffineTransformMakeScale(1.0, -1.0));
CGContextSetShouldAntialias( gr.mrContext, !gr.mbNonAntialiasedText );
CGContextSetTextPosition(gr.mrContext, pos.X(), pos.Y());
CTLineDraw(m_line, gr.mrContext);
#else
InitGIA();
msgs_debug(layout,"at- pos (%ld, %ld) ctfont=%p", pos.X(), pos.Y(),
m_style->GetFont());
SAL_INFO( "vcl.coretext.layout", "at pos (" << pos.X() << "," << pos.Y() <<") ctfont=" << m_style->GetFont() );
CGFontRef cg_font = CTFontCopyGraphicsFont(m_style->GetFont(), NULL);
if(!cg_font)
{
msgs_debug(layout, "Error cg_font is %s", "NULL");
SAL_INFO( "vcl.coretext.layout", "Error cg_font is NULL" );
return;
}
CGContextSetFont(gr.mrContext, cg_font);
......@@ -144,7 +143,7 @@ void CoreTextLayout::DrawText( SalGraphics& rGraphics ) const
#endif
// restore the original graphic context transformations
CGContextRestoreGState( gr.mrContext );
msgs_debug(layout,"<--");
SAL_INFO( "vcl.coretext.layout", "<--" );
}
......@@ -153,7 +152,7 @@ void CoreTextLayout::DropGlyph( int /*nStart*/ ) {}
long CoreTextLayout::FillDXArray( sal_Int32* pDXArray ) const
{
msgs_debug(layout,"-->");
SAL_INFO( "vcl.coretext.layout", "-->" );
// short circuit requests which don't need full details
if( !pDXArray )
{
......@@ -176,14 +175,14 @@ long CoreTextLayout::FillDXArray( sal_Int32* pDXArray ) const
width = round_to_long(m_cached_width * scale);
pDXArray[i] = width - old_width;
}
msgs_debug(layout," w=%ld <--", width);
SAL_INFO( "vcl.coretext.layout", " width=" << width << " <--" );
return width;
}
bool CoreTextLayout::GetBoundRect( SalGraphics& rGraphics, Rectangle& rVCLRect ) const
{
msgs_debug(layout,"-->");
SAL_INFO( "vcl.coretext.layout", "-->" );
if ( !m_has_bound_rec )
{
AquaSalGraphics& gr = static_cast<AquaSalGraphics&>(rGraphics);
......@@ -199,13 +198,13 @@ bool CoreTextLayout::GetBoundRect( SalGraphics& rGraphics, Rectangle& rVCLRect )
m_has_bound_rec = true;
}
rVCLRect = m_bound_rect;
msgs_debug(layout,"<--");
SAL_INFO( "vcl.coretext.layout", "<--" );
return true;
}
void CoreTextLayout::GetCaretPositions( int max_index, sal_Int32* caret_position) const
{
msgs_debug(layout,"max_index %d -->", max_index);
SAL_INFO( "vcl.coretext.layout", "max_index " << max_index << " -->" );
int local_max = max_index < m_chars_count * 2 ? max_index : m_chars_count;
for(int i = 0 ; i < max_index - 1; i+=2)
{
......@@ -219,7 +218,7 @@ void CoreTextLayout::GetCaretPositions( int max_index, sal_Int32* caret_position
{
caret_position[i] = -1;
}
msgs_debug(layout,"<--");
SAL_INFO( "vcl.coretext.layout", "<--" );
}
bool CoreTextLayout::GetGlyphOutlines( SalGraphics&, PolyPolyVector& ) const { return false; }
......@@ -227,7 +226,7 @@ bool CoreTextLayout::GetGlyphOutlines( SalGraphics&, PolyPolyVector& ) const { r
int CoreTextLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIDs, Point& rPos, int& nStart,
sal_Int32* pGlyphAdvances, int* pCharIndexes ) const
{
msgs_debug(layout,"nLen=%d nStart=%d-->", nLen, nStart);
SAL_INFO( "vcl.coretext.layout", "nLen=" << nLen << " nStart=" << nStart << " -->");
// get glyph measurements
InitGIA();
......@@ -274,7 +273,7 @@ int CoreTextLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIDs, Point& rPos
CTRunGetPositions(run, CFRangeMake(m_current_glyphrun_index,1), &first_pos);
Point pos(first_pos.x, first_pos.y);
rPos = GetDrawPosition(pos);
msgs_debug(layout,"rPos(%ld, %ld)", rPos.X(),rPos.Y());
SAL_INFO( "vcl.coretext.layout", "rPos(" << rPos.X() << "," << rPos.Y() << ")" );
first = false;
}
pGlyphIDs[i] = m_glyphs[m_current_glyph_index];
......@@ -291,7 +290,7 @@ int CoreTextLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIDs, Point& rPos
i += 1;
nStart += 1;
}
msgs_debug(layout,"i=%d <--", i);
SAL_INFO( "vcl.coretext.layout", "i=" << i << " <--" );
return i;
}
......@@ -303,23 +302,23 @@ int CoreTextLayout::GetTextBreak( long /*nMaxWidth*/, long /*nCharExtra*/, int /
long CoreTextLayout::GetTextWidth() const
{
msgs_debug(layout,"-->");
SAL_INFO( "vcl.coretext.layout", "-->" );
CGRect bound_rect = CTLineGetImageBounds(m_line, m_graphics->GetContext());
long w = round_to_long(bound_rect.size.width * m_style->GetFontStretchFactor());
msgs_debug(layout,"w=%ld <--", w);
SAL_INFO( "vcl.coretext.layout", "w=" << w << " <--" );
return w;
}
// not needed. CoreText manage fallback directly
void CoreTextLayout::InitFont() const
{
msgs_debug(layout,"<-->");
SAL_INFO( "vcl.coretext.layout", "<-->" );
}
bool CoreTextLayout::InitGIA() const
{
msgs_debug(layout,"count=%d <--", m_chars_count);
SAL_INFO( "vcl.coretext.layout", "count=" << m_chars_count << "-->" );
if( m_chars_count <= 0)
{
......@@ -373,8 +372,7 @@ bool CoreTextLayout::InitGIA() const
for (CFIndex j = 0 ; j < nb_glyphs; ++p, ++j )
{
m_glyphs[ p ] = glyphs[ j ];
msgs_debug(layout,"m_glyphys[%d]=glyphs[%d] run %d : 0x%x\n",
p,(int)j, (int)i, glyphs[j]);
SAL_INFO( "vcl.coretext.layout", "m_glyphys[" << p << "]=glyphs[" << j << "] run " << i << " : 0x" << std::hex << glyphs[j] << std::dec );
CFIndex k = indices[ j ];
m_glyphs2chars[p] = k;
m_chars2glyphs[k] = p;
......@@ -392,14 +390,13 @@ bool CoreTextLayout::InitGIA() const
}
}
}
msgs_debug(layout,"<--");
SAL_INFO( "vcl.coretext.layout", "<--" );
return true;
}
bool CoreTextLayout::LayoutText(ImplLayoutArgs& args)
{
msgs_debug(layout,"-->(m_style=%p font=%p",
m_style, m_style->GetFont());
SAL_INFO( "vcl.coretext.layout", "m_style=" << m_style << " font=" << m_style->GetFont() << " -->" );
Clean();
m_style->SetColor();
/* retreive MinCharPos EndCharPos Flags and Orientation */
......@@ -458,7 +455,7 @@ bool CoreTextLayout::LayoutText(ImplLayoutArgs& args)
}
m_glyphs_count = CTLineGetGlyphCount(m_line);
msgs_debug(layout,"glyph_count=%d <--", m_glyphs_count);
SAL_INFO( "vcl.coretext.layout", "glyph_count=" << m_glyphs_count << " <--" );
return true;
}
......
......@@ -32,12 +32,12 @@ CoreTextStyleInfo::CoreTextStyleInfo() :
m_color(NULL),
m_font_face(NULL)
{
msgs_debug(style,"create <-->");
SAL_INFO( "vcl.coretext.style", "create <-->" );
}
CoreTextStyleInfo::~CoreTextStyleInfo()
{
msgs_debug(style,"destroy (font:%p) <-->", m_CTFont);
SAL_INFO( "vcl.coretext.style", "destroy (font:" << m_CTFont << ") <-->" );
SafeCFRelease(m_CTFont);
SafeCFRelease(m_CTParagraphStyle);
SafeCFRelease(m_color);
......@@ -51,7 +51,7 @@ long CoreTextStyleInfo::GetFontStretchedSize() const
void CoreTextStyleInfo::SetFont(FontSelectPattern* requested_font)
{
msgs_debug(style,"req(%p) release font %p -->", requested_font, m_CTFont);
SAL_INFO( "vcl.coretext.style", "req(" << requested_font << ") release font " << m_CTFont << " -->" );
if(!requested_font)
{
......@@ -92,21 +92,21 @@ 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);
msgs_debug(style,"font %p <--", m_CTFont);
SAL_INFO( "vcl.coretext.style", "font " << m_CTFont << " <--" );
}
void CoreTextStyleInfo::SetColor(SalColor color)
{
msgs_debug(style, "r:%d g:%d b:%d -->", SALCOLOR_RED(color), SALCOLOR_GREEN(color), SALCOLOR_BLUE(color));
SAL_INFO( "vcl.coretext.style", "r:" << SALCOLOR_RED(color) << ",g:" << SALCOLOR_GREEN(color) << ",b:" << SALCOLOR_BLUE(color) );
SafeCFRelease(m_color);
m_color = CGColorCreateGenericRGB(SALCOLOR_RED(color) / 255.0, SALCOLOR_GREEN(color) / 255.0, SALCOLOR_BLUE(color) / 255.0, 1.0);
msgs_debug(style,"color=%p <--", m_color);
SAL_INFO( "vcl.coretext.style", "color=" << m_color << " <--" );
}
void CoreTextStyleInfo::SetColor(void)
{
msgs_debug(style, "null -->");
SAL_INFO( "vcl.coretext.style", "null -->" );
SafeCFRelease(m_color);
msgs_debug(style,"color=%p <--", m_color);
SAL_INFO( "vcl.coretext.style", "color=" << m_color << " <--" );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -45,20 +45,20 @@ AquaSalGraphics::AquaSalGraphics()
, mbVirDev( false )
, mbWindow( false )
{
msgs_debug(gr,"-->");
SAL_INFO( "vcl.coretext.gr", "-->" );
m_style = new CoreTextStyleInfo();
msgs_debug(gr,"m_style=%p <--", m_style);
SAL_INFO( "vcl.coretext.gr", "m_style=" << m_style << " <--" );
}
AquaSalGraphics::~AquaSalGraphics()
{
msgs_debug(gr,"-->");
SAL_INFO( "vcl.coretext.gr", "-->" );
if(m_style)
{
delete m_style;
m_style = NULL;
}
msgs_debug(gr,"<--");
SAL_INFO( "vcl.coretext.gr", "<--" );
}
inline bool AquaSalGraphics::AddTempDevFont( ImplDevFontList*,
......@@ -137,11 +137,7 @@ void AquaSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackL
pMetric->mnExtLeading = nExtDescent + pMetric->mnDescent;
pMetric->mnIntLeading = 0;
pMetric->mnWidth = m_style->GetFontStretchedSize();
msgs_debug(gr,"ascent=%ld, descent=%ld, extleading=%ld, intleading=%ld,w=%ld",
pMetric->mnAscent, pMetric->mnDescent,
pMetric->mnExtLeading,
pMetric->mnIntLeading,
pMetric->mnWidth);
SAL_INFO( "vcl.coretext.gr", "ascent=" << pMetric->mnAscent<< ", descent=" << pMetric->mnDescent << ", extleading=" << pMetric->mnExtLeading << ", intleading=" << pMetric->mnIntLeading << ", w=" << pMetric->mnWidth );
}
sal_Bool AquaSalGraphics::GetGlyphBoundRect( sal_GlyphId /*nGlyphId*/, Rectangle& /*rRect*/ )
......@@ -204,7 +200,7 @@ bool AquaSalGraphics::GetRawFontData( const PhysicalFontFace* pFontFace,
SystemFontData AquaSalGraphics::GetSysFontData( int /* nFallbacklevel */ ) const
{
msgs_debug(gr,"-->");
SAL_INFO( "vcl.coretext.gr", "-->" );
SystemFontData aSysFontData;
aSysFontData.nSize = sizeof( SystemFontData );
aSysFontData.bAntialias = true;
......@@ -237,31 +233,31 @@ SystemFontData AquaSalGraphics::GetSysFontData( int /* nFallbacklevel */ ) const
aSysFontData.bVerticalCharacterType = vertical_font ? true : false;
SafeCFRelease(vertical_font);
msgs_debug(gr,"<--");
SAL_INFO( "vcl.coretext.gr", "<--" );
return aSysFontData;
}
SalLayout* AquaSalGraphics::GetTextLayout( ImplLayoutArgs&, int /*nFallbackLevel*/ )
{
msgs_debug(gr,"-->");
SAL_INFO( "vcl.coretext.gr", "-->" );
CoreTextLayout* layout = new CoreTextLayout( this, m_style );
msgs_debug(gr,"layout:%p <--", layout);
SAL_INFO( "vcl.coretext.gr", "layout:" << layout << " <--" );
return layout;
}
sal_uInt16 AquaSalGraphics::SetFont( FontSelectPattern* pReqFont, int /*nFallbackLevel*/ )
{
msgs_debug(gr,"m_style=%p -->", m_style);
SAL_INFO( "vcl.coretext.gr", "m_style=" << m_style << " -->" );
m_style->SetFont(pReqFont);
msgs_debug(gr,"<--");
SAL_INFO( "vcl.coretext.gr", "<--" );
return 0;
}
void AquaSalGraphics::SetTextColor( SalColor nSalColor )
{
msgs_debug(gr,"m_style=%p -->", m_style);
SAL_INFO( "vcl.coretext.gr", "m_style=" << m_style << " -->" );
m_style->SetColor(nSalColor);
msgs_debug(gr,"<--");
SAL_INFO( "vcl.coretext.gr", "<--" );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -38,12 +38,6 @@
#include "vcl/salgtype.hxx"
//#define msgs_debug(c,f,...)
// fprintf(stderr, "%s::%s(%p:%04.4x)\n", this, #c, __func__, 0, __VA_ARGS__ )
#define msgs_debug(c,f,...) \
fprintf(stderr, "%s::%s(%p:%4.4u)" f "\n", #c, __func__, this, (unsigned int)((sal_uInt64)pthread_self() & 0x1FFF), ##__VA_ARGS__ );
#endif /* _VCL_AQUA_COMMON_H */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -42,10 +42,4 @@
#endif/* _VCL_IOS_COMMON_H */
//#define msgs_debug(c,f,...)
// fprintf(stderr, "%s::%s(%p:%04.4x)\n", this, #c, __func__, 0, __VA_ARGS__ )
#define msgs_debug(c,f,...) \
fprintf(stderr, "%s::%s(%p:%4.4u)" f "\n", #c, __func__, this, ((unsigned int)pthread_self() & 8191), ##__VA_ARGS__ );
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -262,7 +262,7 @@ CoreTextPhysicalFontFace::CoreTextPhysicalFontFace( const ImplDevFontAttributes&
, m_bHasCJKSupport( false )
, m_bFontCapabilitiesRead( false )
{
msgs_debug(font,"retain %p as %p",font, m_CTFontRef);
SAL_INFO( "vcl.coretext.font", "retain " << font << " as " << m_CTFontRef );
}
CoreTextPhysicalFontFace::~CoreTextPhysicalFontFace()
......@@ -271,7 +271,7 @@ CoreTextPhysicalFontFace::~CoreTextPhysicalFontFace()
{
m_pCharMap->DeReference();
}
msgs_debug(font,"release font %p", m_CTFontRef);
SAL_INFO( "vcl.coretext.font", "release " << m_CTFontRef );
SafeCFRelease(m_CTFontRef);
}
......@@ -285,7 +285,7 @@ PhysicalFontFace* CoreTextPhysicalFontFace::Clone() const
if( m_CTFontRef )
{
pClone->m_CTFontRef = (CTFontRef)CFRetain(m_CTFontRef);
msgs_debug(font,"clone ref %p into %p", m_CTFontRef, pClone->m_CTFontRef);
SAL_INFO( "vcl.coretext.font", "clone " << m_CTFontRef << " into " << pClone->m_CTFontRef );
}
return pClone;
}
......
......@@ -53,14 +53,14 @@ CoreTextLayout::~CoreTextLayout()
void CoreTextLayout::AdjustLayout( ImplLayoutArgs& /*rArgs*/ )
{
msgs_debug(layout,"-->");
msgs_debug(layout,"<--");
SAL_INFO( "vcl.coretext.layout", "-->" );
SAL_INFO( "vcl.coretext.layout", "<--" );
/* TODO */
}
void CoreTextLayout::Clean()
{
msgs_debug(layout,"-->");
SAL_INFO( "vcl.coretext.layout", "-->" );
if(m_glyphs)
{
delete[] m_glyphs;
......@@ -94,12 +94,12 @@ void CoreTextLayout::Clean()
SafeCFRelease(m_typesetter);
SafeCFRelease(m_line);
m_has_bound_rec = false;
msgs_debug(layout,"<--");
SAL_INFO( "vcl.coretext.layout", "<--" );
}
void CoreTextLayout::DrawText( SalGraphics& rGraphics ) const
{
msgs_debug(layout,"-->");
SAL_INFO( "vcl.coretext.layout", "-->" );
IosSalGraphics& gr = static_cast<IosSalGraphics&>(rGraphics);
if(m_chars_count <= 0 || !gr.CheckContext())
{
......@@ -108,19 +108,18 @@ void CoreTextLayout::DrawText( SalGraphics& rGraphics ) const
CGContextSaveGState( gr.mrContext );
Point pos = GetDrawPosition(Point(0,0));
#if 0
msgs_debug(layout,"at pos (%ld, %ld)", pos.X(), pos.Y());
SAL_INFO( "vcl.coretext.layout", "at pos (" << pos.X() << "," << pos.Y() << ")" );
CGContextSetTextMatrix(gr.mrContext, CGAffineTransformMakeScale(1.0, -1.0));
CGContextSetShouldAntialias( gr.mrContext, !gr.mbNonAntialiasedText );
CGContextSetTextPosition(gr.mrContext, pos.X(), pos.Y());
CTLineDraw(m_line, gr.mrContext);
#else
InitGIA();
msgs_debug(layout,"at- pos (%ld, %ld) ctfont=%p", pos.X(), pos.Y(),
m_style->GetFont());
SAL_INFO( "vcl.coretext.layout", "at pos (" << pos.X() << "," << pos.Y() <<") ctfont=" << m_style->GetFont() );
CGFontRef cg_font = CTFontCopyGraphicsFont(m_style->GetFont(), NULL);
if(!cg_font)
{
msgs_debug(layout, "Error cg_font is %s", "NULL");
SAL_INFO( "vcl.coretext.layout", "Error cg_font is NULL" );
return;
}
CGContextSetFont(gr.mrContext, cg_font);
......@@ -144,7 +143,7 @@ void CoreTextLayout::DrawText( SalGraphics& rGraphics ) const
#endif
// restore the original graphic context transformations
CGContextRestoreGState( gr.mrContext );
msgs_debug(layout,"<--");
SAL_INFO( "vcl.coretext.layout", "<--" );
}
......@@ -153,7 +152,7 @@ void CoreTextLayout::DropGlyph( int /*nStart*/ ) {}
long CoreTextLayout::FillDXArray( long* pDXArray ) const
{
msgs_debug(layout,"-->");
SAL_INFO( "vcl.coretext.layout", "-->" );
// short circuit requests which don't need full details
if( !pDXArray )
{
......@@ -176,14 +175,14 @@ long CoreTextLayout::FillDXArray( long* pDXArray ) const
width = round_to_long(m_cached_width * scale);
pDXArray[i] = width - old_width;
}
msgs_debug(layout," w=%ld <--", width);
SAL_INFO( "vcl.coretext.layout", " width=" << width << " <--" );
return width;
}
bool CoreTextLayout::GetBoundRect( SalGraphics &rGraphics, Rectangle& rVCLRect ) const
{
msgs_debug(layout,"-->");
SAL_INFO( "vcl.coretext.layout", "-->" );
if ( !m_has_bound_rec )
{
IosSalGraphics& gr = static_cast<IosSalGraphics&>(rGraphics);
......@@ -199,13 +198,13 @@ bool CoreTextLayout::GetBoundRect( SalGraphics &rGraphics, Rectangle& rVCLRect )
m_has_bound_rec = true;
}
rVCLRect = m_bound_rect;
msgs_debug(layout,"<--");
SAL_INFO( "vcl.coretext.layout", "<--" );
return true;
}
void CoreTextLayout::GetCaretPositions( int max_index, long* caret_position) const
{
msgs_debug(layout,"max_index %d -->", max_index);
SAL_INFO( "vcl.coretext.layout", "max_index " << max_index << " -->" );
int local_max = max_index < m_chars_count * 2 ? max_index : m_chars_count;
for(int i = 0 ; i < max_index - 1; i+=2)
{
......@@ -219,7 +218,7 @@ void CoreTextLayout::GetCaretPositions( int max_index, long* caret_position) con
{
caret_position[i] = -1;
}
msgs_debug(layout,"<--");
SAL_INFO( "vcl.coretext.layout", "<--" );
}
bool CoreTextLayout::GetGlyphOutlines( SalGraphics&, PolyPolyVector& ) const { return false; }
......@@ -227,7 +226,7 @@ bool CoreTextLayout::GetGlyphOutlines( SalGraphics&, PolyPolyVector& ) const { r
int CoreTextLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIDs, Point& rPos, int& nStart,
sal_Int32* pGlyphAdvances, int* pCharIndexes ) const
{
msgs_debug(layout,"nLen=%d nStart=%d-->", nLen, nStart);
SAL_INFO( "vcl.coretext.layout", "nLen=" << nLen << " nStart=" << nStart << " -->");
// get glyph measurements
InitGIA();
......@@ -274,7 +273,7 @@ int CoreTextLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIDs, Point& rPos
CTRunGetPositions(run, CFRangeMake(m_current_glyphrun_index,1), &first_pos);
Point pos(first_pos.x, first_pos.y);
rPos = GetDrawPosition(pos);
msgs_debug(layout,"rPos(%ld, %ld)", rPos.X(),rPos.Y());
SAL_INFO( "vcl.coretext.layout", "rPos(" << rPos.X() << "," << rPos.Y() << ")" );
first = false;
}
pGlyphIDs[i] = m_glyphs[m_current_glyph_index];
......@@ -291,7 +290,7 @@ int CoreTextLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIDs, Point& rPos
i += 1;
nStart += 1;
}
msgs_debug(layout,"i=%d <--", i);
SAL_INFO( "vcl.coretext.layout", "i=" << i << " <--" );
return i;
}
......@@ -303,23 +302,23 @@ int CoreTextLayout::GetTextBreak( long /*nMaxWidth*/, long /*nCharExtra*/, int /
long CoreTextLayout::GetTextWidth() const
{
msgs_debug(layout,"-->");
SAL_INFO( "vcl.coretext.layout", "-->" );
CGRect bound_rect = CTLineGetImageBounds(m_line, m_graphics->GetContext());
long w = round_to_long(bound_rect.size.width * m_style->GetFontStretchFactor());
msgs_debug(layout,"w=%ld <--", w);
SAL_INFO( "vcl.coretext.layout", "w=" << w << " <--" );
return w;
}
// not needed. CoreText manage fallback directly
void CoreTextLayout::InitFont() const
{
msgs_debug(layout,"<-->");
SAL_INFO( "vcl.coretext.layout", "<-->" );
}
bool CoreTextLayout::InitGIA() const
{
msgs_debug(layout,"count=%d <--", m_chars_count);
SAL_INFO( "vcl.coretext.layout", "count=" << m_chars_count << "-->" );
if( m_chars_count <= 0)
{
......@@ -373,8 +372,7 @@ bool CoreTextLayout::InitGIA() const
for (CFIndex j = 0 ; j < nb_glyphs; ++p, ++j )
{
m_glyphs[ p ] = glyphs[ j ];
msgs_debug(layout,"m_glyphys[%d]=glyphs[%d] run %d : 0x%x\n",
p,(int)j, (int)i, glyphs[j]);
SAL_INFO( "vcl.coretext.layout", "m_glyphys[" << p << "]=glyphs[" << j << "] run " << i << " : 0x" << std::hex << glyphs[j] << std::dec );
CFIndex k = indices[ j ];
m_glyphs2chars[p] = k;
m_chars2glyphs[k] = p;
......@@ -392,14 +390,13 @@ bool CoreTextLayout::InitGIA() const
}
}
}
msgs_debug(layout,"<--");
SAL_INFO( "vcl.coretext.layout", "<--" );
return true;
}
bool CoreTextLayout::LayoutText(ImplLayoutArgs& args)
{
msgs_debug(layout,"-->(m_style=%p font=%p",
m_style, m_style->GetFont());
SAL_INFO( "vcl.coretext.layout", "m_style=" << m_style << " font=" << m_style->GetFont() << " -->" );
Clean();
m_style->SetColor();
/* retreive MinCharPos EndCharPos Flags and Orientation */
......@@ -471,7 +468,7 @@ bool CoreTextLayout::LayoutText(ImplLayoutArgs& args)
}
m_glyphs_count = CTLineGetGlyphCount(m_line);
msgs_debug(layout,"glyph_count=%d <--", m_glyphs_count);
SAL_INFO( "vcl.coretext.layout", "glyph_count=" << m_glyphs_count << " <--" );
return true;
}
......
......@@ -32,12 +32,12 @@ CoreTextStyleInfo::CoreTextStyleInfo() :
m_color(NULL),
m_font_face(NULL)
{
msgs_debug(style,"create <-->");
SAL_INFO( "vcl.coretext.style", "create <-->" );
}
CoreTextStyleInfo::~CoreTextStyleInfo()
{
msgs_debug(style,"destroy (font:%p) <-->", m_CTFont);
SAL_INFO( "vcl.coretext.style", "destroy (font:" << m_CTFont << ") <-->" );
SafeCFRelease(m_CTFont);
SafeCFRelease(m_CTParagraphStyle);
SafeCFRelease(m_color);
......@@ -51,7 +51,7 @@ long CoreTextStyleInfo::GetFontStretchedSize() const
void CoreTextStyleInfo::SetFont(FontSelectPattern* requested_font)
{
msgs_debug(style,"req(%p) release font %p -->", requested_font, m_CTFont);
SAL_INFO( "vcl.coretext.style", "req(" << requested_font << ") release font " << m_CTFont << " -->" );
if(!requested_font)
{
......@@ -92,12 +92,12 @@ 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);
msgs_debug(style,"font %p <--", m_CTFont);
SAL_INFO( "vcl.coretext.style", "font " << m_CTFont << " <--" );
}
void CoreTextStyleInfo::SetColor(SalColor color)
{
msgs_debug(style, "r:%d g:%d b:%d -->", SALCOLOR_RED(color), SALCOLOR_GREEN(color), SALCOLOR_BLUE(color));
SAL_INFO( "vcl.coretext.style", "r:" << SALCOLOR_RED(color) << ",g:" << SALCOLOR_GREEN(color) << ",b:" << SALCOLOR_BLUE(color) );
SafeCFRelease(m_color);
#ifdef IOS
// No CGColorCreateGenericRGB on iOS
......@@ -108,13 +108,13 @@ void CoreTextStyleInfo::SetColor(SalColor color)
#else
m_color = CGColorCreateGenericRGB(SALCOLOR_RED(color) / 255.0, SALCOLOR_GREEN(color) / 255.0, SALCOLOR_BLUE(color) / 255.0, 1.0);
#endif
msgs_debug(style,"color=%p <--", m_color);
SAL_INFO( "vcl.coretext.style", "color=" << m_color << " <--" );
}
void CoreTextStyleInfo::SetColor(void)
{
msgs_debug(style, "null -->");
SAL_INFO( "vcl.coretext.style", "null -->" );
SafeCFRelease(m_color);
msgs_debug(style,"color=%p <--", m_color);
SAL_INFO( "vcl.coretext.style", "color=" << m_color << " <--" );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -45,20 +45,20 @@ IosSalGraphics::IosSalGraphics()
, mbVirDev( false )
, mbWindow( false )
{
msgs_debug(gr,"-->");
SAL_INFO( "vcl.coretext.gr", "-->" );
m_style = new CoreTextStyleInfo();
msgs_debug(gr,"m_style=%p <--", m_style);
SAL_INFO( "vcl.coretext.gr", "m_style=" << m_style << " <--" );
}
IosSalGraphics::~IosSalGraphics()
{
msgs_debug(gr,"-->");
SAL_INFO( "vcl.coretext.gr", "-->" );
if(m_style)
{
delete m_style;
m_style = NULL;
}
msgs_debug(gr,"<--");
SAL_INFO( "vcl.coretext.gr", "<--" );
}
inline bool IosSalGraphics::AddTempDevFont( ImplDevFontList*,
......@@ -137,11 +137,7 @@ void IosSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLe
pMetric->mnExtLeading = nExtDescent + pMetric->mnDescent;
pMetric->mnIntLeading = 0;
pMetric->mnWidth = m_style->GetFontStretchedSize();
msgs_debug(gr,"ascent=%ld, descent=%ld, extleading=%ld, intleading=%ld,w=%ld",
pMetric->mnAscent, pMetric->mnDescent,
pMetric->mnExtLeading,
pMetric->mnIntLeading,
pMetric->mnWidth);
SAL_INFO( "vcl.coretext.gr", "ascent=" << pMetric->mnAscent<< ", descent=" << pMetric->mnDescent << ", extleading=" << pMetric->mnExtLeading << ", intleading=" << pMetric->mnIntLeading << ", w=" << pMetric->mnWidth );
}
sal_Bool IosSalGraphics::GetGlyphBoundRect( sal_GlyphId /*nGlyphId*/, Rectangle& /*rRect*/ )
......@@ -204,7 +200,7 @@ bool IosSalGraphics::GetRawFontData( const PhysicalFontFace* pFontFace,
SystemFontData IosSalGraphics::GetSysFontData( int /* nFallbacklevel */ ) const
{
msgs_debug(gr,"-->");
SAL_INFO( "vcl.coretext.gr", "-->" );
SystemFontData aSysFontData;
aSysFontData.nSize = sizeof( SystemFontData );
aSysFontData.bAntialias = true;
......@@ -237,31 +233,31 @@ SystemFontData IosSalGraphics::GetSysFontData( int /* nFallbacklevel */ ) const
aSysFontData.bVerticalCharacterType = vertical_font ? true : false;
SafeCFRelease(vertical_font);
msgs_debug(gr,"<--");
SAL_INFO( "vcl.coretext.gr", "<--" );
return aSysFontData;
}
SalLayout* IosSalGraphics::GetTextLayout( ImplLayoutArgs&, int /*nFallbackLevel*/ )
{
msgs_debug(gr,"-->");
SAL_INFO( "vcl.coretext.gr", "-->" );
CoreTextLayout* layout = new CoreTextLayout( this, m_style );
msgs_debug(gr,"layout:%p <--", layout);
SAL_INFO( "vcl.coretext.gr", "layout:" << layout << " <--" );
return layout;
}
sal_uInt16 IosSalGraphics::SetFont( FontSelectPattern* pReqFont, int /*nFallbackLevel*/ )
{
msgs_debug(gr,"m_style=%p -->", m_style);
SAL_INFO( "vcl.coretext.gr", "m_style=" << m_style << " -->" );
m_style->SetFont(pReqFont);
msgs_debug(gr,"<--");
SAL_INFO( "vcl.coretext.gr", "<--" );
return 0;
}
void IosSalGraphics::SetTextColor( SalColor nSalColor )
{
msgs_debug(gr,"m_style=%p -->", m_style);
SAL_INFO( "vcl.coretext.gr", "m_style=" << m_style << " -->" );
m_style->SetColor(nSalColor);
msgs_debug(gr,"<--");
SAL_INFO( "vcl.coretext.gr", "<--" );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment