Commit Graph

195 Commits

Author SHA1 Message Date
Behdad Esfahbod 1ffe637a0e [coretext] Remove dead code
Fixes https://github.com/harfbuzz/harfbuzz/issues/3484
2022-03-21 10:37:42 -06:00
Behdad Esfahbod 20031ddbb8 [unsafe-to-concat] Mark in all other shapers
unsafe_to_break() implies unsafe-to-concat; but setting the flag
manually wasn't.
2022-01-22 11:53:18 -07:00
Behdad Esfahbod 376738d411 [coretext] Fix lsearch 2022-01-19 11:58:42 -07:00
Behdad Esfahbod 94d43c008a [buffer] Merge and rename clear_glyph_flags() 2021-12-04 16:56:39 -08:00
Behdad Esfahbod e80c86ffa6 [coretext] Fix formatting 2021-08-04 10:25:06 -06:00
Simon Cozens 66aef2818e Support passing variations to coretext shaper 2021-08-04 10:24:40 -06:00
Behdad Esfahbod d3dd936309 [coretext] Round position info
Test:

Before:
$ ./hb-shape /System/Library/Fonts/ヒラギノ丸ゴ\ ProN\ W4.ttc 1 --features="+palt" --shaper=coretext
[gid781=0@-78,0+841]
$ ./hb-shape /System/Library/Fonts/ヒラギノ丸ゴ\ ProN\ W4.ttc 1 --features="+palt" --shaper=ot
[gid781=0@-78,0+842]

After:
$ ./hb-shape /System/Library/Fonts/ヒラギノ丸ゴ\ ProN\ W4.ttc 1 --features="+palt" --shaper=coretext
[gid781=0@-78,0+842]
$ ./hb-shape /System/Library/Fonts/ヒラギノ丸ゴ\ ProN\ W4.ttc 1 --features="+palt" --shaper=ot
[gid781=0@-78,0+842]

