Create | Chinese I am using fpdf (www.fpdf.org), download the Fpdf class library, and use the following Chinese class library to support Chinese, but only one Chinese font (Chinese imitation) can be used. I've been bothering for a long time, and now I'm done. Convert TrueType fonts to pt1 font usage:
The following is a library of Chinese classes found on the fpdf:
<?php
Require (' fpdf.php ');
$Big 5_widths=array (' =>250 ', '! ') =>250, ' ' =>408 ', ' ' # ' =>668, ' $ ' =>490, '% ' =>875, ' & ', ' =>698, '
' (' =>240, ') ' =>240, ' ' * ' =>417, ' + ' ' =>667, ', ' ' =>250, ' '-' =>313, '. ' =>250, '/' =>520, ' 0 ' =>500, ' 1 ' =>500,
' 2 ' =>500, ' 3 ' =>500, ' 4 ' =>500, ' 5 ' =>500, ' 6 ' ' =>500, ' 7 ' ' =>500, ' 8 ' =>500, ' 9 ' => ': ' =>250 '; ' =>250,
' < ' =>667, ' = ' =>667, ' > ' =>667, '? ' =>396, ' @ ' =>921, ' A ' =>677, ' B ' =>615, ' C ' ' =>719, ' ' D ' =>760, ' E ' =>625,
' F ' =>552, ' G ' =>771, ' H ' =>802, ' I ' =>354, ' J ' =>354, ' K ' ' =>781, ' L ' =>604, ' ' M ' => 927, ' N ' =>750, ' O ' =>823,
' P ' =>563, ' Q ' =>823, ' R ' =>729, ' S ' =>542, ' T ' =>698, ' U ' ' =>771, ' ' V ' =>729, ' ' W ' => 948, ' X ' =>771, ' Y ' =>677,
' Z ' =>635, ' [' =>344, ' ' =>520, '] ' =>344, ' ^ ' =>469, ' ' _ ' =>500, ' ' ' =>250, ' a ' ' =>469 , ' B ' =>521, ' C ' =>427,
' d ' =>521, ' e ' =>438, ' f ' =>271, ' G ' =>469, ' h ' =>531, ' I ' =>250, ' j ' =>250, ' ' K ' ' => 458, ' l ' =>240, ' m ' =>802,
' N ' =>531, ' o ' =>500, ' P ' =>521, ' Q ' =>521, ' R ' ' =>365, ' ' =>333, ' ' t ' =>292, ' ' U ' => 521, ' V ' =>458, ' W ' =>677,
' x ' =>479, ' y ' =>458, ' z ' =>427, ' {' =>480, ' | ' =>496, ' =>480 ', ' =>667 ';
$GB _widths=array (' =>207 ', '! ') =>270, ' ' =>342 ', ' ' # ' =>467, ' $ ' =>462, '% ' =>797, ' & ', ' =>710, '
' (' =>374, ') ' =>374, ' ' * ' =>423, ' + ' ' =>605, ', ' ' =>238, ' '-' =>375, '. ' =>238, '/' =>334, ' 0 ' =>462, ' 1 ' =>462,
' 2 ' =>462, ' 3 ' =>462, ' 4 ' =>462, ' 5 ' =>462, ' 6 ' ' =>462, ' 7 ' ' =>462, ' 8 ' =>462, ' 9 ' => 462, ': ' =>238, ' =>238,
' < ' =>605, ' = ' =>605, ' > ' =>605, '? ' =>344, ' @ ' =>748, ' A ' =>684, ' B ' =>560, ' C ' ' =>695, ' ' D ' =>739, ' E ' =>563,
' F ' =>511, ' G ' =>729, ' H ' =>793, ' I ' =>318, ' J ' =>312, ' K ' ' =>666, ' L ' =>526, ' ' M ' => 896, ' N ' =>758, ' O ' =>772,
' P ' =>544, ' Q ' =>772, ' R ' =>628, ' S ' =>465, ' T ' =>607, ' U ' ' =>753, ' ' V ' =>711, ' ' W ' => 972, ' X ' =>647, ' Y ' =>620,
' Z ' =>607, ' [' =>374, ' ' =>333, '] ' =>374, ' ^ ' =>606, ' ' _ ' =>500, ' ' ' =>239, ' a ' ' =>417 , ' B ' =>503, ' C ' =>427,
' d ' =>529, ' e ' =>415, ' f ' =>264, ' G ' =>444, ' h ' =>518, ' I ' =>241, ' j ' =>230, ' ' K ' ' => 495, ' l ' =>228, ' m ' =>793,
' N ' =>527, ' o ' =>524, ' P ' =>524, ' Q ' =>504, ' R ' ' =>338, ' ' =>336, ' ' t ' =>277, ' ' U ' => 517, ' V ' =>450, ' W ' =>652,
' x ' =>466, ' y ' =>452, ' z ' =>407, ' {' =>370, ' | ' =>258, ' =>370 ', ' =>605 ';
Class Pdf_chinese extends FPDF
{
function Addcidfont ($family, $style, $name, $CW, $CMap, $registry)
{
$i =count ($this->fonts) +1;
$fontkey =strtolower ($family). Strtoupper ($style);
$this->fonts[$fontkey]=array (' i ' => $i, ' type ' ' => ' Type0 ', ' name ' => $name, ' up ' ' =>-120, ' ut ' = >40, ' CW ' => $CW, ' CMap ' => $CMap, ' registry ' => $registry);
}
The above code can be referenced by saving it as chinese.php. But using it can only get one font. In order to support all Chinese fonts, you can use the TTF2PT1 program to convert TrueType fonts into pt1 fonts, one by one (detailed in fpdf tutorials). In order to support other Chinese fonts, nutrients should be modified above the chinese.php, as follows:
1:replace the following line in the Addgbfont () method:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.