请输入您要查询的百科知识:

 

词条 FreeType 2
释义

§ 概要

FreeType 2被设计为一种占用空间小的、高效的、高度可定制的、并且可以产生可移植的高品质输出(符号图像)。可以被用在诸如图像库、展出服务器、字体转换工具、图像文字产生工具等多种其它产品上。

请注意FreeType 2是一种字体服务而没有提供为实现文字布局或图形化处理这样高阶的功能使用的API(比如带色文字渲染之类的)。然而,它提供一个简单的、易用的并且统一的接口实现对多种字体文件的访问,从而大大简化了这些高级的任务。

FreeType 2的发行遵循两个开源许可:我们自己的BSD样式的FreeType License和GPL(通用公共许可证)。它可以被用在任何程序中,无论是专有与否。

§ 特性

下面是 FreeType 2 提供的特性的一个不完全列表:

·FreeType 2 为访问字体文件提供了一套统一的、独立于字体文件类型的、简单而易用的API。另外,一些特别类型的API可以用来访问字体文件里的特殊数据。

·与大多数同类的字库不同,FreeType 2 生来就支持类似TrueType 或者 Type 1的可缩放字体类型,并且可以将字体的大纲数据(控件介绍/提示)返回给各户应用程序。

·FreeType 2 的设计是基于模块的,这些模块可以在编译时被静态链接到库中或者在运行时根据需要加载。模块可以用来支持特殊的字体格式,或者甚至是新的符号图像类型!

·FreeType 2 特意使用嵌入式系统编写,这意味着它不使用静态可写数据(也就是说,它可以直接从ROM中运行),这样客户程序就可以只为他们自己提供内存管理和输入/输出流的实现。

客户程序自己的输入/输出流可以使你轻易地使用相同的API读取基于ROM或被压缩的或远程的字体文件。多个流实现可以并行的被一个FreeType 2 实例使用。

你可以只编译那些你的嵌入式工程或环境需要的模块,从而有效的减小FreeType 2 的代码大小。

·FreeType 2 默认支持下面的字体类型:

TrueType 字体(集合)

Type 1 字体

CID-keyed Type 1 字体

CFF 字体

OpenType fonts (包括 TrueType 和 变体CFF )

SFNT-based bitmap 字体

X11 PCF 字体

Windows FNT 字体

BDF 字体 (包括反走样类型的)

PFR 字体

Type 42 字体 (有限支持)

·通过一个给定的字形轮廓,FreeType 2 有能力产生一个高质量的单色位图或一幅使用年256阶灰度的不走样的像素图。这比Windows 9x/98/NT/2000 或 FreeType 1使用的5阶灰度像素图要好得多。

·FreeType 2 支持 TrueType 和 OpenType 规格定义的全部字符映射。同时,它也完全有能力自动合成Type 1 使用的那种Unicode字符表,这种表要求必须把一个那种令人头痛的供转换编码时使用的结束符放置在标的末尾——这在Type 1 使用的那种格式中是很常见的(当然,如果你需要,那种原始的编码方式也是可用的)。

·FreeType 2 的核心API提供了对访问字形名或调整数据中字符间距这样的高级信息的函数支持。

·一个完整且有效率的TrueType字节码解释器。这个引擎可以用很小的点产生极好的输出。由于TrueType规格极其令人费解且十分含糊,这个组件想要成功完成输出是极其困难的。但无论如何,我们现在已经能使Windows的显示质量达到Mac的水平。

·对于那些不需要或不希望为TrueType字体使用字节码解释器的人,我们开发了我们自己的自动提示模块。这种模块过去也曾被一些可缩放的字体使用过。

·FreeType 2 可以产生一些相似的字体引擎无法产生的信息,例如字距调整的位距、字符名、垂直度量之类的。

