Skip to content

Commit 024fc72

Browse files
committed
TMP字体渲染修正,使用字体资源获取字库纹理的尺寸,避免通过程序创建的资源取到字体纹理尺寸为0导致阴影效果渲染有误的问题。
1 parent 01624a3 commit 024fc72

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Assets/Scripts/Extensions/TextMeshPro/TMPFont.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ void Init()
9999

100100
void OnCreateNewMaterial(Material mat)
101101
{
102-
mat.SetFloat(ShaderUtilities.ID_TextureWidth, mainTexture.width);
103-
mat.SetFloat(ShaderUtilities.ID_TextureHeight, mainTexture.height);
102+
mat.SetFloat(ShaderUtilities.ID_TextureWidth, fontAsset.atlasWidth);
103+
mat.SetFloat(ShaderUtilities.ID_TextureHeight, fontAsset.atlasHeight);
104104
mat.SetFloat(ShaderUtilities.ID_GradientScale, _gradientScale);
105105
mat.SetFloat(ShaderUtilities.ID_WeightNormal, fontAsset.normalStyle);
106106
mat.SetFloat(ShaderUtilities.ID_WeightBold, fontAsset.boldStyle);

Assets/Scripts/Utils/Html/HtmlPageContext.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.Generic;
2+
using TMPro;
23
using UnityEngine;
34

45
namespace FairyGUI.Utils

0 commit comments

Comments
 (0)