Author: hdu
Date: Tue Jan 28 13:12:22 2014
New Revision: 1562059

URL: http://svn.apache.org/r1562059
Log:
#i124122# emulate bold font weights for CoreText if needed

Modified:
    openoffice/trunk/main/vcl/aqua/source/gdi/ctfonts.cxx

Modified: openoffice/trunk/main/vcl/aqua/source/gdi/ctfonts.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/aqua/source/gdi/ctfonts.cxx?rev=1562059&r1=1562058&r2=1562059&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/aqua/source/gdi/ctfonts.cxx (original)
+++ openoffice/trunk/main/vcl/aqua/source/gdi/ctfonts.cxx Tue Jan 28 13:12:22 
2014
@@ -141,6 +141,16 @@ CTTextStyle::CTTextStyle( const ImplFont
        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);


Reply via email to