Font tester screenshot; Font tester UI fixes

This commit is contained in:
Anton Mukhin
2025-05-29 10:40:13 +03:00
parent 6c32edac6e
commit 92027a0ee3
4 changed files with 23 additions and 11 deletions

View File

@@ -70,9 +70,10 @@
// tbText
//
tbText.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
tbText.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
tbText.Location = new System.Drawing.Point(12, 55);
tbText.Name = "tbText";
tbText.Size = new System.Drawing.Size(220, 23);
tbText.Size = new System.Drawing.Size(260, 29);
tbText.TabIndex = 3;
toolTip1.SetToolTip(tbText, "Text to test the font with");
tbText.TextChanged += Text_Changed;
@@ -83,10 +84,10 @@
dotPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
dotPanel.BackColor = System.Drawing.Color.White;
dotPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
dotPanel.Location = new System.Drawing.Point(12, 84);
dotPanel.Location = new System.Drawing.Point(12, 90);
dotPanel.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
dotPanel.Name = "dotPanel";
dotPanel.Size = new System.Drawing.Size(198, 104);
dotPanel.Size = new System.Drawing.Size(238, 98);
dotPanel.TabIndex = 4;
dotPanel.Paint += PaintPixels;
dotPanel.Resize += ZoomChanged;
@@ -95,7 +96,7 @@
//
vScroll.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
vScroll.LargeChange = 25;
vScroll.Location = new System.Drawing.Point(211, 84);
vScroll.Location = new System.Drawing.Point(251, 84);
vScroll.Name = "vScroll";
vScroll.Size = new System.Drawing.Size(21, 125);
vScroll.TabIndex = 17;
@@ -106,14 +107,14 @@
hScroll.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
hScroll.Location = new System.Drawing.Point(12, 188);
hScroll.Name = "hScroll";
hScroll.Size = new System.Drawing.Size(198, 21);
hScroll.Size = new System.Drawing.Size(238, 21);
hScroll.TabIndex = 16;
hScroll.ValueChanged += Scrolling;
//
// lblZoom
//
lblZoom.AutoSize = true;
lblZoom.Location = new System.Drawing.Point(133, 9);
lblZoom.Location = new System.Drawing.Point(173, 9);
lblZoom.Name = "lblZoom";
lblZoom.Size = new System.Drawing.Size(42, 15);
lblZoom.TabIndex = 18;
@@ -124,7 +125,7 @@
cbZoom.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
cbZoom.FormattingEnabled = true;
cbZoom.Items.AddRange(new object[] { "2", "3", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50" });
cbZoom.Location = new System.Drawing.Point(182, 6);
cbZoom.Location = new System.Drawing.Point(222, 6);
cbZoom.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
cbZoom.Name = "cbZoom";
cbZoom.Size = new System.Drawing.Size(50, 23);
@@ -136,18 +137,19 @@
// chkBaseline
//
chkBaseline.AutoSize = true;
chkBaseline.Location = new System.Drawing.Point(163, 36);
chkBaseline.Location = new System.Drawing.Point(203, 36);
chkBaseline.Name = "chkBaseline";
chkBaseline.Size = new System.Drawing.Size(69, 19);
chkBaseline.TabIndex = 20;
chkBaseline.Text = "Baseline";
chkBaseline.UseVisualStyleBackColor = true;
chkBaseline.CheckedChanged += Scrolling;
//
// FontTester
//
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
ClientSize = new System.Drawing.Size(244, 221);
ClientSize = new System.Drawing.Size(284, 221);
Controls.Add(chkBaseline);
Controls.Add(cbZoom);
Controls.Add(lblZoom);

View File

@@ -19,6 +19,7 @@ namespace McBitFont {
private readonly int absentWidth = 5;
private readonly int pixelOffset = 5;
private int baselineThickness = 1;
private byte[] encoded = [];
private int cellSize;
private int width;
@@ -45,7 +46,7 @@ namespace McBitFont {
SolidBrush sbp = new SolidBrush(Color.LightPink);
SolidBrush sb;
Pen blackPen = new(Color.Black);
Pen bluePen = new(Color.FromArgb(100, 20, 20, 200), 1);
Pen bluePen = new(Color.FromArgb(100, 20, 20, 200), baselineThickness);
int x, y, i, j;
// Sycle through ecoded bytes of test text
@@ -82,7 +83,7 @@ namespace McBitFont {
if (chkBaseline.Checked && baseline > 0) {
x = pixelOffset - hScroll.Value;
y = pixelOffset + baseline * cellSize - vScroll.Value;
g.DrawLine(bluePen, x, y, dotPanel.Width - pixelOffset, y);
g.DrawLine(bluePen, x, y, dotPanel.Width - 2 * pixelOffset, y);
}
}
@@ -123,6 +124,11 @@ namespace McBitFont {
vScroll.Enabled = true;
}
// Baseline thickness calc
baselineThickness = cellSize / 5;
if (baselineThickness > 5) baselineThickness = 5;
if (baselineThickness < 1) baselineThickness = 1;
dotPanel.Refresh();
}

View File

@@ -37,6 +37,10 @@ New project dialog
![New project](/images/Screenshot_New.png)
Font test dialog
![Font tester](/images/Screenshot_Font-tester.png)
Export dialog
![Export](/images/Screenshot_Export.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB