29#if defined(SK_BUILD_FOR_WIN) && (defined(SK_FONTMGR_GDI_AVAILABLE) || \
30 defined(SK_FONTMGR_DIRECTWRITE_AVAILABLE))
34#if defined(SK_BUILD_FOR_ANDROID) && defined(SK_FONTMGR_ANDROID_AVAILABLE)
39#if defined(SK_FONTMGR_CORETEXT_AVAILABLE) && (defined(SK_BUILD_FOR_IOS) || \
40 defined(SK_BUILD_FOR_MAC))
44#if defined(SK_FONTMGR_FONTATIONS_AVAILABLE)
48#if defined(SK_FONTMGR_FONTCONFIG_AVAILABLE)
52#if defined(SK_FONTMGR_FREETYPE_DIRECTORY_AVAILABLE)
56#if defined(SK_FONTMGR_FREETYPE_EMPTY_AVAILABLE)
64 "If true, use native font manager and rendering. "
65 "If false, fonts will draw as portably as possible.");
66#if defined(SK_BUILD_FOR_WIN)
67static DEFINE_bool(gdi,
false,
"Use GDI instead of DirectWrite for font rendering.");
69#if defined(SK_FONTMGR_FONTATIONS_AVAILABLE)
70static DEFINE_bool(fontations,
false,
"Use Fontations for native font rendering.");
76#if defined(SK_BUILD_FOR_WIN)
77 filename =
"fonts/planetcolr.ttf";
78#elif defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
79 filename =
"fonts/planetsbix.ttf";
81 filename =
"fonts/planetcbdt.ttf";
89 return planetTypeface;
95#if defined(SK_BUILD_FOR_WIN)
97#elif defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
152 const float upem = 200;
172 builder.setMetrics(metrics, 1.0f/upem);
177 for (
SkGlyphID index = 0; index <= 67; ++index) {
217 canvas.
clear(0x00000000);
239#ifndef SK_FONT_FILE_PREFIX
240# if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
241# define SK_FONT_FILE_PREFIX "/System/Library/Fonts/"
243# define SK_FONT_FILE_PREFIX "/usr/share/fonts/"
251 if (!FLAGS_nativeFonts) {
254#if defined(SK_BUILD_FOR_WIN) && defined(SK_FONTMGR_GDI_AVAILABLE)
255 else if (FLAGS_gdi) {
256 mgr = SkFontMgr_New_GDI();
259#if defined(SK_FONTMGR_FONTATIONS_AVAILABLE)
260 else if (FLAGS_fontations) {
265#if defined(SK_BUILD_FOR_ANDROID) && defined(SK_FONTMGR_ANDROID_AVAILABLE)
267#elif defined(SK_BUILD_FOR_WIN) && defined(SK_FONTMGR_DIRECTWRITE_AVAILABLE)
268 mgr = SkFontMgr_New_DirectWrite();
269#elif defined(SK_FONTMGR_CORETEXT_AVAILABLE) && (defined(SK_BUILD_FOR_IOS) || \
270 defined(SK_BUILD_FOR_MAC))
272#elif defined(SK_FONTMGR_FONTCONFIG_AVAILABLE)
274#elif defined(SK_FONTMGR_FREETYPE_DIRECTORY_AVAILABLE)
278#elif defined(SK_FONTMGR_FREETYPE_EMPTY_AVAILABLE)
290 if (!FLAGS_nativeFonts) {
293#if defined(SK_BUILD_FOR_WIN)
std::unique_ptr< SkStreamAsset > GetResourceAsStream(const char *resource, bool useFileStream)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
#define SkASSERT_RELEASE(cond)
SK_API sk_sp< SkFontMgr > SkFontMgr_New_Fontations_Empty()
SK_API sk_sp< SkFontMgr > SkFontMgr_New_Android(const SkFontMgr_Android_CustomFonts *custom)
SK_API sk_sp< SkFontMgr > SkFontMgr_New_Custom_Directory(const char *dir)
SK_API sk_sp< SkFontMgr > SkFontMgr_New_Custom_Empty()
SK_API sk_sp< SkFontMgr > SkFontMgr_New_FontConfig(FcConfig *fc)
SK_API sk_sp< SkFontMgr > SkFontMgr_New_CoreText(CTFontCollectionRef)
@ kUTF8
uses bytes to represent UTF-8 or ASCII
static SkString resource(SkPDFResourceType type, int index)
sk_sp< T > sk_ref_sp(T *obj)
sk_sp< SkImage > asImage() const
void drawSimpleText(const void *text, size_t byteLength, SkTextEncoding encoding, SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
void clear(SkColor color)
static sk_sp< SkFontMgr > RefEmpty()
sk_sp< SkTypeface > makeFromStream(std::unique_ptr< SkStreamAsset >, int ttcIndex=0) const
sk_sp< SkTypeface > legacyMakeTypeface(const char familyName[], SkFontStyle style) const
static SkMatrix Scale(SkScalar sx, SkScalar sy)
static SkPath Circle(SkScalar center_x, SkScalar center_y, SkScalar radius, SkPathDirection dir=SkPathDirection::kCW)
uint32_t uint32_t * format
DEF_SWITCHES_START aot vmservice shared library name
font
Font Metadata and Metrics.
SkScalar fTop
greatest extent above origin of any glyph bounding box, typically negative; deprecated with variable ...
SkScalar fLeading
distance to add between lines, typically positive or zero
SkScalar fAvgCharWidth
average character width, zero if unknown
SkScalar fStrikeoutPosition
distance from baseline to bottom of stroke, typically negative
SkScalar fStrikeoutThickness
strikeout thickness
SkScalar fMaxCharWidth
maximum character width, zero if unknown
SkScalar fBottom
greatest extent below origin of any glyph bounding box, typically positive; deprecated with variable ...
uint32_t fFlags
FontMetricsFlags indicating which metrics are valid.
SkScalar fAscent
distance to reserve above baseline, typically negative
SkScalar fXHeight
height of lower-case 'x', zero if unknown, typically negative
SkScalar fUnderlineThickness
underline thickness
SkScalar fDescent
distance to reserve below baseline, typically positive
SkScalar fCapHeight
height of an upper-case letter, zero if unknown, typically negative
SkScalar fXMin
greatest extent to left of origin of any glyph bounding box, typically negative; deprecated with vari...
SkScalar fUnderlinePosition
distance from baseline to top of stroke, typically positive
SkScalar fXMax
greatest extent to right of origin of any glyph bounding box, typically positive; deprecated with var...
static SkImageInfo MakeS32(int width, int height, SkAlphaType at)