Commit Graph

163 Commits

Author SHA1 Message Date
Ben Wagner
8c9830bc46 Use SkUniqueCFRef with CTTypesetterCreateLine
This is a 'Create' and returns a reference. Be sure to release the
reference.

Bug: skia:10542
Change-Id: If4ed7a37a43efe5f8f17a4a15a0f82cdae7d9276
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307795
Auto-Submit: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-08-05 14:19:29 +00:00
John Stiles
fbd050bd0b Enable ClangTidy check modernize-make-unique.
The majority of existing call sites were automatically updated using
clang-tidy -fix. A small handful required a manual update,
e.g. CppCodeGen.

This check is a bit lenient, and in particular will not flag cases like
`std::unique_ptr<Base>(new Derived())` which is still pretty common
throughout our codebase. This CL does not attempt to replace all the
cases that ClangTidy does not flag.

Change-Id: I5eba48ef880e25d22de80f321a68c389ba769e36
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307459
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-03 17:53:52 +00:00
Julia Lavrova
90787fefef Reland #3 "ICU API: only in SkParagraph, simplified."
This is the fix for google3 failure.
This reverts commit e36a466723.

Reason for revert: Trying to fix google3 build brake

Original change's description:
> Revert "Reland "ICU API: only in SkParagraph, simplified (relanding reverted).""
>
> This reverts commit 16fbc24772.
>
> Reason for revert: Checking to see if this is blocking the G3 roll
>
> Original change's description:
> > Reland "ICU API: only in SkParagraph, simplified (relanding reverted)."
> >
> > This reverts commit a30095d17c.
> >
> > Reason for revert: Fixing the build
> >
> > Original change's description:
> > > Revert "ICU API: only in SkParagraph, simplified (relanding reverted)."
> > >
> > > This reverts commit 7479eda3b6.
> > >
> > > Reason for revert: Breaking build
> > >
> > > Original change's description:
> > > > ICU API: only in SkParagraph, simplified (relanding reverted).
> > > >
> > > > Reverted commit: https://skia-review.googlesource.com/c/skia/+/296128/
> > > >
> > > > Change-Id: Iaf793bff94a6060579c7d6176d477e598c047be6
> > > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303261
> > > > Reviewed-by: Mike Reed <reed@google.com>
> > > > Commit-Queue: Julia Lavrova <jlavrova@google.com>
> > >
> > > TBR=reed@google.com,jlavrova@google.com
> > >
> > > Change-Id: Idd4c41e22aa59e24bdbd07f2fa5e9258c1bbb7a7
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303358
> > > Reviewed-by: Julia Lavrova <jlavrova@google.com>
> > > Commit-Queue: Julia Lavrova <jlavrova@google.com>
> >
> > TBR=reed@google.com,jlavrova@google.com
> >
> > Change-Id: Iea5da4535ea2e388e8e632e6c556b66c8781631a
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303377
> > Reviewed-by: Ben Wagner <bungeman@google.com>
> > Reviewed-by: Julia Lavrova <jlavrova@google.com>
> > Commit-Queue: Julia Lavrova <jlavrova@google.com>
>
> TBR=bungeman@google.com,reed@google.com,jlavrova@google.com
>
> Change-Id: I1edfecc56add670b251adf44892265088fd32c42
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304058
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

TBR=bungeman@google.com,robertphillips@google.com,reed@google.com,jlavrova@google.com

Change-Id: Ife73aa21539e870d69bda6b5892979646732d778
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304060
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-24 13:28:52 +00:00
Robert Phillips
e36a466723 Revert "Reland "ICU API: only in SkParagraph, simplified (relanding reverted).""
This reverts commit 16fbc24772.

Reason for revert: Checking to see if this is blocking the G3 roll

Original change's description:
> Reland "ICU API: only in SkParagraph, simplified (relanding reverted)."
> 
> This reverts commit a30095d17c.
> 
> Reason for revert: Fixing the build
> 
> Original change's description:
> > Revert "ICU API: only in SkParagraph, simplified (relanding reverted)."
> >
> > This reverts commit 7479eda3b6.
> >
> > Reason for revert: Breaking build
> >
> > Original change's description:
> > > ICU API: only in SkParagraph, simplified (relanding reverted).
> > >
> > > Reverted commit: https://skia-review.googlesource.com/c/skia/+/296128/
> > >
> > > Change-Id: Iaf793bff94a6060579c7d6176d477e598c047be6
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303261
> > > Reviewed-by: Mike Reed <reed@google.com>
> > > Commit-Queue: Julia Lavrova <jlavrova@google.com>
> >
> > TBR=reed@google.com,jlavrova@google.com
> >
> > Change-Id: Idd4c41e22aa59e24bdbd07f2fa5e9258c1bbb7a7
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303358
> > Reviewed-by: Julia Lavrova <jlavrova@google.com>
> > Commit-Queue: Julia Lavrova <jlavrova@google.com>
> 
> TBR=reed@google.com,jlavrova@google.com
> 
> Change-Id: Iea5da4535ea2e388e8e632e6c556b66c8781631a
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303377
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Reviewed-by: Julia Lavrova <jlavrova@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

TBR=bungeman@google.com,reed@google.com,jlavrova@google.com

Change-Id: I1edfecc56add670b251adf44892265088fd32c42
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304058
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-20 16:39:15 +00:00
Julia Lavrova
16fbc24772 Reland "ICU API: only in SkParagraph, simplified (relanding reverted)."
This reverts commit a30095d17c.

Reason for revert: Fixing the build

