[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 3 commits - vcl/aqua

Herbert Dürr hdu at apache.org
Tue Jan 28 06:08:00 PST 2014


 vcl/aqua/source/gdi/ctfonts.cxx |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

New commits:
commit a8cd1fab9a17df6179c31e1a73816f1bcd627a9b
Author: Herbert Dürr <hdu at apache.org>
Date:   Tue Jan 28 13:31:31 2014 +0000

    #i124121# prevent oblique/italic emulation with ITALIC_DONTKNOW fonts

diff --git a/vcl/aqua/source/gdi/ctfonts.cxx b/vcl/aqua/source/gdi/ctfonts.cxx
index fee1a20..d7f3a2d 100644
--- a/vcl/aqua/source/gdi/ctfonts.cxx
+++ b/vcl/aqua/source/gdi/ctfonts.cxx
@@ -111,8 +111,7 @@ CTTextStyle::CTTextStyle( const ImplFontSelectData& rFSD )
 
     // handle emulation of italic/oblique styles if requested and the font doesn't provide them
     if( ((pReqFont->meItalic == ITALIC_NORMAL) || (pReqFont->meItalic == ITALIC_OBLIQUE))
-    && (mpFontData->meItalic != ITALIC_NORMAL)
-    && (mpFontData->meItalic != ITALIC_OBLIQUE))
+    && (mpFontData->meItalic == ITALIC_NONE))
     {
         if( !pMatrix)
             pMatrix = &(aMatrix = CGAffineTransformIdentity);
commit 6e08208380b1776ab8b84be5a3970770512bf9ef
Author: Herbert Dürr <hdu at apache.org>
Date:   Tue Jan 28 13:12:22 2014 +0000

    #i124122# emulate bold font weights for CoreText if needed

diff --git a/vcl/aqua/source/gdi/ctfonts.cxx b/vcl/aqua/source/gdi/ctfonts.cxx
index 4f538dd..fee1a20 100644
--- a/vcl/aqua/source/gdi/ctfonts.cxx
+++ b/vcl/aqua/source/gdi/ctfonts.cxx
@@ -141,6 +141,16 @@ CTTextStyle::CTTextStyle( const ImplFontSelectData& rFSD )
     CFDictionarySetValue( mpStyleDict, kCTFontAttributeName, pNewCTFont );
     CFRelease( pNewCTFont);
 
+    // handle emulation of bold styles if requested and the font that doesn't provide them
+    if( (pReqFont->meWeight > WEIGHT_MEDIUM)
+    &&  (mpFontData->meWeight <= WEIGHT_MEDIUM)
+    &&  (mpFontData->meWeight != WEIGHT_DONTKNOW))
+    {
+        const int nBoldFactor = -lrint( (3.5F * pReqFont->meWeight) / mpFontData->meWeight);
+        CFNumberRef pCFIntBold = CFNumberCreate( NULL, kCFNumberIntType, &nBoldFactor);
+        CFDictionarySetValue( mpStyleDict, kCTStrokeWidthAttributeName, pCFIntBold);
+    }
+
 #if 0 // LastResort is implicit in CoreText's font cascading
     const void* aGFBDescriptors[] = { CTFontDescriptorCreateWithNameAndSize( CFSTR("LastResort"), 0) }; // TODO: use the full GFB list
     const int nGfbCount = sizeof(aGFBDescriptors) / sizeof(*aGFBDescriptors);
commit 2a589af317926bf7289f6738434df8160354663c
Author: Herbert Dürr <hdu at apache.org>
Date:   Tue Jan 28 12:41:54 2014 +0000

    #i124121# emulate oblique/italic for CoreText fonts without such styles

diff --git a/vcl/aqua/source/gdi/ctfonts.cxx b/vcl/aqua/source/gdi/ctfonts.cxx
index 53a98e0..4f538dd 100644
--- a/vcl/aqua/source/gdi/ctfonts.cxx
+++ b/vcl/aqua/source/gdi/ctfonts.cxx
@@ -109,6 +109,16 @@ CTTextStyle::CTTextStyle( const ImplFontSelectData& rFSD )
         pMatrix = &aMatrix;
     }
 
+    // handle emulation of italic/oblique styles if requested and the font doesn't provide them
+    if( ((pReqFont->meItalic == ITALIC_NORMAL) || (pReqFont->meItalic == ITALIC_OBLIQUE))
+    && (mpFontData->meItalic != ITALIC_NORMAL)
+    && (mpFontData->meItalic != ITALIC_OBLIQUE))
+    {
+        if( !pMatrix)
+            pMatrix = &(aMatrix = CGAffineTransformIdentity);
+        aMatrix = CGAffineTransformConcat(aMatrix, CGAffineTransformMake( 1, 0, 0.375F, 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,


More information about the Libreoffice-commits mailing list