ref: 66cbc209785593cc6080389fac3f0ae5f7b46b6b
parent: 1c044d7d29405644d29ae7fa105342365c517699
author: David Turner <[email protected]>
date: Thu Mar 20 02:04:40 EST 2003
* docs/*: serious rewriting of the documentation * include/freetype/internal/ftobjs.h, src/base/ftobjs.c, src/bdf/bdfdrivr.c, src/pcf/pcfdriver.c, src/pfr/pfrsbit.c, src/sfnt/ttsbit.c, src/type42/t42objs.c, src/winfonts/winfnt.c: introduced three new functions to deal with glyph bitmaps within FT_GlyphSlot objects. these are: ft_glyphslot_free_bitmap ft_glyphslot_alloc_bitmap ft_glyphslot_set_bitmap these are much more convenient to use than managing the FT_GLYPH_OWN_BITMAP flag manually. the font drivers have been modified to use them as well. * src/cache/ftlru.c: fixed an invalid assertion check
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-03-20 David Turner <[email protected]>
+
+ * docs/*: serious rewriting of the documentation
+
+
2003-03-15 David Turner <[email protected]>
* src/truetyoe/ttdriver.c (Set_Char_Sizes): fixed a small rounding bug.
--- a/Jamfile
+++ b/Jamfile
@@ -103,10 +103,9 @@
HDRS += $(FT2_INCLUDE) ;
-#SubDirHdr += $(FT2_INCLUDE) ;
-
# Uncomment the following line if you want to build individual source files
-# for each FreeType 2 module.
+# for each FreeType 2 module. this is only useful during development, and
+# is better defined as an environment variable anyway !
#
# FT2_MULTI = true ;
--- a/docs/BUGS
+++ /dev/null
@@ -1,275 +1,0 @@
-List of known FreeType 2 Bugs
------------------------------
-
-"Identifier" is a string to uniquely identify the bug. A more detailed
-description of the bug is found below the table of opened bugs.
-
-"Date" is the date when the bug was first reported or entered in this
-document. Dates are in _European_ format, i.e day/month/year.
-
-"Opened By" is the name of the person who first spotted the bug. Note that
-we can use abbreviations here, like:
-
- "David" for David Turner
- "Werner" for Werner Lemberg
- etc.
-
-"Reproduceable" indicates whether the bug could be reproduced by the
-development team or not (it can be specific to a given platform), whether it
-always happens, or only sporadically, etc.
-
-
-
-I. Open bugs
-============
-
-
-Identifier Date Opened by Reproduceable
-------------------------------------------------------------------------------
-NO-CID-CMAPS 13-09-2001 David always
-BAD-TT-RENDERING 12-09-2001 Paul Pedriana ?
-BAD-THIN-LINES 13-09-2001 David ?
-NOT-WINDOWS-METRICS 07-10-2001 David always
-ADVANCED-COMPOSITES 25-10-2001 George Williams always
-
---------------------END-OF-OPENED-BUGS-TABLE----------------------------------
-
-
-
-II. Closed bugs
-===============
-
-
-Identifier Date Closed by Closure date
-------------------------------------------------------------------------------
-BAD-TTNAMEID.H 12-09-2001 Antoine N/A
-BAD-T1-CHARMAP 15-06-2001 David 2.0.5
-BAD-UNIXXXX-NAMES 30-07-2001 David 2.0.5
-GLYPH_TO_BITMAP-BUG 05-12-2001 David 05-12-2001
-AUTOHINT-NO-SBITS 13-09-2001 David 2.0.6
-TT-GLYPH-CRASH 01-01-2002 David 2.0.6
-T1-FONT-CRASH 01-01-2002 David 2.0.6
-BAD-ADVANCES 30-11-2001 David 2.0.6
-GLYPH-TO-BITMAP-BUG 15-12-2001 David 2.0.6
---------------------END-OF-CLOSED-BUGS-TABLE----------------------------------
-
-
-
-III. Bug descriptions
-=====================
-
-
---- START OF OPEN BUGS ---
-
-
-NO-CID-CMAPS
-
- Not exactly a bug, but the CFF font driver doesn't build a Unicode charmap
- from the contents of font files, which prevents efficiently using fonts in
- this format.
-
-
-
-BAD-TT-RENDERING
-
- According to Paul Pedriana <[email protected]>, there is a rather
- important difference between the rendering of TrueType-hinted glyphs of
- current FT2 and old betas.
-
- Tests and comparisons show a _major_ discrepancy of monochrome truetype
- bytecode-hinted glyphs! Something seems to be really broken here!
-
- Some of this has been fixed in 2.0.6; there was a bug in the TrueType
- loader that prevented it from loading composites correctly. However,
- there are still _subtle_ differences between FT1 and FT2 when it comes to
- monochrome TrueType-hinted glyphs (the major differences are gone though).
-
-
-
-BAD-THIN-LINES
-
- It seems that the anti-aliased renderer in FreeType has problems rendering
- extremely thin straight lines correctly, at least when using the
- FT_Outline_Render() function.
-
-
-
-NOT-WINDOWS-METRICS
-
- FreeType doesn't always return the same metrics as Windows for ascender,
- descender, and text height, depending on character pixel sizes. A lot of
- testing on Windows is needed to debug this properly. It might be due to a
- rounding bug when computing the "x_scale" and "y_scale" values.
-
-
-
-ADVANCED-COMPOSITES
-
- Provided by George Williams <[email protected]>:
-
- I notice that truetype/ttgload.c only supports Apple's definition of
- offsets for composite glyphs. Apple and Microsoft behave differently if
- there is a scale factor. OpenType defines some bits to disambiguate.
-
- (A problem in both 2.0.4 and 2.0.5.)
-
- Apple says (http://fonts.apple.com/TTRefMan/RM06/Chap6glyf.html) that if
- flags&ARGS_ARE_XY is set then the offsets should be scaled by the scale
- factors (as you have done), but they also say something very cryptic
- about what happens when the component is rotated at 45� (which you do
- not support) -- See the "Important" note at the bottom.
-
- The old truetype spec from Microsoft did not mention this. The OpenType
- spec (http://www.microsoft.com/typography/otspec/glyf.htm,
- http://partners.adobe.com/asn/developer/opentype/glyf.html) defines two
- new bits to disambiguate:
-
- SCALED_COMPONENT_OFFSET 11
- Composite designed to have the component offset scaled (designed for
- Apple rasterizer)
-
- UNSCALED_COMPONENT_OFFSET 12
- Composite designed not to have the component offset scaled (designed
- for the Microsoft TrueType rasterizer)
-
- Perhaps you could add a load_flag to allow the user to define the
- default setting?
-
- David says:
-
- Wow, I was not even aware of this, it will probably take a little time
- to implement since I don't have any font that implement these
- "features", and also because I believe that we're running out of bits
- for "load_flag", some other way to set preferences is probably needed.
-
-
-
---- END OF OPEN BUGS ---
-
-
-
-BAD-TTNAMEID.H
-
- The file "ttnameid.h" contains various constant macro definitions
- corresponding to important values defined by the TrueType specification.
-
- Joe Man <[email protected]> reports that:
-
- According to the information from TrueType v1.66:
-
- Platform ID = 3 (Microsoft)
- the Encoding ID of GB2312 = 4
- the Encoding ID of big5 = 3
-
- However, I have found that in ttnameid.h:
-
- TT_MS_ID_GB2312 = 3
- TT_MS_ID_BIG_5 = 4
-
- Which one is correct?
-
- Antoine replied that this was a bug in the TT 1.66 specification, and that
- FreeType followed the most recent TrueType/OpenType specification here.
-
-
-
-AUTOHINT-SBITS
-
- When trying to load a glyph, with the auto-hinter activated (i.e., when
- using FT_LOAD_FORCE_AUTOHINT, or when the font driver doesn't provide its
- own hinter), embedded bitmaps are _never_ loaded, unlike the default
- behaviour described by the API specification.
-
- This seems to be a bug in FT_Load_Glyph(), but there is no way to solve it
- efficiently without making a few important internal changes to the
- library's design (more importantly, to the font driver interface).
-
- This has been corrected with a hack in FT_Load_Glyph(). More important
- internal changes should help get rid of it with a clean solution in a
- further release like FreeType 2.1.
-
-
-
-BAD-T1-CHARMAP
-
- Type1 driver doesn't read "cacute" and "lslash" characters from iso8859-2
- charset. Those characters are mapped as MAC-one in glnames.py, so they
- cannot be shown in Adobe Type1 fonts.
-
- (This was due to a bug in the "glnames.py" script used to generate the
- table of glyph names in 'src/psaux/pstables.h'.)
-
-
-
-BAD-UNIXXXX-NAMES
-
- Glyph names like uniXXXX are not recognized as they should be. It seems
- that code in psmodule.c for uniXXXX glyph names was never tested. The
- patch is very simple.
-
- (A simple bug that was left un-noticed due to the fact that I don't have
- any Postscript font that use this convention, unfortunately.)
-
-
-
-GLYPH_TO_BITMAP-BUG
-
- Calling FT_Glyph_To_Bitmap() sometimes modifies the original glyph
- outline, creating weird alignment artefacts.
-
- This subtle bug was really in the file `src/smooth/ftsmooth.c'.
- Basically, the outline was shifted before rendering it into a new bitmap
- buffer. However, it wasn't properly un-shifted after that operation.
-
- This was only noticeable with certain glyphs or certain fonts; it crept in
- a long time ago.
-
- The same bug has been fixed in src/raster/ftrender1.c also.
-
-
-
-TT-GLYPH-CRASH
-
- The library crashed when trying to load certain glyphs from an
- automatically generated TrueType file (tt1095m_.ttf submitted by Scott
- Long).
-
- It turned out that the font contained invalid glyph data (i.e. was
- broken), but the TrueType glyph loader in FreeType wasn't paranoid enough,
- which resulted in nasty memory overwrites all over the place.
-
-
-
-T1-FONT-CRASH
-
- The library crashed when trying to load the "Stalingrad Regular" face from
- the "sadn.pfb" font file provided by Anthony Fok (and the Gnome-Print team
- I believe).
-
- This was due to the fact that the font missed a full font name entry,
- though boasted a family name and postscript name. The Type 1 face loader
- didn't check for these pathetic cases and seg-faulted.
-
-
-
-BAD-ADVANCES
-
- All scalable font drivers returned un-fitted glyph advances when
- FT_LOAD_DEFAULT was used, which was incorrect. This problem was pretty
- old but hadn't been spotted because all test programs actually explicitly
- or implicitly (i.e. through the cache) rounded the advance widths of
- glyphs.
-
- This resulted in poor rendering of a number of client applications however
- (it is strange to see they took so long to notify the FreeType team).
-
-
-
-GLYPH-TO-BITMAP-BUG
-
- FT_Glyph_To_Bitmap() did incorrectly modify the source glyph in certain
- cases, which resulted in random behaviour and bad text rendering. This
- was spotted to bugs in both the monochrome and smooth rasterizer.
-
-
-=== end of file ===
--- a/docs/BUILD
+++ /dev/null
@@ -1,276 +1,0 @@
-
- FreeType 2 compilation how-to
- =============================
-
-
-Introduction
-------------
-
-Welcome to the FreeType 2 library. You'll find in this document
-instructions on how to compile the library on your favorite platform.
-
-
-I. QUICK COMMAND-LINE GUIDE
----------------------------
-
- THE FOLLOWING WILL ONLY WORK WITH GNU MAKE, IT WILL FAIL MISERABLY
- WITH OTHER MAKE TOOLS, FOR EXAMPLE "BSD MAKE".
-
- Install GNU Make (version 3.78.1 or newer), then try the following
- on Unix or Cygwin:
-
- ./configure <youroptions> // this will setup the build
- make // this will build the library
-
- or even:
-
- make setup unix
- make
-
- On Win32 + Visual C++:
-
- make setup visualc // setup the build for VisualC++ on Win32
- make // build the library
-
- Then, go to the `demos' directory and type
-
- make
-
-
-
- If this doesn't work, read the following.
-
-
-II. COMMAND-LINE COMPILATION
-----------------------------
-
- Note that if you do not want to compile FreeType 2 from a command
- line shell, please skip to section III below (DETAILED COMPILATION).
-
- FreeType 2 includes a powerful and flexible build system that allows
- you to easily compile it on a great variety of platforms from the
- command line. To do so, just follow these simple instructions:
-
- a. Install GNU Make
-
- Because GNU Make is the only Make tool supported to compile
- FreeType 2, you should install it on your machine.
-
- The FreeType 2 build system relies on many features special to GNU
- Make -- trying to build the library with any other Make tool will
- *fail*.
-
- NEARLY ALL OTHER MAKE TOOLS WILL FAIL, INCLUDING "BSD MAKE", SO
- REALLY INSTALL A RECENT VERSION OF GNU MAKE ON YOUR SYSTEM!
-
- Make sure that you are invoking GNU Make from the command line, by
- typing something like:
-
- make -v
-
- to display its version number.
-
- VERSION 3.78.1 OR NEWER IS NEEDED!
-
- b. Invoke `make'
-
- Go to the root directory of FreeType 2, then simply invoke GNU
- Make from the command line. This will launch the FreeType 2 host
- platform detection routines. A summary will be displayed, for
- example, on Win32:
-
-
- ==============================================================
- FreeType build system -- automatic system detection
-
- The following settings are used:
-
- platform win32
- compiler gcc
- configuration directory ./builds/win32
- configuration rules ./builds/win32/w32-gcc.mk
-
- If this does not correspond to your system or settings please
- remove the file 'config.mk' from this directory then read the
- INSTALL file for help.
-
- Otherwise, simply type 'make' again to build the library.
- =============================================================
-
-
- If the detected settings correspond to your platform and compiler,
- skip to step e. Note that if your platform is completely alien to
- the build system, the detected platform will be `ansi'.
-
-
- c. Configure the build system for a different compiler
-
- If the build system correctly detected your platform, but you want
- to use a different compiler than the one specified in the summary
- (for most platforms, gcc is the defaut compiler), invoke GNU Make
- with
-
- make setup <compiler>
-
- For example:
-
- to use Visual C++ on Win32, type: "make setup visualc"
- to use LCC-Win32 on Win32, type: "make setup lcc"
- to use Cygwin on Win32, type "make setup unix"
-
- The <compiler> name to use is platform-dependent. The list of
- available compilers for your system is available in the file
- `builds/<system>/detect.mk' (note that we hope to make the list
- displayed at user demand in the final release).
-
- If you are satisfied by the new configuration summary, skip to
- step e.
-
- d. Configure the build system for an unknown platform/compiler
-
- The auto-detection/setup phase of the build system copies a file
- to the current directory under the name `config.mk'.
-
- For example, on OS/2+gcc, it would simply copy
- `builds/os2/os2-gcc.mk' to `./config.mk'.
-
- If for some reason your platform isn't correctly detected, copy
- manually the configuration sub-makefile to `./config.mk' and go to
- step e.
-
- Note that this file is a sub-Makefile used to specify Make
- variables for compiler and linker invocation during the build.
- You can easily create your own version from one of the existing
- configuration files, then copy it to the current directory under
- the name `./config.mk'.
-
- e. Build the library
-
- The auto-detection/setup phase should have copied a file in the
- current directory, called `./config.mk'. This file contains
- definitions of various Make variables used to invoke the compiler
- and linker during the build.
-
- To launch the build, simply invoke GNU Make again: The top
- Makefile will detect the configuration file and run the build with
- it.
-
- f. Build the demonstration programs
-
-
-III. DETAILED COMPILATION PROCEDURE
------------------------------------
-
- If you don't want to compile FreeType 2 from the command-line (for
- example if you use a graphical IDE on a Mac or Windows), you will
- need to understand how the FreeType files are organized.
-
- FreeType 2 has a very modular design, and it is made of several
- components. Each component must be compiled as a stand-alone object
- file, even if it is really made of several C source files. For
- example, the `base layer' component is made of the following C
- files:
-
- src/
- base/
- ftcalc.c - computations
- ftextend.c - extensions support
- ftlist.c - simple list management
- ftobjs.c - object management
- ftoutln.c - simple outline processing
- ftstream.c - stream input
-
- However, you can create a single object file by compiling the file
- `src/base/ftbase.c', which basically contains
-
- #include "ftcalc.c"
- #include "ftobjs.c"
- #include "ftstream.c"
- #include "ftlist.c"
- #include "ftoutln.c"
- #include "ftextend.c"
-
- Similarly, each component has a single `englobing' C file to compile
- it as a stand-alone object:
-
- src/autohint/autohint.c - the autohinting module
- src/base/ftbase.c - the base layer, high-level interface
- src/cache/ftcache.c - a glyph and image caching system
- (still experimental)
- src/cff/cff.c - the OpenType font driver
- src/cid/type1cid.c - the CID-keyed font driver
- src/psaux/psaux.c - the PS support module
- src/psnames/psnames.c - a support module to handle PS glyph
- names
- src/raster1/raster1.c - the monochrome raster module
- src/sfnt/sfnt.c - the `sfnt' module
- src/smooth/smooth.c - the anti-aliasing raster module
- src/truetype/truetype.c - the TrueType font driver
- src/type1/type1.c - the Type 1 font driver
-
- The last module of FreeType 2, `winfonts' (implementing support for
- Windows FNT format), is a single file.
-
- To compile one component, do the following:
-
- - Add the top-level `include' directory to your compilation
- include path
-
- - Add the `src/<component>' directory to your compilation include
- path, or simply `cd' to the component's source directory.
-
- - Compile the component `source' file (see list below); you don't
- need to be in the component's directory if you added
- `src/<component>' to your include path.
-
- For example, the following line can be used to compile the truetype
- driver on Unix:
-
- cd freetype2/
- cc -c -Iinclude -Isrc/truetype src/truetype/truetype.c
-
- Alternatively:
-
- cd freetype2/src/truetype
- cc -c -I../../include truetype.c
-
- Finally, FreeType 2 contains some other components:
-
- src/base/ftsystem.c - system-specific memory and i/o support
- src/base/ftinit.c - initialization layer
- src/base/ftdebug.c - debugging component (empty in release
- build)
- src/base/ftglyph.c - optional convenience functions
-
- All font drivers are optional. The `sfnt', `psaux', and `psnames'
- modules are mandatory for certain drivers. However, you may need to
- update the list of drivers that are statically linked to the
- library, which is located in the configuration file
- `include/freetype/config/ftmodule.h'.
-
-
-IV. Support for flat-directory compilation
-------------------------------------------
-
- It is possible to put all FreeType 2 source files into a single
- directory, with the exception of the `include' hierarchy.
-
- 1. Copy all files in current directory:
-
- cp freetype2/src/base/*.[hc] .
- cp freetype2/src/raster1/*.[hc] .
- cp freetype2/src/smooth/*.[hc] .
- etc.
-
- 2. Compile sources:
-
- cc -c -Ifreetype2/include ftsystem.c
- cc -c -Ifreetype2/include ftinit.c
- cc -c -Ifreetype2/include ftdebug.c
- cc -c -Ifreetype2/include ftbase.c
- etc.
-
- You don't need to define the FT_FLAT_COMPILATION macro (as this was
- required in previous releases of FreeType 2).
-
-End of file
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -33,6 +33,11 @@
- the CMap cache is now capable of managing UCS-4 character codes that
are mapped through extended charmaps in recent TrueType/OpenType fonts
+ - the cache sub-system now properly manages out-of-memory conditions,
+ instead of blindly reporting them to the caller. This means that it
+ will try to empty the cache before restarting its allocations to see
+ if that can help.
+
- the PFR driver didn't return the list of available embedded bitmaps
properly.
@@ -71,6 +76,9 @@
- the file docs/VERSION.DLL has been updated to explain versioning
with FreeType (i.e. comparing release/libtool/so numbers, and how
to use them in Autoconf scripts)
+
+ - the installation documentation has been seriously revamped. Everything
+ is now in the "docs" directory.
==============================================================================
LATEST CHANGES BETWEEN 2.1.3 and 2.1.2
--- /dev/null
+++ b/docs/CUSTOMIZE
@@ -1,0 +1,117 @@
+How to customize the compilation of the library:
+================================================
+
+ FreeType is highly customizable to fit various needs, and this document
+ details how it is possible to select options and components at compilation
+ time.
+
+
+I. Configuration macros:
+
+ the file found in "include/freetype/config/ftoption.h" contains a list
+ of commented configuration macros that can be toggled by developers to
+ indicate which features to activate in their build of the library.
+
+ these options range from debug level to availability of certain
+ features, like native TrueType hinting through a bytecode interpreter.
+
+ we invite you to read this file for more information. You can change
+ the file's content to suit your needs, or override it with one of the
+ techniques described below..
+
+
+II. Modules list:
+
+ the file found in "include/freetype/config/ftmodule.h" contains a list
+ of names corresponding to the modules / font drivers to be statically
+ compiled in the FreeType library during the build.
+
+ you can change it to suit your own preferences. Be aware that certain
+ modules depend on others, as described by the file "modules.txt" in
+ this directory.
+
+ you can modify the file's content to suit your needs, or override it
+ at compile time with one of the methods described below
+
+
+III. System interface:
+
+ FreeType's default interface to the system (i.e. the parts that deal with
+ memory management and i/o streams) is located in "src/base/ftsystem.c".
+
+ the current implementation uses standard C library calls to manage
+ memory and read font files. It is however possible to write custom
+ implementations to suit specific systems.
+
+ to tell the GNU Make-based build system to use a custom system interface,
+ you'll need to define the environment variable FTSYS_SRC to point to
+ the relevant implementation, like in:
+
+ on Unix:
+ ./configure <youroptions>
+ export FTSYS_SRC=foo/my_ftsystem.c
+ make
+ make install
+
+ on Windows:
+ make setup <compiler>
+ set FTSYS_SRC=foo/my_ftsystem.c
+ make
+
+
+IV. Overriding default configuration and module headers:
+
+ it is possible to over-ride the default configuration and module headers
+ without changing the original files. There are two ways to do that:
+
+ 1. Using the C include path:
+
+ use the C include path to ensure that your own versions of the
+ files are used at compile time when the lines:
+
+ #include FT_CONFIG_OPTIONS_H
+ #include FT_CONFIG_MODULES_H
+
+ are compiled. Their default values being <freetype/config/ftoption.h>
+ and <freetype/config/ftmodule.h>, you can do something like:
+
+ custom/
+ freetype/
+ config/
+ ftoption.h => custom options header
+ ftmodule.h => custom modules list
+
+ include/ => normal FreeType 2 include
+ freetype/
+ ...
+
+ then change the C include path to always give the path to "custom"
+ before the FreeType 2 "include"
+
+
+ 2. Re-defining FT_CONFIG_OPTIONS_H and FT_CONFIG_MODULES_H
+
+ another way to do the same thing is to re-define the macros used
+ to name the configuration headers. To do so, you'll need a custom
+ "ft2build.h", whose content can be as simple as:
+
+ #ifndef __FT2_BUILD_GENERIC_H__
+ #define __FT2_BUILD_GENERIC_H__
+
+ #define FT_CONFIG_OPTIONS_H <custom/my-ftoption.h>
+ #define FT_CONFIG_MACROS_H <custom/my-ftmodule.h>
+
+ #include <freetype/config/ftheader.h>
+
+ #endif /* __FT2_BUILD_GENERIC_H__ */
+
+ place them in:
+
+ custom/
+ ft2build.h => custom version described above
+ my-ftoption.h => custom options header
+ my-ftmodule.h => custom modules list header
+
+ and change the C include path to ensure that "custom" is always placed
+ before the FT2 "include" during compilation.
+
--- /dev/null
+++ b/docs/DEBUG
@@ -1,0 +1,183 @@
+Debugging within the FreeType sources:
+======================================
+
+I. Configuration macros
+-----------------------
+
+There are several ways to enable debugging features in a FreeType 2
+builds. This is controlled through the definition of special macros
+located in the file "ftoptions.h". The macros are:
+
+
+ FT_DEBUG_LEVEL_ERROR
+
+ #define this macro if you want to compile the FT_ERROR macro calls
+ used to print error messages during program execution. This will
+ not stop the program, but is very useful to spot invalid fonts
+ during development and code workarounds for them.
+
+ FT_DEBUG_LEVEL_TRACE
+
+ #define this macro if you want to compile both the FT_ERROR macro
+ and the FT_TRACE one. This also includes the variants FT_TRACE0,
+ FT_TRACE1, FT_TRACE2, ..., FT_TRACE6.
+
+ The trace macros are used to send debugging messages when an
+ appropriate "debug level" is configured at runtime through the
+ FT2_DEBUG environment variable (more on this later).
+
+ FT_DEBUG_MEMORY
+
+ If this macro is #defined, the FreeType engines is linked with a
+ small but effective debugging memory manager that tracks all
+ allocations and frees that are performed within the font engine.
+
+ When the FT2_DEBUG_MEMORY environment variable is defined at
+ runtime, a call to FT_Done_FreeType will dump memory statistics,
+ including the list of leaked memory blocks with the source locations
+ where these were allocated. It's always a very good idea to define
+ this in development builds. This works with _any_ program linked to
+ FreeType, but requires a big deal of memory (the debugging memory
+ manager never frees the blocks to the heap in order to detect double
+ frees).
+
+ When FT2_DEBUG_MEMORY isn't defined at runtime, the debugging memory
+ manager is ignored, and performance is un-affected.
+
+
+II. Debugging macros
+--------------------
+
+Several macros can be used within the FreeType sources to help debugging
+its code:
+
+ 1. FT_ERROR(( ... ))
+
+ This macro is used to send debug messages that indicate relatively
+ serious errors (like broken font files), but will not stop the
+ execution of the running program. Its code is compiled only when
+ either FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined in
+ "ftoption.h".
+
+ Note that you must use with a printf-like signature, but with double
+ parentheses, like in:
+
+ FT_ERROR(( "your %s is not %s\n", "foo", "bar" ));
+
+
+ 2. FT_ASSERT( condition )
+
+ This macro is used to check strong assertions at runtime. If its
+ condition isn't TRUE, the program will abort with a panic message.
+ Its code is compiled when either FT_DEBUG_LEVEL_ERROR or
+ FT_DEBUG_LEVEL_TRACE are defined. You don't need double-parentheses
+ here. For example:
+
+ FT_ASSERT( ptr != NULL );
+
+
+ 3. FT_TRACE( level, (message...) )
+
+ The FT_TRACE macro is used to send general-purpose debugging
+ messages during program execution. This macro uses an *implicit*
+ macro named FT_COMPONENT used to name the current FreeType component
+ being run.
+
+ The developer should always define FT_COMPONENT as appropriate, for
+ example as in:
+
+ #undef FT_COMPONENT
+ #define FT_COMPONENT trace_io
+
+ The value of the FT_COMPONENT macro is an enumeration named
+ trace_XXXX where XXXX is one of the component names defined in the
+ internal file <freetype/internal/fttrace.h>.
+
+ Each such component is assigned a "debug level", ranging from 0 to 6
+ when a program linked with FreeType starts, through the use of the
+ FT2_DEBUG environment variable, described later.
+
+ When FT_TRACE is called, its level is compared to the one of the
+ corresponding component. Messages with trace levels *higher* than
+ the corresponding component level are filtered and never printed.
+
+ This means that trace messages with level 0 are always printed,
+ those with level 2 are only printed when the component level is *at
+ least* 2.
+
+ The second parameter to FT_TRACE must contain parentheses and
+ correspond to a print-like call, as in:
+
+ FT_TRACE( 2, ( "your %s is not %s\n", "foo", "bar" ) )
+
+ The shortcut macros FT_TRACE0, FT_TRACE1, FT_TRACE2_, ... FT_TRACE6
+ can be used with constant level indices, and are much cleaner to
+ use, as in
+
+ FT_TRACE2(( "your %s is not %s\n", "foo", "bar" ));
+
+
+III. Environment variables
+--------------------------
+
+The following environment variables control debugging output and
+behaviour of FreeType at runtime:
+
+
+ FT2_DEBUG
+
+ This variable is only used when FreeType is built with
+ FT_DEBUG_LEVEL_TRACE defined. It contains a list of component level
+ definitions, following this format:
+
+ component1:level1 component2:level2 component3:level3 ...
+
+ where "componentX" is the name of a tracing component, as defined in
+ "fttrace.h", but without the "trace_" prefix, and "levelX" is the
+ corresponding level to use at runtime.
+
+ "any" is a special component name that will be interpreted as
+ "any/all components". For example, the following definitions
+
+ set FT2_DEBUG=any:2 memory:5 io:4 (on Windows)
+ export FT2_DEBUG="any:2 memory:5 io:4" (on Linux)
+
+ both stipulate that all components should have level 2, except for
+ the memory and io components which will be set to trace levels 5 and
+ 4 respectively.
+
+ FT2_DEBUG_MEMORY
+
+ This environment variable, when defined, tells FreeType to use a
+ debugging memory manager that will track leaked memory blocks as
+ well as other common errors like double frees. It is also capable
+ of reporting _where_ the leaked blocks were allocated, which
+ considerably saves time when debugging new additions to the library.
+
+ This code is only compiled when FreeType is built with the
+ FT_DEBUG_MEMORY macro #defined in "ftoption.h" though, it will be
+ ignored in other builds.
+
+
+ FT2_ALLOC_TOTAL_MAX
+
+ this variable is ignored if FT2_DEBUG_MEMORY is not defined. It allows
+ you to specify a maximum heap size for all memory allocations performed
+ by FreeType. This is very useful to test the robustness of the font
+ engine and programs that use it in tight memory conditions.
+
+ If it is undefined, or if its value is not strictly positive, then no
+ allocation bounds are checked at runtime.
+
+
+ FT2_ALLOC_COUNT_MAX
+
+ this variable is ignored if FT2_DEBUG_MEMORY is not defined. It allows
+ you to sepcify a maximum number of memory allocations performed by
+ FreeType before returning the error FT_Err_Out_Of_Memory. This is
+ useful for debugging and testing the engine's robustness.
+
+ If it is undefined, or if its value is not strictly positive, then no
+ allocation bounsd are checked at runtime.
+
+End of file
--- a/docs/DEBUG.TXT
+++ /dev/null
@@ -1,183 +1,0 @@
-Debugging within the FreeType sources:
-======================================
-
-I. Configuration macros
------------------------
-
-There are several ways to enable debugging features in a FreeType 2
-builds. This is controlled through the definition of special macros
-located in the file "ftoptions.h". The macros are:
-
-
- FT_DEBUG_LEVEL_ERROR
-
- #define this macro if you want to compile the FT_ERROR macro calls
- used to print error messages during program execution. This will
- not stop the program, but is very useful to spot invalid fonts
- during development and code wordarounds for them.
-
- FT_DEBUG_LEVEL_TRACE
-
- #define this macro if you want to compile both the FT_ERROR macro
- and the FT_TRACE one. This also includes the variants FT_TRACE0,
- FT_TRACE1, FT_TRACE2, ..., FT_TRACE6.
-
- The trace macros are used to send debugging messages when an
- appropriate "debug level" is configured at runtime through the
- FT2_DEBUG environment variable (more on this later).
-
- FT_DEBUG_MEMORY
-
- If this macro is #defined, the FreeType engines is linked with a
- small but effective debugging memory manager that tracks all
- allocations and frees that are performed within the font engine.
-
- When the FT2_DEBUG_MEMORY environment variable is defined at
- runtime, a call to FT_Done_FreeType will dump memory statistics,
- including the list of leaked memory blocks with the source locations
- where these were allocated. It's always a very good idea to define
- this in development builds. This works with _any_ program linked to
- FreeType, but requires a big deal of memory (the debugging memory
- manager never frees the blocks to the heap in order to detect double
- frees).
-
- When FT2_DEBUG_MEMORY isn't defined at runtime, the debugging memory
- manager is ignored, and performance is un-affected.
-
-
-II. Debugging macros
---------------------
-
-Several macros can be used within the FreeType sources to help debugging
-its code:
-
- 1. FT_ERROR(( ... ))
-
- This macro is used to send debug messages that indicate relatively
- serious errors (like broken font files), but will not stop the
- execution of the running program. Its code is compiled only when
- either FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined in
- "ftoption.h".
-
- Note that you must use with a printf-like signature, but with double
- parentheses, like in:
-
- FT_ERROR(( "your %s is not %s\n", "foo", "bar" ));
-
-
- 2. FT_ASSERT( condition )
-
- This macro is used to check strong assertions at runtime. If its
- condition isn't TRUE, the program will abort with a panic message.
- Its code is compiled when either FT_DEBUG_LEVEL_ERROR or
- FT_DEBUG_LEVEL_TRACE are defined. You don't need double-parentheses
- here. For example:
-
- FT_ASSERT( ptr != NULL );
-
-
- 3. FT_TRACE( level, (message...) )
-
- The FT_TRACE macro is used to send general-purpose debugging
- messages during program execution. This macro uses an *implicit*
- macro named FT_COMPONENT used to name the current FreeType component
- being run.
-
- The developer should always define FT_COMPONENT as appropriate, for
- example as in:
-
- #undef FT_COMPONENT
- #define FT_COMPONENT trace_io
-
- The value of the FT_COMPONENT macro is an enumeration named
- trace_XXXX where XXXX is one of the component names defined in the
- internal file <freetype/internal/fttrace.h>.
-
- Each such component is assigned a "debug level", ranging from 0 to 6
- when a program linked with FreeType starts, through the use of the
- FT2_DEBUG environment variable, described later.
-
- When FT_TRACE is called, its level is compared to the one of the
- corresponding component. Messages with trace levels *higher* than
- the corresponding component level are filtered and never printed.
-
- This means that trace messages with level 0 are always printed,
- those with level 2 are only printed when the component level is *at
- least* 2.
-
- The second parameter to FT_TRACE must contain parentheses and
- correspond to a print-like call, as in:
-
- FT_TRACE( 2, ( "your %s is not %s\n", "foo", "bar" ) )
-
- The shortcut macros FT_TRACE0, FT_TRACE1, FT_TRACE2_, ... FT_TRACE6
- can be used with constant level indices, and are much cleaner to
- use, as in
-
- FT_TRACE2(( "your %s is not %s\n", "foo", "bar" ));
-
-
-III. Environment variables
---------------------------
-
-The following environment variables control debugging output and
-behaviour of FreeType at runtime:
-
-
- FT2_DEBUG
-
- This variable is only used when FreeType is built with
- FT_DEBUG_LEVEL_TRACE defined. It contains a list of component level
- definitions, following this format:
-
- component1:level1 component2:level2 component3:level3 ...
-
- where "componentX" is the name of a tracing component, as defined in
- "fttrace.h", but without the "trace_" prefix, and "levelX" is the
- corresponding level to use at runtime.
-
- "any" is a special component name that will be interpreted as
- "any/all components". For example, the following definitions
-
- set FT2_DEBUG=any:2 memory:5 io:4 (on Windows)
- export FT2_DEBUG="any:2 memory:5 io:4" (on Linux)
-
- both stipulate that all components should have level 2, except for
- the memory and io components which will be set to trace levels 5 and
- 4 respectively.
-
- FT2_DEBUG_MEMORY
-
- This environment variable, when defined, tells FreeType to use a
- debugging memory manager that will track leaked memory blocks as
- well as other common errors like double frees. It is also capable
- of reporting _where_ the leaked blocks were allocated, which
- considerably saves time when debugging new additions to the library.
-
- This code is only compiled when FreeType is built with the
- FT_DEBUG_MEMORY macro #defined in "ftoption.h" though, it will be
- ignored in other builds.
-
-
- FT2_ALLOC_TOTAL_MAX
-
- this variable is ignored if FT2_DEBUG_MEMORY is not defined. It allows
- you to specify a maximum heap size for all memory allocations performed
- by FreeType. This is very useful to test the robustness of the font
- engine and programs that use it in tight memory conditions.
-
- If it is undefined, or if its value is not strictly positive, then no
- allocation bounds are checked at runtime.
-
-
- FT2_ALLOC_COUNT_MAX
-
- this variable is ignored if FT2_DEBUG_MEMORY is not defined. It allows
- you to sepcify a maximum number of memory allocations performed by
- FreeType before returning the error FT_Err_Out_Of_Memory. This is
- useful for debugging and testing the engine's robustness.
-
- If it is undefined, or if its value is not strictly positive, then no
- allocation bounsd are checked at runtime.
-
-End of file
--- a/docs/INSTALL
+++ b/docs/INSTALL
@@ -1,185 +1,65 @@
-In order to build the library, read the `BUILD' document in the `docs'
-directory. This is only a quick starter.
+Welcome
+There are several ways to build the FreeType library, depending on your
+system and the level of customization you need. Here's a short overview
+of the documentation available:
-I. Unix systems
----------------
+I. Normal installation and upgrades:
- If you have GNU Make installed, simply type
+ 1. Native TrueType Hinting:
+
+ Native TrueType hinting is disabled by default[1]. If you really need it,
+ read the file "TRUETYPE" for information.
- ./configure
- make
- make install
+
+ 2. Unix Systems (as well as Cygwin or MSys on Windows):
- on the command line to configure, build and install FreeType on your
- system. Note that the default installation path is "/usr/local".
+ Please read *both* UPGRADE.UNX and INSTALL.UNX to install or upgrade
+ FreeType 2 on a Unix system. Note that you *will* need GNU Make, since
+ other make tools won't work (this includes BSD Make !!)
- Please read the file README.UNX, it contains _critical_ information
- regarding the installation of FreeType on many Unix systems.
+ 3. On VMS with the "mms" build tool:
+
+ see INSTALL.VMS for installation instructions on this platform
+ 4. Other systems using GNU Make:
+
+ on non-Unix platforms, it's possible to build the library using
+ GNU Make utility. Note that *NO OTHER MAKE TOOL WILL WORK* !!
+ This methods supports several compilers on Windows, OS/2 and BeOS,
+ including Mingw, Visual C++, Borland C++, and more.
-II. From the command line
--------------------------
+ instructions are provided in the file "INSTALL.GNU"
- If you are not using Unix, there are two ways to quickly build
- FreeType 2 from the command line.
- The first, and favorite one, is to use the "Jam" build tool. Jam is
- a highly portable replacement for Make whose control files do not
- depend on the current platform or compiler toolset.
+ 5. With an IDE Project File (e.g. for Visual Studio or CodeWarrior):
+
+ we provide a small number of "project files" for various IDEs to
+ automatically build the library as well. Note that these files are
+ not supported and sporadically maintained by FreeType developers,
+ so don't expect them to work in each release.
+
+ to find them, have a look at the content of the "builds/<system>"
+ directory, where <system> stands for your OS or environment.
- For more information, please see:
- http://www.freetype.org/jam/index.html
+ 6. From you own IDE, or own Makefiles:
+
+ If you want to create your own project file, follow the instructions
+ given in the "INSTALL.ANY" document of this directory.
- The second one is to use "GNU Make" (and NO OTHER MAKE TOOL).
+II. Custom builds of the library:
- 1. Building FT2 with "Jam"
- --------------------------
+ Customizing the compilation of FreeType is easy, and allows you to select
+ only the components of the font engine that you really need. For more details
+ read the file "CUSTOMIZE"
- Once you've got *our version* of the Jam tool installed on your
- system, simply go to the top-level FT2 directory, then type
- "jam"
+--------------------------------------------------------------------
- on the command line. This will build the library and place it in
- the "objs" directory.
+[1] More details on: http://www.freetype.org/patents.html
- By default, a static library is built. On Unix systems, it is
- possible to build a shared library through the "libtool" script.
- You need to have libtool installed on your system, then re-define
- a few environment variables before invoking Jam, as in
+End of file
- export CC="libtool --mode=compile cc"
- export LINK="libtool --mode=link cc"
- jam
-
- In later releases of FT2, building shared libraries with Jam
- should become automatic on Unix systems.
-
-
- 2. Building FT2 with "GNU Make"
- -------------------------------
-
- You need to have GNU Make (version 3.78.1 or newer) installed on
- your system to compile the library from the command line. This will
- _NOT_ work with other make tools (including BSD make)!
-
- [Well, this is not really correct. Recently, a perl implementation
- of make called `makepp' has appeared which can also build FreeType 2
- successfully on Unix platforms. See http://makepp.sourceforge.net
- for more details.]
-
- - Go to the `freetype2' directory.
-
- - Unix (any C compiler should work):
-
- - make setup (don't worry, this will invoke a configure script)
- - make
- - make install
-
- Alternatively, you can pass parameters to the configure script
- within the CFG variable, as in:
-
- - make setup CFG="--prefix=/usr"
- - make
- - make install
-
- If the configure script isn't run, try to add `unix' as a target
- on the command line, e.g.:
-
- - make setup unix CFG="--prefix=/opt/experimental"
-
-
- - Windows:
-
- We provide a version of GNU Make for Win32 on the FreeType site.
- See http://www.freetype.org/download.html for details.
-
- - gcc (Mingw, _not_ CygWin):
-
- - make setup
- - make
-
-
- - Visual C++:
-
- - make setup visualc
- - make
-
-
- - other compilers:
-
- - make setup bcc32 -> Borland C++ 32 bits
- - make setup intelc -> Intel C++
- - make setup watcom -> Watcom C++
- - make setup lcc -> Win32-LCC
-
-
- If you want to build FreeType 2 in another directory, you must set
- two environment variables, `OJB_DIR' and `TOP_DIR'. The former
- gives the directory where the object files and the library should be
- created (this directory must exist), the latter the top directory of
- the FreeType 2 source tree. Example:
-
- OBJ_DIR=~/freetype2.compiled TOP_DIR=~/freetype2 \
- make -f$TOP_DIR/Makefile setup ansi
- OBJ_DIR=~/freetype2.compiled TOP_DIR=~/freetype2 \
- make -f$TOP_DIR/Makefile
-
- On Unix boxes, calling `configure' from the build directory is
- sufficient; it will build a small Makefile which calls the
- FreeType 2 Makefile with the necessary parameters.
-
-
-III. In your own environment (IDE)
-----------------------------------
-
- You need to add the directories "freetype2/include" to your include
- path when compiling the library.
-
- FreeType 2 is made of several components; each one of them is
- located in a subdirectory of "freetype2/src". For example,
- `freetype2/src/truetype/' contains the TrueType font driver.
-
- DO NOT COMPILE ALL C FILES! Rather, compile the following ones:
-
- -- base components (required)
-
- src/base/ftsystem.c
- src/base/ftinit.c
- src/base/ftdebug.c
- src/base/ftbase.c
- src/base/ftglyph.c
- src/base/ftbbox.c
- src/base/ftmm.c
-
- src/base/ftmac.c -- only on the Macintosh
-
- -- other components are optional
-
- src/autohint/autohint.c -- auto hinting module
- src/cache/ftcache.c -- cache sub-system (in beta)
- src/sfnt/sfnt.c -- SFNT files support
- (TrueType & OpenType)
- src/cff/cff.c -- CFF/OpenType font driver
- src/psnames/psnames.c -- Postscript glyph names support
- src/psaux/psaux.c -- Postscript Type 1 parsing
- src/truetype/truetype.c -- TrueType font driver
- src/type1/type1.c -- Type 1 font driver
- src/cid/type1cid.c -- Type 1 CID-keyed font driver
- src/winfonts/winfonts.c -- Windows FONT / FNT font driver
-
- Note:
-
- `truetype.c' needs `sfnt.c' and `psnames.c'
- `type1.c' needs `psaux.c' and `psnames.c'
- `type1cid.c' needs `psaux.c' and `psnames.c'
- `cff.c' needs `sfnt.c', `psaux.c', and `psnames.c'
-
- etc.
-
-For more information, please consult "docs/BUILD".
-
---- end of INSTALL --
+
\ No newline at end of file
--- /dev/null
+++ b/docs/INSTALL.ANY
@@ -1,0 +1,96 @@
+Instructions on how to build FreeType with your own build tool:
+
+ see the file "CUSTOMIZE" to learn how to customize FreeType to
+ specific environments.
+
+ follow these simple steps:
+
+I. Normal way:
+--------------
+
+ * DISABLE PRE-COMPILED HEADERS ! This is very important for Visual
+ C++, because FreeType uses lines like:
+
+ #include FT_FREETYPE_H
+
+ which are not correctly supported by this compiler, while being
+ ISO C compliant !!
+
+ * You need to add the directories "freetype2/include" to your include
+ path when compiling the library.
+
+ * FreeType 2 is made of several components; each one of them is
+ located in a subdirectory of "freetype2/src". For example,
+ 'freetype2/src/truetype/' contains the TrueType font driver.
+
+ * DO NOT COMPILE ALL C FILES! Rather, compile the following ones:
+
+ -- base components (required)
+
+ src/base/ftsystem.c
+ src/base/ftinit.c
+ src/base/ftdebug.c
+ src/base/ftbase.c
+ src/base/ftglyph.c
+ src/base/ftbbox.c
+ src/base/ftmm.c
+ src/base/ftpfr.c -- optional, see <freetype/ftpfr.h>
+ src/base/ftbdf.c -- optional, see <freetype/ftbdf.h>
+ src/base/ftwinfnt.c -- optional, see <freetype/ftwinfnt.h>
+
+ src/base/ftmac.c -- only on the Macintosh
+
+ -- other components are optional
+
+ src/autohint/autohint.c -- auto hinting module
+ src/cache/ftcache.c -- cache sub-system (in beta)
+ src/sfnt/sfnt.c -- SFNT files support
+ (TrueType & OpenType)
+ src/cff/cff.c -- CFF/OpenType font driver
+ src/pfr/pfr.c -- PFR/TrueDoc font driver
+ src/bdf/bdf.c -- BDF font driver
+ src/pcf/pcf.c -- PCF font driver
+ src/psnames/psnames.c -- Postscript glyph names support
+ src/psaux/psaux.c -- Postscript Type 1 parsing
+ src/truetype/truetype.c -- TrueType font driver
+ src/type1/type1.c -- Type 1 font driver
+ src/cid/type1cid.c -- Type 1 CID-keyed font driver
+ src/winfonts/winfonts.c -- Windows FONT / FNT font driver
+ src/raster1/raster1.c -- monochrome rasterizer
+ src/smooth/smooth.c -- anti-aliasing rasterizer
+
+ Note:
+
+ `truetype.c' needs `sfnt.c' and `psnames.c'
+ `type1.c' needs `psaux.c' and `psnames.c'
+ `type1cid.c' needs `psaux.c' and `psnames.c'
+ `cff.c' needs `sfnt.c', `psaux.c', and `psnames.c'
+
+ that should be it ! in case of problems, see the archives of
+ the FreeType development mailing list.
+
+
+II. Support for flat-directory compilation
+------------------------------------------
+
+ It is possible to put all FreeType 2 source files into a single
+ directory, with the *exception* of the `include' hierarchy.
+
+ 1. Copy all files in current directory:
+
+ cp freetype2/src/base/*.[hc] .
+ cp freetype2/src/raster1/*.[hc] .
+ cp freetype2/src/smooth/*.[hc] .
+ etc.
+
+ 2. Compile sources:
+
+ cc -c -Ifreetype2/include ftsystem.c
+ cc -c -Ifreetype2/include ftinit.c
+ cc -c -Ifreetype2/include ftdebug.c
+ cc -c -Ifreetype2/include ftbase.c
+ etc.
+
+ You don't need to define the FT_FLAT_COMPILATION macro (as this was
+ required in previous releases of FreeType 2).
+
--- /dev/null
+++ b/docs/INSTALL.GNU
@@ -1,0 +1,128 @@
+This document contains instructions on how to build the FreeType library
+on non-Unix systems with the help of GNU Make. Note that if you're running
+Cygwin or MSys in Windows, you should follow the instructions of INSTALL.UNX
+instead.
+
+
+ FreeType 2 includes a powerful and flexible build system that allows
+ you to easily compile it on a great variety of platforms from the
+ command line. To do so, just follow these simple instructions:
+
+ a. Install GNU Make
+
+ Because GNU Make is the only Make tool supported to compile
+ FreeType 2, you should install it on your machine.
+
+ The FreeType 2 build system relies on many features special to GNU
+ Make -- trying to build the library with any other Make tool will
+ *fail*.
+
+ NEARLY ALL OTHER MAKE TOOLS WILL FAIL, INCLUDING "BSD MAKE", SO
+ REALLY INSTALL A RECENT VERSION OF GNU MAKE ON YOUR SYSTEM!
+
+ Make sure that you are invoking GNU Make from the command line, by
+ typing something like:
+
+ make -v
+
+ to display its version number.
+
+ VERSION 3.78.1 OR NEWER IS NEEDED!
+
+
+
+ b. Invoke 'make'
+
+ Go to the root directory of FreeType 2, then simply invoke GNU
+ Make from the command line. This will launch the FreeType 2 host
+ platform detection routines. A summary will be displayed, for
+ example, on Win32:
+
+
+ ==============================================================
+ FreeType build system -- automatic system detection
+
+ The following settings are used:
+
+ platform win32
+ compiler gcc
+ configuration directory ./builds/win32
+ configuration rules ./builds/win32/w32-gcc.mk
+
+ If this does not correspond to your system or settings please
+ remove the file 'config.mk' from this directory then read the
+ INSTALL file for help.
+
+ Otherwise, simply type 'make' again to build the library.
+ =============================================================
+
+
+ If the detected settings correspond to your platform and compiler,
+ skip to step e. Note that if your platform is completely alien to
+ the build system, the detected platform will be 'ansi'.
+
+
+ c. Configure the build system for a different compiler
+
+ If the build system correctly detected your platform, but you want
+ to use a different compiler than the one specified in the summary
+ (for most platforms, gcc is the defaut compiler), invoke GNU Make
+ with
+
+ make setup <compiler>
+
+ For example:
+
+ to use Visual C++ on Win32, type: "make setup visualc"
+ to use Borland C++ on Win32, type "make setup bcc32"
+ to use Watcom C++ on Win32, type "make setup watcom"
+ to use Intel C++ on Win32, type "make setup intelc"
+ to use LCC-Win32 on Win32, type: "make setup lcc"
+ to use Watcom C++ on OS/2, type "make setup watcom"
+ to use VisualAge C++ on OS/2, type "make setup visualage"
+
+ The <compiler> name to use is platform-dependent. The list of
+ available compilers for your system is available in the file
+ `builds/<system>/detect.mk'
+
+ If you are satisfied by the new configuration summary, skip to
+ step e.
+
+ d. Configure the build system for an unknown platform/compiler
+
+ The auto-detection/setup phase of the build system copies a file
+ to the current directory under the name `config.mk'.
+
+ For example, on OS/2+gcc, it would simply copy
+ `builds/os2/os2-gcc.mk' to `./config.mk'.
+
+ If for some reason your platform isn't correctly detected, copy
+ manually the configuration sub-makefile to `./config.mk' and go to
+ step e.
+
+ Note that this file is a sub-Makefile used to specify Make
+ variables for compiler and linker invocation during the build.
+ You can easily create your own version from one of the existing
+ configuration files, then copy it to the current directory under
+ the name `./config.mk'.
+
+ e. Build the library
+
+ The auto-detection/setup phase should have copied a file in the
+ current directory, called `./config.mk'. This file contains
+ definitions of various Make variables used to invoke the compiler
+ and linker during the build.
+
+ To launch the build, simply invoke GNU Make again: The top
+ Makefile will detect the configuration file and run the build with
+ it.
+
+
+
+ Final note:
+
+ the build system builds a statically linked library of the font engine
+ in the "objs" directory. It does _not_ support the build of DLLs on
+ Windows and OS/2, if you need these, you'll have to either use
+ a IDE-specific project file, or follow the instructions in
+ "INSTALL.ANY" to create your own Makefiles.
--- /dev/null
+++ b/docs/INSTALL.UNX
@@ -1,0 +1,181 @@
+This document contains instructions on how to build the FreeType library
+on Unix systems. This also works for emulations like Cygwin or MSys on
+Win32:
+
+
+ I. Ensure that you are using GNU Make
+ -------------------------------------
+
+ The FreeType build system _exclusively_ works with GNU Make. You
+ will not be able to compile the library with the instructions
+ below using any other alternative (including BSD Make).
+
+ Trying to compile the library with a different Make tool will
+ print a message like:
+
+ Sorry, GNU make is required to build FreeType2.
+
+ and the build process will be aborted. If this happens, install
+ GNU Make on your system, and use the GNUMAKE environment variable
+ to name it.
+
+
+
+ IV. Build and install the library
+ ---------------------------------
+
+ The following should work on all Unix systems where the 'make'
+ command invokes GNU Make:
+
+ ./configure --prefix=<yourprefix>
+ make
+ make install (as root)
+
+ where "<yourprefix>" must be replaced by the prefix returned by
+ the "freetype-config" command.
+
+ When using a different command to invoke GNU Make, use the GNUMAKE
+ variable. For example, if `gmake' is the command to use on your
+ system, do something like:
+
+ GNUMAKE=gmake ./configure --prefix=<yourprefix>
+ gmake
+ gmake install (as root)
+
+ If this still doesn't work, something's rotten on your system(
+ (e.g. you're using a very old version of GNU Make)
+
+
+
+I. Unix systems
+---------------
+
+ If you have GNU Make installed, simply type
+
+ ./configure
+ make
+ make install
+
+ on the command line to configure, build and install FreeType on your
+ system. Note that the default installation path is "/usr/local".
+
+ Please read the file README.UNX, it contains _critical_ information
+ regarding the installation of FreeType on many Unix systems.
+
+
+II. From the command line
+-------------------------
+
+ If you are not using Unix, there are two ways to quickly build
+ FreeType 2 from the command line.
+
+ The first, and favorite one, is to use the "Jam" build tool. Jam is
+ a highly portable replacement for Make whose control files do not
+ depend on the current platform or compiler toolset.
+
+ For more information, please see:
+
+ http://www.freetype.org/jam/index.html
+
+ The second one is to use "GNU Make" (and NO OTHER MAKE TOOL).
+
+
+ 1. Building FT2 with "Jam"
+ --------------------------
+
+ Once you've got *our version* of the Jam tool installed on your
+ system, simply go to the top-level FT2 directory, then type
+
+ "jam"
+
+ on the command line. This will build the library and place it in
+ the "objs" directory.
+
+ By default, a static library is built. On Unix systems, it is
+ possible to build a shared library through the "libtool" script.
+ You need to have libtool installed on your system, then re-define
+ a few environment variables before invoking Jam, as in
+
+ export CC="libtool --mode=compile cc"
+ export LINK="libtool --mode=link cc"
+ jam
+
+ In later releases of FT2, building shared libraries with Jam
+ should become automatic on Unix systems.
+
+
+ 2. Building FT2 with "GNU Make"
+ -------------------------------
+
+ You need to have GNU Make (version 3.78.1 or newer) installed on
+ your system to compile the library from the command line. This will
+ _NOT_ work with other make tools (including BSD make)!
+
+ [Well, this is not really correct. Recently, a perl implementation
+ of make called `makepp' has appeared which can also build FreeType 2
+ successfully on Unix platforms. See http://makepp.sourceforge.net
+ for more details.]
+
+ - Go to the `freetype2' directory.
+
+ - Unix (any C compiler should work):
+
+ - make setup (don't worry, this will invoke a configure script)
+ - make
+ - make install
+
+ Alternatively, you can pass parameters to the configure script
+ within the CFG variable, as in:
+
+ - make setup CFG="--prefix=/usr"
+ - make
+ - make install
+
+ If the configure script isn't run, try to add `unix' as a target
+ on the command line, e.g.:
+
+ - make setup unix CFG="--prefix=/opt/experimental"
+
+
+ - Windows:
+
+ We provide a version of GNU Make for Win32 on the FreeType site.
+ See http://www.freetype.org/download.html for details.
+
+ - gcc (Mingw, _not_ CygWin):
+
+ - make setup
+ - make
+
+
+ - Visual C++:
+
+ - make setup visualc
+ - make
+
+
+ - other compilers:
+
+ - make setup bcc32 -> Borland C++ 32 bits
+ - make setup intelc -> Intel C++
+ - make setup watcom -> Watcom C++
+ - make setup lcc -> Win32-LCC
+
+
+ If you want to build FreeType 2 in another directory, you must set
+ two environment variables, `OJB_DIR' and `TOP_DIR'. The former
+ gives the directory where the object files and the library should be
+ created (this directory must exist), the latter the top directory of
+ the FreeType 2 source tree. Example:
+
+ OBJ_DIR=~/freetype2.compiled TOP_DIR=~/freetype2 \
+ make -f$TOP_DIR/Makefile setup ansi
+ OBJ_DIR=~/freetype2.compiled TOP_DIR=~/freetype2 \
+ make -f$TOP_DIR/Makefile
+
+ On Unix boxes, calling `configure' from the build directory is
+ sufficient; it will build a small Makefile which calls the
+ FreeType 2 Makefile with the necessary parameters.
+
+
+--- end of INSTALL --
--- /dev/null
+++ b/docs/INSTALL.VMS
@@ -1,0 +1,35 @@
+How to build the freetype2 library on VMS
+-----------------------------------------
+
+Just type one of the following depending on the type of external entries you
+want:
+
+ mms
+
+or
+
+ mms/macro=("COMP_FLAGS=/name=(as_is,short)")
+
+The library is avalaible in the directory
+
+ [.LIB]
+
+To compile applications using freetype2 you'll need to define the logical
+FREETYPE pointing to the directory
+
+ [.INCLUDE.FREETYPE]
+
+(i.e., if the directory in which this README.VMS file is located is
+$disk:[freetype] then define the logical with
+
+ define freetype $disk:[freetype.include.freetype]
+
+This version has been tested with Compaq C V6.2-006 on OpenVMS Alpha V7.2-1.
+
+
+ Any problems can be reported to
+
+ [email protected]
+
+
+ Jouk Jansen
--- /dev/null
+++ b/docs/TRUETYPE
@@ -1,0 +1,23 @@
+How to enable the TrueType native hinter if you need it
+--------------------------------------------------------
+
+ The TrueType bytecode interpreter is disabled in all public
+ releases of the FreeType packages for patents reasons (see
+ http://www.freetype.org/patents.html for more details).
+
+ However, many Linux distributions do enable the interpreter in the
+ FreeType packages (DEB/RPM/etc.) they produce for their platforms.
+ If you are using TrueType fonts on your system, you most probably
+ want to enable it manually by doing the following:
+
+ - open the file "include/freetype/config/ftoption.h"
+
+ - locate a line that says:
+
+ #undef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
+ - change it to:
+
+ #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
+ of course, this must be done _before_ compiling the library
--- /dev/null
+++ b/docs/UPGRADE.UNX
@@ -1,0 +1,124 @@
+
+SPECIAL NOTE FOR UNIX USERS
+===========================
+
+ If you are installing this release of FreeType on a system that
+ already uses release 2.0.5 (or even an older version), you have to
+ perform a few special steps to ensure that everything goes well.
+
+
+ I. Enable the TrueType bytecode hinter if you need it
+ -----------------------------------------------------
+
+ See the instructions in the file "TRUETYPE" of this directory.
+
+ Note that FreeType supports TrueType fonts without the bytecode
+ interpreter through its auto-hinter, which now generate relatively good
+ results with most fonts.
+
+
+ II. Determine the correct installation path
+ --------------------------------------------
+
+ By default, the source package will install the library in
+ "/usr/local". However, many Unix distributions now install the
+ library in "/usr", since FreeType is becoming a critical system
+ component.
+
+ If FreeType is already installed on your system, type
+
+ freetype-config --prefix
+
+ on the command line. This should return the installation path to
+ use below (e.g. "/usr" or "/usr/local"). Otherwise, simply use
+ "/usr" (or what you think is adequate for your installation).
+
+
+
+ III. Ensure that you are using GNU Make
+ ---------------------------------------
+
+ The FreeType build system _exclusively_ works with GNU Make. You
+ will not be able to compile the library with the instructions
+ below using any other alternative (including BSD Make).
+
+ Trying to compile the library with a different Make tool will
+ print a message like:
+
+ Sorry, GNU make is required to build FreeType2.
+
+ and the build process will be aborted. If this happens, install
+ GNU Make on your system, and use the GNUMAKE environment variable
+ to name it.
+
+
+
+ IV. Build and install the library
+ ---------------------------------
+
+ The following should work on all Unix systems where the `make'
+ command invokes GNU Make:
+
+ ./configure --prefix=<yourprefix>
+ make
+ make install (as root)
+
+ where "<yourprefix>" must be replaced by the prefix returned by
+ the "freetype-config" command.
+
+ When using a different command to invoke GNU Make, use the GNUMAKE
+ variable. For example, if `gmake' is the command to use on your
+ system, do something like:
+
+ GNUMAKE=gmake ./configure --prefix=<yourprefix>
+ gmake
+ gmake install (as root)
+
+ If this still doesn't work, read the detailed compilation
+ procedure available in the file "docs/BUILD" for troubleshooting.
+
+
+ V. Take care of XFree86 version 4
+ ---------------------------------
+
+ Certain recent Linux distributions will install _several_ versions
+ of FreeType on your system. For example, on a fresh Mandrake 8.1
+ system, you can find the following files:
+
+ /usr/lib/libfreetype.so which links to
+ /usr/lib/libfreetype.6.1.0.so
+
+ and
+
+ /usr/X11R6/lib/libfreetype.so which links to
+ /usr/X11R6/lib/libfreetype.6.0.so
+
+ Note that these files correspond to two distinct versions of the
+ library! It seems that this surprising issue is due to the
+ install scripts of recent XFree86 servers (from 4.1.0) which
+ irremediably install their own (dated) version of the library in
+ "/usr/X11R6/lib".
+
+ In certain _rare_ cases you may experience minor problems if you
+ install this release of the library in "/usr" only, namely, that
+ certain applications will not benefit from the bug fixes and
+ rendering improvements you'd expect.
+
+ There are two good ways to deal with this situation:
+
+ - Install the library _twice_, in "/usr" and in "/usr/X11R6"
+ (you have to do that each time you install a new FreeType
+ release though).
+
+ - Change the link in /usr/X11R6/lib/libfreetype.so to point to
+
+ /usr/lib/libfreetype.so,
+
+ and get rid of
+
+ /usr/X11R6/lib/libfreetype.6.0.so
+
+ The FreeType Team is not responsible for this problem, so please
+ contact either the XFree86 development team or your Linux
+ distributor to help clear this issue in case the information given
+ here doesn't help.
--- a/docs/license.txt
+++ b/docs/license.txt
@@ -1,11 +1,28 @@
-FreeType comes with two licenses from which you can choose the one which
-fits your needs best:
+ The FreeType 2 font engine is copyrighted work, and cannot be
+ used legally without a software license. In order to make this
+ project usable to a vast majority of developers, we distribute it
+ under two dual licenses.
- . The FreeType License, in file `docs/FTL.txt'.
+ What this means is that *you* must choose *one* license among those
+ described below, then obey all its terms and conditions when using
+ FreeType 2 in any of your projects or products:
- . The GNU General Public License, in file `docs/GPL.txt'.
-The contributed PCF driver comes with a license similar to that of X Window
-System which is compatible to the above two licenses (see file
-src/pcf/readme).
+ - The FreeType License, found in the file "FTL.TXT", which is
+ an BSD-style open-source license *with* an advertising
+ clause that forces you to explicitely cite the
+ FreeType project in your product's documentation. All
+ details are in the license file
+
+
+ - The GNU General Public License, found in "GPL.TXT", which is
+ the traditionnal and "viral" GPL license, that
+ forces you to redistribute the _complete_ sources of all
+ your products that simply use FreeType 2.
+
+
+ Note that the contributed PCF driver comes with a license similar to
+ that of X Window System which is compatible to the above two
+ licenses (see file src/pcf/readme).
+
--- a/docs/readme.vms
+++ /dev/null
@@ -1,35 +1,0 @@
-How to build the freetype2 library on VMS
------------------------------------------
-
-Just type one of the following depending on the type of external entries you
-want:
-
- mms
-
-or
-
- mms/macro=("COMP_FLAGS=/name=(as_is,short)")
-
-The library is avalaible in the directory
-
- [.LIB]
-
-To compile applications using freetype2 you'll need to define the logical
-FREETYPE pointing to the directory
-
- [.INCLUDE.FREETYPE]
-
-(i.e., if the directory in which this README.VMS file is located is
-$disk:[freetype] then define the logical with
-
- define freetype $disk:[freetype.include.freetype]
-
-This version has been tested with Compaq C V6.2-006 on OpenVMS Alpha V7.2-1.
-
-
- Any problems can be reported to
-
- [email protected]
-
-
- Jouk Jansen
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -536,6 +536,30 @@
FT_BASE( void )
FT_Done_GlyphSlot( FT_GlyphSlot slot );
+ /* */
+
+ /*
+ * free the bitmap of a given glyphslot when needed
+ * (i.e. only when it was allocated with ft_glyphslot_alloc_bitmap)
+ */
+ FT_BASE( void )
+ ft_glyphslot_free_bitmap( FT_GlyphSlot slot );
+
+ /*
+ * allocate a new bitmap buffer in a glyph slot
+ */
+ FT_BASE( FT_Error )
+ ft_glyphslot_alloc_bitmap( FT_GlyphSlot slot,
+ FT_ULong size );
+
+ /*
+ * set the bitmap buffer in a glyph slot to a given pointer.
+ * the buffer will not be freed by a later call to ft_glyphslot_free_bitmap
+ */
+ FT_BASE( void )
+ ft_glyphslot_set_bitmap( FT_GlyphSlot slot,
+ FT_Pointer buffer );
+
/*************************************************************************/
/*************************************************************************/
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -198,20 +198,60 @@
return error;
}
-
- static void
- ft_glyphslot_clear( FT_GlyphSlot slot )
+ FT_BASE_DEF( void )
+ ft_glyphslot_free_bitmap( FT_GlyphSlot slot )
{
- /* free bitmap if needed */
if ( slot->flags & FT_GLYPH_OWN_BITMAP )
{
FT_Memory memory = FT_FACE_MEMORY( slot->face );
-
-
+
+
FT_FREE( slot->bitmap.buffer );
slot->flags &= ~FT_GLYPH_OWN_BITMAP;
}
+ else
+ {
+ /* assume that the bitmap buffer was stolen or not */
+ /* allocated from the heap */
+ slot->bitmap.buffer = NULL;
+ }
+ }
+
+ FT_BASE_DEF( void )
+ ft_glyphslot_set_bitmap( FT_GlyphSlot slot,
+ FT_Pointer buffer )
+ {
+ ft_glyphslot_free_bitmap( slot );
+
+ slot->bitmap.buffer = buffer;
+
+ FT_ASSERT( (slot->flags & FT_GLYPH_OWN_BITMAP) == 0 );
+ }
+
+
+ FT_BASE_DEF( FT_Error )
+ ft_glyphslot_alloc_bitmap( FT_GlyphSlot slot,
+ FT_ULong size )
+ {
+ FT_Memory memory = FT_FACE_MEMORY( slot->face );
+
+
+ if ( slot->flags & FT_GLYPH_OWN_BITMAP )
+ FT_FREE( slot->bitmap.buffer );
+ else
+ slot->flags |= FT_GLYPH_OWN_BITMAP;
+
+ return FT_MEM_ALLOC( slot->bitmap.buffer, size );
+ }
+
+
+ static void
+ ft_glyphslot_clear( FT_GlyphSlot slot )
+ {
+ /* free bitmap if needed */
+ ft_glyphslot_free_bitmap( slot );
+
/* clear all public fields in the glyph slot */
FT_ZERO( &slot->metrics );
FT_ZERO( &slot->outline );
@@ -248,8 +288,7 @@
clazz->done_slot( slot );
/* free bitmap buffer if needed */
- if ( slot->flags & FT_GLYPH_OWN_BITMAP )
- FT_FREE( slot->bitmap.buffer );
+ ft_glyphslot_free_bitmap( slot );
/* free glyph loader */
if ( FT_DRIVER_USES_OUTLINES( driver ) )
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -489,8 +489,6 @@
int i, j, count;
unsigned char *p, *pp;
- FT_Memory memory = face->bdffont->memory;
-
FT_UNUSED( load_flags );
@@ -514,9 +512,9 @@
bitmap->pixel_mode = FT_PIXEL_MODE_MONO;
bitmap->pitch = glyph.bpr;
- if ( FT_NEW_ARRAY( bitmap->buffer, glyph.bytes ) )
- goto Exit;
- FT_MEM_COPY( bitmap->buffer, glyph.bitmap, glyph.bytes );
+ /* note: we don't allocate a new array to hold the bitmap, we */
+ /* can simply point to it */
+ ft_glyphslot_set_bitmap( slot, glyph.bitmap );
}
else
{
@@ -524,7 +522,8 @@
bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;
bitmap->pitch = bitmap->width;
- if ( FT_NEW_ARRAY( bitmap->buffer, bitmap->rows * bitmap->pitch ) )
+ error = ft_glyphslot_alloc_bitmap( slot, bitmap->rows * bitmap->pitch );
+ if ( error )
goto Exit;
switch ( bpp )
@@ -625,7 +624,6 @@
slot->linearHoriAdvance = (FT_Fixed)glyph.dwidth << 16;
slot->format = FT_GLYPH_FORMAT_BITMAP;
- slot->flags = FT_GLYPH_OWN_BITMAP;
Exit:
return error;
--- a/src/cache/ftlru.c
+++ b/src/cache/ftlru.c
@@ -236,7 +236,7 @@
goto Exit;
}
- FT_ASSERT( list->nodes > 0 );
+ FT_ASSERT( list->num_nodes > 0 );
while ( node->next )
{
--- a/src/pcf/pcfdriver.c
+++ b/src/pcf/pcfdriver.c
@@ -355,7 +355,6 @@
PCF_Face face = (PCF_Face)FT_SIZE_FACE( size );
FT_Stream stream = face->root.stream;
FT_Error error = PCF_Err_Ok;
- FT_Memory memory = FT_FACE( face )->memory;
FT_Bitmap* bitmap = &slot->bitmap;
PCF_Metric metric;
int bytes;
@@ -411,7 +410,8 @@
/* XXX: to do: are there cases that need repadding the bitmap? */
bytes = bitmap->pitch * bitmap->rows;
- if ( FT_ALLOC( bitmap->buffer, bytes ) )
+ error = ft_glyphslot_alloc_bitmap( slot, bytes );
+ if ( error )
goto Exit;
if ( FT_STREAM_SEEK( metric->bits ) ||
@@ -451,7 +451,6 @@
slot->linearHoriAdvance = (FT_Fixed)bitmap->width << 16;
slot->format = FT_GLYPH_FORMAT_BITMAP;
- slot->flags = FT_GLYPH_OWN_BITMAP;
FT_TRACE4(( " --- ok\n" ));
--- a/src/pfr/pfrsbit.c
+++ b/src/pfr/pfrsbit.c
@@ -645,11 +645,10 @@
/* Allocate and read bitmap data */
{
- FT_Memory memory = face->root.memory;
- FT_Long len = glyph->root.bitmap.pitch * ysize;
+ FT_ULong len = glyph->root.bitmap.pitch * ysize;
-
- if ( !FT_ALLOC( glyph->root.bitmap.buffer, len ) )
+ error = ft_glyphslot_alloc_bitmap( &glyph->root, len );
+ if ( !error )
{
error = pfr_load_bitmap_bits( p,
stream->limit,
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -1212,14 +1212,16 @@
TT_SBit_Range range,
FT_ULong ebdt_pos,
FT_ULong glyph_offset,
- FT_Bitmap* map,
+ FT_GlyphSlot slot,
FT_Int x_offset,
FT_Int y_offset,
FT_Stream stream,
- TT_SBit_Metrics metrics )
+ TT_SBit_Metrics metrics,
+ FT_Int depth )
{
- FT_Memory memory = stream->memory;
- FT_Error error;
+ FT_Memory memory = stream->memory;
+ FT_Bitmap* map = &slot->bitmap;
+ FT_Error error;
/* place stream at beginning of glyph data and read metrics */
@@ -1230,11 +1232,10 @@
if ( error )
goto Exit;
- /* this function is recursive. At the top-level call, the */
- /* field map.buffer is NULL. We thus begin by finding the */
- /* dimensions of the higher-level glyph to allocate the */
- /* final pixmap buffer */
- if ( map->buffer == 0 )
+ /* this function is recursive. At the top-level call, we */
+ /* compute the dimensions of the higher-level glyph to */
+ /* allocate the final pixmap buffer */
+ if ( depth == 0 )
{
FT_Long size;
@@ -1274,7 +1275,8 @@
if ( size == 0 )
goto Exit; /* exit successfully! */
- if ( FT_ALLOC( map->buffer, size ) )
+ error = ft_glyphslot_alloc_bitmap( slot, size );
+ if (error)
goto Exit;
}
@@ -1348,11 +1350,12 @@
elem_range,
ebdt_pos,
elem_offset,
- map,
+ slot,
x_offset + comp->x_offset,
y_offset + comp->y_offset,
stream,
- &elem_metrics );
+ &elem_metrics,
+ depth+1 );
if ( error )
goto Fail_Memory;
}
@@ -1409,7 +1412,6 @@
TT_SBit_MetricsRec *metrics )
{
FT_Error error;
- FT_Memory memory = stream->memory;
FT_ULong ebdt_pos, glyph_offset;
TT_SBit_Strike strike;
@@ -1432,19 +1434,10 @@
ebdt_pos = FT_STREAM_POS();
- /* clear the bitmap & load the bitmap */
- if ( face->root.glyph->flags & FT_GLYPH_OWN_BITMAP )
- FT_FREE( map->buffer );
-
- map->rows = map->pitch = map->width = 0;
-
error = Load_SBit_Image( strike, range, ebdt_pos, glyph_offset,
- map, 0, 0, stream, metrics );
+ face->root.glyph, 0, 0, stream, metrics, 0 );
if ( error )
goto Exit;
-
- /* the glyph slot owns this bitmap buffer */
- face->root.glyph->flags |= FT_GLYPH_OWN_BITMAP;
/* setup vertical metrics if needed */
if ( strike->flags & 1 )
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -560,18 +560,11 @@
static void
- ft_glyphslot_clear( FT_GlyphSlot slot )
+ t42_glyphslot_clear( FT_GlyphSlot slot )
{
/* free bitmap if needed */
- if ( slot->flags & FT_GLYPH_OWN_BITMAP )
- {
- FT_Memory memory = FT_FACE_MEMORY( slot->face );
+ ft_glyphslot_free_bitmap( slot );
-
- FT_FREE( slot->bitmap.buffer );
- slot->flags &= ~FT_GLYPH_OWN_BITMAP;
- }
-
/* clear all public fields in the glyph slot */
FT_ZERO( &slot->metrics );
FT_ZERO( &slot->outline );
@@ -603,7 +596,7 @@
FT_Driver_Class ttclazz = ((T42_Driver)glyph->face->driver)->ttclazz;
- ft_glyphslot_clear( t42slot->ttslot );
+ t42_glyphslot_clear( t42slot->ttslot );
error = ttclazz->load_glyph( t42slot->ttslot,
t42size->ttsize,
glyph_index,
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -618,10 +618,7 @@
/* allocate and build bitmap */
{
- FT_Memory memory = FT_FACE_MEMORY( slot->face );
FT_Int pitch = ( bitmap->width + 7 ) >> 3;
- FT_Byte* column;
- FT_Byte* write;
bitmap->pitch = pitch;
@@ -628,22 +625,11 @@
bitmap->rows = font->header.pixel_height;
bitmap->pixel_mode = FT_PIXEL_MODE_MONO;
- if ( FT_ALLOC( bitmap->buffer, pitch * bitmap->rows ) )
- goto Exit;
-
- column = (FT_Byte*)bitmap->buffer;
-
- for ( ; pitch > 0; pitch--, column++ )
- {
- FT_Byte* limit = p + bitmap->rows;
-
-
- for ( write = column; p < limit; p++, write += bitmap->pitch )
- write[0] = p[0];
- }
+ /* note: we don't allocate a new buffer for the bitmap since we */
+ /* already store the images in the FT_Face */
+ ft_glyphslot_set_bitmap( slot, p );
}
- slot->flags = FT_GLYPH_OWN_BITMAP;
slot->bitmap_left = 0;
slot->bitmap_top = font->header.ascent;
slot->format = FT_GLYPH_FORMAT_BITMAP;