I'm using TCPDF to create PDFs that include Japanese characters. Using the TrueType font ArialUni, most characters are displayed correctly, except the yen symbol shows up as a square box instead of ¥.
Here's a snippet of the resulting PDF using ArialUni:
So I tried another font. Here's the same section of the resulting PDF using GT200001:
And here's the same section using Helvetica:
Here's the same section using GNU's FreeSans:
I would like that second line to show up as "(渋谷猿, ¥8,000)"
I'm not surprised that Helvetica and Freesans cannot render the kanji correctly, but I cannot fathom why the other two fonts can render the kanji, but not the yen symbol, which is much more common.
The web server creating the PDFs is LAMP running Ubuntu. I'm viewing the PDFs on OS X with Chrome (using its in-browser view). I've also tried downloading the PDFs with Firefox and displaying in Preview. I get essentially the same results: ArialUni and GT200001 don't display the yen symbol, while Helvetica and Freesans don't display the kanji (but do display the yen symbol).
I know I can use different fonts for different lines/cells of the PDF, but the kanji and yen symbol are on the same line.
How can I get the kanji and yen symbol to display in a single line using TCPDF?
Near the top of my PDF code, I load the font using TCPDF's addTTFfont();
$this->font = $this->addTTFfont(K_PATH_FONTS.'arialuni.ttf', 'TrueTypeUnicode', '', 32);
Here's the code I'm using to write the section of the PDF.
$pdf->SetFont('arialuni','',10);
$pdf->MultiCell(105, $remarks_height, $remarks, 'B', 'L', false, 0, '', '', true, 1, false, true, $remarks_height, 'T');
In this wikipedia article you can read some more about this character.
Basically, there are 2 different ways of writing this Japanese Kanji, as it happens with some other symbols. From accepted answer "I was using ¥, not ¥", we can see that he was using the 'occidental' or Unicode ¥ symbol, when he actually wanted to use the double-width character ¥.
Oh dear, I figured it out.
I was using ¥, not ¥. Sorry for being confused!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With