{"action":"created","issue":{"url":"https://api.github.com/repos/nodebox/opentype.js/issues/126","labels_url":"https://api.github.com/repos/nodebox/opentype.js/issues/126/labels{/name}","comments_url":"https://api.github.com/repos/nodebox/opentype.js/issues/126/comments","events_url":"https://api.github.com/repos/nodebox/opentype.js/issues/126/events","html_url":"https://github.com/nodebox/opentype.js/issues/126","id":89066357,"number":126,"title":"UI rendering is blocked if loads a large font","user":{"login":"yurenju","id":22155,"avatar_url":"https://avatars.githubusercontent.com/u/22155?v=3","gravatar_id":"","url":"https://api.github.com/users/yurenju","html_url":"https://github.com/yurenju","followers_url":"https://api.github.com/users/yurenju/followers","following_url":"https://api.github.com/users/yurenju/following{/other_user}","gists_url":"https://api.github.com/users/yurenju/gists{/gist_id}","starred_url":"https://api.github.com/users/yurenju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurenju/subscriptions","organizations_url":"https://api.github.com/users/yurenju/orgs","repos_url":"https://api.github.com/users/yurenju/repos","events_url":"https://api.github.com/users/yurenju/events{/privacy}","received_events_url":"https://api.github.com/users/yurenju/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-17T16:37:33Z","updated_at":"2015-06-18T06:24:07Z","closed_at":null,"body":"I try to load a Chinese font [DroidSansFallbackFull.ttf](https://github.com/android/platform_frameworks_base/blob/master/data/fonts/DroidSansFallbackFull.ttf) to render CJK font but it will block UI rendering and I can't interact with my website for few seconds.\r\n\r\nafter profiling startup process, I found the root cause is parsing font to glyphs in synchronized way.\r\n\r\n![2015-06-16 5 42 25](https://cloud.githubusercontent.com/assets/22155/8212483/9723cf8a-154e-11e5-9779-31c87bccdc50.png)\r\n\r\nat the first I thought I can use web worker to solve it but I realize that is not a easy way since `Font` is not a serializable object.\r\n\r\n@em suggested me that we can use lazy parsing when `charToGlyph()` is executed and don't have to parse all glyphs in `opentype.load()` -> `opentype.parse()`\r\n\r\nThere is  a [proof of concept patch](https://github.com/yurenju/opentype.js/commit/de08ec9cd00271f6fea095e513b8adedd78ff3ab) to lazy parsing glyph in `charToGlyph()`.\r\n\r\nthat should be a possible solution for large font loading issue and wanna to know other suggestion to fix it.\r\n\r\nthank you!"},"comment":{"url":"https://api.github.com/repos/nodebox/opentype.js/issues/comments/113049943","html_url":"https://github.com/nodebox/opentype.js/issues/126#issuecomment-113049943","issue_url":"https://api.github.com/repos/nodebox/opentype.js/issues/126","id":113049943,"user":{"login":"yurenju","id":22155,"avatar_url":"https://avatars.githubusercontent.com/u/22155?v=3","gravatar_id":"","url":"https://api.github.com/users/yurenju","html_url":"https://github.com/yurenju","followers_url":"https://api.github.com/users/yurenju/followers","following_url":"https://api.github.com/users/yurenju/following{/other_user}","gists_url":"https://api.github.com/users/yurenju/gists{/gist_id}","starred_url":"https://api.github.com/users/yurenju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurenju/subscriptions","organizations_url":"https://api.github.com/users/yurenju/orgs","repos_url":"https://api.github.com/users/yurenju/repos","events_url":"https://api.github.com/users/yurenju/events{/privacy}","received_events_url":"https://api.github.com/users/yurenju/received_events","type":"User","site_admin":false},"created_at":"2015-06-18T06:24:07Z","updated_at":"2015-06-18T06:24:07Z","body":"this morning I just realize previous patch breaks `opentype.load()` & `font.getPath()` so I added an new optional argument `lazyParsing` to `opentype.load(url, [lazy,] callback)`\r\n\r\nlet's wait build result on travis-ci."}}