Skip to content

Commit 23ce95c

Browse files
Merge pull request #533 from SixLabors/js/bump-licensing
Add high-level text layout docs; bump licensing version
2 parents 24b0b7f + cd96b77 commit 23ce95c

9 files changed

Lines changed: 38 additions & 49 deletions

File tree

.github/workflows/build-and-test.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,26 +64,26 @@ jobs:
6464
- ${{ contains(github.event.pull_request.labels.*.name, 'arch:arm32') || contains(github.event.pull_request.labels.*.name, 'arch:arm64') }}
6565
options:
6666
- os: ubuntu-latest
67-
framework: net9.0
68-
sdk: 9.0.x
67+
framework: net10.0
68+
sdk: 10.0.x
6969
sdk-preview: true
7070
runtime: -x64
7171
codecov: false
7272
- os: macos-latest
73-
framework: net9.0
74-
sdk: 9.0.x
73+
framework: net10.0
74+
sdk: 10.0.x
7575
sdk-preview: true
7676
runtime: -x64
7777
codecov: false
7878
- os: windows-latest
79-
framework: net9.0
80-
sdk: 9.0.x
79+
framework: net10.0
80+
sdk: 10.0.x
8181
sdk-preview: true
8282
runtime: -x64
8383
codecov: false
8484
- os: buildjet-4vcpu-ubuntu-2204-arm
85-
framework: net9.0
86-
sdk: 9.0.x
85+
framework: net10.0
86+
sdk: 10.0.x
8787
sdk-preview: true
8888
runtime: -x64
8989
codecov: false
@@ -161,7 +161,7 @@ jobs:
161161
uses: actions/setup-dotnet@v5
162162
with:
163163
dotnet-version: |
164-
9.0.x
164+
10.0.x
165165
166166
- name: DotNet Build
167167
if: ${{ matrix.options.sdk-preview != true }}

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ SixLabors.Fonts
1515

1616
**SixLabors.Fonts** is a cross-platform library for loading, measuring, and laying out fonts and text. It supports TrueType and OpenType fonts (including CFF1 and CFF2 outlines), WOFF/WOFF2 web fonts, variable fonts, color fonts (COLR v0/v1 and SVG), and TrueType hinting. The library provides a full OpenType layout engine with GSUB/GPOS support, advanced text shaping for complex scripts, and bidirectional text rendering.
1717

18+
Fonts also exposes high-level text layout primitives for applications that need more than a single bounding box. Callers can measure advance, ink bounds, renderable bounds, lines, words, graphemes, and glyphs; reuse prepared text across multiple wrapping widths; inspect the resolved font used to shape and render fallback glyphs; and use built-in hit testing, caret placement, and selection geometry.
19+
1820
## License
1921

