diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2017-10-23 05:48:12 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2017-10-23 05:48:12 +0000 |
commit | 6a26d1aa8ad4cdce657ae0ae7c12b464b34b6bd1 (patch) | |
tree | 61e17b15c55073763d4e45388b20322d5311c783 /Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc | |
parent | 1ee93ecee3dcb1e5ed488c3d8616a5ebfdf9fa7a (diff) |
harfbuzz 1.6.1
git-svn-id: svn://tug.org/texlive/trunk@45584 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc')
-rw-r--r-- | Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc index 22661407dea..937822b8673 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc @@ -65,12 +65,12 @@ reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data) CGFontRef cg_font = reinterpret_cast<CGFontRef> (user_data); CFDataRef cf_data = CGFontCopyTableForTag (cg_font, tag); if (unlikely (!cf_data)) - return NULL; + return nullptr; const char *data = reinterpret_cast<const char*> (CFDataGetBytePtr (cf_data)); const size_t length = CFDataGetLength (cf_data); if (!data || !length) - return NULL; + return nullptr; return hb_blob_create (data, length, HB_MEMORY_MODE_READONLY, reinterpret_cast<void *> (const_cast<__CFData *> (cf_data)), @@ -125,7 +125,7 @@ static void release_data (void *info, const void *data, size_t size) { assert (hb_blob_get_length ((hb_blob_t *) info) == size && - hb_blob_get_data ((hb_blob_t *) info, NULL) == data); + hb_blob_get_data ((hb_blob_t *) info, nullptr) == data); hb_blob_destroy ((hb_blob_t *) info); } @@ -133,7 +133,7 @@ release_data (void *info, const void *data, size_t size) static CGFontRef create_cg_font (hb_face_t *face) { - CGFontRef cg_font = NULL; + CGFontRef cg_font = nullptr; if (face->destroy == _hb_cg_font_release) { cg_font = CGFontRetain ((CGFontRef) face->user_data); @@ -161,7 +161,7 @@ create_cg_font (hb_face_t *face) static CTFontRef create_ct_font (CGFontRef cg_font, CGFloat font_size) { - CTFontRef ct_font = NULL; + CTFontRef ct_font = nullptr; /* CoreText does not enable trak table usage / tracking when creating a CTFont * using CTFontCreateWithGraphicsFont. The only way of enabling tracking seems @@ -174,23 +174,23 @@ create_ct_font (CGFontRef cg_font, CGFloat font_size) if (CFStringHasSuffix (cg_postscript_name, CFSTR ("-Bold"))) font_type = kCTFontUIFontEmphasizedSystem; - ct_font = CTFontCreateUIFontForLanguage (font_type, font_size, NULL); + ct_font = CTFontCreateUIFontForLanguage (font_type, font_size, nullptr); CFStringRef ct_result_name = CTFontCopyPostScriptName(ct_font); if (CFStringCompare (ct_result_name, cg_postscript_name, 0) != kCFCompareEqualTo) { CFRelease(ct_font); - ct_font = NULL; + ct_font = nullptr; } CFRelease (ct_result_name); } CFRelease (cg_postscript_name); if (!ct_font) - ct_font = CTFontCreateWithGraphicsFont (cg_font, font_size, NULL, NULL); + ct_font = CTFontCreateWithGraphicsFont (cg_font, font_size, nullptr, nullptr); if (unlikely (!ct_font)) { DEBUG_MSG (CORETEXT, cg_font, "Font CTFontCreateWithGraphicsFont() failed"); - return NULL; + return nullptr; } /* crbug.com/576941 and crbug.com/625902 and the investigation in the latter @@ -200,7 +200,7 @@ create_ct_font (CGFontRef cg_font, CGFloat font_size) * reconfiguring the cascade list causes CoreText crashes. For details, see * crbug.com/549610 */ // 0x00070000 stands for "kCTVersionNumber10_10", see CoreText.h - if (&CTGetCoreTextVersion != NULL && CTGetCoreTextVersion() < 0x00070000) { + if (&CTGetCoreTextVersion != nullptr && CTGetCoreTextVersion() < 0x00070000) { CFStringRef fontName = CTFontCopyPostScriptName (ct_font); bool isEmojiFont = CFStringCompare (fontName, CFSTR("AppleColorEmoji"), 0) == kCFCompareEqualTo; CFRelease (fontName); @@ -214,7 +214,7 @@ create_ct_font (CGFontRef cg_font, CGFloat font_size) * font fallback which we don't need anyway. */ { CTFontDescriptorRef last_resort_font_desc = get_last_resort_font_desc (); - CTFontRef new_ct_font = CTFontCreateCopyWithAttributes (ct_font, 0.0, NULL, last_resort_font_desc); + CTFontRef new_ct_font = CTFontCreateCopyWithAttributes (ct_font, 0.0, nullptr, last_resort_font_desc); CFRelease (last_resort_font_desc); if (new_ct_font) { @@ -257,7 +257,7 @@ _hb_coretext_shaper_face_data_create (hb_face_t *face) if (unlikely (!cg_font)) { DEBUG_MSG (CORETEXT, face, "CGFont creation failed.."); - return NULL; + return nullptr; } return (hb_coretext_shaper_face_data_t *) cg_font; @@ -275,7 +275,7 @@ _hb_coretext_shaper_face_data_destroy (hb_coretext_shaper_face_data_t *data) CGFontRef hb_coretext_face_get_cg_font (hb_face_t *face) { - if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return NULL; + if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return nullptr; return (CGFontRef) HB_SHAPER_DATA_GET (face); } @@ -288,7 +288,7 @@ hb_coretext_shaper_font_data_t * _hb_coretext_shaper_font_data_create (hb_font_t *font) { hb_face_t *face = font->face; - if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return NULL; + if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return nullptr; CGFontRef cg_font = (CGFontRef) HB_SHAPER_DATA_GET (face); CTFontRef ct_font = create_ct_font (cg_font, coretext_font_size (font->ptem)); @@ -296,7 +296,7 @@ _hb_coretext_shaper_font_data_create (hb_font_t *font) if (unlikely (!ct_font)) { DEBUG_MSG (CORETEXT, font, "CGFont creation failed.."); - return NULL; + return nullptr; } return (hb_coretext_shaper_font_data_t *) ct_font; @@ -333,7 +333,7 @@ _hb_coretext_shaper_shape_plan_data_destroy (hb_coretext_shaper_shape_plan_data_ CTFontRef hb_coretext_font_get_ct_font (hb_font_t *font) { - if (unlikely (!hb_coretext_shaper_font_data_ensure (font))) return NULL; + if (unlikely (!hb_coretext_shaper_font_data_ensure (font))) return nullptr; return (CTFontRef)HB_SHAPER_DATA_GET (font); } @@ -678,7 +678,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, CFNumberCreate (kCFAllocatorDefault, kCFNumberIntType, &active_features[j].rec.feature), CFNumberCreate (kCFAllocatorDefault, kCFNumberIntType, &active_features[j].rec.setting) }; - ASSERT_STATIC (ARRAY_LENGTH (keys) == ARRAY_LENGTH (values)); + static_assert ((ARRAY_LENGTH_CONST (keys) == ARRAY_LENGTH_CONST (values)), ""); CFDictionaryRef dict = CFDictionaryCreate (kCFAllocatorDefault, (const void **) keys, (const void **) values, @@ -704,12 +704,12 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, CTFontDescriptorRef font_desc = CTFontDescriptorCreateWithAttributes (attributes); CFRelease (attributes); - range->font = CTFontCreateCopyWithAttributes (ct_font, 0.0, NULL, font_desc); + range->font = CTFontCreateCopyWithAttributes (ct_font, 0.0, nullptr, font_desc); CFRelease (font_desc); } else { - range->font = NULL; + range->font = nullptr; } range->index_first = last_index; @@ -779,14 +779,14 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, #define FAIL(...) \ HB_STMT_START { \ - DEBUG_MSG (CORETEXT, NULL, __VA_ARGS__); \ + DEBUG_MSG (CORETEXT, nullptr, __VA_ARGS__); \ ret = false; \ goto fail; \ } HB_STMT_END; bool ret = true; - CFStringRef string_ref = NULL; - CTLineRef line = NULL; + CFStringRef string_ref = nullptr; + CTLineRef line = nullptr; if (0) { @@ -798,8 +798,8 @@ resize_and_retry: assert (line); CFRelease (string_ref); CFRelease (line); - string_ref = NULL; - line = NULL; + string_ref = nullptr; + line = nullptr; /* Get previous start-of-scratch-area, that we use later for readjusting * our existing scratch arrays. */ @@ -820,7 +820,7 @@ resize_and_retry: scratch_size -= old_scratch_used; } { - string_ref = CFStringCreateWithCharactersNoCopy (NULL, + string_ref = CFStringCreateWithCharactersNoCopy (nullptr, pchars, chars_len, kCFAllocatorNull); if (unlikely (!string_ref)) @@ -937,7 +937,7 @@ resize_and_retry: CFArrayRef glyph_runs = CTLineGetGlyphRuns (line); unsigned int num_runs = CFArrayGetCount (glyph_runs); - DEBUG_MSG (CORETEXT, NULL, "Num runs: %d", num_runs); + DEBUG_MSG (CORETEXT, nullptr, "Num runs: %d", num_runs); buffer->len = 0; uint32_t status_and = ~0, status_or = 0; @@ -963,7 +963,7 @@ resize_and_retry: status_or |= run_status; status_and &= run_status; DEBUG_MSG (CORETEXT, run, "CTRunStatus: %x", run_status); - double run_advance = CTRunGetTypographicBounds (run, range_all, NULL, NULL, NULL); + double run_advance = CTRunGetTypographicBounds (run, range_all, nullptr, nullptr, nullptr); if (HB_DIRECTION_IS_VERTICAL (buffer->props.direction)) run_advance = -run_advance; DEBUG_MSG (CORETEXT, run, "Run advance: %g", run_advance); @@ -1089,7 +1089,7 @@ resize_and_retry: /* Testing used to indicate that CTRunGetGlyphsPtr, etc (almost?) always * succeed, and so copying data to our own buffer will be rare. Reports - * have it that this changed in OS X 10.10 Yosemite, and NULL is returned + * have it that this changed in OS X 10.10 Yosemite, and nullptr is returned * frequently. At any rate, we can test that codepath by setting USE_PTR * to false. */ @@ -1105,13 +1105,13 @@ resize_and_retry: { /* Setup glyphs */ SCRATCH_SAVE(); - const CGGlyph* glyphs = USE_PTR ? CTRunGetGlyphsPtr (run) : NULL; + const CGGlyph* glyphs = USE_PTR ? CTRunGetGlyphsPtr (run) : nullptr; if (!glyphs) { ALLOCATE_ARRAY (CGGlyph, glyph_buf, num_glyphs, goto resize_and_retry); CTRunGetGlyphs (run, range_all, glyph_buf); glyphs = glyph_buf; } - const CFIndex* string_indices = USE_PTR ? CTRunGetStringIndicesPtr (run) : NULL; + const CFIndex* string_indices = USE_PTR ? CTRunGetStringIndicesPtr (run) : nullptr; if (!string_indices) { ALLOCATE_ARRAY (CFIndex, index_buf, num_glyphs, goto resize_and_retry); CTRunGetStringIndices (run, range_all, index_buf); @@ -1133,7 +1133,7 @@ resize_and_retry: * advance (in the advance direction only), and for last glyph we set * whatever is needed to make the whole run's advance add up. */ SCRATCH_SAVE(); - const CGPoint* positions = USE_PTR ? CTRunGetPositionsPtr (run) : NULL; + const CGPoint* positions = USE_PTR ? CTRunGetPositionsPtr (run) : nullptr; if (!positions) { ALLOCATE_ARRAY (CGPoint, position_buf, num_glyphs, goto resize_and_retry); CTRunGetPositions (run, range_all, position_buf); @@ -1300,12 +1300,12 @@ _hb_coretext_aat_shaper_face_data_create (hb_face_t *face) if (hb_blob_get_length (blob)) { hb_blob_destroy (blob); - return hb_coretext_shaper_face_data_ensure (face) ? (hb_coretext_aat_shaper_face_data_t *) HB_SHAPER_DATA_SUCCEEDED : NULL; + return hb_coretext_shaper_face_data_ensure (face) ? (hb_coretext_aat_shaper_face_data_t *) HB_SHAPER_DATA_SUCCEEDED : nullptr; } hb_blob_destroy (blob); } - return NULL; + return nullptr; } void @@ -1323,7 +1323,7 @@ struct hb_coretext_aat_shaper_font_data_t {}; hb_coretext_aat_shaper_font_data_t * _hb_coretext_aat_shaper_font_data_create (hb_font_t *font) { - return hb_coretext_shaper_font_data_ensure (font) ? (hb_coretext_aat_shaper_font_data_t *) HB_SHAPER_DATA_SUCCEEDED : NULL; + return hb_coretext_shaper_font_data_ensure (font) ? (hb_coretext_aat_shaper_font_data_t *) HB_SHAPER_DATA_SUCCEEDED : nullptr; } void |