Multi Language Textbox in unity - unity3d

I've been trying to make a project that creates Flash Cards , and i wanted to make the user be able to input any text on either sides of the card , the problem I'm facing now is that since the textbox(from TextMeshPro or regular one) has certain font whenever I try to input another languages like Japanese or Arabic it simply shows as squares, I tried the suggestion to use the textmesh pro dynamic font feature but still with no luck.
my question is , is there any way to do what I'm asking for without using fallback assets for every single language?
are there any unity plugins that do the job?
Like I said the aim is to make a textbox that displays whatever language is put in it.
any tips would be appreciated
NOTE: the solution doesn't need to use textmeshpro , it can use standard text component or any other custom ones.

I think the problem is the font. You will need a font that supports all the characters.
Perhaps you could use different fonts for different languages.
TextMeshPro creates a texture from the fonts characters. This texture will get very large if you have a lot of characters (e.g. for chinese). Because of that, the standard Text-component should be easier to work with.
(But I don't exactly know how the dynamic font feature of TextMeshPro works.)

So Since this is the first time I've worked with Fonts it appears that I didn't quite understand how fonts work and now I found the right way to approach the problem so I will give here the steps that I used to solve the multi-language issue:
1)you need a Font that supports as many languages as possible i found out that "Ariel Unicode" fits this need quite well with support to most common used languages support
2)you need to create a TextMeshPro Dynamic font asset that uses the font chosen in step one. (I tried using TextMeshPro Dynamic font before but i was mistakenly under the impression that the dynamic feature "search" for a font that has a certain character rather than we need to supply the font and it searches within the font for a character, that was a bit of a stupid assumption at my part created from the fact that I didn't understand how fonts work) .Here is a link how to use Dynamic SDF textmeshPro
I hope this helps someone with this process.

Related

Combine more than one Style in a map

Here is what I'm trying to achieve: I want to combine more than one Style (a map built by the user in the Mapbox Studio) in a single map.
Let's say we have a Style with some base layers and tilesets, and another Style with just one tileset but with colors and other styling configuration and I want to dynamically combine them in my map.
What I have tried
I add the first Style with setStyle
Make a request to the Styles API and get the second Style json
Iterate over the sources of the second Style and add them to the map using addSource (renaming to avoid conflict)
Iterate over the layers of the second Style and add them to the map usgin addLayer
It pretty much worked, I only got errors with layers that use a "text-field" and require the style to have a "glyphs" attribute.
I then tried do dynamically change the "glyphs" attribute of the map Style but it didn't work. The error persists.
Error: "layers.state-label.layout.text-field: use of "text-field" requires a style "glyphs" property"
Why don't I add tilesets instead?
Because I want to get the all the layout options present in the Style.
Why didn't I open an issue about how to change the glyphs dynamically?
Alhtough this is the concrete problem I'm facing right now I was willing to get feedback on the general approach.
Is it something doable? Should I consider combining more than one style in the map a good idea? Is there a better way to do it?
Thanks in advance.
Leo,,
Your approach sounds generally fine, with a couple of major caveats, which you have discovered:
A style can only have a single font glyph
A style can only have a single icon sprite
If both are hosted under the same user account on Studio, I think it might work, at least for fonts. But judging from your error, that's not the case.
So what can you do? You will have to pick the font glyph from one style, then update every layer in the other style to use a font present in that style. I think that would be hard to do in the general case (I don't know how to find out what fonts are present in a glyph), so the safest option might be to create a new font glyph and remap every font to it.
FWIW, this general issue is already tracked here: https://github.com/mapbox/mapbox-gl-js/issues/4225

Can you help me finding the best method to add long paragraphs in flutter?

I know about html plugins which can be used to add pages of long paragraphs
I also know about flutter codes which can be used to add long paras of texts
But I am not satisfied with both methods..
I am creating a lesson app and want to insert tons of texts and images in a beautifully way...
Can you suggest me any way [better way] to add long texts with keeping eye on the size of the app
I have added screenshots for reference
I'd recommend checking out Zefyr. It's a WYSIWYG that can embed images, display lists and even has collaborative editing capabilities. If you only wanted it for presentation you could make it view only by changing the mode to ZefyrMode.view on the ZefyrEditor constructor.
Edit:
Another more lightweight solution is to use flutter_markdown. It also supports images, lists and so on and doesn't require the special delta format that Zefyr does when storing your strings of text.

How to add text outline in unity

How can i add text outline in unity over a text UI object?
I want to do it in the designer/editor view. i cant see to find any useful topic and i also cant see how to add it from the designer view.
My project is 2d and i'm using the latest unity version 5.3. I want to achieve similar effect.
Or. Alternatively to Joe's answer. To simply add a outline effect to a normal .ttf font :
Click on the text object from the Hierarchy
Click the Add Component button in the inspector
Type "outline" in the search bar.
Add the outline component.
Note! This explains how to make custom type ("sprite sheet type") in Unity.
Before reading it, check Uri's & Programmer's answer which explains using the handy new "outline" feature in .UI ! It may well be enough!
Unity does not have any fancy type handling at all.
You can drop in "normal" .ttf fonts,
or, you can drop in "image fonts", called custom fonts by Unity, where you literally make each letter on a sprite sheet.
A font sprite sheet looks something like this:
Here's exactly how to do it ...
(1) you have to use GlyphDesigner (or any similar product) to actually make your custom font sheet. Find the product you like for your Mac or PC to do this.
(2) There is a critical trick.
Unity completely forgot to include a type matcher for custom fonts. (They may fix this in Unity 6.) It's one of the stupidest things in Unity. So, fortunately there is a free and perfect script
BitmapFontImporter.cs
https://github.com/BenoitFreslon/BitmapFontImporter
There's a full and long tutorial link at that page.
You have to include that to make custom fonts work. It's just one of those weird things about Unity.
So in short, firstly you have to literally "draw" such custom fonts, letter by letter. In fact you need to use something like GlyphDesigner to do that.
Secondly in Unity you have to use the extremely handy script mentioned above or it won't work. Enjoy!
http://answers.unity3d.com/answers/1105527/view.html
TextMesh Pro from the Asset Store does the job and it can be imported for free.
This gives plenty of possibilities fort texts, including how thick the outline should be.

Unity: How to use TextMesh to display Emojis

I am making a 3D environment in Unity which is designed to retrieve Tweets and display them using Unity's TextMesh. The problem arises when a tweet includes an emoji (emoticons such as 😀 and 😉, which should appear as smiley faces in your browser).
When a tweet includes one of these characters, unity renders them as either a "?" symbol, or the following symbol in the editor:
...and like this when using a TextMesh:
What Do I Want?
All I need is to represent any smiley/emoticon as character in the TextMesh, using a TTF font. I don't need to show a full colour image (like your browser/phone does) of the emoji. I realise that there are some extensions in the Unity store which allow you to do that - TextMesh Pro for example. If there's an easy way of doing this though, it would be better than plain characters.
I am specifically looking to do this using TextMesh, not in any of the new GUI system components.
Things I've Tried
You'd have thought that by downloading a font which contains characters for all of the emoticons you can imagine with their correct encoding, and using this as the font for the TextMesh would solve the problem. This was unfortunately not the case when I tried using Symbola (http://users.teilar.gr/~g1951d/). This, along with some other fonts rendered the "?" symbol despite having characters for the emoticons being used.

iPhone / iPad: Font issue for non-Latin languages

I have a problem about the font in iphone/ipad
Everyone knows UILabel can't do rich text.
So I choose FrontLabel http://github.com/zynga/FontLabel/blob/master/README
I guess what FrontLabel is doing is something like NSAttributedString and core text framework, and also, it is quite low level. But anyway, I have a problem.
If I want to display a mixed language text, let's say English + Chinese, and give the whole string a font of "ArialMT", then all Chinese characters are displayed like small squares.
I have tried, if I assign "STHeitiTC-Light" font to the text, no problem, both Chinese and English can be displayed, because STHeitiTC-Light is a Chinese font in iphone/ipad.
I think FrontLabel can't automatically select best font for non-latin text if the given font does not apply.
If I use UILabel and assign it as "ArialMT", and let it display text of Chinese or Japanese, NO problem, right? I guess apple is detecting font for different language?
Please give me some clues how can I solve this problem if I want to use FrontLabel?
Thanks
author of FontLabel here.
You're right, FontLabel does not do automatic font fallback if the glyph cannot be found in the selected font. Implementing such a behavior was outside the scope of the project, as it can be quite complex. UILabel does perform this, as it uses WebKit to do the actual text rendering and WebKit supports font fallback. I am unsure if CoreText provides this or if it behaves like FontLabel. In any case, if you need multiple fonts in FontLabel, you can specify different fonts for different ranges of your ZAttributedString. Unfortunately there's no easy way to determine which ranges are necessary without inspecting your string directly. If you know you're only working with English and Chinese, you could iterate over the characters in your string to determine if they're likely to be english or chinese characters, and use that to determine which ranges to assign fonts to. The alternative would be to teach FontLabel how to perform font fallback, but as I said before, that's quite complicated.
Alternatively, if you're comfortable require 4.0 or above on iPhone, you can try using CoreText. As I said before, I'm unsure if it does font fallback, but it's worth investigating.