Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wordbreaking support #167

Merged
merged 2 commits into from
Sep 18, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion src/ImageSharp.Drawing/ImageSharp.Drawing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="SixLabors.Fonts" Version="1.0.0-beta15.10" />
<PackageReference Include="SixLabors.Fonts" Version="1.0.0-beta15.15" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.3" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ protected override void BeforeImageApply()
LineSpacing = this.Options.TextOptions.LineSpacing,
FallbackFontFamilies = this.Options.TextOptions.FallbackFonts,
ColorFontSupport = this.definition.Options.TextOptions.RenderColorFonts ? ColorFontSupport.MicrosoftColrFormat : ColorFontSupport.None,
WordBreaking = this.definition.Options.TextOptions.WordBreaking
};

this.textRenderer = new CachingGlyphRenderer(
Expand Down
11 changes: 9 additions & 2 deletions src/ImageSharp.Drawing/Processing/TextOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,24 @@ public float LineSpacing
/// defined by the location and width, if <see cref="WrapTextWidth"/> equals zero, and thus
/// wrapping disabled, then the alignment is relative to the drawing location.
/// <para/>
/// Defaults to <see cref="SixLabors.Fonts.HorizontalAlignment.Left"/>.
/// Defaults to <see cref="HorizontalAlignment.Left"/>.
/// </summary>
public HorizontalAlignment HorizontalAlignment { get; set; } = HorizontalAlignment.Left;

/// <summary>
/// Gets or sets a value indicating how to align the text relative to the rendering space.
/// <para/>
/// Defaults to <see cref="SixLabors.Fonts.VerticalAlignment.Top"/>.
/// Defaults to <see cref="VerticalAlignment.Top"/>.
/// </summary>
public VerticalAlignment VerticalAlignment { get; set; } = VerticalAlignment.Top;

/// <summary>
/// Gets or sets a value indicating what word breaking mode to use when wrapping text.
/// <para/>
/// Defaults to <see cref="WordBreaking.Normal"/>.
/// </summary>
public WordBreaking WordBreaking { get; set; } = WordBreaking.Normal;

/// <summary>
/// Gets the list of fallback font families to apply to the text drawing operation.
/// <para/>
Expand Down