{"action":"created","issue":{"url":"https://api.github.com/repos/fabricjs/fabric.js/issues/5041","repository_url":"https://api.github.com/repos/fabricjs/fabric.js","labels_url":"https://api.github.com/repos/fabricjs/fabric.js/issues/5041/labels{/name}","comments_url":"https://api.github.com/repos/fabricjs/fabric.js/issues/5041/comments","events_url":"https://api.github.com/repos/fabricjs/fabric.js/issues/5041/events","html_url":"https://github.com/fabricjs/fabric.js/issues/5041","id":332237547,"node_id":"MDU6SXNzdWUzMzIyMzc1NDc=","number":5041,"title":"Fail to render text with Zero Width Joiner character","user":{"login":"zengfenfei","id":773310,"node_id":"MDQ6VXNlcjc3MzMxMA==","avatar_url":"https://avatars0.githubusercontent.com/u/773310?v=4","gravatar_id":"","url":"https://api.github.com/users/zengfenfei","html_url":"https://github.com/zengfenfei","followers_url":"https://api.github.com/users/zengfenfei/followers","following_url":"https://api.github.com/users/zengfenfei/following{/other_user}","gists_url":"https://api.github.com/users/zengfenfei/gists{/gist_id}","starred_url":"https://api.github.com/users/zengfenfei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zengfenfei/subscriptions","organizations_url":"https://api.github.com/users/zengfenfei/orgs","repos_url":"https://api.github.com/users/zengfenfei/repos","events_url":"https://api.github.com/users/zengfenfei/events{/privacy}","received_events_url":"https://api.github.com/users/zengfenfei/received_events","type":"User","site_admin":false},"labels":[{"id":86773,"node_id":"MDU6TGFiZWw4Njc3Mw==","url":"https://api.github.com/repos/fabricjs/fabric.js/labels/bug","name":"bug","color":"e10c02","default":true},{"id":139904891,"node_id":"MDU6TGFiZWwxMzk5MDQ4OTE=","url":"https://api.github.com/repos/fabricjs/fabric.js/labels/itext","name":"itext","color":"bfe5bf","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-06-14T03:15:46Z","updated_at":"2018-06-17T09:02:43Z","closed_at":null,"author_association":"NONE","body":"<!--\r\nThank you for contributing!\r\n\r\nHave a usage question?\r\n======================\r\nThe issue tracker is only for bugs (with reproducible minimal test case) and feature requests, so please do the following if you have a question:\r\n\r\n- Read the tutorial: http://fabricjs.com/articles\r\n- Read the object caching introduction: http://fabricjs.com/fabric-object-caching\r\n- Read the docs: http://fabricjs.com/docs\r\n- Explore demos: http://fabricjs.com/demos\r\n- Look for/ask questions on StackOverflow: http://stackoverflow.com/questions/tagged/fabricjs\r\n- Ask on Google Group: https://groups.google.com/forum/#!forum/fabricjs\r\n\r\n\r\nThink you found a bug?\r\n======================\r\nThe best bug report is a failing test in the repository as a pull request. Otherwise, please use the \"BUG REPORT\" template below. You NEED to create a fiddle with very simple test case that illustrate the problem. Otherwise the issue will be closed.\r\n\r\n\r\nHave a feature request?\r\n=======================\r\nRemove the template from below and provide thoughtful commentary *and code samples* on what this feature means for your product. What will it allow you to do that you can't do today? How will it make current work-arounds straightforward? What potential bugs and edge cases does it help to avoid? etc.\r\n-->\r\n\r\n<!-- BUG TEMPLATE -->\r\n## Version\r\n2.3.0\r\n\r\n## Steps to reproduce\r\n\r\nWith following code, the first line will disappear:\r\n```javascript\r\nvar canvas = new fabric.Canvas('canvas');\r\n        var text = new fabric.Textbox(`നിങ്ങള്‍ ഏത് ടീമിനെ\r\n പിന്തുണക്കുന്നു?`, {\r\n            top: 10,\r\n            left: 10,\r\n            width: 480,\r\n            fontSize: 32,\r\n            color: '#161616',\r\n            textAlign: 'center'\r\n        });\r\n\r\n        setTimeout(function(){\r\n            text.width = 470;\r\n            canvas.renderAll();\r\n        }, 100)\r\n```\r\n\r\n## Expected Behavior\r\nAll text can be rendered correctly.\r\n\r\n## Actual Behavior\r\nThe first line is not rendered.\r\n\r\n## More info\r\nI did some investigation and discovered:\r\n * The problem occurs only when `textAlign` is not `left`.\r\n * When `textAlign` is not left, fabric will try to calculate the width of every line, but when the line contains `ZWJ` char, the computed width is `NaN`. \r\n * A quick working fix is: give a default value `0` to `previousWidth` in the method `_measureChar` of `text.class.js`."},"comment":{"url":"https://api.github.com/repos/fabricjs/fabric.js/issues/comments/397864880","html_url":"https://github.com/fabricjs/fabric.js/issues/5041#issuecomment-397864880","issue_url":"https://api.github.com/repos/fabricjs/fabric.js/issues/5041","id":397864880,"node_id":"MDEyOklzc3VlQ29tbWVudDM5Nzg2NDg4MA==","user":{"login":"asturur","id":1194048,"node_id":"MDQ6VXNlcjExOTQwNDg=","avatar_url":"https://avatars3.githubusercontent.com/u/1194048?v=4","gravatar_id":"","url":"https://api.github.com/users/asturur","html_url":"https://github.com/asturur","followers_url":"https://api.github.com/users/asturur/followers","following_url":"https://api.github.com/users/asturur/following{/other_user}","gists_url":"https://api.github.com/users/asturur/gists{/gist_id}","starred_url":"https://api.github.com/users/asturur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asturur/subscriptions","organizations_url":"https://api.github.com/users/asturur/orgs","repos_url":"https://api.github.com/users/asturur/repos","events_url":"https://api.github.com/users/asturur/events{/privacy}","received_events_url":"https://api.github.com/users/asturur/received_events","type":"User","site_admin":false},"created_at":"2018-06-17T09:02:43Z","updated_at":"2018-06-17T09:02:43Z","author_association":"MEMBER","body":"can you replicate it? i can't\r\n"}}
{"actor":{"display_login":"asturur"}}