Skip to content
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
be8329f
Add a managed TrueType reader for text on every platform (#412)
claude Oct 15, 2026
cb05b5b
Get the fonts of texts from a font service of the kernel instead of G…
claude Oct 15, 2026
fc5326e
Read the CFF outlines of OpenType fonts in the managed font reader (#…
claude Oct 15, 2026
5e7a0be
Read variable fonts: gvar, CFF2, avar and HVAR (#412)
claude Oct 15, 2026
4d939ef
Compare the managed font reader with GDI on Windows (#412)
claude Oct 15, 2026
e08061f
Find a family by the name GDI cuts to 31 characters (#412)
claude Oct 15, 2026
318a1ed
Lay out glyphs, metrics and decorations like GDI (#412)
claude Oct 15, 2026
191927d
Name and measure variable instances like Windows (#412)
claude Oct 15, 2026
b30fcd0
Correct the documentation of HasOutlines and HasCffOutlines for CFF2 …
claude Oct 15, 2026
1d19182
Merge branch 'feature/variable-fonts' into feature/gdi-glyph-comparison
claude Oct 15, 2026
a4de85a
Test texts without frame or GDI: save, export, finalizers (#412)
claude Oct 15, 2026
3f1eb39
Merge master into feature/font-service
claude Oct 17, 2026
415fea4
Merge branch 'feature/font-service' into feature/cff-outlines
claude Oct 17, 2026
9a17a7b
Merge branch 'feature/cff-outlines' into feature/variable-fonts
claude Oct 17, 2026
95efb36
Merge branch 'feature/variable-fonts' into feature/gdi-glyph-comparison
claude Oct 17, 2026
020713a
Merge branch 'feature/gdi-glyph-comparison' into test/headless-text-e…
claude Oct 17, 2026
8d22a3f
Adapt the font cache test of #497 to the font service (#412)
claude Oct 17, 2026
8e4900a
Merge branch 'feature/font-service' into feature/cff-outlines
claude Oct 17, 2026
1e56c2e
Merge branch 'feature/cff-outlines' into feature/variable-fonts
claude Oct 17, 2026
1496f3b
Merge branch 'feature/variable-fonts' into feature/gdi-glyph-comparison
claude Oct 17, 2026
d90108c
Merge branch 'feature/gdi-glyph-comparison' into test/headless-text-e…
claude Oct 17, 2026
83debf3
Merge remote-tracking branch 'origin/master' into feature/managed-fon…
claude Oct 19, 2026
830f757
Merge remote-tracking branch 'origin/feature/managed-font-provider' i…
claude Oct 19, 2026
3163749
Pass Unicode code points instead of chars to FontFace (#412)
claude Oct 19, 2026
3e640f2
Merge branch 'feature/font-service' into feature/cff-outlines
claude Oct 19, 2026
8a07d38
Merge branch 'feature/cff-outlines' into feature/variable-fonts
claude Oct 19, 2026
23aa919
Merge branch 'feature/variable-fonts' into feature/gdi-glyph-comparison
claude Oct 19, 2026
cacc4d0
Merge branch 'feature/gdi-glyph-comparison' into test/headless-text-e…
claude Oct 19, 2026
ac0ad17
Lock the shared sets of the parallel STEP import
claude Oct 19, 2026
c54ed31
Merge branch 'feature/managed-font-provider' into feature/font-service
claude Oct 19, 2026
5b325e3
Merge branch 'feature/font-service' into feature/cff-outlines
claude Oct 19, 2026
6b5e200
Merge branch 'feature/cff-outlines' into feature/variable-fonts
claude Oct 19, 2026
cfd97de
Merge branch 'feature/variable-fonts' into feature/gdi-glyph-comparison
claude Oct 19, 2026
9d4fd4b
Merge branch 'feature/gdi-glyph-comparison' into test/headless-text-e…
claude Oct 19, 2026
cac8016
Make the GDI font provider the default in CADability.Forms (#503)
dsn27 Oct 19, 2026
1b39feb
Merge branch 'feature/gdi-glyph-comparison' into test/headless-text-e…
claude Oct 19, 2026
0ccbbfc
Merge branch 'master' into test/headless-text-export
claude Oct 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions tests/CADability.Tests/HeadlessTextExportTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
using CADability.GeoObject;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Path = System.IO.Path;

namespace CADability.Tests
{
/// <summary>
/// A text is created, measured and exported without a frame and without GDI (issue #412, step 9): this runs in the Linux
/// CI, where there is no GDI+. The font is Liberation Sans, which the tests register (see <see cref="TestFonts"/>).
/// Afterwards the finalizers run, and the process must survive them.
/// </summary>
[TestClass]
public class HeadlessTextExportTests
{
private static Text MakeText(string textString)
{
Text text = Text.Construct();
text.Font = "Liberation Sans";
text.TextString = textString;
text.Location = new GeoPoint(10, 20, 0);
text.LineDirection = GeoVector.XAxis;
text.GlyphDirection = GeoVector.YAxis;
text.TextSize = 5.0;
return text;
}

[TestMethod]
public void ATextIsSavedAndReadWithoutFrameOrGdi()
{
Assert.IsNull(FrameImpl.MainFrame, "the tests run without a frame");
Project project = Project.CreateSimpleProject();
Text text = MakeText("Headless 412");
project.GetActiveModel().Add(text);
BoundingCube extent = text.GetBoundingCube();
Assert.IsFalse(extent.IsEmpty);
Assert.IsTrue(extent.Xmax - extent.Xmin > 20 && extent.Ymax - extent.Ymin > 2, "the text has the size of its glyphs");

MemoryStream written = new MemoryStream();
project.WriteToJson(written);
Text read = Project.ReadFromJson(new MemoryStream(written.ToArray())).GetActiveModel().AllObjects.OfType<Text>().Single();
Assert.AreEqual("Headless 412", read.TextString);
Assert.AreEqual("Liberation Sans", read.Font);
BoundingCube readExtent = read.GetBoundingCube();
Assert.AreEqual(extent.Xmin, readExtent.Xmin, 1e-9);
Assert.AreEqual(extent.Xmax, readExtent.Xmax, 1e-9);
Assert.AreEqual(extent.Ymax, readExtent.Ymax, 1e-9);
}

[TestMethod]
public void ATextIsExportedToDxfAndReadBackWithoutFrameOrGdi()
{
Project project = Project.CreateSimpleProject();
project.GetActiveModel().Add(MakeText("Headless 412"));
string file = Path.Combine(Path.GetTempPath(), "HeadlessTextExportTests-" + Guid.NewGuid().ToString("N") + ".dxf");
try
{
Assert.IsTrue(project.Export(file, "dxf"), "the DXF file was not written");
Project imported = Project.ReadFromFile(file, "dxf");
Text text = imported.GetActiveModel().AllObjects.OfType<Text>().Single();
Assert.AreEqual("Headless 412", text.TextString);
Assert.AreEqual(5.0, text.TextSize, 1e-6);
Assert.AreEqual(new GeoPoint(10, 20, 0), text.Location);
Assert.IsFalse(text.GetBoundingCube().IsEmpty, "the imported text is measured with the font of the kernel");
}
finally
{
File.Delete(file);
}
}

[TestMethod]
public void TheProcessSurvivesTheFinalizersAfterTexts()
{
// the GDI version of the FontCache had a finalizer that threw without GDI and ended the process (issue #412)
for (int i = 0; i < 20; ++i)
{
Text text = MakeText("finalize " + i);
text.GetOutline();
text.GetBoundingCube();
}
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
}
}
}
Loading