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

@@ -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;
}