Original change's description:
> Revert "ICU API: only in SkParagraph, simplified (relanding reverted)."
>
> This reverts commit 7479eda3b6.
>
> Reason for revert: Breaking build
>
> Original change's description:
> > ICU API: only in SkParagraph, simplified (relanding reverted).
> >
> > Reverted commit: https://skia-review.googlesource.com/c/skia/+/296128/
> >
> > Change-Id: Iaf793bff94a6060579c7d6176d477e598c047be6
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303261
> > Reviewed-by: Mike Reed <reed@google.com>
> > Commit-Queue: Julia Lavrova <jlavrova@google.com>
>
> TBR=reed@google.com,jlavrova@google.com
>
> Change-Id: Idd4c41e22aa59e24bdbd07f2fa5e9258c1bbb7a7
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303358
> Reviewed-by: Julia Lavrova <jlavrova@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

TBR=reed@google.com,jlavrova@google.com

Change-Id: Iea5da4535ea2e388e8e632e6c556b66c8781631a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303377
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2020-07-20 15:26:31 +00:00
Julia Lavrova
a30095d17c Revert "ICU API: only in SkParagraph, simplified (relanding reverted)."
This reverts commit 7479eda3b6.

Reason for revert: Breaking build

Original change's description:
> ICU API: only in SkParagraph, simplified (relanding reverted).
> 
> Reverted commit: https://skia-review.googlesource.com/c/skia/+/296128/
> 
> Change-Id: Iaf793bff94a6060579c7d6176d477e598c047be6
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303261
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

TBR=reed@google.com,jlavrova@google.com

Change-Id: Idd4c41e22aa59e24bdbd07f2fa5e9258c1bbb7a7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303358
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2020-07-16 16:35:12 +00:00
Julia Lavrova
7479eda3b6 ICU API: only in SkParagraph, simplified (relanding reverted).
Reverted commit: https://skia-review.googlesource.com/c/skia/+/296128/

Change-Id: Iaf793bff94a6060579c7d6176d477e598c047be6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303261
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2020-07-16 15:57:28 +00:00
Julia Lavrova
a6d1e98b65 Revert "ICU API: only in SkParagraph, simplified."
This reverts commit 8d639e1a42.

Reason for revert: Build break

Original change's description:
> ICU API: only in SkParagraph, simplified.
> 
> Change-Id: I4f7fbb233217cb3b7a171c91720c9c2289e28a5f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296128
> Commit-Queue: Julia Lavrova <jlavrova@google.com>
> Reviewed-by: Mike Reed <reed@google.com>

TBR=djsollen@google.com,bungeman@google.com,reed@google.com,jlavrova@google.com

Change-Id: If41d7ebaa081837bf2615b24d9035f37cdb76081
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300712
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-07-06 19:59:15 +00:00
Julia Lavrova
8d639e1a42 ICU API: only in SkParagraph, simplified.
Change-Id: I4f7fbb233217cb3b7a171c91720c9c2289e28a5f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296128
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-07-06 19:13:23 +00:00
Adlai Holler
f54dbf71e8 Clean up SkShaper_coretext.cpp & SkCGBase.h
- Use SkUniqueCFRef.
- Use CFShow to print dictionary.
- Use CGFLOAT_IS_DOUBLE define.
- Use kCFAllocatorDefault consistently.

Change-Id: If0276cab0182d33aacf1060a734b8b025e16f99e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295010
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-06-08 19:04:54 +00:00
Ben Wagner
94aed0be1f Use "und" in place of HB_LANGUAGE_INVALID.
Buffers with HB_LANGUAGE_INVALID race since it will force
hb_buffer_guess_segment_properties to call hb_language_get_default which
is not thread safe. The user is required to pass a language string to
the shaper, but it may be malformed and hb_language_from_string may
return HB_LANGUAGE_INVALID. Detect this and use "und" as the language,
since the language really isn't known (RFC5646 4.1 5).

Bug: skia:10323
Change-Id: Icf2389e606eb1b635d7535e57be10cca23bf9d33
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294999
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-06-08 16:24:00 +00:00
Ben Wagner
d13487e71b Regularize SkFontMgr for CoreText build.
Move SkFontHost_mac.cpp into an 'optional' like the other fontmgr build
rules. This allows building with other fontmgrs on Mac and makes the lib
dependencies explicit. In the future this helps with splitting the out
the default factory.

Change-Id: Iecef9e428acb69f89b54afa00b4e779f5858c61a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294076
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-06-04 16:45:09 +00:00
Ben Wagner
5b8dd73546 Hide ICU C++ API from Skia users.
Parts of third_party need the C++ API so hide it from Skia users as
needed to prevent re-introduction.

This also avoids the ICU version renaming / name mangling when building
our own test version of ICU. This makes life in an editor and debugger
much easier.

Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292854
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Change-Id: Id636fbf9e750fe72a4ace8a59fb9acac839a07c4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292967
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-05-29 21:43:19 +00:00
Ben Wagner
2837f24a16 Revert "Hide ICU C++ API from Skia users."
This reverts commit 5ef0d2f6c0.

Reason for revert: Sharing a build with flutter is crazy pants.

Original change's description:
> Hide ICU C++ API from Skia users.
> 
> Parts of third_party need the C++ API so hide it from Skia users as
> needed to prevent re-introduction.
> 
> This also avoids the ICU version renaming / name mangling when building
> our own test version of ICU. This makes life in an editor and debugger
> much easier.
> 
> Change-Id: I8fb1903e2b31e9dd04efa22173a03115d629c232
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292854
> Reviewed-by: Julia Lavrova <jlavrova@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>

