vcl/coretext/ctfonts.cxx | 16 +++++++++++----- vcl/coretext/salgdi2.cxx | 25 ++++++++++++------------- 2 files changed, 23 insertions(+), 18 deletions(-)
New commits: commit de2cdeabfe18f6fbe2f0f9a7aa5d91bcf88d9fa2 Author: Khaled Hosny <khaledho...@eglug.org> Date: Sun Jun 30 14:40:37 2013 +0200 Handle synthetic italic with Core Text Core Text does not fake missing italic and bold (unlike ATSUI), so we have to do it on our own. This commit handles fake italic, bold is a bit harder. Change-Id: I4e705669638f67e3c8ec414f2cadd0c6daea9bcb diff --git a/vcl/coretext/ctfonts.cxx b/vcl/coretext/ctfonts.cxx index 9caf4f4..f5e1a98 100644 --- a/vcl/coretext/ctfonts.cxx +++ b/vcl/coretext/ctfonts.cxx @@ -72,15 +72,21 @@ CTTextStyle::CTTextStyle( const FontSelectPattern& rFSD ) mfFontRotation = pReqFont->mnOrientation * (M_PI / 1800.0); // handle font stretching if any - const CGAffineTransform* pMatrix = NULL; - CGAffineTransform aMatrix; + CGAffineTransform aMatrix = CGAffineTransformMakeScale(1.0, 1.0); if( (pReqFont->mnWidth != 0) && (pReqFont->mnWidth != pReqFont->mnHeight) ) { mfFontStretch = (float)pReqFont->mnWidth / pReqFont->mnHeight; - aMatrix = CGAffineTransformMakeScale( mfFontStretch, 1.0F ); - pMatrix = &aMatrix; + aMatrix = CGAffineTransformConcat(aMatrix, CGAffineTransformMakeScale(mfFontStretch, 1.0F)); } + // fake bold + if ((pReqFont->GetWeight() >= WEIGHT_BOLD) && (mpFontData->GetWeight() < WEIGHT_SEMIBOLD)) + /* XXX */; + // fake italic + if (((pReqFont->GetSlant() == ITALIC_NORMAL) || (pReqFont->GetSlant() == ITALIC_OBLIQUE)) + && !((mpFontData->GetSlant() == ITALIC_NORMAL) || (mpFontData->GetSlant() == ITALIC_OBLIQUE))) + aMatrix = CGAffineTransformConcat(aMatrix, CGAffineTransformMake(1, 0, tanf(14 * acosf(0) / 90), 1, 0, 0)); + // create the style object for CoreText font attributes static const CFIndex nMaxDictSize = 16; // TODO: does this really suffice? mpStyleDict = CFDictionaryCreateMutable( NULL, nMaxDictSize, @@ -90,7 +96,7 @@ CTTextStyle::CTTextStyle( const FontSelectPattern& rFSD ) CFDictionarySetValue( mpStyleDict, kCTVerticalFormsAttributeName, pCFVertBool ); CTFontDescriptorRef pFontDesc = (CTFontDescriptorRef)mpFontData->GetFontId(); - CTFontRef pNewCTFont = CTFontCreateWithFontDescriptor( pFontDesc, fScaledFontHeight, pMatrix ); + CTFontRef pNewCTFont = CTFontCreateWithFontDescriptor( pFontDesc, fScaledFontHeight, &aMatrix ); CFDictionarySetValue( mpStyleDict, kCTFontAttributeName, pNewCTFont ); CFRelease( pNewCTFont); commit 3ed5b347c5916be5c119ecd1fd2239585a512e55 Author: Khaled Hosny <khaledho...@eglug.org> Date: Sun Jun 30 12:04:27 2013 +0200 Fix debug code Change-Id: If8cd564b03712a8835788386afd83cc97ce04a98 diff --git a/vcl/coretext/salgdi2.cxx b/vcl/coretext/salgdi2.cxx index 48f2f26..c99c90a 100644 --- a/vcl/coretext/salgdi2.cxx +++ b/vcl/coretext/salgdi2.cxx @@ -485,19 +485,18 @@ sal_uInt16 AquaSalGraphics::SetFont( FontSelectPattern* pReqFont, int /*nFallbac mpMacTextStyle = mpMacFontData->CreateMacTextStyle( *pReqFont ); mpMacTextStyle->SetTextColor( maTextColor ); -#if OSL_DEBUG_LEVEL > 3 - fprintf( stderr, "SetFont to (\"%s\", \"%s\", fontid=%d) for (\"%s\" \"%s\" weight=%d, slant=%d size=%dx%d orientation=%d)\n", - OUStringToOString( mpMacFontData->GetFamilyName(), RTL_TEXTENCODING_UTF8 ).getStr(), - OUStringToOString( mpMacFontData->GetStyleName(), RTL_TEXTENCODING_UTF8 ).getStr(), - (int)nFontID, - OUStringToOString( pReqFont->GetFamilyName(), RTL_TEXTENCODING_UTF8 ).getStr(), - OUStringToOString( pReqFont->GetStyleName(), RTL_TEXTENCODING_UTF8 ).getStr(), - pReqFont->GetWeight(), - pReqFont->GetSlant(), - pReqFont->mnHeight, - pReqFont->mnWidth, - pReqFont->mnOrientation); -#endif + SAL_INFO("vcl.coretext", + "SetFont" + << " to " << mpMacFontData->GetFamilyName() + << ", " << mpMacFontData->GetStyleName() + << " fontid=" << mpMacFontData->GetFontId() + << " for " << pReqFont->GetFamilyName() + << ", " << pReqFont->GetStyleName() + << " weight=" << pReqFont->GetWeight() + << " slant=" << pReqFont->GetSlant() + << " size=" << pReqFont->mnHeight << "x" << pReqFont->mnWidth + << " orientation=" << pReqFont->mnOrientation + ); return 0; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits