ibicha / emojitexture Goto Github PK
View Code? Open in Web Editor NEWA Unity plugin to render Emojis βΊ β€ π π to a texture
License: Other
A Unity plugin to render Emojis βΊ β€ π π to a texture
License: Other
Refactor current code to implement interface EmojiProvider
(native, github, other) and possibility to set fallback list
Really great project but I notice some emojis are missing when I test on Android (not yet tested iOS) with the Github Fallback disabled. π (U+1F608) π¦ (U+1F993) for example display as squares. Is this an issue my end or a known bug?
Also, is there any update on complex emojis such as π U+1F482. They also still display incorrectly.
I would really like to deploy this to my app, could do wonders for the user experience. Many thanks for all the progress so far.
Automatic generation of sprite sheets to be used by TextMesh Pro.
Hey.
I found a crash in the iOS Plugin. Currently unfortunately I cannot give you debug data, but i can give you reproduction steps.
I got this fixed by changing the way the emoji is retrieved ( instead of using the character-based search, i changed it to GetFirstEmoji() ). I cannot post the source, unfortunately, and also it's kindof a bodgejob so it's probably for the best.
Cheers!
Some code got forgotten in the last commit for the iOS plugin. FIX ASAP
Stumbled on https://www.reddit.com/r/iOSProgramming/comments/6zpxms/use_of_apple_emoji_against_tos_in_ios_app_but/
Need to research TOS before moving on, and put any needed disclaimers in the README.
Implement a simple cache mechanism to save downloaded images, and clear cache when needed (maybe an expiry as well).
Motives:
When I first created this plugin, I wanted to keep away from all the complexities related to font/ glyphs, rendering, and so on, and leave that for the underlying OS to do the heavy lifting.
This resulted in a flaky implementation that had platform specific bugs (and even per os version).
What's next:
The superior solution was to implement a library that is capable of loading emojis straight from color font files and render them directly. The implementation was delayed because of many posts/news about TextMesh Pro was in progress with such features. But since the wait got too long, and the lack of a good solution is becoming frustrating to some people, I resumed working on this.
The how:
The idea is to leverage a combination of great libraries (FreeType/Harfbuzz/Cairo SkiaSharp/HarfBuzzSharp) that do this pretty well, and use that for EmojiTexture. This will allow better flexibility, quality and performance in the future.
Currently in the TODO list:
Sidenote: TextMesh Pro will have colored glyphs with Unity 2019.2, and compatible with 2019.1, according to the roadmap (https://youtu.be/qwGjneorKgs?t=2742). It sounds like this feature is not going to be supported on earlier versions of Unity.
Should be possible to set the text with an int
representing the unicode value of the emoji.
Something like <emoji="heart"> or maybe would be a nice addition.
Combinations are currently not working.
E.g. an emoji of man + skin tone is not detected as a single emoji, but as 2.
It works fine in api level 30 but in 31 it crashes, and Google requires Api level 31 from November. Any help?
Hello, I just realized when compiling for Android 64 bits, it crashes.
Using GitHub like emoji codes for instantiating EmojiTexture class, for example instead of doing:
material.mainTexture = new EmojiTexture("β€");
We can do this:
material.mainTexture = new EmojiTexture(":heart:");
Thanks.
TextMesh Pro doesn't not support Emoji modifiers yet. Need work around.
IUnityRenderingExtensions.h file not found error when building with Unity3D 2018.2.6f1 and Xcode 9.4.1
I know it is not efficient, and probably unnecessary, to use a UILabel for rendering the text, but it was a fast mean to get an accurate rendering, without going through calculating the correct size of the glyphs.
Hi,
Your plugin is really great! But sadly on Android marshmalow 6.0 (tested on 2 phones).
I got some weird behaviors:
Can you tell me if you have the same issues and if you have an idea on how to fix this?
The plugin work well on Andoid 9.0 :)
Otherwise on iOS (10.3.3) the TextMeshPro part doesn't work :'(
I see only the unsupported text character... If you have an idea on this too?
Thanks!
Someone investigate this problem?
When on keyboard switch to smile get errors:
2020-11-24 12:05:27.446448+0200 The behavior of the UICollectionViewFlowLayout is not defined because:
2020-11-24 12:05:27.446534+0200 the item height must be less than the height of the UICollectionView minus the section insets top and bottom values, minus the content insets top and bottom values.
2020-11-24 12:05:27.446773+0200 The relevant UICollectionViewFlowLayout instance is <_InvertibleFlowLayout: 0x127fcfde0>, and it is attached to <UICollectionView: 0x12e335a00; frame = (0 0; 896 414); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x28059da70>; layer = <CALayer: 0x2813d7120>; contentOffset: {0, 0}; contentSize: {0, 0}; adjustedContentInset: {0, 0, 0, 0}; layout: <_InvertibleFlowLayout: 0x127fcfde0>; dataSource: <__UIDiffableDataSource 0x282800ff0: sectionCounts=[_UIDataSourceSnapshotter - 0x2813cdea0:(0:169)]; sections=[0x2813ce3a0]; identifiers=[0x2813cdf80]>>.
2020-11-24 12:05:27.446815+0200 Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the debugger.
2020-11-24 12:05:55.502103+0200 CoreText note: Client requested name ".PhoneFallback", it will get TimesNewRomanPSMT rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[UIFont systemFontOfSize:].
2020-11-24 12:05:55.502209+0200 CoreText note: Set a breakpoint on CTFontLogSystemFontNameRequest to debug.
test.html :
<!DOCTYPE html>
<html>
<body>
<script>
var DEBUG = true;
function Render(emojiText, width, height, /*ignored*/sanitize) {
var canvas = document.getElementById("emojiCanvas") || document.createElement("canvas");
canvas.id = "emojiCanvas"
if(DEBUG)
document.body.appendChild(canvas);
canvas.width = width;
canvas.height = height;
var ctx = canvas.getContext("2d");
ctx.textAlign = "center";
ctx.textBaseline = "middle"
ctx.font = "256px sans-serif";
var size = canvas.width;
var scaleFactor = size / ctx.measureText(emojiText).width;
ctx.translate(size/2, size/2);
ctx.scale(scaleFactor, scaleFactor);
ctx.translate(-size/2, -size/2);
ctx.fillText(emojiText, size/2, size/2);
return ctx.getImageData(0, 0, width, height).data;
}
function DoRender() {
var emojiText = "π¨βπΎ";
var size = 64;
Render(emojiText, size, size);
}
DoRender()
</script>
</body>
</html>
Could use IssuePluginCustomTextureUpdate for rendering on mobile since it supports GLES and Metal
Error:
java.lang.NoSuchMethodErrorΒ Β·Β no non-static method "Ljava/nio/DirectByteBuffer;.(JI)V"
Stacktrace:
Native Method com.unity3d.player.UnityPlayer.nativeRender()
Unknown Source com.unity3d.player.UnityPlayer.access$300()
Unknown Source:95 com.unity3d.player.UnityPlayer$e$1.handleMessage()
Handler.java:102 ndroid.os.Handler.dispatchMessage()
Looper.java:226 ndroid.os.Looper.loopOnce()
Looper.java:313 ndroid.os.Looper.loop()
Unknown Source:20 com.unity3d.player.UnityPlayer$e.run()
unknown UnityEngine.AndroidJNISafe.CheckException()
System.IntPtr obj, System.String name, System.String sig UnityEngine.AndroidJNISafe.GetMethodID()
System.IntPtr jclass, System.String signature UnityEngine._AndroidJNIHelper.GetConstructorID()
System.String className, System.Object[] args UnityEngine.AndroidJavaObject._AndroidJavaObject()
System.String text, System.Int32 width, System.Int32 height iBicha.EmojiTexture..ctor()
TMPro.TMP_Text tmp_Text iBicha.TMPro.TMProEmojiAsset.HookTMP()
"Hooking" to textmesh pro is too awkward. Should be a behaviour that is added with a TMP text, leveraging the TMPro_EventManager.TEXT_CHANGED_EVENT
event.
Native rendering on windows using DirectWrite
512x512 textures and larger do not display emojis. They do display regular characters though.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.