ios/experimental/LibreOffice/LibreOffice.xcodeproj/project.pbxproj | 16 +++++ ios/experimental/LibreOffice/LibreOffice/lo.mm | 5 - vcl/coretext/salcoretextfontutils.cxx | 30 ++++------ vcl/coretext/salcoretextlayout.cxx | 14 +++- vcl/headless/svpgdi.cxx | 12 +++- vcl/inc/headless/svpgdi.hxx | 6 +- 6 files changed, 56 insertions(+), 27 deletions(-)
New commits: commit de2ccd8e1ad3eeb5545e4dcccfe40ec81929a9ed Author: Tor Lillqvist <t...@iki.fi> Date: Wed Apr 3 23:36:06 2013 +0300 Bypass fields that are unused for iOS Change-Id: I378228808ef8f974e574714f48a2faf23123714b diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index ca95dc3..96733ec 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -80,14 +80,17 @@ SvpSalGraphics::SvpSalGraphics() : m_aLineColor( COL_BLACK ), m_bUseFillColor( false ), m_aFillColor( COL_WHITE ), - m_aTextColor( COL_BLACK ), m_aDrawMode( basebmp::DrawMode_PAINT ), +#ifndef IOS + m_aTextColor( COL_BLACK ), m_eTextFmt( basebmp::Format::EIGHT_BIT_GREY ), +#endif m_bClipSetup( false ) { +#ifndef IOS for( int i = 0; i < MAX_FALLBACK; ++i ) m_pServerFont[i] = NULL; -#ifdef IOS +#else mrContext = nil; mfFakeDPIScale = 1.0; m_style = new CoreTextStyleInfo(); @@ -115,6 +118,7 @@ void SvpSalGraphics::setDevice( basebmp::BitmapDeviceSharedPtr& rDevice ) m_aOrigDevice = rDevice; ResetClipRegion(); +#ifndef IOS // determine matching bitmap format for masks sal_uInt32 nDeviceFmt = m_aDevice->getScanlineFormat(); DBG_ASSERT( (nDeviceFmt <= (sal_uInt32)basebmp::Format::MAX), "SVP::setDevice() with invalid bitmap format" ); @@ -134,6 +138,7 @@ void SvpSalGraphics::setDevice( basebmp::BitmapDeviceSharedPtr& rDevice ) m_eTextFmt = basebmp::Format::ONE_BIT_LSB_GREY; break; } +#endif } void SvpSalGraphics::GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) @@ -551,6 +556,9 @@ void SvpSalGraphics::copyArea( long nDestX, void SvpSalGraphics::copyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics ) { + if( !m_aDevice.get() ) + return; + SvpSalGraphics* pSrc = pSrcGraphics ? static_cast<SvpSalGraphics*>(pSrcGraphics) : this; basegfx::B2IBox aSrcRect( pPosAry->mnSrcX, pPosAry->mnSrcY, diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index ad544df..50a3f87 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -45,12 +45,16 @@ class SvpSalGraphics : public SalGraphics basebmp::Color m_aLineColor; bool m_bUseFillColor; basebmp::Color m_aFillColor; - basebmp::Color m_aTextColor; basebmp::DrawMode m_aDrawMode; +#ifndef IOS + // These fields are used only when we use FreeType to draw into a + // headless backend, i.e. not on iOS. + basebmp::Color m_aTextColor; ServerFont* m_pServerFont[ MAX_FALLBACK ]; sal_uInt32 m_eTextFmt; +#endif basebmp::BitmapDeviceSharedPtr m_aClipMap; commit ce0c3c1eb1405912f36a3ad7e850a5b4e17a3f2c Author: Tor Lillqvist <t...@iki.fi> Date: Wed Apr 3 23:33:25 2013 +0300 Ensure we have a CGContext in a couple of more places Change-Id: I1d0963f51472328a1a5b212ab277c6e72fafd7b9 diff --git a/vcl/coretext/salcoretextlayout.cxx b/vcl/coretext/salcoretextlayout.cxx index 7cadbe7..98e2ae4 100644 --- a/vcl/coretext/salcoretextlayout.cxx +++ b/vcl/coretext/salcoretextlayout.cxx @@ -301,11 +301,14 @@ long CoreTextLayout::FillDXArray( sal_Int32* pDXArray ) const bool CoreTextLayout::GetBoundRect( SalGraphics& rGraphics, Rectangle& rVCLRect ) const { - SAL_INFO( "vcl.coretext.layout", "GetBoundRect(" << this << ")" ); + QuartzSalGraphics& gr = static_cast<QuartzSalGraphics&>(rGraphics); + + if( !gr.CheckContext() ) + return false; + if ( !mbHasBoundRectangle ) { - QuartzSalGraphics& gr = static_cast<QuartzSalGraphics&>(rGraphics); CGRect bound_rect = CTLineGetImageBounds( mpLine, gr.mrContext ); if ( !CGRectIsNull( bound_rect ) ) { maBoundRectangle = Rectangle( @@ -464,7 +467,12 @@ int CoreTextLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) long CoreTextLayout::GetTextWidth() const { - CGRect bound_rect = CTLineGetImageBounds(mpLine, mpGraphics->GetContext()); + CGContextRef context = mpGraphics->GetContext(); + if (!context) { + SAL_INFO( "vcl.coretext.layout", "GetTextWidth(): no context!?"); + return 0; + } + CGRect bound_rect = CTLineGetImageBounds(mpLine, context); long w = round_to_long(bound_rect.size.width * mpStyle->GetFontStretchFactor()); SAL_INFO( "vcl.coretext.layout", "GetTextWidth(" << this << ") returning " << w ); commit 0ea4a012400343b7105f108b47bb6e3df38d2558 Author: Tor Lillqvist <t...@iki.fi> Date: Wed Apr 3 23:28:13 2013 +0300 It's the font *style* we are looking at here So no point in checking font *family* names like "arial" or "times". Actually, I doubt this whole block of heuristics is necessary. Change-Id: I6965c27a7c4bed53db0e7ddaa40b1d09ccc4ad43 diff --git a/vcl/coretext/salcoretextfontutils.cxx b/vcl/coretext/salcoretextfontutils.cxx index eef05c3..15db6fb 100644 --- a/vcl/coretext/salcoretextfontutils.cxx +++ b/vcl/coretext/salcoretextfontutils.cxx @@ -166,44 +166,40 @@ static bool GetDevFontAttributes( CTFontDescriptorRef font_descriptor, ImplDevFo } CFStringRef string_ref = (CFStringRef)CTFontDescriptorCopyAttribute(font_descriptor, kCTFontStyleNameAttribute); - rtl::OUString font_name = GetOUString(string_ref); - rtl::OUString font_name_lc(font_name.toAsciiLowerCase()); + rtl::OUString style(GetOUString(string_ref).toAsciiLowerCase()); CFRelease(string_ref); // heuristics to adjust font slant - if( (font_name_lc.indexOf("oblique") != -1) || - (font_name_lc.indexOf("inclined") != -1) || - (font_name_lc.indexOf("slanted") != -1) ) + if( (style.indexOf("oblique") != -1) || + (style.indexOf("inclined") != -1) || + (style.indexOf("slanted") != -1) ) { rDFA.SetItalic( ITALIC_OBLIQUE ); } // heuristics to adjust font width - if (font_name_lc.indexOf("narrow") != -1) + if (style.indexOf("narrow") != -1) { rDFA.SetWidthType( WIDTH_SEMI_CONDENSED ); } // heuristics for font family type - if( (font_name_lc.indexOf("script") != -1) || - (font_name_lc.indexOf("chancery") != -1) || - (font_name_lc.indexOf("zapfino") != -1)) + if( (style.indexOf("script") != -1) || + (style.indexOf("chancery") != -1) ) { rDFA.SetFamilyType( FAMILY_SCRIPT ); } - else if( (font_name_lc.indexOf("comic") != -1) || - (font_name_lc.indexOf("outline") != -1) || - (font_name_lc.indexOf("pinpoint") != -1) ) + else if( (style.indexOf("comic") != -1) || + (style.indexOf("outline") != -1) || + (style.indexOf("pinpoint") != -1) ) { rDFA.SetFamilyType( FAMILY_DECORATIVE ); } - else if( (font_name_lc.indexOf("sans") != -1) || - (font_name_lc.indexOf("arial") != -1) ) + else if( (style.indexOf("sans") != -1) ) { rDFA.SetFamilyType( FAMILY_SWISS ); } - else if( (font_name_lc.indexOf("roman") != -1) || - (font_name_lc.indexOf("times") != -1) ) + else if( (style.indexOf("roman") != -1) ) { rDFA.SetFamilyType( FAMILY_ROMAN ); } commit e0d38b6656ee348690f5495e72067f4ac2ed49da Author: Tor Lillqvist <t...@iki.fi> Date: Wed Apr 3 23:24:33 2013 +0300 Add missing break Change-Id: I938b512dc3a32af9f2529a92ea3e4291abf64ad2 diff --git a/vcl/coretext/salcoretextfontutils.cxx b/vcl/coretext/salcoretextfontutils.cxx index 0c1342f..eef05c3 100644 --- a/vcl/coretext/salcoretextfontutils.cxx +++ b/vcl/coretext/salcoretextfontutils.cxx @@ -113,6 +113,7 @@ static bool GetDevFontAttributes( CTFontDescriptorRef font_descriptor, ImplDevFo break; case kCTFontSansSerifClass: rDFA.SetFamilyType( FAMILY_SWISS ); + break; case kCTFontOrnamentalsClass: rDFA.SetFamilyType( FAMILY_DECORATIVE ); break; commit 965f58fa51d51f1d313a2935b13edd1fcbb32b22 Author: Tor Lillqvist <t...@iki.fi> Date: Wed Apr 3 23:21:57 2013 +0300 Fix heap corruption As its name says, CFDictionaryGetValue() follows "The Get Rule", i.e. you don't have ownership of the object returned, so it shouldn't be released. Change-Id: Ie605ac21754ed479911d8f4ceb00744a6df600aa diff --git a/vcl/coretext/salcoretextfontutils.cxx b/vcl/coretext/salcoretextfontutils.cxx index 3f64d3b..0c1342f 100644 --- a/vcl/coretext/salcoretextfontutils.cxx +++ b/vcl/coretext/salcoretextfontutils.cxx @@ -76,7 +76,6 @@ static bool GetDevFontAttributes( CTFontDescriptorRef font_descriptor, ImplDevFo CFDictionaryRef traits = (CFDictionaryRef)CTFontDescriptorCopyAttribute(font_descriptor, kCTFontTraitsAttribute); CFNumberRef symbolics = (CFNumberRef)CFDictionaryGetValue(traits, kCTFontSymbolicTrait); CFNumberGetValue(symbolics, kCFNumberIntType, &value); - CFRelease(symbolics); if(value & kCTFontMonoSpaceTrait) { commit 5f18619f937bf3587b57ed88dbefc03cebb9dd17 Author: Tor Lillqvist <t...@iki.fi> Date: Wed Apr 3 23:17:52 2013 +0300 Add the vcl coretext sources Change-Id: I433419e1ed7bda566bb13bf14346948d131abee6 diff --git a/ios/experimental/LibreOffice/LibreOffice.xcodeproj/project.pbxproj b/ios/experimental/LibreOffice/LibreOffice.xcodeproj/project.pbxproj index ee24e75..4430b6c 100644 --- a/ios/experimental/LibreOffice/LibreOffice.xcodeproj/project.pbxproj +++ b/ios/experimental/LibreOffice/LibreOffice.xcodeproj/project.pbxproj @@ -58,6 +58,10 @@ BE9086FF16FF02B3004400A1 /* svptext.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = svptext.cxx; path = ../../../../vcl/headless/svptext.cxx; sourceTree = "<group>"; }; BE90870016FF02B3004400A1 /* svpvd.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = svpvd.cxx; path = ../../../../vcl/headless/svpvd.cxx; sourceTree = "<group>"; }; BE954A2E1704F9500040D517 /* iosinst.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = iosinst.cxx; path = ../../../../vcl/ios/iosinst.cxx; sourceTree = "<group>"; }; + BEA86895170B3FC20043E44B /* salcoretextfontutils.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = salcoretextfontutils.cxx; path = ../../../../vcl/coretext/salcoretextfontutils.cxx; sourceTree = "<group>"; }; + BEA86896170B3FC20043E44B /* salcoretextlayout.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = salcoretextlayout.cxx; path = ../../../../vcl/coretext/salcoretextlayout.cxx; sourceTree = "<group>"; }; + BEA86897170B3FC20043E44B /* salcoretextstyle.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = salcoretextstyle.cxx; path = ../../../../vcl/coretext/salcoretextstyle.cxx; sourceTree = "<group>"; }; + BEA86898170B3FC20043E44B /* salgdi.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = salgdi.cxx; path = ../../../../vcl/coretext/salgdi.cxx; sourceTree = "<group>"; }; BEBF3E3A17002D0200C454AC /* svapp.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = svapp.cxx; path = ../../../../vcl/source/app/svapp.cxx; sourceTree = "<group>"; }; BEBF3E3B17002D0200C454AC /* svmain.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = svmain.cxx; path = ../../../../vcl/source/app/svmain.cxx; sourceTree = "<group>"; }; BEBF3E3C17002D4C00C454AC /* frame.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = frame.cxx; path = ../../../../framework/source/services/frame.cxx; sourceTree = "<group>"; }; @@ -109,6 +113,7 @@ BEBF3E3D17002D6900C454AC /* window.cxx */, BEBF3E3A17002D0200C454AC /* svapp.cxx */, BEBF3E3B17002D0200C454AC /* svmain.cxx */, + BEA86899170B3FCB0043E44B /* coretext */, BE2F0A0C17077A2F0060FE0D /* headless */, ); name = vcl; @@ -223,6 +228,17 @@ name = Resources; sourceTree = "<group>"; }; + BEA86899170B3FCB0043E44B /* coretext */ = { + isa = PBXGroup; + children = ( + BEA86895170B3FC20043E44B /* salcoretextfontutils.cxx */, + BEA86896170B3FC20043E44B /* salcoretextlayout.cxx */, + BEA86897170B3FC20043E44B /* salcoretextstyle.cxx */, + BEA86898170B3FC20043E44B /* salgdi.cxx */, + ); + name = coretext; + sourceTree = "<group>"; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ commit 4f879d0cd5396056994df6229f8162e122a69c51 Author: Tor Lillqvist <t...@iki.fi> Date: Wed Apr 3 23:13:35 2013 +0300 Checking the device orientation at this stage doesn't seem to work Change-Id: I0015f7d751cb0e45262774c19a120f428cb35af2 diff --git a/ios/experimental/LibreOffice/LibreOffice/lo.mm b/ios/experimental/LibreOffice/LibreOffice/lo.mm index 983839b..193a01f 100644 --- a/ios/experimental/LibreOffice/LibreOffice/lo.mm +++ b/ios/experimental/LibreOffice/LibreOffice/lo.mm @@ -133,10 +133,7 @@ extern "C" void lo_initialize(void) { - if (UIDeviceOrientationIsPortrait([[UIDevice currentDevice] orientation])) - setenv("SAL_LOG", "+WARN+INFO.vcl.headless+INFO.vcl.ios", 1); - else - setenv("SAL_LOG", "-WARN-INFO", 1); + setenv("SAL_LOG", "+WARN+INFO.vcl.headless+INFO.vcl.coretext+INFO.vcl.ios", 1); const char *argv[] = { "placeholder-exe", _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits