WIP: Packed fonts...

This commit is contained in:
Anton Mukhin
2025-05-20 17:08:42 +03:00
parent ca42d3819f
commit 5e55c0a5ea
5 changed files with 333 additions and 306 deletions

View File

@@ -23,331 +23,337 @@
/// the contents of this method with the code editor. /// the contents of this method with the code editor.
/// </summary> /// </summary>
private void InitializeComponent() { private void InitializeComponent() {
this.components = new System.ComponentModel.Container(); components = new System.ComponentModel.Container();
this.txtOutput = new System.Windows.Forms.RichTextBox(); txtOutput = new System.Windows.Forms.RichTextBox();
this.gbScan = new System.Windows.Forms.GroupBox(); gbScan = new System.Windows.Forms.GroupBox();
this.cbVDir = new System.Windows.Forms.ComboBox(); cbVDir = new System.Windows.Forms.ComboBox();
this.cbHDir = new System.Windows.Forms.ComboBox(); cbHDir = new System.Windows.Forms.ComboBox();
this.cbOrder = new System.Windows.Forms.ComboBox(); cbOrder = new System.Windows.Forms.ComboBox();
this.gbOptions = new System.Windows.Forms.GroupBox(); gbOptions = new System.Windows.Forms.GroupBox();
this.cbZeroes = new System.Windows.Forms.CheckBox(); cbPacked = new System.Windows.Forms.CheckBox();
this.cbHeader = new System.Windows.Forms.CheckBox(); cbZeroes = new System.Windows.Forms.CheckBox();
this.cbComments = new System.Windows.Forms.CheckBox(); cbHeader = new System.Windows.Forms.CheckBox();
this.gbNumbers = new System.Windows.Forms.GroupBox(); cbComments = new System.Windows.Forms.CheckBox();
this.cbBitOrder = new System.Windows.Forms.ComboBox(); gbNumbers = new System.Windows.Forms.GroupBox();
this.cbNumSize = new System.Windows.Forms.ComboBox(); cbBitOrder = new System.Windows.Forms.ComboBox();
this.cbNumBase = new System.Windows.Forms.ComboBox(); cbNumSize = new System.Windows.Forms.ComboBox();
this.gbText = new System.Windows.Forms.GroupBox(); cbNumBase = new System.Windows.Forms.ComboBox();
this.lblXLines = new System.Windows.Forms.Label(); gbText = new System.Windows.Forms.GroupBox();
this.nudXLines = new System.Windows.Forms.NumericUpDown(); lblXLines = new System.Windows.Forms.Label();
this.cbLines = new System.Windows.Forms.ComboBox(); nudXLines = new System.Windows.Forms.NumericUpDown();
this.cbFormat = new System.Windows.Forms.ComboBox(); cbLines = new System.Windows.Forms.ComboBox();
this.btnGenerate = new System.Windows.Forms.Button(); cbFormat = new System.Windows.Forms.ComboBox();
this.btnClose = new System.Windows.Forms.Button(); btnGenerate = new System.Windows.Forms.Button();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); btnClose = new System.Windows.Forms.Button();
this.gbScan.SuspendLayout(); toolTip1 = new System.Windows.Forms.ToolTip(components);
this.gbOptions.SuspendLayout(); gbScan.SuspendLayout();
this.gbNumbers.SuspendLayout(); gbOptions.SuspendLayout();
this.gbText.SuspendLayout(); gbNumbers.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudXLines)).BeginInit(); gbText.SuspendLayout();
this.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)nudXLines).BeginInit();
SuspendLayout();
// //
// txtOutput // txtOutput
// //
this.txtOutput.AcceptsTab = true; txtOutput.AcceptsTab = true;
this.txtOutput.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) txtOutput.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
| System.Windows.Forms.AnchorStyles.Left) txtOutput.AutoWordSelection = true;
| System.Windows.Forms.AnchorStyles.Right))); txtOutput.DetectUrls = false;
this.txtOutput.AutoWordSelection = true; txtOutput.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 204);
this.txtOutput.DetectUrls = false; txtOutput.HideSelection = false;
this.txtOutput.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); txtOutput.Location = new System.Drawing.Point(176, 14);
this.txtOutput.HideSelection = false; txtOutput.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.txtOutput.Location = new System.Drawing.Point(151, 12); txtOutput.Name = "txtOutput";
this.txtOutput.Name = "txtOutput"; txtOutput.Size = new System.Drawing.Size(616, 584);
this.txtOutput.Size = new System.Drawing.Size(529, 507); txtOutput.TabIndex = 0;
this.txtOutput.TabIndex = 0; txtOutput.Text = "";
this.txtOutput.Text = ""; txtOutput.WordWrap = false;
this.txtOutput.WordWrap = false;
// //
// gbScan // gbScan
// //
this.gbScan.Controls.Add(this.cbVDir); gbScan.Controls.Add(cbVDir);
this.gbScan.Controls.Add(this.cbHDir); gbScan.Controls.Add(cbHDir);
this.gbScan.Controls.Add(this.cbOrder); gbScan.Controls.Add(cbOrder);
this.gbScan.Location = new System.Drawing.Point(5, 12); gbScan.Location = new System.Drawing.Point(6, 14);
this.gbScan.Name = "gbScan"; gbScan.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.gbScan.Size = new System.Drawing.Size(140, 105); gbScan.Name = "gbScan";
this.gbScan.TabIndex = 1; gbScan.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.gbScan.TabStop = false; gbScan.Size = new System.Drawing.Size(163, 121);
this.gbScan.Text = "Scan"; gbScan.TabIndex = 1;
gbScan.TabStop = false;
gbScan.Text = "Scan";
// //
// cbVDir // cbVDir
// //
this.cbVDir.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; cbVDir.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbVDir.FormattingEnabled = true; cbVDir.FormattingEnabled = true;
this.cbVDir.Items.AddRange(new object[] { cbVDir.Items.AddRange(new object[] { "Top to Bottom", "Bottom to Top" });
"Top to Bottom", cbVDir.Location = new System.Drawing.Point(12, 84);
"Bottom to Top"}); cbVDir.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.cbVDir.Location = new System.Drawing.Point(10, 73); cbVDir.Name = "cbVDir";
this.cbVDir.Name = "cbVDir"; cbVDir.Size = new System.Drawing.Size(140, 23);
this.cbVDir.Size = new System.Drawing.Size(121, 21); cbVDir.TabIndex = 2;
this.cbVDir.TabIndex = 2;
// //
// cbHDir // cbHDir
// //
this.cbHDir.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; cbHDir.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbHDir.FormattingEnabled = true; cbHDir.FormattingEnabled = true;
this.cbHDir.Items.AddRange(new object[] { cbHDir.Items.AddRange(new object[] { "Left to Right", "Right to Left" });
"Left to Right", cbHDir.Location = new System.Drawing.Point(12, 53);
"Right to Left"}); cbHDir.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.cbHDir.Location = new System.Drawing.Point(10, 46); cbHDir.Name = "cbHDir";
this.cbHDir.Name = "cbHDir"; cbHDir.Size = new System.Drawing.Size(140, 23);
this.cbHDir.Size = new System.Drawing.Size(121, 21); cbHDir.TabIndex = 1;
this.cbHDir.TabIndex = 1;
// //
// cbOrder // cbOrder
// //
this.cbOrder.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; cbOrder.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbOrder.FormattingEnabled = true; cbOrder.FormattingEnabled = true;
this.cbOrder.Items.AddRange(new object[] { cbOrder.Items.AddRange(new object[] { "Columns", "Rows" });
"Columns", cbOrder.Location = new System.Drawing.Point(12, 22);
"Rows"}); cbOrder.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.cbOrder.Location = new System.Drawing.Point(10, 19); cbOrder.Name = "cbOrder";
this.cbOrder.Name = "cbOrder"; cbOrder.Size = new System.Drawing.Size(140, 23);
this.cbOrder.Size = new System.Drawing.Size(121, 21); cbOrder.TabIndex = 0;
this.cbOrder.TabIndex = 0; cbOrder.SelectedIndexChanged += cbOrder_SelectedIndexChanged;
this.cbOrder.SelectedIndexChanged += new System.EventHandler(this.cbOrder_SelectedIndexChanged);
// //
// gbOptions // gbOptions
// //
this.gbOptions.Controls.Add(this.cbZeroes); gbOptions.Controls.Add(cbPacked);
this.gbOptions.Controls.Add(this.cbHeader); gbOptions.Controls.Add(cbZeroes);
this.gbOptions.Controls.Add(this.cbComments); gbOptions.Controls.Add(cbHeader);
this.gbOptions.Location = new System.Drawing.Point(5, 345); gbOptions.Controls.Add(cbComments);
this.gbOptions.Name = "gbOptions"; gbOptions.Location = new System.Drawing.Point(6, 398);
this.gbOptions.Size = new System.Drawing.Size(140, 88); gbOptions.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.gbOptions.TabIndex = 3; gbOptions.Name = "gbOptions";
this.gbOptions.TabStop = false; gbOptions.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.gbOptions.Text = "Options"; gbOptions.Size = new System.Drawing.Size(163, 116);
gbOptions.TabIndex = 3;
gbOptions.TabStop = false;
gbOptions.Text = "Options";
//
// cbPacked
//
cbPacked.AutoSize = true;
cbPacked.Location = new System.Drawing.Point(7, 90);
cbPacked.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
cbPacked.Name = "cbPacked";
cbPacked.Size = new System.Drawing.Size(89, 19);
cbPacked.TabIndex = 3;
cbPacked.Text = "Packed font";
toolTip1.SetToolTip(cbPacked, "Pack symbols utilizing all bits within a symbol");
cbPacked.UseVisualStyleBackColor = true;
cbPacked.CheckedChanged += cbPacked_CheckedChanged;
// //
// cbZeroes // cbZeroes
// //
this.cbZeroes.AutoSize = true; cbZeroes.AutoSize = true;
this.cbZeroes.Checked = true; cbZeroes.Checked = true;
this.cbZeroes.CheckState = System.Windows.Forms.CheckState.Checked; cbZeroes.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbZeroes.Location = new System.Drawing.Point(6, 65); cbZeroes.Location = new System.Drawing.Point(7, 66);
this.cbZeroes.Name = "cbZeroes"; cbZeroes.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.cbZeroes.Size = new System.Drawing.Size(98, 17); cbZeroes.Name = "cbZeroes";
this.cbZeroes.TabIndex = 2; cbZeroes.Size = new System.Drawing.Size(104, 19);
this.cbZeroes.Text = "Leading zeroes"; cbZeroes.TabIndex = 2;
this.toolTip1.SetToolTip(this.cbZeroes, "Add leading zeroes: 0x01 / 0x1"); cbZeroes.Text = "Leading zeroes";
this.cbZeroes.UseVisualStyleBackColor = true; toolTip1.SetToolTip(cbZeroes, "Add leading zeroes: 0x01 / 0x1");
cbZeroes.UseVisualStyleBackColor = true;
// //
// cbHeader // cbHeader
// //
this.cbHeader.AutoSize = true; cbHeader.AutoSize = true;
this.cbHeader.Checked = true; cbHeader.Checked = true;
this.cbHeader.CheckState = System.Windows.Forms.CheckState.Checked; cbHeader.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbHeader.Location = new System.Drawing.Point(6, 19); cbHeader.Location = new System.Drawing.Point(7, 18);
this.cbHeader.Name = "cbHeader"; cbHeader.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.cbHeader.Size = new System.Drawing.Size(86, 17); cbHeader.Name = "cbHeader";
this.cbHeader.TabIndex = 1; cbHeader.Size = new System.Drawing.Size(92, 19);
this.cbHeader.Text = "Meta header"; cbHeader.TabIndex = 1;
this.toolTip1.SetToolTip(this.cbHeader, "Add meta header with meta data"); cbHeader.Text = "Meta header";
this.cbHeader.UseVisualStyleBackColor = true; toolTip1.SetToolTip(cbHeader, "Add meta header with meta data");
this.cbHeader.CheckedChanged += new System.EventHandler(this.cbFormat_SelectedIndexChanged); cbHeader.UseVisualStyleBackColor = true;
cbHeader.CheckedChanged += cbFormat_SelectedIndexChanged;
// //
// cbComments // cbComments
// //
this.cbComments.AutoSize = true; cbComments.AutoSize = true;
this.cbComments.Checked = true; cbComments.Checked = true;
this.cbComments.CheckState = System.Windows.Forms.CheckState.Checked; cbComments.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbComments.Location = new System.Drawing.Point(6, 42); cbComments.Location = new System.Drawing.Point(7, 42);
this.cbComments.Name = "cbComments"; cbComments.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.cbComments.Size = new System.Drawing.Size(75, 17); cbComments.Name = "cbComments";
this.cbComments.TabIndex = 0; cbComments.Size = new System.Drawing.Size(85, 19);
this.cbComments.Text = "Comments"; cbComments.TabIndex = 0;
this.toolTip1.SetToolTip(this.cbComments, "Add descriptive comments"); cbComments.Text = "Comments";
this.cbComments.UseVisualStyleBackColor = true; toolTip1.SetToolTip(cbComments, "Add descriptive comments");
cbComments.UseVisualStyleBackColor = true;
// //
// gbNumbers // gbNumbers
// //
this.gbNumbers.Controls.Add(this.cbBitOrder); gbNumbers.Controls.Add(cbBitOrder);
this.gbNumbers.Controls.Add(this.cbNumSize); gbNumbers.Controls.Add(cbNumSize);
this.gbNumbers.Controls.Add(this.cbNumBase); gbNumbers.Controls.Add(cbNumBase);
this.gbNumbers.Location = new System.Drawing.Point(5, 123); gbNumbers.Location = new System.Drawing.Point(6, 142);
this.gbNumbers.Name = "gbNumbers"; gbNumbers.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.gbNumbers.Size = new System.Drawing.Size(140, 105); gbNumbers.Name = "gbNumbers";
this.gbNumbers.TabIndex = 4; gbNumbers.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.gbNumbers.TabStop = false; gbNumbers.Size = new System.Drawing.Size(163, 121);
this.gbNumbers.Text = "Numbers"; gbNumbers.TabIndex = 4;
gbNumbers.TabStop = false;
gbNumbers.Text = "Numbers";
// //
// cbBitOrder // cbBitOrder
// //
this.cbBitOrder.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; cbBitOrder.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbBitOrder.FormattingEnabled = true; cbBitOrder.FormattingEnabled = true;
this.cbBitOrder.Items.AddRange(new object[] { cbBitOrder.Items.AddRange(new object[] { "LSB Top", "MSB Top" });
"LSB Top", cbBitOrder.Location = new System.Drawing.Point(12, 22);
"MSB Top"}); cbBitOrder.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.cbBitOrder.Location = new System.Drawing.Point(10, 19); cbBitOrder.Name = "cbBitOrder";
this.cbBitOrder.Name = "cbBitOrder"; cbBitOrder.Size = new System.Drawing.Size(140, 23);
this.cbBitOrder.Size = new System.Drawing.Size(121, 21); cbBitOrder.TabIndex = 5;
this.cbBitOrder.TabIndex = 5;
// //
// cbNumSize // cbNumSize
// //
this.cbNumSize.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; cbNumSize.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbNumSize.FormattingEnabled = true; cbNumSize.FormattingEnabled = true;
this.cbNumSize.Items.AddRange(new object[] { cbNumSize.Items.AddRange(new object[] { "8 bit", "16 bit", "32 bit" });
"8 bit", cbNumSize.Location = new System.Drawing.Point(12, 84);
"16 bit", cbNumSize.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
"32 bit"}); cbNumSize.Name = "cbNumSize";
this.cbNumSize.Location = new System.Drawing.Point(10, 73); cbNumSize.Size = new System.Drawing.Size(140, 23);
this.cbNumSize.Name = "cbNumSize"; cbNumSize.TabIndex = 4;
this.cbNumSize.Size = new System.Drawing.Size(121, 21);
this.cbNumSize.TabIndex = 4;
// //
// cbNumBase // cbNumBase
// //
this.cbNumBase.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; cbNumBase.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbNumBase.FormattingEnabled = true; cbNumBase.FormattingEnabled = true;
this.cbNumBase.Items.AddRange(new object[] { cbNumBase.Items.AddRange(new object[] { "Hexadecimal", "Binary", "Decimal" });
"Hexadecimal", cbNumBase.Location = new System.Drawing.Point(12, 53);
"Binary", cbNumBase.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
"Decimal"}); cbNumBase.Name = "cbNumBase";
this.cbNumBase.Location = new System.Drawing.Point(10, 46); cbNumBase.Size = new System.Drawing.Size(140, 23);
this.cbNumBase.Name = "cbNumBase"; cbNumBase.TabIndex = 3;
this.cbNumBase.Size = new System.Drawing.Size(121, 21);
this.cbNumBase.TabIndex = 3;
// //
// gbText // gbText
// //
this.gbText.Controls.Add(this.lblXLines); gbText.Controls.Add(lblXLines);
this.gbText.Controls.Add(this.nudXLines); gbText.Controls.Add(nudXLines);
this.gbText.Controls.Add(this.cbLines); gbText.Controls.Add(cbLines);
this.gbText.Controls.Add(this.cbFormat); gbText.Controls.Add(cbFormat);
this.gbText.Location = new System.Drawing.Point(5, 234); gbText.Location = new System.Drawing.Point(6, 270);
this.gbText.Name = "gbText"; gbText.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.gbText.Size = new System.Drawing.Size(140, 105); gbText.Name = "gbText";
this.gbText.TabIndex = 5; gbText.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.gbText.TabStop = false; gbText.Size = new System.Drawing.Size(163, 121);
this.gbText.Text = "Text format"; gbText.TabIndex = 5;
gbText.TabStop = false;
gbText.Text = "Text format";
// //
// lblXLines // lblXLines
// //
this.lblXLines.AutoSize = true; lblXLines.AutoSize = true;
this.lblXLines.Enabled = false; lblXLines.Enabled = false;
this.lblXLines.Location = new System.Drawing.Point(10, 76); lblXLines.Location = new System.Drawing.Point(12, 88);
this.lblXLines.Name = "lblXLines"; lblXLines.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblXLines.Size = new System.Drawing.Size(60, 13); lblXLines.Name = "lblXLines";
this.lblXLines.TabIndex = 9; lblXLines.Size = new System.Drawing.Size(67, 15);
this.lblXLines.Text = "X numbers:"; lblXLines.TabIndex = 9;
lblXLines.Text = "X numbers:";
// //
// nudXLines // nudXLines
// //
this.nudXLines.Enabled = false; nudXLines.Enabled = false;
this.nudXLines.Location = new System.Drawing.Point(76, 73); nudXLines.Location = new System.Drawing.Point(89, 84);
this.nudXLines.Maximum = new decimal(new int[] { nudXLines.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
64, nudXLines.Maximum = new decimal(new int[] { 64, 0, 0, 0 });
0, nudXLines.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
0, nudXLines.Name = "nudXLines";
0}); nudXLines.Size = new System.Drawing.Size(64, 23);
this.nudXLines.Minimum = new decimal(new int[] { nudXLines.TabIndex = 8;
1, nudXLines.Value = new decimal(new int[] { 8, 0, 0, 0 });
0,
0,
0});
this.nudXLines.Name = "nudXLines";
this.nudXLines.Size = new System.Drawing.Size(55, 20);
this.nudXLines.TabIndex = 8;
this.nudXLines.Value = new decimal(new int[] {
8,
0,
0,
0});
// //
// cbLines // cbLines
// //
this.cbLines.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; cbLines.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbLines.FormattingEnabled = true; cbLines.FormattingEnabled = true;
this.cbLines.Items.AddRange(new object[] { cbLines.Items.AddRange(new object[] { "1 Column per line", "1 Symbol per line", "X Numbers per line" });
"1 Column per line", cbLines.Location = new System.Drawing.Point(12, 53);
"1 Symbol per line", cbLines.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
"X Numbers per line"}); cbLines.Name = "cbLines";
this.cbLines.Location = new System.Drawing.Point(10, 46); cbLines.Size = new System.Drawing.Size(140, 23);
this.cbLines.Name = "cbLines"; cbLines.TabIndex = 7;
this.cbLines.Size = new System.Drawing.Size(121, 21); cbLines.SelectedIndexChanged += cbLines_SelectedIndexChanged;
this.cbLines.TabIndex = 7;
this.cbLines.SelectedIndexChanged += new System.EventHandler(this.cbLines_SelectedIndexChanged);
// //
// cbFormat // cbFormat
// //
this.cbFormat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; cbFormat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbFormat.FormattingEnabled = true; cbFormat.FormattingEnabled = true;
this.cbFormat.Items.AddRange(new object[] { cbFormat.Items.AddRange(new object[] { "1D C array", "2D C array", "Comma separated" });
"1D C array", cbFormat.Location = new System.Drawing.Point(12, 22);
"2D C array", cbFormat.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
"Comma separated"}); cbFormat.Name = "cbFormat";
this.cbFormat.Location = new System.Drawing.Point(10, 19); cbFormat.Size = new System.Drawing.Size(140, 23);
this.cbFormat.Name = "cbFormat"; cbFormat.TabIndex = 6;
this.cbFormat.Size = new System.Drawing.Size(121, 21); cbFormat.SelectedIndexChanged += cbFormat_SelectedIndexChanged;
this.cbFormat.TabIndex = 6;
this.cbFormat.SelectedIndexChanged += new System.EventHandler(this.cbFormat_SelectedIndexChanged);
// //
// btnGenerate // btnGenerate
// //
this.btnGenerate.Location = new System.Drawing.Point(5, 439); btnGenerate.Location = new System.Drawing.Point(6, 520);
this.btnGenerate.Name = "btnGenerate"; btnGenerate.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.btnGenerate.Size = new System.Drawing.Size(140, 30); btnGenerate.Name = "btnGenerate";
this.btnGenerate.TabIndex = 6; btnGenerate.Size = new System.Drawing.Size(163, 35);
this.btnGenerate.Text = "Generate"; btnGenerate.TabIndex = 6;
this.btnGenerate.UseVisualStyleBackColor = true; btnGenerate.Text = "Generate";
this.btnGenerate.Click += new System.EventHandler(this.btnGenerate_Click); btnGenerate.UseVisualStyleBackColor = true;
btnGenerate.Click += btnGenerate_Click;
// //
// btnClose // btnClose
// //
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel; btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnClose.Location = new System.Drawing.Point(5, 487); btnClose.Location = new System.Drawing.Point(6, 562);
this.btnClose.Name = "btnClose"; btnClose.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.btnClose.Size = new System.Drawing.Size(140, 30); btnClose.Name = "btnClose";
this.btnClose.TabIndex = 7; btnClose.Size = new System.Drawing.Size(163, 35);
this.btnClose.Text = "Close"; btnClose.TabIndex = 7;
this.btnClose.UseVisualStyleBackColor = true; btnClose.Text = "Close";
btnClose.UseVisualStyleBackColor = true;
// //
// toolTip1 // toolTip1
// //
this.toolTip1.AutoPopDelay = 10000; toolTip1.AutoPopDelay = 10000;
this.toolTip1.InitialDelay = 500; toolTip1.InitialDelay = 500;
this.toolTip1.ReshowDelay = 100; toolTip1.ReshowDelay = 100;
// //
// Export // Export
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnClose; CancelButton = btnClose;
this.ClientSize = new System.Drawing.Size(692, 531); ClientSize = new System.Drawing.Size(807, 613);
this.Controls.Add(this.btnClose); Controls.Add(btnClose);
this.Controls.Add(this.btnGenerate); Controls.Add(btnGenerate);
this.Controls.Add(this.gbText); Controls.Add(gbText);
this.Controls.Add(this.gbNumbers); Controls.Add(gbNumbers);
this.Controls.Add(this.gbOptions); Controls.Add(gbOptions);
this.Controls.Add(this.gbScan); Controls.Add(gbScan);
this.Controls.Add(this.txtOutput); Controls.Add(txtOutput);
this.MinimumSize = new System.Drawing.Size(700, 570); Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.Name = "Export"; MinimumSize = new System.Drawing.Size(814, 652);
this.ShowIcon = false; Name = "Export";
this.ShowInTaskbar = false; ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; ShowInTaskbar = false;
this.Text = "Export"; StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Load += new System.EventHandler(this.Export_Load); Text = "Export";
this.gbScan.ResumeLayout(false); Load += Export_Load;
this.gbOptions.ResumeLayout(false); gbScan.ResumeLayout(false);
this.gbOptions.PerformLayout(); gbOptions.ResumeLayout(false);
this.gbNumbers.ResumeLayout(false); gbOptions.PerformLayout();
this.gbText.ResumeLayout(false); gbNumbers.ResumeLayout(false);
this.gbText.PerformLayout(); gbText.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.nudXLines)).EndInit(); gbText.PerformLayout();
this.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)nudXLines).EndInit();
ResumeLayout(false);
} }
@@ -374,5 +380,6 @@
private System.Windows.Forms.Button btnClose; private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.CheckBox cbZeroes; private System.Windows.Forms.CheckBox cbZeroes;
private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.CheckBox cbPacked;
} }
} }

