|
Does Linux hava default Chinese font? |
Posted by Alvin on Aug-22-2005 11:40 |
|
Hello,
I can see the Traditioinal Chinese font in my local computer with Window XP using "kaiu.ttf". ( pic1)
But in Linux, I don't know which font to use to make the Traditioinal Chinese characters look right. (pic2)
Does Linux have the similiar fonts like "kaiu.ttf" or "MingLiu.ttc"?
Thanks for your help.
|
Re: Does Linux hava default Chinese font? |
Posted by Peter Kwan on Aug-22-2005 13:59 |
|
Hi Alvin,
You need to refer to your Linux operating system to see which fonts are available. There are many brands of Linux, and some of them designed for Chinese usage may contain Chinese fonts. If your Linux contains Chinese fonts, please copy them to the ChartDirector fonts directory (in the "fonts" subdirectory under the directory that contains "libchartdir.so"), then you can use that font in ChartDirector.
If your Linux does not contain Chinese fonts, you may need to download one yourself.
I heard that there is a Chinese font "Cyberbit" in the Netscape web site below. You may try to look at it to see if it is free to use in your system.
ftp://ftp.netscape.com/pub/communicator/extras/fonts/windows/Cyberbit.ZIP
Hope this can help.
Regards
Peter Kwan |
Re: Does Linux hava default Chinese font? |
Posted by Alvin on Aug-22-2005 14:46 |
|
Hi, Peter
Thanks for your kindly help.
Our Linux version is Red Hat Linux 3.2.3-34 and we use ChartDirector for JSP/Java.
I have a question. What is the "ChartDirector fonts directory"? I still cannot find the file "libchartdir.so" location. |
Re: Does Linux hava default Chinese font? |
Posted by Peter Kwan on Aug-22-2005 17:00 |
|
Hi Alvin,
Sorry about this problem. I am not aware you are using Java. For Java, ChartDirector can use any fonts that is installed in your Java system. Please simply make sure you have a Chinese font in your Java system.
You may refer to your Java documentation on how to install fonts in your Java system. For example, for the SUN Java 1.4 VM, you may refer to http://java.sun.com/j2se/1.4.2/docs/guide/intl/
You may use the following code to list out the fonts in your system. If the code works normally, then your UNIX supports loading font files.
For your reference, you may use the following JSP code to list out the fonts in your Java system. Make sure it contains some Chinese capable fonts. Then use that font in your ChartDirector code.
<%
String[] f = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
for (int i = 0; i < f.length; ++i) {
%><%=f[i]%><br>
<% } %>
Regards
Peter Kwan |
Re: Does Linux hava default Chinese font? |
Posted by Alvin on Aug-22-2005 17:27 |
|
Hi Peter,
The ChartDirector code does'nt work. I try many times and still do'nt know what's wrong with codes above.
<%
String[] f = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
for (int i = 0; i < f.length; ++i) {
%><%=f[i]%><br>
<% } %>
I just saw the Sever Side Run-time Message without seeing any font name.
Would you give me another advise?
Thanks and best regards.
=============================================================
Aug 22, 2005 9:19:40 AM org.apache.jk.server.JkCoyoteHandler action
INFO: Response already commited
============================================================= |
Re: Does Linux hava default Chinese font? |
Posted by Peter Kwan on Aug-22-2005 18:04 |
|
Hi Alvin,
Please put the code in a new standalone JSP page, and not on your existing page. The error means that your existing page has already output something, and cannot ouptut further information.
Regards
Peter Kwan |
Re: Does Linux hava default Chinese font? |
Posted by Alvin on Aug-22-2005 18:05 |
|
Hi Peter,
The ChartDirector code does'nt work. I try many times and still do'nt know what's wrong with codes above.
<%
String[] f = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
for (int i = 0; i < f.length; ++i) {
%><%=f[i]%><br>
<% } %>
I just saw the Sever Side Run-time Message without seeing any font name.
Would you give me another advise?
Thanks and best regards.
=============================================================
Aug 22, 2005 9:19:40 AM org.apache.jk.server.JkCoyoteHandler action
INFO: Response already commited
============================================================= |
Re: Does Linux hava default Chinese font? |
Posted by Peter Kwan on Aug-22-2005 20:37 |
|
Hi Alvin,
1. Would you mind to include the exact source code file (the whole JSP file) you use for testing?
2. Please confirm that you are using the JSP server directly for testing. Do not use Apache web server, and do not use Struts. Just use Tomcat port 8080 (if you are using Tomcat as the web server) directly. The Apache mod_jk you are using may be configured not to show the true error message, etc..
Regards
Peter Kwan |
Re: Does Linux hava default Chinese font? |
Posted by Alvin on Aug-23-2005 09:22 |
|
Hi Peter,
(1)Here is my source code.
<%@ page language="java" contentType="text/html; charset=utf-8" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>test</title>
</head>
<body>
test
<%
try{
String[] f = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
for (int i = 0; i < f.length; ++i) {
System.out.println(f[i]);
}
} catch (Exception e){
System.out.println("e:"+e);
}
%>
</body>
</html>
(2)For some management of administration reason, I have called for help. This may be hold for a while.
Thanks. |
Re: Does Linux hava default Chinese font? |
Posted by Peter Kwan on Aug-23-2005 15:21 |
|
Hi Alvin,
I suspect your existing code is not correct. You are trying to output to the server console using System.out.println, but not to the browser. So it is normal that nothing is shown on the browser, as your code does not output to the browser. The server console window is not visible even on the server, if the Tomcat server is running in the background (which is typically the case).
To view the result on the browser, please try to use the code I attached:
<%@ page language="java" contentType="text/html; charset=utf-8" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>test</title>
</head>
<body>
<%
String[] f = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
for (int i = 0; i < f.length; ++i) {
%><%=f[i]%><br>
<% } %>
</body>
</html>
Another thing you may try is to run the "ChartDirector/jspdemo/cdinfo.jsp" that comes with ChartDirector. It will perform a font system test. If it reports the font system is not working in your Java system, you may need to configure your Java system to enable the font system.
It is possible that the entire Java GUI including the fonts are disabled in a Linux system that does not have GUI - such as in some rack mounted Linux servers - so called "headless" servers. If you are using such a system, please enable headless support in your Java VM. You may refer to your Java documentation for details. For example, the followings are description on how to enable headless support for SUN Java 1.4.2:
http://java.sun.com/j2se/1.4.2/docs/guide/awt/AWTChanges.html#headless
Hope this can help.
Regards
Peter Kwan |
Re: Does Linux hava default Chinese font? |
Posted by Alvin on Aug-23-2005 16:56 |
|
Hi Peter,
I have tried any possible method to figure it out.
But still have a little trouble.
<%@ page language="java" contentType="text/html; charset=utf-8" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>test</title>
</head>
<body>
<%
String[] f = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
for (int i = 0; i < f.length; ++i) {
%><%=f[i]%>
<% } %>
</body>
</html>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.I have put your code to server and execute it again.
But now "HTTP 404" was occured, the same situation as before.
=======================================================
Another thing you may try is to run the "ChartDirector/jspdemo/cdinfo.jsp" that comes with ChartDirector. It will perform a font system test. If it reports the font system is not working in your Java system, you may need to configure your Java system to enable the font system.
It is possible that the entire Java GUI including the fonts are disabled in a Linux system that does not have GUI - such as in some rack mounted Linux servers - so called "headless" servers. If you are using such a system, please enable headless support in your Java VM. You may refer to your Java documentation for details. For example, the followings are description on how to enable headless support for SUN Java 1.4.2:
http://java.sun.com/j2se/1.4.2/docs/guide/awt/AWTChanges.html#headless
==============================================================
2.After reading the docs, I tried to enable headless support for SUN Java 1.4.x by
execute the java command the docs said. But the result even tells nothing.
There may be something wrong but I still could'nt figure them out.
Need your help again.
==============================================================
3. Addtionally, I have found two font in Linux diectory. They are bkai00mp.ttf and bsmi00lp.ttf
I am sure both of them support Traditional Chinese language.
==============================================================
4. When I try to install Cyberbit.ttf, I find an additional directory "yudit". Is it necessary?
I do'nt know the function of yudit.
===============================================================
Sorry, with so many questions to ask. It's not easy to answer, right?
Cheers.
|
Re: Does Linux hava default Chinese font? |
Posted by Peter Kwan on Aug-24-2005 02:22 |
|
Hi Alvin,
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 1.I have put your code to server and execute it again.
> But now "HTTP 404" was occured, the same situation as before.
> =======================================================
The HTTP 404 means your web page does not exist in the specified URL.
Are you sure the URL in fact points to your web page? To test if the URL points to your web page, I suggest you remove my code, and replace it with a "Hello World" script, like:
<%@ page language="java" contentType="text/html; charset=utf-8" %>
<% = "Hello World" %>
If the Hello World script returns HTTP 404, it means your URL is not pointing to your web page. This may be because the web page is put in the wrong directory, or of case sensitivity issues with file names or directory names, etc.. Anyway, you need to confirm what is the URL of your web page before you can test it.
> ==============================================================
> 2.After reading the docs, I tried to enable headless support for SUN Java 1.4.x by
> execute the java command the docs said. But the result even tells nothing.
> There may be something wrong but I still could'nt figure them out.
> Need your help again.
> ==============================================================
First, have you tried the "cdinfo.jsp" I mentioned to test whether you need to enable "headless" support at all?
If you need to enable "headless" support, please enable it for the Java VM used by your JSP web server. In your current case, you are enabling headless support for a Java VM that does nothing, so nothing happens.
First, you need to know how your JSP web server (is it Tomcat?) get started in the first place. For some versions of Tomcat, it is started by some shell scripts that runs Java, and the Java options may be configured by using the JAVA_OPTS environmental variable. So you just need to add "-Djava.awt.headless=true" in your JAVA_OPTS environmental variable and restart Tomcat. For the exact details, you would need to refer to your JSP server documentation.
> 3. Addtionally, I have found two font in Linux diectory. They are bkai00mp.ttf and bsmi00lp.ttf
> I am sure both of them support Traditional Chinese language.
> ==============================================================
> 4. When I try to install Cyberbit.ttf, I find an additional directory "yudit". Is it necessary?
> I do'nt know the function of yudit.
> ===============================================================
I do not know the function of yudit either. Anyway, I think you just need to follow the Java documentation to install fonts.
Regards
Peter Kwan |
Re: Does Linux hava default Chinese font? |
Posted by Alvin on Aug-24-2005 13:06 |
|
Http 404 occurs only by adding font testing code.
If I remove font testing code. "Hello World" shows.
Thus it's not the problem of URL pointing to that web page.
Now I know how to set the JAVA_OPTS environment variable for webserver Tomcat.
Below is ChartDir message "cdinfo.html" run from our linux server.
In cdinfo.html, it tells
"The Java font system (java.awt.Font) is not working (java.lang.NoClassDefFoundError) - using ChartDirector internal font system"
I also wonder how to add Chinese Font into "ChartDirector internal font system" for java?
cdinfo.htm |
---|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0050)http://dvpbmg.shipmentlink.com/tvs3/jsp/cdinfo.jsp -->
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2722" name=GENERATOR></HEAD>
<BODY leftMargin=0 topMargin=0 rightMargin=0 marginheight="0" marginwidth="0">
<DIV style="MARGIN: 5px">
<DIV
style="FONT-WEIGHT: bold; FONT-SIZE: 18pt; FONT-FAMILY: verdana">ChartDirector
Information </DIV>
<HR color=#000080>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: verdana">
<UL
style="MARGIN-TOP: 0px; FONT-SIZE: 10pt; FONT-FAMILY: verdana; LIST-STYLE-TYPE: square">
<LI>Description : ChartDirector<BR><BR>
<LI>Version : 4.0.1<BR><BR>
<LI>Copyright : Copyright (c) 2005 Advanced Software Engineering
Limited<BR><BR>
<LI>Boot Log : <BR>
<UL>
<LI>2005-08-24 00:58:37> Cannot load license file chartdir.lic -
java.io.FileNotFoundException: chartdir.lic (No such file or directory)
<LI>2005-08-24 00:58:37> The Java font system (java.awt.Font) is not
working (java.lang.NoClassDefFoundError) - using ChartDirector internal font
system
<LI>Updated license check at 2005-08-24 04:28:17> Cannot load license
file chartdir.lic - java.io.FileNotFoundException: chartdir.lic (No such
file or directory)</LI></UL><BR>
<LI>Font Loading Test : <BR>
<UL>
<LI>Trying to open font Arial at 8.0 pts.
<LI>Using ChartDirector internal font system.
<LI>Font Arial is mapped to helv.font.
<LI>Font helv.font successfully opened
<LI>Using Java font system (java.awt.Font).
<LI>java.lang.NoClassDefFoundError</LI></UL></LI></UL></DIV></DIV></BODY></HTML>
|
| |
Re: Does Linux hava default Chinese font? |
Posted by Peter Kwan on Aug-24-2005 17:24 |
|
Hi Alvin,
The "cdinfo.jsp" shows that your Java font system is not working. There is no need to try the font testing code now, as it cannot work if your Java font system is not working.
Please kindly configure your Tomcat system to run in headless mode. Once you get the java font system working, you may try to use the font testing code, and to install the Chinese fonts.
The "ChartDirector Internal Font System" is just a very simple system used as a backup in case the Java font system is not working. It cannot support any additional fonts. To use Chinese, you would need to ensure your Java VM supports Chinese. ChartDirector always supports any language that your Java VM supports.
Regards
Peter Kwan |
Re: Does Linux hava default Chinese font? |
Posted by Alvin on Aug-24-2005 18:31 |
|
Hi Peter,
Your reply makes me more and more excited.
After configuring the Tomcat system variable, the cdinfo.jsp works.
Above is the running message.
--------------------------------------------
Hello Alvin.
isHeadless():true
Bitstream Charter
Courier
Courier 10 Pitch
Cursor
Default
Dialog
DialogInput
Kochi Gothic
Kochi Mincho
Lucida Bright
Lucida Sans
Lucida Sans Typewriter
Luxi Mono
Luxi Sans
Luxi Serif
Monospaced
SansSerif
Serif
Utopia
------------------------------
It's the Headless mode issues as you mentioned before.
But now I know the "Font Name", how to include that font?
(I don't know the file name of that font name, for example "Cyberbit.ttf")
Why I can use the Chinese font in Windows XP Sytem even Headless mode is false in Java?
Thanks. |
Re: Does Linux hava default Chinese font? |
Posted by Peter Kwan on Aug-24-2005 20:09 |
|
Hi Alvin,
You may use the font by specifying the font name in the various ChartDirector API. For example:
//use Kochi Mincho as the font in chart title
c.addTitle("This is my Title", "Kochi Mincho", 15);
or
//use Luxi Sans as the default font
c.setDefaultFonts("Luxi Sans", "Luxi Sans Bold");
There does not seem to be a Chinese font recoginzed by Java. This means the Java VM is not using the font "Cyberbit.ttf" yet.
I think the font name of the cyberbit.ttf font is "BitStream CyberBit".
Anyway, I think in your case, it is almost done. You just need to install the font in Java as per Java documentation. May be you can try to just copy the "cyberbit.ttf" file to "<java runtime directory>/lib/fonts" and restart your Tomcat to see if it works.
Headless mode is needed only if the operating system does not support GUI. Windows always support GUI. So headless mode is never needed. Linux may not support GUI (if it is a rack mounted server instead of a workstation), and so headless mode may be needed.
Regards
Peter Kwan |
Re: Does Linux hava default Chinese font? |
Posted by Alvin on Aug-25-2005 09:43 |
|
Hi Peter,
Thanks for your help, the finally the Chinese font has shown in chart.
Although the font is a bit unclear.
I also copy XP Chinese fonts into java font path. And it works.
(For example kaiu.ttf, mingliu.ttc)
To use all fonts but not in the headless mode may cause why HTTP 404 occured before,
Best regards. |
|