summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-02-20 01:01:00 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2019-02-20 09:51:12 +0100
commit035f934d7a798e97bf0213a5d42a3d511132f03d (patch)
tree89aa6efdc86864ce479cddca6b9c4ba523c2754a /src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
parentf4cc23cffbe3005f0a522cac938695e87ecd6407 (diff)
parentda4ab444ffac37514435364d4d3f0ad59d4f9bc3 (diff)
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts: tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp Added tests/auto/testlib/selftests/expected_crashes_5.txt to work round the output of the crashes test (which exercises UB, see QTBUG-73903) being truncated on one test platform. Change-Id: I9cd3f2639b4e50c3c4513e14629a40bdca8f8273
Diffstat (limited to 'src/3rdparty/harfbuzz-ng/src/hb-coretext.cc')
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-coretext.cc25
1 files changed, 4 insertions, 21 deletions
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc b/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
index 9431ba5fe1..d64cb7edbd 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
@@ -52,24 +52,6 @@ struct CoreTextFontEngineData {
/* https://developer.apple.com/documentation/coretext/1508745-ctfontcreatewithgraphicsfont */
#define HB_CORETEXT_DEFAULT_FONT_SIZE 12.f
-static CGFloat
-coretext_font_size_from_ptem (float ptem)
-{
- /* CoreText points are CSS pixels (96 per inch),
- * NOT typographic points (72 per inch).
- *
- * https://developer.apple.com/library/content/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html
- */
- ptem *= 96.f / 72.f;
- return ptem <= 0.f ? HB_CORETEXT_DEFAULT_FONT_SIZE : ptem;
-}
-static float
-coretext_font_size_to_ptem (CGFloat size)
-{
- size *= 72.f / 96.f;
- return size <= 0.f ? 0 : size;
-}
-
static void
release_table_data (void *user_data)
{
@@ -104,7 +86,7 @@ _hb_cg_font_release (void *data)
HB_SHAPER_DATA_ENSURE_DEFINE(coretext, face)
HB_SHAPER_DATA_ENSURE_DEFINE_WITH_CONDITION(coretext, font,
- fabs (CTFontGetSize((CTFontRef) data) - coretext_font_size_from_ptem (font->ptem)) <= .5
+ fabs (CTFontGetSize ((CTFontRef) data) - font->ptem) <= .5
)
static CTFontDescriptorRef
@@ -308,7 +290,8 @@ _hb_coretext_shaper_font_data_create (hb_font_t *font)
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_from_ptem (font->ptem));
+ CGFloat font_size = font->ptem <= 0.f ? HB_CORETEXT_DEFAULT_FONT_SIZE : font->ptem;
+ CTFontRef ct_font = create_ct_font (cg_font, font_size);
if (unlikely (!ct_font))
{
@@ -340,7 +323,7 @@ hb_coretext_font_create (CTFontRef ct_font)
if (unlikely (hb_object_is_inert (font)))
return font;
- hb_font_set_ptem (font, coretext_font_size_to_ptem (CTFontGetSize(ct_font)));
+ hb_font_set_ptem (font, CTFontGetSize (ct_font));
/* Let there be dragons here... */
HB_SHAPER_DATA_GET (font) = (hb_coretext_shaper_font_data_t *) CFRetain (ct_font);