/*
* Copyright 2020 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "include/core/SkTypes.h"
#if defined (SK_BUILD_FOR_MAC) ||
defined (SK_BUILD_FOR_IOS)
#include "include/core/SkData.h"
#include "include/core/SkRefCnt.h"
#include "include/private/base/SkOnce.h"
#include "src/sfnt/SkOTTable_OS_2.h"
#include "src/sfnt/SkSFNTHeader.h"
#include "src/utils/mac/SkCTFont.h"
#include "src/utils/mac/SkUniqueCFRef.h"
#ifdef SK_BUILD_FOR_MAC
#import <ApplicationServices/ApplicationServices.h>
#endif
#ifdef SK_BUILD_FOR_IOS
#include <CoreText/CoreText.h>
#include <CoreText/CTFontManager.h>
#include <CoreGraphics/CoreGraphics.h>
#include <CoreFoundation/CoreFoundation.h>
#endif
#include <dlfcn.h>
static constexpr CGBitmapInfo kBitmapInfoRGB = ((CGBitmapInfo)kCGImageAlphaNoneSkipFi
rst |
kCGBitmapByteOrder32Host);
/** Drawn in FontForge, reduced with fonttools ttx, converted by xxd -i,
* this TrueType font contains a glyph of the spider.
*
* To re-forge the original bytes of the TrueType font file,
* remove all ',|( +0x)' from this definition,
* copy the data to the clipboard,
* run 'pbpaste | xxd -p -r - spider.ttf'.
*/
static constexpr const uint8_t kSpiderSymbol_ttf[] = {
0 x00, 0 x01, 0 x00, 0 x00, 0 x00, 0 x0c, 0 x00, 0 x80, 0 x00, 0 x03, 0 x00, 0 x40,
0 x47, 0 x44, 0 x45, 0 x46, 0 x00, 0 x14, 0 x00, 0 x14, 0 x00, 0 x00, 0 x07, 0 xa8,
0 x00, 0 x00, 0 x00, 0 x18, 0 x4f, 0 x53, 0 x2f, 0 x32, 0 x8a, 0 xf4, 0 xfb, 0 xdb,
0 x00, 0 x00, 0 x01, 0 x48, 0 x00, 0 x00, 0 x00, 0 x60, 0 x63, 0 x6d, 0 x61, 0 x70,
0 xe0, 0 x7f, 0 x10, 0 x7e, 0 x00, 0 x00, 0 x01, 0 xb8, 0 x00, 0 x00, 0 x00, 0 x54,
0 x67, 0 x61, 0 x73, 0 x70, 0 xff, 0 xff, 0 x00, 0 x03, 0 x00, 0 x00, 0 x07, 0 xa0,
0 x00, 0 x00, 0 x00, 0 x08, 0 x67, 0 x6c, 0 x79, 0 x66, 0 x97, 0 x0b, 0 x6a, 0 xf6,
0 x00, 0 x00, 0 x02, 0 x18, 0 x00, 0 x00, 0 x03, 0 x40, 0 x68, 0 x65, 0 x61, 0 x64,
0 x0f, 0 xa2, 0 x24, 0 x1a, 0 x00, 0 x00, 0 x00, 0 xcc, 0 x00, 0 x00, 0 x00, 0 x36,
0 x68, 0 x68, 0 x65, 0 x61, 0 x0e, 0 xd3, 0 x07, 0 x3f, 0 x00, 0 x00, 0 x01, 0 x04,
0 x00, 0 x00, 0 x00, 0 x24, 0 x68, 0 x6d, 0 x74, 0 x78, 0 x10, 0 x03, 0 x00, 0 x44,
0 x00, 0 x00, 0 x01, 0 xa8, 0 x00, 0 x00, 0 x00, 0 x0e, 0 x6c, 0 x6f, 0 x63, 0 x61,
0 x01, 0 xb4, 0 x00, 0 x28, 0 x00, 0 x00, 0 x02, 0 x0c, 0 x00, 0 x00, 0 x00, 0 x0a,
0 x6d, 0 x61, 0 x78, 0 x70, 0 x00, 0 x4a, 0 x01, 0 x4d, 0 x00, 0 x00, 0 x01, 0 x28,
0 x00, 0 x00, 0 x00, 0 x20, 0 x6e, 0 x61, 0 x6d, 0 x65, 0 xc3, 0 xe5, 0 x39, 0 xd4,
0 x00, 0 x00, 0 x05, 0 x58, 0 x00, 0 x00, 0 x02, 0 x28, 0 x70, 0 x6f, 0 x73, 0 x74,
0 xff, 0 x03, 0 x00, 0 x67, 0 x00, 0 x00, 0 x07, 0 x80, 0 x00, 0 x00, 0 x00, 0 x20,
0 x00, 0 x01, 0 x00, 0 x00, 0 x00, 0 x01, 0 x00, 0 x00, 0 x0b, 0 x0f, 0 x08, 0 x1d,
0 x5f, 0 x0f, 0 x3c, 0 xf5, 0 x00, 0 x0b, 0 x08, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00,
0 xd1, 0 x97, 0 xa8, 0 x5a, 0 x00, 0 x00, 0 x00, 0 x00, 0 xd6, 0 xe8, 0 x32, 0 x33,
0 x00, 0 x03, 0 xff, 0 x3b, 0 x08, 0 x00, 0 x05, 0 x55, 0 x00, 0 x00, 0 x00, 0 x08,
0 x00, 0 x02, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x01, 0 x00, 0 x00,
0 x05, 0 x55, 0 xff, 0 x3b, 0 x01, 0 x79, 0 x08, 0 x00, 0 x00, 0 x03, 0 x00, 0 x00,
0 x08, 0 x00, 0 x00, 0 x01, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00,
0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x03, 0 x00, 0 x01, 0 x00, 0 x00,
0 x00, 0 x04, 0 x01, 0 x1c, 0 x00, 0 x04, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x02,
0 x00, 0 x00, 0 x00, 0 x01, 0 x00, 0 x01, 0 x00, 0 x00, 0 x00, 0 x40, 0 x00, 0 x2e,
0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x04, 0 x08, 0 x00, 0 x01, 0 x90, 0 x00, 0 x05,
0 x00, 0 x00, 0 x05, 0 x33, 0 x05, 0 x99, 0 x00, 0 x00, 0 x01, 0 x1e, 0 x05, 0 x33,
0 x05, 0 x99, 0 x00, 0 x00, 0 x03, 0 xd7, 0 x00, 0 x66, 0 x02, 0 x12, 0 x00, 0 x00,
0 x05, 0 x00, 0 x01, 0 x02, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00,
0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00,
0 x00, 0 x00, 0 x73, 0 x6b, 0 x69, 0 x61, 0 x00, 0 xc0, 0 x00, 0 x00, 0 xf0, 0 x21,
0 x06, 0 x66, 0 xfe, 0 x66, 0 x01, 0 x79, 0 x05, 0 x55, 0 x00, 0 xc5, 0 x80, 0 x00,
0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00,
0 x00, 0 x20, 0 x00, 0 x01, 0 x08, 0 x00, 0 x00, 0 x44, 0 x00, 0 x00, 0 x00, 0 x00,
0 x08, 0 x00, 0 x00, 0 x00, 0 x00, 0 x03, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x01,
0 x00, 0 x03, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x0c, 0 x00, 0 x04, 0 x00, 0 x48,
0 x00, 0 x00, 0 x00, 0 x0e, 0 x00, 0 x08, 0 x00, 0 x02, 0 x00, 0 x06, 0 x00, 0 x00,
0 x00, 0 x09, 0 x00, 0 x0d, 0 x00, 0 x1d, 0 x00, 0 x21, 0 xf0, 0 x21, 0 xff, 0 xff,
0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x08, 0 x00, 0 x0d, 0 x00, 0 x1d, 0 x00, 0 x21,
0 xf0, 0 x21, 0 xff, 0 xff, 0 x00, 0 x01, 0 xff, 0 xf9, 0 xff, 0 xf5, 0 xff, 0 xe4,
0 xff, 0 xe2, 0 x0f, 0 xe2, 0 x00, 0 x01, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00,
0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x14,
0 x00, 0 x14, 0 x00, 0 x14, 0 x01, 0 xa0, 0 x00, 0 x00, 0 x00, 0 x02, 0 x00, 0 x44,
0 x00, 0 x00, 0 x02, 0 x64, 0 x05, 0 x55, 0 x00, 0 x03, 0 x00, 0 x07, 0 x00, 0 x00,
0 x33, 0 x11, 0 x21, 0 x11, 0 x25, 0 x21, 0 x11, 0 x21, 0 x44, 0 x02, 0 x20, 0 xfe,
0 x24, 0 x01, 0 x98, 0 xfe, 0 x68, 0 x05, 0 x55, 0 xfa, 0 xab, 0 x44, 0 x04, 0 xcd,
0 x00, 0 x04, 0 x00, 0 x03, 0 xff, 0 x3b, 0 x08, 0 x00, 0 x05, 0 x4c, 0 x00, 0 x15,
0 x00, 0 x1d, 0 x00, 0 x25, 0 x01, 0 x1b, 0 x00, 0 x00, 0 x01, 0 x36, 0 x37, 0 x36,
0 x27, 0 x26, 0 x07, 0 x06, 0 x06, 0 x23, 0 x22, 0 x27, 0 x26, 0 x27, 0 x26, 0 x07,
0 x06, 0 x17, 0 x16, 0 x17, 0 x16, 0 x32, 0 x37, 0 x32, 0 x35, 0 x34, 0 x23, 0 x22,
0 x15, 0 x14, 0 x27, 0 x32, 0 x35, 0 x34, 0 x23, 0 x22, 0 x15, 0 x14, 0 x03, 0 x32,
0 x17, 0 x30, 0 x17, 0 x31, 0 x36, 0 x37, 0 x36, 0 x37, 0 x36, 0 x37, 0 x36, 0 x33,
0 x32, 0 x33, 0 x16, 0 x33, 0 x32, 0 x17, 0 x16, 0 x07, 0 x06, 0 x23, 0 x22, 0 x27,
0 x26, 0 x27, 0 x26, 0 x23, 0 x22, 0 x07, 0 x07, 0 x06, 0 x07, 0 x06, 0 x07, 0 x06,
0 x1f, 0 x02, 0 x37, 0 x36, 0 x37, 0 x36, 0 x33, 0 x32, 0 x17, 0 x17, 0 x16, 0 x33,
0 x16, 0 x17, 0 x16, 0 x07, 0 x06, 0 x23, 0 x22, 0 x27, 0 x27, 0 x26, 0 x23, 0 x22,
0 x07, 0 x06, 0 x07, 0 x06, 0 x17, 0 x16, 0 x17, 0 x16, 0 x33, 0 x32, 0 x33, 0 x32,
0 x37, 0 x36, 0 x37, 0 x36, 0 x17, 0 x16, 0 x1f, 0 x02, 0 x16, 0 x17, 0 x16, 0 x15,
0 x14, 0 x23, 0 x22, 0 x27, 0 x27, 0 x26, 0 x27, 0 x27, 0 x26, 0 x27, 0 x26, 0 x07,
0 x06, 0 x07, 0 x06, 0 x17, 0 x16, 0 x17, 0 x16, 0 x15, 0 x14, 0 x07, 0 x06, 0 x07,
0 x06, 0 x23, 0 x22, 0 x27, 0 x26, 0 x07, 0 x06, 0 x07, 0 x06, 0 x15, 0 x14, 0 x17,
0 x16, 0 x17, 0 x16, 0 x15, 0 x14, 0 x07, 0 x06, 0 x23, 0 x22, 0 x27, 0 x26, 0 x27,
0 x26, 0 x35, 0 x34, 0 x37, 0 x36, 0 x37, 0 x36, 0 x37, 0 x34, 0 x27, 0 x26, 0 x07,
0 x06, 0 x07, 0 x06, 0 x0f, 0 x02, 0 x06, 0 x23, 0 x22, 0 x27, 0 x26, 0 x35, 0 x34,
0 x37, 0 x37, 0 x36, 0 x37, 0 x36, 0 x37, 0 x36, 0 x37, 0 x36, 0 x27, 0 x26, 0 x27,
0 x26, 0 x07, 0 x06, 0 x07, 0 x06, 0 x07, 0 x06, 0 x07, 0 x07, 0 x06, 0 x23, 0 x22,
0 x27, 0 x26, 0 x35, 0 x34, 0 x37, 0 x36, 0 x37, 0 x37, 0 x36, 0 x37, 0 x37, 0 x36,
0 x37, 0 x36, 0 x37, 0 x36, 0 x35, 0 x34, 0 x27, 0 x26, 0 x27, 0 x26, 0 x27, 0 x26,
0 x23, 0 x22, 0 x07, 0 x06, 0 x07, 0 x06, 0 x07, 0 x06, 0 x27, 0 x26, 0 x27, 0 x26,
0 x27, 0 x26, 0 x35, 0 x34, 0 x37, 0 x36, 0 x37, 0 x36, 0 x37, 0 x36, 0 x33, 0 x32,
0 x17, 0 x16, 0 x33, 0 x32, 0 x37, 0 x36, 0 x35, 0 x34, 0 x37, 0 x36, 0 x37, 0 x36,
0 x33, 0 x04, 0 xf5, 0 x23, 0 x13, 0 x11, 0 x14, 0 x16, 0 x1d, 0 x1b, 0 x4c, 0 x1f,
0 x0e, 0 x2d, 0 x23, 0 x14, 0 x2c, 0 x13, 0 x18, 0 x25, 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 x2d,
0 x68, 0 x34, 0 x14, 0 x3c, 0 x25, 0 x12, 0 x04, 0 x10, 0 x18, 0 x0b, 0 x09, 0 x30,
0 x2b, 0 x44, 0 x66, 0 x14, 0 x47, 0 x47, 0 x59, 0 x73, 0 x25, 0 x05, 0 x03, 0 x1f,
0 x01, 0 x08, 0 x3f, 0 x48, 0 x4b, 0 x4b, 0 x76, 0 x2f, 0 x49, 0 x2d, 0 x22, 0 x24,
0 x0c, 0 x15, 0 x08, 0 x0e, 0 x33, 0 x03, 0 x44, 0 x4c, 0 x10, 0 x46, 0 x13, 0 x1f,
0 x27, 0 x1b, 0 x1d, 0 x13, 0 x02, 0 x24, 0 x08, 0 x02, 0 x42, 0 x0e, 0 x4d, 0 x3c,
0 x19, 0 x1b, 0 x40, 0 x2b, 0 x2b, 0 x1e, 0 x16, 0 x11, 0 x04, 0 x1f, 0 x11, 0 x04,
0 x18, 0 x11, 0 x35, 0 x01, 0 xa3, 0 x13, 0 x24, 0 x1f, 0 x0b, 0 x0c, 0 x19, 0 x19,
0 x18, 0 x13, 0 x0f, 0 x0c, 0 x1a, 0 x18, 0 x1f, 0 x19, 0 x1e, 0 x07, 0 x1a, 0 xc3,
0 x54, 0 x51, 0 x54, 0 x51, 0 x04, 0 x53, 0 x51, 0 x54, 0 x50, 0 x02, 0 x48, 0 x1a,
0 x31, 0 x18, 0 x55, 0 x74, 0 x04, 0 x0e, 0 x09, 0 x0d, 0 x06, 0 x10, 0 x16, 0 x1b,
0 x24, 0 x01, 0 x04, 0 x0b, 0 x04, 0 x10, 0 x3f, 0 x0a, 0 x41, 0 x02, 0 x41, 0 x20,
0 x06, 0 x12, 0 x16, 0 x21, 0 x17, 0 x2a, 0 x1e, 0 x15, 0 x40, 0 x27, 0 x11, 0 x0e,
0 x1e, 0 x11, 0 x15, 0 x1f, 0 x43, 0 x13, 0 x1a, 0 x10, 0 x15, 0 x1b, 0 x04, 0 x09,
0 x4d, 0 x2a, 0 x0f, 0 x19, 0 x0a, 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 0 x00, 0 x00,
0 x00, 0 x00, 0 x00, 0 x1b, 0 x00, 0 x00, 0 x00, 0 x01, 0 x00, 0 x00, 0 x00, 0 x00,
0 x00, 0 x01, 0 x00, 0 x0c, 0 x00, 0 x1b, 0 x00, 0 x01, 0 x00, 0 x00, 0 x00, 0 x00,
0 x00, 0 x02, 0 x00, 0 x07, 0 x00, 0 x27, 0 x00, 0 x01, 0 x00, 0 x00, 0 x00, 0 x00,
0 x00, 0 x03, 0 x00, 0 x0c, 0 x00, 0 x1b, 0 x00, 0 x01, 0 x00, 0 x00, 0 x00, 0 x00,
0 x00, 0 x04, 0 x00, 0 x0c, 0 x00, 0 x1b, 0 x00, 0 x01, 0 x00, 0 x00, 0 x00, 0 x00,
0 x00, 0 x05, 0 x00, 0 x02, 0 x00, 0 x2e, 0 x00, 0 x01, 0 x00, 0 x00, 0 x00, 0 x00,
0 x00, 0 x06, 0 x00, 0 x0c, 0 x00, 0 x1b, 0 x00, 0 x01, 0 x00, 0 x00, 0 x00, 0 x00,
0 x00, 0 x0d, 0 x00, 0 x1b, 0 x00, 0 x00, 0 x00, 0 x01, 0 x00, 0 x00, 0 x00, 0 x00,
0 x00, 0 x0e, 0 x00, 0 x1a, 0 x00, 0 x30, 0 x00, 0 x03, 0 x00, 0 x00, 0 x04, 0 x09,
0 x00, 0 x00, 0 x00, 0 x36, 0 x00, 0 x4a, 0 x00, 0 x03, 0 x00, 0 x00, 0 x04, 0 x09,
0 x00, 0 x01, 0 x00, 0 x18, 0 x00, 0 x80, 0 x00, 0 x03, 0 x00, 0 x00, 0 x04, 0 x09,
0 x00, 0 x02, 0 x00, 0 x0e, 0 x00, 0 x98, 0 x00, 0 x03, 0 x00, 0 x00, 0 x04, 0 x09,
0 x00, 0 x03, 0 x00, 0 x18, 0 x00, 0 x80, 0 x00, 0 x03, 0 x00, 0 x00, 0 x04, 0 x09,
0 x00, 0 x04, 0 x00, 0 x18, 0 x00, 0 x80, 0 x00, 0 x03, 0 x00, 0 x00, 0 x04, 0 x09,
0 x00, 0 x05, 0 x00, 0 x04, 0 x00, 0 xa6, 0 x00, 0 x03, 0 x00, 0 x00, 0 x04, 0 x09,
0 x00, 0 x06, 0 x00, 0 x18, 0 x00, 0 x80, 0 x00, 0 x03, 0 x00, 0 x00, 0 x04, 0 x09,
0 x00, 0 x0d, 0 x00, 0 x36, 0 x00, 0 x4a, 0 x00, 0 x03, 0 x00, 0 x00, 0 x04, 0 x09,
0 x00, 0 x0e, 0 x00, 0 x34, 0 x00, 0 xaa, 0 x00, 0 x03, 0 x00, 0 x01, 0 x04, 0 x09,
0 x00, 0 x00, 0 x00, 0 x36, 0 x00, 0 x4a, 0 x00, 0 x03, 0 x00, 0 x01, 0 x04, 0 x09,
0 x00, 0 x01, 0 x00, 0 x18, 0 x00, 0 x80, 0 x00, 0 x03, 0 x00, 0 x01, 0 x04, 0 x09,
0 x00, 0 x02, 0 x00, 0 x0e, 0 x00, 0 x98, 0 x00, 0 x03, 0 x00, 0 x01, 0 x04, 0 x09,
0 x00, 0 x03, 0 x00, 0 x18, 0 x00, 0 x80, 0 x00, 0 x03, 0 x00, 0 x01, 0 x04, 0 x09,
0 x00, 0 x04, 0 x00, 0 x18, 0 x00, 0 x80, 0 x00, 0 x03, 0 x00, 0 x01, 0 x04, 0 x09,
0 x00, 0 x05, 0 x00, 0 x04, 0 x00, 0 xa6, 0 x00, 0 x03, 0 x00, 0 x01, 0 x04, 0 x09,
0 x00, 0 x06, 0 x00, 0 x18, 0 x00, 0 x80, 0 x00, 0 x03, 0 x00, 0 x01, 0 x04, 0 x09,
0 x00, 0 x0d, 0 x00, 0 x36, 0 x00, 0 x4a, 0 x00, 0 x03, 0 x00, 0 x01, 0 x04, 0 x09,
0 x00, 0 x0e, 0 x00, 0 x34, 0 x00, 0 xaa, 0 x43, 0 x6f, 0 x70, 0 x79, 0 x72, 0 x69,
0 x67, 0 x68, 0 x74, 0 x20, 0 x28, 0 x63, 0 x29, 0 x20, 0 x32, 0 x30, 0 x31, 0 x35,
0 x2c, 0 x20, 0 x47, 0 x6f, 0 x6f, 0 x67, 0 x6c, 0 x65, 0 x2e, 0 x53, 0 x70, 0 x69,
0 x64, 0 x65, 0 x72, 0 x53, 0 x79, 0 x6d, 0 x62, 0 x6f, 0 x6c, 0 x52, 0 x65, 0 x67,
0 x75, 0 x6c, 0 x61, 0 x72, 0 x56, 0 x31, 0 x68, 0 x74, 0 x74, 0 x70, 0 x3a, 0 x2f,
0 x2f, 0 x73, 0 x63, 0 x72, 0 x69, 0 x70, 0 x74, 0 x73, 0 x2e, 0 x73, 0 x69, 0 x6c,
0 x2e, 0 x6f, 0 x72, 0 x67, 0 x2f, 0 x4f, 0 x46, 0 x4c, 0 x00, 0 x43, 0 x00, 0 x6f,
0 x00, 0 x70, 0 x00, 0 x79, 0 x00, 0 x72, 0 x00, 0 x69, 0 x00, 0 x67, 0 x00, 0 x68,
0 x00, 0 x74, 0 x00, 0 x20, 0 x00, 0 x28, 0 x00, 0 x63, 0 x00, 0 x29, 0 x00, 0 x20,
0 x00, 0 x32, 0 x00, 0 x30, 0 x00, 0 x31, 0 x00, 0 x35, 0 x00, 0 x2c, 0 x00, 0 x20,
0 x00, 0 x47, 0 x00, 0 x6f, 0 x00, 0 x6f, 0 x00, 0 x67, 0 x00, 0 x6c, 0 x00, 0 x65,
0 x00, 0 x2e, 0 x00, 0 x53, 0 x00, 0 x70, 0 x00, 0 x69, 0 x00, 0 x64, 0 x00, 0 x65,
0 x00, 0 x72, 0 x00, 0 x53, 0 x00, 0 x79, 0 x00, 0 x6d, 0 x00, 0 x62, 0 x00, 0 x6f,
0 x00, 0 x6c, 0 x00, 0 x52, 0 x00, 0 x65, 0 x00, 0 x67, 0 x00, 0 x75, 0 x00, 0 x6c,
0 x00, 0 x61, 0 x00, 0 x72, 0 x00, 0 x56, 0 x00, 0 x31, 0 x00, 0 x68, 0 x00, 0 x74,
0 x00, 0 x74, 0 x00, 0 x70, 0 x00, 0 x3a, 0 x00, 0 x2f, 0 x00, 0 x2f, 0 x00, 0 x73,
0 x00, 0 x63, 0 x00, 0 x72, 0 x00, 0 x69, 0 x00, 0 x70, 0 x00, 0 x74, 0 x00, 0 x73,
0 x00, 0 x2e, 0 x00, 0 x73, 0 x00, 0 x69, 0 x00, 0 x6c, 0 x00, 0 x2e, 0 x00, 0 x6f,
0 x00, 0 x72, 0 x00, 0 x67, 0 x00, 0 x2f, 0 x00, 0 x4f, 0 x00, 0 x46, 0 x00, 0 x4c,
0 x00, 0 x03, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 xff, 0 x00, 0 x00, 0 x66,
0 x00, 0 x00, 0 x00, 0 x01, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00,
0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x01,
0 xff, 0 xff, 0 x00, 0 x02, 0 x00, 0 x01, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00, 0 x00,
0 x00, 0 x0c, 0 x00, 0 x14, 0 x00, 0 x04, 0 x00, 0 x00, 0 x00, 0 x01, 0 x00, 0 x00,
0 x00, 0 x02, 0 x00, 0 x00
};
/**
* There does not appear to be a publicly accessible API for determining if lcd
* font smoothing will be applied if we request it. The main issue is that if
* smoothing is applied a gamma of 2.0 will be used, if not a gamma of 1.0.
*/
SkCTFontSmoothBehavior SkCTFontGetSmoothBehavior() {
static SkCTFontSmoothBehavior gSmoothBehavior = []{
uint32_t noSmoothBitmap[16 ][16 ] = {};
uint32_t smoothBitmap[16 ][16 ] = {};
SkUniqueCFRef<CGColorSpaceRef> colorspace(CGColorSpaceCreateDeviceRGB());
SkUniqueCFRef<CGContextRef> noSmoothContext(
CGBitmapContextCreate(&noSmoothBitmap, 16 , 16 , 8 , 16 *4 ,
colorspace.get(), kBitmapInfoRGB));
SkUniqueCFRef<CGContextRef> smoothContext(
CGBitmapContextCreate(&smoothBitmap, 16 , 16 , 8 , 16 *4 ,
colorspace.get(), kBitmapInfoRGB));
SkUniqueCFRef<CFDataRef> data(CFDataCreateWithBytesNoCopy(
kCFAllocatorDefault, kSpiderSymbol_ttf, std::size(kSpiderSymbol_ttf),
kCFAllocatorNull));
SkUniqueCFRef<CTFontDescriptorRef> desc(
CTFontManagerCreateFontDescriptorFromData(data.get()));
SkUniqueCFRef<CTFontRef> ctFont(CTFontCreateWithFontDescriptor(desc.get(), 16 , nullptr));
SkASSERT(ctFont);
CGContextSetShouldSmoothFonts(noSmoothContext.get(), false );
CGContextSetShouldAntialias(noSmoothContext.get(), true );
CGContextSetTextDrawingMode(noSmoothContext.get(), kCGTextFill);
CGContextSetGrayFillColor(noSmoothContext.get(), 1 , 1 );
CGContextSetShouldSmoothFonts(smoothContext.get(), true );
CGContextSetShouldAntialias(smoothContext.get(), true );
CGContextSetTextDrawingMode(smoothContext.get(), kCGTextFill);
CGContextSetGrayFillColor(smoothContext.get(), 1 , 1 );
CGPoint point = CGPointMake(0 , 3 );
CGGlyph spiderGlyph = 3 ;
CTFontDrawGlyphs(ctFont.get(), &spiderGlyph, &point, 1 , noSmoothContext.get());
CTFontDrawGlyphs(ctFont.get(), &spiderGlyph, &point, 1 , smoothContext.get());
// For debugging.
//SkUniqueCFRef<CGImageRef> image(CGBitmapContextCreateImage(noSmoothContext()));
//SkUniqueCFRef<CGImageRef> image(CGBitmapContextCreateImage(smoothContext()));
SkCTFontSmoothBehavior smoothBehavior = SkCTFontSmoothBehavior::none;
for (int x = 0 ; x < 16 ; ++x) {
for (int y = 0 ; y < 16 ; ++y) {
uint32_t smoothPixel = smoothBitmap[x][y];
uint32_t r = (smoothPixel >> 16 ) & 0 xFF;
uint32_t g = (smoothPixel >> 8 ) & 0 xFF;
uint32_t b = (smoothPixel >> 0 ) & 0 xFF;
if (r != g || r != b) {
return SkCTFontSmoothBehavior::subpixel;
}
if (noSmoothBitmap[x][y] != smoothPixel) {
smoothBehavior = SkCTFontSmoothBehavior::some;
}
}
}
return smoothBehavior;
}();
return gSmoothBehavior;
}
SkCTFontWeightMapping& SkCTFontGetNSFontWeightMapping() {
// In the event something goes wrong finding the real values, use this mapping.
static constexpr CGFloat defaultNSFontWeights[] =
{ -1 .00 , -0 .80 , -0 .60 , -0 .40 , 0 .00 , 0 .23 , 0 .30 , 0 .40 , 0 .56 , 0 .62 , 1 .00 };
// Declarations in <AppKit/AppKit.h> on macOS, <UIKit/UIKit.h> on iOS
#ifdef SK_BUILD_FOR_MAC
# define SK_KIT_FONT_WEIGHT_PREFIX "NS"
#endif
#ifdef SK_BUILD_FOR_IOS
# define SK_KIT_FONT_WEIGHT_PREFIX "UI"
#endif
static constexpr const char * nsFontWeightNames[] = {
SK_KIT_FONT_WEIGHT_PREFIX "FontWeightUltraLight" ,
SK_KIT_FONT_WEIGHT_PREFIX "FontWeightThin" ,
SK_KIT_FONT_WEIGHT_PREFIX "FontWeightLight" ,
SK_KIT_FONT_WEIGHT_PREFIX "FontWeightRegular" ,
SK_KIT_FONT_WEIGHT_PREFIX "FontWeightMedium" ,
SK_KIT_FONT_WEIGHT_PREFIX "FontWeightSemibold" ,
SK_KIT_FONT_WEIGHT_PREFIX "FontWeightBold" ,
SK_KIT_FONT_WEIGHT_PREFIX "FontWeightHeavy" ,
SK_KIT_FONT_WEIGHT_PREFIX "FontWeightBlack" ,
};
static_assert(std::size(nsFontWeightNames) == 9 , "" );
static CGFloat nsFontWeights[11 ];
static const CGFloat (*selectedNSFontWeights)[11 ] = &defaultNSFontWeights;
static SkOnce once;
once([&] {
size_t i = 0 ;
nsFontWeights[i++] = -1 .00 ;
for (const char * nsFontWeightName : nsFontWeightNames) {
void * nsFontWeightValuePtr = dlsym(RTLD_DEFAULT, nsFontWeightName);
if (nsFontWeightValuePtr) {
nsFontWeights[i++] = *(static_cast <CGFloat*>(nsFontWeightValuePtr));
} else {
return ;
}
}
nsFontWeights[i++] = 1 .00 ;
selectedNSFontWeights = &nsFontWeights;
});
return *selectedNSFontWeights;
}
SkCTFontWeightMapping& SkCTFontGetDataFontWeightMapping() {
// In the event something goes wrong finding the real values, use this mapping.
// These were the values from macOS 10.13 to 10.15.
static constexpr CGFloat defaultDataFontWeights[] =
{ -1 .00 , -0 .70 , -0 .50 , -0 .23 , 0 .00 , 0 .20 , 0 .30 , 0 .40 , 0 .60 , 0 .80 , 1 .00 };
static const CGFloat (*selectedDataFontWeights)[11 ] = &defaultDataFontWeights;
static CGFloat dataFontWeights[11 ];
static SkOnce once;
once([&] {
constexpr size_t dataSize = std::size(kSpiderSymbol_ttf);
sk_sp<SkData> data = SkData::MakeWithCopy(kSpiderSymbol_ttf, dataSize);
const SkSFNTHeader* sfntHeader = reinterpret_cast <const SkSFNTHeader*>(data->data());
const SkSFNTHeader::TableDirectoryEntry* tableEntry =
SkTAfter<const SkSFNTHeader::TableDirectoryEntry>(sfntHeader);
const SkSFNTHeader::TableDirectoryEntry* os2TableEntry = nullptr;
int numTables = SkEndian_SwapBE16(sfntHeader->numTables);
for (int tableEntryIndex = 0 ; tableEntryIndex < numTables; ++tableEntryIndex) {
if (SkOTTableOS2::TAG == tableEntry[tableEntryIndex].tag) {
os2TableEntry = tableEntry + tableEntryIndex;
break ;
}
}
if (!os2TableEntry) {
return ;
}
size_t os2TableOffset = SkEndian_SwapBE32(os2TableEntry->offset);
SkOTTableOS2_V0* os2Table = SkTAddOffset<SkOTTableOS2_V0>(data->writable_data(),
os2TableOffset);
CGFloat previousWeight = -CGFLOAT_MAX;
for (int i = 0 ; i < 11 ; ++i) {
os2Table->usWeightClass.value = SkEndian_SwapBE16(i * 100 );
// On macOS 10.14 and earlier it appears that the CFDataGetBytePtr is used somehow in
// font caching. Creating a slightly modified font with data at the same address seems
// to in some ways act like a font previously created at that address. As a result,
// always make a copy of the data.
SkUniqueCFRef<CFDataRef> cfData(
CFDataCreate(kCFAllocatorDefault, (const UInt8 *)data->data(), data->size()));
if (!cfData) {
return ;
}
SkUniqueCFRef<CTFontDescriptorRef> desc(
CTFontManagerCreateFontDescriptorFromData(cfData.get()));
if (!desc) {
return ;
}
// On macOS 10.14 and earlier, the CTFontDescriptorRef returned from
// CTFontManagerCreateFontDescriptorFromData is incomplete and does not have the
// correct traits. It is necessary to create the CTFont and then get the descriptor
// off of it.
SkUniqueCFRef<CTFontRef> ctFont(CTFontCreateWithFontDescriptor(desc.get(), 9 , nullptr));
if (!ctFont) {
return ;
}
SkUniqueCFRef<CTFontDescriptorRef> desc2(CTFontCopyFontDescriptor(ctFont.get()));
if (!desc2) {
return ;
}
SkUniqueCFRef<CFTypeRef> traitsRef(
CTFontDescriptorCopyAttribute(desc2.get(), kCTFontTraitsAttribute));
if (!traitsRef || CFGetTypeID(traitsRef.get()) != CFDictionaryGetTypeID()) {
return ;
}
CFDictionaryRef fontTraitsDict = static_cast <CFDictionaryRef>(traitsRef.get());
CFTypeRef weightRef;
if (!CFDictionaryGetValueIfPresent(fontTraitsDict, kCTFontWeightTrait, &weightRef) ||
!weightRef)
{
return ;
}
// It is possible there is a kCTFontWeightTrait entry, but it is not a CFNumberRef.
// This is usually due to a bug with the handling of 0, so set the default to 0.
// See https://crbug.com/1372420
CGFloat weight = 0 ;
if (CFGetTypeID(weightRef) == CFNumberGetTypeID()) {
CFNumberRef weightNumber = static_cast <CFNumberRef>(weightRef);
if (!CFNumberIsFloatType(weightNumber) ||
!CFNumberGetValue(weightNumber, kCFNumberCGFloatType, &weight))
{
// CFNumberGetValue may modify `weight` even when returning `false`.
weight = 0 ;
}
}
// It is expected that the weights will be strictly monotonically increasing.
if (weight <= previousWeight) {
return ;
}
previousWeight = weight;
dataFontWeights[i] = weight;
}
selectedDataFontWeights = &dataFontWeights;
});
return *selectedDataFontWeights;
}
#endif
Messung V0.5 in Prozent C=92 H=93 G=92
¤ Dauer der Verarbeitung: 0.32 Sekunden
(vorverarbeitet am 2026-06-04)
¤
*© Formatika GbR, Deutschland