Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@ or ScriptClass.Takri
or ScriptClass.Tibetan
or ScriptClass.Tifinagh
or ScriptClass.Tirhuta
or ScriptClass.Kawi
or ScriptClass.NagMundari
or ScriptClass.Garay
or ScriptClass.GurungKhema
or ScriptClass.KiratRai
or ScriptClass.OlOnal
or ScriptClass.Sunuwar
or ScriptClass.Todhri
or ScriptClass.TuluTigalari
or ScriptClass.BeriaErfe
or ScriptClass.Sidetic
or ScriptClass.TaiYo
or ScriptClass.TolongSiki
=> new UniversalShaper(script, textOptions, fontMetrics),
_ => new DefaultShaper(script, textOptions),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,5 +201,18 @@ private static UnicodeScriptTagMap CreateMap()
{ ScriptClass.Yezidi, new[] { Tag.Parse("yezi") } },
{ ScriptClass.Yi, new[] { Tag.Parse("yiii") } },
{ ScriptClass.ZanabazarSquare, new[] { Tag.Parse("zanb") } },
{ ScriptClass.BeriaErfe, new[] { Tag.Parse("berf") } },
{ ScriptClass.Garay, new[] { Tag.Parse("gara") } },
{ ScriptClass.GurungKhema, new[] { Tag.Parse("gukh") } },
{ ScriptClass.Kawi, new[] { Tag.Parse("kawi") } },
{ ScriptClass.KiratRai, new[] { Tag.Parse("krai") } },
{ ScriptClass.NagMundari, new[] { Tag.Parse("nagm") } },
{ ScriptClass.OlOnal, new[] { Tag.Parse("onao") } },
{ ScriptClass.Sidetic, new[] { Tag.Parse("sidt") } },
{ ScriptClass.Sunuwar, new[] { Tag.Parse("sunu") } },
{ ScriptClass.TaiYo, new[] { Tag.Parse("tayo") } },
{ ScriptClass.Todhri, new[] { Tag.Parse("todr") } },
{ ScriptClass.TolongSiki, new[] { Tag.Parse("tols") } },
{ ScriptClass.TuluTigalari, new[] { Tag.Parse("tutg") } },
};
}
507 changes: 507 additions & 0 deletions src/SixLabors.Fonts/TextLayout.LineBreaking.cs

Large diffs are not rendered by default.

548 changes: 48 additions & 500 deletions src/SixLabors.Fonts/TextLayout.cs

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions src/SixLabors.Fonts/Unicode/ArabicJoiningClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@
namespace SixLabors.Fonts.Unicode;

