After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 753312 - Font not properly loaded on MacOSX (example attached)
Font not properly loaded on MacOSX (example attached)
Status: RESOLVED FIXED
Product: pango
Classification: Platform
Component: coretext
unspecified
Other Mac OS
: Normal normal
: ---
Assigned To: gtk-quartz maintainers
pango-maint
: 763536 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2015-08-06 09:45 UTC by Gautier Pelloux-Prayer
Modified: 2016-04-24 09:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Sample code des (375 bytes, text/x-csrc)
2015-08-06 09:45 UTC, Gautier Pelloux-Prayer
  Details
Program output for 3 different setups (39.96 KB, image/png)
2015-08-06 09:48 UTC, Gautier Pelloux-Prayer
  Details
[PATCH 1/3] coretext: properly handle UTF32 characters in CFStrings (6.21 KB, patch)
2015-09-06 19:20 UTC, Kristian Rietveld
committed Details | Review
[PATCH 2/3] coretext: remove useless calls to pango_coverage_set() (1.11 KB, patch)
2015-09-06 19:20 UTC, Kristian Rietveld
committed Details | Review
[PATCH 3/3] coretext: implement obtaining coverage of supplementary planes (2.23 KB, patch)
2015-09-06 19:21 UTC, Kristian Rietveld
committed Details | Review

Description Gautier Pelloux-Prayer 2015-08-06 09:45:45 UTC
Created attachment 308841 [details]
Sample code des

Using the attached program, it seems that Emoji/Emoticons unicode symbols are not handled by Gtk on MacOSX while it is working fine on Debian.

I tested with gtk+ 2.24.28, gtk+ 3.16.4 (installed from HomeBrew) and on another Mac with gtk+ 2.24.25 (installed from MacPorts) with always the same result. I can see that Gimp is also affected by this bug.
Comment 1 Gautier Pelloux-Prayer 2015-08-06 09:48:28 UTC
Created attachment 308842 [details]
Program output for 3 different setups
Comment 2 Kristian Rietveld 2015-08-06 10:08:46 UTC
Could you tell us which Pango version you are using on Mac OS X? Are you using a specific font on Mac OS, or the default one?

It's most likely a Pango issue, so we might want to reassign when we have the additional information. Also we need to verify if the Emoji unicode symbols are actually included in the used Mac OS font.
Comment 3 Gautier Pelloux-Prayer 2015-08-06 11:36:47 UTC
On first MacOSX, Pango 1.36_8.1 built from https://github.com/Homebrew/homebrew/blob/master/Library/Formula/pango.rb
On second 1.36.8 from Macports.

I am only using the given program (so default font), compiled with:

gcc hello-world.c `pkg-config --libs --cflags gtk+-3.0`

Which ends with:

gcc hello-world.c -D_REENTRANT -I/usr/local/Cellar/gtk+3/3.16.4_1/include/gtk-3.0 -I/usr/local/Cellar/glib/2.44.1/include/gio-unix-2.0/ -I/usr/local/Cellar/cairo/1.14.2_1/include/cairo -I/usr/local/Cellar/libepoxy/1.2/include -I/usr/local/Cellar/pango/1.36.8_1/include/pango-1.0 -I/usr/local/Cellar/atk/2.16.0/include/atk-1.0 -I/usr/local/Cellar/cairo/1.14.2_1/include/cairo -I/usr/local/Cellar/pixman/0.32.6/include/pixman-1 -I/usr/local/Cellar/fontconfig/2.11.1/include -I/usr/local/Cellar/freetype/2.5.3_1/include/freetype2 -I/usr/local/Cellar/freetype/2.6_1/include/freetype2 -I/usr/local/Cellar/libpng/1.6.17/include/libpng16 -I/usr/local/Cellar/gdk-pixbuf/2.30.8/include/gdk-pixbuf-2.0 -I/usr/local/Cellar/libpng/1.6.17/include/libpng16 -I/usr/local/Cellar/glib/2.44.1/include/glib-2.0 -I/usr/local/Cellar/glib/2.44.1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -L/usr/local/Cellar/gtk+3/3.16.4_1/lib -L/usr/local/Cellar/pango/1.36.8_1/lib -L/usr/local/Cellar/atk/2.16.0/lib -L/usr/local/Cellar/cairo/1.14.2_1/lib -L/usr/local/Cellar/gdk-pixbuf/2.30.8/lib -L/usr/local/Cellar/glib/2.44.1/lib -L/usr/local/opt/gettext/lib -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl


On MacOSX, Emoji symbols seems to be in font "Apple Color Emoji" and not on the default font (which seems to be "Helvetica Neue", but I am not totally sure about that). 

