New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 625995 link

Starred by 26 users

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

Printing problem when Helvetica Neue is used.

Reported by loorong...@gmail.com, Jul 6 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36

Steps to reproduce the problem:
1. Go to Google Docs.
2. Select Helvetica Neue font-type.
3. Type "The quick brown fox jumps over the lazy dog".
4. Print.

What is the expected behavior?
Characters should be rendered properly.

What went wrong?
Some characters are overlapped with a block symbol.

Did this work before? N/A 

Chrome version: 51.0.2704.106  Channel: stable
OS Version: 6.3
Flash Version: Shockwave Flash 22.0 r0

The user said this only happens in Chrome, other browsers are fine. They only use Mac OS. I tried to reproduce it with Windows 8.1 but the problem does not exist.

Sample preview: https://docs.google.com/viewer?a=v&pid=forums&srcid=MTUxMDQyNjg3OTc0OTg5NzIyMDEBMDgyNDUyMzExMjMxODIwOTEwNDABZEhGMGYxMk5Cd0FKATAuMQFnb29nbGVwcm9kdWN0Zm9ydW1zLmNvbQF2Mg

Product forum link:
https://productforums.google.com/forum/#!msg/chrome/OOOWQPieuEA/dHF0f12NBwAJ
 
Cc: halcanary@chromium.org
Components: Internals>Printing
Labels: -OS-Windows -Arch-x86_64 OS-Mac
Status: Untriaged (was: Unconfirmed)
In print preview, it thinks the source document is HTML and not PDF, so this is not Docs generating a bad PDF.
Owner: paolof@chromium.org
Status: Assigned (was: Untriaged)
Unable to reproduce with 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.21 Safari/537.36'
halcanary: Mac only I think.
Yes it is Mac only and Chrome only, not sure why this is what is being tested when it was stated the problem only happens on Mac in Chrome browser. 
Skia seems to be getting NOT_DEF glyphs.  From the PDF page content stream:

BT                           %% begin text object
/F0 12 Tf                    %% set font
1 0 0 -1 96 108 Tm           %% set text matrix, x, y
<003B> Tj                    %% Write glyph 0x003B, 'T'
1 0 0 -1 102.887985 108 Tm   %% move to next x, y position
<004F> Tj                    %% write glyph 0x004F, 'h'
1 0 0 -1 109.559982 108 Tm   %%
<004C> Tj                    %% write glyph 0x004C, 'e'
1 0 0 -1 116.003967 108 Tm   %%
<0003> Tj                    %% write glyph 0x0003, ' '
1 0 0 -1 119.339965 108 Tm   %%
<0000> Tj                    %% write glyph 0x0000, NOT_DEF
1 0 0 -1 119.339965 108 Tm   %%
<0058> Tj                    %% write glyph 0x0058, 'q'
1 0 0 -1 126.455963 108 Tm
<005C> Tj
1 0 0 -1 133.127960 108 Tm
<0050> Tj
1 0 0 -1 135.791946 108 Tm
<004A> Tj
1 0 0 -1 142.235931 108 Tm
<0052> Tj
1 0 0 -1 148.463928 108 Tm
<0003> Tj
1 0 0 -1 151.799926 108 Tm
<0000> Tj
1 0 0 -1 151.799926 108 Tm
<0049> Tj
1 0 0 -1 158.915924 108 Tm
<0059> Tj


Comment 7 by t...@tibbetts.org, Jul 26 2016

I am having the same problem with the Arial font using Chrome on Mac.  I've attached screenshots showing the same behavior with Arial.  I've confirmed that the same document prints fine from Firefox.
screen1.jpg
57.9 KB View Download
screen2.jpg
80.3 KB View Download

Comment 8 by kotah@chromium.org, Aug 17 2016

Issue 622732 has been merged into this issue.

Comment 9 by kotah@chromium.org, Aug 17 2016

Cc: kotah@chromium.org
Labels: Hotlist-Enterprise

Comment 10 by kotah@chromium.org, Aug 17 2016

