Support » Plugin: Gravity PDF » The distance between Persian letters in a custom font

Viewing 1 replies (of 1 total)
  • Plugin Author Jake Jackson


    Thanks for opening a new ticket about this issue.

    Currently, Gravity PDF makes no guess work when registering custom fonts with Mpdf (the software used to generate PDFs). What that means is, since not all fonts support Open Type layout tables (what’s used to join the cursive Arabic font) we don’t enable this functionality at all.

    If you’d like to enable this yourself you can use the “mpdf_font_data” WordPress filter at priority 15 to modify the $fonts array and include the appropriate ‘useOTL’ and ‘useKashida’ options for your custom font. That might look like this:

    add_filter( 'mpdf_font_data', function( $fonts ) {
       if ( isset( $fonts['notosans'] ) ) {
          $fonts['notosans']['useOTL']     = 0xFF;
          $fonts['notosans']['useKashida'] = 50;
       return $fonts;
    }, 15 );

    You’ll need to adjust ‘notosans’ to the font key assigned to your font (i.e if you added a custom font called “Vazir” the font key would be “vazir”), and adjust ‘useOTL’ and ‘useKashida’ as appropriate to your font family.

    We understand this is very inconvenient for our users who want to display Persian or Arabic using a custom font, and redesigning how we handle the entire custom font experience is high on our priority list.

    Please let me know if you’ve any questions

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.