From d568c76b0b5ab7c246fbc0c5640988b7b64e1a41 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 31 Mar 2016 11:44:32 +0200 Subject: [PATCH 1/3] :apple: Fix emoji rendering --- src/workspace-element.coffee | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/workspace-element.coffee b/src/workspace-element.coffee index 8f6dca48a..02ff2e5b4 100644 --- a/src/workspace-element.coffee +++ b/src/workspace-element.coffee @@ -44,10 +44,15 @@ class WorkspaceElement extends HTMLElement @subscriptions.add @config.onDidChange 'editor.lineHeight', @updateGlobalTextEditorStyleSheet.bind(this) updateGlobalTextEditorStyleSheet: -> + fontFamily = @config.get('editor.fontFamily') + # TODO: There is a bug in how some emojis (e.g. ❤️) are rendered on OSX. + # This workaround should be removed once we update to Chromium 51, where the + # problem was fixed. + fontFamily += ', "Apple Color Emoji"' if process.platform is 'darwin' styleSheetSource = """ atom-text-editor { font-size: #{@config.get('editor.fontSize')}px; - font-family: #{@config.get('editor.fontFamily')}; + font-family: #{fontFamily}; line-height: #{@config.get('editor.lineHeight')}; } """ From d89d34f4ef5d819e517548bda70d8486531dc3be Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 31 Mar 2016 13:02:52 +0200 Subject: [PATCH 2/3] :green_heart: --- spec/workspace-element-spec.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/workspace-element-spec.coffee b/spec/workspace-element-spec.coffee index cf773b4ef..186a33258 100644 --- a/spec/workspace-element-spec.coffee +++ b/spec/workspace-element-spec.coffee @@ -47,9 +47,9 @@ describe "WorkspaceElement", -> it "updates the font-family based on the 'editor.fontFamily' config value", -> initialCharWidth = editor.getDefaultCharWidth() - expect(getComputedStyle(editorElement).fontFamily).toBe atom.config.get('editor.fontFamily') + expect(getComputedStyle(editorElement).fontFamily).toBe atom.config.get('editor.fontFamily') + ", 'Apple Color Emoji'" atom.config.set('editor.fontFamily', 'sans-serif') - expect(getComputedStyle(editorElement).fontFamily).toBe atom.config.get('editor.fontFamily') + expect(getComputedStyle(editorElement).fontFamily).toBe atom.config.get('editor.fontFamily') + ", 'Apple Color Emoji'" expect(editor.getDefaultCharWidth()).not.toBe initialCharWidth it "updates the line-height based on the 'editor.lineHeight' config value", -> From 47bbd8b4bba38ba8a51eda7ddc8d66b5c442aafc Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 31 Mar 2016 17:45:32 +0200 Subject: [PATCH 3/3] Ensure we test for emojis only on Darwin --- spec/workspace-element-spec.coffee | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spec/workspace-element-spec.coffee b/spec/workspace-element-spec.coffee index 186a33258..efb1d1b26 100644 --- a/spec/workspace-element-spec.coffee +++ b/spec/workspace-element-spec.coffee @@ -47,9 +47,14 @@ describe "WorkspaceElement", -> it "updates the font-family based on the 'editor.fontFamily' config value", -> initialCharWidth = editor.getDefaultCharWidth() - expect(getComputedStyle(editorElement).fontFamily).toBe atom.config.get('editor.fontFamily') + ", 'Apple Color Emoji'" + fontFamily = atom.config.get('editor.fontFamily') + fontFamily += ", 'Apple Color Emoji'" if process.platform is 'darwin' + expect(getComputedStyle(editorElement).fontFamily).toBe fontFamily + atom.config.set('editor.fontFamily', 'sans-serif') - expect(getComputedStyle(editorElement).fontFamily).toBe atom.config.get('editor.fontFamily') + ", 'Apple Color Emoji'" + fontFamily = atom.config.get('editor.fontFamily') + fontFamily += ", 'Apple Color Emoji'" if process.platform is 'darwin' + expect(getComputedStyle(editorElement).fontFamily).toBe fontFamily expect(editor.getDefaultCharWidth()).not.toBe initialCharWidth it "updates the line-height based on the 'editor.lineHeight' config value", ->