{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/pdf.js/pulls/comments/153553161","pull_request_review_id":79573463,"id":153553161,"diff_hunk":"@@ -1443,17 +1448,21 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {\n \n       var simpleFillText =\n         current.textRenderingMode === TextRenderingMode.FILL &&\n-        !font.disableFontFace;\n+        !font.disableFontFace && !current.patternFill;\n \n       ctx.save();\n-      ctx.transform.apply(ctx, current.textMatrix);\n-      ctx.translate(current.x, current.y + current.textRise);\n-\n+      let patternTransform;\n       if (current.patternFill) {\n-        // TODO: Some shading patterns are not applied correctly to text,\n-        //       e.g. issues 3988 and 5432, and ShowText-ShadingPattern.pdf.\n-        ctx.fillStyle = current.fillColor.getPattern(ctx, this);\n+        // TODO: Patterns are not applied correctly to text if a system font","path":"src/display/canvas.js","position":50,"original_position":50,"commit_id":"eddf58d41f48c3482f168692319297e90e451357","original_commit_id":"eddf58d41f48c3482f168692319297e90e451357","user":{"login":"Snuffleupagus","id":2692120,"avatar_url":"https://avatars0.githubusercontent.com/u/2692120?v=4","gravatar_id":"","url":"https://api.github.com/users/Snuffleupagus","html_url":"https://github.com/Snuffleupagus","followers_url":"https://api.github.com/users/Snuffleupagus/followers","following_url":"https://api.github.com/users/Snuffleupagus/following{/other_user}","gists_url":"https://api.github.com/users/Snuffleupagus/gists{/gist_id}","starred_url":"https://api.github.com/users/Snuffleupagus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Snuffleupagus/subscriptions","organizations_url":"https://api.github.com/users/Snuffleupagus/orgs","repos_url":"https://api.github.com/users/Snuffleupagus/repos","events_url":"https://api.github.com/users/Snuffleupagus/events{/privacy}","received_events_url":"https://api.github.com/users/Snuffleupagus/received_events","type":"User","site_admin":false},"body":"Nit: Let's replace `system font` with `non-embedded font` instead here, since that's more inline with the notation used elsewhere in PDF.js.","created_at":"2017-11-28T16:48:19Z","updated_at":"2017-11-28T16:54:06Z","html_url":"https://github.com/mozilla/pdf.js/pull/9090#discussion_r153553161","pull_request_url":"https://api.github.com/repos/mozilla/pdf.js/pulls/9090","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/mozilla/pdf.js/pulls/comments/153553161"},"html":{"href":"https://github.com/mozilla/pdf.js/pull/9090#discussion_r153553161"},"pull_request":{"href":"https://api.github.com/repos/mozilla/pdf.js/pulls/9090"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/pdf.js/pulls/9090","id":149844522,"html_url":"https://github.com/mozilla/pdf.js/pull/9090","diff_url":"https://github.com/mozilla/pdf.js/pull/9090.diff","patch_url":"https://github.com/mozilla/pdf.js/pull/9090.patch","issue_url":"https://api.github.com/repos/mozilla/pdf.js/issues/9090","number":9090,"state":"open","locked":false,"title":"Fix pattern-filled text (embedded fonts only)","user":{"login":"janpe2","id":26090208,"avatar_url":"https://avatars3.githubusercontent.com/u/26090208?v=4","gravatar_id":"","url":"https://api.github.com/users/janpe2","html_url":"https://github.com/janpe2","followers_url":"https://api.github.com/users/janpe2/followers","following_url":"https://api.github.com/users/janpe2/following{/other_user}","gists_url":"https://api.github.com/users/janpe2/gists{/gist_id}","starred_url":"https://api.github.com/users/janpe2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janpe2/subscriptions","organizations_url":"https://api.github.com/users/janpe2/orgs","repos_url":"https://api.github.com/users/janpe2/repos","events_url":"https://api.github.com/users/janpe2/events{/privacy}","received_events_url":"https://api.github.com/users/janpe2/received_events","type":"User","site_admin":false},"body":"Fixes #8940\r\nFixes #5432 (AkzoNobel file)\r\nFixes #3988 (texts now have gradient fill instead of solid color)\r\n\r\nThis PR fixes the rendering of texts that have a tiling or shading pattern as a fill color and an embedded font is used.\r\n\r\nThe problems in the reported issues are caused by `ctx.fillText()`. The glyphs and the pattern would need their own transforms but `ctx.fillText()` uses the same transform for them both. Thus either the text or the pattern gets incorrectly transformed. My solution is to draw glyphs as paths, so I can use a different transform for the pattern and the glyphs. However I can't fix texts that use system fonts because it's impossible to get glyphs as paths from system fonts.\r\n\r\nThe file test/pdfs/ShowText-ShadingPattern.pdf (test case `ShowText-ShadingPattern`) is rendered better now. The \"Arial\" text is correct because it uses an embedded font. The \"Helvetica\" text is still wrong since it uses a system font.\r\n\r\nThis PR continues the work that was started in PR #6820.","created_at":"2017-10-31T16:53:37Z","updated_at":"2017-11-28T16:54:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dbd5975c9783ecfca425da296c2a84b379e9e9c2","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/pdf.js/pulls/9090/commits","review_comments_url":"https://api.github.com/repos/mozilla/pdf.js/pulls/9090/comments","review_comment_url":"https://api.github.com/repos/mozilla/pdf.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/pdf.js/issues/9090/comments","statuses_url":"https://api.github.com/repos/mozilla/pdf.js/statuses/eddf58d41f48c3482f168692319297e90e451357","head":{"label":"janpe2:pattern-text","ref":"pattern-text","sha":"eddf58d41f48c3482f168692319297e90e451357","user":{"login":"janpe2","id":26090208,"avatar_url":"https://avatars3.githubusercontent.com/u/26090208?v=4","gravatar_id":"","url":"https://api.github.com/users/janpe2","html_url":"https://github.com/janpe2","followers_url":"https://api.github.com/users/janpe2/followers","following_url":"https://api.github.com/users/janpe2/following{/other_user}","gists_url":"https://api.github.com/users/janpe2/gists{/gist_id}","starred_url":"https://api.github.com/users/janpe2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janpe2/subscriptions","organizations_url":"https://api.github.com/users/janpe2/orgs","repos_url":"https://api.github.com/users/janpe2/repos","events_url":"https://api.github.com/users/janpe2/events{/privacy}","received_events_url":"https://api.github.com/users/janpe2/received_events","type":"User","site_admin":false},"repo":{"id":92857995,"name":"pdf.js","full_name":"janpe2/pdf.js","owner":{"login":"janpe2","id":26090208,"avatar_url":"https://avatars3.githubusercontent.com/u/26090208?v=4","gravatar_id":"","url":"https://api.github.com/users/janpe2","html_url":"https://github.com/janpe2","followers_url":"https://api.github.com/users/janpe2/followers","following_url":"https://api.github.com/users/janpe2/following{/other_user}","gists_url":"https://api.github.com/users/janpe2/gists{/gist_id}","starred_url":"https://api.github.com/users/janpe2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janpe2/subscriptions","organizations_url":"https://api.github.com/users/janpe2/orgs","repos_url":"https://api.github.com/users/janpe2/repos","events_url":"https://api.github.com/users/janpe2/events{/privacy}","received_events_url":"https://api.github.com/users/janpe2/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/janpe2/pdf.js","description":"PDF Reader in JavaScript","fork":true,"url":"https://api.github.com/repos/janpe2/pdf.js","forks_url":"https://api.github.com/repos/janpe2/pdf.js/forks","keys_url":"https://api.github.com/repos/janpe2/pdf.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/janpe2/pdf.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/janpe2/pdf.js/teams","hooks_url":"https://api.github.com/repos/janpe2/pdf.js/hooks","issue_events_url":"https://api.github.com/repos/janpe2/pdf.js/issues/events{/number}","events_url":"https://api.github.com/repos/janpe2/pdf.js/events","assignees_url":"https://api.github.com/repos/janpe2/pdf.js/assignees{/user}","branches_url":"https://api.github.com/repos/janpe2/pdf.js/branches{/branch}","tags_url":"https://api.github.com/repos/janpe2/pdf.js/tags","blobs_url":"https://api.github.com/repos/janpe2/pdf.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/janpe2/pdf.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/janpe2/pdf.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/janpe2/pdf.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/janpe2/pdf.js/statuses/{sha}","languages_url":"https://api.github.com/repos/janpe2/pdf.js/languages","stargazers_url":"https://api.github.com/repos/janpe2/pdf.js/stargazers","contributors_url":"https://api.github.com/repos/janpe2/pdf.js/contributors","subscribers_url":"https://api.github.com/repos/janpe2/pdf.js/subscribers","subscription_url":"https://api.github.com/repos/janpe2/pdf.js/subscription","commits_url":"https://api.github.com/repos/janpe2/pdf.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/janpe2/pdf.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/janpe2/pdf.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/janpe2/pdf.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/janpe2/pdf.js/contents/{+path}","compare_url":"https://api.github.com/repos/janpe2/pdf.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/janpe2/pdf.js/merges","archive_url":"https://api.github.com/repos/janpe2/pdf.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/janpe2/pdf.js/downloads","issues_url":"https://api.github.com/repos/janpe2/pdf.js/issues{/number}","pulls_url":"https://api.github.com/repos/janpe2/pdf.js/pulls{/number}","milestones_url":"https://api.github.com/repos/janpe2/pdf.js/milestones{/number}","notifications_url":"https://api.github.com/repos/janpe2/pdf.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/janpe2/pdf.js/labels{/name}","releases_url":"https://api.github.com/repos/janpe2/pdf.js/releases{/id}","deployments_url":"https://api.github.com/repos/janpe2/pdf.js/deployments","created_at":"2017-05-30T17:20:14Z","updated_at":"2017-05-30T18:04:09Z","pushed_at":"2017-11-14T16:57:38Z","git_url":"git://github.com/janpe2/pdf.js.git","ssh_url":"git@github.com:janpe2/pdf.js.git","clone_url":"https://github.com/janpe2/pdf.js.git","svn_url":"https://github.com/janpe2/pdf.js","homepage":"","size":66880,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"92fcfce68534b9f23564ae72a9d50f33739af8c0","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":1663468,"name":"pdf.js","full_name":"mozilla/pdf.js","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/pdf.js","description":"PDF Reader in JavaScript","fork":false,"url":"https://api.github.com/repos/mozilla/pdf.js","forks_url":"https://api.github.com/repos/mozilla/pdf.js/forks","keys_url":"https://api.github.com/repos/mozilla/pdf.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/pdf.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/pdf.js/teams","hooks_url":"https://api.github.com/repos/mozilla/pdf.js/hooks","issue_events_url":"https://api.github.com/repos/mozilla/pdf.js/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/pdf.js/events","assignees_url":"https://api.github.com/repos/mozilla/pdf.js/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/pdf.js/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/pdf.js/tags","blobs_url":"https://api.github.com/repos/mozilla/pdf.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/pdf.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/pdf.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/pdf.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/pdf.js/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/pdf.js/languages","stargazers_url":"https://api.github.com/repos/mozilla/pdf.js/stargazers","contributors_url":"https://api.github.com/repos/mozilla/pdf.js/contributors","subscribers_url":"https://api.github.com/repos/mozilla/pdf.js/subscribers","subscription_url":"https://api.github.com/repos/mozilla/pdf.js/subscription","commits_url":"https://api.github.com/repos/mozilla/pdf.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/pdf.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/pdf.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/pdf.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/pdf.js/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/pdf.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/pdf.js/merges","archive_url":"https://api.github.com/repos/mozilla/pdf.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/pdf.js/downloads","issues_url":"https://api.github.com/repos/mozilla/pdf.js/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/pdf.js/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/pdf.js/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/pdf.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/pdf.js/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/pdf.js/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla/pdf.js/deployments","created_at":"2011-04-26T06:32:03Z","updated_at":"2017-11-28T16:40:05Z","pushed_at":"2017-11-28T08:39:38Z","git_url":"git://github.com/mozilla/pdf.js.git","ssh_url":"git@github.com:mozilla/pdf.js.git","clone_url":"https://github.com/mozilla/pdf.js.git","svn_url":"https://github.com/mozilla/pdf.js","homepage":"","size":67484,"stargazers_count":20060,"watchers_count":20060,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":4936,"mirror_url":null,"archived":false,"open_issues_count":697,"forks":4936,"open_issues":697,"watchers":20060,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/pdf.js/pulls/9090"},"html":{"href":"https://github.com/mozilla/pdf.js/pull/9090"},"issue":{"href":"https://api.github.com/repos/mozilla/pdf.js/issues/9090"},"comments":{"href":"https://api.github.com/repos/mozilla/pdf.js/issues/9090/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/pdf.js/pulls/9090/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/pdf.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/pdf.js/pulls/9090/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/pdf.js/statuses/eddf58d41f48c3482f168692319297e90e451357"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"Snuffleupagus"}}