vendor: import KillerPDF 1.7.5 source (GPL-3.0) as the base for MMD PDF

This commit is contained in:
2026-08-27 06:58:22 +02:00
commit 532485a830
577 changed files with 149058 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
using KillerPDF.Services;
using Xunit;
namespace KillerPDF.Tests;
public sealed class TextRunServiceTests
{
[Theory]
[InlineData("English text", false)]
[InlineData("متن فارسی", true)]
[InlineData("نص عربي", true)]
[InlineData("טקסט עברי", true)]
[InlineData("1234", false)]
public void DetectsLineDirection(string text, bool expected)
=> Assert.Equal(expected, TextRunService.IsRightToLeftText(new[] { text }));
[Fact]
public void RightToLeftCaretMovesFromRightEdgeToLeftEdge()
{
var runs = new PageTextRuns();
runs.Chars.Add(new RunChar("א", 90, 100, 0, 0));
runs.Chars.Add(new RunChar("ב", 80, 90, 0, 0));
runs.Chars.Add(new RunChar("ג", 70, 80, 0, 0));
runs.Lines.Add(new RunLine
{
Start = 0,
Count = 3,
Top = 20,
Bottom = 10,
Left = 70,
Right = 100,
RightToLeft = true,
});
Assert.Equal(0, TextRunService.CaretFromPoint(runs, 101, 15));
Assert.Equal(1, TextRunService.CaretFromPoint(runs, 89, 15));
Assert.Equal(3, TextRunService.CaretFromPoint(runs, 69, 15));
}
}