Components: Internals>Plugins>PDF Internals>Skia>PDF
Cc: soushi@chromium.org rnimmagadda@chromium.org
 Issue 635737  has been merged into this issue.
Customer has the same issue when they use not only 'Helvetica Neue' but also 'Arial' font.
(Originally,  crbug.com/635737  has been reported as 'Arial' font issue, but I confirmed that they have the same issue when they use 'Helvetica Neue' as well)
Thank you for documenting this issue, and thank you for working towards a solution.  I experience this same issue in the same conditions (Mac, Chrome, Docs) but it is pervasive across multiple fonts including both serif and sans-serif families.
Screen Shot 2016-08-24 at 11.48.02 AM.png
42.9 KB View Download
We are also having the same exact issue!  Running the latest version 52.02743.116


https://crrev.com/2278703002 may fix this.
More detail.  Now that I can use printPagesToSkPictures() to debug it, it seems that Blink is emitting out-of-range glyphs, specifically 0xFFFF.  In m52, I was correcting that to glyph 0.  In m54, I clamp that to the max glyph for that typeface.

Skia's API makes no guarantees about what happens when invalid glyphs are sent.

https://crrev.com/2278703002 attempts to skip over invalid glyphs.

We still should find out why Blink is sending out-of-range glyphIDs. Are they coming from HarfBuzz?
Cc: bunge...@chromium.org
bungeman@ points out that HarfBuzz on Mac falls back to CoreGraphics (calling CTRunGetGlyphs) for shaping certain fonts.  HarfBuzz does not validate the output, which sometimes includes 0xFFFF.

https://cs.chromium.org/search/?q=CTRunGetGlyphs

Project Member

Comment 18 by bugdroid1@chromium.org, Aug 26 2016

The following revision refers to this bug:
  https://skia.googlesource.com/skia.git/+/4871f2277738fa7e9232d25424c008b36dae4711

commit 4871f2277738fa7e9232d25424c008b36dae4711
Author: halcanary <halcanary@google.com>
Date: Fri Aug 26 20:17:44 2016

SkPDF: Glyph validation change

Instead of mapping invaid glyphIDs to zero or maxGlyphID,
don't draw them at all.

Validate glyphs when glyph is written, not ahead of time.

Don't allocate array to copy user-provided glyphs.

Easy early exit from SkPDFDevice::internalDrawText()
    GlyphPositioner::flush() called ~GlyphPositioner()
    SkScopeExit class now exists.

Assume SkTypeface* pointers are now never null in more
places.

precalculate alignmentFactor to clean up code.

SkPDFDevice::updateFont must be called with validated
glyphID.  Skip bad glyphs to make this true.

SkPDFDevice::updateFont always succeeds.

SkPDFFont::GetFontResource always succeeds (preconditions are
asserted).  If GetMetrics fails, don't call GetFontResource.

SkPDFFont::glyphsToPDFFontEncodingCount() becomes
SkPDFFont::countStretch() and is inlined.

SkPDFFont::glyphsToPDFFontEncoding now works one Glyph at a
time and is inlined.

SkPDFFont::noteGlyphUsage() operates one glyph at a time.

Add SkScopeExit.h; also a unit test for it.

SkPostConfig: Fix SK_UNUSED for Win32.

No public API changes.
TBR=reed@google.com

BUG= 625995 

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

Review-Url: https://codereview.chromium.org/2278703002

[modify] https://crrev.com/4871f2277738fa7e9232d25424c008b36dae4711/include/core/SkPostConfig.h
[modify] https://crrev.com/4871f2277738fa7e9232d25424c008b36dae4711/src/pdf/SkPDFDevice.cpp
[modify] https://crrev.com/4871f2277738fa7e9232d25424c008b36dae4711/src/pdf/SkPDFDevice.h
[modify] https://crrev.com/4871f2277738fa7e9232d25424c008b36dae4711/src/pdf/SkPDFFont.cpp
[modify] https://crrev.com/4871f2277738fa7e9232d25424c008b36dae4711/src/pdf/SkPDFFont.h
[add] https://crrev.com/4871f2277738fa7e9232d25424c008b36dae4711/src/pdf/SkScopeExit.h
[modify] https://crrev.com/4871f2277738fa7e9232d25424c008b36dae4711/tests/CPlusPlusEleven.cpp

Project Member

Comment 19 by bugdroid1@chromium.org, Aug 26 2016

The following revision refers to this bug:
  https://skia.googlesource.com/skia.git/+/4871f2277738fa7e9232d25424c008b36dae4711

commit 4871f2277738fa7e9232d25424c008b36dae4711
Author: halcanary <halcanary@google.com>
Date: Fri Aug 26 20:17:44 2016

SkPDF: Glyph validation change

Instead of mapping invaid glyphIDs to zero or maxGlyphID,
don't draw them at all.

Validate glyphs when glyph is written, not ahead of time.

Don't allocate array to copy user-provided glyphs.

Easy early exit from SkPDFDevice::internalDrawText()
    GlyphPositioner::flush() called ~GlyphPositioner()
    SkScopeExit class now exists.

Assume SkTypeface* pointers are now never null in more
places.

precalculate alignmentFactor to clean up code.

SkPDFDevice::updateFont must be called with validated
glyphID.  Skip bad glyphs to make this true.

SkPDFDevice::updateFont always succeeds.

SkPDFFont::GetFontResource always succeeds (preconditions are
asserted).  If GetMetrics fails, don't call GetFontResource.

SkPDFFont::glyphsToPDFFontEncodingCount() becomes
SkPDFFont::countStretch() and is inlined.

SkPDFFont::glyphsToPDFFontEncoding now works one Glyph at a
time and is inlined.

SkPDFFont::noteGlyphUsage() operates one glyph at a time.

Add SkScopeExit.h; also a unit test for it.

SkPostConfig: Fix SK_UNUSED for Win32.

No public API changes.
TBR=reed@google.com

BUG= 625995 

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

Review-Url: https://codereview.chromium.org/2278703002

[modify] https://crrev.com/4871f2277738fa7e9232d25424c008b36dae4711/include/core/SkPostConfig.h
[modify] https://crrev.com/4871f2277738fa7e9232d25424c008b36dae4711/src/pdf/SkPDFDevice.cpp
[modify] https://crrev.com/4871f2277738fa7e9232d25424c008b36dae4711/src/pdf/SkPDFDevice.h
[modify] https://crrev.com/4871f2277738fa7e9232d25424c008b36dae4711/src/pdf/SkPDFFont.cpp
[modify] https://crrev.com/4871f2277738fa7e9232d25424c008b36dae4711/src/pdf/SkPDFFont.h
[add] https://crrev.com/4871f2277738fa7e9232d25424c008b36dae4711/src/pdf/SkScopeExit.h
[modify] https://crrev.com/4871f2277738fa7e9232d25424c008b36dae4711/tests/CPlusPlusEleven.cpp

Labels: M-54
Assuming taht's the fix, we may want to consider merging that to M54, depending on when it branches exactly.
I would recommend cherry picking to m54.
Project Member

Comment 22 by bugdroid1@chromium.org, Aug 27 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6a205ea39d9075faa18bbc13c9d52bd8b1ce938a

commit 6a205ea39d9075faa18bbc13c9d52bd8b1ce938a
Author: skia-deps-roller <skia-deps-roller@chromium.org>
Date: Sat Aug 27 10:39:55 2016

Roll src/third_party/skia/ 9d08cbc8c..79418093c (46 commits).

https://chromium.googlesource.com/skia.git/+log/9d08cbc8c613..79418093c1bb

