Skip to content

Commit

Permalink
No utf-8 conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielku15 committed Dec 23, 2023
1 parent 939af9b commit 895cb41
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
2 changes: 0 additions & 2 deletions wrapper/include/AlphaSkiaCanvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ class AlphaSkiaCanvas
private:
SkPaint create_paint();

std::string convert_utf16_to_utf8(const char16_t *text);

SkColor color_;
float line_width_;
sk_sp<SkSurface> surface_;
Expand Down
4 changes: 1 addition & 3 deletions wrapper/src/AlphaSkiaCanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,6 @@ void AlphaSkiaCanvas::text_run(const char16_t *text,
font.setSubpixel(true);
font.setHinting(SkFontHinting::kNormal);

std::string utf8(convert_utf16_to_utf8(text));

HBFont harfBuzzFont(make_harfbuzz_font(font));

SkTextBlobBuilder builder;
Expand All @@ -317,7 +315,7 @@ void AlphaSkiaCanvas::text_run(const char16_t *text,
HBBuffer buffer(hb_buffer_create());
hb_buffer_set_direction(buffer.get(), HB_DIRECTION_LTR);
hb_buffer_set_language(buffer.get(), hb_language_get_default());
hb_buffer_add_utf8(buffer.get(), utf8.c_str(), -1, 0, -1);
hb_buffer_add_utf16(buffer.get(), reinterpret_cast<const uint16_t*>(text), -1, 0, -1);

hb_shape(harfBuzzFont.get(), buffer.get(), nullptr, 0);

Expand Down

0 comments on commit 895cb41

Please sign in to comment.