Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

Build the .fon test samples in code instead of committing them

SeoJCalive711e827442b1
diff --git a/docs/ENGINES.md b/docs/ENGINES.md
index c06f5369..e15a3775 100644
--- a/docs/ENGINES.md
+++ b/docs/ENGINES.md
@@ -501,8 +501,8 @@ extension, and the file must then have an NE header with FNT resources.
`tests/Filee.Engines.Tests/FontTests.cs` checks every conversion with small OFL fonts in
`tests/Filee.Engines.Tests/Fonts` (see `OFL.txt` there): round trips keep every table byte for byte, a WOFF2 made
by Google's encoder decodes to the source font, and converted CFF glyphs are compared with the originals in Skia.
-`tests/Filee.Engines.Tests/FonTests.cs` converts the synthetic `Fon-*.fon` samples that `make-test-fon.py` draws
-from pixel art (see `FON-FIXTURES.md`) and compares every rendered glyph with its source bitmap.
+`tests/Filee.Engines.Tests/FonTests.cs` builds synthetic FON samples in code (`FonBuilder`) and compares every
+rendered glyph with its source bitmap.
## DOCX writer
diff --git a/tests/Filee.Cli.Tests/CliTests.cs b/tests/Filee.Cli.Tests/CliTests.cs
index 4c36b21c..3e00d528 100644
--- a/tests/Filee.Cli.Tests/CliTests.cs
+++ b/tests/Filee.Cli.Tests/CliTests.cs
@@ -4,6 +4,7 @@ using System.Buffers.Binary;
using System.Text.Json;
using System.Xml.Linq;
using Filee.Core.Presets;
+using Filee.Engines.Tests;
namespace Filee.Cli.Tests;
@@ -437,19 +438,17 @@ public sealed class CliTests : IDisposable
Assert.True(File.Exists(source));
}
- // ──────────── Windows bitmap fonts (#177): the engine tests' committed samples, linked into this project ────────────
+ // ──────────── Windows bitmap fonts (#177): in-memory samples shared with the engine tests ────────────
private static readonly string[] FontFormats = ["ttf", "otf", "woff", "woff2", "eot"];
- private static string FonSample(string name) => Path.Combine(AppContext.BaseDirectory, "Fonts", name);
-
- /// <summary>Copies a committed sample to <c>Name.fon</c> in this test's folder (or a sub folder of it).</summary>
+ /// <summary>Writes a synthetic sample to <c>Name.fon</c> in this test's folder (or a subfolder).</summary>
private string Fon(string sample, string? folder = null)
{
folder = Path.Combine(_folder, folder ?? "");
Directory.CreateDirectory(folder);
var path = Path.Combine(folder, "Name.fon");
- File.Copy(FonSample(sample), path);
+ File.WriteAllBytes(path, FonBuilder.Sample(sample));
return path;
}
@@ -460,11 +459,11 @@ public sealed class CliTests : IDisposable
}
[Fact]
- public void Committed_fon_samples_are_copied_to_cli_output()
+ public void Generated_fon_samples_are_written_to_cli_input()
{
foreach (var sample in new[] { "Fon-v2-fixed.fon", "Fon-multi.fon" })
{
- var bytes = File.ReadAllBytes(FonSample(sample));
+ var bytes = FonBuilder.Sample(sample);
Assert.Equal("MZ"u8.ToArray(), bytes[..2]);
Assert.Equal(bytes, File.ReadAllBytes(Fon(sample, Path.GetFileNameWithoutExtension(sample))));
}
diff --git a/tests/Filee.Cli.Tests/Filee.Cli.Tests.csproj b/tests/Filee.Cli.Tests/Filee.Cli.Tests.csproj
index fab82bdb..d02ae79a 100644
--- a/tests/Filee.Cli.Tests/Filee.Cli.Tests.csproj
+++ b/tests/Filee.Cli.Tests/Filee.Cli.Tests.csproj
@@ -20,6 +20,6 @@
</ItemGroup>
<ItemGroup>
- <None Include="..\Filee.Engines.Tests\Fonts\Fon-*.fon" Link="Fonts\%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
+ <Compile Include="..\Filee.Engines.Tests\FonBuilder.cs" Link="FonBuilder.cs" />
</ItemGroup>
</Project>
diff --git a/tests/Filee.Engines.Tests/Filee.Engines.Tests.csproj b/tests/Filee.Engines.Tests/Filee.Engines.Tests.csproj
index 6a640661..90946d30 100644
--- a/tests/Filee.Engines.Tests/Filee.Engines.Tests.csproj
+++ b/tests/Filee.Engines.Tests/Filee.Engines.Tests.csproj
@@ -22,7 +22,7 @@
<ItemGroup>
<!-- Small OFL test fonts for FontTests (see Fonts/OFL.txt and Fonts/make-test-fonts.py). -->
- <None Update="Fonts\*.ttf;Fonts\*.otf;Fonts\*.woff2;Fonts\*.fon" CopyToOutputDirectory="PreserveNewest" />
+ <None Update="Fonts\*.ttf;Fonts\*.otf;Fonts\*.woff2" CopyToOutputDirectory="PreserveNewest" />
<!-- Small Shapefiles written by GDAL for the geospatial tests (synthetic data; Geo/make-test-geo.py recreates them). -->
<None Update="Geo\*" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
diff --git a/tests/Filee.Engines.Tests/FonBuilder.cs b/tests/Filee.Engines.Tests/FonBuilder.cs
new file mode 100644
index 00000000..a5232e13
--- /dev/null
+++ b/tests/Filee.Engines.Tests/FonBuilder.cs
@@ -0,0 +1,183 @@
+// Creates FON samples in memory; no font files are checked into the repository.
+
+using System.Numerics;
+
+namespace Filee.Engines.Tests;
+
+internal static class FonBuilder
+{
+ private static void Put(List<byte> data, int offset, ushort value)
+ {
+ data[offset] = (byte)value;
+ data[offset + 1] = (byte)(value >> 8);
+ }
+
+ private static void Put(List<byte> data, int offset, uint value)
+ {
+ Put(data, offset, (ushort)value);
+ Put(data, offset + 2, (ushort)(value >> 16));
+ }
+
+ private static byte[] Fnt(int version, int height = 13, bool fixedWidth = true, int first = 32,
+ int last = 127, int? flags = null)
+ {
+ var count = last - first + 1;
+ var entrySize = version == 2 ? 4 : flags is null ? 6 : 8 + (BitOperations.Log2((uint)flags.Value) - 2) * 2;
+ var table = version == 2 ? 0x76 : 0x94;
+ var face = table + (count + 1) * entrySize;
+ var bits = face + 6;
+ var data = new List<byte>(new byte[bits]);
+ Put(data, 0, (ushort)(version << 8));
+ Put(data, 0x42, (ushort)0);
+ Put(data, 0x4A, (ushort)Math.Min(height, 10));
+ Put(data, 0x4E, (ushort)2);
+ Put(data, 0x53, (ushort)400);
+ data[0x55] = 0;
+ Put(data, 0x56, (ushort)(fixedWidth ? 8 : 0));
+ Put(data, 0x58, (ushort)height);
+ Put(data, 0x5D, (ushort)9);
+ data[0x5F] = (byte)first;
+ data[0x60] = (byte)last;
+ Put(data, 0x69, (uint)face);
+ Put(data, 0x71, (uint)bits);
+ if (version == 3)
+ {
+ Put(data, 0x76, (uint)(flags ?? (fixedWidth ? 1 : 2)));
+ if (flags is not null)
+ {
+ Put(data, 0x7A, (ushort)(flags + 1));
+ Put(data, 0x7C, (ushort)(flags + 2));
+ Put(data, 0x7E, (ushort)(flags + 3));
+ }
+ }
+ for (var i = 0; i < 6; i++)
+ data[face + i] = "Fixed\0"u8[i];
+
+ for (var index = 0; index < count; index++)
+ {
+ var code = first + index;
+ var width = flags is not null ? flags.Value + index % 3 :
+ fixedWidth ? 8 : code == 32 ? 0 : code % 2 == 1 ? 5 : 9;
+ var entry = table + index * entrySize;
+ Put(data, entry, (ushort)width);
+ if (flags is not null)
+ {
+ Put(data, entry + 2, (ushort)(flags + index % 3));
+ Put(data, entry + 4, (uint)data.Count);
+ }
+ else if (version == 2)
+ Put(data, entry + 2, (ushort)data.Count);
+ else
+ Put(data, entry + 2, (uint)data.Count);
+
+ // Pixel art is independent of the reader: a single pixel, diagonal, and hollow box.
+ for (var column = 0; column < (width + 7) / 8; column++)
+ for (var y = 0; y < height; y++)
+ {
+ byte value = 0;
+ for (var bit = 0; bit < 8; bit++)
+ {
+ var x = column * 8 + bit;
+ if (x >= width || code == 32)
+ continue;
+ var rows = Math.Min(height, 7);
+ var lit = code == 33 ? x == 2 && y == 0 :
+ code == 34 ? x == 2 + y % Math.Max(1, width - 2) :
+ x >= 2 && y < rows && (x == 2 || x == width - 1 || y == 0 || y == rows - 1);
+ if (lit)
+ value |= (byte)(0x80 >> bit);
+ }
+ data.Add(value);
+ }
+ }
+ var sentinel = table + count * entrySize;
+ Put(data, sentinel, (ushort)0);
+ if (flags is not null)
+ Put(data, sentinel + 4, (uint)data.Count);
+ else if (version == 2)
+ Put(data, sentinel + 2, (ushort)data.Count);
+ else
+ Put(data, sentinel + 2, (uint)data.Count);
+ Put(data, 2, (uint)data.Count);
+ return [.. data];
+ }
+
+ /// <summary>Writes NE FONTDIR and RT_FONT entries with an optional resource alignment shift.</summary>
+ public static byte[] Container(byte[][] resources, int alignmentShift = 0)
+ {
+ const int ne = 0x40, table = ne + 0x40;
+ var payload = table + 2 + 8 + 12 + 8 + 12 * resources.Length + 2;
+ var data = new List<byte>(new byte[payload]);
+ data[0] = (byte)'M';
+ data[1] = (byte)'Z';
+ Put(data, 0x3C, (uint)ne);
+ data[ne] = (byte)'N';
+ data[ne + 1] = (byte)'E';
+ Put(data, ne + 0x24, (ushort)(table - ne));
+ Put(data, ne + 0x26, (ushort)(payload - ne));
+ Put(data, table, (ushort)alignmentShift);
+ Put(data, table + 2, (ushort)0x8007);
+ Put(data, table + 4, (ushort)1);
+ var unit = 1 << alignmentShift;
+ // The one-byte FONTDIR, like every resource, starts on an alignment unit.
+ while (data.Count % unit != 0)
+ data.Add(0);
+ Put(data, table + 10, (ushort)(data.Count / unit));
+ Put(data, table + 12, (ushort)1);
+ data.Add(0);
+ var fontType = table + 22;
+ Put(data, fontType, (ushort)0x8008);
+ Put(data, fontType + 2, (ushort)resources.Length);
+ for (var index = 0; index < resources.Length; index++)
+ {
+ while (data.Count % unit != 0)
+ data.Add(0);
+ var resource = resources[index];
+ var offset = data.Count / unit;
+ var length = (resource.Length + unit - 1) / unit;
+ if (offset > ushort.MaxValue || length > ushort.MaxValue)
+ throw new ArgumentOutOfRangeException(nameof(resources), "NE resource exceeds WORD range.");
+ var entry = fontType + 8 + index * 12;
+ Put(data, entry, (ushort)offset);
+ Put(data, entry + 2, (ushort)length);
+ Put(data, entry + 6, (ushort)(0x8001 + index));
+ data.AddRange(resource);
+ while (data.Count % unit != 0)
+ data.Add(0);
+ }
+ return [.. data];
+ }
+
+ /// <summary>Builds the fixed-width FNT v2 sample.</summary>
+ public static byte[] V2Fixed() => Container([Fnt(2)]);
+ /// <summary>Builds the proportional FNT v2 sample with control characters.</summary>
+ public static byte[] V2Proportional() => Container([Fnt(2, fixedWidth: false, first: 0)]);
+ /// <summary>Builds the fixed-width FNT v3 sample.</summary>
+ public static byte[] V3Fixed() => Container([Fnt(3)]);
+ /// <summary>Builds the proportional FNT v3 sample.</summary>
+ public static byte[] V3Proportional() => Container([Fnt(3, fixedWidth: false)]);
+ /// <summary>Builds three strikes, two at the same height.</summary>
+ public static byte[] Multi() => Container([Fnt(2), Fnt(3), Fnt(3, 14)]);
+ /// <summary>Builds the one- and 256-pixel strikes.</summary>
+ public static byte[] Edge() => Container([Fnt(3, 1, first: 32, last: 34), Fnt(3, 256, first: 32, last: 34)]);
+ /// <summary>Builds a v3 resource with the given unsupported glyph table flags.</summary>
+ public static byte[] V3Flags(int flag) => Container([Fnt(3, flags: flag)]);
+
+ /// <summary>Returns one of the twelve named synthetic samples.</summary>
+ public static byte[] Sample(string name) => name switch
+ {
+ "Fon-v2-fixed.fon" => V2Fixed(),
+ "Fon-v2-proportional.fon" => V2Proportional(),
+ "Fon-v3-fixed.fon" => V3Fixed(),
+ "Fon-v3-proportional.fon" => V3Proportional(),
+ "Fon-multi.fon" => Multi(),
+ "Fon-edge.fon" => Edge(),
+ "Fon-v3-flags-04.fon" => V3Flags(0x04),
+ "Fon-v3-flags-08.fon" => V3Flags(0x08),
+ "Fon-v3-flags-10.fon" => V3Flags(0x10),
+ "Fon-v3-flags-20.fon" => V3Flags(0x20),
+ "Fon-v3-flags-40.fon" => V3Flags(0x40),
+ "Fon-v3-flags-80.fon" => V3Flags(0x80),
+ _ => throw new ArgumentOutOfRangeException(nameof(name)),
+ };
+}
diff --git a/tests/Filee.Engines.Tests/FonTests.cs b/tests/Filee.Engines.Tests/FonTests.cs
index dabb7065..638a02ae 100644
--- a/tests/Filee.Engines.Tests/FonTests.cs
+++ b/tests/Filee.Engines.Tests/FonTests.cs
@@ -1,6 +1,5 @@
-// Windows bitmap FON (NE + FNT v2/v3) to TTF/OTF/WOFF/WOFF2/EOT (issue #177). The committed Fonts/Fon-*.fon files are
-// synthetic, made by Fonts/make-test-fon.py; the expected pixels below are written from that generator's art, never
-// from the engine's own reader.
+// Windows bitmap FON (NE + FNT v2/v3) to TTF/OTF/WOFF/WOFF2/EOT (issue #177). FonBuilder creates
+// synthetic samples in memory; the expected pixels below are independent of the engine's reader.
using System.Buffers.Binary;
using System.Globalization;
@@ -17,9 +16,7 @@ public class FonTests(EngineFixture fx) : IClassFixture<EngineFixture>
{
private static readonly string[] Formats = ["ttf", "otf", "woff", "woff2", "eot"];
- private static string Sample(string name) => Path.Combine(AppContext.BaseDirectory, "Fonts", name);
-
- private static byte[] Data(string name) => File.ReadAllBytes(Sample(name));
+ private static byte[] Data(string name) => FonBuilder.Sample(name);
private static int FntStart(byte[] data, int resource = 0)
{
@@ -31,7 +28,7 @@ public class FonTests(EngineFixture fx) : IClassFixture<EngineFixture>
// ───────────────────────── The generator's art, independent of the reader ─────────────────────────
- /// <summary>One committed single-resource sample: FNT version, fixed or proportional, first character.</summary>
+ /// <summary>One synthetic single-resource sample: FNT version, fixed or proportional, first character.</summary>
public sealed record Kind(string File, bool Fixed, int First);
private static readonly Kind[] Kinds =
@@ -70,7 +67,7 @@ public class FonTests(EngineFixture fx) : IClassFixture<EngineFixture>
[InlineData("Fon-v3-proportional.fon", 0x300, 0)]
[InlineData("Fon-multi.fon", 0x200, 8)]
[InlineData("Fon-edge.fon", 0x300, 8)]
- public void Committed_fon_samples_are_copied_to_test_output(string name, int version, int width)
+ public void Generated_fon_samples_have_expected_resources(string name, int version, int width)
{
var bytes = Data(name);
Assert.Equal("MZ", Encoding.ASCII.GetString(bytes, 0, 2));
@@ -81,6 +78,23 @@ public class FonTests(EngineFixture fx) : IClassFixture<EngineFixture>
Assert.Equal("Fixed", strikes[0].Face);
}
+ [Fact]
+ public void Aligned_ne_container_keeps_resource_lengths_inside_file()
+ {
+ var sample = FonBuilder.V2Fixed();
+ var bytes = FonBuilder.Container([Resource(sample, 0)], alignmentShift: 9);
+ // FONTDIR (first entry at 0x8A) and RT_FONT (0x9E) both resolve inside the file in 512-byte units.
+ foreach (var entry in new[] { 0x80 + 10, 0x80 + 30 })
+ {
+ var offset = BitConverter.ToUInt16(bytes, entry) << 9;
+ var length = BitConverter.ToUInt16(bytes, entry + 2) << 9;
+ Assert.InRange(offset, 0x100, bytes.Length - length);
+ }
+ var strike = Assert.Single(FonReader.Read(bytes, TestContext.Current.CancellationToken));
+ Assert.Equal(0x200, strike.Version);
+ Assert.Equal(13, strike.PixelHeight);
+ }
+
/// <summary>A folder holding <paramref name="data"/> as <c>Name.fon</c>.</summary>
private string Source(byte[] data, out string folder)
{
@@ -308,7 +322,7 @@ public class FonTests(EngineFixture fx) : IClassFixture<EngineFixture>
[Fact]
public void Cmap_excludes_controls_and_undefined_bytes_without_losing_glyphs()
{
- // 0x00..0x7F from the committed sample: controls 0x00..0x1F and DEL 0x7F keep glyphs but no cmap entry.
+ // 0x00..0x7F from the generated sample: controls 0x00..0x1F and DEL 0x7F keep glyphs but no cmap entry.
var strike = Assert.Single(FonReader.Read(Data("Fon-v2-proportional.fon"), TestContext.Current.CancellationToken));
var font = FonOutlineBuilder.Build(strike, TestContext.Current.CancellationToken);
var glyphs = GlyfTable.ReadAll(font);
@@ -697,7 +711,7 @@ public class FonTests(EngineFixture fx) : IClassFixture<EngineFixture>
return fon[start..(start + BinaryPrimitives.ReadUInt16LittleEndian(fon.AsSpan(entry + 2)))];
}
- /// <summary>MZ/NE with a FONTDIR and the given RT_FONT resources (the layout of make-test-fon.py).</summary>
+ /// <summary>MZ/NE with a FONTDIR and the given RT_FONT resources.</summary>
private static byte[] Container(params byte[][] resources)
{
const int ne = 0x40, table = ne + 0x40;
diff --git a/tests/Filee.Engines.Tests/Fonts/FON-FIXTURES.md b/tests/Filee.Engines.Tests/Fonts/FON-FIXTURES.md
deleted file mode 100644
index b9a3384c..00000000
--- a/tests/Filee.Engines.Tests/Fonts/FON-FIXTURES.md
+++ /dev/null
@@ -1,31 +0,0 @@
-# Synthetic FON test fixtures
-
-`make-test-fon.py` builds NE RT_FONT containers with FNT v2/v3 resources from pixel art defined in the script. No
-bytes or outlines are taken from any existing font, so the samples are original synthetic data under the project's
-MIT licence. The tests read only the committed files and never run the generator.
-
-Rebuild: `uv run tests/Filee.Engines.Tests/Fonts/make-test-fon.py`
-
-Check: `sha256sum tests/Filee.Engines.Tests/Fonts/Fon-*.fon`
-
-| File | SHA-256 |
-|---|---|
-| Fon-v2-fixed.fon | `3b1b05572ba5ce6e0c011e5fb7bcc9ecedf367abd1d58fdb31dca161ca75e9f4` |
-| Fon-v2-proportional.fon | `802ec675899d50afd8b22907a505c8029cb837d555b59dac76492267e977d4b2` |
-| Fon-v3-fixed.fon | `ebc793d05862802a57ee2af3d2abd7425bd97a2957e3f4fd449a50863a8804a8` |
-| Fon-v3-proportional.fon | `0744fc346722abd93f735a6bc42540ccdb5248b703d196d1b5c4dd957b88525d` |
-| Fon-multi.fon | `e1f5379b11a5d4bddcfbb5b7c03c08556d8bb32528e973e58fcecb3290697273` |
-| Fon-edge.fon | `fa8dd5d6424850d6054ae89685cffae30ab2b5757d13be86b97c8d3b24dd8b09` |
-| Fon-v3-flags-04.fon | `6c789389ed490fd4f88dd1e67329ba10464cd76e0c22c1acb95eebf17142f03e` |
-| Fon-v3-flags-08.fon | `c7f99f904af5d83d9b47603fe13645c701bca7ef1c22f362f181c1d506d0d6a3` |
-| Fon-v3-flags-10.fon | `6e5538d1cf78a776f4631861da563163bcd087f7205ebd8898171a6f00071917` |
-| Fon-v3-flags-20.fon | `c218cd58e2bfb33653cf0726137f4c6eb6943c73866d815c72feb43e8f77d58d` |
-| Fon-v3-flags-40.fon | `86caba38ada299971ca997b458e6c15162f3765149aec8070ce1d7bb79d73365` |
-| Fon-v3-flags-80.fon | `89f79b840576b013100e39f87fc306c71d5b161be6bc9eec77e8f5eafa965d5b` |
-
-The basic samples cover 0x20..0x7F at 13 px; only the v2 proportional sample also holds the control codes
-0x00..0x1F. The space is blank, `!` is a single pixel at `(2,0)`, `"` is a diagonal, and every other glyph is a
-framed rectilinear shape. Proportional widths are 0 px for the space, 9 px for even codes and 5 px for odd codes.
-`Fon-multi.fon` holds 13, 13 and 14 px resources, and `Fon-edge.fon` holds 1 and 256 px resources. The flag samples
-check that unsupported v3 dfFlags are rejected; each uses a glyph table entry size, widths and offsets that differ
-from the allowed 6-byte table. The external `fixed.fon` and `tektite.fon` are not included.
diff --git a/tests/Filee.Engines.Tests/Fonts/Fon-edge.fon b/tests/Filee.Engines.Tests/Fonts/Fon-edge.fon
deleted file mode 100644
index 3e5ff6d9..00000000
Binary files a/tests/Filee.Engines.Tests/Fonts/Fon-edge.fon and /dev/null differ
diff --git a/tests/Filee.Engines.Tests/Fonts/Fon-multi.fon b/tests/Filee.Engines.Tests/Fonts/Fon-multi.fon
deleted file mode 100644
index 98a152f4..00000000
Binary files a/tests/Filee.Engines.Tests/Fonts/Fon-multi.fon and /dev/null differ
diff --git a/tests/Filee.Engines.Tests/Fonts/Fon-v2-fixed.fon b/tests/Filee.Engines.Tests/Fonts/Fon-v2-fixed.fon
deleted file mode 100644
index e141989c..00000000
Binary files a/tests/Filee.Engines.Tests/Fonts/Fon-v2-fixed.fon and /dev/null differ
diff --git a/tests/Filee.Engines.Tests/Fonts/Fon-v2-proportional.fon b/tests/Filee.Engines.Tests/Fonts/Fon-v2-proportional.fon
deleted file mode 100644
index e9ae81e9..00000000
Binary files a/tests/Filee.Engines.Tests/Fonts/Fon-v2-proportional.fon and /dev/null differ
diff --git a/tests/Filee.Engines.Tests/Fonts/Fon-v3-fixed.fon b/tests/Filee.Engines.Tests/Fonts/Fon-v3-fixed.fon
deleted file mode 100644
index 298e1887..00000000
Binary files a/tests/Filee.Engines.Tests/Fonts/Fon-v3-fixed.fon and /dev/null differ
diff --git a/tests/Filee.Engines.Tests/Fonts/Fon-v3-flags-04.fon b/tests/Filee.Engines.Tests/Fonts/Fon-v3-flags-04.fon
deleted file mode 100644
index 344c5192..00000000
Binary files a/tests/Filee.Engines.Tests/Fonts/Fon-v3-flags-04.fon and /dev/null differ
diff --git a/tests/Filee.Engines.Tests/Fonts/Fon-v3-flags-08.fon b/tests/Filee.Engines.Tests/Fonts/Fon-v3-flags-08.fon
deleted file mode 100644
index c241cefa..00000000
Binary files a/tests/Filee.Engines.Tests/Fonts/Fon-v3-flags-08.fon and /dev/null differ
diff --git a/tests/Filee.Engines.Tests/Fonts/Fon-v3-flags-10.fon b/tests/Filee.Engines.Tests/Fonts/Fon-v3-flags-10.fon
deleted file mode 100644
index abfc2685..00000000
Binary files a/tests/Filee.Engines.Tests/Fonts/Fon-v3-flags-10.fon and /dev/null differ
diff --git a/tests/Filee.Engines.Tests/Fonts/Fon-v3-flags-20.fon b/tests/Filee.Engines.Tests/Fonts/Fon-v3-flags-20.fon
deleted file mode 100644
index daaa906d..00000000
Binary files a/tests/Filee.Engines.Tests/Fonts/Fon-v3-flags-20.fon and /dev/null differ
diff --git a/tests/Filee.Engines.Tests/Fonts/Fon-v3-flags-40.fon b/tests/Filee.Engines.Tests/Fonts/Fon-v3-flags-40.fon
deleted file mode 100644
index dfa07c58..00000000
Binary files a/tests/Filee.Engines.Tests/Fonts/Fon-v3-flags-40.fon and /dev/null differ
diff --git a/tests/Filee.Engines.Tests/Fonts/Fon-v3-flags-80.fon b/tests/Filee.Engines.Tests/Fonts/Fon-v3-flags-80.fon
deleted file mode 100644
index a3eddf0d..00000000
Binary files a/tests/Filee.Engines.Tests/Fonts/Fon-v3-flags-80.fon and /dev/null differ
diff --git a/tests/Filee.Engines.Tests/Fonts/Fon-v3-proportional.fon b/tests/Filee.Engines.Tests/Fonts/Fon-v3-proportional.fon
deleted file mode 100644
index f6327a63..00000000
Binary files a/tests/Filee.Engines.Tests/Fonts/Fon-v3-proportional.fon and /dev/null differ
diff --git a/tests/Filee.Engines.Tests/Fonts/make-test-fon.py b/tests/Filee.Engines.Tests/Fonts/make-test-fon.py
deleted file mode 100644
index 64df49e8..00000000
--- a/tests/Filee.Engines.Tests/Fonts/make-test-fon.py
+++ /dev/null
@@ -1,136 +0,0 @@
-#!/usr/bin/env -S uv run --script
-# /// script
-# requires-python = ">=3.10"
-# dependencies = []
-# ///
-# How to run: uv run tests/Filee.Engines.Tests/Fonts/make-test-fon.py
-# Rebuild committed synthetic fixtures only when changing the generator; tests never run it.
-
-from __future__ import annotations
-
-import hashlib
-import struct
-from pathlib import Path
-
-HERE = Path(__file__).resolve().parent
-
-
-def put(data: bytearray, offset: int, fmt: str, value: int) -> None:
- struct.pack_into("<" + fmt, data, offset, value)
-
-
-def fnt(version: int, height: int = 13, *, fixed: bool = True, first: int = 32,
- last: int = 127, flags: int | None = None) -> bytes:
- """Create a complete, independent FNT resource with column-major bitmaps."""
- count = last - first + 1
- # Rejected flag samples deliberately do not have the allowed 6-byte table.
- entry_size = 4 if version == 2 else 6 if flags is None else 8 + (flags.bit_length() - 3) * 2
- table = 0x76 if version == 2 else 0x94
- face = table + (count + 1) * entry_size
- bits = face + len(b"Fixed\0")
- data = bytearray(bits)
- put(data, 0, "H", version << 8)
- put(data, 0x42, "H", 0)
- put(data, 0x4A, "H", min(height, 10))
- put(data, 0x4E, "H", 2)
- put(data, 0x53, "H", 400)
- data[0x55] = 0
- put(data, 0x56, "H", 8 if fixed else 0)
- put(data, 0x58, "H", height)
- put(data, 0x5D, "H", 9)
- data[0x5F:0x63] = bytes((first, last, 0, 0))
- put(data, 0x69, "I", face)
- put(data, 0x71, "I", bits)
- if version == 3:
- put(data, 0x76, "I", flags if flags is not None else (1 if fixed else 2))
- if flags is not None:
- put(data, 0x7A, "H", flags + 1)
- put(data, 0x7C, "H", flags + 2)
- put(data, 0x7E, "H", flags + 3)
- data[face:bits] = b"Fixed\0"
-
- for index, code in enumerate(range(first, last + 1)):
- width = (flags + index % 3) if flags is not None else (
- 8 if fixed else (0 if code == 32 else 5 if code % 2 else 9))
- entry = table + index * entry_size
- put(data, entry, "H", width)
- if flags is not None:
- put(data, entry + 2, "H", flags + index % 3)
- put(data, entry + 4, "I", len(data))
- else:
- put(data, entry + 2, "H" if version == 2 else "I", len(data))
- # x=2 creates a left bearing; an isolated pixel, diagonal and hole are
- # defined independently of the parser. Space and zero-width glyphs are blank.
- for column in range((width + 7) // 8):
- for y in range(height):
- value = 0
- for bit in range(8):
- x = column * 8 + bit
- if x >= width or code == 32:
- continue
- lit = (code == 33 and x == 2 and y == 0) or (
- code == 34 and x == 2 + y % max(1, width - 2)) or (
- code != 33 and code != 34 and
- 2 <= x < width and y < min(height, 7) and
- (x in (2, width - 1) or y in (0, min(height, 7) - 1)))
- if lit:
- value |= 0x80 >> bit
- data.append(value)
- sentinel = table + count * entry_size
- put(data, sentinel, "H", 0)
- put(data, sentinel + (4 if flags is not None else 2),
- "I" if flags is not None or version == 3 else "H", len(data))
- put(data, 2, "I", len(data))
- return bytes(data)
-
-
-def fon(resources: list[bytes]) -> bytes:
- """Write MZ/NE, a FONTDIR entry, RT_FONT entries, and aligned FNT payloads."""
- ne = 0x40
- table = ne + 0x40
- payload = table + 2 + 8 + 12 + 8 + 12 * len(resources) + 2
- data = bytearray(payload)
- data[:2] = b"MZ"
- put(data, 0x3C, "I", ne)
- data[ne:ne + 2] = b"NE"
- put(data, ne + 0x24, "H", table - ne)
- put(data, ne + 0x26, "H", payload - ne)
- put(data, table + 2, "H", 0x8007)
- put(data, table + 4, "H", 1)
- put(data, table + 10, "H", len(data))
- put(data, table + 12, "H", 1)
- data.append(0)
- font_type = table + 22
- put(data, font_type, "H", 0x8008)
- put(data, font_type + 2, "H", len(resources))
- for index, resource in enumerate(resources):
- if len(data) > 0xFFFF or len(resource) > 0xFFFF:
- raise OverflowError("NE unshifted resource exceeds WORD range")
- entry = font_type + 8 + index * 12
- put(data, entry, "H", len(data))
- put(data, entry + 2, "H", len(resource))
- put(data, entry + 6, "H", 0x8001 + index)
- data.extend(resource)
- return bytes(data)
-
-
-def main() -> None:
- samples = {
- "Fon-v2-fixed.fon": [fnt(2)],
- "Fon-v2-proportional.fon": [fnt(2, fixed=False, first=0)],
- "Fon-v3-fixed.fon": [fnt(3)],
- "Fon-v3-proportional.fon": [fnt(3, fixed=False)],
- "Fon-multi.fon": [fnt(2), fnt(3), fnt(3, 14)],
- "Fon-edge.fon": [fnt(3, 1, first=32, last=34), fnt(3, 256, first=32, last=34)],
- }
- for flag in (0x04, 0x08, 0x10, 0x20, 0x40, 0x80):
- samples[f"Fon-v3-flags-{flag:02x}.fon"] = [fnt(3, flags=flag)]
- for name, resources in samples.items():
- path = HERE / name
- contents = fon(resources)
- path.write_bytes(contents)
- print(f"{hashlib.sha256(contents).hexdigest()} {path.name}")
-
-
-if __name__ == "__main__":
- main()