emoji

Is it possible to render multi-coloured emojis with ImageMagick?

时间秒杀一切 提交于 2019-12-01 07:51:48
问题 I have a text that may contain emojis. I want to render it into JPEG image with RMagick (I can also use ImageMagick directly). I was able to render only monochrome emojis with AndroidEmoji.ttf, but ImageMagick renders interrogation signs if I use AppleColorEmoji.ttf. Here's how I do it: require 'rmagick' granite = Magick::ImageList.new('granite:') canvas = Magick::ImageList.new canvas.new_image(300, 100, Magick::TextureFill.new(granite)) input = "👠 👯👢 👣" text = Magick::Draw.new text.font =

Dynamically create NSString with Unicode emoji

廉价感情. 提交于 2019-12-01 07:16:46
I have the string @"Hi there! \U0001F603" , which correctly shows the emoji like Hi there! 😃 if I put it in a UILabel . But I want to create it dynamically like [NSString stringWithFormat:@"Hi there! \U0001F60%ld", (long)arc4random_uniform(10)] , but it doesn't even compile. If I double the backslash, it shows the Unicode value literally like Hi there! \U0001F605 . How can I achieve this? A step back, for a second: that number that you have, 1F6603 16 , is a Unicode code point , which, to try to put it as simply as possible, is the index of this emoji in the list of all Unicode items. That's

php extract Emoji from a string

我是研究僧i 提交于 2019-12-01 06:49:41
I have a string contain emoji. I want extract emoji's from that string,i'm using below code but it doesn't what i want. $string = "😃 hello world 🙃"; preg_match('/([0-9#][\x{20E3}])|[\x{00ae}\x{00a9}\x{203C}\x{2047}\x{2048}\x{2049}\x{3030}\x{303D}\x{2139}\x{2122}\x{3297}\x{3299}][\x{FE00}-\x{FEFF}]?|[\x{2190}-\x{21FF}][\x{FE00}-\x{FEFF}]?|[\x{2300}-\x{23FF}][\x{FE00}-\x{FEFF}]?|[\x{2460}-\x{24FF}][\x{FE00}-\x{FEFF}]?|[\x{25A0}-\x{25FF}][\x{FE00}-\x{FEFF}]?|[\x{2600}-\x{27BF}][\x{FE00}-\x{FEFF}]?|[\x{2900}-\x{297F}][\x{FE00}-\x{FEFF}]?|[\x{2B00}-\x{2BF0}][\x{FE00}-\x{FEFF}]?|[\x{1F000}-\x{1F6FF}

How to count the correct length of a string with emojis in javascript?

末鹿安然 提交于 2019-12-01 06:37:29
I've a little problem. I'm using NodeJS as backend. Now, an user has a field "biography", where the user can write something about himself. Suppose that this field has 220 maxlength, and suppose this as input: 👶🏻👦🏻👧🏻👨🏻👩🏻👱🏻‍♀️👱🏻👴🏻👵🏻👲🏻👳🏻‍♀️👳🏻👮🏻‍♀️👮🏻👷🏻‍♀️👷🏻💂🏻‍♀️💂🏻🕵🏻‍♀️👩🏻‍⚕️👨🏻‍⚕️👩🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾 As you can see there aren't 220 emojis (there are 37 emojis), but if I do in my nodejs server console.log(bio.length) where bio is the input text, I got 221. How could I "parse" the string input to get the correct length? Is it a problem about unicode? SOLVED

Python3 emoji characters as unicode

℡╲_俬逩灬. 提交于 2019-12-01 06:19:45
I have a string in python3 that has emojis in it and I want to treat the emojis as their unicode representation. I need to do some manipulation on the emoji in this format. s = '😬 😎 hello' This treats each emoji as its own character such that len(s) == 9 && s[0] == 😬 I want to be change the format of the string so that it is in unicode points such that s = '😬 😎 hello' u = to_unicode(s) # Some function to change the format. print(u) # '\ud83d\ude2c \ud83d\ude0e hello' u[0] == '\ud83d' and u[1] == '\ude2c' len(u) == 11 Any thoughts on creating a function to_unicode that will take s and change it

How to count grapheme clusters or “perceived” emoji characters in Java

人盡茶涼 提交于 2019-12-01 05:28:44
I'm looking to count the number of perceived emoji characters in a provided Java string. I'm currently using the emoji4j library, but it doesn't work for grapheme clusters like this one: 👩‍👩‍👦‍👦 Calling EmojiUtil.getLength("👩‍👩‍👦‍👦") returns 4 instead of 1 , and similarly calling EmojiUtil.getLength("👻👩‍👩‍👦‍👦") returns 5 instead of 2 . Are there any APIs or methods on String in Java that make it easy to count grapheme clusters? I've been hunting around but understandably the codePoints() method on a String includes not only the visible emojis, but also the zero width joiners. I also attempted

Dynamically create NSString with Unicode emoji

自闭症网瘾萝莉.ら 提交于 2019-12-01 04:50:57
问题 I have the string @"Hi there! \U0001F603" , which correctly shows the emoji like Hi there! 😃 if I put it in a UILabel . But I want to create it dynamically like [NSString stringWithFormat:@"Hi there! \U0001F60%ld", (long)arc4random_uniform(10)] , but it doesn't even compile. If I double the backslash, it shows the Unicode value literally like Hi there! \U0001F605 . How can I achieve this? 回答1: A step back, for a second: that number that you have, 1F6603 16 , is a Unicode code point , which,

How to count the correct length of a string with emojis in javascript?

不打扰是莪最后的温柔 提交于 2019-12-01 04:06:49
问题 I've a little problem. I'm using NodeJS as backend. Now, an user has a field "biography", where the user can write something about himself. Suppose that this field has 220 maxlength, and suppose this as input: 👶🏻👦🏻👧🏻👨🏻👩🏻👱🏻‍♀️👱🏻👴🏻👵🏻👲🏻👳🏻‍♀️👳🏻👮🏻‍♀️👮🏻👷🏻‍♀️👷🏻💂🏻‍♀️💂🏻🕵🏻‍♀️👩🏻‍⚕️👨🏻‍⚕️👩🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾👨🏻‍🌾 As you can see there aren't 220 emojis (there are 37 emojis), but if I do in my nodejs server console.log(bio.length) where bio is the input text, I got 221

Rendering Emoji with PIL

旧时模样 提交于 2019-12-01 03:59:28
I am trying to make images out of tweets, however some of them contain Emojis . I am using PIL to render my images and the Symbola font. The text is in unicode utf-8 encoding and the Symbola font does include the emojis. Here is an abridged version of the code: from PIL import Image, ImageFont, ImageDraw text = u"\U0001f300" #CYCLONE emoji image = Image.new("RGBA", (100,100), (255,255,255)) font = ImageFont.truetype("Symbola.ttf", 60, encoding='unic') draw = ImageDraw.Draw(image) draw.text((0,0), text, (0,0,0), font=font) image.save("Test.png") image.show() This just renders and image with two

PHP导出带有emoji表情的文本到excel文件出问题了

非 Y 不嫁゛ 提交于 2019-12-01 02:43:36
前段时间做了一个导出用户信息(包含微信昵称)到excel文件的功能,一直没问题,今天突然有人反馈说导出来的数据有一些丢失了。我试了一下,发现有些数据导出没问题,有些有问题,某些列出现了空白,数据打印出来是没问题的,但是输出到excel文件中就出问题了。因为打开导出的excel文件的时候提示存在无法读取的内容,所以我猜想可能是数据中存在某些特殊字符导致的。不断缩小导出的数据范围进行重试后,终于锁定了问题,原来是用户的微信昵称中出现emoji表情导致的,将其过滤掉再导出就好了。 emoji表情过滤函数: /** * 过滤文本中的emoji表情包(输出到excel文件中会导致问题) * @param string $text 原文本 * @return string 过滤emoji表情包后的文本 */ function removeEmoji($text){ $len = mb_strlen($text); $newText = ''; for($i=0;$i<$len;$i++){ $str = mb_substr($text, $i, 1, 'utf-8'); if(strlen($str) >= 4) continue;//emoji表情为4个字节 $newText .= $str; } return $newText; }    来源: https://www.cnblogs