From 979ddbfff81b597cb2bc90b9e0614c5e901f60ff Mon Sep 17 00:00:00 2001 From: XcantloadX <3188996979@qq.com> Date: Mon, 16 Nov 2020 11:10:43 +0800 Subject: [PATCH] Improved UI, supported multi-font --- README.md | 10 +- UnitaleFontMaker.suo | Bin 34816 -> 34816 bytes UnitaleFontMaker/Character.cs | 23 +- UnitaleFontMaker/FontPainter.cs | 69 ++- UnitaleFontMaker/FormInput.Designer.cs | 97 ++++ UnitaleFontMaker/FormInput.cs | 49 ++ UnitaleFontMaker/FormInput.resx | 120 +++++ UnitaleFontMaker/MainForm.Designer.cs | 575 +++++++++++++---------- UnitaleFontMaker/MainForm.cs | 212 ++++----- UnitaleFontMaker/UnitaleFontMaker.csproj | 9 + 10 files changed, 772 insertions(+), 392 deletions(-) create mode 100644 UnitaleFontMaker/FormInput.Designer.cs create mode 100644 UnitaleFontMaker/FormInput.cs create mode 100644 UnitaleFontMaker/FormInput.resx diff --git a/README.md b/README.md index d9a4324..e07b2be 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,8 @@ Unitale/CYF 字体制作器 ## 使用说明 How to use ### 制作字体 -1.点击 `Add` 从 txt 文件添加里字符,你可以在 `CharacterTemplate` 里找到常用汉字 -2.选择字体名称(`Font Name`),通常 `uidialog` 为旁白字体,`monster` 为怪物对话框字体,其他自行探索(有时间补充) +1.点击 `Add` 从 txt 文件添加里字符,你可以在 `CharacterTemplate` 文件夹里找到常用汉字 +2.选择字体名称(`Font Name`),通常 `uidialog` 为旁白字体,`monster` 为怪物对话框字体,其他的有时间再补充 3.行间距(`Line Spacing`)一般不需要改 4.点击 `Change Font` 选择一个字体,建议的字体如下 ``` @@ -26,5 +26,7 @@ Zpix 四号 宽 1000 高 1400 行间距 30 ### 安装字体 复制到`[MOD名称]\Sprites\UI\Fonts\`下覆盖即可 -通常来说不建议复制到`Default`目录下,会导致所有 Mod 加载速度变慢(因为默认加载中文字体) -至于在对话中如何使用自定义名称的字体,参考 Unitale/CYF 的文档 \ No newline at end of file +通常来说不建议复制到`Default`目录下,会导致所有 Mod 加载速度变慢(如果你的字体有很多字的话) +至于在对话中如何使用自定义名称的字体,参考 Unitale/CYF 的文档 + +**注意:强烈建议每次更改字体之后重启游戏再测试(特别是 Unitale)!** \ No newline at end of file diff --git a/UnitaleFontMaker.suo b/UnitaleFontMaker.suo index e93d4842172505be309c95a1e8d0bc4458e8578b..442fe2ac180faf3f505cd2c9388e03b870f00085 100644 GIT binary patch delta 2145 zcmbVNZ%k8H6u-B;()S9~RtktvEDW(&?TQFgCKG5yD;>1Jj5^{(z`120U`5ak3W70y zFtjIgizYLhZW*Y^e7d117XKwK^S|4tEn)kx88b8IxD(;U zx^2_1UK;zJM&W=b54Lf3fue(;4s|%o&x1#tlban@4B(IBphNE9=OK|TkscK%K9Z+W z`WYlB4p31%sn{cv(*!m?Y1f09iv_pR$x|fM(nkU14L%MPRfG@&F_oMUT81D|ZuRvj zIf-ZLGe24IhrxPKq zI~lhoC6Aty#;9N7h5C(kZFTkT#y0qAh7tD8ya>9~IQoJYPEKqu5O7)-A92>594!{7 z^~rbxE@j5E<>)H~!l9NbG46CH&o(+uA|`V<#Q@tQ47Vq(L@dsT;=sBhCwe(DYm~4p z%MKT~95Il^Q9;Gd2SqDVLp(1$M7PUItF0AKlD`R@20a`xtK>gc51XpRbLLYD*telY zS4K9GHqu1wq?xpkEyPVsq@HZX4;^*~`%p8*0$Lk&P@LZarcPdbVEHBHc$tmzi8!$g zf%#z&-OHR&yb-ne5e5P)oV*DYO@#2R!K5j7@Uf`tBOCtH!2|^7 zTqVmtmesarM;jeJTIlMwX`-23MA#|G;EJvR(v2Blu1ke+S1+uuX-=84A(1V^L=%gu z;wkL{Z{z!laIC%9Z-SA0EzTM*zE+(=wO^oTb{BVG+lM%h0PV_MO{cIkh!{c~MzED1 zMGPa3Ax02iB90@*5hoBQ5nmy`MvNku$5X`^(H9Xsm^DK z!Scy=p4tk{_}gw>T2_*4Ey$a1$wU9E@#2)@czE()@UD{OJEZ9hKC_k!_1Egsp}pIY z*obD5bYTY{VWMx#e>N&!6RuYx$|%!D~1D*VT?S&!(0iH=sw zf88NV>d@qtgFf%NC;IKbDu)lU)RdMhwNRXrh|w&-P^U(N_RonD`zay44zFkzQqL-SLOJ?Q)d5yNr8%V*atyPwHj|dd z!Orm~o=c`G;ic%`bN6HBPBndy@A&^Qx{O--I;0n#g_a^UEPlTfRBt`>Ez6*b@VUWS zqFE@vfs=j?8lfC)J!e2K*x+JM5!_yqF78^~Av~8dzfmp;ZCRNCcY6&tS5gA)l>%k& z9Xq7(@Kz_-R+u5MbwG1r*h z%d%-fC_I1rLisJ^J_&J_FsJ5t_CB+{W^Q7>#SXjoC~(tY74Ov~Qn2$iVojfxf=g!# zW%9oTO7Cw#Qx^QxOoox(*jTm;Y)OP{X$Joe^Ry;Rl((_UZwOa>=-xS@4%hmSRp<{? Z&g3MPDw42=h}}e+pF&H18tm*}{|`W9oTLB% delta 1317 zcmZvcZA@EL7{||P&t1=j(ot!l2y`t8wTz7xUrJ`8UPk4uO?&HxnL1w>!;JZ|rfFc1 z8M}_kG80pIl$e-o6Js(bvW_ddfoNHXF7d;$+%;JYei80`F=DmwCyU9Q2 z{D04Vo^#LJ&E!p)ys2=(MAzR;1mG8wqhftyW21u*vJ-{y&nXtAP2go)Y{kFkY_X;9 zs2L+l0LED_blTe>$QZ0Km9-#-W$uS!1%ty>-At2E2PU*-hiOeNGg?Go`=7v)I^d zyi;;am}nP_)kJtJGONy^R1@2zU?quwC-EGd%e7jPsiBeKp;5>*1nAe`O+5QQdOv(y zy8^rGR_Tf!9Ryc>#hvn*M8bC}(XGE+r77+S6R*XuaozqRPh6%9UA;llUX^b{<2Jyx zHfEWo=y1kI-5r|JXl7y~HuWI6#9`dmD^U?Q)ox3_? z&=EQWs^0^%L7TL&{`7oQ`!aaZqRs4h#;PS#Tj_jPm~ua6nowecwRE>?=8fp?(Fv6L zRPI4zH$Xa~@+vew1C$~&_8WhHe|+_4+k4kDiElzp51p~V9It)97^QHuw(dVG@1BbF zuxcYS9lIja?dXC!k+Rr13uEyJ6GzdQrZtCV79}2_uiYnCU`Lb*-`calK($>E;}OTx z4E2e<;B9GyLWn^jdp8sl8PgF=Z`lt&^}C>N*OVzM?2DkZJK$jdG;}?70B-JaX-d{b z9p|x#xG~4DozVN>c>H+(88jcF&Z0ij10Q2MhdPHU=xiQa4fP3X0re^BGt>ptMU*JM zgze{|e?GC9LN8Z9+4GgX>xJ!$Yq@b}`=#Yb&Aa(XIj&|iC{GmWAPl5dwBMd`FfDn+ zMz!g-Kg=+*BdHZam#ML_KbVb$gY?L5=<#iX(nwq;796M?b?YjpM^)A)jB&L}qj`Hn z-(u$VC(V=Lnf3#3Csu!Kz=2z!c=&|9OZlSet$`+Iv;R@r`K$E110z21KhSbxOA?%R zh2Z8y6x^z{Ox!`Cu((G4sZ6I#0%*ks{X23dE)KP{h+q!vas', '(', ')', '[', ']', '(', ')', '-', '_', '=', '~', '@', '#', '$', '%', '^', '&', '*', '(', ')', ' ' }; //别忘了空格字符! + public char Char { get { return _char; } @@ -53,6 +54,26 @@ public Character(char character, float x, float y, float width, float height) { } + + /// + /// 检查传入的字符是否是因为字符 + /// + /// 要检查的字符 + /// 结果 + public static bool isEnglishChar(char c) + { + return Array.IndexOf(ENGLISH_CHARS, c) >= 0; + } + + /// + /// 检查传入的字符是否是因为字符 + /// + /// 要检查的字符 + /// 结果 + public static bool isEnglishChar(Character c) + { + return Array.IndexOf(ENGLISH_CHARS, c.Char) >= 0; + } } } diff --git a/UnitaleFontMaker/FontPainter.cs b/UnitaleFontMaker/FontPainter.cs index b93787a..11ac9d6 100644 --- a/UnitaleFontMaker/FontPainter.cs +++ b/UnitaleFontMaker/FontPainter.cs @@ -23,9 +23,22 @@ public class FontPainter private string str; private char[] characters; private StringFormat format; - - public Font font; - + + /// + /// 默认字体 + /// + public Font Font { get; set; } + /// + /// 如果此项不为空,则绘制英文字符时使用此字体 + /// + public Font EnglishFont { get; set; } + /// + /// 默认字体的 Y 坐标 Offset TODO 1 + /// + public float fontYOffset = 0; + + public bool drawDebugBorders = false; + /// /// 字体的颜色 /// @@ -67,7 +80,7 @@ public Size Size public FontPainter(Font font, int width, int height) { - this.font = font; + this.Font = font; brush = new SolidBrush(Color.White); backBrush = new SolidBrush(Color.FromArgb(0, 0, 0, 0)); @@ -101,7 +114,13 @@ public void Paint() int width = (int)chars[i].Width; int height = (int)chars[i].Height; - gImage.DrawString(chars[i].Char.ToString(), font, brush, x, y, format); + Font font = this.Font; + if (!Character.isEnglishChar(chars[i])) //中文字体设置了 offset 的情况 + y += (int)fontYOffset; + + gImage.DrawString(chars[i].Char.ToString(), GetFontByChar(chars[i].Char), brush, x, y, format); + if (drawDebugBorders) + gImage.DrawRectangle(Pens.Red, x, y, width, height); } } @@ -129,25 +148,29 @@ public Character[] GetCharacters() char[] chars = Characters; Character[] characters = new Character[chars.Length]; - float x = 0; + float x = 5; float y = 0; for (int i = 0; i < chars.Length; i++) { //转换前(左上原点) - float width = GetCharWidth(font, chars[i]); - float height = GetCharHeight(font, chars[i]); - - Character c = new Character(chars[i], x, y, width, height); + float width = GetCharWidth(Font, chars[i]); + float height = GetCharHeight(Font, chars[i]); + + Character c = null; + if(!Character.isEnglishChar(chars[i])) //非英文字体的 Offset + c = new Character(chars[i], x, y, width, height + fontYOffset); + else + c = new Character(chars[i], x, y, width, height); characters[i] = c; - x += width + 3; + x += width + 10; - if(x + GetCharWidth(font, chars[i]) + 3 > this.width) + if(x + GetCharWidth(Font, chars[i]) + 10 > this.width) { - x = 0; - y += height; + x = 5; + y += height + 10; } } @@ -165,13 +188,25 @@ public Character[] PositionConvert(Character[] chars) private float GetCharWidth(Font font, char c) { - return gImage.MeasureString(c.ToString(), font, width, format).Width; + return gImage.MeasureString(c.ToString(), GetFontByChar(c), width, format).Width; } private float GetCharHeight(Font font, char c) { - return gImage.MeasureString(c.ToString(), font, width, format).Height; + return gImage.MeasureString(c.ToString(), GetFontByChar(c), width, format).Height; } - + + /// + /// 判断是使用英文字体还是默认字体 + /// + /// 待判断字符 + /// 应该使用的字体 + private Font GetFontByChar(char c) + { + if (EnglishFont != null && Character.isEnglishChar(c)) + return EnglishFont; + else + return Font; + } } } diff --git a/UnitaleFontMaker/FormInput.Designer.cs b/UnitaleFontMaker/FormInput.Designer.cs new file mode 100644 index 0000000..eb31c16 --- /dev/null +++ b/UnitaleFontMaker/FormInput.Designer.cs @@ -0,0 +1,97 @@ +namespace UnitaleFontMaker +{ + partial class FormInput + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.btnOK = new System.Windows.Forms.Button(); + this.btnCancel = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(49, 14); + this.label1.TabIndex = 0; + this.label1.Text = "label1"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(15, 38); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(363, 21); + this.textBox1.TabIndex = 1; + // + // btnOK + // + this.btnOK.Location = new System.Drawing.Point(210, 80); + this.btnOK.Name = "btnOK"; + this.btnOK.Size = new System.Drawing.Size(74, 28); + this.btnOK.TabIndex = 2; + this.btnOK.Text = "OK"; + this.btnOK.UseVisualStyleBackColor = true; + this.btnOK.Click += new System.EventHandler(this.btnOK_Click); + // + // btnCancel + // + this.btnCancel.Location = new System.Drawing.Point(304, 80); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(74, 28); + this.btnCancel.TabIndex = 3; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); + // + // FormInput + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(390, 120); + this.Controls.Add(this.btnCancel); + this.Controls.Add(this.btnOK); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label1); + this.Name = "FormInput"; + this.Text = "InputBox"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Button btnOK; + private System.Windows.Forms.Button btnCancel; + } +} \ No newline at end of file diff --git a/UnitaleFontMaker/FormInput.cs b/UnitaleFontMaker/FormInput.cs new file mode 100644 index 0000000..4855bc9 --- /dev/null +++ b/UnitaleFontMaker/FormInput.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace UnitaleFontMaker +{ + public partial class FormInput : Form + { + public bool done; + public string text; + + public FormInput(string title, string description) + { + InitializeComponent(); + + Text = title; + label1.Text = description; + } + + private void btnOK_Click(object sender, EventArgs e) + { + done = true; + text = textBox1.Text; + } + + private void btnCancel_Click(object sender, EventArgs e) + { + done = true; + text = null; + } + + + } + + public class InputDialog + { + public static string Show(string title, string description) + { + FormInput form = new FormInput(title, description); + while (!form.done) { }; + return form.text; + } + } +} diff --git a/UnitaleFontMaker/FormInput.resx b/UnitaleFontMaker/FormInput.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/UnitaleFontMaker/FormInput.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/UnitaleFontMaker/MainForm.Designer.cs b/UnitaleFontMaker/MainForm.Designer.cs index c7b77ac..b5e2783 100644 --- a/UnitaleFontMaker/MainForm.Designer.cs +++ b/UnitaleFontMaker/MainForm.Designer.cs @@ -6,22 +6,8 @@ partial class MainForm /// Designer variable used to keep track of non-visual components. /// private System.ComponentModel.IContainer components = null; - private System.Windows.Forms.Button btnSaveFile; - private System.Windows.Forms.Button button2; - private System.Windows.Forms.Button btnPreview; - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Button btnAddChar; - private System.Windows.Forms.TextBox txtboxY; - private System.Windows.Forms.TextBox txtboxX; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label labCharNum; - private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.Button btnOpenMod; - private System.Windows.Forms.TextBox txtboxModPath; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Button btnSave; + private System.Windows.Forms.Button btnPreviewImage; /// /// Disposes resources used by the form. @@ -44,219 +30,315 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.btnSaveFile = new System.Windows.Forms.Button(); - this.button2 = new System.Windows.Forms.Button(); - this.btnPreview = new System.Windows.Forms.Button(); - this.panel1 = new System.Windows.Forms.Panel(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.btnScan = new System.Windows.Forms.Button(); - this.btnOpenMod = new System.Windows.Forms.Button(); - this.txtboxModPath = new System.Windows.Forms.TextBox(); - this.label5 = new System.Windows.Forms.Label(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.btnSave = new System.Windows.Forms.Button(); + this.btnPreviewImage = new System.Windows.Forms.Button(); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.btnChangeEnglishFont = new System.Windows.Forms.Button(); + this.lblEnglishFontPreview = new System.Windows.Forms.Label(); + this.lblNormalFontPreview = new System.Windows.Forms.Label(); + this.lblEnglishFontInfo = new System.Windows.Forms.Label(); + this.lblNormalFontInfo = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.btnChangeNomalFont = new System.Windows.Forms.Button(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.btnClear = new System.Windows.Forms.Button(); + this.labCharNum = new System.Windows.Forms.Label(); + this.btnAddChar = new System.Windows.Forms.Button(); + this.tabPage3 = new System.Windows.Forms.TabPage(); + this.checkBoxDrawBorder = new System.Windows.Forms.CheckBox(); + this.label4 = new System.Windows.Forms.Label(); + this.textBoxFontYOffset = new System.Windows.Forms.TextBox(); this.txtboxLineSpacing = new System.Windows.Forms.TextBox(); this.label7 = new System.Windows.Forms.Label(); this.picboxColor = new System.Windows.Forms.PictureBox(); this.btnChooseColor = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); - this.btnClear = new System.Windows.Forms.Button(); this.comboxType = new System.Windows.Forms.ComboBox(); this.label6 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); - this.labCharNum = new System.Windows.Forms.Label(); this.txtboxX = new System.Windows.Forms.TextBox(); - this.label4 = new System.Windows.Forms.Label(); this.txtboxY = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.btnAddChar = new System.Windows.Forms.Button(); - this.panel1.SuspendLayout(); - this.groupBox2.SuspendLayout(); - this.groupBox1.SuspendLayout(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.tabPage2.SuspendLayout(); + this.tabPage3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.picboxColor)).BeginInit(); this.SuspendLayout(); // - // btnSaveFile - // - this.btnSaveFile.Location = new System.Drawing.Point(15, 303); - this.btnSaveFile.Margin = new System.Windows.Forms.Padding(2); - this.btnSaveFile.Name = "btnSaveFile"; - this.btnSaveFile.Size = new System.Drawing.Size(113, 33); - this.btnSaveFile.TabIndex = 2; - this.btnSaveFile.Text = "Save"; - this.btnSaveFile.UseVisualStyleBackColor = true; - this.btnSaveFile.Click += new System.EventHandler(this.BtnSaveFileClick); - // - // button2 - // - this.button2.Location = new System.Drawing.Point(135, 303); - this.button2.Margin = new System.Windows.Forms.Padding(2); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(110, 34); - this.button2.TabIndex = 3; - this.button2.Text = "Change Font"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.Button2Click); - // - // btnPreview - // - this.btnPreview.Location = new System.Drawing.Point(252, 303); - this.btnPreview.Margin = new System.Windows.Forms.Padding(2); - this.btnPreview.Name = "btnPreview"; - this.btnPreview.Size = new System.Drawing.Size(117, 33); - this.btnPreview.TabIndex = 4; - this.btnPreview.Text = "Preview"; - this.btnPreview.UseVisualStyleBackColor = true; - this.btnPreview.Click += new System.EventHandler(this.BtnPreviewClick); - // - // panel1 - // - this.panel1.Controls.Add(this.groupBox2); - this.panel1.Controls.Add(this.groupBox1); - this.panel1.Location = new System.Drawing.Point(4, 6); - this.panel1.Margin = new System.Windows.Forms.Padding(2); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(370, 287); - this.panel1.TabIndex = 10; - // - // groupBox2 - // - this.groupBox2.Controls.Add(this.btnScan); - this.groupBox2.Controls.Add(this.btnOpenMod); - this.groupBox2.Controls.Add(this.txtboxModPath); - this.groupBox2.Controls.Add(this.label5); - this.groupBox2.Location = new System.Drawing.Point(5, 174); - this.groupBox2.Margin = new System.Windows.Forms.Padding(2); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Padding = new System.Windows.Forms.Padding(2); - this.groupBox2.Size = new System.Drawing.Size(365, 80); - this.groupBox2.TabIndex = 12; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "Mod Settings"; - // - // btnScan - // - this.btnScan.Location = new System.Drawing.Point(4, 39); - this.btnScan.Margin = new System.Windows.Forms.Padding(2); - this.btnScan.Name = "btnScan"; - this.btnScan.Size = new System.Drawing.Size(74, 25); - this.btnScan.TabIndex = 9; - this.btnScan.Text = "Auto Scan"; - this.btnScan.UseVisualStyleBackColor = true; - this.btnScan.Click += new System.EventHandler(this.BtnScanClick); - // - // btnOpenMod - // - this.btnOpenMod.Location = new System.Drawing.Point(330, 18); - this.btnOpenMod.Margin = new System.Windows.Forms.Padding(2); - this.btnOpenMod.Name = "btnOpenMod"; - this.btnOpenMod.Size = new System.Drawing.Size(32, 19); - this.btnOpenMod.TabIndex = 5; - this.btnOpenMod.Text = "..."; - this.btnOpenMod.UseVisualStyleBackColor = true; - this.btnOpenMod.Click += new System.EventHandler(this.BtnOpenModClick); - // - // txtboxModPath - // - this.txtboxModPath.Location = new System.Drawing.Point(64, 17); - this.txtboxModPath.Margin = new System.Windows.Forms.Padding(2); - this.txtboxModPath.Name = "txtboxModPath"; - this.txtboxModPath.Size = new System.Drawing.Size(263, 21); - this.txtboxModPath.TabIndex = 4; - // - // label5 - // - this.label5.Location = new System.Drawing.Point(4, 19); - this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(56, 18); - this.label5.TabIndex = 3; - this.label5.Text = "Mod Path"; - // - // groupBox1 - // - this.groupBox1.Controls.Add(this.txtboxLineSpacing); - this.groupBox1.Controls.Add(this.label7); - this.groupBox1.Controls.Add(this.picboxColor); - this.groupBox1.Controls.Add(this.btnChooseColor); - this.groupBox1.Controls.Add(this.label2); - this.groupBox1.Controls.Add(this.btnClear); - this.groupBox1.Controls.Add(this.comboxType); - this.groupBox1.Controls.Add(this.label6); - this.groupBox1.Controls.Add(this.label1); - this.groupBox1.Controls.Add(this.labCharNum); - this.groupBox1.Controls.Add(this.txtboxX); - this.groupBox1.Controls.Add(this.label4); - this.groupBox1.Controls.Add(this.txtboxY); - this.groupBox1.Controls.Add(this.label3); - this.groupBox1.Controls.Add(this.btnAddChar); - this.groupBox1.Location = new System.Drawing.Point(2, 5); - this.groupBox1.Margin = new System.Windows.Forms.Padding(2); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Padding = new System.Windows.Forms.Padding(2); - this.groupBox1.Size = new System.Drawing.Size(368, 162); - this.groupBox1.TabIndex = 10; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Font Settings"; + // btnSave + // + this.btnSave.Location = new System.Drawing.Point(11, 422); + this.btnSave.Margin = new System.Windows.Forms.Padding(2); + this.btnSave.Name = "btnSave"; + this.btnSave.Size = new System.Drawing.Size(113, 33); + this.btnSave.TabIndex = 2; + this.btnSave.Text = "Save"; + this.btnSave.UseVisualStyleBackColor = true; + this.btnSave.Click += new System.EventHandler(this.BtnSaveFileClick); + // + // btnPreviewImage + // + this.btnPreviewImage.Location = new System.Drawing.Point(141, 422); + this.btnPreviewImage.Margin = new System.Windows.Forms.Padding(2); + this.btnPreviewImage.Name = "btnPreviewImage"; + this.btnPreviewImage.Size = new System.Drawing.Size(117, 33); + this.btnPreviewImage.TabIndex = 4; + this.btnPreviewImage.Text = "Image Preview"; + this.btnPreviewImage.UseVisualStyleBackColor = true; + this.btnPreviewImage.Click += new System.EventHandler(this.BtnPreviewClick); + // + // tabControl1 + // + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Controls.Add(this.tabPage3); + this.tabControl1.Location = new System.Drawing.Point(0, 1); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(705, 416); + this.tabControl1.TabIndex = 11; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.btnChangeEnglishFont); + this.tabPage1.Controls.Add(this.lblEnglishFontPreview); + this.tabPage1.Controls.Add(this.lblNormalFontPreview); + this.tabPage1.Controls.Add(this.lblEnglishFontInfo); + this.tabPage1.Controls.Add(this.lblNormalFontInfo); + this.tabPage1.Controls.Add(this.label9); + this.tabPage1.Controls.Add(this.label8); + this.tabPage1.Controls.Add(this.btnChangeNomalFont); + this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(697, 390); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "Font Settings"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // btnChangeEnglishFont + // + this.btnChangeEnglishFont.Location = new System.Drawing.Point(41, 269); + this.btnChangeEnglishFont.Margin = new System.Windows.Forms.Padding(2); + this.btnChangeEnglishFont.Name = "btnChangeEnglishFont"; + this.btnChangeEnglishFont.Size = new System.Drawing.Size(90, 33); + this.btnChangeEnglishFont.TabIndex = 35; + this.btnChangeEnglishFont.Text = "Change"; + this.btnChangeEnglishFont.UseVisualStyleBackColor = true; + this.btnChangeEnglishFont.Click += new System.EventHandler(this.btnChangeEnglishFont_Click); + // + // lblEnglishFontPreview + // + this.lblEnglishFontPreview.AutoSize = true; + this.lblEnglishFontPreview.Location = new System.Drawing.Point(39, 224); + this.lblEnglishFontPreview.Name = "lblEnglishFontPreview"; + this.lblEnglishFontPreview.Size = new System.Drawing.Size(269, 12); + this.lblEnglishFontPreview.TabIndex = 34; + this.lblEnglishFontPreview.Text = "The quick brown fox jumps over the lazy dog."; + // + // lblNormalFontPreview + // + this.lblNormalFontPreview.AutoSize = true; + this.lblNormalFontPreview.Location = new System.Drawing.Point(39, 70); + this.lblNormalFontPreview.Name = "lblNormalFontPreview"; + this.lblNormalFontPreview.Size = new System.Drawing.Size(269, 12); + this.lblNormalFontPreview.TabIndex = 33; + this.lblNormalFontPreview.Text = "The quick brown fox jumps over the lazy dog."; + // + // lblEnglishFontInfo + // + this.lblEnglishFontInfo.AutoSize = true; + this.lblEnglishFontInfo.Location = new System.Drawing.Point(39, 190); + this.lblEnglishFontInfo.Name = "lblEnglishFontInfo"; + this.lblEnglishFontInfo.Size = new System.Drawing.Size(35, 12); + this.lblEnglishFontInfo.TabIndex = 32; + this.lblEnglishFontInfo.Text = "Empty"; + // + // lblNormalFontInfo + // + this.lblNormalFontInfo.AutoSize = true; + this.lblNormalFontInfo.Location = new System.Drawing.Point(39, 38); + this.lblNormalFontInfo.Name = "lblNormalFontInfo"; + this.lblNormalFontInfo.Size = new System.Drawing.Size(35, 12); + this.lblNormalFontInfo.TabIndex = 31; + this.lblNormalFontInfo.Text = "Empty"; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label9.Location = new System.Drawing.Point(17, 169); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(215, 16); + this.label9.TabIndex = 30; + this.label9.Text = "English Font (Optional)"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label8.Location = new System.Drawing.Point(16, 12); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(107, 16); + this.label8.TabIndex = 29; + this.label8.Text = "Normal Font"; + // + // btnChangeNomalFont + // + this.btnChangeNomalFont.Location = new System.Drawing.Point(41, 112); + this.btnChangeNomalFont.Margin = new System.Windows.Forms.Padding(2); + this.btnChangeNomalFont.Name = "btnChangeNomalFont"; + this.btnChangeNomalFont.Size = new System.Drawing.Size(90, 33); + this.btnChangeNomalFont.TabIndex = 28; + this.btnChangeNomalFont.Text = "Change"; + this.btnChangeNomalFont.UseVisualStyleBackColor = true; + this.btnChangeNomalFont.Click += new System.EventHandler(this.btnChangeNomalFont_Click); + // + // tabPage2 + // + this.tabPage2.Controls.Add(this.btnClear); + this.tabPage2.Controls.Add(this.labCharNum); + this.tabPage2.Controls.Add(this.btnAddChar); + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(697, 390); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "Character Settings"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // btnClear + // + this.btnClear.Location = new System.Drawing.Point(97, 43); + this.btnClear.Margin = new System.Windows.Forms.Padding(2); + this.btnClear.Name = "btnClear"; + this.btnClear.Size = new System.Drawing.Size(54, 35); + this.btnClear.TabIndex = 13; + this.btnClear.Text = "Clear"; + this.btnClear.UseVisualStyleBackColor = true; + this.btnClear.Click += new System.EventHandler(this.btnClear_Click); + // + // labCharNum + // + this.labCharNum.Location = new System.Drawing.Point(28, 16); + this.labCharNum.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.labCharNum.Name = "labCharNum"; + this.labCharNum.Size = new System.Drawing.Size(252, 14); + this.labCharNum.TabIndex = 12; + this.labCharNum.Text = "No characters, please add from text file."; + // + // btnAddChar + // + this.btnAddChar.Location = new System.Drawing.Point(30, 43); + this.btnAddChar.Margin = new System.Windows.Forms.Padding(2); + this.btnAddChar.Name = "btnAddChar"; + this.btnAddChar.Size = new System.Drawing.Size(54, 35); + this.btnAddChar.TabIndex = 11; + this.btnAddChar.Text = "Add"; + this.btnAddChar.UseVisualStyleBackColor = true; + this.btnAddChar.Click += new System.EventHandler(this.btnAddChar_Click); + // + // tabPage3 + // + this.tabPage3.Controls.Add(this.checkBoxDrawBorder); + this.tabPage3.Controls.Add(this.label4); + this.tabPage3.Controls.Add(this.textBoxFontYOffset); + this.tabPage3.Controls.Add(this.txtboxLineSpacing); + this.tabPage3.Controls.Add(this.label7); + this.tabPage3.Controls.Add(this.picboxColor); + this.tabPage3.Controls.Add(this.btnChooseColor); + this.tabPage3.Controls.Add(this.label2); + this.tabPage3.Controls.Add(this.comboxType); + this.tabPage3.Controls.Add(this.label6); + this.tabPage3.Controls.Add(this.label3); + this.tabPage3.Controls.Add(this.label1); + this.tabPage3.Controls.Add(this.txtboxX); + this.tabPage3.Controls.Add(this.txtboxY); + this.tabPage3.Location = new System.Drawing.Point(4, 22); + this.tabPage3.Name = "tabPage3"; + this.tabPage3.Size = new System.Drawing.Size(697, 390); + this.tabPage3.TabIndex = 2; + this.tabPage3.Text = "Export Settings"; + this.tabPage3.UseVisualStyleBackColor = true; + // + // checkBoxDrawBorder + // + this.checkBoxDrawBorder.AutoSize = true; + this.checkBoxDrawBorder.Location = new System.Drawing.Point(18, 145); + this.checkBoxDrawBorder.Name = "checkBoxDrawBorder"; + this.checkBoxDrawBorder.Size = new System.Drawing.Size(126, 16); + this.checkBoxDrawBorder.TabIndex = 26; + this.checkBoxDrawBorder.Text = "Draw Debug Border"; + this.checkBoxDrawBorder.UseVisualStyleBackColor = true; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(16, 117); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(83, 12); + this.label4.TabIndex = 25; + this.label4.Text = "Font Y Offset"; + // + // textBoxFontYOffset + // + this.textBoxFontYOffset.Location = new System.Drawing.Point(111, 114); + this.textBoxFontYOffset.Name = "textBoxFontYOffset"; + this.textBoxFontYOffset.Size = new System.Drawing.Size(100, 21); + this.textBoxFontYOffset.TabIndex = 24; + this.textBoxFontYOffset.Text = "0"; // // txtboxLineSpacing // - this.txtboxLineSpacing.Location = new System.Drawing.Point(89, 137); + this.txtboxLineSpacing.Location = new System.Drawing.Point(111, 88); this.txtboxLineSpacing.Margin = new System.Windows.Forms.Padding(2); this.txtboxLineSpacing.Name = "txtboxLineSpacing"; - this.txtboxLineSpacing.Size = new System.Drawing.Size(22, 21); - this.txtboxLineSpacing.TabIndex = 16; + this.txtboxLineSpacing.Size = new System.Drawing.Size(38, 21); + this.txtboxLineSpacing.TabIndex = 23; this.txtboxLineSpacing.Text = "30"; // // label7 // this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(8, 139); + this.label7.Location = new System.Drawing.Point(16, 91); this.label7.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(77, 12); - this.label7.TabIndex = 15; - this.label7.Text = "Line spacing"; + this.label7.TabIndex = 22; + this.label7.Text = "Line Spacing"; // // picboxColor // - this.picboxColor.Location = new System.Drawing.Point(77, 110); + this.picboxColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.picboxColor.Location = new System.Drawing.Point(111, 62); this.picboxColor.Margin = new System.Windows.Forms.Padding(2); this.picboxColor.Name = "picboxColor"; this.picboxColor.Size = new System.Drawing.Size(22, 20); - this.picboxColor.TabIndex = 14; + this.picboxColor.TabIndex = 21; this.picboxColor.TabStop = false; // // btnChooseColor // - this.btnChooseColor.Location = new System.Drawing.Point(104, 110); + this.btnChooseColor.Location = new System.Drawing.Point(137, 63); this.btnChooseColor.Margin = new System.Windows.Forms.Padding(2); this.btnChooseColor.Name = "btnChooseColor"; this.btnChooseColor.Size = new System.Drawing.Size(56, 18); - this.btnChooseColor.TabIndex = 13; + this.btnChooseColor.TabIndex = 20; this.btnChooseColor.Text = "Choose"; this.btnChooseColor.UseVisualStyleBackColor = true; - this.btnChooseColor.Click += new System.EventHandler(this.btnChooseColor_Click); // // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(8, 114); + this.label2.Location = new System.Drawing.Point(16, 66); this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(65, 12); - this.label2.TabIndex = 12; - this.label2.Text = "Font color"; - // - // btnClear - // - this.btnClear.Location = new System.Drawing.Point(49, 62); - this.btnClear.Margin = new System.Windows.Forms.Padding(2); - this.btnClear.Name = "btnClear"; - this.btnClear.Size = new System.Drawing.Size(48, 18); - this.btnClear.TabIndex = 10; - this.btnClear.Text = "Clear"; - this.btnClear.UseVisualStyleBackColor = true; - this.btnClear.Click += new System.EventHandler(this.btnClear_Click); + this.label2.TabIndex = 19; + this.label2.Text = "Font Color"; // // comboxType // @@ -264,119 +346,110 @@ private void InitializeComponent() this.comboxType.Items.AddRange(new object[] { "uidialog", "monster"}); - this.comboxType.Location = new System.Drawing.Point(76, 86); + this.comboxType.Location = new System.Drawing.Point(111, 38); this.comboxType.Margin = new System.Windows.Forms.Padding(2); this.comboxType.Name = "comboxType"; this.comboxType.Size = new System.Drawing.Size(152, 20); - this.comboxType.TabIndex = 9; + this.comboxType.TabIndex = 18; + this.comboxType.Text = "uidialog"; // // label6 // this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(8, 88); + this.label6.Location = new System.Drawing.Point(16, 40); this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(59, 12); - this.label6.TabIndex = 8; - this.label6.Text = "Font name"; + this.label6.TabIndex = 17; + this.label6.Text = "Font Name"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(153, 15); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(11, 12); + this.label3.TabIndex = 10; + this.label3.Text = "x"; // // label1 // - this.label1.Location = new System.Drawing.Point(4, 17); + this.label1.Location = new System.Drawing.Point(16, 14); this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(78, 17); - this.label1.TabIndex = 0; - this.label1.Text = "Image size"; - // - // labCharNum - // - this.labCharNum.Location = new System.Drawing.Point(8, 46); - this.labCharNum.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); - this.labCharNum.Name = "labCharNum"; - this.labCharNum.Size = new System.Drawing.Size(252, 14); - this.labCharNum.TabIndex = 7; - this.labCharNum.Text = "No characters, please add from text file."; + this.label1.TabIndex = 7; + this.label1.Text = "Image Size"; // // txtboxX // - this.txtboxX.Location = new System.Drawing.Point(122, 14); + this.txtboxX.Location = new System.Drawing.Point(111, 11); this.txtboxX.Margin = new System.Windows.Forms.Padding(2); this.txtboxX.Name = "txtboxX"; this.txtboxX.Size = new System.Drawing.Size(38, 21); - this.txtboxX.TabIndex = 1; - this.txtboxX.Text = "1000"; - // - // label4 - // - this.label4.Location = new System.Drawing.Point(166, 17); - this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(45, 18); - this.label4.TabIndex = 6; - this.label4.Text = "Height"; + this.txtboxX.TabIndex = 8; + this.txtboxX.Text = "2000"; // // txtboxY // - this.txtboxY.Location = new System.Drawing.Point(213, 14); + this.txtboxY.Location = new System.Drawing.Point(166, 12); this.txtboxY.Margin = new System.Windows.Forms.Padding(2); this.txtboxY.Name = "txtboxY"; this.txtboxY.Size = new System.Drawing.Size(37, 21); - this.txtboxY.TabIndex = 2; - this.txtboxY.Text = "1400"; - // - // label3 - // - this.label3.Location = new System.Drawing.Point(80, 17); - this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(38, 18); - this.label3.TabIndex = 5; - this.label3.Text = "Width"; - // - // btnAddChar - // - this.btnAddChar.Location = new System.Drawing.Point(7, 62); - this.btnAddChar.Margin = new System.Windows.Forms.Padding(2); - this.btnAddChar.Name = "btnAddChar"; - this.btnAddChar.Size = new System.Drawing.Size(38, 18); - this.btnAddChar.TabIndex = 4; - this.btnAddChar.Text = "Add"; - this.btnAddChar.UseVisualStyleBackColor = true; - this.btnAddChar.Click += new System.EventHandler(this.BtnAddFileClick); + this.txtboxY.TabIndex = 9; + this.txtboxY.Text = "2000"; // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(383, 343); - this.Controls.Add(this.panel1); - this.Controls.Add(this.btnPreview); - this.Controls.Add(this.button2); - this.Controls.Add(this.btnSaveFile); + this.ClientSize = new System.Drawing.Size(704, 465); + this.Controls.Add(this.tabControl1); + this.Controls.Add(this.btnPreviewImage); + this.Controls.Add(this.btnSave); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Margin = new System.Windows.Forms.Padding(2); this.MaximizeBox = false; this.Name = "MainForm"; this.Text = "Unitale Font Maker"; - this.panel1.ResumeLayout(false); - this.groupBox2.ResumeLayout(false); - this.groupBox2.PerformLayout(); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.tabPage1.PerformLayout(); + this.tabPage2.ResumeLayout(false); + this.tabPage3.ResumeLayout(false); + this.tabPage3.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.picboxColor)).EndInit(); this.ResumeLayout(false); - } - + } + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.TabPage tabPage3; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox txtboxX; + private System.Windows.Forms.TextBox txtboxY; + private System.Windows.Forms.CheckBox checkBoxDrawBorder; + private System.Windows.Forms.TextBox txtboxLineSpacing; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.PictureBox picboxColor; + private System.Windows.Forms.Button btnChooseColor; + private System.Windows.Forms.Label label2; private System.Windows.Forms.ComboBox comboxType; private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Button btnChangeNomalFont; + private System.Windows.Forms.Label lblEnglishFontInfo; + private System.Windows.Forms.Label lblNormalFontInfo; + private System.Windows.Forms.Label lblEnglishFontPreview; + private System.Windows.Forms.Label lblNormalFontPreview; + private System.Windows.Forms.Button btnChangeEnglishFont; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.TextBox textBoxFontYOffset; private System.Windows.Forms.Button btnClear; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Button btnChooseColor; - private System.Windows.Forms.PictureBox picboxColor; - private System.Windows.Forms.TextBox txtboxLineSpacing; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Button btnScan; + private System.Windows.Forms.Label labCharNum; + private System.Windows.Forms.Button btnAddChar; } } diff --git a/UnitaleFontMaker/MainForm.cs b/UnitaleFontMaker/MainForm.cs index d4bdcaa..97c8c75 100644 --- a/UnitaleFontMaker/MainForm.cs +++ b/UnitaleFontMaker/MainForm.cs @@ -14,73 +14,21 @@ public partial class MainForm : Form private FontPainter painter; private int width; private int height; - //private string chars; private List characters = new List(300); private Color fontColor = Color.White; - private const string ENGLISH_CHARS = "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ "; - public string ModPath - { - get { return txtboxModPath.Text; } - } public MainForm() { - InitializeComponent(); - Font font = new Font("宋体", 14); + InitializeComponent(); + Font font = new Font("宋体", 14); Brush brush = Brushes.White; painter = new FontPainter(font, 400, 400); + picboxColor.BackColor = fontColor; - AddNewChars(ENGLISH_CHARS); - } - - /// - /// 显示一个带错误图标的信息框 - /// - /// 要显示的信息 - private void ShowError(string str) - { - MessageBox.Show(str, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - - private void CopyDir( string srcPath, string aimPath ) - { - try { - /* 检查目标目录是否以目录分割字符结束如果不是则添加 */ - if ( aimPath[aimPath.Length - 1] != System.IO.Path.DirectorySeparatorChar ) - { - aimPath += System.IO.Path.DirectorySeparatorChar; - } - /* 判断目标目录是否存在如果不存在则新建 */ - if ( !System.IO.Directory.Exists( aimPath ) ) - { - System.IO.Directory.CreateDirectory( aimPath ); - } - /* - * 得到源目录的文件列表,该里面是包含文件以及目录路径的一个数组 - * 如果你指向copy目标文件下面的文件而不包含目录请使用下面的方法 - * string[] fileList = Directory.GetFiles(srcPath); - */ - string[] fileList = System.IO.Directory.GetFileSystemEntries( srcPath ); - /* 遍历所有的文件和目录 */ - foreach ( string file in fileList ) - { - /* 先当作目录处理如果存在这个目录就递归Copy该目录下面的文件 */ - if ( System.IO.Directory.Exists( file ) ) - { - CopyDir( file, aimPath + System.IO.Path.GetFileName( file ) ); - } - /* 否则直接Copy文件 */ - else { - System.IO.File.Copy( file, aimPath + System.IO.Path.GetFileName( file ), true ); - } - } - } catch ( Exception e ) { - throw; - } + AddChars(Character.ENGLISH_CHARS); } - //保存为文件 private void BtnSaveFileClick(object sender, EventArgs e) @@ -118,29 +66,21 @@ private bool SaveCheck() //检查字体名称 if (string.IsNullOrWhiteSpace(comboxType.Text)) { - ShowError("Please enter a font name!"); + Utils.ShowError("A font name is needed."); return false; } //检查字符是否为空 if(characters.Count <= 0) { - ShowError("You have not added a character yet!"); + Utils.ShowError("Try add some characters."); return false; } - //检查字体中是否含有英文字符 - /*Regex regex = new Regex(@"[^\u4e00-\u9fa5]"); - if(!regex.IsMatch(chars)) - { - ShowError("No English characters found, please add to the font!"); - return false; - }*/ - //检查行距 if(string.IsNullOrWhiteSpace(txtboxLineSpacing.Text)) { - ShowError("Line spacing is empty."); + Utils.ShowError("Line spacing is needed."); return false; } @@ -148,9 +88,9 @@ private bool SaveCheck() { int.Parse(txtboxLineSpacing.Text); } - catch (Exception e) + catch { - ShowError("Invalid line spacing."); + Utils.ShowError("Invalid line spacing."); return false; } @@ -162,37 +102,92 @@ private bool SaveCheck() } catch { - ShowError("Invalid size."); + Utils.ShowError("Invalid size."); } return true; } - - private void Button2Click(object sender, EventArgs e) + + private bool ApplySettings() + { + try + { + painter.Size = new Size(int.Parse(txtboxX.Text), int.Parse(txtboxY.Text)); + painter.TextColor = fontColor; + painter.fontYOffset = float.Parse(textBoxFontYOffset.Text); + painter.drawDebugBorders = checkBoxDrawBorder.Checked; + } + catch (FormatException) + { + Utils.ShowError("Invail value! Please check if all the numbers you entered is correct."); + } + + + return true; //TODO 继续完善 + } + + private void btnChangeNomalFont_Click(object sender, EventArgs e) { FontDialog dialog = new FontDialog(); - dialog.Font = painter.font; //设置为上一次的字体,方便修改 - dialog.ShowDialog(); - if(dialog.Font != null) - painter.font = dialog.Font; + dialog.Font = painter.Font; //设置为上一次的字体,方便修改 + try + { + if (dialog.ShowDialog() == DialogResult.OK && dialog.Font != null) + { + painter.Font = dialog.Font; + lblNormalFontInfo.Text = string.Format("{0} {1}", dialog.Font.Name, dialog.Font.Size); + lblNormalFontPreview.Font = dialog.Font; + } + + } + catch (ArgumentException ex) + { + if(ex.Message.Contains("TrueType")) + Utils.ShowError("TrueType font is not supported! Try google how to convert .otf to .ttf ."); + } dialog.Dispose(); - } + } + + private void btnChangeEnglishFont_Click(object sender, EventArgs e) + { + FontDialog dialog = new FontDialog(); + dialog.Font = painter.EnglishFont; //设置为上一次的字体,方便修改 + try + { + if (dialog.ShowDialog() == DialogResult.OK && dialog.Font != null) + { + painter.EnglishFont = dialog.Font; + lblEnglishFontInfo.Text = string.Format("{0} {1}", dialog.Font.Name, dialog.Font.Size); + lblEnglishFontPreview.Font = dialog.Font; + } + + } + catch (ArgumentException ex) + { + if (ex.Message.Contains("TrueType")) + Utils.ShowError("TrueType font is not supported! Try google how to convert .otf to .ttf ."); + } + dialog.Dispose(); + } void BtnPreviewClick(object sender, EventArgs e) { + ApplySettings(); + try { width = int.Parse(txtboxX.Text); height = int.Parse(txtboxY.Text); } - catch (Exception ex) + catch { - ShowError("Invalid size."); + Utils.ShowError("Invalid size."); + return; } - //painter.Text = chars; painter.Characters = characters.ToArray(); painter.Size = new Size(width, height); + painter.fontYOffset = float.Parse(textBoxFontYOffset.Text); painter.Paint(); PreviewForm previewForm = new PreviewForm(painter); @@ -201,35 +196,33 @@ void BtnPreviewClick(object sender, EventArgs e) //--------------字符选择部分---------------- //选择文件 - void BtnAddFileClick(object sender, EventArgs e) + void btnAddChar_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Text file(*.txt)|*.txt"; - dialog.Title = "Open a file"; + dialog.Title = "Open a text file:"; if(dialog.ShowDialog() == DialogResult.OK) { - AddNewChars(File.ReadAllText(dialog.FileName)); + AddChars(File.ReadAllText(dialog.FileName)); } dialog.Dispose(); - - } //清除字符 private void btnClear_Click(object sender, EventArgs e) { characters.Clear(); - AddNewChars(ENGLISH_CHARS); + AddChars(Character.ENGLISH_CHARS); } //增加英文字符 private void btnAddEnChar_Click(object sender, EventArgs e) { - AddNewChars(ENGLISH_CHARS); + AddChars(Character.ENGLISH_CHARS); labCharNum.Text = "Character Num: " + characters.Count; } - public void AddNewChars(string s) + public void AddChars(string s) { for (int i = 0; i < s.Length; i++) { @@ -240,6 +233,17 @@ public void AddNewChars(string s) labCharNum.Text = "Character: " + characters.Count; //更新显示 } + public void AddChars(char[] chars) + { + for (int i = 0; i < chars.Length; i++) + { + if (!characters.Contains(chars[i])) + characters.Add(chars[i]); + } + + labCharNum.Text = "Character: " + characters.Count; //更新显示 + } + //--------------字体颜色设置部分--------------- //选择颜色 private void btnChooseColor_Click(object sender, EventArgs e) @@ -255,37 +259,6 @@ private void btnChooseColor_Click(object sender, EventArgs e) } //-----------------Mod设置部分------------ - - //选择Mod路径按钮 - void BtnOpenModClick(object sender, EventArgs e) - { - FolderBrowserDialog dialog = new FolderBrowserDialog(); - dialog.Description = "Choose your Unitale mod."; - if(dialog.ShowDialog() == DialogResult.OK) - { - string path = dialog.SelectedPath; - if(!Directory.Exists(Path.Combine(path, "Lua"))) - { - ShowError("Invalid mod directory(Must have a \"Lua\" directory)."); - return; - } - txtboxModPath.Text = dialog.SelectedPath; - } - dialog.Dispose(); - } - - - //自动扫描 - void BtnScanClick(object sender, EventArgs e) - { - List luaFiles = new List(); - GetAllDirectory(ModPath, luaFiles); - - for (int i = 0; i < luaFiles.Count; i++) - { - string[] strs = GetAllStrings(File.ReadAllText(luaFiles[i])); - } - } /// /// 获取Lua文件中的所有字符串 @@ -350,5 +323,6 @@ private FileInfo[] GetAllFiles(string path) } + } } diff --git a/UnitaleFontMaker/UnitaleFontMaker.csproj b/UnitaleFontMaker/UnitaleFontMaker.csproj index 10c58a2..c2d39a4 100644 --- a/UnitaleFontMaker/UnitaleFontMaker.csproj +++ b/UnitaleFontMaker/UnitaleFontMaker.csproj @@ -53,6 +53,12 @@ + + Form + + + FormInput.cs + Form @@ -79,6 +85,9 @@ + + FormInput.cs + MainForm.cs