View File

@@ -38,16 +38,16 @@ namespace McBitFont {
"//\n" + "//\n" +
"//\n" "//\n"
); );
comments.Add("scan_order", "// Scan order: "); comments.Add("scan_order", "// Scan order: ");
comments.Add("scan_hdir", "// Horizontal direction: "); comments.Add("scan_hdir", "// Horizontal direction: ");
comments.Add("scan_vdir", "// Vertical direction: "); comments.Add("scan_vdir", "// Vertical direction: ");
comments.Add("num_bit_order", "// Bit order: "); comments.Add("num_bit_order", "// Bit order: ");
comments.Add("num_base", "// Numbers base: "); comments.Add("num_base", "// Numbers base: ");
comments.Add("num_size", "// Numbers size: "); comments.Add("num_size", "// Numbers size: ");
comments.Add("text_format", "// Text format: "); comments.Add("text_format", "// Text format: ");
comments.Add("text_lines", "// Numbers per line: "); comments.Add("text_lines", "// Numbers per line: ");
comments.Add("font_header_map", comments.Add("font_header_map",
"// Font header map:\n" + "// Font header map:\n" +
@@ -79,6 +79,7 @@ namespace McBitFont {
txtOutput.Clear(); txtOutput.Clear();
bool com = cbComments.Checked; bool com = cbComments.Checked;
bool hdr = cbHeader.Checked; bool hdr = cbHeader.Checked;
bool packed = cbPacked.Checked;
int lines = cbLines.SelectedIndex; int lines = cbLines.SelectedIndex;
int format = cbFormat.SelectedIndex; int format = cbFormat.SelectedIndex;
bool mono = mainForm.monospaced; bool mono = mainForm.monospaced;
@@ -156,7 +157,7 @@ namespace McBitFont {
} }
} }
// C data type selection
ushort bits = 8; ushort bits = 8;
string dataType = "uint8_t"; string dataType = "uint8_t";
switch (cbNumSize.SelectedIndex) { switch (cbNumSize.SelectedIndex) {
@@ -197,9 +198,10 @@ namespace McBitFont {
} }
// Array definition // Array definition
if ( format == 0 || format == 1 ) output += "const " + dataType + " " + mainForm.prjName + "[]" + (format==1?"[]":"") + " = {\n"; if (format == 0 || format == 1) output += "const " + dataType + " " + mainForm.prjName + "[]" + (format == 1 ? "[]" : "") + " = {\n";
// Should we add the meta header? // Should we add the meta header?
// TODO: PACKED FONT FLAG!!!! ==================================
if (hdr) { if (hdr) {
output += output +=
" // Meta header\n" + " // Meta header\n" +
@@ -210,17 +212,17 @@ namespace McBitFont {
" " + mainForm.frames.Last().code.ToString() + ", // Last character code\n" " " + mainForm.frames.Last().code.ToString() + ", // Last character code\n"
; ;
} }
// Brackets for 2D array definition // Brackets for 2D array definition
string obracket = format == 1 ? "{ " : ""; string obracket = format == 1 ? "{ " : "";
string cbracket = format == 1 ? " }" : ""; string cbracket = format == 1 ? " }" : "";
// Number output counter // Number output counter
int numcount = 0; int numcount = 0;
if (com) output += " // Data:\n"; if (com) output += " // Data:\n";
MainForm.FrameMiniature flast = mainForm.frames.Last(); MainForm.FrameMiniature flast = mainForm.frames.Last();
foreach ( MainForm.FrameMiniature f in mainForm.frames) { foreach (MainForm.FrameMiniature f in mainForm.frames) {
// For each frame // For each frame
uint b = 0; // current number bits uint b = 0; // current number bits
int t, x, y; // t - calculated bit number; x - actual x; y - actual y int t, x, y; // t - calculated bit number; x - actual x; y - actual y
@@ -289,6 +291,7 @@ namespace McBitFont {
} }
} }
t = jdir < 0 ? bits+1 : -1;
for (int i = imin; i != imax; i += idir) { for (int i = imin; i != imax; i += idir) {
if (lines == 0) { if (lines == 0) {
// "Column/Row per line" - new line offset // "Column/Row per line" - new line offset
@@ -296,8 +299,13 @@ namespace McBitFont {
numcount = 0; numcount = 0;
} }
for (int j = jmin; j != jmax; j += jdir) { for (int j = jmin; j != jmax; j += jdir) {
if (jdir < 0) t = jmin - j; if (packed) {
else t = j; t += jdir;
if (t < 0 || t % bits == 0) t = jdir < 0 ? bits : 0;
} else {
if (jdir < 0) t = jmin - j;
else t = j;
}
if (t % bits == 0) b = 0; if (t % bits == 0) b = 0;
if (cbOrder.SelectedIndex == 0) { // Columns if (cbOrder.SelectedIndex == 0) { // Columns
@@ -314,9 +322,9 @@ namespace McBitFont {
// MSB on top/Left // MSB on top/Left
b |= (uint)(1 << (bits - (t % bits) - 1)); b |= (uint)(1 << (bits - (t % bits) - 1));
} }
} }
if (((t + 1) % bits == 0) || j + jdir == jmax) { if (((t + 1) % bits == 0) || (j + jdir == jmax && !packed)) {
// we have filled a number with bits - let's post it // we have filled a number with bits - let's post it
// should we post a comma before the number? // should we post a comma before the number?
@@ -337,9 +345,19 @@ namespace McBitFont {
} }
if (lines == 0) { if (lines == 0) {
// "Column/Row per line" - closing line // "Column/Row per line" - closing line
output += cbracket + ((i+idir==imax) && f.Equals(flast) ? "" : ",") + "\n"; output += cbracket + ((i + idir == imax) && f.Equals(flast) ? "" : ",") + "\n";
} }
} }
if (packed && (f.width * f.height / 8) % bits > 0) {
// post leftovers in last byte
// should we post a prefix to the number?
pref = (!cbZeroes.Checked && ((b < 10 && nbase == 16) || (b < 2 && nbase == 2))) ? "" : prefix;
output += ", " + pref + Convert.ToString(b, nbase).PadLeft(pad, '0');
// count posted numbers
numcount++;
}
if (lines == 1) { if (lines == 1) {
// "1 symbol per line" - closing line // "1 symbol per line" - closing line
if (!f.Equals(flast) && f.width > 0) output += ","; if (!f.Equals(flast) && f.width > 0) output += ",";
@@ -390,5 +408,10 @@ namespace McBitFont {
lblXLines.Enabled = false; lblXLines.Enabled = false;
} }
} }
private void cbPacked_CheckedChanged(object sender, EventArgs e) {
cbLines.Enabled = !cbPacked.Checked;
if (cbPacked.Checked) cbLines.SelectedIndex = 1;
}
} }
} }

View File

@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
The primary goals of this format is to allow a simple XML format The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes various data types are done through the TypeConverter classes
associated with the data types. associated with the data types.
Example: Example:
... ado.net/XML headers & schema ... ... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader> <resheader name="version">2.0</resheader>
@@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment> <comment>This is a comment</comment>
</data> </data>
There are any number of "resheader" rows that contain simple There are any number of "resheader" rows that contain simple
name/value pairs. name/value pairs.
Each data row contains a name, and value. The row also contains a Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture. text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the Classes that don't support this are serialized and stored with the
mimetype set. mimetype set.
The mimetype is used for serialized objects, and tells the The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly: extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below. read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64 mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64 mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter : using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
--> -->
@@ -120,7 +120,4 @@
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>

Binary file not shown.

Binary file not shown.