I've verified in the font that 842 is correct.
2021-06-14 13:24:23 -07:00
Behdad Esfahbod 7cb22ba7eb
Include C headers with their C++ names (#2882)
Remove unnecessary includes.

Fixes build with some known broken SDKs (Nintendo Switch?)

https://en.cppreference.com/w/cpp/header

Fixes https://github.com/harfbuzz/harfbuzz/pull/2881
2021-03-01 11:44:06 -08:00
Behdad Esfahbod 6a9f576fd4 [coretext] Silence CoreText deprecation warning
As suggested by Ned, just ignoring it.

warning: 'CTGetCoreTextVersion' is deprecated: first deprecated in macOS 11.0 - Use
      -[NSProcessInfo operatingSystemVersion] [-Wdeprecated-declarations]
2021-02-17 11:31:32 -07:00
Behdad Esfahbod 8e53c7c125 [coretext] Fix more CGFloat double-promotion warnings
The warning is:
warning: implicit conversion increases floating-point precision: 'CGFloat' (aka 'float') to
      'double' [-Wdouble-promotion]
2021-02-17 11:12:56 -07:00
Khaled Hosny 3d7a361648 [docs] Miscellaneous missing docs 2020-12-30 19:21:49 -08:00
Khaled Hosny 5c8900efe4 [coretext] Properly check for macOS 10.10
Fixes https://github.com/harfbuzz/harfbuzz/issues/2452
2020-06-08 03:20:54 +02:00
René Meusel d6ddb232fc FIX: -Wextra-semi-stmt in Clang9 2020-04-29 02:35:05 +04:30
Behdad Esfahbod a11db0b9d4
Merge branch 'master' into usermanual-integration 2020-04-23 15:32:43 -07:00
Khaled Hosny 68c1798a67 [coretext] Use kCTFontOpenTypeFeatureTag
Instead of trying to map OpenType features to AAT feature selectors
which only works for a small subset of OpenType features, use the
simpler kCTFontOpenTypeFeatureTag with OpenType feature tags directly.

With this change, features like cvXX can be enabled in coretext shaper,
while they were previously ignored due to missing mapping.

This seems to work even with AAT fonts that don’t have OpenType layout
tables, which suggests that CoreText is doing the mapping itself in this
case.

kCTFontOpenTypeFeatureTag seems to have been introduced in macOS 10.10
and iOS 8.0, though, so its use is conditional on version check for now.
Not sure how to check iOS version, so I left this out.
2019-12-22 06:27:48 -08:00
Ebrahim Byagowi f3214df6f6 [coretext] Fix double promotion warnings by making casts explicit 2019-09-14 11:55:53 +04:30
Ebrahim Byagowi a0b4ac4dce Turn 8 spaces to tab across the project
According to the current code style of the project
2019-08-27 02:40:41 +04:30
Ebrahim Byagowi 37de38adea
Merge branch 'master' into remove-coretext-96dpi-assumption 2019-08-20 12:59:33 +04:30
Ebrahim Byagowi 9fea6b4dd4
[amalgam] Use it in cmake port and fix conflicts (#1812) 2019-07-05 18:46:41 +04:30
Misty De Meo e710888188 coretext: remove trailing macro from SCRATCH_RESTORE 2019-06-18 15:52:23 -07:00
Behdad Esfahbod 10bac21bb5 [coretext/uniscribe/directwrite] Remove extra semicolons
Fixes https://github.com/harfbuzz/harfbuzz/pull/1783
2019-06-18 15:15:06 -07:00
Behdad Esfahbod aa3450cac1 [config] Don't compile disabled features
This makes it possible to include all .cc files into build, even if not
building CoreText, Uniscribe, etc.

This was mostly to help custom builders.  But also means that we can
include all files in our own build system.  Not sure if we should.
Definitely simplifies things, but slightly only.
2019-06-17 22:41:49 -07:00
Nathan Willis 32ae0d3e78 [Docs] Add gtk-doc comments to hb-coretext. 2019-05-20 17:35:39 +01:00
Behdad Esfahbod 68e12e68f8 Fix more semi-colon issues 2019-05-13 17:28:59 -07:00
Behdad Esfahbod 2fb3a8327a [vector] Simplify arrayZ
Was turned into function when we had static ones and wanted to be
move-safe...  Not the case anymore.
2019-05-10 18:43:48 -07:00
Behdad Esfahbod 0601a19d38 Fix a few more double-pomotion errors 2019-05-08 07:47:36 -07:00
Behdad Esfahbod 41248cce0e Remove MIN/MAX in favor of hb_min/hb_max 2019-05-07 20:54:31 -07:00
Behdad Esfahbod 95df00aec1 Hide a few static methods
Looks like static methods that do not get inlined end up exported.
We have a lot more.  Need to protect all at some point.  Wish there
was an easier way, like the visibility flag we pass that automatically
hides all inline methods.

Was exposed by check-symbols.sh when compiling on OS X 10.14 with:

$ make CPPFLAGS=-Oz CXXFLAGS=-flto=thin LDFLAGS=-lc++
2019-04-12 17:51:14 -04:00
Behdad Esfahbod c5509be93a [coretext] Fix unused-variable error
Fixes https://github.com/harfbuzz/harfbuzz/issues/1659
2019-04-08 14:50:58 -04:00
Ebrahim Byagowi ba4b7be455
Remove coretext_aat shaper (#1581)
coretext_aat was a temporary shaper to redirect shaping of AAT fonts
to CoreText and leaving the rest for HarfBuzz.  As HarfBuzz now supports
AAT and Chrome now actually ships that on a stable version on macOS,
we no longer care about such use-case.  If a client really wants 100%
metrics compatibility with CoreText better to use it directly or through
our API.  Replicating the same behavior still is possible using
hb_shape_full, something we don't care or like to offer anymore.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1478
2019-03-31 01:32:30 -07:00
Ken fdfa3d29b7 hb-coretext.cc: remove TARGET_OS_MAC from test (#1578)
it is always true when building on APPLE systems
and this file only builds on APPLE systems
2019-02-11 11:16:05 +03:30
Ken Cunningham 7859decdd0 hb-coretext.cc: clean up macosx test
TARGET_OS_OSX was introduced only in late OS versions
so always returns as "0" on older systems.

if !TARGET_OS_IPHONE can work, as it returns as !0 on older
systems where TARGET_OS_IPHONE is not defined, but is not
specific

if TARGET_OS_MAC && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
is both specific and accurate on all systems.
2019-02-05 20:26:49 -08:00
Tor Arne Vestbø f401f85a5a Remove assumption about Core Text working in 96 DPI
Core Text doesn't actually have a concept of DPI internally, as it
doesn't rasterize anything by itself, it just generates vector paths
that get passed along to Core Graphics.

In practice this means Core Text operates in the classical macOS
logical DPI of 72, with one typographic point corresponding to one
point in the Core Graphics coordinate system, which for a normal
bitmap context then corresponds to one pixel -- or two pixels for
a "retina" context with a 2x scale transform.

Scaling the font point sizes given to HarfBuzz to an assumed DPI
of 96 is problematic with this in mind, as fonts with optical
features such as 'trak' tables for tracking, or color glyphs,
will then base the metrics off of the wrong point size compared
to what the client asked for.

This in turn causes mismatches between the metrics of the shaped
text and the actual rasterization, which doesn't include the 72
to 96 DPI scaling.

If a 96 DPI is needed, such as on the Web, the scaling should be
done outside of HarfBuzz, allowing the client to keep the DPI of
the shaping in sync with the rasterization.

The recommended way to do that is by scaling the font point size,
not by applying a transform to the target Core Graphics context,
to let Core Text choose the right optical features of the target
point size, as described in WWDC 2015 session 804:

  https://developer.apple.com/videos/play/wwdc2015/804/
2019-01-15 13:26:35 +01:00
Behdad Esfahbod 474a12058d [array/vector] Rename len to length 2018-12-21 18:53:01 -05:00
Ebrahim Byagowi e412008599 Remove redundant void from C++ sources (#1486) 2018-12-17 13:01:01 -05:00
Ebrahim Byagowi d0a250a7b1
Reuse hb_aat_layout_has_* logic in coretext-aat detection logic (#1442) 2018-12-04 23:42:13 +03:30
Behdad Esfahbod 27a6b0a2f7 Fix build for realz 2018-11-29 16:29:30 -05:00
Behdad Esfahbod ac0264717b [coretext] Fix compile
Fingers crossed.
2018-11-29 15:07:44 -05:00
Behdad Esfahbod 50d1a41c08 [coretext] Hopefully the last one 2018-11-16 08:52:57 -05:00
Behdad Esfahbod 0aab861f9c [coretext] Another round 2018-11-16 08:43:25 -05:00
Behdad Esfahbod 0809b76a9a [coretext] One more try.. 2018-11-16 08:29:47 -05:00
Behdad Esfahbod 78bd447594 [coretext] One more try 2018-11-16 04:10:53 -05:00
Behdad Esfahbod fd27a23c82 [coretext] Another build fix attemt 2018-11-16 03:57:12 -05:00
Behdad Esfahbod cfb9771a3b [coretext] Try to fix 2018-11-16 03:25:07 -05:00
Behdad Esfahbod e3e9547365 [coretext] Unbreak build 2018-11-16 02:55:29 -05:00
Behdad Esfahbod ce5da0f36a [shaper] Rewrite shaper data code to be more template-driven than macro-driven 2018-11-16 02:52:20 -05:00
Behdad Esfahbod f521a28b4a Embed hb_ot_shape_plan_t into hb_shape_plan_t
No other shaper will need shape_plan_data, by definition.  So, remove
abstraction layer and always create hb_ot_shape_plan_t as part of
hb_shape_plan_t.
2018-11-11 21:54:10 -05:00
Behdad Esfahbod 1beacdded9 Minor 2018-11-11 16:35:28 -05:00
Behdad Esfahbod 93ef20a83b Replace most uses of is_inert with is_immutable 2018-11-03 15:03:06 -04:00
Behdad Esfahbod 3a4e5dd425 Remove a few unnecessary hb_auto_t<>'s
See a85641446c30247c4e948263f0f8c1147ed4efb9
2018-10-29 22:27:20 -07:00