2 * Copyright 2020 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef SkCTFont_DEFINED
9 #define SkCTFont_DEFINED
11 #include "include/core/SkTypes.h"
12 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
14 #ifdef SK_BUILD_FOR_MAC
15 #import <ApplicationServices/ApplicationServices.h>
18 #ifdef SK_BUILD_FOR_IOS
19 #include <CoreGraphics/CoreGraphics.h>
22 enum class SkCTFontSmoothBehavior {
23 none, // SmoothFonts produces no effect.
24 some, // SmoothFonts produces some effect, but not subpixel coverage.
25 subpixel, // SmoothFonts produces some effect and provides subpixel coverage.
28 SkCTFontSmoothBehavior SkCTFontGetSmoothBehavior();
30 using SkCTFontWeightMapping = const CGFloat[11];
32 /** Returns the [-1, 1] CTFontDescriptor weights for the
33 * <0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000> CSS weights.
35 * It is assumed that the values will be interpolated linearly between these points.
36 * NSFontWeightXXX were added in 10.11, appear in 10.10, but do not appear in 10.9.
37 * The actual values appear to be stable, but they may change without notice.
38 * These values are valid for system fonts only.
40 SkCTFontWeightMapping& SkCTFontGetNSFontWeightMapping();
42 /** Returns the [-1, 1] CTFontDescriptor weights for the
43 * <0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000> CSS weights.
45 * It is assumed that the values will be interpolated linearly between these points.
46 * The actual values appear to be stable, but they may change without notice.
47 * These values are valid for fonts created from data only.
49 SkCTFontWeightMapping& SkCTFontGetDataFontWeightMapping();
52 #endif // SkCTFontSmoothBehavior_DEFINED