Skip to content

Commit 38e4a82

Browse files
Add wordbreaking support
1 parent 22c2a27 commit 38e4a82

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

src/ImageSharp.Drawing/ImageSharp.Drawing.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</ItemGroup>
2121

2222
<ItemGroup>
23-
<PackageReference Include="SixLabors.Fonts" Version="1.0.0-beta15.10" />
23+
<PackageReference Include="SixLabors.Fonts" Version="1.0.0-beta15.15" />
2424
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.3" />
2525
</ItemGroup>
2626

src/ImageSharp.Drawing/Processing/Processors/Text/DrawTextProcessor{TPixel}.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ protected override void BeforeImageApply()
5757
LineSpacing = this.Options.TextOptions.LineSpacing,
5858
FallbackFontFamilies = this.Options.TextOptions.FallbackFonts,
5959
ColorFontSupport = this.definition.Options.TextOptions.RenderColorFonts ? ColorFontSupport.MicrosoftColrFormat : ColorFontSupport.None,
60+
WordBreaking = this.definition.Options.TextOptions.WordBreaking
6061
};
6162

6263
this.textRenderer = new CachingGlyphRenderer(

src/ImageSharp.Drawing/Processing/TextOptions.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,24 @@ public float LineSpacing
122122
/// defined by the location and width, if <see cref="WrapTextWidth"/> equals zero, and thus
123123
/// wrapping disabled, then the alignment is relative to the drawing location.
124124
/// <para/>
125-
/// Defaults to <see cref="SixLabors.Fonts.HorizontalAlignment.Left"/>.
125+
/// Defaults to <see cref="HorizontalAlignment.Left"/>.
126126
/// </summary>
127127
public HorizontalAlignment HorizontalAlignment { get; set; } = HorizontalAlignment.Left;
128128

129129
/// <summary>
130130
/// Gets or sets a value indicating how to align the text relative to the rendering space.
131131
/// <para/>
132-
/// Defaults to <see cref="SixLabors.Fonts.VerticalAlignment.Top"/>.
132+
/// Defaults to <see cref="VerticalAlignment.Top"/>.
133133
/// </summary>
134134
public VerticalAlignment VerticalAlignment { get; set; } = VerticalAlignment.Top;
135135

136+
/// <summary>
137+
/// Gets or sets a value indicating what word breaking mode to use when wrapping text.
138+
/// <para/>
139+
/// Defaults to <see cref="WordBreaking.Normal"/>.
140+
/// </summary>
141+
public WordBreaking WordBreaking { get; set; } = WordBreaking.Normal;
142+
136143
/// <summary>
137144
/// Gets the list of fallback font families to apply to the text drawing operation.
138145
/// <para/>

0 commit comments

Comments
 (0)