CSS style font properly

Im using WordPress and uploaded my font locally.

.MyText {font-family: CustomFont}

Its working properly.

But when the page loads, it shows a flash of the text without my added font.

I tried

.MyText {

font-family: CustomFont;
font-display: block

}

But its still showing a flash of styled text, except the font.

How can i fix that?

‘What did you try and what were you expecting?’ Above