Conversion and embedding of Linux Chinese Fonts

Source: Internet
Author: User
Linux Chinese font conversion and embedding-general Linux technology-Linux programming and kernel information. The following is a detailed description. Both Postscript files and PDF files can directly embed the required fonts. You can only prompt the desired fonts and the encoding indexes of each word in the fonts. The file size of the latter is certainly smaller than that of the former, but the premise is that the font names and specifications used in the file must have a general standard, this document can be read and printed in various environments. Therefore, generally only contains ASCII or ISO8859-1 text Postscript files are not embedded font, but a Chinese file in the current common circumstances must be embedded font, the reason is that there are no common Chinese fonts and specifications.

In the early days (when the PDF format was not available yet), the embedded Chinese font source was a lattice font named HBF, at that time, there were many programs that could convert HBF fonts into a format that can be used by Postscript. However, the resolution of such lattice fonts is limited, so embedded in Postscript files is often not beautiful enough, especially when we want to scale up or down a certain amount of text. Later, due to the popularity of TrueType fonts and the advent of freetype library, the engine that can handle TrueType fonts, many TrueType type conversion programs based on this library were developed one by one, makes it the most important source of embedded fonts in Postscript and PDF. The file with built-in TrueType conversion fonts is not only more beautiful than in the past, but also has the scalability feature, so we can easily generate high-resolution conversion fonts, this ensures that files are not distorted with limited scaling. At the same time, thanks to winding's support for the Free Software world, two TrueType Chinese fonts were donated for free use, which allowed us to completely solve the problem of Chinese file output.

The best solution is still to avoid the need to embed Chinese fonts. The advantages of this solution can not only make the output file smaller, it also ensures scaling at any scale without distortion. Because the fonts embedded in the file are converted into lattice fonts in many cases, (for example, a dot matrix character converted from TrueType To PK is embedded in the file compiled by CJK-LaTeX ). Only the converted fonts have a relatively high resolution, but the higher resolution is also limited, so it will still be distorted during large-scale scaling. There are a lot of work to do to truly not embed Chinese fonts in files, including:

1. a unified set of font names and specifications is required: this may be the biggest headache, because authorization problems are stuck here. Since the Postscript and PDF file formats are developed by Adobe, the font names used by them are filled with Adobe's names. Can these names be in the Free Software world, running with free software game rules will be a problem, especially in PDF. At the same time, when setting these names and specifications, we cannot close the door and decide for ourselves. We must talk to many groups at the same time, it may include Adobe, TeX/LaTeX Development Team, Ghostscript Development Team, and even other typographical and font-related plans and business companies.

2. there must be a source of fonts: This has been a preliminary achievement at this stage. At present, we have tools to convert TrueType to Type1 fonts required by Postscript, such as ttf2pt1, chpfb, ttf2pfb, etc. In addition, there is also a library called t1lib, which can be used to further process Type1 fonts, such as scaling and rotating words, or convert it into a lattice format for other purposes .... and so on.

3. If we have the Type1 font, we can further synthesize it into the CID-Keyed font of Type0, which can be used in Postscript and PDF files.

4. our file conversion engine: Ghostscript must be able to process multi-byte encoding and utilize these fonts: This is also under development, for example, the next generation of Ghostscript has the ability to process multi-byte encoding. In addition to the Chinese Type1 font, it also contains a module that can directly use the TrueType font, you can use the TrueType font to display files without embedding the fonts. The principle is to simulate the TrueType font into the Type0 CID-Keyed font. However, this may face portability issues. In case this file is taken to other systems without the TrueType font installed, it cannot be read. Therefore, it is also developing a technology that directly embeds TrueType fonts as a supporting measure to address this problem.

Generation of Chinese Postscript and PDF files

· At present, the commonly used program for converting plain text files to Postscript formats is the bg5ps program written in the python language. The Postscript files generated by the program are embedded with Chinese fonts, the source of Chinese fonts is TrueType.

CJK-LaTeX

· It is a powerful behind-the-scenes typographical system. It formats and orchestrates files in a way similar to programming languages and works with Postscript output to easily meet the output requirements of high-quality files. In particular, it is easy to deal with the characteristics of mathematical symbols, making it particularly suitable for the typographical work of academic documents, books, and publishing. To enable LaTeX to process Chinese characters, you must add a CJK-LaTeX macro to the LaTeX system. Gu mingyu, this macro can give LaTeX the ability to process Chinese, Japanese, Korean and other encoding systems, and it has gradually become one of LaTeX standards. When a Postscript file is generated, it uses an embedded Chinese font, and its source is TrueType. It uses the derivative tools ttf2tfm and ttf2pk of freetype library to convert TrueType fonts into TFM and PK lattice fonts. The former is used for the layout of the front section, and the latter is used for the final font embedding.

LaTeX coat-LyX

LyX is a graphical typographical System Based on LaTeX, so that we do not have to remember a lot of LaTeX typographical commands, you can directly orchestrate our files in the window, the final typographical output is handled by LaTeX. Its support for Chinese characters is gradually developing, including the support for XIM protocol, so that we can use the XIM server Input Method program to directly type Chinese Characters in its window. The CJK-LaTeX command can be correctly used after a few modifications.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.