$ git log 9d08cbc8c..79418093c --date=short --no-merges --format='%ad %ae %s'
2016-08-26 caryclark if the winding of the top can't be computed, give up
2016-08-26 mtklein GN: support compiler_prefix, use it for ccache on bots.
2016-08-26 halcanary SkPDF: Glyph validation change
2016-08-26 fmalita drawBitmapRect() should not touch the CTM when mask filters are present
2016-08-26 msarett Reduce CPU overhead on drawRegion()
2016-08-26 brianosman Fix angle build on Ubuntu
2016-08-26 bungeman Expat target exports includes instead of FreeType.
2016-08-26 mtklein Add Mac NDK asset, and fetch NDK on Android compile bots.
2016-08-26 egdaniel Don't add the resolve attachment to vulkan render passes.
2016-08-26 ethannicholas fixed 'corners' of paths in GrAAConvexTessellator
2016-08-26 mtklein add an asset for the Linux Android NDK.
2016-08-26 bsalomon Converts a drawPaint through a rrect clip to a drawRRect in GrDrawContext.
2016-08-26 brianosman Update ANGLE to latest as of August 25, 2016
2016-08-26 fmalita Remove SVG serialization suppressions
2016-08-26 fmalita Add imagemasksubset GM
2016-08-26 drott Restrict supported font formats in Chrome context
2016-08-26 robertphillips Move work from ctor to onOnceBeforeDraw in ShowMipLevel GMs
2016-08-26 caryclark avoid generating degenerate conic from arc
2016-08-26 vjiaoblack Added distance attenuation and diffuse shading to PointLights
2016-08-26 jvanverth Fix for fat stroked roundrects.
2016-08-26 mtklein GN: mac host and armv7 target
2016-08-26 bungeman SkOSFile instead of dirent in android font parser.
2016-08-26 bsalomon Fix bounds check in grshape test GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2274113004
2016-08-26 msarett drawRegion() cleanups
2016-08-26 robertphillips Ignore fill when stroke & filling convex line-only paths
2016-08-25 msarett GPU implementation of drawRegion()
2016-08-25 mtklein GN: Android
2016-08-25 msarett Add drawRegion() API to SkCanvas
2016-08-25 egdaniel Add support for getting vulkan descriptor sets without a GrVkUniformHandler.
2016-08-25 liyuqian Do not spam the debugging information
2016-08-25 bsalomon Respecify SkCanvas::drawArc, consolidate conversion to SkPath, add GM for oddball drawArcs
2016-08-25 caryclark path ops stream-lining
2016-08-25 halcanary SkDrawCommand: hinting
2016-08-25 jcgregorio BUILD.gn: Fix fiddle raster.
2016-08-25 halcanary SkPDF: Stop `#include PREPROCESSOR_DEFINE` pattern
2016-08-25 brianosman Remove pixel config fallback - failing is a better option.
2016-08-25 mtklein update Android auto-detection.
2016-08-25 fmalita Reland: Experimental parsing expression grammar (PEG) template library
2016-08-25 jvanverth Add Ganesh support for circular roundrects with strokes > 2*radii.
2016-08-25 bsalomon Make bleed GM produce consistent bitmaps on all platforms GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2264133003
2016-08-25 vjiaoblack Made shadows blurry (thru implementing variance mapping)
2016-08-25 hcm Update Skia milestone to 55
2016-08-25 jvanverth Add fat stroke test case to roundrects GM.
2016-08-25 fmalita Revert of Experimental parsing expression grammar (PEG) template library (patchset #8 id:140001 of https://codereview.chromium.org/2271743002/ )
2016-08-25 caryclark add pathops debugging
2016-08-25 anmittal Add neon and crc32 sources for aarch64

BUG= 641478 , 625995 

CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_precise_blink_rel
TBR=bungeman@google.com

Review-Url: https://codereview.chromium.org/2284953003
Cr-Commit-Position: refs/heads/master@{#414892}

[modify] https://crrev.com/6a205ea39d9075faa18bbc13c9d52bd8b1ce938a/DEPS

Labels: Merge-Request-54

Comment 24 by dimu@chromium.org, Aug 31 2016

Labels: -Merge-Request-54 Merge-Review-54 Hotlist-Merge-Review
[Automated comment] DEPS changes referenced in bugdroid comments, needs manual review.
Labels: -Merge-Review-54 Merge-Approved-54
This change meets the bar and is approved for merging into M54
Okay.  Will do.
Project Member

Comment 27 by bugdroid1@chromium.org, Sep 2 2016

Labels: merge-merged-m54
The following revision refers to this bug:
  https://skia.googlesource.com/skia.git/+/9baacd93a1fa5e2518b492bfd293c13e2020e62c

commit 9baacd93a1fa5e2518b492bfd293c13e2020e62c
Author: halcanary <halcanary@google.com>
Date: Fri Sep 02 14:28:17 2016

SkPDF: Glyph validation change

[cherry-pick https://skia.googlesource.com/skia.git/+/4871f22 to m54]

Instead of mapping invaid glyphIDs to zero or maxGlyphID,
don't draw them at all.

Validate glyphs when glyph is written, not ahead of time.

Don't allocate array to copy user-provided glyphs.

Easy early exit from SkPDFDevice::internalDrawText()
    GlyphPositioner::flush() called ~GlyphPositioner()
    SkScopeExit class now exists.

Assume SkTypeface* pointers are now never null in more
places.

precalculate alignmentFactor to clean up code.

SkPDFDevice::updateFont must be called with validated
glyphID.  Skip bad glyphs to make this true.

SkPDFDevice::updateFont always succeeds.

SkPDFFont::GetFontResource always succeeds (preconditions are
asserted).  If GetMetrics fails, don't call GetFontResource.

SkPDFFont::glyphsToPDFFontEncodingCount() becomes
SkPDFFont::countStretch() and is inlined.

SkPDFFont::glyphsToPDFFontEncoding now works one Glyph at a
time and is inlined.

SkPDFFont::noteGlyphUsage() operates one glyph at a time.

Add SkScopeExit.h; also a unit test for it.

SkPostConfig: Fix SK_UNUSED for Win32.

No public API changes.
TBR=reed@google.com

BUG= 625995 

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

Review-Url: https://codereview.chromium.org/2278703002
NOTREECHECKS=true
NOTRY=true
NOPRESUBMIT=true

Review-Url: https://codereview.chromium.org/2302353002

[modify] https://crrev.com/9baacd93a1fa5e2518b492bfd293c13e2020e62c/include/core/SkPostConfig.h
[modify] https://crrev.com/9baacd93a1fa5e2518b492bfd293c13e2020e62c/src/pdf/SkPDFDevice.cpp
[modify] https://crrev.com/9baacd93a1fa5e2518b492bfd293c13e2020e62c/src/pdf/SkPDFDevice.h
[modify] https://crrev.com/9baacd93a1fa5e2518b492bfd293c13e2020e62c/src/pdf/SkPDFFont.cpp
[modify] https://crrev.com/9baacd93a1fa5e2518b492bfd293c13e2020e62c/src/pdf/SkPDFFont.h
[add] https://crrev.com/9baacd93a1fa5e2518b492bfd293c13e2020e62c/src/pdf/SkScopeExit.h
[modify] https://crrev.com/9baacd93a1fa5e2518b492bfd293c13e2020e62c/tests/CPlusPlusEleven.cpp

Status: Fixed (was: Assigned)
Please merge your change to M54 (branch: 2840) before 5:00 PM PST Monday [09/05] if you would like to make it to M54 Beta promotion on Thursday [09/08].

Project Member

Comment 30 by sheriffbot@chromium.org, Sep 5 2016

This issue has been approved for a merge. Please merge the fix to any appropriate branches as soon as possible!

If all merges have been completed, please remove any remaining Merge-Approved labels from this issue.

Thanks for your time! To disable nags, add the Disable-Nags label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
If there is no pending work in M54, please remove - Merge-Approved-54 label.

Comment 32 Deleted

Project Member

Comment 33 by sheriffbot@chromium.org, Sep 8 2016

This issue has been approved for a merge. Please merge the fix to any appropriate branches as soon as possible!

If all merges have been completed, please remove any remaining Merge-Approved labels from this issue.

Thanks for your time! To disable nags, add the Disable-Nags label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Merge-Approved-54
Owner: halcanary@google.com

Sign in to add a comment