/// <summary>
/// Represents the Unicode Arabic Joining value of a given <see cref="CodePoint"/>.
/// <see href="https://www.unicode.org/versions/Unicode14.0.0/ch09.pdf"/>
/// Represents the Unicode joining properties of a given <see cref="CodePoint"/>.
/// <see href="https://www.unicode.org/reports/tr44/#Joining_Type"/>
/// <see href="https://www.unicode.org/reports/tr44/#Joining_Group"/>
/// </summary>
/// <remarks>
/// This combines the Unicode <c>Joining_Type</c> and <c>Joining_Group</c>
/// properties used by cursive shaping. Unlisted nonspacing marks, enclosing marks,
/// and format controls follow the Unicode default joining behavior.
/// </remarks>
public readonly struct ArabicJoiningClass
{
/// <summary>
Expand Down
20 changes: 17 additions & 3 deletions src/SixLabors.Fonts/Unicode/ArabicJoiningGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
namespace SixLabors.Fonts.Unicode;

/// <summary>
/// Unicode Arabic Joining Groups
/// <see href="https://www.unicode.org/versions/Unicode13.0.0/ch09.pdf"/>.
/// Unicode Joining_Group property values used for Arabic-script cursive shaping.
/// <see href="https://www.unicode.org/reports/tr44/#Joining_Group"/>
/// </summary>
/// <remarks>
/// Joining groups identify characters that share the same basic joining shape for
/// cursive joining.
/// </remarks>
public enum ArabicJoiningGroup
{
/// <summary>
Expand Down Expand Up @@ -144,6 +148,11 @@ public enum ArabicJoiningGroup
/// </summary>
Kaph,

/// <summary>
/// Kashmiri_Yeh
/// </summary>
KashmiriYeh,

/// <summary>
/// Khaph
/// </summary>
Expand Down Expand Up @@ -470,7 +479,7 @@ public enum ArabicJoiningGroup
TehMarbuta,

/// <summary>
/// Hamza_On_Heh_Goal
/// Teh_Marbuta_Goal, formerly known by the stable alias Hamza_On_Heh_Goal.
/// </summary>
TehMarbutaGoal,

Expand All @@ -479,6 +488,11 @@ public enum ArabicJoiningGroup
/// </summary>
Teth,

/// <summary>
/// Thin_Noon
/// </summary>
ThinNoon,

/// <summary>
/// Thin_Yeh
/// </summary>
Expand Down
20 changes: 12 additions & 8 deletions src/SixLabors.Fonts/Unicode/ArabicJoiningType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,42 @@
namespace SixLabors.Fonts.Unicode;

/// <summary>
/// Unicode Arabic Joining Types
/// <see href="https://www.unicode.org/versions/Unicode13.0.0/ch09.pdf"/> Table 9-3.
/// Unicode Joining_Type property values used for Arabic-script cursive shaping.
/// <see href="https://www.unicode.org/reports/tr44/#Joining_Type"/>
/// </summary>
/// <remarks>
/// These values describe how a character participates in cursive joining with
/// neighboring characters.
/// </remarks>
public enum ArabicJoiningType
{
/// <summary>
/// Right Joining (R)
/// Right_Joining (R): joins on the right side only.
/// </summary>
RightJoining,

/// <summary>
/// Left Joining (L)
/// Left_Joining (L): joins on the left side only.
/// </summary>
LeftJoining,

/// <summary>
/// Dual Joining (D)
/// Dual_Joining (D): joins on both sides.
/// </summary>
DualJoining,

/// <summary>
/// Join Causing (C)
/// Join_Causing (C): causes adjacent join-capable characters to join.
/// </summary>
JoinCausing,

/// <summary>
/// Non Joining (U)
/// Non_Joining (U): does not participate in cursive joining.
/// </summary>
NonJoining,

/// <summary>
/// Transparent (T)
/// Transparent (T): ignored when determining the joining relationship of surrounding characters.
/// </summary>
Transparent
}
55 changes: 30 additions & 25 deletions src/SixLabors.Fonts/Unicode/BidiCharacterType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,133 +4,138 @@
namespace SixLabors.Fonts.Unicode;

/// <summary>
/// Provides enumeration for the Unicode Bidirectional character types.
/// <see href="https://unicode.org/reports/tr9/#Table Bidirectional Character Types"/>.
/// Unicode Bidi_Class property values.
/// <see href="https://www.unicode.org/reports/tr9/#Bidirectional_Character_Types"/>
/// </summary>
/// <remarks>
/// These are the bidirectional character types used by the Unicode Bidirectional
/// Algorithm. The algorithm resolves these input classes into embedding levels and
/// final visual ordering; the enum represents the original character class.
/// </remarks>
public enum BidiCharacterType
{
// Strong Types

/// <summary>
/// Left-to-right.
/// Left-to-Right (L).
/// </summary>
LeftToRight = 0,

/// <summary>
/// Right-to-left.
/// Right-to-Left (R).
/// </summary>
RightToLeft = 1,

/// <summary>
/// Arabic Letter.
/// Right-to-Left Arabic (AL).
/// </summary>
ArabicLetter = 2,

// Weak Types

/// <summary>
/// European Number
/// European Number (EN).
/// </summary>
EuropeanNumber = 3,

/// <summary>
/// European Separator
/// European Number Separator (ES).
/// </summary>
EuropeanSeparator = 4,

/// <summary>
/// European Terminator
/// European Number Terminator (ET).
/// </summary>
EuropeanTerminator = 5,

/// <summary>
/// Arabic Number.
/// Arabic Number (AN).
/// </summary>
ArabicNumber = 6,

/// <summary>
/// Common Separator
/// Common Number Separator (CS).
/// </summary>
CommonSeparator = 7,

/// <summary>
/// Nonspacing Mark.
/// Nonspacing Mark (NSM).
/// </summary>
NonspacingMark = 8,

/// <summary>
/// Boundary Neutral.
/// Boundary Neutral (BN).
/// </summary>
BoundaryNeutral = 9,

// Neutral Types

/// <summary>
/// Paragraph Separator
/// Paragraph Separator (B).
/// </summary>
ParagraphSeparator = 10,

/// <summary>
/// Segment Separator
/// Segment Separator (S).
/// </summary>
SegmentSeparator = 11,

/// <summary>
/// White Space.
/// Whitespace (WS).
/// </summary>
Whitespace = 12,

/// <summary>
/// Other Neutral.
/// Other Neutral (ON).
/// </summary>
OtherNeutral = 13,

// Explicit Formatting Types - Embed

/// <summary>
/// Left-to-right Embedding.
/// Left-to-Right Embedding (LRE).
/// </summary>
LeftToRightEmbedding = 14,

/// <summary>
/// Left-to-right Override
/// Left-to-Right Override (LRO).
/// </summary>
LeftToRightOverride = 15,

/// <summary>
/// Right-to-left Embedding
/// Right-to-Left Embedding (RLE).
/// </summary>
RightToLeftEmbedding = 16,

/// <summary>
/// Right-to-left Override.
/// Right-to-Left Override (RLO).
/// </summary>
RightToLeftOverride = 17,

/// <summary>
/// Pop Directional Format
/// Pop Directional Format (PDF).
/// </summary>
PopDirectionalFormat = 18,

// Explicit Formatting Types - Isolate

/// <summary>
/// Left-to-right Isolate
/// Left-to-Right Isolate (LRI).
/// </summary>
LeftToRightIsolate = 19,

/// <summary>
/// Right-to-left Isolate.
/// Right-to-Left Isolate (RLI).
/// </summary>
RightToLeftIsolate = 20,

/// <summary>
/// First Strong Isolate
/// First Strong Isolate (FSI).
/// </summary>
FirstStrongIsolate = 21,

/// <summary>
/// Pop Directional Isolate.
/// Pop Directional Isolate (PDI).
/// </summary>
PopDirectionalIsolate = 22,
}
15 changes: 9 additions & 6 deletions src/SixLabors.Fonts/Unicode/BidiPairedBracketType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,27 @@
namespace SixLabors.Fonts.Unicode;

/// <summary>
/// Provides enumeration for classifying characters into opening and closing paired brackets
/// for the purposes of the Unicode Bidirectional Algorithm.
/// <see href="https://www.unicode.org/Public/UCD/latest/ucd/BidiBrackets.txt"/>.
/// Unicode Bidi_Paired_Bracket_Type property values.
/// <see href="https://www.unicode.org/reports/tr9/#Paired_Brackets"/>
/// </summary>
/// <remarks>
/// UAX #9 uses this property with <c>Bidi_Paired_Bracket</c> to find bracket pairs
/// while resolving neutral characters.
/// </remarks>
public enum BidiPairedBracketType
{
/// <summary>
/// None.
/// No paired bracket behavior.
/// </summary>
None = 0,

/// <summary>
/// Open.
/// Opening paired bracket.
/// </summary>
Open = 1,

/// <summary>
/// Close.
/// Closing paired bracket.
/// </summary>
Close = 2
}
Loading
Loading