Skia Issue with rendering some Emoticons

514 views
Skip to first unread message

Neeraj garg

unread,
Apr 14, 2018, 3:28:56 AM4/14/18
to skia-discuss
I am trying to some emoticons like   ♠️ .  But i am getting an empty box after the emoticon.

Does anyone have any idea, is it related to surrogate pair or unicode 9 introduced in android 7?

Cary Clark

unread,
Apr 14, 2018, 6:45:34 AM4/14/18
to skia-d...@googlegroups.com
Drawing a spade with fiddle works fine: https://fiddle.skia.org/c/@spade
What code are you using to draw (which font, encoding, glyph, ...), Which Android SDK are you building against?

On Sat, Apr 14, 2018 at 3:28 AM, Neeraj garg <neera...@gmail.com> wrote:
I am trying to some emoticons like   ♠️ .  But i am getting an empty box after the emoticon.

Does anyone have any idea, is it related to surrogate pair or unicode 9 introduced in android 7?

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

Neeraj garg

unread,
Apr 14, 2018, 9:37:07 AM4/14/18
to skia-discuss

I am currently using skia library which is  android 5 source code based . But my current Android SDK version is 27.

You can find the attached source code and the output i am getting.

I am dumping the skia output raw data in a file to visualize it with some external tool.












On Saturday, April 14, 2018 at 4:15:34 PM UTC+5:30, Cary Clark wrote:
Drawing a spade with fiddle works fine: https://fiddle.skia.org/c/@spade
What code are you using to draw (which font, encoding, glyph, ...), Which Android SDK are you building against?
On Sat, Apr 14, 2018 at 3:28 AM, Neeraj garg <neera...@gmail.com> wrote:
I am trying to some emoticons like   ♠️ .  But i am getting an empty box after the emoticon.

Does anyone have any idea, is it related to surrogate pair or unicode 9 introduced in android 7?

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
Skia output.png
native-lib.cpp

Hal Canary

unread,
Apr 14, 2018, 10:14:11 AM4/14/18
to skia-discuss
On Sat, Apr 14, 2018, 9:37 AM Neeraj garg <neera...@gmail.com> wrote:
I am currently using skia library which is  android 5 source code based .

That is a very old version of Skia. Try the most recent stable branch:

cd skia
git checkout origin/chrome/m67

Neeraj garg

unread,
Apr 14, 2018, 10:21:52 AM4/14/18
to skia-discuss
I am using a legacy code base so upgrading the entire source code giving me lots of issues. Major one is default  font fallback feature which is no longer present with latest skia version.

Can you help me with the source code that i have attached with earlier post.

Cary Clark

unread,
Apr 14, 2018, 10:46:26 AM4/14/18
to skia-d...@googlegroups.com
If you are relying on font fallback, you'll need to do additional diagnostic work to figure out why it is failing. I would try turning the text into glyphs when drawing only the spade to see why it is generating both a spade and a missing character. I would also try setting the font explicitly rather than relying on font fallback, just to understand it better.

To directly answer your question, there's no support for older versions of Skia.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss+unsubscribe@googlegroups.com.

Cary Clark

unread,
Apr 14, 2018, 10:59:38 AM4/14/18
to skia-d...@googlegroups.com
I have managed to reproduce your bug using modern Skia: https://fiddle.skia.org/c/@spademono
I wrote up a bug to track this here: skbug.com/7811

Neeraj garg

unread,
Apr 14, 2018, 11:16:34 AM4/14/18
to skia-discuss
Thanks a lot Cary.

What do you think? Is this some encoding issue. I see the same issue with some other emoticons but not all. 


On Saturday, April 14, 2018 at 8:29:38 PM UTC+5:30, Cary Clark wrote:
I have managed to reproduce your bug using modern Skia: https://fiddle.skia.org/c/@spademono
I wrote up a bug to track this here: skbug.com/7811

On Sat, Apr 14, 2018 at 10:46 AM, Cary Clark <cary...@google.com> wrote:
If you are relying on font fallback, you'll need to do additional diagnostic work to figure out why it is failing. I would try turning the text into glyphs when drawing only the spade to see why it is generating both a spade and a missing character. I would also try setting the font explicitly rather than relying on font fallback, just to understand it better.

To directly answer your question, there's no support for older versions of Skia.
On Sat, Apr 14, 2018 at 10:21 AM, Neeraj garg <neera...@gmail.com> wrote:
I am using a legacy code base so upgrading the entire source code giving me lots of issues. Major one is default  font fallback feature which is no longer present with latest skia version.

Can you help me with the source code that i have attached with earlier post.

On Saturday, April 14, 2018 at 7:44:11 PM UTC+5:30, Hal Canary wrote:
On Sat, Apr 14, 2018, 9:37 AM Neeraj garg <neera...@gmail.com> wrote:
I am currently using skia library which is  android 5 source code based .

That is a very old version of Skia. Try the most recent stable branch:

cd skia
git checkout origin/chrome/m67

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.

Cary Clark

unread,
Apr 14, 2018, 5:02:24 PM4/14/18
to skia-d...@googlegroups.com
If I did my analysis right, when you paste the spade character in, your text editor is inserting U+2660 (the spade character) followed by U+FE0F, a variation selector. I'm guessing the variation selector is there to allow the preceding character to be drawn in color, as would be the case for red hearts or diamonds. The fallback font chosen for you has the spade code point, but not the variation selector, so it draws the spade and a missing character symbol.

You can fix this by either describing your spade with  "\xE2" "\x99" "\xA0", or by selecting a font that includes U+FE0F as one of its code points.

To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss+unsubscribe@googlegroups.com.

Neeraj Garg