TBR=bungeman@google.com,reed@google.com,jlavrova@google.com

Change-Id: If238225b20a6b73064e3b16c5e0bdc89760e522d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292966
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-05-29 19:08:04 +00:00
Ben Wagner
def1df3f11 Create CTTypesetter without Options.
Calling the 'AndOptions' version with nullptr for the options on 10.13
is reported to crash. Since the options are unused, use the version of
the call without them.

Bug: skia:10282
Change-Id: I6674b0230f403744c9dd471245eeb3a78c2a4417
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292727
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-05-29 18:57:26 +00:00
Ben Wagner
5ef0d2f6c0 Hide ICU C++ API from Skia users.
Parts of third_party need the C++ API so hide it from Skia users as
needed to prevent re-introduction.

This also avoids the ICU version renaming / name mangling when building
our own test version of ICU. This makes life in an editor and debugger
much easier.

Change-Id: I8fb1903e2b31e9dd04efa22173a03115d629c232
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292854
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-05-29 18:04:46 +00:00
Ben Wagner
4651b99f32 Reland "Cache hb_face."
Creating an hb_face can be quite expensive, cache them.

This implementation is similar to the super simple caching strategy used
by libtxt. It uses a simple global LRU cache from SkFontID to hb_hbface
of size 100.

Reviewed-on: https://skia-review.googlesource.com/c/skia/+/289442
Change-Id: I971620f7aaaf2d7b6902da8681e29d6d458429ed
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290761
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-05-19 17:42:14 +00:00
Mike Reed
7a4ea2baf5 Revert "Cache hb_face."
This reverts commit d19bb17782.

Reason for revert: windows build failure?
lld-link: error: undefined symbol: private: void __cdecl SkSemaphore::osSignal(int)


Original change's description:
> Cache hb_face.
> 
> Creating an hb_face can be quite expensive, cache them.
> 
> This implementation is similar to the super simple caching strategy used
> by libtxt. It uses a simple global LRU cache from SkFontID to hb_hbface
> of size 100.
> 
> Change-Id: I364a4548699cece50073e829a065c0a303245873
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/289442
> Commit-Queue: Ben Wagner <bungeman@google.com>
> Reviewed-by: Mike Reed <reed@google.com>

TBR=bungeman@google.com,reed@google.com

Change-Id: I31967a638fb497f28ca3d3f26ef3692dddff004d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290718
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-05-19 01:35:41 +00:00
Ben Wagner
d19bb17782 Cache hb_face.
Creating an hb_face can be quite expensive, cache them.

This implementation is similar to the super simple caching strategy used
by libtxt. It uses a simple global LRU cache from SkFontID to hb_hbface
of size 100.

Change-Id: I364a4548699cece50073e829a065c0a303245873
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/289442
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-05-18 20:18:07 +00:00
Mike Reed
0cbd58766a be sure to keep the fonts alive for the two loops
Bug: skia:10124
Change-Id: I449b72a00d714207a6bbc7948b5cdbb9a541b43f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/287819
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-05-05 15:40:59 +00:00
Mike Klein
dc976a96ea update skstd
- Lots of skstd::foo is now std::foo since C++14.
- Get rid of SK_WHEN(cond,T); std::enable_if_t<cond,T> is pithy enough.
- Move SkBitmaskEnum.h contents into sknonstd.

Change-Id: Ie5dc459405b1ff55e5b3ac57e70df7edd7cf38c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/286315
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-04-30 15:05:43 +00:00
Mike Klein
96f6401789 harmonize rewrite-includes and gn-format checks
The CheckGeneratedFiles bot only required rewriting
.gn files, while the presubmit wants both .gn and .gni files.

It also appears that the #includes rewrite script runs on
both the presubmit and CheckGeneratedFiles bots.

These presubmits run on the CQ before landing right?
If so, no need for them in the CheckGeneratedFIles bot at all.

And of course, format .gni files.

Change-Id: Icd4526d62f85088862ad93566cc9ace11dc3e33f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281505
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-04-03 17:00:54 +00:00
Mike Klein
a01c6b0b59 reformat GN files
Change-Id: I2d19c4f0ff1439dcd923a3064eb3ba78432a5113
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281043
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-04-01 23:23:03 +00:00
Brian Osman
788b91678f Remove SkTMin and SkTMax
Use std::min and std::max everywhere.

SkTPin still exists. We can't use std::clamp yet, and even when
we can, it has undefined behavior with NaN. SkTPin is written
to ensure that we return a value in the [lo, hi] range.

Change-Id: I506852a36e024ae405358d5078a872e2c77fa71e
Docs-Preview: https://skia.org/?cl=269357
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269357
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-02-07 18:40:09 +00:00
Brian Osman
2758ec2be8 Reland "Fix skshaper in component builds"
Change-Id: Ic7e233216f7d1031cf2c0f97003140b3e09f5491
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267760
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-30 18:57:16 +00:00
Brian Osman
482f1c7479 Revert "Fix skshaper in component builds"
This reverts commit d1be5d64f8.

Reason for revert: Chrome win compile

Original change's description:
> Fix skshaper in component builds
> 
> It was building a shared library, but had no exports (on Windows).
> We think the correct model for modules in the future is for each one
> to be a separate DLL linked against the public API/exports of Skia.
> This serves as the model for that. Doing this with other modules will
> probably require exporting more symbols from Skia.
> 
> Change-Id: I116b1635533d755ae71e8df5aa234270b7f77a31
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267477
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

TBR=mtklein@google.com,brianosman@google.com

