Skip to content

Commit

Permalink
Add Support for RTL languages
Browse files Browse the repository at this point in the history
Fixes #162

- Changes both instances of `DrawText` with `DrawShapedText`
- Requires an additional dependency (~200kb).
  • Loading branch information
primo-ppcg committed May 17, 2023
1 parent 129e274 commit e483d7f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/BinaryKits.Zpl.Viewer/BinaryKits.Zpl.Viewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<PackageReference Include="BarcodeLib" Version="2.4.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.1" />
<PackageReference Include="SkiaSharp" Version="2.80.3" />
<PackageReference Include="SkiaSharp.HarfBuzz" Version="2.80.3" />
<PackageReference Include="ZXing.Net" Version="0.16.8" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using BinaryKits.Zpl.Label.Elements;
using BinaryKits.Zpl.Viewer.Helpers;
using SkiaSharp;
using SkiaSharp.HarfBuzz;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -150,7 +151,7 @@ public override void Draw(ZplElementBase element, DrawerOptions options)
break;
}

this._skCanvas.DrawText(textLine, x, y, skFont, skPaint);
this._skCanvas.DrawShapedText(textLine, x, y, skPaint);
y += lineHeight;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using BinaryKits.Zpl.Label.Elements;
using BinaryKits.Zpl.Viewer.Helpers;
using SkiaSharp;
using SkiaSharp.HarfBuzz;
using System;

namespace BinaryKits.Zpl.Viewer.ElementDrawers
Expand Down Expand Up @@ -116,7 +117,7 @@ public override void Draw(ZplElementBase element, DrawerOptions options)
y += textBoundBaseline.Height;
}

this._skCanvas.DrawText(displayText, x, y, skFont, skPaint);
this._skCanvas.DrawShapedText(displayText, x, y, skPaint);
}
}
}
Expand Down

0 comments on commit e483d7f

Please sign in to comment.