Bugs fixed:

- Improper bytes count for 16 or 32 bit numbers export
- Exception on Code Shift when nothing is selected in Symbols List
This commit is contained in:
Anton Mukhin
2025-05-23 16:40:44 +03:00
parent 0f2da5542c
commit a287ddaee7
4 changed files with 24 additions and 14 deletions

View File

@@ -76,17 +76,17 @@
// lblValue
//
lblValue.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
lblValue.AutoSize = true;
lblValue.Location = new System.Drawing.Point(206, 8);
lblValue.Location = new System.Drawing.Point(156, 8);
lblValue.Name = "lblValue";
lblValue.Size = new System.Drawing.Size(50, 15);
lblValue.Size = new System.Drawing.Size(110, 15);
lblValue.TabIndex = 3;
lblValue.Text = "Shift by:";
lblValue.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// nudValue
//
nudValue.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
nudValue.Location = new System.Drawing.Point(206, 27);
nudValue.Location = new System.Drawing.Point(185, 27);
nudValue.Maximum = new decimal(new int[] { 254, 0, 0, 0 });
nudValue.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
nudValue.Name = "nudValue";
@@ -130,7 +130,7 @@
// lblRange
//
lblRange.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
lblRange.Location = new System.Drawing.Point(204, 53);
lblRange.Location = new System.Drawing.Point(183, 53);
lblRange.Name = "lblRange";
lblRange.Size = new System.Drawing.Size(62, 31);
lblRange.TabIndex = 9;

View File

@@ -33,7 +33,7 @@ namespace McBitFont {
}
}
comments.Add("header",
"// File generated by McBitFont " + MainForm.version + "\n" +
"// File generated by McBitFont v" + MainForm.version + "\n" +
"// made by Anton Mukhin (mcfly@mcflyer.ru)\n" +
"//\n" +
"//\n"
@@ -51,7 +51,8 @@ namespace McBitFont {
comments.Add("font_header_map",
"// Font header map:\n" +
"// width; // Font width in pixels\n" +
"// packed; // Flag for packed font" +
"// width; // Font width in pixels (0 - variable width)\n" +
"// height; // Font height in pixels\n" +
"// space; // Font space in pixels\n" +
"// first; // First character code\n" +
@@ -212,7 +213,7 @@ namespace McBitFont {
" " + mainForm.frames.First().code.ToString() + ", // First character code\n" +
" " + mainForm.frames.Last().code.ToString() + ", // Last character code\n"
;
bTotal += 6; // Count bytes total
bTotal += 6*bits / 8; // Count bytes total
}
// Brackets for 2D array definition
@@ -245,7 +246,7 @@ namespace McBitFont {
// Should we post a prefix to the number?
pref = (!cbZeroes.Checked && ((f.width < 10 && nbase == 16) || (f.width < 2 && nbase == 2))) ? "" : prefix;
output += (lines != 1 ? " " : "") + pref + Convert.ToString(f.width, nbase).PadLeft(pad, '0') + (lines != 0 ? (lines == 1 ? ", " : "") : ",\n");
bTotal++; // Count bytes total
bTotal += bits / 8; // Count bytes total
// Count posted numbers
numcount++;
if (lines != 2) numcount = 0;
@@ -336,7 +337,7 @@ namespace McBitFont {
// 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');
bTotal++; // Count bytes total
bTotal += bits / 8; // Count bytes total
// count posted numbers
numcount++;
@@ -353,12 +354,12 @@ namespace McBitFont {
}
}
if (packed && (f.width * f.height / 8) % bits > 0) {
// post leftovers in last byte
// post leftovers in last number
// should we post a prefix to the number?
pref = (!cbZeroes.Checked && ((b < 10 && nbase == 16) || (b < 2 && nbase == 2))) ? "" : prefix;
output += (numcount > 0? ", " : "") + pref + Convert.ToString(b, nbase).PadLeft(pad, '0');
bTotal++; // Count bytes total
bTotal += bits / 8; // Count bytes total
// count posted numbers
numcount++;
@@ -384,7 +385,7 @@ namespace McBitFont {
// Add header and bytes total counter
if (com) {
output = "// Bytes total: " + bTotal.ToString() + "\n" + output;
output = "// Bytes total: " + bTotal.ToString() + "\n" + output;
output = comments["header"] + output;
}

View File

@@ -776,6 +776,9 @@ namespace McBitFont {
prjFileName = filename;
prjName = Path.GetFileNameWithoutExtension(filename);
this.Text = "McBitFont " + version + " - " + prjName;
miniList.Items[0].Selected = true;
CheckForAdd();
fbuffer = false;
@@ -1019,7 +1022,9 @@ namespace McBitFont {
Cursor.Current = Cursors.WaitCursor;
FrameMiniature ff;
var sel = miniList.SelectedItems[0].Index;
int sel;
if (miniList.SelectedItems.Count > 0) sel = miniList.SelectedItems[0].Index;
else sel = 0;
var val = Convert.ToInt32(csform.nudValue.Value);
if (csform.rbSpecify.Checked) val -= csform.sc;
if (csform.rbShiftLeft.Checked) val *= -1;

View File

@@ -5,6 +5,8 @@ V Better quality pictures in symbol list
V Spinning cursor when application is busy
V Change Menu icons
V Re-arranged menu items
- Option to display codes in Hex numbers
- Make symbol list wider to display 8 characters instead of 7
Functionality:
V Context menu in symbol navigator
@@ -20,3 +22,5 @@ V "Packed" fonts export
V "Bytes total comment in export
Bugs:
V Improper bytes count for 16 or 32 bit numbers export
V Exception on Code Shift when nothing is selected in Symbols List