I have used Hindi font in my laravel project for generating pdf using dompdf. I have downloaded Noto Sans Devanagari font and place under myproject\storage\fonts folder.
I have used in blade html file like this.
<style>
* { font-family: Noto Sans, sans-serif; }
</style>
I have set collation and charset as utf8_unicode_ci in database table column structure and also in config/database.php like this.
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'test'),
'username' => env('DB_USERNAME', 'test'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => false,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
Now when I generate pdf with hindi language, it is showing perfectly, Now I have added Noto sans gujarati in same fonts folder and modify my view file like this.
<style>
* {
font-family: 'Noto Sans Devanagari', sans-serif;
font-family: 'Noto Sans Gujarati', sans-serif;
}
</style>
But Gujarati font is not showing properly either it shows boxes or ?? I have also tried including google font library like this.
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@300&family=Noto+Sans+Gujarati:wght@300&display=swap" rel="stylesheet">
Can anyone suggest me how can gujarati and hindi font we can show in pdf?