Change-Id: I4c70dc996ce3964b017dc863bed2428bf4b63325
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267758
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-30 15:35:13 +00:00
Brian Osman
eb40726b88 Revert "Use separate SKSHAPER_DLL define to activate shared library logic"
This reverts commit 3e98c0e1d1.

Reason for revert: Need to revert earlier CL

Original change's description:
> Use separate SKSHAPER_DLL define to activate shared library logic
> 
> Change-Id: I35cd463fd85920651a940a9af131f7b6515c2a3a
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267676
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

TBR=mtklein@google.com,brianosman@google.com

Change-Id: Ia25b838a2fbe5cd5a7be7a0a8c2e7052647ded9a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267757
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-30 15:31:58 +00:00
Brian Osman
3e98c0e1d1 Use separate SKSHAPER_DLL define to activate shared library logic
Change-Id: I35cd463fd85920651a940a9af131f7b6515c2a3a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267676
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-30 15:15:27 +00:00
Brian Osman
d1be5d64f8 Fix skshaper in component builds
It was building a shared library, but had no exports (on Windows).
We think the correct model for modules in the future is for each one
to be a separate DLL linked against the public API/exports of Skia.
This serves as the model for that. Doing this with other modules will
probably require exporting more symbols from Skia.

Change-Id: I116b1635533d755ae71e8df5aa234270b7f77a31
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267477
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-30 14:20:48 +00:00
Mike Reed
f4a90679d1 tweak textbox to use subpixel
This makes it line-up with the coretext version.

Bug: skia:9836
Change-Id: I39f51e56ecb0d55ab970a8fa247bede9f4f0f394
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267445
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-29 18:26:27 +00:00
Mike Reed
a2a0c8a2c4 extract font from run
Change-Id: Ice98eeb1f815cf07f842b22ddc26e32e849a1218
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267256
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-29 15:28:06 +00:00
Mike Reed
04da74633f improvements to shaper_ct
- fix CF leaks
- handle memory allocs better (using arena)

Change-Id: I0282bac288f7e5a785b6aab100251edde4b06b3f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267079
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-01-28 22:05:31 +00:00
Mike Reed
b2bf28cbbc Experimental coretext backend for SkShaper
Primary goal: API compatibility with SkShaper but reduce code size on iOS.

Change-Id: I6ee8f49827a029569010a69308541b74a21ac3e2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266854
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-01-28 17:41:54 +00:00
Ben Wagner
32b45b32b7 Glyph 0xFFFF is a valid glyph.
Assert that the hb_codepoint_t passed to skhb_glyph_extents is in range
using SkTo, which is obviously correct (and consistently used elsewhere)
instead of the incorrect '< 0xFFFF' since 0xFFFF is a valid glyph id.

While doing so, rename the hb_codepoint_t parameters which are actually
glyph ids to reflect that they are glyphs and not codepoints (HarfBuzz
uses hb_codepoint_t for both).

Change-Id: I0bf2b7f12183dfb8254856b12168b8bee867c430
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265769
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-01-22 19:22:15 +00:00
Ben Wagner
56a48bb1aa Avoid BOT/EOT setting in HarfBuzz.
Unlike many users of HarfBuzz, the Skia shaper sets HB_BUFFER_FLAG_BOT
and HB_BUFFER_FLAG_EOT flags to inform HarfBuzz that the full context
contains the beginning and end of the paragraph so that it can treat the
beginning and end of the context specially. In reality, the EOT flag
currently does nothing and the BOT flag only has the effect of adding a
dotted circle (if the font provides it) if the first codepoint in the text
and context is a unicode mark. This behavior is generally unwanted, so
just remove it with a note to revisit this decision should HarfBuzz ever
change the effect of these flags.

Bug: skia:9618
Change-Id: I6cdf86ff3499e1321b1212d63192a4a9c5847e39
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264686
Auto-Submit: Ben Wagner <bungeman@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-01-16 22:48:16 +00:00
Mike Klein
f46d5ca492 use std::make_unique
Change-Id: I7c672ff6b8eb95ec8c1123a5bfdb202e1644f494
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259281
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-12-12 22:32:45 +00:00
Ben Wagner
24ee4e0341 Add feature support to shaper.
Change-Id: Iab8bf9ab144d1661c0653b617ca394c3663ab35c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248861
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
2019-12-06 14:42:31 +00:00
Brian Osman
417d299d44 Fix windows DLL builds with shaper included
Change-Id: I7adc1e01f4f9cec56e53e620ba4d04eae61f0b9e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254899
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-11-19 14:50:12 +00:00
Ben Wagner
da53dd5e17 Reland "Fix empty run handling in trivial shaper iterators"
This reverts commit 1803f4ef6f.
And also fixes the primitive shaper.

Change-Id: Ieaeda5522c98d8a9e6f628b8a6cc30cf41278350
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252929
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-11-06 14:32:13 +00:00
Ben Wagner
1803f4ef6f Revert "Fix empty run handling in trivial shaper iterators"
This reverts commit 0f3a26dd18.

Reason for revert: Windows bots are broken

Original change's description:
> Fix empty run handling in trivial shaper iterators
> 
> When the text run is of zero length the iterator starts at the end. The
> trivial itereators did not handle this case.
> 
> Change-Id: Id41304500e33d821874f56ab20085cbc4b2d9b0b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252857
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>

TBR=bungeman@google.com,herb@google.com

Change-Id: Ia38e46ac4c04def5d374fbbce450538096d90d64
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252923
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-11-05 20:13:43 +00:00
Ben Wagner
0f3a26dd18 Fix empty run handling in trivial shaper iterators
When the text run is of zero length the iterator starts at the end. The
trivial itereators did not handle this case.

