[转]Untiy的阿拉伯文本适配

Unity Text的文本是左往右读,阿拉伯文的文本是右往左读。在复制粘贴之后,可能文本顺序会发生改变。并且通过不Text组件的自动换行的时候会造成换行位置的不正确。在做阿拉伯UI时候需要引入插件处理

Unity商店里面有两个关于阿拉伯语言适配的免费插件:

Arabic Support for Unity
Arabic lines support


Arabic Support for Unity

This plugin allows you to use accurate and correct Arabic text in your game or 3D application. Supports Tashkeel and Hindu numbers. Supports multiple lines. Very easy with Text Mesh Pro. Supports 4 Persian Characters. The project is open sourced here: https://github.com/Konash/arabic-support-unity

可以用来校验或者修复阿拉伯文本的文字顺序,并返回其正确的语序。

使用时候需要引入命名空间

using ArabicSupport;

可以通过

public static string Fix(string str, bool showTashkeel, bool useHinduNumbers)

来对文本进行校验。校验后的文本将会变成从右外左的阅读顺序的阿拉伯语言文本。


Arabic lines support

what is this ?
a script to help you to show Arabic text in right way
what it do ?
fixes the arrange of lines in Arabic texts
How to Use ?
- you must download and import Arabic Support for Unity from here
- download and import this package
- add textFixer script to you Text UI game object
-write or copy paste your text to enter text field
- run ant it will fix the lines
please take a look into the sample scene to have a better understanding of this script

用来给多行的阿拉伯文进行修正。之前提到过阿拉伯文字是右往左读的语言,如果直接适应Unity的自动换行,因为语序问题。阿拉伯文的文末将会变成最顶部的一行,而首部则会变成文本的后段。

Arabic lines support 是基于Arabic Support for Unity的多段阿拉伯文的修正插件

给文本框加上TextFixer,并且在EnterText输入阿拉伯文本,那在这个组件Start()的时候将会调用其方法进行换行的修正。
在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值