summaryrefslogtreecommitdiff
path: root/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2017-12-04 22:53:50 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2017-12-04 22:53:50 +0000
commit9a0a15c9b59d9fd8dac7591d467ef27f718e16d6 (patch)
tree8340685b75516223567426a251813d64ee80f42e /Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc
parent527c20c05260beb1e9851ec5ccb404d6a0dd150f (diff)
harfbuzz-1.7.2
git-svn-id: svn://tug.org/texlive/trunk@45988 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.cc57
1 files changed, 36 insertions, 21 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 86ca17fb2dd..2dd10d2da5a 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc
@@ -81,21 +81,12 @@ _hb_cg_font_release (void *data)
CGFontRelease ((CGFontRef) data);
}
-hb_face_t *
-hb_coretext_face_create (CGFontRef cg_font)
-{
- return hb_face_create_for_tables (reference_table, CGFontRetain (cg_font), _hb_cg_font_release);
-}
HB_SHAPER_DATA_ENSURE_DEFINE(coretext, face)
HB_SHAPER_DATA_ENSURE_DEFINE_WITH_CONDITION(coretext, font,
fabs (CTFontGetSize((CTFontRef) data) - coretext_font_size (font->ptem)) <= .5
)
-/*
- * shaper face data
- */
-
static CTFontDescriptorRef
get_last_resort_font_desc (void)
{
@@ -267,6 +258,12 @@ _hb_coretext_shaper_face_data_destroy (hb_coretext_shaper_face_data_t *data)
CFRelease ((CGFontRef) data);
}
+hb_face_t *
+hb_coretext_face_create (CGFontRef cg_font)
+{
+ return hb_face_create_for_tables (reference_table, CGFontRetain (cg_font), _hb_cg_font_release);
+}
+
/*
* Since: 0.9.10
*/
@@ -278,10 +275,6 @@ hb_coretext_face_get_cg_font (hb_face_t *face)
}
-/*
- * shaper font data
- */
-
hb_coretext_shaper_font_data_t *
_hb_coretext_shaper_font_data_create (hb_font_t *font)
{
@@ -306,6 +299,35 @@ _hb_coretext_shaper_font_data_destroy (hb_coretext_shaper_font_data_t *data)
CFRelease ((CTFontRef) data);
}
+/*
+ * Since: 1.7.2
+ */
+hb_font_t *
+hb_coretext_font_create (CTFontRef ct_font)
+{
+ CGFontRef cg_font = CTFontCopyGraphicsFont (ct_font, 0);
+ hb_face_t *face = hb_coretext_face_create (cg_font);
+ CFRelease (cg_font);
+ hb_font_t *font = hb_font_create (face);
+ hb_face_destroy (face);
+
+ if (unlikely (hb_object_is_inert (font)))
+ return font;
+
+ /* Let there be dragons here... */
+ HB_SHAPER_DATA_GET (font) = (hb_coretext_shaper_font_data_t *) CFRetain (ct_font);
+
+ return font;
+}
+
+CTFontRef
+hb_coretext_font_get_ct_font (hb_font_t *font)
+{
+ if (unlikely (!hb_coretext_shaper_font_data_ensure (font))) return nullptr;
+ return (CTFontRef) HB_SHAPER_DATA_GET (font);
+}
+
+
/*
* shaper shape_plan data
@@ -328,13 +350,6 @@ _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 nullptr;
- return (CTFontRef)HB_SHAPER_DATA_GET (font);
-}
-
/*
* shaper
@@ -1000,7 +1015,7 @@ resize_and_retry:
* However, even that wouldn't work if we were passed in the CGFont to
* construct a hb_face to begin with.
*
- * See: http://github.com/behdad/harfbuzz/pull/36
+ * See: http://github.com/harfbuzz/harfbuzz/pull/36
*
* Also see: https://bugs.chromium.org/p/chromium/issues/detail?id=597098
*/