From 326ebe083338e53e261a513418a418413a63bd2f Mon Sep 17 00:00:00 2001 From: Ian C Date: Sat, 21 May 2005 02:54:04 +0000 Subject: Improved font import slightly. Fixed non-clearing of changed flags when saving. --- BitmapChar.cs | 4 ++++ MainForm.cs | 19 +++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/BitmapChar.cs b/BitmapChar.cs index 3033fee..649c135 100644 --- a/BitmapChar.cs +++ b/BitmapChar.cs @@ -287,6 +287,8 @@ namespace BitmapFontEd stream.WriteByte(m_data[x,y].A); } } + + m_changed=false; } public static BitmapChar Input(Stream stream) @@ -416,6 +418,8 @@ namespace BitmapFontEd { c.Output(stream); } + + m_changed=false; } public static BitmapCharList Input(Stream stream) diff --git a/MainForm.cs b/MainForm.cs index fa13599..00d7514 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -939,7 +939,7 @@ namespace BitmapFontEd } } - private void GrabChar(Bitmap bmp, BitmapChar c) + private void GrabChar(Bitmap bmp, BitmapChar c, ref int max_height) { int x,y; int mx,my; @@ -960,10 +960,10 @@ namespace BitmapFontEd if (mx==Int32.MinValue) return; - System.Diagnostics.Debug.WriteLine("(pre)mx="+mx+" my="+my); - mx=Math.Min(mx+1,GfxEditor.MAX_SIZE); - my=Math.Min(my+1,GfxEditor.MAX_SIZE); - System.Diagnostics.Debug.WriteLine("(post)mx="+mx+" my="+my); + mx=Math.Min(mx+2,GfxEditor.MAX_SIZE); + my=Math.Min(my+2,GfxEditor.MAX_SIZE); + + max_height=Math.Max(max_height,my); c.Resize(mx,my); @@ -986,6 +986,8 @@ namespace BitmapFontEd { try { + int max_height=Int32.MinValue; + Bitmap bmp=new Bitmap(GfxEditor.MAX_SIZE, GfxEditor.MAX_SIZE, PixelFormat.Format32bppArgb); @@ -1000,10 +1002,15 @@ namespace BitmapFontEd g.Clear(Color.Transparent); g.DrawString(s,fdlg.Font,b,0,0); g.Flush(FlushIntention.Sync); - GrabChar(bmp,m_chars[ascii-32]); + GrabChar(bmp,m_chars[ascii-32],ref max_height); } } + foreach (BitmapChar c in m_chars) + { + c.Resize(c.Width,max_height); + } + m_edit.BitmapChar=new BitmapChar(m_chars[m_selected]); } catch (Exception ex) -- cgit v1.2.3