TODO feature: Change height of variable width fonts with ability to choose which side to add pixels to

This commit is contained in:
2025-05-18 03:15:10 +03:00
parent 5164060ffc
commit f2b01d4a27
3 changed files with 47 additions and 31 deletions

View File

@@ -78,6 +78,8 @@
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.btnClear = new System.Windows.Forms.Button();
this.ClearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.chkLeftSide = new System.Windows.Forms.CheckBox();
this.chkTopSide = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.nudX)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudY)).BeginInit();
this.panel1.SuspendLayout();
@@ -103,14 +105,14 @@
// nudX
//
this.nudX.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.nudX.Location = new System.Drawing.Point(717, 27);
this.nudX.Location = new System.Drawing.Point(666, 27);
this.nudX.Maximum = new decimal(new int[] {
255,
0,
0,
0});
this.nudX.Name = "nudX";
this.nudX.Size = new System.Drawing.Size(55, 20);
this.nudX.Size = new System.Drawing.Size(40, 20);
this.nudX.TabIndex = 1;
this.toolTip1.SetToolTip(this.nudX, "Symbol width");
this.nudX.Value = new decimal(new int[] {
@@ -123,7 +125,7 @@
// nudY
//
this.nudY.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.nudY.Location = new System.Drawing.Point(717, 49);
this.nudY.Location = new System.Drawing.Point(666, 49);
this.nudY.Maximum = new decimal(new int[] {
255,
0,
@@ -135,7 +137,7 @@
0,
0});
this.nudY.Name = "nudY";
this.nudY.Size = new System.Drawing.Size(55, 20);
this.nudY.Size = new System.Drawing.Size(40, 20);
this.nudY.TabIndex = 2;
this.toolTip1.SetToolTip(this.nudY, "Symbol height");
this.nudY.Value = new decimal(new int[] {
@@ -149,7 +151,7 @@
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(673, 29);
this.label1.Location = new System.Drawing.Point(622, 29);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(38, 13);
this.label1.TabIndex = 3;
@@ -159,7 +161,7 @@
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(670, 51);
this.label2.Location = new System.Drawing.Point(619, 51);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(41, 13);
this.label2.TabIndex = 4;
@@ -193,7 +195,7 @@
"40",
"45",
"50"});
this.cbZoom.Location = new System.Drawing.Point(605, 45);
this.cbZoom.Location = new System.Drawing.Point(554, 45);
this.cbZoom.Name = "cbZoom";
this.cbZoom.Size = new System.Drawing.Size(59, 21);
this.cbZoom.TabIndex = 6;
@@ -205,7 +207,7 @@
//
this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(604, 29);
this.label4.Location = new System.Drawing.Point(553, 29);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(62, 13);
this.label4.TabIndex = 7;
@@ -701,11 +703,35 @@
this.ClearToolStripMenuItem.Text = "Clear canvas";
this.ClearToolStripMenuItem.Click += new System.EventHandler(this.btnClear_Click);
//
// chkLeftSide
//
this.chkLeftSide.AutoSize = true;
this.chkLeftSide.Location = new System.Drawing.Point(712, 29);
this.chkLeftSide.Name = "chkLeftSide";
this.chkLeftSide.Size = new System.Drawing.Size(66, 17);
this.chkLeftSide.TabIndex = 19;
this.chkLeftSide.Text = "Left side";
this.toolTip1.SetToolTip(this.chkLeftSide, "Width changes will be made on Left/Right side");
this.chkLeftSide.UseVisualStyleBackColor = true;
//
// chkTopSide
//
this.chkTopSide.AutoSize = true;
this.chkTopSide.Location = new System.Drawing.Point(712, 50);
this.chkTopSide.Name = "chkTopSide";
this.chkTopSide.Size = new System.Drawing.Size(67, 17);
this.chkTopSide.TabIndex = 20;
this.chkTopSide.Text = "Top side";
this.toolTip1.SetToolTip(this.chkTopSide, "Height changes will be made on Top/Bottom side");
this.chkTopSide.UseVisualStyleBackColor = true;
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(784, 561);
this.Controls.Add(this.chkTopSide);
this.Controls.Add(this.chkLeftSide);
this.Controls.Add(this.btnBaseline);
this.Controls.Add(this.btnApply);
this.Controls.Add(this.btnExport);
@@ -796,6 +822,8 @@
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.Button btnClear;
private System.Windows.Forms.ToolStripMenuItem ClearToolStripMenuItem;
private System.Windows.Forms.CheckBox chkLeftSide;
private System.Windows.Forms.CheckBox chkTopSide;
}
}

View File

@@ -177,20 +177,24 @@ namespace McBitFont {
private FrameMiniature frameResize(FrameMiniature ff, int neww, int newh) {
int oldw = ff.width;
int oldh = ff.height;
int di = 0, dj = 0;
int imax, jmax;
bool[,] t;
if (neww < oldw) imax = neww;
else imax = oldw;
if (newh < oldh) jmax = newh;
else jmax = oldh;
if (chkLeftSide.Checked) di = oldw - neww;
if (chkTopSide.Checked) dj = oldh - newh;
imax = (neww < oldw) ? neww : oldw;
jmax = (newh < oldh) ? newh : oldh;
if (neww > oldw) imax -= di;
if (newh > oldh) jmax -= dj;
ff.width = neww;
ff.height = newh;
t = new bool[neww, newh];
for (int i=0; i<imax; i++) {
for (int j=0;j<jmax; j++) {
t[i, j] = ff.data[i, j];
if (i+di >= 0 && j+dj >= 0) t[i, j] = ff.data[i + di, j + dj];
}
}
ff.data = t;
@@ -199,23 +203,7 @@ namespace McBitFont {
}
private void dotResize(int ww, int hh) {
int imax, jmax;
bool[,] t;
if (ww < dotWidth) imax = ww;
else imax = dotWidth;
if (hh < dotHeight) jmax = hh;
else jmax = dotHeight;
f.width = ww;
f.height = hh;
t = new bool[ww, hh];
for (int i=0; i<imax; i++) {
for (int j=0; j<jmax; j++) {
t[i, j] = f.data[i, j];
}
}
f.data = t;
f = frameResize(f, ww, hh);
dotWidth = ww;
dotHeight = hh;
w = pixelOffset + dotWidth * (cellSize + gap);

View File

@@ -16,7 +16,7 @@ V Button to Clear/Fill a block
- Import from a text array
V 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
V Change height of variable width fonts with ability to choose which side to add pixels to
V Make it possible to have zero width chars in VarWidth fonts
- "Packed" fonts export
V Tooltips on main form