Skip to content

Commit 55a2d47

Browse files
committed
Fixed incorrect preferred height and alignment
1 parent 1d29352 commit 55a2d47

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Assets/BitmapFontImporter/Editor/BFImporter.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,10 @@ public static void DoImportBitmapFont(string fntPatn)
5959

6060
SerializedObject so = new SerializedObject(font);
6161
so.Update();
62-
so.FindProperty("m_FontSize").floatValue = parse.fontSize;
62+
so.FindProperty("m_FontSize").floatValue = Mathf.Abs(parse.fontSize);
6363
so.FindProperty("m_LineSpacing").floatValue = parse.lineHeight;
64+
so.FindProperty("m_Descent").floatValue = parse.lineBaseHeight - parse.lineHeight;
65+
so.FindProperty("m_Ascent").floatValue = parse.lineBaseHeight;
6466
UpdateKernings(so, parse.kernings);
6567
so.ApplyModifiedProperties();
6668
so.SetIsDifferentCacheDirty();

Assets/BitmapFontImporter/Editor/FntParse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ private CharacterInfo CreateCharInfo(int id, int x, int y, int w, int h, int xo,
286286

287287
Rect vert = new Rect();
288288
vert.x = xo;
289-
vert.y = yo;
289+
vert.y = yo - lineBaseHeight;
290290
vert.width = w;
291291
vert.height = h;
292292
vert.y = -vert.y;

0 commit comments

Comments
 (0)