21

i've downloaded the DejaVu open source font and want to use it ad a WebFont, but even when converting it, i get a large file, and because the website i'll use will be only in few languages (arabic, french, amazigh) then, i dont need some characters.

so is there a way to browse the font file and delete the unnecessary range of unicode characters that i'll not need?

1

2 Answers 2

19

Using FontForge, you may open Element->Font Info->Unicode Ranges. You will see all available ranges and you can select a whole Unicode range with a single click. Then, you can tune your selection and delete using Encoding->Detach & Remove Glyphs.

Also, you can use Edit->Select->Select by Script.

To create a new font from the minified or reduced glyph set, File->Generate Fonts..., then choose a font file type in the dropdown menu under the filename field, and then click Generate.

0
16

The easiest method I found is to use pyftsubset tool from FontTools. Here's an example:

$ pyftsubset NotoSans-Regular.ttf \
      --unicodes=U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116 \
      --output-file=NotoSans-Regular.cyrillic.woff2 \
      --flavor=woff2

Note: woff2 output requires Brotli.

I wrote a simple script around it which automates the whole process including generation of a CSS file after splitting the font file. You may find it here: https://github.com/johncf/ttf2web

1
  • 2
    For anyone wondering, this also worked with an OTF font for me.
    – Ed_
    Commented Feb 21, 2019 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.