10 Commits

Author SHA1 Message Date
Anton Mukhin
c5e440ee44 Update TODO; More examples 2025-05-16 18:04:09 +03:00
Anton Mukhin
34bec25b3d Fix TODO.txt 2023-07-07 12:08:44 +03:00
Anton Mukhin
b1acbdd98f Ability to open a project by double-clicking on a file in Explorer 2023-07-07 12:07:14 +03:00
Anton Mukhin
6d5f90aaac TODO added 2023-07-07 10:27:25 +03:00
72ad6e5be0 Changed Release version info 2023-07-05 02:36:24 +03:00
9d1ca65f34 Added modified check before project save 2023-07-05 02:22:58 +03:00
Anton Mukhin
dd3f4f4b4b Merge branch 'fix-broken-resize' 2023-05-17 16:48:11 +03:00
Anton Mukhin
8889b846dc Fixed font resize; Restored 8x16 example; 2023-05-17 16:47:55 +03:00
Anton Mukhin
fe0e1dabfd More examples 2023-05-17 15:26:45 +03:00
Anton Mukhin
e0786bdb07 Codepage persists through saved projects now; Fixed Baseline draw 2023-05-17 09:42:57 +03:00
10 changed files with 95 additions and 50 deletions

View File

@@ -88,7 +88,7 @@ namespace McBitFont {
int imin, jmin, imax, jmax, idir, jdir;
if (com) {
//Header comments
// Header comments
output += comments["header"];
output += comments["scan_order"] + cbOrder.Text + "\n";
output += comments["scan_hdir"] + cbHDir.Text + "\n";
@@ -107,7 +107,7 @@ namespace McBitFont {
}
}
//Figure out mins and maxes
// Figure out mins and maxes
if (cbOrder.SelectedIndex == 0) {
if (cbHDir.SelectedIndex == 0) {
// Columns; Left to right

View File

@@ -51,7 +51,7 @@ namespace McBitFont {
public bool monospaced = false;
bool modified = false;
bool prjModified = false;
public const string version = "1.3";
public const string version = "1.6";
public string prjName = "Untitled";
public int codepage = 1251;
private FrameMiniature fbuf;
@@ -89,6 +89,11 @@ namespace McBitFont {
this.Text = "McBitFont " + version + " - " + prjName;
fbuf = new FrameMiniature(0, dotWidth, dotHeight);
// Chek for arguments
if (Environment.GetCommandLineArgs().Length > 1) {
loadProject(Environment.GetCommandLineArgs()[1]);
}
}
[DllImport("user32.dll")]
@@ -141,7 +146,7 @@ namespace McBitFont {
for (int i = 0; i < frames.Count; i++) {
frames[i] = frameResize(frames[i], (int)nudX.Value, dotHeight);
bmp = getMiniPictue(frames[i]);
string s = frames[i].code.ToString();
string s = frames[i].code.ToString().PadLeft(3, '0');
ilMiniatures.Images.RemoveByKey(s);
ilMiniatures.Images.Add(s, (Image)bmp);
miniList.Items[s].ImageKey = s;
@@ -158,11 +163,12 @@ namespace McBitFont {
for (int i = 0; i < frames.Count; i++) {
frames[i] = frameResize(frames[i], dotWidth, (int)nudY.Value);
bmp = getMiniPictue(frames[i]);
string s = frames[i].code.ToString();
string s = frames[i].code.ToString().PadLeft(3, '0');
ilMiniatures.Images.RemoveByKey(s);
ilMiniatures.Images.Add(s, (Image)bmp);
miniList.Items[s].ImageKey = s;
}
if (nudY.Focused) modified = true;
prjModified = true;
dotResize(dotWidth, (int)nudY.Value);
}
@@ -278,17 +284,18 @@ namespace McBitFont {
}
private void dotPanel_MouseMove(object sender, MouseEventArgs e) {
Rectangle rect1, rect2;
if (set_base) {
int yy = pixelOffset + baseline * (cellSize + gap) - vScroll.Value - 1;
Rectangle rect1 = new Rectangle(pixelOffset, yy, w, 3);
rect1 = new Rectangle(pixelOffset, yy, w, 2);
baseline = (e.Y - pixelOffset + vScroll.Value) / (cellSize + gap);
if (baseline >= dotHeight) baseline = dotHeight - 1;
if (baseline < 0) baseline = 0;
yy = pixelOffset + baseline * (cellSize + gap) - vScroll.Value - 1;
Rectangle rect2 = new Rectangle(pixelOffset, yy, w, 3);
rect2 = new Rectangle(pixelOffset, yy, w, 2);
dotPanel.Invalidate(rect1);
dotPanel.Invalidate(rect2);
@@ -309,8 +316,9 @@ namespace McBitFont {
f.data[i, j] = true;
int x = pixelOffset + i * (cellSize + gap) - hScroll.Value;
int y = pixelOffset + j * (cellSize + gap) - vScroll.Value;
g.FillRectangle(sbb, x, y, cellSize, cellSize);
modified = true;
rect1 = new Rectangle(x, y, cellSize, cellSize);
dotPanel.Invalidate(rect1);
}
if (e.Button == MouseButtons.Right && f.data[i, j]) {
Graphics g = dotPanel.CreateGraphics();
@@ -318,8 +326,9 @@ namespace McBitFont {
f.data[i, j] = false;
int x = pixelOffset + i * (cellSize + gap) - hScroll.Value;
int y = pixelOffset + j * (cellSize + gap) - vScroll.Value;
g.FillRectangle(sbw, x, y, cellSize, cellSize);
modified = true;
rect1 = new Rectangle(x, y, cellSize, cellSize);
dotPanel.Invalidate(rect1);
}
}
@@ -473,13 +482,13 @@ namespace McBitFont {
}
if (f.data[i, j]) sb = sbb;
else sb = sbw;
g.FillRectangle(sb, x, y, cellSize, cellSize);
g.FillRectangle(sb, x, (baseline == j ? y+1 : y), cellSize, (baseline == j ? cellSize-1 : cellSize));
}
}
if (baseline > 0 && gap > 0) {
x = pixelOffset - hScroll.Value;
y = pixelOffset + baseline * (cellSize + gap) - vScroll.Value - 1;
y = pixelOffset + baseline * (cellSize + gap) - vScroll.Value;
g.DrawLine(
new Pen(Color.Blue, 2),
x, y,
@@ -571,10 +580,10 @@ namespace McBitFont {
monospaced = form.rbMono.Checked;
}
lblType.Text = monospaced ? "Monospaced" : "Variable width / Single";
codepage = (form.cbEncoding.SelectedItem as New.EncodingItem).Code;
foreach (FrameMiniature ff in frames) {
var s = ff.code.ToString().PadLeft(3, '0');
ilMiniatures.Images.Add(s, (Image)getMiniPictue(ff));
codepage =(form.cbEncoding.SelectedItem as New.EncodingItem).Code;
var sss = decodeSymbol(ff.code);
miniList.Items.Add(s, s+' '+append+sss, s);
}
@@ -583,11 +592,14 @@ namespace McBitFont {
miniList.Refresh();
form.Dispose();
baseline = 0;
prjName = "Untitled";
this.Text = "McBitFont " + version + " - " + prjName;
modified = false;
checkForAdd();
fbuffer = false;
dotPanel.Refresh();
}
}
@@ -625,6 +637,11 @@ namespace McBitFont {
}
private void saveToolStripMenuItem_Click(object sender, EventArgs e) {
if (modified) {
if (MessageBox.Show("Current frame is modified.\nDo you want to apply the changes first?", "The frame was modified!", MessageBoxButtons.YesNo) == DialogResult.Yes) {
saveFrame();
}
}
if (dlgSave.ShowDialog() == DialogResult.OK) {
SaveBlock sav;
sav.monospaced = monospaced;
@@ -642,18 +659,11 @@ namespace McBitFont {
}
}
private void openToolStripMenuItem_Click(object sender, EventArgs e) {
if (prjModified) {
if (MessageBox.Show("The project is modified.\nDo you want to save it first?", "Project was modified!", MessageBoxButtons.YesNo) == DialogResult.Yes) {
saveToolStripMenuItem.PerformClick();
return;
}
}
if (dlgOpen.ShowDialog() == DialogResult.OK) {
private void loadProject(string filename) {
SaveBlock sav;
BinaryFormatter formatter = new BinaryFormatter();
using (FileStream fs = File.Open(dlgOpen.FileName, FileMode.Open)) {
using (FileStream fs = File.Open(filename, FileMode.Open)) {
sav = (SaveBlock)formatter.Deserialize(fs);
fs.Close();
}
@@ -666,8 +676,9 @@ namespace McBitFont {
ilMiniatures.Images.Clear();
foreach (FrameMiniature ff in frames) {
var s = ff.code.ToString().PadLeft(3, '0');
var sss = decodeSymbol(ff.code);
ilMiniatures.Images.Add(s, (Image)getMiniPictue(ff));
miniList.Items.Add(s, s + ' ' + (char)ff.code, s);
miniList.Items.Add(s, s + ' ' + sss, s);
}
nudX.ValueChanged -= nudX_ValueChanged;
nudY.ValueChanged -= nudY_ValueChanged;
@@ -682,11 +693,22 @@ namespace McBitFont {
modified = false;
prjModified = false;
prjName = Path.GetFileNameWithoutExtension(dlgOpen.FileName);
prjName = Path.GetFileNameWithoutExtension(filename);
this.Text = "McBitFont " + version + " - " + prjName;
checkForAdd();
fbuffer = false;
}
private void openToolStripMenuItem_Click(object sender, EventArgs e) {
if (prjModified) {
if (MessageBox.Show("The project is modified.\nDo you want to save it first?", "Project was modified!", MessageBoxButtons.YesNo) == DialogResult.Yes) {
saveToolStripMenuItem.PerformClick();
return;
}
}
if (dlgOpen.ShowDialog() == DialogResult.OK) {
loadProject(dlgOpen.FileName);
}
}
private void removeSymbolToolStripMenuItem_Click(object sender, EventArgs e) {

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Можно задать все значения или принять номера сборки и редакции по умолчанию
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyVersion("1.6.0.0")]
[assembly: AssemblyFileVersion("1.6.0.0")]

23
TODO.txt Normal file
View File

@@ -0,0 +1,23 @@
Application:
- Implement "Save" menu
Functionality:
- Context menu in symbol navigator
- Delete symbols before/after selected
- Shift all symbols on code line (change symbol codes)
- Specify starting code (extends the shift)
- "Only numbers" range in the New dialog
- "Specify range" in the New dialog
- "Single frame", "only numbers" and "specify range" as radio buttons
- Button to Clear/Fill a block
- Undo/Redo
- Image import from a file
- Import from a text array
- Copy-paste to a symbol with different size
- Rectangle selection to mass-paint, shift and mirror pixels
- Change height of variable width fonts with ability to choose which side to add pixels to
- Make it possible to have zero width chars in VarWidth fonts
- "Packed" fonts export
Bugs:
- Every char changes its width to default on VarWidth font height change!

BIN
examples/Font_5x7.mbf Normal file

Binary file not shown.

BIN
examples/Numbers_11x16.mbf Normal file

Binary file not shown.

BIN
examples/Numbers_13x20.mbf Normal file

Binary file not shown.

Binary file not shown.

BIN
examples/helvB08_PREFAB.mbf Normal file

Binary file not shown.

Binary file not shown.