Skip to content

Commit ce307b3

Browse files
committed
[修复]1. 修复TMP的字体出现模糊的问题
1 parent 02b4c75 commit ce307b3

File tree

1 file changed

+32
-10
lines changed

1 file changed

+32
-10
lines changed

Runtime/UI/GTextField.cs

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,32 @@ public GTextField()
3232
_textField.wordWrap = false;
3333
}
3434

35+
public override BlendMode blendMode
36+
{
37+
get
38+
{
39+
if (displayObject != null)
40+
{
41+
return displayObject.blendMode;
42+
}
43+
else
44+
{
45+
#if FAIRYGUI_TMPRO
46+
return BlendMode.One_OneMinusSrcAlpha;
47+
#else
48+
return BlendMode.None;
49+
#endif
50+
}
51+
}
52+
set
53+
{
54+
if (displayObject != null)
55+
{
56+
displayObject.blendMode = value;
57+
}
58+
}
59+
}
60+
3561
override protected void CreateDisplayObject()
3662
{
3763
_textField = new TextField();
@@ -166,9 +192,11 @@ protected string ParseTemplate(string template)
166192
if (!_templateVars.TryGetValue(tag, out value))
167193
value = "";
168194
}
195+
169196
buffer.Append(value);
170197
pos1 = pos2 + 1;
171198
}
199+
172200
if (pos1 < template.Length)
173201
buffer.Append(template, pos1, template.Length - pos1);
174202

@@ -180,10 +208,7 @@ protected string ParseTemplate(string template)
180208
/// </summary>
181209
public TextFormat textFormat
182210
{
183-
get
184-
{
185-
return _textField.textFormat;
186-
}
211+
get { return _textField.textFormat; }
187212
set
188213
{
189214
_textField.textFormat = value;
@@ -197,10 +222,7 @@ public TextFormat textFormat
197222
/// </summary>
198223
public Color color
199224
{
200-
get
201-
{
202-
return _textField.textFormat.color;
203-
}
225+
get { return _textField.textFormat.color; }
204226
set
205227
{
206228
if (_textField.textFormat.color != value)
@@ -362,7 +384,7 @@ override protected void HandleSizeChanged()
362384
{
363385
if (_textField.autoSize == AutoSizeType.Height)
364386
{
365-
displayObject.width = this.width;//先调整宽度,让文本重排
387+
displayObject.width = this.width; //先调整宽度,让文本重排
366388
if (_text != string.Empty) //文本为空时,1是本来就不需要调整, 2是为了防止改掉文本为空时的默认高度,造成关联错误
367389
SetSizeDirectly(this.width, displayObject.height);
368390
}
@@ -435,4 +457,4 @@ override public void Setup_AfterAdd(ByteBuffer buffer, int beginPos)
435457
this.text = str;
436458
}
437459
}
438-
}
460+
}

0 commit comments

Comments
 (0)