On Debian, the default font does not contain emojis but I guess that this is still working because there are contained in another font (ttf-ancien-fonts and/or ttf-symbola at least) with automatic fallback(?).
Comment 4 Kristian Rietveld 2015-08-06 12:14:12 UTC
(In reply to Gautier Pelloux-Prayer from comment #3)
> 
> On MacOSX, Emoji symbols seems to be in font "Apple Color Emoji" and not on
> the default font (which seems to be "Helvetica Neue", but I am not totally
> sure about that). 

Very well possible and we need to ensure that Pango is falling back on the Emoji font properly.
Comment 5 Gautier Pelloux-Prayer 2015-08-10 08:20:49 UTC
Can you confirm me that I have nothing more to do yet? If not, what can I do to help on this matter?
Comment 6 Gautier Pelloux-Prayer 2015-08-28 10:01:02 UTC
Hello - did you manage to reproduce this issue or should I try to provide you a simpler program without Gtk but only Pango?
Comment 7 Christian Hergert 2015-08-30 00:19:38 UTC
I can reproduce on 10.10 with glib/gtk+/pango from git master branches.

Harfbuzz-1.0.2
Pango git 1.37.3..aa12788659f2a65314bdcc005d50105a5f4a63cd
Gtk+ 3.17.7..09567d19a73b7992f702605790d7dc43139650e9
Comment 8 Kristian Rietveld 2015-09-03 21:13:05 UTC
(In reply to Gautier Pelloux-Prayer from comment #6)
> Hello - did you manage to reproduce this issue or should I try to provide
> you a simpler program without Gtk but only Pango?

Yes I can reproduce the issue too. Also I can confirm that the 0x1f600 character is included with the Apple Color Emoji font and that the Apple Color Emoji font is included in the cascade list (fallback font list) that is used.

We appear to need fixes in two places:

 1) The code that translates coverage bitmaps from what is obtained from CoreText to what is needed by Pango only handles the BMP plane and needs to be extended to handle non-BMP planes. I have a half finished patch to do this now which I will clean up.

 2) The CoreText shaper engine needs to be fixed/extended to be able to handle 32-bit code points. Since we didn't support non-BMP, this was never done.


Hope I'll have patches during the weekend.
Comment 9 Kristian Rietveld 2015-09-04 22:24:23 UTC
Note that in order to get this to work, we depend on the patch in the following Cairo bug to be applied:

  https://bugs.freedesktop.org/show_bug.cgi?id=63771

I updated that patch today and requested it to be reviewed and accepted.
Comment 10 Kristian Rietveld 2015-09-06 19:20:24 UTC
Created attachment 310767 [details] [review]
[PATCH 1/3] coretext: properly handle UTF32 characters in CFStrings
Comment 11 Kristian Rietveld 2015-09-06 19:20:46 UTC
Created attachment 310768 [details] [review]
[PATCH 2/3] coretext: remove useless calls to pango_coverage_set()
Comment 12 Kristian Rietveld 2015-09-06 19:21:12 UTC
Created attachment 310769 [details] [review]
[PATCH 3/3] coretext: implement obtaining coverage of supplementary planes
Comment 13 Kristian Rietveld 2015-09-06 19:23:23 UTC
I just attached the necessary Pango patches to get this to work. Note that in addition to this you need the Cairo patched I referenced in comment 9. It looks like this patch will land in Cairo after the 1.14 release.

When rendered, the Emoji glyphs look like they are slightly cut off. I haven't investigated why this is happening, I would propose a separate bug is opened for this after the above patches have landed.
Comment 14 Gautier Pelloux-Prayer 2015-09-06 19:24:58 UTC
Awesome work! Thanks for investigating this issue.

I will try that asap!
Comment 15 Matthias Clasen 2015-09-06 22:55:33 UTC
Moving this to pango then. Thanks, Kris!
Comment 16 Ryusei Yamaguchi 2016-03-15 23:44:40 UTC
*** Bug 763536 has been marked as a duplicate of this bug. ***
Comment 17 Behdad Esfahbod 2016-04-21 20:19:25 UTC
Any update here anyone?
Comment 18 Kristian Rietveld 2016-04-21 20:45:20 UTC
As far as I know, the attached patches fix the issue and are waiting to be reviewed.

In conjunction with this, the Cairo patch linked in command 9 (https://bugs.freedesktop.org/show_bug.cgi?id=63771) is waiting to be pushed.
Comment 19 Behdad Esfahbod 2016-04-21 21:34:34 UTC
lgtm.  Please push.  Thanks!
Comment 20 Kristian Rietveld 2016-04-24 09:51:35 UTC
Pushed to master.  Hope the necessary Cairo improvements will follow suit.


commit 7e6fe2c381c307619215a1f7661dd5c609b22c39
Author: Kristian Rietveld <kris@loopnest.org>
Date:   Sat Sep 5 23:13:18 2015 +0200

    coretext: implement obtaining coverage of supplementary planes

commit 550fba61eea3cae292d4b2abbffbe8a7a99a50b4
Author: Kristian Rietveld <kris@loopnest.org>
Date:   Sat Sep 5 22:58:28 2015 +0200

    coretext: remove useless calls to pango_coverage_set()

    Since Pango coverage is initialized to PANGO_COVERAGE_NONE, it makes no
    sense to perform calls to pango_coverage_set for characters that will
    be set (or rather left) to none.

commit 783544ddfc23225f894a26eb31fcc4bc3990ce22
Author: Kristian Rietveld <kris@loopnest.org>
Date:   Sat Sep 5 22:52:48 2015 +0200

    coretext: properly handle UTF32 characters in CFStrings