📄 ft2faq.html
字号:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="Author"
content="David Turner">
<title>FreeType 2 FAQ</title>
</head>
<body text="#000000"
bgcolor="#FFFFFF"
link="#0000EF"
vlink="#51188E"
alink="#FF0000">
<font size=1>http://www.freetype.org</font><p>
<h1 align=center>
<a href="freetype.html">
<img src="image/freetype.jpg"
width=550 height=105
alt="The FreeType Project"
border=0></a>
<h1>The FreeType 2 FAQ</h1>
</h1>
<center>
<table width="75%">
<tr><td>
<hr><p>
Document index
<ul>
<li><a href="#general">General</a>
<ul><p>
<li>
<a href="#general-what">What is FreeType 2 ?</a>
</li>
<li>
<a href="#general-uses">What can I do with FreeType 2 ?</a>
</li>
<li>
<a href="#general-donts">What can't I do with FreeType 2 ?</a>
</li>
<li>
<a href="#general-portability">How portable is FreeType 2 ?</a>
</li>
<li>
<a href="#general-freetype1">What are the differences between
FreeType 1.x and FreeType 2 ?</a>
</li>
<li>
<a href="#general-truetype">What about the TrueType patents ?</a>
</li>
<li>
<a href="#general-ft1">Is FreeType 2 backwards compatible
to FreeType 1.x?</a>
</li>
<li>
<a href="#general-edit">Can I use FreeType 2 to edit fonts
or create new ones?</a>
</li>
</p></ul>
</li>
<li><a href="#builds">Compilation & Configuration</a>
<ul><p>
<li>
<a href="#builds-compile">How do I compile the FreeType 2
library?</a>
</li>
<li>
<a href="#builds-problems">I've tried to compile FreeType 2, but
I'm having problems. What can I do ?</a>
</li>
<li>
<a href="#builds-config">How do I configure my library build?</a>
</li>
<li>
<a href="#builds-modules">How do I select the modules I need?</a>
</li>
<li>
<a href="#builds-flat">How do I compile all FreeType 2 files
in a single directory?</a>
</li>
</p></ul>
</li>
<li>
<a href="#autohint">The FreeType 2 autohinter</a>
<ul><p>
<li>
<a href="#autohint-license">Under which license is the auto-hinter
released?</a>
</li>
<li>
<a href="#autohint-work">How does auto-hinting work in
FreeType 2?</a>
</li>
<li>
<a href="#autohint-cjk">Why doesn't the auto-hinter work well
with CJK fonts?</a>
</li>
</p></ul>
</li>
<li>
<a href="#other">Other questions</a>
<ul><p>
<li>
<a href="#other-bbox">How can I compute the dimensions of glyphs
before rendering them ?</a>
</li>
<li>
<a href="#other-ascent">How can I determine the ascent, descent
or "x-height" of glyphs before rendering them ?</a>
</li>
<li>
<a href="#other-color">How can I set the color of text rendered
by FreeType?</a>
</li>
<li>
<a href="#other-depth">Can I use FreeType to draw text on a pixmap
with arbitrary depth?</a>
</li>
<li>
<a href="#other-size">I set the pixel size to 8x8, but the
resulting glyphs are larger than that. Why?</a>
</li>
<li>
<a href="#other-bbox">How can I compute the bounding box of a text
string without loading its glyphs?</a>
</li>
<li>
<a href="#other-antialias">Which anti-aliasing algorithm is
used in the FreeType 2 renderer?</a>
</li>
<li>
<a href="#other-opentype">When will FreeType 2 support
OpenType?</a>
</li>
</p></ul>
</li>
</ul>
<p><hr></p>
<table width="100%">
<tr bgcolor="#CCCCEE"><td>
<h2 align=center>
<a name="general">General questions & answers
</h2>
</td></tr>
<tr><td>
<p>
<a name="general-what">
<h3>
I.1 What is FreeType 2 ?
</h3>
<p>It's a software library that can be used by all kinds of applications
to access the content of font files. Most notably, it supports the
following "features":</p>
<ul>
<li><p>
It provides a uniform interface to access font files. It supports
both bitmap and scalable formats, including TrueType, OpenType,
Type1, CID, CFF, Windows FON/FNT, X11 PCF.
</p></li>
<li><p>
It supports high-speed anti-aliased glyph bitmap generation with
256 levels of gray.
</p></li>
<li><p>
It is extremely modular, each font format being supported by
a specific module. A build of the library can be tailored to support
only the formats you need, thus reducing code size
(a minimal anti-aliasing build of FreeType can be less than 30 Kb)
</p></li>
</ul>
<hr><a name="general-uses">
<h3>
I.2 What can I do with FreeType 2 ?
</h3>
<p>FreeType 2 is already used in countless product. For example:</p>
<ul>
<li>in graphics subsystem and libraries to display text</li>
<li>in text layout and pagination services to measure and
eventually render text</li>
<li>in font inspection and conversion tools</li>
</ul>
<p>Generally speaking, the library allows you to access and manage
the content of font files in a very easy way.</p>
<hr><a name="general-donts">
<h3>
I.3 What can't I do with FreeType 2 ?
</h3>
<p>FreeType 2 doesn't try to perform a number of sophisticated things,
because it focuses on being an excellent <em>font service</em>.</p>
<p>This means that the following are not supported directly by the
library, even though they can be more or less be implemented on
top of it, or by using it:</p>
<ul>
<li><p><b>rendering glyphs to arbitrary surfaces</b><br>
FT2 doesn't try to be a graphics library and thus only supports
two pixel formats when rendering glyphs: monochrome 1-bit
bitmaps, or 8-bit gray-level pixmaps.</p>
<p>If you need to draw glyphs to other kinds of surfaces
(for example, a 24-bit RGB pixmap), you'll need to use your
favorite graphics library to do just that.</p>
<p><em>Note however that in the case of rendering scalable glyph
outlines to anti-aliased pixmaps, an application can also provide
its own rendering callback in order to draw or compose directly
the anti-aliased glyph on any target surface.</em></p>
</li>
<li><p><b>glyph caching</b><br>
Each time you request a glyph image from a font, FT2 does it
by parsing the relevant portion of the font file/stream and
interpreting it according to its font format. This can be very
slow for certain formats, including scalable ones like TrueType
or Type 1.</p>
<p>Any decent text-rendering sub-system must thus be capable of
caching glyph data in order to reach appropriate rendering speed</p>
<p><em>Note that we provide a beta caching sub-system with FreeType 2
since version 2.0.1. Even though you're free to write your own
to suit your needs.</em></p>
</li>
<li><p><b>text layout</b><br>
The library doesn't support the text layout operations. Sophisticated
operations like glyph substitution, positioning (kerning),
justification, bi-directional ordering, etc.. are not part of a
<em>font service</em> in itself.</p>
</ul>
<hr><a name="general-portability">
<h3>
I.4 How portable is FreeType 2 ?
</h3>
<p>The FreeType 2 source code is <em>extremely</em> portable for the
following reasons:</p>
<ul>
<li>Everything is written in standard ANSI C</li>
<li>We're very pedantic to avoid any kinds of compiler warnings. The
current source code has been compiled with many compilers without
producing a single warning.</li>
<li>The library doesn't use any static writable data at all, making
it an ideal choice on various embedded systems (e.g. it can be
run from ROM directly)</li>
</ul>
<p>Meanwhile, we've made great efforts to ensure that the library is
both efficient, compact and customizable.</p>
<hr><a name="general-freetype1">
<h3>
I.5 What are the differences between FreeType 1.x and FreeType 2 ?
</h3>
<p>The biggest differences are that:</p>
<ul>
<li><p>
FT1 only supports the TrueType format, while FT2 does a lot more.
</p></li>
<li><p>
The FT2 API is simpler as well as more powerful than the FT1 API,
</p></li>
<li><p>
FT1 includes an extension to support OpenType text layout processing.
This support is not part of FT2, but has been moved to a distinct
project, called <em>FreeType Layout</em>. ( FT Layout is not
currently available though..)
</p></li>
</ul>
<hr><a name="general-ft1">
<h3>
I.6 Is FreeType 2 backwards compatible with FreeType 1.x?
</h3>
<p>Not directly, though we had the project to provide an optional binary
compatibility layer on top of it in order to easily re-link applications
with the new version. However, this idea has been dropped as it is
possible to install and use the two versions independently on any system
(read: no namespace conflicts).</p>
<p>The FreeType 2 API is a lot simpler than the one in 1.x
while being much more powerful. We thus encourage you to adapt your
source code to it as this should not involve much work.</p>
<hr>
<a name="general-edit">
<h3>
I.6 Can I use FreeType 2 to edit fonts or create new ones?
</h3>
<p>The answer is a definitive <b>no</b>, because the library was
specifically designed to <em>read</em> font files with small code size
and very low memory usage.</p>
<p>We thus do not plan to support editing or creation in the font engine
in any way, as this would imply a complete rewrite. This doesn't mean
that we won't introduce a font editing/creation library in the future,
as this really depends on how many people are asking for it (or how much
they would be willing to pay for it), as well as the time of the
FreeType developers.</p>
<p>Do not expect anything in this direction until we officially announce
something though. There are other axes of development for this project
(like text-layout capabilities, glyph caching, etc.) that may be more
important to us at the moment.</p>
</td></tr>
</table>
<br>
<table width="100%">
<tr bgcolor="#CCCCEE"><td>
<h2 align=center>
<a name="builds">Compilation & Configuration
</h2>
</td></tr>
<tr><td>
<a name="builds-compile">
<h3>
II.1 How do I compile the FreeType 2 library?
</h3>
<p>The library can be compiled in various ways, and a detailed
documentation is available in the file <tt>freetype2/docs/BUILD</tt>.
However, we will summarize the process to a few cases:</p>
<h4>
a. Using the command-line 2 build system
</h4>
<p>The engine comes with a sophisticated build system that is used to
configure and compile a build of the library. You will need <em>GNU
Make</em> installed on your platform (<b>Note:</b> It will
<em>not</em> work with other Make tools).</p>
<p>Basically, you will need to invoke <tt>make</tt> a first time in
the top-level FreeType 2 directory in order to set up the build.
This will detect your current platform and choose a configuration
sub-makefile to drive the build. A specific compiler can be selected
on some platforms by providing an additional target. For example, on
Win32:</p>
<ul>
<li>
<b><tt>make visualc</tt></b> will select the Visual C++
compiler
</li>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -