Home > Backend Development > PHP Tutorial > About the Chinese display of jpGraph. . . _PHP Tutorial

About the Chinese display of jpGraph. . . _PHP Tutorial

WBOY
Release: 2016-07-13 17:12:06
Original
1269 people have browsed it

I read a post here two days ago. . . There is something called JPGRAPH, and I think it is really practical. It really saves us a lot of effort in graphic statistics, so I have been trying it out, and then I saw:
Note: This information is only given here for very advanced users. No free support will ge given in the case you run into difficulties trying to add new fonts. At the moment adding new fonts require code modifications as outlined below.
At this point, most of my enthusiasm is gone. . . . Can a novice like me only use simsun.ttf? Later, I tried to change the names of many Chinese fonts to simsun.ttf, and found that most of the Chinese characters could be displayed normally. . . (It may be all in Chinese), I don’t dare to keep it to myself, so I will post the usage method to share with everyone (I think there may be many experts who know the method, so I will show my shame here...).
There are some people who are using it. When using a text display class, you must use the SetFont method to set the font in advance. It has three parameters: font name, font size, and size. Currently, in Chinese, JPGraph only supports simsun fonts. If you want to use it, you need to add it using the following method:
First use it in jpgraph.php: DEFINE ("TTF_DIR", "/usr/local/fonts/ttf/" ); Define the path of the font (you can put the font here in the future)
Then find this line of comment " // Chinese font "
in jpgraph.php and define it like this below: define("FF_SIMFANG",9);(In order to make it easy to understand, the format is: use "FF_" at the beginning plus the font name, "9" is the value of the constant, as long as it is not the same as its original value, no value will matter. The problem is as long as it’s not too big)
Now make the insinuation:
Find the comment "// CONSTRUCTOR" (at this point, if you are smart, you must know what is going on), and add something like this to the array:
FF_SIMFANG=>array(FS_NORMAL=>'simfang',FS_BOLD=>',FS_ITALIC=>',FS_BOLDITALIC=>'), the array has four items, the first one is the standard font , the second is bold, the third is italic, and the fourth is bold italic. Each item corresponds to a font file, and their value is the font file name without the extension. If there is no extension, there is no need to fill it in, except for the standard.
Come here, the addition of general English fonts has been completed, but Chinese is still restricted. The key lies in the following places:
Find the LanguageConv class, that is, find "class LanguageConv"
In the function Convert() In "elseif( $aFF === FF_SIMSUN )", use or ("||") to add the font name you defined before, such as "$aFF====FF_SIMFANG"
Okay, now you try it, you're done !!



www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/629492.htmlTechArticleI read a post here two days ago. . . There is something called JPGRAPH, and I think it is really practical. It really saved us a lot of effort in graphic statistics, so I have been trying it out. Later...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template