由于它模块化的设计,可以很方便地通过可选的API更改FreeType库来提供另外的针对特定字体类型的信息。(例如,一个可选的API用来检索TrueType 和 OpenType 字体的SFNT表。

·自从2.0.1版发布开始,FreeType 2 开始提供它自己的超高速缓存子系统。可以利用它缓存可变实例或字形图像,使它们拥有更高的效率。

§ 原文

What is FreeType 2?

FreeType 2 is a software font engine that is designed to be small, efficient, highly customizable, and portable while capable of producing high-quality output (glyph images). It can be used in graphics libraries, display servers, font conversion tools, text image generation tools, and many other products as well.

Note that FreeType 2 is a font service and doesn't provide APIs to perform higher-level features like text layout or graphics processing (e.g., colored text rendering, ‘hollowing’, etc.). However, it greatly simplifies these tasks by providing a simple, easy to use, and uniform interface to access the content of font files.

FreeType 2 is released under two open-source licenses: our own BSD-like FreeType License and the GPL. It can thus be used by any kind of projects, be they proprietary or not.

--------------------------------------------------------------------------------

Features

The following is a non-exhaustive list of features provided by FreeType 2.

FreeType 2 provides a simple and easy-to-use API to access font content in a uniform way, independently of the file format. Additionally, some format-specific APIs can be used to access special data in the font file.

Unlike most comparable libraries, FreeType 2 supports scalable font formats like TrueType or Type 1 natively and can return the outline data (and control instructions/hints) to client applications.

The design of FreeType 2 is based on modules that can be either linked statically to the library at compile time, or loaded on demand at runtime. Modules are used to support specific font formats, or even new glyph image formats!

FreeType 2 was written with embedded systems in mind. This means that it doesn't use static writable data (i.e., it can be run from ROM directly), and that client applications can provide their own memory manager and I/O stream implementation.

The latter allows you to easily read from ROM-based, compressed or remote font files with the same API. Several stream implementations can be used concurrently with a single FreeType 2 instance.

You can also reduce the size of the FreeType 2 code by only compiling the modules you need for your embedded project/environment.

By default, FreeType 2 supports the following font formats.

TrueType fonts (and collections)

Type 1 fonts

CID-keyed Type 1 fonts

CFF fonts

OpenType fonts (both TrueType and CFF variants)

SFNT-based bitmap fonts

X11 PCF fonts

Windows FNT fonts

BDF fonts (including anti-aliased ones)

PFR fonts

Type 42 fonts (limited support)

From a given glyph outline, FreeType 2 is capable of producing a high-quality monochrome bitmap, or anti-aliased pixmap, using 256 levels of ‘gray’. This is much better than the 5 levels used by Windows 9x/98/NT/2000 or FreeType 1.

FreeType 2 supports all the character mappings defined by the TrueType and OpenType specification. It is also capable of automatically synthetizing a Unicode charmap from Type 1 fonts, which puts an end to the painful ‘encoding translation’ headache common with this format (of course, original encodings are also available in the case where you need them).

The FreeType 2 core API provides simple functions to access advanced information like glyph names or kerning data.

A full-featured and efficient TrueType bytecode interpreter. The engine is able to produce excellent output at small point sizes. This component has been extremely difficult to get right, due to the ambiguous and misleading TrueType specification. However, we now match Windows and Mac qualities. Please read our patents page to learn more about some issues when using the interpreter.

For those who don't need or want to use the bytecode interpreter for TrueType fonts, we developed our own automatic hinter module. It is also used by other scalable formats.

FreeType 2 provides information that is often not available from other similar font engines, like kerning distances, glyph names, vertical metrics, etc.

Due to its modular design, it is easy to enhance the library to provide additional format-specific information through optional APIs (as an example, an optional API is provided to retrieve SFNT tables from TrueType and OpenType fonts).

FreeType 2 provides its own caching subsystem since release 2.0.1. It can be used to cache either face instances or glyph images efficiently.

--------------------------------------------------------------------------------

Requirements

FreeType 2 is written in industry-standard ANSI C and should compile easily with any compliant C compiler. We have even taken great care to eliminate all warnings when compiling with popular compilers like gcc, Visual C++, and Borland C++.

Apart from a standard ANSI C library, FreeType 2 doesn't have any external dependencies and can be compiled and installed on its own on any kind of system.

--------------------------------------------------------------------------------

Patents Issues

Since some small aspects of the TrueType specification are covered by several patents owned by Apple Computer, Inc., it is generally not possible to render TrueType glyphs exactly as they should without infringing on Apple's IP rights (without a license).

This explains that we have taken some special measures to deal with this problem:

First of all, a default build of the FreeType 2 sources does not use any of the patented techniques to render TrueType glyphs. You are thus safe to use it freely in all kinds of projects.

Unfortunately, this freedom comes at the price of sometimes less than ideal glyph quality, depending on the font design, and most surely different glyph metrics for a given font.

In the case where you want the best TrueType glyph quality (for example, if you are in a country where the patent doesn't apply, or if you have a license from Apple), you simply have to toggle a single configuration macro before compiling and installing the library.

More information regarding this topic is available at our TrueType patents page. In case you would like to obtain a license from Apple, please contact their legal department, as we are unable to give you any information regarding its availability or pricing.

随便看

 

百科全书收录594082条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2024/11/11 9:22:05