By default the height of the sprite is equal to the font ascender and vertically aligned to the baseline. However both vertical alignment and the scale of the sprite can be controlled individually.
I still need to create a custom inspector for the Sprite Assets to make it easier to edit alignment and scale for each sprite contained in the Sprite Asset.
Ooh itâs nice. Makes the graphic designer within cringe like hell but Iâm thinking of cool things like Press (x) to continue or whatever when joypad is used. A most useful quality of developer life feature!
I need to find a nice png with lots of game pad icons.
As I said before, sprites are considered characters by the layout system so they behave as expected.
One piece of the implementation I am uncertain about is the mapping of those characters in terms of the Unicode chart. I am thinking that all sprites should be assigned the same unicode value. So when checking characterInfo[index].character you would be able to known if this character is a sprite.
I would also add textInfo.spriteCount which would allow a user to know how many sprites are used in the text object. A new spriteInfo[index] structure would be added to textInfo. spriteInfo[index].index which would represent which character index this sprite is at in the characterInfo[ ]. spriteInfo[index].vertexIndex would represent the first UIVertex of the sprite geometry so it could be accessed and modified to do stuff to it. Lastly spriteInfo[index].spriteIndex.
Thatâs good stuff. But how about animation for example a gloss sheen? If this is a stretch too far perhaps itâs more sane to let the developer place the sprite there - but give tools to make the space for it and obtain the coordinates for that space for example specifying our own id and width for a sprite in units, then GetSpritePosition(id) to get the xyz coordinate of the precise placement it would goâĻ would help for people who might want animated sprites (unless you have that all worked out).
Embedding this kind of meta data could open up the opportunity to put 3D objects in those spaces where sprites would have been and so on. I wouldnât use this but just thinking out loud.
For me its not essential to animate them, and I would probably skip animating them without the feature (I only have so much hair left). So not essentialâĻ just thoughts.
By using the textInfo and sub set of structures, it is pretty easy to get information about the location of any character or soon sprite used in the text object. For instance, once you have the UIVertex index of the sprite, changing the position to create a jitter effect or changing vertex color or to animate / change the UVs to essentially have them point to a different sprite in the atlas would be simple.
Since the textInfo.characterInfo[index] already includes information about each character such as bottom left, top right, baseline, ascender, descender using this information would make it easy to add a 3d object or collider or track mouseovers.
Back to animating, I guess there are two ways (that I can think of). The first could be to replace <sprite=0> by <sprite=1> in the string which would work but we all dread string manipulations. Alternatively and the method I would prefer would be to animate the UV of the sprite to have them point to other sprites in the atlas. There might be a third but sadly I havenât looked deep enough into sprites and how those would be animated in Unity 4.6 using Raw Image or Image Components for instance.
P.S. Reflecting on this, I would create a small script and track mouse position. I could use the spriteInfo or characterInfo structures to figure out which sprite the mouse is over. I would then look up which UIVertex index this sprite is using in the sprite mesh. Assuming I had a sprite sheet with X frames per sprite, I would cycle through those by changing the UVs. Just like the Vertex Attribute animation examples I posted, this would alter the mesh data after TextMesh Pro has done the layout. This is sort of post processing of the mesh created by TextMesh Pro and thus keeps it static. However, in Unity 4.6, due to how the CanvasRenderer and Canvas system works, it would trigger Unity rebuilding the Canvas.
This is probably a stupid question, but Iâm new to buying Unity assets.
I purchased TextMesh Pro and now I want to register at the Digital Native Studios forum.
It says to enter the following: TextMesh Pro Purchase Invoice Number:
First look at the TextMeshPro SpriteAsset Editor Panel which will be used in conjunction with the new <sprite=xx> tag. Once the SpriteAsset is created, you will be able to adjust the offset values (OX and OY) to position the Sprite relative to the baseline of the text. It will also be possible to adjust scale by changing the SF value.
EDIT - I did find a font Bangla which I used to create the following. I simply copy / pasted the text.
Here are the settings I used to create the font asset. The character range for Bengali is 0980-09FF (2432-2559). I also added the normal ASCII 32-126 in case but this font doesnât seem to include them. This font ttf (design) doesnât seem that great so hopefully there a better Bengali fonts to pick from.
EDIT 2 - Same text using the Microsoft Vrinda Bold font.
Hi,
Thanks for trying it out. But this is the same problem that I have. In bangla there are compound word which is not showing up as you would expect. For example see the first word in your example. It should say âāϰāĻā§āώāĻžâ but it is saying âāϰāĻā§ āώāĻžâ. And that is the problem
This is what it should look like in case your font is not showing up correctly on the browser.
As for font, you can try any as long as you can make it look like the attached image
It is wrong in the unity editor text field which means it is not interpreting the characters / using the correct compound word. Please file a bug report with Unity.
Well, it is not just about unity editor. You can type it properly in c-sharp file in MonoDevelop. But when you retrieve that text dynamically, it gets broken like your own example.
I donât have any experience with Bangla text nor font stuffs but seems like you are looking to have Ligature in TextMeshPro, maybe Stephan B can help you to have a list of ligatures thing and show 2 or more characters as just one glyph