Bangla Font showing mismatch - Laravel Dompdf - laravel

I am using Laravel Dompdf to generate PDF. Use Kalpurush font for Bangla text. Everything working well but text showing mismatch into PDF view. Lets example:Text should be আমি comes out like আ ম ি .
I don't know how can solve this problem. Already used UTF-8 charset. Here is my code sample
$pdf = PDF::setOptions(['dpi' => 150, 'defaultFont' => 'Kalpurush'])->loadView('text.download', compact('data'));
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style>
#font-face {
font-family: "Kalpurush";
src: url({{ storage_path('fonts/Kalpurush.ttf') }}) format('truetype');
}
body { font-family: "Kalpurush", DejaVu Sans;}
</style>
Have anyone face this type of problem.
Please give me guideline or any solution to solve this Bangla font problem for Lavavel Dompdf.

Related

OCR A Extended font puzzle

I have 'OCR A Extended' font installed in Windows and I created the following test.html file, but in Chrome only the OCR A gets rendered as OCR text (class p.b), OCR A Extended (class p.a) gets rendered (computed) as Times New Roman, what's going on? In IE both are rendered as OCR. Same behavior in Windows 7 and Windows 10. Looks like a bug to me.
<html>
<head>
<style>
p.a {
font-family: "OCR A Extended";
}
p.b {
font-family: "OCR A";
}
</style>
</head>
<body>
<p class="a">1234567890</p>
<p class="b">1234567890</p>
</body>
</html>

Cannot type slash or single quote in firefox add-on input field

I'm learning to develop a Firefox add-on. I've made a simple dev-tools tab with an input box. I'm finding that I can type every character into the input box with the exception of "/" or "'". A forward slash or single quote will not populate. Nothing appears in the input box when I type these characters.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
body{
margin:0;
}
.warpath-search{
width:100%;
background-color:#fcfcfc;
border:1px solid #f0f1f2;
padding:.3em;
}
.warpath-search label{
width:100px;
display:inline-block;
}
.warpath-search input{
width:400px;
}
</style>
</head>
<body>
<div class="warpath-search">
<label>Xpath:</label><input type="text" name="warpath-xpath" id="warpath-xpath" />
</div>
<script src="devtools-panel.js"></script>
</body>
</html>
devtools-panel.js:
input = document.getElementById("warpath-xpath");
input.addEventListener("keyup", () => {
console.log(input.value);
});
Gif:
If I load the plugin's HTML file directly in the browser I can enter the characters but when it is loaded as a plugin it's blocked.
Using Firefox: 70.0.1 (64-bit)
The problem seems to have something to do with a Firefox type-ahead feature. The following steps resolved the issue for me:
Open about:config in the browser
Click "I accept the risk"
Search for "accessibility.typeaheadfind.manual"
Change the value of this key from "true" to "false"

Laravel 5.6 barryvdh dompdf version 0.8.4 show Indian Rupee symbol as "?"

In one of my Laravel 5 project, I have used barryvdh dompdf (version 0.8.4) to generate PDF files. I used the following for meta e.g. <meta charset="utf-8"> and in html code, I used to show the Indian Rupee symbol e.g. <div style="font-size: 16px;">Payment of ₹ 6000.</div>
(&#8377 ; = html unicode of INR)
The PDF generates well however, the INR symbol is showing as ?. From several sources, I see that they are using dejavu font. I have used the same
<style>
body { font-family: DejaVu Sans, sans-serif; }
</style>
However by using the dejaVu, the other text including INR sign in the PDF are showing garbage characters. Any help?
PS - Should I download the font and store it into the asests/ folder?
Add code inside of html tag
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style>
* { font-family: DejaVu Sans, sans-serif; }
</style>

The attribute 'amp4ads' may not appear in tag 'html'

I was developing AMP Ad as advertiser. I tested the sample amp4ads provided by ampByExample.com (official starter codes)
https://ampbyexample.com/amp-ads/introduction/hello_world/
I found amp4ads is not VALIDATED by official validator (link below)
https://validator.ampproject.org/
here is the sample snippet you can test it on validator
<html ⚡4ads>
<head>
<meta charset="utf-8">
<title> Hello World</title>
<script async src="https://cdn.ampproject.org/amp4ads-v0.js"></script>
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<style amp4ads-boilerplate>body{visibility:hidden}</style>
<style amp-custom>
h1 {
color: red;
}
</style>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
It throws a lot of errors. Can anyone help me fix this issue, I couldn't find anything related.
Thanks
Unfortunately, validator.ampproject.org does not support AMP Ads. If you open the page in the AMP Playground you'll see that it's valid: https://ampbyexample.com/playground/#url=https%3A%2F%2Fampbyexample.com%2Famp-ads%2Fintroduction%2Fhello_world%2Fsource%2F&runtime=amp4ads.

Japanese characters not supported by rmagick

I'm tring to build a voucher from template by rmagick, (using utf8 encoding) Below is just a small code snippet
text.annotate(template, 0, 0, 23, 155, offer_label) {
self.pointsize = 16
self.font_weight = BoldWeight
}
When i provide offer_label as 安価な価格でホテルを予約 (japanese)
so in the voucher that is created, the offer_label is dispayed as ????????????.
The offer_label is stored correctly in the database
Template code snippet:
<html lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><%= #from_name %></title>
<style type="text/css">
a:hover { color: #09F !important; text-decoration: underline !important; }
</style>
</head>
I looked around the suggested questions but no luck.Looking forward for suggestions.
UPDATE:
The label_name is displayed correctly in the browser web pages, this issue only comes in the voucher which is created using rmagick
1) you should install Japanese font(s) to your runtime environment(s).
you can check this via Magick.fonts whether you've installed it or not.
2) specify font related attributes.
use Draw#annotate and specify font name/font_family name that you'd like to use.
Hope this helps.

Resources