-1

I use @font-face on my web page for change font. If i use local files with fonts(route for font from my pc), all work fine font look like this: needed font . But if I try to use server file from same directory(server font file route) IE received this font I see it in dev tool but font not working and looks like standart font

1 Answers1

0

I not found good solution, but I fixed it used base64 converter from this answer: Converting and rendering web fonts to base64 - keep original look

Converter:

function base64convert (files) {
  console.clear()
  const reader = new FileReader()
  reader.onload = (e) => {
    console.log(e.target.result)
  }
  reader.readAsDataURL(files[0])
}
<input type="file" onchange="base64convert(this.files)">

And included my ttf font file as base64 string.

@font-face {
    font-family: 'myfont';
    src: url("<<copied base64 string>>");
}
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Nol4635 Jul 01 '22 at 22:37