Change-Id: Id41304500e33d821874f56ab20085cbc4b2d9b0b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252857
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-11-05 19:51:11 +00:00
Ben Wagner
bdf2c87947 HarfBuzz reports y-up, convert to y-down.
Change-Id: If90857f9cf8039ddc0dfba7f660d415a41953015
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250818
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-10-25 14:41:50 +00:00
Ben Wagner
1ca50524c4 Allow better font fallback.
The intent is to allow the creation of a MakeFontMgrRunIterator which
uses the passed font's typeface as the primary typeface, but uses a
given family name and style as for the request for fallback fonts. This
allows the user to provide the actual request for the primary typeface
as opposed to making a request based on the resolved primary typeface
(which may not be the right thing to do).

To support this, the selection of language for fallback is also added.
Since this information is already in the language iterator, this change
makes the font iterator the lowest priority iterator for consume,
allowing the font iterator to rely on the current value of the language
iterator to provide the language.

In order to allow these changes to be exercised, this also adds a few
generic 'Make' methods for bidi and script. These new methods will use
the best available implementation. These are needed since the most
capable implementations may not always be available (such as on our
testing ios builds).

Change-Id: I1b8d9c9007058adcb2a26e0581d903b835a6118f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245460
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-10-02 22:19:13 +00:00
Ben Wagner
89e1f600ec Improve implementations of copyTable.
The CoreText version relies on undefined behavior and the DirectWrite
version makes an extra copy of the data. This fixes several issues
introduced in https://skia-review.googlesource.com/c/skia/+/229384 .

Change-Id: I29a2170465bafcf6fe7ae5ad107e85a9e882bd33
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244721
Commit-Queue: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-09-30 14:55:44 +00:00
Ben Wagner
0033008d95 Properly subset the run in ShapeThenWrap.
The previous code always reported the runs on the lines as being full
runs even when they were actually partial runs.

Change-Id: Icc746a7bdeebdde6c4979d8cb438426d21246d57
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/241881
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-09-17 19:24:07 +00:00
Julia Lavrova
526df26b03 Reshuffling bidi regions + empty text sizes + some font resolution bugs
Change-Id: Icc0d688985de7253f3113e5c9657544f68b4e01d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/236217
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-09-04 20:42:15 +00:00
Ben Wagner
723a877d0c Make SkFunctionWrapper a better wrapper.
SkFunctionWrapper was made to be a simple abstraction over existing
resource release functions which generally follow a specific pattern of
returning void and taking a pointer to the underlying type. However,
this has been observed to be an unnecessary limit. This makes it more
generic while also making the call sites a little less brittle.

This change also uncovered an issue in msvc v19.20 to v19.22, see
https://developercommunity.visualstudio.com/content/problem/698192/in-templateusing-decltype-is-void.html
To work around this, several otherwise redundant '&' are used.

There was an attempt to take references to functions instead of pointers
to functions which greatly simplifies the intermediate wrappers.
However, that uncovered another issue in msvc, see
https://developercommunity.visualstudio.com/content/problem/699878/function-to-pointer.html

Change-Id: I54ab945ed9d9cfd0204d4d6650c2fde47cc9e175
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235105
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-08-20 20:31:36 +00:00
Ben Wagner
bedbb0780b Allow HarfBuzz to massage the character stream.
If the nominal_glyphs callback returns a value less than 'count'
HarfBuzz will process the rest of the buffer with the nominal_glyph
callback and attempt to find glyphs through NFC and space synthesis. It
may be preferable in the future to tweak this behavior, since this is
effectively modifying the font.

Change-Id: If2deeb643c5e636d18e914eb7ee32518f86077f5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/231110
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-07-31 19:54:36 +00:00
Florin Malita
426843323f [skottie,skshaper] Plumb an optional SkFontMgr in SkShaper/SkottieShaper
Skottie already takes an optional client fontmgr at load time, but
SkShaper(HB) currently uses the default fontmgr for fallback.

Plumb the Skottie font manager all the way to SkShaper.

This should give clients more control over font fallback, instead of
relying on the default SkFontMgr.

Change-Id: I3df16b3924a68d232573e25f9e526f523fc1dc08
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230122
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner aka dogben <benjaminwagner@google.com>
2019-07-26 19:34:48 +00:00
Mike Klein
e172236e7b rewrite *.gn and #includes on CheckGeneratedFiles bot
In addition to checking .fp files, this ought to make this bot now also
check that our .gn files are formatted and our #includes are consistent
with rewrite_includes.py.

Some .gn files needed formatting; you can see the failure caught on PS 4.

Cq-Include-Trybots: skia.primary:Housekeeper-PerCommit-CheckGeneratedFiles
Change-Id: Ia6669581406212c986da81f2521e4e9d8d3eadb4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/229802
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
2019-07-25 20:48:33 +00:00
Mike Reed
6d907faa7d add copytable method to typefaces
This allows some backends to efficiently retrieve a copy of the data.

Inspired by https://skia-review.googlesource.com/c/skia/+/229136

Change-Id: I9b0345333e30376a50a5dc7c9e993b847e2791c4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/229384
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-07-24 19:20:46 +00:00
Julia Lavrova
a3552c5e6d Reland "SkParagraph"
This is a reland of 10ad0b9b01

Original change's description:
> SkParagraph
>
> Change-Id: I0a4be75fd0c18021c201bcc1edfdfad8556edeff
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/192100
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

Change-Id: I46cf43eae693edf68e45345acd0eb39e04e02bfc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219863
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2019-06-11 17:20:36 +00:00
Herb Derby
07cd38dc13 Revert "SkParagraph"
This reverts commit 10ad0b9b01.

