Go to file
halcanary f0c30f5566 SkPDF: Join Positioned Text
When N sequential positioned glyphs differ in positions by exactly the
advances of the first (N-1) glyphs, join the glyphs into a string
rather than changing the text matrix between each glyph draw.

Decreases PDF output size by about ~1.4%.  Potentially more on
text-heavy pages.

A single-typeface PDF of an 27kB ASCII document shaped with harfbuzz:
        before:  187743 Bytes
         after:  65513 Bytes
    difference:  -65.1%

Before:
    BT
    /F0 13 Tf
    1 0 0 -1 143.5 61 Tm
    <0029> Tj
    1 0 0 -1 150.634765 61 Tm
    <004C> Tj
    1 0 0 -1 154.602050 61 Tm
    <0055> Tj
    1 0 0 -1 160.245117 61 Tm
    <0048> Tj
    1 0 0 -1 167.925781 61 Tm
    <004B> Tj
    1 0 0 -1 176.469726 61 Tm
    <0052> Tj
    1 0 0 -1 184.518554 61 Tm
    <0056> Tj
    1 0 0 -1 190.980468 61 Tm
    <0048> Tj
    ET

After:
    BT
    /F0 13 Tf
    1 0 0 -1 0 0 Tm
    143.5 -61 Td <0029004C0055> Tj
    16.7451171 0 Td <0048004B005200560048> Tj
    ET

Also: update the Text matrix with the `Td` operator, instead of
overwriting it with the the `Tm` operator.  In the worst case, when
every glyph is positioned differently than it's advance, this still
makes the command stream smaller:

Before:
    ...
    1 0 0 -1 58.328125 660 Tm <0055> Tj
    1 0 0 -1 61.609375 660 Tm <004C> Tj
    1 0 0 -1 63.828125 660 Tm <0056> Tj
    ...

After:
    ...
    3.140625 0 Td <0055> Tj
    3.28125 0 Td <004C> Tj
    2.21875 0 Td <0056> Tj
    ...

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2150393002

Review-Url: https://codereview.chromium.org/2150393002
2016-07-15 13:35:45 -07:00
animations first cut at a checkbox 2009-10-21 19:41:10 +00:00
bench Add a bench to measure the best way to pack from int to uint16_t with SSE. 2016-07-15 07:45:53 -07:00
bin bin/fetch-skps: print instruction on error 2016-04-26 12:38:47 -07:00
build_overrides GN 2016-06-23 10:29:30 -07:00
cmake initial checkin of SkSL compiler 2016-07-01 08:22:01 -07:00
debugger Fix old debugger 2016-04-29 14:02:18 -07:00
dm Make XML compilation conditional. 2016-07-15 10:33:29 -07:00
example Lots of progress on switching to SkColorSpace rather than SkColorProfileType 2016-06-16 13:03:24 -07:00
experimental tools/SkShaper: SkStream->blob 2016-07-12 09:17:43 -07:00
fuzz remove DownSample imagefilter 2016-06-25 14:30:44 -07:00
gm SkPDF: Always give a default advance for glyphs. 2016-07-15 12:54:30 -07:00
gyp Fix broken Android framework build. 2016-07-15 12:52:34 -07:00
include remove unused CreateInfo flag 2016-07-15 09:41:27 -07:00
infra Convert Win toolchain to CIPD package 2016-07-15 08:34:08 -07:00
platform_tools Update documents/scripts for SampleApp removal 2016-07-12 09:12:39 -07:00
resources Use hintgasp font when testing rendering. 2016-07-12 06:55:25 -07:00
samplecode Factor code to rotate a canvas about a point. 2016-07-12 15:01:19 -07:00
site Fix option name typo 2016-07-12 15:11:31 -07:00
src SkPDF: Join Positioned Text 2016-07-15 13:35:45 -07:00
tests Make XML compilation conditional. 2016-07-15 10:33:29 -07:00
third_party GN 2016-06-23 10:29:30 -07:00
tools Add verb field in scraping scripts 2016-07-14 07:44:50 -07:00
.gitignore Add CIPD support for bot assets 2016-06-28 04:41:49 -07:00
.gn GN 2016-06-23 10:29:30 -07:00
AUTHORS SkPDF: Use type 2/3 shading for gradient shaders 2016-06-17 12:38:54 -07:00
BUILD.gn GN 2016-06-23 10:29:30 -07:00
codereview.settings Automatically add a docs preview link and NOTRY=true when there are only docs changes. 2015-02-26 10:16:13 -08:00
CONTRIBUTING Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
CQ_COMMITTERS Moved committer list to chrome-infra-auth and deleted it from the repo 2015-09-02 13:37:54 -07:00
DEPS Build Expat on all platforms 2016-07-14 14:02:24 -07:00
Doxyfile Documentation: SkCanvas API 2015-05-19 10:21:29 -07:00
gn.py GN 2016-06-23 10:29:30 -07:00
gyp_skia Make Win runtime DLLs writeable before overwriting 2016-03-18 08:33:38 -07:00
gyp_skia.py Roll gyp deps from 1765 to 1796. 2013-11-21 18:11:14 +00:00
LICENSE Include resources directory in google3 sync. 2015-10-20 13:00:48 -07:00
make.bat Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
make.py GYP: remove stale skia_scalar gyp variable 2015-11-10 13:25:12 -05:00
Makefile Add visualbench as valid target to Makefile 2015-12-18 08:05:06 -08:00
OWNERS add root files from chrome 2013-08-13 19:11:15 +00:00
PRESUBMIT.py Specifying master names with "master." prefix is deprecated 2016-07-13 12:57:42 -07:00
public.bzl Exclude XML and dependencies from Bazel build. 2016-07-15 11:27:27 -07:00
README Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
README.chromium Update README.chromium. 2015-06-11 13:19:24 -07:00
SK_IMAGE_VERSION Remove extra DNG images and use smaller HTC.dng 2016-05-24 06:23:47 -07:00
skia.gyp Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
SKP_VERSION Update SKP version 2016-07-10 00:41:28 -07:00
whitespace.txt Test PDFium bot again 2016-06-04 11:57:23 -07:00

Skia is a complete 2D graphic library for drawing Text, Geometries, and Images.

See full details, and build instructions, at https://skia.org.