Skip to content

Commit

Permalink
Merge pull request #167 from SixLabors/js/word-break
Browse files Browse the repository at this point in the history
Add wordbreaking support
  • Loading branch information
JimBobSquarePants authored Sep 18, 2021
2 parents 22c2a27 + a8ba093 commit 5bbf20e
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 9 deletions.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5bbf20e

Please sign in to comment.