DjDeveloperr / skia_canvas

Fast HTML Canvas API implementation for Deno using Google Skia
https://deno.land/x/skia_canvas
Apache License 2.0
124 stars 7 forks source link

[bug] `fillText` failed with non usual latin symbols #30

Closed shevernitskiy closed 1 year ago

shevernitskiy commented 1 year ago

I trying to draw text with cyrillic chars and got error.

ctx.font = '20px "Consolas"';
ctx.fillText("Ё", 50, 50);
error: Uncaught (in promise) Error: failed to fill text
      throw new Error("failed to fill text");
            ^
    at CanvasRenderingContext2D.fillText (https://deno.land/x/skia_canvas@0.4.0/src/context2d.ts:296:13)
    at drawChar (file:///E:/programming/ts/charmap/src/main.ts:51:7)
    at file:///E:/programming/ts/charmap/src/main.ts:59:7
    at Array.forEach (<anonymous>)
    at file:///E:/programming/ts/charmap/src/main.ts:58:9
    at Array.forEach (<anonymous>)
    at drawMatrix (file:///E:/programming/ts/charmap/src/main.ts:57:10)
    at file:///E:/programming/ts/charmap/src/main.ts:37:1

I checked on other unicode symbols and seems like it only work with main EN ASCII table. Using unicode hexcodes \u0090 also gives error. It there any way to solve this issue?

DjDeveloperr commented 1 year ago

Can you try and see if importing from https://raw.githubusercontent.com/DjDeveloperr/skia_canvas/76fe0856d743cf4bce289f3fad06259133f0d825/mod.ts fixes the issue?

DjDeveloperr commented 1 year ago

image

Indeed does

shevernitskiy commented 1 year ago

Yep, its work. Thanks for instant fix!