-1

I used Tamil font Noto Sans but when I am trying to generate pdf, the tamil words mismatch in pdf. This is What I wrote in web page "முகவரி", but in pdf it generate like this "மீகவரி".

This is my head tag of my blade view in laravel:

//I also tried akruti1.ttf by downloading it and added on my public directory but it does not load in my project::

<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Tamil&display=swap" rel="stylesheet">

<title>Proforma Report</title>
<style>
    body {
        font-family: 'Noto Sans Tamil', sans-serif;
    }
</style>

//This is my body tag:

<div>
    <label>1. விண்ணப்பதாரர் பெயர்<br>
        Name of the Applicant</label>
</div>
<div>
    <textarea></textarea>
</div>
  • 2
    the font used is present in your computer and needs every user of the pdf to have it installed too. The other solution would be to embed the font with the pdf file and the solution depends on what tool you are using to create the pdf. – N69S May 17 '23 at 10:39
  • Thank you, I am using dompdf, should I have to embed inside config.dompdf.php,, will it generate the tamil words correctly in pdf – Dhatchayani P May 17 '23 at 10:56
  • 1
    Just embedding a font may not solve the problem. You should ask specifically to dompdf developers if they support the ligatures and combining diacritics of the language. – Kevin Brown May 17 '23 at 15:56

1 Answers1

0

In your Blade, try modifying the head tag section to the following.

<head>
    <title>Proforma Report</title>
    <style>
        @font-face {
            font-family: 'Noto Sans Tamil';
            font-style: normal;
            font-weight: 400;
            src: url('{{ public_path('fonts/NotoSansTamil-Regular.ttf') }}') format('truetype');
        }
        body {
            font-family: 'Noto Sans Tamil', sans-serif;
        }
    </style>
</head>
Karl Hill
  • 12,937
  • 5
  • 58
  • 95