| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2012 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2006 Alexey Proskuryakov | 3 * Copyright (C) 2006 Alexey Proskuryakov |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "platform/fonts/SimpleFontData.h" | 28 #include "platform/fonts/SimpleFontData.h" |
| 29 | 29 |
| 30 #include <ApplicationServices/ApplicationServices.h> | 30 #include <ApplicationServices/ApplicationServices.h> |
| 31 | 31 |
| 32 namespace WebCore { | 32 namespace WebCore { |
| 33 | 33 |
| 34 CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typese
ttingFeatures, FontOrientation orientation) const | 34 CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typese
ttingFeatures, FontOrientation orientation) const |
| 35 { | 35 { |
| 36 unsigned key = typesettingFeatures + 1; | 36 unsigned key = typesettingFeatures + 1; |
| 37 HashMap<unsigned, RetainPtr<CFDictionaryRef> >::AddResult addResult = m_CFSt
ringAttributes.add(key, RetainPtr<CFDictionaryRef>()); | 37 HashMap<unsigned, RetainPtr<CFDictionaryRef> >::AddResult addResult = m_CFSt
ringAttributes.add(key, RetainPtr<CFDictionaryRef>()); |
| 38 RetainPtr<CFDictionaryRef>& attributesDictionary = addResult.iterator->value
; | 38 RetainPtr<CFDictionaryRef>& attributesDictionary = addResult.storedValue->va
lue; |
| 39 if (!addResult.isNewEntry) | 39 if (!addResult.isNewEntry) |
| 40 return attributesDictionary.get(); | 40 return attributesDictionary.get(); |
| 41 | 41 |
| 42 attributesDictionary.adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault,
4, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); | 42 attributesDictionary.adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault,
4, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); |
| 43 CFMutableDictionaryRef mutableAttributes = (CFMutableDictionaryRef)attribute
sDictionary.get(); | 43 CFMutableDictionaryRef mutableAttributes = (CFMutableDictionaryRef)attribute
sDictionary.get(); |
| 44 | 44 |
| 45 CFDictionarySetValue(mutableAttributes, kCTFontAttributeName, platformData()
.ctFont()); | 45 CFDictionarySetValue(mutableAttributes, kCTFontAttributeName, platformData()
.ctFont()); |
| 46 | 46 |
| 47 if (!(typesettingFeatures & Kerning)) { | 47 if (!(typesettingFeatures & Kerning)) { |
| 48 const float zero = 0; | 48 const float zero = 0; |
| 49 static CFNumberRef zeroKerningValue = CFNumberCreate(kCFAllocatorDefault
, kCFNumberFloatType, &zero); | 49 static CFNumberRef zeroKerningValue = CFNumberCreate(kCFAllocatorDefault
, kCFNumberFloatType, &zero); |
| 50 CFDictionarySetValue(mutableAttributes, kCTKernAttributeName, zeroKernin
gValue); | 50 CFDictionarySetValue(mutableAttributes, kCTKernAttributeName, zeroKernin
gValue); |
| 51 } | 51 } |
| 52 | 52 |
| 53 bool allowLigatures = (orientation == Horizontal && platformData().allowsLig
atures()) || (typesettingFeatures & Ligatures); | 53 bool allowLigatures = (orientation == Horizontal && platformData().allowsLig
atures()) || (typesettingFeatures & Ligatures); |
| 54 if (!allowLigatures) { | 54 if (!allowLigatures) { |
| 55 const int zero = 0; | 55 const int zero = 0; |
| 56 static CFNumberRef essentialLigaturesValue = CFNumberCreate(kCFAllocator
Default, kCFNumberIntType, &zero); | 56 static CFNumberRef essentialLigaturesValue = CFNumberCreate(kCFAllocator
Default, kCFNumberIntType, &zero); |
| 57 CFDictionarySetValue(mutableAttributes, kCTLigatureAttributeName, essent
ialLigaturesValue); | 57 CFDictionarySetValue(mutableAttributes, kCTLigatureAttributeName, essent
ialLigaturesValue); |
| 58 } | 58 } |
| 59 | 59 |
| 60 if (orientation == Vertical) | 60 if (orientation == Vertical) |
| 61 CFDictionarySetValue(mutableAttributes, kCTVerticalFormsAttributeName, k
CFBooleanTrue); | 61 CFDictionarySetValue(mutableAttributes, kCTVerticalFormsAttributeName, k
CFBooleanTrue); |
| 62 | 62 |
| 63 return attributesDictionary.get(); | 63 return attributesDictionary.get(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace WebCore | 66 } // namespace WebCore |
| OLD | NEW |