Reason for revert: Breaks google3 build

Original change's description:
> SkParagraph
> 
> Change-Id: I0a4be75fd0c18021c201bcc1edfdfad8556edeff
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/192100
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

TBR=borenet@google.com,djsollen@google.com,halcanary@google.com,bungeman@google.com,kjlubick@google.com,reed@google.com,drott@chromium.org,jlavrova@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I3f4ef2f34b7489d008c2fe92527d39fba0e16ff7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219858
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-06-10 13:16:53 +00:00
Julia Lavrova
10ad0b9b01 SkParagraph
Change-Id: I0a4be75fd0c18021c201bcc1edfdfad8556edeff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/192100
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2019-06-07 17:23:23 +00:00
Ben Wagner
89799efe58 Document SkShaper::RunHandler::Buffer
This at least documents the current behavior. There exists tension between
users who just want positions and those who also want advances, which
requires this to be overly clever. Perhaps a better solution can be
found.

Change-Id: Ic2166ca294003da3325a0fe068ef84cdef9f804d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217259
Commit-Queue: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-05-30 23:06:02 +00:00
Mike Reed
c72216583d share tiny bit of code for std language iter
Change-Id: I928ba956c1ff038332d7c7497fe5fc0c297f4f22
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217140
Commit-Queue: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-05-30 19:10:44 +00:00
Ben Wagner
bd8c724fd4 Correct shaper assert around iterator fonts.
The assert here was intended to catch the case where a font run iterator
produced a font without specifying a typeface. This should never happen.
However, it is currently fine for the user to pass in a font without
specifying a typeface, which really means they don't care.

Change-Id: Ib63430142b9a05b4f2f8603e7a56a0ac09fa219f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/216874
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-05-30 14:47:58 +00:00
Ben Wagner
e8db325168 Add trivial implemenations of shaper run iterators.
Change-Id: I71f9cf2971cdb44ae2d189e29afc2ab330750dcb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/216780
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-05-30 13:19:28 +00:00
Ben Wagner
6bb79bbfdc Add SkShaper which just shapes.
This adds and SkShaper which doesn't wrap or re-order. This allows for
users to write their own implementations of shape-then-wrap logic.

Change-Id: I8bd8931ac9534c33883fc303be25f379c02da4b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/213829
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-05-15 15:37:08 +00:00
Ben Wagner
51e15a69ce Use SkTextEncoding enum instead of macros.
Change-Id: I4b6259590fa0693ee0522b4999a1c0fe250b173d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212504
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-05-07 20:54:16 +00:00
Mike Klein
c0bd9f9fe5 rewrite includes to not need so much -Ifoo
Current strategy: everything from the top

Things to look at first are the manual changes:

   - added tools/rewrite_includes.py
   - removed -Idirectives from BUILD.gn
   - various compile.sh simplifications
   - tweak tools/embed_resources.py
   - update gn/find_headers.py to write paths from the top
   - update gn/gn_to_bp.py SkUserConfig.h layout
     so that #include "include/config/SkUserConfig.h" always
     gets the header we want.

No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-24 16:27:11 +00:00
Brian Osman
eec1e9e4f1 Even more DLL build fixes
These changes let us build a non-official component build on Windows,
using either MSVC or clang

Change-Id: Ia3279aa19e007e70ff28925ff70a0bfe8144d96f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207307
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-04-10 21:02:40 +00:00
Brian Osman
c725e8f7ea Make SkShaper's GN setup more DLL friendly
Similar to the Skottie refactor that just landed, this avoids having an
empty component when shaper is disabled (which turns into a DLL with no
sources, and a missing DllMain). I think this pattern of having modules
expose the same components as empty groups is simpler (and also fixes
the fact that only two of N references in top-level BUILD.gn were
guarded). Also, no one is using the define?

Change-Id: I9d25c1cfbd42336874f4428bf61f3e34a4a18d3c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207303
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-04-10 18:59:35 +00:00
Ben Wagner
51874e3e37 Allow selection of shaper wrapping algorithm.
Change-Id: I8103348de810863088758d26b6b2d8062827105e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206170
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-04-04 21:03:00 +00:00
Ben Wagner
1383a38e1d Allow users to create stock shaping iterators.
This provides a way to re-use the existing basic shaping iterators.

Change-Id: I148dd513dcd01381301e7835672d0d605c1c462b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205933
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-04-04 15:04:59 +00:00
Ben Wagner
3bdb69c55f Clean up shaper handler.
Change-Id: Icb741ba9013747528e893c94df3b9242562028ba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205341
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-04-02 14:56:26 +00:00
Ben Wagner
1e08a7cbc4 Expose basic shaper iterators.
Change-Id: I1b4a04a296df6830c50461a891725b48a2defbd9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/204261
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-04-01 19:42:53 +00:00
Ben Wagner
7415a422ac Replace SkSpan with Range in shaper reporting.
This allows for using non-contiguous input in a future api for shaper.
This change forces cleanup of error handling when doing low level
shaping, which prompts cleaning up the correct shaper code to make the
control flow more obvious.

Bug: skia:8906
Change-Id: If084e0dd88e2f3a9651551ceeff87480e87fb998
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203465
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-03-25 20:26:50 +00:00
Hal Canary
c25f4e9eaa GN: split out skia_*_public from skia_*_sources
`gn check` passes.  We will work towards removing `check_includes = false`.

