Emoji: Move a comment to match the restructure in [31779], and add an extra comment explaining how emoji rendering support is detected.

See #31242



git-svn-id: https://develop.svn.wordpress.org/trunk@31788 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast 2015-03-16 00:05:05 +00:00
parent f078bc93aa
commit ad7456fe03
1 changed files with 8 additions and 3 deletions

View File

@ -82,6 +82,11 @@
return false; return false;
} }
/*
* Chrome on OS X added native emoji rendering in M41. Unfortunately,
* it doesn't work when the font is bolder than 500 weight. So, we
* check for bold rendering support to avoid invisible emoji in Chrome.
*/
context.textBaseline = 'top'; context.textBaseline = 'top';
context.font = '600 32px Arial'; context.font = '600 32px Arial';
@ -99,9 +104,9 @@
return canvas.toDataURL().length > 3000; return canvas.toDataURL().length > 3000;
} else { } else {
/* /*
* Chrome on OS X added native emoji rendering in M41. Unfortunately, * This creates a smiling emoji, and checks to see if there is any image data in the
* it doesn't work when the font is bolder than 500 weight. So, we * center pixel. In browsers that don't support emoji, the character will be rendered
* check for bold rendering support to avoid invisible emoji in Chrome. * as an empty square, so the center pixel will be blank.
*/ */
context.fillText( String.fromCharCode( 55357, 56835 ), 0, 0 ); context.fillText( String.fromCharCode( 55357, 56835 ), 0, 0 );
return context.getImageData( 16, 16, 1, 1 ).data[0] !== 0; return context.getImageData( 16, 16, 1, 1 ).data[0] !== 0;