Solution 1 :

You can only cache the font per user after it’s been loaded once already. You can manage the cache of the font by adding following to htaccess:

<IfModule mod_expires.c>
    ExpiresActive on
    ExpiresDefault                              "access plus 1 month"
    ExpiresByType text/cache-manifest           "access plus 0 seconds"
    # Webfonts
    ExpiresByType font/ttf                      "access plus 4 months"
    ExpiresByType font/otf                      "access plus 4 months"
    ExpiresByType font/woff                     "access plus 4 months"
    ExpiresByType font/woff2                    "access plus 4 months"
    ExpiresByType image/svg+xml                 "access plus 1 month"
    ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
</IfModule>

Problem :

I have a font named “Jameel Noori Nastaliq”. It is urdu font, having .ttf file of 10MB. I have used it in my website. But when my website loads, its take alot of time to complete the loading whole page.

I have tried changing it to woff or compressing it but no success. Here is download link to font .ttf file. https://urdufonts.net/fonts/jameel-noori-nastaleeq-regular#

Comments

Comment posted by curious_nustian

Thanks for you answer, can you guide me on how to cache on

Comment posted by Unbranded Manchester

Sorry, no idea how to add onto Python server – only know apache htaccess. Copy and paste my answer and ask a new question on how to get the equivalent rules into your config.

By