unread,
Apr 14, 2018, 10:07:48 PM4/14/18
to skia-d...@googlegroups.com
The same thing is happening when I take a input text field and and then I enter some emoticons I get this empty box. How do I handle this at runtime?

I am using skia calls behind  input text.




You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/Dr8RyUdAKZA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss...@googlegroups.com.

Neeraj garg

unread,
Apr 14, 2018, 10:36:32 PM4/14/18
to skia-discuss
Do you have any idea which handles variation character(U+FE0F) ? 
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss+unsubscribe@googlegroups.com.

To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/Dr8RyUdAKZA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss+unsubscribe@googlegroups.com.

Neeraj garg

unread,
Apr 14, 2018, 10:39:28 PM4/14/18
to skia-discuss
Sorry for the typo.

I meant to say which font family handles the variation character?

Cary Clark

unread,
Apr 15, 2018, 7:43:28 AM4/15/18
to skia-d...@googlegroups.com
I don't know if Skia has a way to iterate through all of the fonts it can see, or if it can determine if a particular Unicode value is present in the font. I'll consult with our local font expert and find out. 

But do you need this at all? For your purposes, can you remove U+FE0F from the text stream before drawing to fix the bug?


Neeraj Garg

unread,
Apr 15, 2018, 8:21:06 AM4/15/18
to skia-d...@googlegroups.com
What I read about variation selector on internet, it provides the color, animation,size etc. meta data to the precedding character which in our case is spade emoticon. 

If I remove it from the stream.... won't it affect the emoticon appearance on the screen while drawing?


I just debug my app....I didn't find the unicode (U+FE0F) . I just could see some extra characters (\x0F\xFE). I am trying with  alteing/removing these characters. But I guess there should be some better solution for this problem with no side affects(appearance).

Sorry for the typo.

You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/Dr8RyUdAKZA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss...@googlegroups.com.

To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/Dr8RyUdAKZA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss...@googlegroups.com.

To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.
Sorry for the typo.

You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/Dr8RyUdAKZA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss...@googlegroups.com.

To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/Dr8RyUdAKZA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss...@googlegroups.com.

Neeraj garg

unread,
Apr 16, 2018, 10:11:50 AM4/16/18
to skia-discuss
Cary, did you get any help from your local font team? 
Sorry for the typo.

To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss+unsubscribe@googlegroups.com.

To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/Dr8RyUdAKZA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss+unsubscribe@googlegroups.com.

To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss+unsubscribe@googlegroups.com.

To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/Dr8RyUdAKZA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss+unsubscribe@googlegroups.com.
Sorry for the typo.

To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss+unsubscribe@googlegroups.com.

To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/Dr8RyUdAKZA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss+unsubscribe@googlegroups.com.

To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss+unsubscribe@googlegroups.com.

To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/Dr8RyUdAKZA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss+unsubscribe@googlegroups.com.

Cary Clark

unread,
Apr 16, 2018, 10:29:47 AM4/16/18
to skia-d...@googlegroups.com
Yes, thanks to Hal. 

"Take a look at
https://fiddle.skia.org/c/@SkFontMgr_example

Also, SkFontMgr::matchFamilyStyleCharacter(...)"

Neeraj garg

unread,
Apr 16, 2018, 11:00:44 AM4/16/18
to skia-discuss
As per my understanding, this is sort of font fallback which is by default handled in android 5  source code(my code version). 

Below snippet of code use matchFamilyStyleCharacter internally:

ANPPaint* paint = new ANPPaint();
SkPaintOptionsAndroid paintOptions;
paintOptions.setUseFontFallbacks(true);
paint->setPaintOptionsAndroid(paintOptions);




Sorry for the typo.

You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/Dr8RyUdAKZA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss...@googlegroups.com.

To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/Dr8RyUdAKZA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss...@googlegroups.com.

To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.
Sorry for the typo.

To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/Dr8RyUdAKZA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss...@googlegroups.com.

To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/Dr8RyUdAKZA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss...@googlegroups.com.

To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

Neeraj garg

unread,
Apr 18, 2018, 1:14:00 AM4/18/18
to skia-discuss
Cary , i am trying to understand why skia font fallback is choosing a font for me which does not have codepoint of variation selector?

What is default typeface skia uses while drawing any text?

Neeraj garg

unread,
Apr 18, 2018, 2:12:58 AM4/18/18
to skia-discuss
I am getting attached output for below snippet of code on mac device :

   canvas->clear(SK_ColorWHITE);
   SkPaint paint;
   paint.setTextEncoding(SkPaint::kUTF8_TextEncoding);
   paint.setSubpixelText(true);
   paint.setColor(SK_ColorBLACK);
   paint.setTextSize(30);
   paint.setAntiAlias(true);
   paint.setTypeface(SkTypeface::MakeFromName("Apple Color Emoji", SkFontStyle()) );

   static const char message[] = "❤️";

   canvas->drawText(message, sizeof (message) , fWindow->width()/2, fWindow->height()/2, paint);
Screen Shot 2018-04-18 at 11.30.18 AM.png

Neeraj garg

unread,
Apr 19, 2018, 1:32:42 AM4/19/18
to skia-discuss
Cary, I am still stuck with this issue and need your help. Please respond.

Cary Clark

unread,
Apr 19, 2018, 7:32:23 AM4/19/18
to skia-d...@googlegroups.com
Skia is designed to operate at a low level, and draws the glyphs requested. Because of the complexity of converting Unicode to font glyphs, Skia has been deprecating font fallback and relegates font shaping to dedicated packages like harfbuzz. You may want to pursue your issue at that level.

To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages