2 * Copyright (C) 2014 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #include <CoreText/CoreText.h>
31 #if USE(APPLE_INTERNAL_SDK)
33 #include <CoreText/CoreTextPriv.h>
38 kCTFontUIFontSystemItalic = 27,
39 kCTFontUIFontSystemThin = 102,
40 kCTFontUIFontSystemLight = 103,
41 kCTFontUIFontSystemUltraLight = 104,
48 typedef const UniChar* (*CTUniCharProviderCallback)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void* refCon);
49 typedef void (*CTUniCharDisposeCallback)(const UniChar* chars, void* refCon);
51 extern const CFStringRef kCTFontReferenceURLAttribute;
54 #if !USE(APPLE_INTERNAL_SDK)
55 typedef CF_OPTIONS(uint32_t, CTFontTransformOptions)
57 kCTFontTransformApplyShaping = (1 << 0),
58 kCTFontTransformApplyPositioning = (1 << 1)
61 bool CTFontTransformGlyphs(CTFontRef, CGGlyph glyphs[], CGSize advances[], CFIndex count, CTFontTransformOptions);
64 CGSize CTRunGetInitialAdvance(CTRunRef run);
65 CTLineRef CTLineCreateWithUniCharProvider(CTUniCharProviderCallback provide, CTUniCharDisposeCallback dispose, void* refCon);
66 CTTypesetterRef CTTypesetterCreateWithUniCharProviderAndOptions(CTUniCharProviderCallback provide, CTUniCharDisposeCallback dispose, void* refCon, CFDictionaryRef options);
67 bool CTFontGetVerticalGlyphsForCharacters(CTFontRef, const UniChar characters[], CGGlyph glyphs[], CFIndex count);
68 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED > 101000
69 void CTFontSetRenderingParameters(CTFontRef, CGContextRef);
72 CTFontDescriptorRef CTFontDescriptorCreateForUIType(CTFontUIFontType, CGFloat size, CFStringRef language);
73 CTFontDescriptorRef CTFontDescriptorCreateWithTextStyle(CFStringRef style, CFStringRef size, CFStringRef language);
76 #if !USE(APPLE_INTERNAL_SDK)
77 typedef CF_OPTIONS(uint32_t, CTFontDescriptorOptions)
79 kCTFontDescriptorOptionSystemUIFont = 1 << 1,
80 kCTFontDescriptorOptionPreferAppleSystemFont = kCTFontOptionsPreferSystemFont
83 CTFontDescriptorRef CTFontDescriptorCreateWithAttributesAndOptions(CFDictionaryRef attributes, CTFontDescriptorOptions);
87 bool CTFontDescriptorIsSystemUIFont(CTFontDescriptorRef);
88 CTFontRef CTFontCreateForCSS(CFStringRef name, uint16_t weight, CTFontSymbolicTraits, CGFloat size);
90 #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 10100
91 extern const CFStringRef kCTUIFontTextStyleShortHeadline;
92 extern const CFStringRef kCTUIFontTextStyleShortBody;
93 extern const CFStringRef kCTUIFontTextStyleShortSubhead;
94 extern const CFStringRef kCTUIFontTextStyleShortFootnote;
95 extern const CFStringRef kCTUIFontTextStyleShortCaption1;
96 extern const CFStringRef kCTUIFontTextStyleTallBody;
98 extern const CFStringRef kCTUIFontTextStyleHeadline;
99 extern const CFStringRef kCTUIFontTextStyleBody;
100 extern const CFStringRef kCTUIFontTextStyleSubhead;
101 extern const CFStringRef kCTUIFontTextStyleFootnote;
102 extern const CFStringRef kCTUIFontTextStyleCaption1;
103 extern const CFStringRef kCTUIFontTextStyleCaption2;
105 extern const CFStringRef kCTFontDescriptorTextStyleEmphasized;
108 #if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000
109 extern const CFStringRef kCTUIFontTextStyleTitle1;
110 extern const CFStringRef kCTUIFontTextStyleTitle2;
111 extern const CFStringRef kCTUIFontTextStyleTitle3;
112 CTFontDescriptorRef CTFontCreatePhysicalFontDescriptorForCharactersWithLanguage(CTFontRef currentFont, const UTF16Char* characters, CFIndex length, CFStringRef language, CFIndex* coveredLength);
115 CTFontRef CTFontCreatePhysicalFontForCharactersWithLanguage(CTFontRef, const UTF16Char* characters, CFIndex length, CFStringRef language, CFIndex* coveredLength);
116 bool CTFontIsAppleColorEmoji(CTFontRef);
117 bool CTFontDescriptorIsSystemUIFont(CTFontDescriptorRef);
118 CTFontRef CTFontCreateForCSS(CFStringRef name, uint16_t weight, CTFontSymbolicTraits, CGFloat size);
119 CTFontRef CTFontCreateForCharacters(CTFontRef currentFont, const UTF16Char *characters, CFIndex length, CFIndex *coveredLength);