Change-Id: I0ab396fadaf31a166921bdea334b2cfedca23dcd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/195363
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-03-15 18:29:19 +00:00
Ben Wagner
ff84d8a900 SkTypeface::openStream to return smart pointer.
Change-Id: I2c936510e13561fcc9fd8343d5ab9f18c28c8340
Reviewed-on: https://skia-review.googlesource.com/c/195371
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-02-27 14:08:09 +00:00
Kevin Lubick
867da4b96e Allow system harfbuzz.
This should allow shaper to run on the no-deps bot.

Change-Id: I2515875d4e9b428681c20877630b904c3229ecc5
Reviewed-on: https://skia-review.googlesource.com/c/194420
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-02-23 12:14:30 +00:00
Kevin Lubick
1ba9c4df77 [canvaskit] JS API in place for shaped text
Depends on https://skia-review.googlesource.com/c/skia/+/186870

It's optional at build time, which is good given that
it adds about 2MB of uncompressed size (from 4.3 MB to 6.4 MB)

Bug: skia:
Change-Id: I5f54ad628b735c3bc880e917394fb27d16849ebe
Reviewed-on: https://skia-review.googlesource.com/c/187924
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-02-22 15:39:55 +00:00
Ben Wagner
b059194c08 Make SkShaper an interface.
The interface here is not ideal, but there will need to be some build
clean-up before it can be changed.

Change-Id: Ic4d55634405f4c8d9c194e4e6f368287c9669dcd
Reviewed-on: https://skia-review.googlesource.com/c/193036
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-02-19 22:06:47 +00:00
Ben Wagner
18ea3c70fb Add asserts to SkTextBlobBuilderRunHandler.
This makes a user check some postconditions of shaping.

Change-Id: Ifa34bbb9bd8baf18c830d58d99eee9c82811125a
Reviewed-on: https://skia-review.googlesource.com/c/193038
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
2019-02-19 15:55:42 +00:00
Hal Canary
1b85323f10 ICU: enable on wasm
Change-Id: I0647f641d4716af39f4afb832cfcc9fa7d571880
Reviewed-on: https://skia-review.googlesource.com/c/192832
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-02-15 18:14:43 +00:00
Ben Wagner
2fe1e23c58 Fix signed/unsigned mismatch in shaper assert.
Change-Id: I05e0e3f5940281b8c9fdcbabf6d8c1013bfa48d4
Reviewed-on: https://skia-review.googlesource.com/c/192824
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-02-14 22:38:37 +00:00
Ben Wagner
84cc4616df Fix assert in shaper.
Need and 'in range' operator.

Change-Id: I57cd6631376a6e857054b4712a70b2aa75a53223
Reviewed-on: https://skia-review.googlesource.com/c/192823
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-02-14 22:16:43 +00:00
Ben Wagner
83597ce581 Remove typeface from SkShaper constructor.
It isn't used anymore.

Change-Id: I4079ff9944aa2483a0cd42130d0e69fb98935731
Reviewed-on: https://skia-review.googlesource.com/c/192820
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
2019-02-14 21:41:28 +00:00
Ben Wagner
f61c936670 Add HarfBuzz callbacks.
This allows for SkTypefaces not backed by OpenType data to get minimal
shaping through HarfBuzz.

Change-Id: I0e4d69627500e0aff40c8989d3734597bfa1f8d6
Reviewed-on: https://skia-review.googlesource.com/c/192681
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-02-14 21:28:38 +00:00
Ben Wagner
b9cc1c6bc2 Fix calculating clusters from start of input.
Still some code hanging on from optimizing for SkTextBlob.

Bug: skia:8420

Change-Id: I947a9ff691fb1fbcb82934c5597e5db11c12f013
Reviewed-on: https://skia-review.googlesource.com/c/192683
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-02-14 21:23:38 +00:00
Hal Canary
b6f5378333 SkShaper: enable for unit and render tests
New tests that use skshaper should hide behind SK_USING_SKSHAPER define.

Change-Id: Ifcd726d931e3eb1ff209085a63e8129c9cd5596d
Reviewed-on: https://skia-review.googlesource.com/c/192026
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-02-13 16:19:48 +00:00
Ben Wagner
a8d94c1688 Font fallback to handle no font with character.
In the event that no fallback font can be found to handle a character,
just keep using the current font.

Change-Id: I93c852dc8ee5eaa868e48a5ce3e8298a642b15c7
Reviewed-on: https://skia-review.googlesource.com/c/191661
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
2019-02-12 21:52:12 +00:00
Ben Wagner
50becee292 Primitive SkShaper to do primitive line breaking.
This essentially resurects the old SkTextBox code into a primitive
shaper.

Change-Id: Ia4d1a5ab3d1c7d410962b49ac3891298655c7dc4
Reviewed-on: https://skia-review.googlesource.com/c/191562
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
2019-02-12 17:56:40 +00:00
Ben Wagner
454e5fb745 Fix cluster reporting from shaper.
Bug: skia:8420
Change-Id: I7eea8c6b3af2153a1ac1189782fc6cbaaf9ee5c6
Reviewed-on: https://skia-review.googlesource.com/c/190821
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-02-11 21:59:33 +00:00
Florin Malita
500133b1e2 [skshaper] Add per-line callback
Bug: skia:
Change-Id: Iaaf7e95230207bc796dd436a918722a089426e34
Reviewed-on: https://skia-review.googlesource.com/c/190220
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-02-07 16:30:00 +00:00
Ben Wagner
2fc1474f9d Add BOT/EOT to Shaper.
This informs HarfBuzz when we are at the beginning or end of a
paragraph so that it can handle a few rules in a special way.

