0

I got all load's from webpack.config and everything about ts compiler work. I got green text message intro cmd logs.

I got file intro folder dist/fonts/test.woff

My frontend view is canvas2d based (Anyway).

I try first to define fontface intro css :

@font-face {
  font-family: plantagenet;
  src: url(../fonts/plantagenet-cherokee.woff) format("woff"),
       url(../fonts/plantagenet_cherokee.woff2) format("woff2");
}

But not successful ( font not adapting to the text ).

Any suggestion?

Do I need to use import or new FontFace(args..) ?

I use webpack version : "version": "3.11.0"

More error log variant :

Property 'FontFace' does not exist on type 'Window'.

'FontFace' only refers to a type, but is being used as a value here.

Cannot find name 'FontFace'.

Nikola Lukic
  • 4,001
  • 6
  • 44
  • 75

1 Answers1

0

The font loading is an asynchronous process and mostly will not be available at the time of loading page.

You need to prepare the canvas after the font is available. See to get callback when font is loaded successfully callback after a font is loaded

You can try preparing canvas image using the font in a setTimeout function with few seconds time delay.

Pradeep Lakku
  • 241
  • 2
  • 7