当前位置:网站首页>Get the width of text component content
Get the width of text component content
2022-06-29 15:05:00 【Sunshine in front of heart】
Text The component already has text content
// The required length of a line of text
Debug.Log(text.preferredWidth);// According to the text Recommended preferred width
Text Component has no text content Get width in advance
int CalucalateTextContenWidth(Font font, string content, int fontSize, FontStyle fontStyle)
{
font.RequestCharactersInTexture(content, fontSize, fontStyle);
int width = 0;
CharacterInfo characterInfo;
// Read the information of each character
for (int i = 0; i < content.Length; i++)
{
font.GetCharacterInfo(content[i], out characterInfo, fontSize, fontStyle);
width += characterInfo.advance;
}
return width;
}
边栏推荐
- PyTorch 二维多通道卷积运算方式
- 材质 动态自发光
- kubernetes Unable to connect to the server: x509: certificate has expired or is not yet valid
- Opengauss community establishes sig knowledgegraph
- 中国软冰淇淋市场预测与投资前景研究报告(2022版)
- Lumiprobe 活性染料丨杂染料:BDP FL 神经酰胺
- Const usage
- If I am in Foshan, where can I open an account? Is it safe to open an account online?
- 捷氢科技冲刺科创板:拟募资10.6亿 上汽集团是大股东
- Lumiprobe 脱氧核糖核酸丨磷酸盐 CPG 1000 固体载体
猜你喜欢

Is 100W data table faster than 1000W data table query in MySQL?

Alibaba cloud experience Award: use polardb-x and Flink to build a large real-time data screen

synchronized 与多线程的哪些关系

Yi Ming ang Ke rushed to Hong Kong shares: loss of 730million in the year Lilly and sunshine life insurance were shareholders

June 27 talk SofiE

MCS:多元随机变量——多项式分布

Lumiprobe 脱氧核糖核酸丨磷酸盐 CPG 1000 固体载体

Redis installation in windows and Linux Environment

The 5th China software open source innovation competition | opengauss track live training

Weigao blood purification sprint to Hong Kong: annual revenue of RMB 2.9 billion, net profit decreased by 12.7%
随机推荐
信息学奥赛一本通2062:电影票
三角函数对应在平面坐标上画圆
【Try to Hack】vulnhub DC2
Chinese garbled code output from idea output station
卫星运动的微分方程
中国三氧化二砷行业研究与未来预测报告(2022版)
Informatics Olympiad 1001:hello, world!
信息学奥赛一本通2061:梯形面积
mysql 备份与还原
Intelligent diagnosis of Alzheimer's disease
How does a two character name become a three character name with spaces
两个字的名字如何变成有空格的3个字符的名字
Is Guangzhou futures regular? If someone asks you to log in with your own mobile phone and help open an account, is it safe?
威高血液净化冲刺香港:年营收29亿 净利降12.7%
我想在数仓的几百个节点里面 查找一个都有哪些sql里面用到了某张表 能查吗
Alibaba cloud experience Award: use polardb-x and Flink to build a large real-time data screen
Chapter 6 picture operation of canvas
Digital IC code -- traffic lights
PyTorch 二维多通道卷积运算方式
Chapter 9 of canvas: gradients and shadows