{"action":"created","issue":{"url":"https://api.github.com/repos/classilla/tenfourfox/issues/261","repository_url":"https://api.github.com/repos/classilla/tenfourfox","labels_url":"https://api.github.com/repos/classilla/tenfourfox/issues/261/labels{/name}","comments_url":"https://api.github.com/repos/classilla/tenfourfox/issues/261/comments","events_url":"https://api.github.com/repos/classilla/tenfourfox/issues/261/events","html_url":"https://github.com/classilla/tenfourfox/issues/261","id":99932625,"number":261,"title":"Font black list for ATSUI-incompatible webfonts","user":{"login":"GoogleCodeExporter","id":9614759,"avatar_url":"https://avatars.githubusercontent.com/u/9614759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":16,"created_at":"2015-08-09T21:54:58Z","updated_at":"2016-12-02T22:36:12Z","closed_at":"2015-08-09T21:54:58Z","body":"```\nUplift from \nhttps://tenfourfox.tenderapp.com/discussions/problems/715-2430-crashes\n\nCertain web fonts do not appear to be compatible with ATSUI or trigger bugs. On \n10.4, this generates warnings; on 10.5, this crashes the browser. This is due \nto Mozilla's changes in 24 that cause us to use ATSUI on both 10.4 and 10.5 (on \n10.5, previously they used a different code path).\n\nSince the font name is identifiable, we should be able to intercept it before \nit becomes activated.\n```\n\nOriginal issue reported on code.google.com by `classi...@floodgap.com` on 7 Mar 2014 at 4:27\n"},"comment":{"url":"https://api.github.com/repos/classilla/tenfourfox/issues/comments/264581149","html_url":"https://github.com/classilla/tenfourfox/issues/261#issuecomment-264581149","issue_url":"https://api.github.com/repos/classilla/tenfourfox/issues/261","id":264581149,"user":{"login":"internetzel","id":979556,"avatar_url":"https://avatars.githubusercontent.com/u/979556?v=3","gravatar_id":"","url":"https://api.github.com/users/internetzel","html_url":"https://github.com/internetzel","followers_url":"https://api.github.com/users/internetzel/followers","following_url":"https://api.github.com/users/internetzel/following{/other_user}","gists_url":"https://api.github.com/users/internetzel/gists{/gist_id}","starred_url":"https://api.github.com/users/internetzel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/internetzel/subscriptions","organizations_url":"https://api.github.com/users/internetzel/orgs","repos_url":"https://api.github.com/users/internetzel/repos","events_url":"https://api.github.com/users/internetzel/events{/privacy}","received_events_url":"https://api.github.com/users/internetzel/received_events","type":"User","site_admin":false},"created_at":"2016-12-02T22:36:12Z","updated_at":"2016-12-02T22:36:12Z","body":"Had some days of struggling to get CoreText work right with web fonts - and well, it seems to finally do it right now!\r\nI don't think the issues are CoreText specific ones but rather general ATS issues, the proposed workarounds should apply to NSFonts and CGFonts as well.\r\nThose workarounds may reduce the need for blacklisting fonts quite a bit - at least on 10.5 .\r\n\r\nI managed to solve the following issues:\r\n1. CoreText has severe difficulties with Fonts that don't have a valid post script name;\r\nIt may leak entire CTFontDescriptors, render garbled glyphs, whatever bad things you can imagine.\r\n2. CoreText may arbitrarily mix up Fonts that have the same PostScript name but in fact aren't the same font.\r\n3. CoreText tends to return fallback fonts when using the functions CTFontCreateCopyWith... for modifying existing CTFontRefs (at least for many web fonts).\r\n\r\nIssue 1 can be worked around by using OpenType Sanitizer - which Apple has refused to ever use. But sanitized fonts have identical font names, causing issue 2.\r\n\r\nIssue 2 can be solved by changing ots to add a unique ID, like a hash value of the whole name table, to the sanitized PostScript name like in the following patch: [ots_name_table_patch.txt](https://github.com/classilla/tenfourfox/files/628354/ots_name_table_patch.txt)\r\n\r\nIssue 3 can be worked around by following the rule to always create CTFontRefs (and CGFontRefs as well!) from the underlying ATSFontRefs, like this:\r\n`CTFontDescriptorRef newDescriptor;`\r\n`CTFontDescriptorRef descriptor = NULL;`\r\n`ATSFontRef platformFont = CTFontGetPlatformFont(originalFont, &descriptor);`\r\n`if (descriptor) {`\r\n`newDescriptor = CTFontDescriptorCreateCopyWithAttributes(descriptor, attributes);`\r\n`CFRelease(descriptor);`\r\n`} else`\r\n`newDescriptor = CTFontDescriptorCreateWithAttributes(attributes));`\r\n`CTFontRef result = CTFontCreateWithPlatformFont(platformFont, CTFontGetSize(originalFont), nullptr, newDescriptor));`"}}
{"actor":{"display_login":"internetzel"}}