dompdf / dompdf/dompdf

dompdf Urdu Words Not Joining Issue

Open
#3,091 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
PHP
Stars
11.2k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

Font is loading but characters are separated tried so many other URDU language fonts like zoya font, noto_nastaliq_urdu font but nothing worked.

My complete code is

<?php
require_once "vendor/autoload.php";

use Dompdf\Dompdf;
use Dompdf\CanvasFactory;
use Dompdf\Exception;
use Dompdf\FontMetrics;
use Dompdf\Options;

use FontLib\Font;
ini_set("display_errors", true);
ini_set("error_log", "phperr.log");
ini_set("log_errors", true);
error_reporting(E_ALL);

$pdf = new Dompdf(new Options([
    'defaultPaperSize'          => 'a4',
    'defaultPaperOrientation'   => 'portrait',
    'isRemoteEnabled'           => true,
    'allowUrlFopen'             => true,
    'isHtml5ParserEnabled'      => true,
    'isFontSubsettingEnabled' => false,
    'direction' => 'rtl',
]));

// define("DOMPDF_ENABLE_HTML5PARSER", true);

$pdf->loadHtml('
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta charset="utf-8">

<style>

@font-face {
  font-family: "Zoya";
  font-style: normal;
  font-weight: 400;
  src: url(http://localhost/dompdf/drive/zoya-regular-1.ttf);
}


* {
  font-family: "Zoya";
  font-style: normal;
  font-weight: 400;
  direction: rtl;

}
</style>
</head>

<body>    
  <span> اردو پوائنٹ    </span>
</body>

',"UTF-8");
$pdf->render();
$pdf->stream('test.pdf', array('Attachment'=> 0 ));

screenshot
image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided PHP example with the Zoya font and Urdu text, then inspect the rendering path used for character joining and right-to-left text. Done means the Urdu characters render as connected words in the generated PDF rather than as separated glyphs.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, html, php
Domain
backend, internationalization
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.