Change-Id: I66a306f1ff7ddb2c1546b0fd9c0cee94cb9f7006
Reviewed-on: https://skia-review.googlesource.com/c/189850
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-02-06 23:04:59 +00:00
Hal Canary
6102192b96 SkLoadICU: simplify
Change-Id: I98cd1f36ca96a92b72974ae228465199638e4bea
Reviewed-on: https://skia-review.googlesource.com/c/189864
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-02-06 21:20:49 +00:00
Ben Wagner
0ec8ec27b8 Add a 'correct' shaper.
There are currently two consistent ways to do line breaking. The 'ok'
way where the entire line is shaped and the resulting glyphs broken
into lines based on hopeful cluster breaks. This has the one nice
property of preserving all shaping done by the font. The 'correct' way
is to shape to each break opportunity and pick the best one, then
continue to do so for each line. This has the nice property of not
shaping incorrectly.

Fortunately, the actual implementation can be hidden behind a common
interface. Keep both of them to ensure this continues to be the case.

Change-Id: I68086731c9c2eea00b26f1447e3ec17aba799ab3
Reviewed-on: https://skia-review.googlesource.com/c/156641
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-02-05 20:11:24 +00:00
Hal Canary
32498f0846 GN/ICU cleanup
For targets that depend on ICU, only define if `skia_use_icu` is set.

Move declare_args/skia_use_icu into skia.gni.  Other variables that need
to work like that can move there later.

icu/BUILD.gn defines SK_USING_THIRD_PARTY_ICU if needed.
SkShaper_harfbuzz.cpp SkPDFSubsetFont.cpp respects
SK_USING_THIRD_PARTY_ICU when calling SkLoadICU().

sfntly/BUILD.gn, harfbuzz/BUILD.gn, icu/icu.gni uses $_src variable to
reduce verbosity.   icu/icu.gni adds more headersto sources.

Change-Id: I9e000b9b19902d9f5c0c64e989bf42466aa8a299
Reviewed-on: https://skia-review.googlesource.com/c/189304
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
2019-02-05 17:27:55 +00:00
Kevin Lubick
57abfe9737 Adjust variable names from paint to font
Bug: skia:
Change-Id: I9ca7c8dd5e0122b2a9d4edd4c4f4934e36151b7e
Reviewed-on: https://skia-review.googlesource.com/c/187383
Auto-Submit: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-01-28 20:57:56 +00:00
Ben Wagner
c5aa8ebe0d Use only icu c api in shaper.
Change-Id: I6e05404465b44ca48d391d0502dadbcef0b4b111
Reviewed-on: https://skia-review.googlesource.com/c/186702
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-01-24 21:53:25 +00:00
Mike Reed
77f94ea72b Move more utils into SkFontPriv, IWYU
Fissioned from https://skia-review.googlesource.com/c/skia/+/185460

Bug: skia:
Change-Id: Iaf980e931c17196f917602fc58fc39ab51e3d248
Reviewed-on: https://skia-review.googlesource.com/c/185840
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-01-22 22:24:03 +00:00
Florin Malita
a4e1a63452 [skshaper] Relax create_hb_font assert
Log a message in debug mode instead of crashing.

Change-Id: Ib8d7733f3aab2e9f1324188a221550ccf13563cb
Reviewed-on: https://skia-review.googlesource.com/c/185881
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-01-22 22:20:33 +00:00
Mike Reed
9a4a05e211 iwyu
Bug: skia:
Change-Id: I4b9e1ef1e352f3495e92479501cfc5b6422e7a6d
Reviewed-on: https://skia-review.googlesource.com/c/185682
Commit-Queue: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-01-22 14:08:13 +00:00
Florin Malita
6d415bce3a [skshaper] Build tweaks
Preps for building in Chromium & G3.

Change-Id: I4eb802f27aac7d3652c3b3ce427dcc758d6c31fe
Reviewed-on: https://skia-review.googlesource.com/c/185000
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-01-18 20:25:40 +00:00
Florin Malita
950243df0e Hack up SkShaper to pass additional callback info
- rename LineHandler -> RunHandler (since it gets called per run)
- pass additionl run info:

  * line index
  * cumulative advance
  * ascent/descent/leading

Bug: skia:
Change-Id: Ie848e5a35243088b99989c73fdec44c6a1bdd051
Reviewed-on: https://skia-review.googlesource.com/c/183300
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-01-11 17:04:26 +00:00
Mike Reed
22451ccae5 accessors for RunBuffer as points or rsxforms
trying to reduce casts at call-sites

Bug: skia:
Change-Id: I7c74cfd89111f7a197cbb1d77b499e2adc193579
Reviewed-on: https://skia-review.googlesource.com/c/180363
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-01-02 04:10:36 +00:00
Florin Malita
9867f61160 SkShaper per-line callback
Tweak SkShaper to call out for each line, instead of bundling everything
as a text blob.

Change-Id: Ic522f88afcf31cefd873dc8b5cde1ac2e107c64f
Reviewed-on: https://skia-review.googlesource.com/c/176592
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-12-12 17:54:12 +00:00
Mike Reed
6d59568196 change private alloc methods to also take fonts
Bug: skia:2664
Change-Id: I772534179ce0c948984640f9fffc22e0372fce97
Reviewed-on: https://skia-review.googlesource.com/c/174848
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-12-06 02:15:36 +00:00
Hal Canary
2a1848d2aa SkShaper->SkFont
Change-Id: I6293f08c426650e3d1da8b2f94a81f7b0a65e8a3
Reviewed-on: https://skia-review.googlesource.com/c/172969
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2018-11-27 18:53:32 +00:00