2022
- Fonts is licensed under the [Six Labors Split License, Version 1.0](https://github.com/SixLabors/Fonts/blob/main/LICENSE)
@@ -106,6 +108,11 @@ git lfs pull
106108
- Support for ligatures and kerning.
107109
- Support for rendering left to right, right to left, and bidirectional text.
108110
- Support for line breaking based on [UAX 14](https://www.unicode.org/reports/tr14/).
111+
- Support for reusable prepared text layout via `TextBlock`.
112+
- Text measurement APIs for advance bounds, ink bounds, renderable bounds, line metrics, word metrics, grapheme metrics, and glyph metrics.
113+
- Glyph and grapheme metrics expose the resolved font used to shape and render each entry, including fallback fonts.
114+
- Text interaction helpers for hit testing, caret positioning, caret movement, and selection bounds.
115+
- Support for wrapping, trimming, ellipsis, hyphenation, tab width, tracking, line height, and horizontal and vertical layout modes.
109116

110117
## API Examples
111118

src/SixLabors.Fonts/SixLabors.Fonts.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<AssemblyName>SixLabors.Fonts</AssemblyName>
@@ -32,7 +32,7 @@
3232
<Choose>
3333
<When Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
3434
<PropertyGroup>
35-
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
35+
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
3636
<IsTrimmable>true</IsTrimmable>
3737
</PropertyGroup>
3838
</When>

src/UnicodeTrieGenerator/Generator.UniversalShapingEngine.cs

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ public static partial class Generator
317317
{ 0x1cf9, IPC.Top }
318318
};
319319

320-
private static bool Check(dynamic pattern, dynamic value)
320+
private static bool Check(object pattern, object? value)
321321
{
322322
// TODO:This is nasty. Port to use the harfbuzz approach using Function<CodePoint, bool>
323323
if (pattern is Dictionary<string, object> dictionary && dictionary.TryGetValue("not", out object? not))
@@ -326,12 +326,7 @@ private static bool Check(dynamic pattern, dynamic value)
326326
{
327327
foreach (object item in list)
328328
{
329-
if (value is int i && item is int i2 && i == i2)
330-
{
331-
return false;
332-
}
333-
334-
if (value is GC gc && item is GC gc2 && gc == gc2)
329+
if (object.Equals(value, item))
335330
{
336331
return false;
337332
}
@@ -341,35 +336,28 @@ private static bool Check(dynamic pattern, dynamic value)
341336
}
342337
else
343338
{
344-
if (value is int i && not is int i2)
345-
{
346-
return i != i2;
347-
}
348-
349-
if (value is GC gc && not is GC gc2)
350-
{
351-
return gc != gc2;
352-
}
339+
return !object.Equals(value, not);
353340
}
354341
}
355342

356-
return value == pattern;
343+
return object.Equals(value, pattern);
357344
}
358345

359-
private static bool Matches(dynamic pattern, Codepoint code)
346+
private static bool Matches(object pattern, Codepoint code)
360347
{
361348
if (pattern is int i)
362349
{
363-
pattern = new Dictionary<string, int> { { "U", i } };
350+
pattern = new Dictionary<string, object> { { "U", i } };
364351
}
365352
else if (pattern is ISC isc)
366353
{
367-
pattern = new Dictionary<string, dynamic> { { "UISC", isc } };
354+
pattern = new Dictionary<string, object> { { "UISC", isc } };
368355
}
369356

370-
foreach (string? key in pattern.Keys)
357+
Dictionary<string, object> dictionary = (Dictionary<string, object>)pattern;
358+
foreach (string key in dictionary.Keys)
371359
{
372-
if (!Check(pattern[key], GetCodeValue(code, key)))
360+
if (!Check(dictionary[key], GetCodeValue(code, key)))
373361
{
374362
return false;
375363
}
Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
// Copyright (c) Six Labors.
22
// Licensed under the Six Labors Split License.
33

4-
namespace UnicodeTrieGenerator;
4+
using UnicodeTrieGenerator;
55

6-
internal static class Program
7-
{
8-
private static void Main()
9-
{
10-
Console.WriteLine("Generating Trie Data");
11-
Generator.GenerateUnicodeTries();
12-
Console.WriteLine("Done");
13-
Console.ReadLine();
14-
}
15-
}
6+
Console.WriteLine("Generating Trie Data");
7+
Generator.GenerateUnicodeTries();
8+
Console.WriteLine("Done");
9+
Console.ReadLine();

src/UnicodeTrieGenerator/UnicodeTrieGenerator.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<Choose>
1111
<When Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
1212
<PropertyGroup>
13-
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
13+
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
1414
</PropertyGroup>
1515
</When>
1616
<Otherwise>

tests/SixLabors.Fonts.Benchmarks/SixLabors.Fonts.Benchmarks/SixLabors.Fonts.Benchmarks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<Choose>
2020
<When Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
2121
<PropertyGroup>
22-
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
22+
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
2323
</PropertyGroup>
2424
</When>
2525
<Otherwise>

tests/SixLabors.Fonts.Tests/SixLabors.Fonts.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<DebugSymbols>True</DebugSymbols>
@@ -13,7 +13,7 @@
1313
<Choose>
1414
<When Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
1515
<PropertyGroup>
16-
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
16+
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
1717
</PropertyGroup>
1818
</When>
1919
<Otherwise>

0 commit comments

Comments
 (0)