* src/base/fttrigon.c, src/base/ftgloadr.c: Inlude

FT_INTERNAL_OBJECTS_H.

* src/base/ftstroke.c (FT_Outline_GetInsideBorder,
FT_Outline_GetOutsideBorder): s/or/o/ to make it compile with
C++ compilers.

* src/cache/ftcmru.c, include/freetype/cache/ftcmru.h:
s/select/selection/ to avoid compiler warning.
* src/cff/cffload.h: s/select/ftselect/ to avoid potential
compiler warning.

Formatting.
This commit is contained in:
Werner Lemberg 2003-12-26 07:26:08 +00:00
parent a40b1b64a0
commit 80cfbd7073
36 changed files with 1398 additions and 1135 deletions

260
ChangeLog
View File

@ -1,3 +1,17 @@
2003-12-25 Werner Lemberg <wl@gnu.org>
* src/base/fttrigon.c, src/base/ftgloadr.c: Inlude
FT_INTERNAL_OBJECTS_H.
* src/base/ftstroke.c (FT_Outline_GetInsideBorder,
FT_Outline_GetOutsideBorder): s/or/o/ to make it compile with
C++ compilers.
* src/cache/ftcmru.c, include/freetype/cache/ftcmru.h:
s/select/selection/ to avoid compiler warning.
* src/cff/cffload.h: s/select/ftselect/ to avoid potential
compiler warning.
2003-12-24 Werner Lemberg <wl@gnu.org>
* src/cache/ftcsbits.c (FTC_SNode_Weight):
@ -25,8 +39,14 @@
`(x) & ~63' instead!
Updated all related code.
* include/freetype/ftstroke.h, src/base/ftstroke.c: Added support
for extraction of "inside" and "outside" borders.
Add support for extraction of `inside' and `outside' borders.
* src/base/ftstroke.c (FT_StrokerBorder): New enumeration.
(FT_Outline_GetInsideBorder, FT_Outline_GetOutsideBorder,
FT_Stroker_GetBorderCounts, FT_Stroker_ExportBorder): New functions.
(FT_StrokeBorderRec): New boolean member `valid'.
(ft_stroke_border_get_counts): Updated.
* include/freetype/ftstroke.h: Updated.
2003-12-22 Werner Lemberg <wl@gnu.org>
@ -61,11 +81,11 @@
src/cache/ftcbasic.c (added),
src/cache/ftclru.c (removed):
*Complete* rewrite of the cache sub-system to "solve" the
*Complete* rewrite of the cache sub-system to `solve' the
following points:
- all public APIs have been moved to FT_CACHE_H, everything
under "include/freetype/cache" is only needed by client
under `include/freetype/cache' is only needed by client
applications that want to implement their own caches
- a new function named FTC_Manager_RemoveFaceID to deal
@ -2292,8 +2312,8 @@
(not defined, but in comments) for the unpatented hinting system.
* include/freetype/internal/tttypes.h (TT_FaceRec)
[TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING]: New element "FT_Bool
unpatented_hinting".
[TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING]: New element `FT_Bool
unpatented_hinting'.
* src/truetype/ttinterp.c (NO_APPLE_PATENT, APPLE_THRESHOLD):
Removed.
@ -2359,8 +2379,8 @@
* src/pcf/pcfread.c (pcf_load_font): Fixed the computation of
face->num_glyphs. We must increase the value by 1 to respect the
convention that glyph index 0 always corresponds to the "missing
glyph".
convention that glyph index 0 always corresponds to the `missing
glyph'.
2003-04-24 Werner Lemberg <wl@gnu.org>
@ -2456,7 +2476,7 @@
2003-04-09 Torrey Lyons <torrey@mrcla.com>
* src/base/ftmac.c (open_face_from_buffer): Removed a double-free
bug that had nasty consequences when trying to open an "invalid"
bug that had nasty consequences when trying to open an `invalid'
font on a Mac.
2003-04-09 Mike Fabian <mfabian@suse.de>
@ -2475,7 +2495,7 @@
2003-04-03 Martin Muskens <mmuskens@aurelon.com>
* src/type1/t1load.c (T1_Open_Face): Fixed the code to make it
handle special cases where a font only contains a ".notdef" glyph
handle special cases where a font only contains a `.notdef' glyph
(happens in PDF-embedded fonts). Otherwise, FT_Panic was called.
2003-03-27 David Turner <david@freetype.org>
@ -2584,8 +2604,8 @@
2003-03-13 David Turner <david@freetype.org>
Added new environment variables to control memory debugging with
FreeType. See the description of "FT2_DEBUG_MEMORY",
"FT2_ALLOC_TOTAL_MAX" and "FT2_ALLOC_COUNT_MAX" in DEBUG.TXT.
FreeType. See the description of `FT2_DEBUG_MEMORY',
`FT2_ALLOC_TOTAL_MAX' and `FT2_ALLOC_COUNT_MAX' in DEBUG.TXT.
* src/base/ftdbgmem.c (FT_MemTableRec): Add `alloc_count',
`bound_total', `alloc_total_max', `bound_count', `alloc_count_max'.
@ -2630,7 +2650,7 @@
(ftc_cmap_family_init): The cmap cache now
supports UCS-4 charmaps when available in Asian fonts.
* src/sfnt/ttload.c, src/base/ftobjs.c: Changed "asian" to "Asian"
* src/sfnt/ttload.c, src/base/ftobjs.c: Changed `asian' to `Asian'
in comments.
2003-02-25 David Turner <david@freetype.org>
@ -2651,7 +2671,7 @@
- The table loaded now scans for *undocumented* elements of a
physical font's auxiliary data record. This is necessary to
retrieve the "real" family and style names.
retrieve the `real' family and style names.
NOTE THAT THESE CHANGES THE FAMILY NAME OF MANY PFR FONTS!
@ -2697,7 +2717,7 @@
`exec->metrics'.
* src/autohint/ahhint.c (ah_hinter_load): Disabled the advance width
"correction" which seemed to provide more trouble than benefits.
`correction' which seemed to provide more trouble than benefits.
2003-02-13 Graham Asher <graham.asher@btinternet.com>
@ -2738,7 +2758,7 @@
* src/pfr/pfrsbit.c: Removed compiler warnings.
* src/cache/ftccmap.c (ftc_cmap_family_init): Changed an FT_ERROR
into an FT_TRACE1 since it caused "ftview" and others to dump too
into an FT_TRACE1 since it caused `ftview' and others to dump too
much junk when trying to display a waterfall with a font without a
Unicode charmap (e.g. SYMBOL.TTF).
@ -2802,9 +2822,9 @@
(pcf_find_property): Decorate it with FT_LOCAL_DEF.
* src/pcf/pcfread.h: New file, providing `pcf_find_property'.
* src/sfnt/ttload.c (sfnt_dir_check): Relaxed the "head" table size
* src/sfnt/ttload.c (sfnt_dir_check): Relaxed the `head' table size
verification to accept a few broken fonts who pad the size
incorrectly (the table should be padded, but its "size" field
incorrectly (the table should be padded, but its `size' field
shouldn't according to the specification).
2003-01-18 Werner Lemberg <wl@gnu.org>
@ -2870,9 +2890,9 @@
Patches to the auto-hinter in order to slightly improve the output.
Note that everything is controlled through the new
FT_CONFIG_OPTION_CHESTER_HINTS defined in "ftoption.h". There are
FT_CONFIG_OPTION_CHESTER_HINTS defined in `ftoption.h'. There are
also individual FT_CONFIG_CHESTER_XXX macros to control individual
"features".
`features'.
Note that all improvements are enabled by default, but can be
tweaked for optimization and testing purposes. The configuration
@ -2914,11 +2934,11 @@
2003-01-08 Huw Dawies <huw@codeweavers.com>
* src/winfonts/winfnt.c (winfnt_header_fields): Read 16 bytes into
"reserved2", not "reserved".
`reserved2', not `reserved'.
* src/base/ftobjs.c (find_unicode_charmap): Fixed the error code
returned when the font doesn't contain a Unicode charmap. This
allows FT2 to load "symbol.ttf" and a few others correctly since the
allows FT2 to load `symbol.ttf' and a few others correctly since the
last release.
(open_face): Fix return value.
@ -2971,7 +2991,7 @@
assertion, and changing code to avoid hash table size contraction.
* src/base/Jamfile, src/base/rules.mk, src/base/descrip.mms: Adding
"ftstroker" to default build, as optional component.
`ftstroker' to default build, as optional component.
2002-12-26 David Turner <david@freetype.org>
@ -3102,7 +3122,7 @@
configuration (typically by adding -D flags at compile time).
* src/sfnt/ttcmap0.c (tt_face_build_cmaps): Removed compiler
warnings in optimized mode relative to the "volatile" local
warnings in optimized mode relative to the `volatile' local
variables. This was not a compiler bug after all, but the fact that
a pointer to a volatile variable is not the same as a volatile
pointer to a variable :-)
@ -3234,8 +3254,8 @@
src/tools/docmaker/tohtml.py: Fixing a few nasty bugs.
* src/sfnt/ttcmap0.c (tt_cmap4_validate): The validator for format 4
sub-tables is now capable of dealing with invalid "length" fields at
the start of the sub-table. This allows fonts like "mg______.ttf"
sub-tables is now capable of dealing with invalid `length' fields at
the start of the sub-table. This allows fonts like `mg______.ttf'
(i.e. Marriage) to return accurate charmaps.
* docs/CHANGES: Updated.
@ -3499,7 +3519,7 @@
Removed conditional code. This fixes a bug that prevented
compilation in debug mode of template instantiation.
* include/freetype/ftimage.h: Removed incorrect "zft_" definitions
* include/freetype/ftimage.h: Removed incorrect `zft_' definitions
and updated constants documentation comments.
* src/cff/cffparse.c (cff_parser_run): Fixed the CFF table loader.
@ -3507,7 +3527,7 @@
certain fonts.
* include/freetype/freetype.h (FT_FaceRec): Updating documentation
comment. The "descender" value is always *negative*, not positive.
comment. The `descender' value is always *negative*, not positive.
2002-09-09 Owen Taylor <owen@redhat.com>
@ -3811,7 +3831,7 @@
The automatic and Postscript hinter now automatically detect
inflection points in glyph outlines and treats them specially. This
is very useful to prevent nasty effect like the disappearing
diagonals of "S" and "s" in many, many fonts.
diagonals of `S' and `s' in many, many fonts.
* src/autohint/ahtypes.h (ah_flag_inflection): New macro.
* src/autohint/ahangles.c (ah_angle_diff): New function.
@ -3825,8 +3845,8 @@
* src/tools/docmaker/docmaker.py, src/tools/docmaker/utils.py,
src/tools/docmaker/tohtml.py: Updating the DocMaker tool.
* include/freetype/freetype.h: Changing the type of the "load_flags"
parameter from "FT_Int" to "FT_Int32", this in order to support more
* include/freetype/freetype.h: Changing the type of the `load_flags'
parameter from `FT_Int' to `FT_Int32', this in order to support more
options. This should only break binary and/or source compatibility
on 16-bit platforms (Atari?).
(FT_LOAD_NO_AUTOHINT): New macro.
@ -3995,7 +4015,7 @@
2002-07-30 David Turner <david@freetype.org>
* include/freetype/ftincrem.h: Adding new experimental header file
to demonstrate a "cleaner" API to support incremental font loading.
to demonstrate a `cleaner' API to support incremental font loading.
* include/freetype/config/ftheader.h (FT_INCREMENTAL_H): New macro.
@ -4031,10 +4051,10 @@
2002-07-24 Graham Asher <graham.asher@btinternet.com>
* src/truetype/ttobjs.c: Fix for bug reported by Sven Neumann
[sven@gimp.org] on the FreeType development forum: "If
[sven@gimp.org] on the FreeType development forum: `If
FT_CONFIG_OPTION_INCREMENTAL is undefined (this is the default), the
TrueType loader crashes in line 852 of src/truetype/ttgload.c when
it tries to access face->glyph_locations."
it tries to access face->glyph_locations.'
2002-07-18 Graham Asher <graham.asher@btinternet.com>
@ -4137,8 +4157,8 @@
2002-07-11 David Turner <david@freetype.org>
Changing the SFNT loader to check for SFNT-based font files
differently. We now ignore the range "helper" fields and check the
"head" table's magic number instead.
differently. We now ignore the range `helper' fields and check the
`head' table's magic number instead.
* include/freetype/internal/tttypes.h (SFNT_HeaderRec): Add `offset'
field.
@ -4655,7 +4675,7 @@
2002-06-07 David Turner <david@freetype.org>
Fixed the bug that prevented the correct display of fonts with
"ftview".
`ftview'.
* src/type42/t42drivr.c: Split into...
* src/type42/t42drivr.h, src/type42/t42parse.c,
@ -4761,8 +4781,8 @@
* include/freetype/t1tables.h: Updated.
* src/base/Jamfile, src/base/rules.mk, src/base/descrip.mms:
Updating build control files for the new files "ftxf86.c" and
"fttype1.c" in src/base.
Updating build control files for the new files `ftxf86.c' and
`fttype1.c' in src/base.
* src/pshinter/pshglob.c (psh_blues_scale_zones): Fixed a bug that
prevented family blue zones substitution from hapenning correctly.
@ -4784,7 +4804,7 @@
Fixing the SFNT name table loader to support various buggy fonts.
It now ignores empty name entries, entries with invalid pointer
Offsets and certain fonts containing tables with broken
"storageOffset" fields.
`storageOffset' fields.
Name strings are now loaded on demand, which reduces the memory
requirements for a given FT_Face tremendously (for example, the name
@ -4838,7 +4858,7 @@
2002-05-21 David Turner <david@freetype.org>
* src/bdf/bdflib.c: Removed compiler warning, and changed all tables
to the "static const" storage specifier (instead of simply
to the `static const' storage specifier (instead of simply
`static').
* src/type42/t42drivr.c (hexval): Use more efficient code.
@ -4849,7 +4869,7 @@
src/base/descrip.mms, src/base/Jamfile, src/base/rules.mk
(FT_Get_BDF_Charset_ID): New API to retrieve BDF-specific strings
from a face. This is much cleaner than accessing the internal types
"BDF_Public_Face" defined in FT_INTERNAL_BDF_TYPES_H.
`BDF_Public_Face' defined in FT_INTERNAL_BDF_TYPES_H.
2002-05-21 Werner Lemberg <wl@gnu.org>
@ -5003,11 +5023,11 @@
2002-05-01 David Turner <david@freetype.org>
* src/sfnt/sfobjs.c (tt_face_get_name): Fixing a bug that caused
FreeType to crash when certain broken fonts (e.g. "hya6gb.ttf")
FreeType to crash when certain broken fonts (e.g. `hya6gb.ttf')
were opened.
* src/sfnt/ttload.c (TT_Load_Names): Applied a small work-around to
manage fonts containing a broken name table (e.g. "hya6gb.ttf").
manage fonts containing a broken name table (e.g. `hya6gb.ttf').
* src/sfnt/ttcmap0.c (tt_cmap4_validate): Fixed over-restrictive
validation test. The charmap validator now accepts overlapping
@ -5174,8 +5194,8 @@
* src/base/ftobjs.c, builds/win32/ftdebug.c,
builds/amiga/src/base/ftdebug.c: Version 2.1.0 couldn't be linked
against applications in Win32 and Amiga builds due to changes to
"src/base/ftdebug.c" that were not properly propagated to
"builds/win32" and "builds/amiga". This has been fixed.
`src/base/ftdebug.c' that were not properly propagated to
`builds/win32' and `builds/amiga'. This has been fixed.
* include/freetype/internal/ftobject.h,
include/freetype/internal/ftexcept.h, include/freetype/ftsysmem.h,
@ -5262,7 +5282,7 @@
builds/amiga/src/base/ftdebug.c:
Added the new configuration file "ftstdlib.h" used to define
Added the new configuration file `ftstdlib.h' used to define
aliases for all ISO C library functions used by the engine
(e.g. strlen, qsort, setjmp, etc.).
@ -5503,7 +5523,7 @@
* src/psaux/t1cmap.h, src/psaux/t1cmap.c, src/type1/t1cmap.h,
src/type1/t1cmap.c: Updating and moving the Type 1 FT_CMap support
from "src/type1" to "src/psaux" since it is going to be shared by
from `src/type1' to `src/psaux' since it is going to be shared by
the Type 1 and CID font drivers.
* src/psaux/Jamfile, src/psaux/psaux.c, src/psaux/psauxmod.c,
@ -5713,11 +5733,11 @@
* src/cid/cidriver.c (cid_get_postscript_name): Fixed a bug that
caused the CID driver to return Postscript font names with a leading
slash ("/") as in "/MOEKai-Regular".
slash (`/') as in `/MOEKai-Regular'.
* src/sfnt/ttload.c (TT_Load_Names), src/sfnt/sfobjs.c (Get_Name),
src/sfnt/sfdriver.c (get_sfnt_postscript_name): Fixed the loader so
that it accepts broken fonts like "foxjump.ttf", which made FreeType
that it accepts broken fonts like `foxjump.ttf', which made FreeType
crash when trying to load them.
Also improved the name table parser to be able to load
@ -5777,7 +5797,7 @@
* src/sfnt/ttload.c (TT_Load_Names): Simplifying and securing the
names table loader. Invalid individual name entries are now handled
correctly. This allows the loading of very buggy fonts like
"foxjump.ttf" without allocating tons of memory and causing crashes.
`foxjump.ttf' without allocating tons of memory and causing crashes.
* src/otlayout/otlcommon.h, src/otlayout/otlcommon.c: Adding (still
experimental) code for OpenType Layout tables validation and
@ -5824,14 +5844,14 @@
ft_io_stream => ft_ansi_stream_io (in base/ftsystem.c only)
* src/base/ftutil.c: New file. Contains all memory and list
management code (previously in "ftobjs.c" and "ftlist.c",
management code (previously in `ftobjs.c' and `ftlist.c',
respectively).
* include/freetype/internal/ftobjs.h: Moving all code related to
glyph loaders to ...
* include/freetype/"internal/ftgloadr.h: This new file.
"FT_GlyphLoader" is now a pointer to the structure
"FT_GlyphLoaderRec".
* include/freetype/internal/ftgloadr.h: This new file.
`FT_GlyphLoader' is now a pointer to the structure
`FT_GlyphLoaderRec'.
(ft_glyph_own_bitmap): Renamed to ...
(FT_GLYPH_OWN_BITMAP): This.
* src/base/ftobjs.c: Moving all code related to glyph loaders
@ -5846,8 +5866,8 @@
2002-02-21 David Turner <david@freetype.org>
Modified the debug sub-system initialization. Trace levels can now
be specified within the "FT2_DEBUG" environment variable. See the
comments within "ftdebug.c" for more details.
be specified within the `FT2_DEBUG' environment variable. See the
comments within `ftdebug.c' for more details.
* src/base/ftdebug.c: (FT_SetTraceLevel): Removed.
(ft_debug_init): New function.
@ -5872,8 +5892,8 @@
Removed. Both files are now completely obsolete.
* src/base/Jamfile, src/base/rules.mk: Updated.
* include/freetype/fterrors.h: Adding "#undef FT_ERR_CAT" and
`#undef FT_ERR_XCAT" to avoid warnings with certain compilers (like
* include/freetype/fterrors.h: Adding `#undef FT_ERR_CAT' and
`#undef FT_ERR_XCAT' to avoid warnings with certain compilers (like
LCC).
* src/pshinter/pshalgo2.c (print_zone): Renamed to ...
@ -5885,7 +5905,7 @@
2002-02-20 David Turner <david@freetype.org>
* README: Adding "devel@freetype.org" address for bug reports.
* README: Adding `devel@freetype.org' address for bug reports.
2002-02-20 Werner Lemberg <wl@gnu.org>
@ -6013,7 +6033,7 @@
* src/pcf/pcfdriver.c (FT_Done_Face): Fixed small memory leak.
* src/pcf/pcfread.c (pcf_load_font): Now handles the "AVERAGE_WIDTH"
* src/pcf/pcfread.c (pcf_load_font): Now handles the `AVERAGE_WIDTH'
property to return correct character pixel (width/height) pairs for
embedded bitmaps.
@ -6079,7 +6099,7 @@
2002-01-30 David Turner <david@freetype.org>
* INSTALL: Moved to ...
* docs/INSTALL: Here to avoid conflicts with the "install" script on
* docs/INSTALL: Here to avoid conflicts with the `install' script on
Windows, where the filesystem doesn't preserve case.
2002-01-29 David Turner <david@freetype.org>
@ -6089,7 +6109,7 @@
./configure --disable-shared --disable-nls
the "--disable-nls" was incorrectly sent to the "make" program.
the `--disable-nls' was incorrectly sent to the `make' program.
2002-01-29 Werner Lemberg <wl@gnu.org>
@ -6136,7 +6156,7 @@
2002-01-21 Antoine Leca <Antoine-Freetype@Leca-Marti.org>
* docs/PATENTS: Typo fixed (thanks to Detlef "Hawkeye" Würkner) in
* docs/PATENTS: Typo fixed (thanks to Detlef `Hawkeye' Würkner) in
the URL for the online resource.
2002-01-18 Ian Brown <ian.brown@printsoft.de>
@ -6211,7 +6231,7 @@
* src/autohint/ahhint.c (ah_align_linked_edge): Modified computation
of auto-hinted stem widths; this avoids color fringes in
"ClearType-like" rendering.
`ClearType-like' rendering.
* src/truetype/ttgload.c (TT_Load_Glyph_Header,
TT_Load_Simple_Glyph, TT_Load_Composite_Glyph, load_truetype_glyph):
@ -6238,22 +6258,22 @@
2002-01-03 Keith Packard <keithp@keithp.com>
* builds/unix/ftsystem.c (FT_New_Stream): Added a fix to ensure that
all FreeType input streams are closed in child processes of a "fork"
all FreeType input streams are closed in child processes of a `fork'
on Unix systems. This is important to avoid (potential) access
control issues.
2002-01-03 David Turner <david@freetype.org>
* src/type1/t1objs.c (T1_Face_Init): Fixed a bug that crashed the
library when dealing with certain weird fonts like "Stalingrad", in
"sadn.pfb" (this font has no full font name entry).
library when dealing with certain weird fonts like `Stalingrad', in
`sadn.pfb' (this font has no full font name entry).
* src/base/ftoutln.c, include/freetype/ftoutln.h (FT_Outline_Check):
New function to check the consistency of outline data.
* src/base/ftobjs.c (FT_Load_Glyph): Use `FT_Outline_Check' to
ensure that loaded glyphs are valid. This allows certain fonts like
"tt1095m_.ttf" to be loaded even though it appears they contain
`tt1095m_.ttf' to be loaded even though it appears they contain
really funky glyphs.
There still is a bug there, though.
@ -6304,8 +6324,8 @@
2001-12-21 David Turner <david@freetype.org>
* src/pshinter/pshrec.c (ps_hints_t2mask, ps_hints_t2counter):
Ignore invalid "hintmask" and "cntrmask" operators (instead of
returning an error). Glyph 2028 of the CFF font "MSung-Light-Acro"
Ignore invalid `hintmask' and `cntrmask' operators (instead of
returning an error). Glyph 2028 of the CFF font `MSung-Light-Acro'
couldn't be rendered otherwise (it seems its charstring is buggy,
though this requires more analysis).
(FT_COMPONENT): Define.
@ -6401,12 +6421,12 @@
routines were never released when CID faces were destroyed.
* src/cff/cffload.h, src/cff/cffload.c, src/cff/cffgload.c: Updated
to move the definition of encoding tables back within "cffload.c"
to move the definition of encoding tables back within `cffload.c'
instead of making them part of a shared header (causing problems in
"multi" builds). This reverts change 2001-08-08.
`multi' builds). This reverts change 2001-08-08.
* docs/CHANGES: Updated for 2.0.6 release.
* docs/TODO: Added "stem3 and counter hints support" to the TODO
* docs/TODO: Added `stem3 and counter hints support' to the TODO
list for the Postscript hinter.
* docs/BUGS: Closed the AUTOHINT-NO-SBITS bug.
@ -6420,12 +6440,12 @@
that prevented composites from loading correctly, due to missing
parentheses around macro parameters.
* src/sfnt/sfobjs.c (SFNT_Load_Face): Make the "post" and "name"
* src/sfnt/sfobjs.c (SFNT_Load_Face): Make the `post' and `name'
tables optional to load PCL fonts properly.
* src/truetype/ttgload.c (TT_Load_Glyph), src/base/ftobjs.c
(FT_Load_Glyph), include/freetype/freetype.h (FT_LOAD_SBITS_ONLY):
"Fixed" the bug that prevented embedded bitmaps to be loaded when
`Fixed' the bug that prevented embedded bitmaps to be loaded when
the auto-hinter is used. This actually is a hack but will be enough
until the internal re-design scheduled for FreeType 2.1.
@ -6514,9 +6534,9 @@
2001-12-11 David Turner <david@freetype.org>
* builds/unix/freetype-config.in: Modified the script to prevent
passing "-L/usr/lib" to gcc.
passing `-L/usr/lib' to gcc.
* docs/FTL.TXT: Simple fix (change "LICENSE.TXT" to "FTL.TXT").
* docs/FTL.TXT: Simple fix (change `LICENSE.TXT' to `FTL.TXT').
* builds/unix/freetype2.m4: New file for checking configure paths.
We need to install it in $(prefix)/share/aclocal/freetype2.m4 but I
@ -6537,7 +6557,7 @@
2001-12-10 Francesco Zappa Nardelli <Francesco.Zappa.Nardelli@ens.fr>
* src/pcf/pcfdriver.c (PCF_Init_Face): Allow Xft to use PCF fonts
by setting the "face->metrics.max_advance" correctly.
by setting the `face->metrics.max_advance' correctly.
2001-12-07 David Turner <david@freetype.org>
@ -6636,8 +6656,8 @@
* include/freetype/ttnameid.h: Added some new Microsoft language
codes and LCIDs as found in MSDN (Passport SDK). Also added
comments about the meaning of bit 57 of the `OS/2' table
(TT_UCR_SURROGATES) which (with OpenType v.1.3) now means "there is
a character beyond 0xFFFF in this font". Thanks to Detlef Würkner
(TT_UCR_SURROGATES) which (with OpenType v.1.3) now means `there is
a character beyond 0xFFFF in this font'. Thanks to Detlef Würkner
<TetiSoft@apg.lahn.de> for noticing this.
2001-11-20 David Turner <david@freetype.org>
@ -6684,7 +6704,7 @@
Fix typos.
* tests/gview.c: Updated the debugging glyph viewer to show the
hints generated by the "autohint" module.
hints generated by the `autohint' module.
2001-10-27 David Turner <david@freetype.org>
@ -6695,7 +6715,7 @@
* include/freetype/ftcache.h, include/freetype/cache/*.h,
src/cache/*.c: Major re-design of the cache sub-system to provide
better performance as well as an "Acquire"/"Release" API. Seems to
better performance as well as an `Acquire'/`Release' API. Seems to
work well here, but probably needs a bit more testing.
2001-10-26 Leonard Rosenthol <leonardr@lazerware.com>
@ -6763,7 +6783,7 @@
the source file.
* src/base/ftdbgmem.c: New debugging memory manager. You must
define the FT_DEBUG_MEMORY macro in "ftoption.h" to enable it. It
define the FT_DEBUG_MEMORY macro in `ftoption.h' to enable it. It
will record every memory block allocated and report simple errors
like memory leaks and double deletes.
@ -6817,7 +6837,7 @@
compiler warnings.
* src/pshinter/module.mk, src/pshinter/rules.mk: Adding control
files to build the PostScript hinter with the "old" build system.
files to build the PostScript hinter with the `old' build system.
2001-10-19 Jacob Jansen <joukj@hrem.stm.tudelft.nl>
@ -6827,7 +6847,7 @@
2001-10-18 David Turner <david@freetype.org>
* src/psnames/pstables.h, src/tools/glnames.py: Rewrote the
"glnames.py" script used to generate the "pstables.h" header file.
`glnames.py' script used to generate the `pstables.h' header file.
The old one contained a serious bug that made FreeType return
incorrect glyph names for certain glyphs.
@ -6869,7 +6889,7 @@
* tests/Jamfile, tests/gview.c: Adding a new glyph hinting
viewer/debugger to the source tree. Note that you will _not_ be
able to compile it since it depends on an unavailable graphics
library named "Nirvana" to render vector images.
library named `Nirvana' to render vector images.
2001-10-17 David Turner <david@freetype.org>
@ -6991,7 +7011,7 @@
in PDF documents that were automatically generated from TrueType
ones).
* src/type1/t1load.c (is_alpha): Now supports "+" in font names;
* src/type1/t1load.c (is_alpha): Now supports `+' in font names;
this is used in embedded fonts.
* src/psaux/psobjs.c (PS_Table_Add): Fixed a reallocation bug that
@ -7073,7 +7093,7 @@
(cff_get_glyph_index): Minor documentation change.
* src/type1/t1driver.c (t1_get_name_index): New function used in
Get_Interface as the function returned when the "name_index"
Get_Interface as the function returned when the `name_index'
function is requested.
(get_t1_glyph_name): Renamed to t1_get_glyph_name for consistency.
@ -7090,10 +7110,10 @@
* src/cff/cffdrivr.c (cff_get_name_index): New function, returned
when `cff_get_interface' is called with a request for the
"name_index" function.
`name_index' function.
(cff_get_interface): Modified so that it returns the function
`cff_get_name_index' when the "name_index" function is requested.
`cff_get_name_index' when the `name_index' function is requested.
* src/base/ftobjs.c (FT_Get_Name_Index): New function, used to
return a glyph index for a given glyph name only if the driver
@ -7239,7 +7259,7 @@
Removing _lots_ of compiler warnings when the most pedantic warning
levels of Visual C++ and Borland C++ are used. Too many files to be
listed here, but FT2 now compiles without warnings with VC++ and the
"/W4" warning level (lint-style).
`/W4' warning level (lint-style).
* include/freetype/freetype.h (FT_New_Memory_Face): Updated
documentation.
@ -7313,9 +7333,9 @@
2001-06-14 David Turner <david@freetype.org>
Modified the TrueType interpreter to let it use the new
trigonometric functions provided in "fttrigon.h". This gets rid of
trigonometric functions provided in `fttrigon.h'. This gets rid of
some old 64-bit computation routines, as well as many warnings when
compiling the library with the "long long" 64-bit integer type.
compiling the library with the `long long' 64-bit integer type.
* include/freetype/config/ftoption.h: Undefine
FT_CONFIG_OPTION_OLD_CALCS.
@ -7437,7 +7457,7 @@
2001-05-25 David Turner <david@freetype.org>
Moved several documents from the top-level to the "docs" directory.
Moved several documents from the top-level to the `docs' directory.
* src/base/ftcalc.c (FT_DivFix): Small fix to return value.
@ -7491,9 +7511,9 @@
* builds/newline: New file.
* builds/top_level.mk, builds/detect.mk: Use it. This fixes
problems with Make on Windows 2000, as well as problems when "make
distclean" is invoked on a non-Unix platform when there is no
"config.mk" in the current directory.
problems with Make on Windows 2000, as well as problems when `make
distclean' is invoked on a non-Unix platform when there is no
`config.mk' in the current directory.
* builds/freetype.mk: Fixed a problem with object deletions under
Dos/Windows/OS/2 systems.
@ -7545,7 +7565,7 @@
* src/base/ftcalc.c (FT_MulDiv, FT_MulFix, FT_DivFix): Various tiny
fixes related to rounding in 64-bits routines and
pseudo-"optimizations".
pseudo-`optimizations'.
2001-04-27 David Turner <david@freetype.org>
@ -7572,7 +7592,7 @@
fixed-point square root computation. It is now used even with
64-bits integers, as it is _much_ faster than calling FT_Sqrt64 :-)
* src/base/ftbbox.c: Removed invalid "#include FT_BEZIER_H" line.
* src/base/ftbbox.c: Removed invalid `#include FT_BEZIER_H' line.
2001-04-25 David Turner <david@freetype.org>
@ -7590,7 +7610,7 @@
2001-04-20 David Turner <david@freetype.org>
* ftconfig.h, ftoption.h: Updated "ftconfig.h" to detect 64-bit int
* ftconfig.h, ftoption.h: Updated `ftconfig.h' to detect 64-bit int
types on platforms where Autoconf is not available). Also removed
FTCALC_USE_LONG_LONG and replaced it with
FT_CONFIG_OPTION_FORCE_INT64.
@ -7707,7 +7727,7 @@
2001-03-20 David Turner <david.turner@freetype.org>
* include/freetype/config/ftheader.h, include/freetype/ftsnames.h:
Renamed "ftnames.h" to "ftsnames.h", and FT_NAMES_H to
Renamed `ftnames.h' to `ftsnames.h', and FT_NAMES_H to
FT_SFNT_NAMES_H.
* docs/docmaker.py: Added generation of INDEX link in table of
@ -7717,8 +7737,8 @@
compilation process has changed slightly (no more `src' required in
the include path).
* builds/*/*-def.mk: Changed the objects directory from "obj" to
"objs".
* builds/*/*-def.mk: Changed the objects directory from `obj' to
`objs'.
* include/freetype/config/ftheader.h: Removed obsolete macros like
FT_SOURCE_FILE, etc. and added cache-specific macro definitions that
@ -7727,7 +7747,7 @@
* src/*/*: Removed the use of FT_SOURCE_FILE, etc. Now, each
component needs to add its own directory to the include path at
compile time. Modified all "rules.mk" and "descrip.mms"
compile time. Modified all `rules.mk' and `descrip.mms'
accordingly.
2001-03-20 Werner Lemberg <wl@gnu.org>
@ -7753,7 +7773,7 @@
compiler warnings in pedantic modes.
* include/config/ft2build.h, include/config/ftheader.h: The file
"ft2build.h" was renamed to "ftheader.h" to avoid conflicts with the
`ft2build.h' was renamed to `ftheader.h' to avoid conflicts with the
top-level <ft2build.h>.
* include/config/ftheader.h: Added new section describing the #include
@ -7775,7 +7795,7 @@
via FT_Get_Glyph_Name().
(cff_get_interface): Added support for getting a glyph name via the
"glyph_name" module interface. Uses the new function
`glyph_name' module interface. Uses the new function
get_cff_glyph_name().
Submitted by Sander van der Wal <svdwal@xs4all.nl>.
@ -7786,7 +7806,7 @@
Submitted by Sander van der Wal <svdwal@xs4all.nl>.
* src/cff/cffgload.c (CFF_Parse_CharStrings): Added support for
deprecated operator "dotsection".
deprecated operator `dotsection'.
Submitted by Sander van der Wal <svdwal@xs4all.nl>.
2001-03-12 Werner Lemberg <wl@gnu.org>
@ -7972,7 +7992,7 @@
2001-02-01 David Turner <david.turner@freetype.org>
* docs/docmaker.py: Improved the index sorting routine to place
capital letters before small ones. Added the "<order>" marker to
capital letters before small ones. Added the `<order>' marker to
section blocks in order to give the order of blocks.
2001-01-30 Antoine Leca <Antoine.Leca@renault.fr>
@ -8179,7 +8199,7 @@
* src/smooth/ftgrays.c (grays_convert_glyph): Implement it.
* INSTALL: Updated installation instructions on Win32, listing the
new "make setup list" target used to list supported
new `make setup list' target used to list supported
compilers/targets.
* src/raster/ftraster.c (ft_black_render): Test for unsupported
@ -8197,7 +8217,7 @@
* builds/win32/detect.mk: Added support for the Intel C/C++
compiler, as well as _preliminary_ (read: doesn't work!) support for
Watcom. Also added a new setup target. Type "make setup list" for
Watcom. Also added a new setup target. Type `make setup list' for
a list of supported command-line compilers on Win32.
* src/base/ftdebug.c: Added dummy symbol to avoid empty file if
@ -8298,16 +8318,16 @@
pointer).
* src/base/ftsystem.c (FT_Done_Memory): Fixed an obvious bug:
The ANSI "free()" function was called instead of "memory->free()".
The ANSI `free()' function was called instead of `memory->free()'.
* docs/docmaker.py: Added section filtering, multi-page generation
(index page generation is still missing though).
2000-12-04 David Turner <david.turner@freetype.org>
* builds/unix/install.mk, builds/unix/ft2unix.h: The file "ft2unix.h"
* builds/unix/install.mk, builds/unix/ft2unix.h: The file `ft2unix.h'
is now installed as <ft2build.h> for Unix systems. Note that we
still use the "freetype2/freetype" installation path for now.
still use the `freetype2/freetype' installation path for now.
* */*.[ch]: Now using <ft2build.h> as the default build and setup
configuration file in all public headers. Internal source files
@ -8319,7 +8339,7 @@
* builds/win32/detect.mk, builds/win32/w32-bccd.mk,
builds/win32/w32-dev.mk: Changed the developer build targets to
"devel-gcc" and "devel-bcc" in order to be able to develop with the
`devel-gcc' and `devel-bcc' in order to be able to develop with the
Borland C++ compiler.
2000-12-01 David Turner <david.turner@freetype.org>
@ -8331,7 +8351,7 @@
* builds/unix/configure.in, builds/unix/configure,
builds/cygwin/configure.in, builds/cygwin/configure: Setting
"version_info" to 6:1:0 for the 2.0.1 release.
`version_info' to 6:1:0 for the 2.0.1 release.
* CHANGES: Added a summary of changes between 2.0.1 and 2.0.
@ -8358,13 +8378,13 @@
2000-11-30 David Turner <david.turner@freetype.ogr>
* INSTALL: Slightly updated the quick starter documentation to
include IDE compilation, prevent against BSD Make, and specify "make
setup" instead of a single "make" for build configuration.
include IDE compilation, prevent against BSD Make, and specify `make
setup' instead of a single `make' for build configuration.
* include/config/ftbuild.h, include/internal/internal.h: Added new
configuration files used to determine the location of all public,
configuration, and internal header files for FreeType 2. Modified
all headers under "include/freetype" to reflect this change. Note
all headers under `include/freetype' to reflect this change. Note
that we still need to change the library source files themselves
though.
@ -8372,7 +8392,7 @@
builds/win32/w32-bcc.mk, builds/win32/w32-bccd.mk,
builds/win32/detect.mk: Added new files to support compilation with
the free Borland C++ command-line compiler. Modified the detection
rules to recognize the new "bcc32" target in "make setup bcc32".
rules to recognize the new `bcc32' target in `make setup bcc32'.
* src/sfnt/ttcmap.c, src/sfnt/ttpost.c, src/sfnt/ttsbit.c,
src/truetype/ttobjs.c, src/truetype/ttgload.c,

View File

@ -10,18 +10,18 @@ LATEST CHANGES BETWEEN 2.1.8 and 2.1.7
rounded, making them virtually unusable if not loaded with
FT_LOAD_LINEAR_DESIGN.
- Indexing CID-keyed CFF fonts is now working: The glyph index is
correctly treated as a CID, similar to FreeType's CID driver
- Indexing CID-keyed CFF fonts is now working: The glyph index is
correctly treated as a CID, similar to FreeType's CID driver
module. Note that CID CMaps support is still missing.
- The FT_FACE_FLAGS_GLYPH_NAMES is now set correctly for all font
formats.
- Some subsetted Type 1 fonts weren't parsed correctly. This bug
- Some subsetted Type 1 fonts weren't parsed correctly. This bug
has been introduced in 2.1.7.
- The WinFNT driver now correctly reports FT_ENCODING_NONE for all
but one encoding. Use the new FT_WinFNT_ID_XXX values together
but one encoding. Use the new FT_WinFNT_ID_XXX values together
with FT_Get_WinFNT_Header() to get the WinFNT charset ID.
@ -35,6 +35,70 @@ LATEST CHANGES BETWEEN 2.1.8 and 2.1.7
`tttables.h') is available to get the language ID of a
TrueType/SFNT cmap.
- The cache sub-system has been rewritten.
- There is now support for deinstallation of faces.
- A new API function `FTC_Manager_RemoveFaceID' has been added
to delete all `idle' nodes that correspond to a given
FTC_FaceID. All `locked' nodes (i.e., those with a reference
count > 0), will be modified to prevent them from appearing in
further lookups (they will be cleaned normally when their
reference count reaches 0).
- There is now support for point scaling (i.e., providing
character sizes in points + dpis, instead of pixels).
- Three abstract cache classes are now available:
FTC_GCache: Used to store one glyph item per cache node,
with the ability to group common attributes into
`families'. This replaces the old
FTC_GlyphCache class.
FTC_ICache: Used to store one FT_Glyph per cache node. This
extends FTC_GCache. Family definition, family
comparison, and glyph loading are however left
to sub-classes.
FTC_SCache: Used to store up to 16 small bitmaps per cache
node. This extends FTC_GCache. Family
definition, family comparison and glyph loading
are however left to sub-classes.
- The file `src/cache/ftcbasic.c' implements:
FTC_ImageCache: Extends FTC_ICache; implements family
definitions and glyph loading similar to the
old API.
FTC_SBitCache: Extends FTC_SCache, implements family
definitions and glyph loading similar to the
old API
Client applications should be able to extend FTC_GCache,
FTC_ICache, or FTC_SCache much more easily (i.e., less code to
write, and less callbacks). For example, one could envision
caches that are capable of storing transformed (obliqued),
stroked, emboldened, or colored glyph images. Use
`ftcbasic.c' as an example.
- All public APIs are now in `include/freetype/ftcache.h', (to
be accessed as `FT_CACHE_H'). The contents of
`include/freetype/cache/' is only needed by applications that
wish to implement their own caches.
- There were some major performance improvements through the use
of various programming tricks. Cache hits are up to 70%
faster than in the old code.
- The FTC_CMapCache has been simplied. Charmaps can only be
accessed by index right now. There is also a new API named
`FT_Charmap_GetIndex' for this purpose.
- The demo programs have been updated to the new code. The
previous versions will not work with the current one.
III. MISCELLANEOUS

View File

@ -4,7 +4,7 @@
/* */
/* FreeType internal cache interface (specification). */
/* */
/* Copyright 2000-2001, 2002 by */
/* Copyright 2000-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -30,6 +30,7 @@ FT_BEGIN_HEADER
/* handle to cache class */
typedef const struct FTC_CacheClassRec_* FTC_CacheClass;
/*************************************************************************/
/*************************************************************************/
/***** *****/
@ -68,6 +69,7 @@ FT_BEGIN_HEADER
#define FTC_NODE__NEXT(x) FTC_NODE( (x)->mru.next )
#define FTC_NODE__PREV(x) FTC_NODE( (x)->mru.prev )
/*************************************************************************/
/* */
/* These functions are exported so that they can be called from */
@ -81,7 +83,6 @@ FT_BEGIN_HEADER
FTC_Manager manager );
/*************************************************************************/
/*************************************************************************/
/***** *****/
@ -91,56 +92,63 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* initialize a new cache node */
typedef FT_Error (*FTC_Node_NewFunc)( FTC_Node *pnode,
FT_Pointer query,
FTC_Cache cache );
typedef FT_Error
(*FTC_Node_NewFunc)( FTC_Node *pnode,
FT_Pointer query,
FTC_Cache cache );
typedef FT_ULong (*FTC_Node_WeightFunc)( FTC_Node node,
FTC_Cache cache );
typedef FT_ULong
(*FTC_Node_WeightFunc)( FTC_Node node,
FTC_Cache cache );
/* compare a node to a given key pair */
typedef FT_Bool (*FTC_Node_CompareFunc)( FTC_Node node,
FT_Pointer key,
FTC_Cache cache );
typedef FT_Bool
(*FTC_Node_CompareFunc)( FTC_Node node,
FT_Pointer key,
FTC_Cache cache );
typedef void (*FTC_Node_FreeFunc)( FTC_Node node,
FTC_Cache cache );
typedef void
(*FTC_Node_FreeFunc)( FTC_Node node,
FTC_Cache cache );
typedef FT_Error (*FTC_Cache_InitFunc)( FTC_Cache cache );
typedef FT_Error
(*FTC_Cache_InitFunc)( FTC_Cache cache );
typedef void (*FTC_Cache_DoneFunc)( FTC_Cache cache );
typedef void
(*FTC_Cache_DoneFunc)( FTC_Cache cache );
typedef struct FTC_CacheClassRec_
typedef struct FTC_CacheClassRec_
{
FTC_Node_NewFunc node_new;
FTC_Node_WeightFunc node_weight;
FTC_Node_CompareFunc node_compare;
FTC_Node_CompareFunc node_remove_faceid;
FTC_Node_FreeFunc node_free;
FTC_Node_NewFunc node_new;
FTC_Node_WeightFunc node_weight;
FTC_Node_CompareFunc node_compare;
FTC_Node_CompareFunc node_remove_faceid;
FTC_Node_FreeFunc node_free;
FT_UInt cache_size;
FTC_Cache_InitFunc cache_init;
FTC_Cache_DoneFunc cache_done;
FT_UInt cache_size;
FTC_Cache_InitFunc cache_init;
FTC_Cache_DoneFunc cache_done;
} FTC_CacheClassRec;
/* each cache really implements a dynamic hash table to manage its nodes */
typedef struct FTC_CacheRec_
{
FT_UFast p;
FT_UFast mask;
FT_Long slack;
FTC_Node* buckets;
FT_UFast p;
FT_UFast mask;
FT_Long slack;
FTC_Node* buckets;
FTC_CacheClassRec clazz; /* local copy, for speed */
FTC_CacheClassRec clazz; /* local copy, for speed */
FTC_Manager manager;
FT_Memory memory;
FT_UInt index; /* in manager's table */
FTC_Manager manager;
FT_Memory memory;
FT_UInt index; /* in manager's table */
FTC_CacheClass org_class; /* original class pointer */
FTC_CacheClass org_class; /* original class pointer */
} FTC_CacheRec;
@ -149,19 +157,19 @@ FT_BEGIN_HEADER
#define FTC_CACHE_P( x ) ( (FTC_Cache*)(x) )
/* default cache initialize */
/* default cache initialize */
FT_EXPORT( FT_Error )
FTC_Cache_Init( FTC_Cache cache );
FTC_Cache_Init( FTC_Cache cache );
/* default cache finalizer */
/* default cache finalizer */
FT_EXPORT( void )
FTC_Cache_Done( FTC_Cache cache );
/* call this function to lookup the cache. if no corresponding
* node is found, a new one is automatically created. This function
* is capable of flushing the cache adequately to make room for the
* new cache object.
*/
/* Call this function to lookup the cache. If no corresponding
* node is found, a new one is automatically created. This function
* is capable of flushing the cache adequately to make room for the
* new cache object.
*/
FT_EXPORT( FT_Error )
FTC_Cache_Lookup( FTC_Cache cache,
FT_UInt32 hash,
@ -174,29 +182,30 @@ FT_BEGIN_HEADER
FT_Pointer query,
FTC_Node *anode );
/* remove all nodes that relate to a given face_id. This is useful
* when un-installing fonts. Note that if a cache node relates to
* the face_id, but is locked (i.e. has 'ref_count > 0'), the node
* will _not_ be destroyed, but its internal face_id reference will
* be modified.
*
* the end result will be that the node will never come back
* in further lookup requests, and will be flushed on demand from
* the cache normally when its reference count reaches 0
*/
/* Remove all nodes that relate to a given face_id. This is useful
* when un-installing fonts. Note that if a cache node relates to
* the face_id, but is locked (i.e., has 'ref_count > 0'), the node
* will _not_ be destroyed, but its internal face_id reference will
* be modified.
*
* The final result will be that the node will never come back
* in further lookup requests, and will be flushed on demand from
* the cache normally when its reference count reaches 0.
*/
FT_EXPORT( void )
FTC_Cache_RemoveFaceID( FTC_Cache cache,
FTC_FaceID face_id );
FTC_Cache_RemoveFaceID( FTC_Cache cache,
FTC_FaceID face_id );
#define FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error ) \
#define FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error ) \
FT_BEGIN_STMNT \
FTC_Node *_bucket, *_pnode, _node; \
FTC_Cache _cache = FTC_CACHE(cache); \
FT_UInt32 _hash = (FT_UInt32)(hash); \
FTC_Node *_bucket, *_pnode, _node; \
FTC_Cache _cache = FTC_CACHE(cache); \
FT_UInt32 _hash = (FT_UInt32)(hash); \
FTC_Node_CompareFunc _nodcomp = (FTC_Node_CompareFunc)(nodecmp); \
FT_UInt _idx; \
FT_UInt _idx; \
\
\
error = 0; \
_idx = _hash & _cache->mask; \
@ -208,7 +217,7 @@ FT_BEGIN_HEADER
{ \
_node = *_pnode; \
if ( _node == NULL ) \
goto _NewNode; \
goto _NewNode; \
\
if ( _node->hash == _hash && _nodcomp( _node, query, _cache ) ) \
break; \
@ -226,6 +235,7 @@ FT_BEGIN_HEADER
{ \
FTC_Manager _manager = _cache->manager; \
\
\
if ( _node != _manager->nodes_list ) \
FTC_MruNode_Up( (FTC_MruNode*)&_manager->nodes_list, \
(FTC_MruNode)_node ); \

View File

@ -19,51 +19,50 @@
/*
*
* FTC_GCache is an _abstract_ cache object optimized to store glyph
* data. It works as follows:
* data. It works as follows:
*
* - it manages FTC_GNode objects. Each one of them can hold one or more
* glyph "items". Item types are not specified in the FTC_GCache but in
* classes that extend it
* - It manages FTC_GNode objects. Each one of them can hold one or more
* glyph `items'. Item types are not specified in the FTC_GCache but
* in classes that extend it.
*
* - glyph attributes, like face_id, character size, render mode, etc..
* can be grouped in abstract "glyph families". This avoids storing
* - Glyph attributes, like face ID, character size, render mode, etc.,
* can be grouped into abstract `glyph families'. This avoids storing
* the attributes within the FTC_GCache, since it is likely that many
* FTC_GNodes will belong to the same family in typical uses
* FTC_GNodes will belong to the same family in typical uses.
*
* - each FTC_GNode is thus a FTC_Node with two additionnal fields:
* - Each FTC_GNode is thus an FTC_Node with two additional fields:
*
* * gindex :: a glyph index, or the first index in a glyph range
* * family :: a pointer to a glyph "family"
* * gindex: A glyph index, or the first index in a glyph range.
* * family: A pointer to a glyph `family'.
*
* - Family types are not fully specific in the FTC_Family type, but
* by classes that extend it.
*
* Note that both FTC_ImageCache and FTC_SBitCache extend FTC_GCache. They
* share an FTC_Family sub-class called FTC_BasicFamily which is used to
* store the following data: face_id, pixel/point sizes, load flags.
* for more details, see the file "src/cache/ftcbasic.c"
* Note that both FTC_ImageCache and FTC_SBitCache extend FTC_GCache.
* They share an FTC_Family sub-class called FTC_BasicFamily which is
* used to store the following data: face ID, pixel/point sizes, load
* flags. For more details see the file `src/cache/ftcbasic.c'.
*
* Client applications can extend FTC_GNode with their own FTC_GNode
* and FTC_Family sub-classes to implement more complex caches (e.g.
* handling automatic synthetis, like obliquing & emboldening, colored
* glyphs, etc...)
* and FTC_Family sub-classes to implement more complex caches (e.g.,
* handling automatic synthesis, like obliquing & emboldening, colored
* glyphs, etc.).
*
* See also the FTC_ICache & FTC_SCache classes in "ftcimage.h" and
* "ftcsbits.h", which both extend FTC_GCache with additionnal
* See also the FTC_ICache & FTC_SCache classes in `ftcimage.h' and
* `ftcsbits.h', which both extend FTC_GCache with additional
* optimizations.
*
* A typical FTC_GCache implementation must provide at least the
* following:
*
* a typical FTC_GCache implementation must provide at least the following:
* - FTC_GNode sub-class, e.g. MyNode, with relevant methods:
* my_node_new (must call FTC_GNode_Init)
* my_node_free (must call FTC_GNode_Done)
* my_node_compare (must call FTC_GNode_Compare)
* my_node_remove_faceid (must call ftc_gnode_unselect in case
* of match)
*
* - FTC_GNode sub-class, e.g. MyNode, with relevant methods, i.e:
* my_node_new ( must call FTC_GNode_Init )
* my_node_free ( must call FTC_GNode_Done )
* my_node_compare ( must call FTC_GNode_Compare )
* my_node_remove_faceid ( must call ftc_gnode_unselect in case
* of match )
*
*
* - FTC_Family sub-class, e.g. MyFamily, with relevant methods, e.g.:
* - FTC_Family sub-class, e.g. MyFamily, with relevant methods:
* my_family_compare
* my_family_init
* my_family_reset (optional)
@ -72,23 +71,24 @@
* - FTC_GQuery sub-class, e.g. MyQuery, to hold cache-specific query
* data.
*
* - provide constant structures for a FTC_GNodeClass
* - Constant structures for a FTC_GNodeClass.
*
* - MyCacheNew() can be implemented easily as a call to the convenience
* function FTC_GCache_New
* function FTC_GCache_New.
*
* - implement MyCacheLookup with a call to FTC_GCache_Lookup. This
* function will automatically:
* - MyCacheLookup with a call to FTC_GCache_Lookup. This function will
* automatically:
*
* - search for the corresponding family in the cache, or create
* a new one if necessary. put it in FTC_GQUERY(myquery).family
* - Search for the corresponding family in the cache, or create
* a new one if necessary. Put it in FTC_GQUERY(myquery).family
*
* - call FTC_Cache_Lookup
* - Call FTC_Cache_Lookup.
*
* if it returns NULL, you should create a new node, then call
* If it returns NULL, you should create a new node, then call
* ftc_cache_add as usual.
*/
/*************************************************************************/
/* */
/* Important: The functions defined in this file are only used to */
@ -125,16 +125,17 @@ FT_BEGIN_HEADER
/*
* we can group glyph in "families". Each family correspond to a
* given face id, character size, transform, etc...
* We can group glyphs into `families'. Each family correspond to a
* given face ID, character size, transform, etc.
*
* families are implemented as MRU list nodes. They are reference-counted
* Families are implemented as MRU list nodes. They are
* reference-counted.
*/
typedef struct FTC_FamilyRec_
{
FTC_MruNodeRec mrunode;
FT_UInt num_nodes; /* current number of nodes in this family */
FT_UInt num_nodes; /* current number of nodes in this family */
FTC_Cache cache;
FTC_MruListClass clazz;
@ -166,8 +167,6 @@ FT_BEGIN_HEADER
#define FTC_GQUERY( x ) ( (FTC_GQuery)(x) )
/*************************************************************************/
/* */
/* These functions are exported so that they can be called from */
@ -177,9 +176,9 @@ FT_BEGIN_HEADER
/* must be called by derived FTC_Node_InitFunc routines */
FT_EXPORT( void )
FTC_GNode_Init( FTC_GNode node,
FT_UInt gindex, /* glyph index for node */
FTC_Family family );
FTC_GNode_Init( FTC_GNode node,
FT_UInt gindex, /* glyph index for node */
FTC_Family family );
/* returns TRUE iff the query's glyph index correspond to the node; */
/* this assumes that the "family" and "hash" fields of the query are */
@ -188,17 +187,16 @@ FT_BEGIN_HEADER
FTC_GNode_Compare( FTC_GNode gnode,
FTC_GQuery gquery );
/* call this function to clear a node's family. this is necessary
* to implement the "node_remove_faceid" cache method correctly
*/
/* call this function to clear a node's family -- this is necessary */
/* to implement the `node_remove_faceid' cache method correctly */
FT_EXPORT( void )
FTC_GNode_UnselectFamily( FTC_GNode gnode,
FTC_Cache cache );
FTC_GNode_UnselectFamily( FTC_GNode gnode,
FTC_Cache cache );
/* must be called by derived FTC_Node_DoneFunc routines */
FT_EXPORT( void )
FTC_GNode_Done( FTC_GNode node,
FTC_Cache cache );
FTC_Cache cache );
FT_EXPORT( void )
@ -207,27 +205,26 @@ FT_BEGIN_HEADER
typedef struct FTC_GCacheRec_
{
FTC_CacheRec cache;
FTC_MruListRec families;
FTC_CacheRec cache;
FTC_MruListRec families;
} FTC_GCacheRec, *FTC_GCache;
#define FTC_GCACHE(x) ((FTC_GCache)(x))
#define FTC_GCACHE( x ) ((FTC_GCache)(x))
/* can be used as @FTC_Cache_InitFunc */
/* can be used as @FTC_Cache_InitFunc */
FT_EXPORT( FT_Error )
FTC_GCache_Init( FTC_GCache cache );
FTC_GCache_Init( FTC_GCache cache );
/* can be used as @FTC_Cache_DoneFunc */
/* can be used as @FTC_Cache_DoneFunc */
FT_EXPORT( void )
FTC_GCache_Done( FTC_GCache cache );
/* the glyph cache class adds fields for the family implementation */
typedef struct FTC_GCacheClassRec_
/* the glyph cache class adds fields for the family implementation */
typedef struct FTC_GCacheClassRec_
{
FTC_CacheClassRec clazz;
FTC_MruListClass family_class;
@ -236,13 +233,15 @@ FT_BEGIN_HEADER
typedef const FTC_GCacheClassRec* FTC_GCacheClass;
#define FTC_GCACHE_CLASS(x) ((FTC_GCacheClass)(x))
#define FTC_GCACHE_CLASS( x ) ((FTC_GCacheClass)(x))
#define FTC_CACHE__GCACHE_CLASS(x) FTC_GCACHE_CLASS( FTC_CACHE(x)->org_class )
#define FTC_CACHE__FAMILY_CLASS(x) ((FTC_MruListClass) FTC_CACHE__GCACHE_CLASS(x)->family_class)
#define FTC_CACHE__GCACHE_CLASS( x ) \
FTC_GCACHE_CLASS( FTC_CACHE(x)->org_class )
#define FTC_CACHE__FAMILY_CLASS( x ) \
((FTC_MruListClass) FTC_CACHE__GCACHE_CLASS(x)->family_class)
/* convenience function. use instead of FTC_Manager_Register_Cache */
/* convenience function; use it instead of FTC_Manager_Register_Cache */
FT_EXPORT( FT_Error )
FTC_GCache_New( FTC_Manager manager,
FTC_GCacheClass clazz,
@ -256,33 +255,35 @@ FT_BEGIN_HEADER
FTC_Node *anode );
#define FTC_GCACHE_LOOKUP_CMP( cache, famcmp, nodecmp, hash, gindex, query, node, error ) \
FT_BEGIN_STMNT \
FTC_GCache _gcache = FTC_GCACHE( cache ); \
FTC_Family _family; \
FTC_GQuery _gquery = (FTC_GQuery)( query ); \
FTC_MruNode_CompareFunc _fcompare = (FTC_MruNode_CompareFunc)(famcmp); \
\
_gquery->gindex = (gindex); \
\
FTC_MRULIST_LOOP( &_gcache->families, _family ) \
{ \
if ( _fcompare( (FTC_MruNode)_family, _gquery ) ) \
{ \
_gquery->family = _family; \
goto _FamilyFound; \
} \
} \
FTC_MRULIST_LOOP_END(); \
\
error = FTC_MruList_New( &_gcache->families, \
_gquery, \
(FTC_MruNode*)&_gquery->family ); \
if ( !error ) \
{ \
_FamilyFound: \
FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error ); \
} \
#define FTC_GCACHE_LOOKUP_CMP( cache, famcmp, nodecmp, hash, \
gindex, query, node, error ) \
FT_BEGIN_STMNT \
FTC_GCache _gcache = FTC_GCACHE( cache ); \
FTC_Family _family; \
FTC_GQuery _gquery = (FTC_GQuery)( query ); \
FTC_MruNode_CompareFunc _fcompare = (FTC_MruNode_CompareFunc)(famcmp); \
\
\
_gquery->gindex = (gindex); \
\
FTC_MRULIST_LOOP( &_gcache->families, _family ) \
{ \
if ( _fcompare( (FTC_MruNode)_family, _gquery ) ) \
{ \
_gquery->family = _family; \
goto _FamilyFound; \
} \
} \
FTC_MRULIST_LOOP_END(); \
\
error = FTC_MruList_New( &_gcache->families, \
_gquery, \
(FTC_MruNode*)&_gquery->family ); \
if ( !error ) \
{ \
_FamilyFound: \
FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error ); \
} \
FT_END_STMNT
/* */

View File

@ -20,11 +20,11 @@
* FTC_ICache is an _abstract_ cache used to store a single FT_Glyph
* image per cache node.
*
* FTC_ICache extends FTC_GCache. For an implementation example,
* see FTC_ImageCache in "src/cache/ftbasic.c"
*
* FTC_ICache extends FTC_GCache. For an implementation example,
* see FTC_ImageCache in `src/cache/ftbasic.c'.
*/
/*************************************************************************/
/* */
/* Each image cache really manages FT_Glyph objects. */
@ -55,12 +55,13 @@ FT_BEGIN_HEADER
#define FTC_INODE_GINDEX( x ) FTC_GNODE(x)->gindex
#define FTC_INODE_FAMILY( x ) FTC_GNODE(x)->family
typedef FT_Error (*FTC_IFamily_LoadGlyphFunc)( FTC_Family family,
FT_UInt gindex,
FTC_Cache cache,
FT_Glyph *aglyph );
typedef FT_Error
(*FTC_IFamily_LoadGlyphFunc)( FTC_Family family,
FT_UInt gindex,
FTC_Cache cache,
FT_Glyph *aglyph );
typedef struct FTC_IFamilyClassRec_
typedef struct FTC_IFamilyClassRec_
{
FTC_MruListClassRec clazz;
FTC_IFamily_LoadGlyphFunc family_load_glyph;
@ -69,26 +70,27 @@ FT_BEGIN_HEADER
typedef const FTC_IFamilyClassRec* FTC_IFamilyClass;
#define FTC_IFAMILY_CLASS(x) ((FTC_IFamilyClass)(x))
#define FTC_IFAMILY_CLASS( x ) ((FTC_IFamilyClass)(x))
#define FTC_CACHE__IFAMILY_CLASS(x) \
FTC_IFAMILY_CLASS( FTC_CACHE__GCACHE_CLASS(x)->family_class )
#define FTC_CACHE__IFAMILY_CLASS( x ) \
FTC_IFAMILY_CLASS( FTC_CACHE__GCACHE_CLASS(x)->family_class )
/* can be used as a @FTC_Node_FreeFunc */
/* can be used as a @FTC_Node_FreeFunc */
FT_EXPORT( void )
FTC_INode_Free( FTC_INode inode,
FTC_Cache cache );
/* can be used as @FTC_Node_NewFunc. "gquery.index" & "gquery.family" must
* be set correctly. this function will call the 'family_load_glyph' method
* to load the FT_Glyph into the cache node
*/
/* Can be used as @FTC_Node_NewFunc. `gquery.index' and `gquery.family'
* must be set correctly. This function will call the `family_load_glyph'
* method to load the FT_Glyph into the cache node.
*/
FT_EXPORT( FT_Error )
FTC_INode_New( FTC_INode *pinode,
FTC_GQuery gquery,
FTC_Cache cache );
/* can be used as @FTC_Node_WeightFunc */
/* can be used as @FTC_Node_WeightFunc */
FT_EXPORT( FT_ULong )
FTC_INode_Weight( FTC_INode inode );

View File

@ -4,7 +4,7 @@
/* */
/* FreeType Cache Manager (specification). */
/* */
/* Copyright 2000-2001 by */
/* Copyright 2000-2001, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -80,13 +80,14 @@ FT_BEGIN_HEADER
/*************************************************************************/
#define FTC_MAX_FACES_DEFAULT 2
#define FTC_MAX_SIZES_DEFAULT 4
#define FTC_MAX_BYTES_DEFAULT 200000L /* ~200kByte by default */
#define FTC_MAX_FACES_DEFAULT 2
#define FTC_MAX_SIZES_DEFAULT 4
#define FTC_MAX_BYTES_DEFAULT 200000L /* ~200kByte by default */
/* maximum number of caches registered in a single manager */
#define FTC_MAX_CACHES 16
typedef struct FTC_ManagerRec_
{
FT_Library library;
@ -97,7 +98,7 @@ FT_BEGIN_HEADER
FT_ULong cur_weight;
FT_UInt num_nodes;
FTC_Cache caches[ FTC_MAX_CACHES ];
FTC_Cache caches[FTC_MAX_CACHES];
FT_UInt num_caches;
FTC_MruListRec faces;
@ -134,12 +135,12 @@ FT_BEGIN_HEADER
FTC_Manager_Compress( FTC_Manager manager );
/* try to flush "count" old nodes from the cache. return the number
* of really flushed nodes
*/
/* try to flush `count' old nodes from the cache; return the number
* of really flushed nodes
*/
FT_EXPORT( FT_UInt )
FTC_Manager_FlushN( FTC_Manager manager,
FT_UInt count );
FT_UInt count );
/* this must be used internally for the moment */
@ -150,19 +151,19 @@ FT_BEGIN_HEADER
/* */
typedef struct FTC_ScalerRec_
typedef struct FTC_ScalerRec_
{
FTC_FaceID face_id;
FT_UInt width;
FT_UInt height;
FT_Int pixel;
FT_UInt x_res;
FT_UInt y_res;
FTC_FaceID face_id;
FT_UInt width;
FT_UInt height;
FT_Int pixel;
FT_UInt x_res;
FT_UInt y_res;
} FTC_ScalerRec, *FTC_Scaler;
#define FTC_SCALER_COMPARE(a,b) \
#define FTC_SCALER_COMPARE( a, b ) \
( (a)->face_id == (b)->face_id && \
(a)->width == (b)->width && \
(a)->height == (b)->height && \
@ -171,16 +172,16 @@ FT_BEGIN_HEADER
( (a)->x_res == (b)->x_res && \
(a)->y_res == (b)->y_res ) ) )
#define FTC_SCALER_HASH(q) \
( FTC_FACE_ID_HASH((q)->face_id) + \
#define FTC_SCALER_HASH( q ) \
( FTC_FACE_ID_HASH( (q)->face_id ) + \
(q)->width + (q)->height*7 + \
( (q)->pixel ? 0 : ( (q)->x_res*33 ^ (q)->y_res*61 ) ) )
FT_EXPORT( FT_Error )
FTC_Manager_LookupSize( FTC_Manager manager,
FTC_Scaler scaler,
FT_Size *asize );
FTC_Manager_LookupSize( FTC_Manager manager,
FTC_Scaler scaler,
FT_Size *asize );
/* */

View File

@ -58,15 +58,16 @@
FT_BEGIN_HEADER
typedef struct FTC_MruNodeRec_* FTC_MruNode;
typedef struct FTC_MruNodeRec_* FTC_MruNode;
typedef struct FTC_MruNodeRec_
typedef struct FTC_MruNodeRec_
{
FTC_MruNode next;
FTC_MruNode prev;
FTC_MruNode next;
FTC_MruNode prev;
} FTC_MruNodeRec;
FT_EXPORT( void )
FTC_MruNode_Prepend( FTC_MruNode *plist,
FTC_MruNode node );
@ -79,42 +80,49 @@ FT_BEGIN_HEADER
FTC_MruNode_Remove( FTC_MruNode *plist,
FTC_MruNode node );
typedef struct FTC_MruListRec_* FTC_MruList;
typedef struct FTC_MruListClassRec_ const * FTC_MruListClass;
typedef FT_Int (*FTC_MruNode_CompareFunc)( FTC_MruNode node,
FT_Pointer key );
typedef FT_Error (*FTC_MruNode_InitFunc)( FTC_MruNode node,
FT_Pointer key,
FT_Pointer data );
typedef FT_Int
(*FTC_MruNode_CompareFunc)( FTC_MruNode node,
FT_Pointer key );
typedef FT_Error (*FTC_MruNode_ResetFunc)( FTC_MruNode node,
FT_Pointer key,
FT_Pointer data );
typedef FT_Error
(*FTC_MruNode_InitFunc)( FTC_MruNode node,
FT_Pointer key,
FT_Pointer data );
typedef void (*FTC_MruNode_DoneFunc)( FTC_MruNode node,
FT_Pointer data );
typedef FT_Error
(*FTC_MruNode_ResetFunc)( FTC_MruNode node,
FT_Pointer key,
FT_Pointer data );
typedef struct FTC_MruListClassRec_
typedef void
(*FTC_MruNode_DoneFunc)( FTC_MruNode node,
FT_Pointer data );
typedef struct FTC_MruListClassRec_
{
FT_UInt node_size;
FTC_MruNode_CompareFunc node_compare;
FTC_MruNode_InitFunc node_init;
FTC_MruNode_ResetFunc node_reset;
FTC_MruNode_DoneFunc node_done;
FT_UInt node_size;
FTC_MruNode_CompareFunc node_compare;
FTC_MruNode_InitFunc node_init;
FTC_MruNode_ResetFunc node_reset;
FTC_MruNode_DoneFunc node_done;
} FTC_MruListClassRec;
typedef struct FTC_MruListRec_
typedef struct FTC_MruListRec_
{
FT_UInt num_nodes;
FT_UInt max_nodes;
FTC_MruNode nodes;
FT_Pointer data;
FTC_MruListClassRec clazz;
FT_Memory memory;
FT_UInt num_nodes;
FT_UInt max_nodes;
FTC_MruNode nodes;
FT_Pointer data;
FTC_MruListClassRec clazz;
FT_Memory memory;
} FTC_MruListRec;
@ -135,12 +143,12 @@ FT_BEGIN_HEADER
FT_EXPORT( FTC_MruNode )
FTC_MruList_Find( FTC_MruList list,
FT_Pointer key );
FT_Pointer key );
FT_EXPORT( FT_Error )
FTC_MruList_New( FTC_MruList list,
FT_Pointer key,
FTC_MruNode *anode );
FTC_MruList_New( FTC_MruList list,
FT_Pointer key,
FTC_MruNode *anode );
FT_EXPORT( FT_Error )
FTC_MruList_Lookup( FTC_MruList list,
@ -154,17 +162,18 @@ FT_BEGIN_HEADER
FT_EXPORT( void )
FTC_MruList_RemoveSelection( FTC_MruList list,
FTC_MruNode_CompareFunc select,
FTC_MruNode_CompareFunc selection,
FT_Pointer key );
#ifdef FTC_INLINE
#define FTC_MRULIST_LOOKUP( list, key, node, error ) \
#define FTC_MRULIST_LOOKUP( list, key, node, error ) \
FT_BEGIN_STMNT \
FTC_MruNode_CompareFunc _compare = (list)->clazz.node_compare; \
FTC_MruNode _first, _node; \
\
\
error = 0; \
_first = (list)->nodes; \
_node = NULL; \
@ -180,8 +189,8 @@ FT_BEGIN_HEADER
goto _Ok; \
} \
_node = _node->next; \
} \
while ( _node != _first) ; \
\
} while ( _node != _first) ; \
} \
\
error = FTC_MruList_New( (list), (key), (FTC_MruNode*)&(node) ); \
@ -191,28 +200,31 @@ FT_BEGIN_HEADER
#else /* !FTC_INLINE */
#define FTC_MRULIST_LOOKUP_CMP( list, key, node, error ) \
#define FTC_MRULIST_LOOKUP_CMP( list, key, node, error ) \
error = FTC_MruList_Lookup( (list), (key), (FTC_MruNode*)&(node) )
#endif /* !FTC_INLINE */
#define FTC_MRULIST_LOOP( list, node ) \
#define FTC_MRULIST_LOOP( list, node ) \
FT_BEGIN_STMNT \
FTC_MruNode _first = (list)->nodes; \
FTC_MruNode _first = (list)->nodes; \
\
\
if ( _first ) \
{ \
FTC_MruNode _node = _first; \
\
\
do \
{ \
*(FTC_MruNode*)&(node) = _node;
#define FTC_MRULIST_LOOP_END() \
#define FTC_MRULIST_LOOP_END() \
_node = _node->next; \
} \
while ( _node != _first ); \
\
} while ( _node != _first ); \
} \
FT_END_STMNT

View File

@ -4,7 +4,7 @@
/* */
/* A small-bitmap cache (specification). */
/* */
/* Copyright 2000-2001, 2002 by */
/* Copyright 2000-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -33,24 +33,26 @@ FT_BEGIN_HEADER
{
FTC_GNodeRec gnode;
FT_UInt count;
FTC_SBitRec sbits[ FTC_SBIT_ITEMS_PER_NODE ];
FTC_SBitRec sbits[FTC_SBIT_ITEMS_PER_NODE];
} FTC_SNodeRec, *FTC_SNode;
#define FTC_SNODE( x ) ( (FTC_SNode)( x ) )
#define FTC_SNODE_GINDEX( x ) FTC_GNODE(x)->gindex
#define FTC_SNODE_FAMILY( x ) FTC_GNODE(x)->family
#define FTC_SNODE( x ) ( (FTC_SNode)( x ) )
#define FTC_SNODE_GINDEX( x ) FTC_GNODE( x )->gindex
#define FTC_SNODE_FAMILY( x ) FTC_GNODE( x )->family
typedef FT_UInt (*FTC_SFamily_GetCountFunc)( FTC_Family family,
FTC_Manager manager );
typedef FT_UInt
(*FTC_SFamily_GetCountFunc)( FTC_Family family,
FTC_Manager manager );
typedef FT_Error (*FTC_SFamily_LoadGlyphFunc)( FTC_Family family,
FT_UInt gindex,
FTC_Manager manager,
FT_Face *aface );
typedef FT_Error
(*FTC_SFamily_LoadGlyphFunc)( FTC_Family family,
FT_UInt gindex,
FTC_Manager manager,
FT_Face *aface );
typedef struct FTC_SFamilyClassRec_
typedef struct FTC_SFamilyClassRec_
{
FTC_MruListClassRec clazz;
FTC_SFamily_GetCountFunc family_get_count;
@ -60,10 +62,11 @@ FT_BEGIN_HEADER
typedef const FTC_SFamilyClassRec* FTC_SFamilyClass;
#define FTC_SFAMILY_CLASS(x) ((FTC_SFamilyClass)(x))
#define FTC_SFAMILY_CLASS( x ) ((FTC_SFamilyClass)(x))
#define FTC_CACHE__SFAMILY_CLASS( x ) \
FTC_SFAMILY_CLASS( FTC_CACHE__GCACHE_CLASS( x )->family_class )
#define FTC_CACHE__SFAMILY_CLASS(x) \
FTC_SFAMILY_CLASS( FTC_CACHE__GCACHE_CLASS(x)->family_class )
FT_EXPORT( void )
FTC_SNode_Free( FTC_SNode snode,

View File

@ -4,7 +4,7 @@
/* */
/* Build macros of the FreeType 2 library. */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -433,10 +433,10 @@
/* see the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need */
/* to store small glyph bitmaps, as it will use less memory. */
/* */
/* this macro is *DEPRECATED*, simply include @FT_CACHE_H and you'll */
/* have all glyph image-related cache declarations */
/* This macro is deprecated. Simply include @FT_CACHE_H to have all */
/* glyph image-related cache declarations. */
/* */
#define FT_CACHE_IMAGE_H FT_CACHE_H
#define FT_CACHE_IMAGE_H FT_CACHE_H
/*************************************************************************/
@ -453,8 +453,8 @@
/* in @FT_CACHE_IMAGE_H if you want to cache arbitrary glyph images, */
/* including scalable outlines. */
/* */
/* this macro is *DEPRECATED*, simply include @FT_CACHE_H and you'll */
/* have all small bitmaps-related cache declarations */
/* This macro is deprecated. Simply include @FT_CACHE_H to have all */
/* small bitmaps-related cache declarations. */
/* */
#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H
@ -468,8 +468,8 @@
/* A macro used in #include statements to name the file containing */
/* the `charmap' API of the FreeType 2 cache sub-system. */
/* */
/* this macro is *DEPRECATED*, simply include @FT_CACHE_H and you'll */
/* have all charmap-based cache declarations */
/* This macro is deprecated. Simply include @FT_CACHE_H to have all */
/* charmap-based cache declarations. */
/* */
#define FT_CACHE_CHARMAP_H FT_CACHE_H
@ -517,30 +517,30 @@
/* */
#define FT_TRIGONOMETRY_H <freetype/fttrigon.h>
#define FT_STROKER_H <freetype/ftstroke.h>
#define FT_SYNTHESIS_H <freetype/ftsynth.h>
#define FT_ERROR_DEFINITIONS_H <freetype/fterrdef.h>
#define FT_TRIGONOMETRY_H <freetype/fttrigon.h>
#define FT_STROKER_H <freetype/ftstroke.h>
#define FT_SYNTHESIS_H <freetype/ftsynth.h>
#define FT_ERROR_DEFINITIONS_H <freetype/fterrdef.h>
#define FT_CACHE_MANAGER_H <freetype/cache/ftcmanag.h>
#define FT_CACHE_MANAGER_H <freetype/cache/ftcmanag.h>
#define FT_CACHE_INTERNAL_MRU_H <freetype/cache/ftcmru.h>
#define FT_CACHE_INTERNAL_MANAGER_H <freetype/cache/ftcmanag.h>
#define FT_CACHE_INTERNAL_CACHE_H <freetype/cache/ftccache.h>
#define FT_CACHE_INTERNAL_CACHE_H <freetype/cache/ftccache.h>
#define FT_CACHE_INTERNAL_GLYPH_H <freetype/cache/ftcglyph.h>
#define FT_CACHE_INTERNAL_IMAGE_H <freetype/cache/ftcimage.h>
#define FT_CACHE_INTERNAL_SBITS_H <freetype/cache/ftcsbits.h>
#define FT_XFREE86_H <freetype/ftxf86.h>
#define FT_XFREE86_H <freetype/ftxf86.h>
#define FT_INCREMENTAL_H <freetype/ftincrem.h>
#define FT_INCREMENTAL_H <freetype/ftincrem.h>
#define FT_TRUETYPE_UNPATENTED_H <freetype/ttunpat.h>
#define FT_TRUETYPE_UNPATENTED_H <freetype/ttunpat.h>
/* now include internal headers definitions from <freetype/internal/...> */
#define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h>
#define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h>
#include FT_INTERNAL_INTERNAL_H

View File

@ -63,7 +63,7 @@ FT_BEGIN_HEADER
/* FTC_Face_Requester */
/* */
/* FTC_Manager_New */
/* FTC_Manager_LookupFace */
/* FTC_Manager_LookupFace */
/* FTC_Manager_Lookup_Size */
/* */
/* FTC_Node */
@ -111,7 +111,7 @@ FT_BEGIN_HEADER
/* An opaque pointer type that is used to identity face objects. The */
/* contents of such objects is application-dependent. */
/* */
typedef struct FTC_FaceIDRec_* FTC_FaceID;
typedef struct FTC_FaceIDRec_* FTC_FaceID;
/*************************************************************************/
@ -319,7 +319,7 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Function> */
/* FTC_Manager_LookupFace */
/* FTC_Manager_LookupFace */
/* */
/* <Description> */
/* Retrieves the @FT_Face object that corresponds to a given face ID */
@ -350,8 +350,8 @@ FT_BEGIN_HEADER
/* */
FT_EXPORT( FT_Error )
FTC_Manager_LookupFace( FTC_Manager manager,
FTC_FaceID face_id,
FT_Face *aface );
FTC_FaceID face_id,
FT_Face *aface );
/*************************************************************************/
@ -374,10 +374,10 @@ FT_BEGIN_HEADER
FTC_Manager manager );
/* remove all nodes belonging to a given face_id */
/* remove all nodes belonging to a given face_id */
FT_EXPORT( void )
FTC_Manager_RemoveFaceID( FTC_Manager manager,
FTC_FaceID face_id );
FTC_FaceID face_id );
/*************************************************************************/
@ -405,7 +405,7 @@ FT_BEGIN_HEADER
/* FTC_CMapCache_New */
/* */
/* @description: */
/* Creates a new charmap cache. */
/* Create a new charmap cache. */
/* */
/* @input: */
/* manager :: A handle to the cache manager. */
@ -425,31 +425,31 @@ FT_BEGIN_HEADER
FTC_CMapCache *acache );
/* retrieve the index of a given charmap
*/
/* retrieve the index of a given charmap */
FT_EXPORT( FT_Int )
FT_Get_CharMap_Index( FT_CharMap charmap );
/*************************************************************************/
/* */
/* @function: */
/* FTC_CMapCache_Lookup */
/* */
/* @description: */
/* Translates a character code into a glyph index, using the charmap */
/* Translate a character code into a glyph index, using the charmap */
/* cache. */
/* */
/* @input: */
/* cache :: A charmap cache handle. */
/* cache :: A charmap cache handle. */
/* */
/* face_id :: source face id */
/* */
/* cmap_index :: index of charmap in source face */
/* */
/* char_code :: The character code (in the corresponding charmap). */
/* char_code :: The character code (in the corresponding charmap). */
/* */
/* @return: */
/* Glyph index. 0 means "no glyph". */
/* Glyph index. 0 means `no glyph'. */
/* */
FT_EXPORT( FT_UInt )
FTC_CMapCache_Lookup( FTC_CMapCache cache,
@ -463,7 +463,7 @@ FT_BEGIN_HEADER
/* <Section> */
/* cache_subsystem */
/* */
/**********************************************************************/
/*************************************************************************/
/*************************************************************************/
@ -564,13 +564,13 @@ FT_BEGIN_HEADER
/* Never try to transform or discard it manually! You can however */
/* create a copy with @FT_Glyph_Copy and modify the new one. */
/* */
/* If "anode" is _not_ NULL, it receives the address of the cache */
/* If `anode' is _not_ NULL, it receives the address of the cache */
/* node containing the glyph image, after increasing its reference */
/* count. This ensures that the node (as well as the FT_Glyph) will */
/* always be kept in the cache until you call @FTC_Node_Unref to */
/* "release" it. */
/* `release' it. */
/* */
/* If "anode" is NULL, the cache node is left unchanged, which means */
/* If `anode' is NULL, the cache node is left unchanged, which means */
/* that the FT_Glyph could be flushed out of the cache on the next */
/* call to one of the caching sub-system APIs. Don't assume that it */
/* is persistent! */
@ -582,13 +582,6 @@ FT_BEGIN_HEADER
FT_Glyph *aglyph,
FTC_Node *anode );
/*************************************************************************/
/* */
/* <Section> */
/* cache_subsystem */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
@ -635,7 +628,7 @@ FT_BEGIN_HEADER
/* */
/* yadvance :: The vertical advance height in pixels. */
/* */
/* buffer :: A pointer to the bitmap pixels. */
/* buffer :: A pointer to the bitmap pixels. */
/* */
typedef struct FTC_SBitRec_
{
@ -698,7 +691,7 @@ FT_BEGIN_HEADER
/* */
/* <Description> */
/* Looks up a given small glyph bitmap in a given sbit cache and */
/* "lock" it to prevent its flushing from the cache until needed */
/* `lock' it to prevent its flushing from the cache until needed. */
/* */
/* <Input> */
/* cache :: A handle to the source sbit cache. */
@ -726,12 +719,12 @@ FT_BEGIN_HEADER
/* The descriptor's `buffer' field is set to 0 to indicate a missing */
/* glyph bitmap. */
/* */
/* If "anode" is _not_ NULL, it receives the address of the cache */
/* If `anode' is _not_ NULL, it receives the address of the cache */
/* node containing the bitmap, after increasing its reference count. */
/* This ensures that the node (as well as the image) will always be */
/* kept in the cache until you call @FTC_Node_Unref to "release" it. */
/* kept in the cache until you call @FTC_Node_Unref to `release' it. */
/* */
/* If "anode" is NULL, the cache node is left unchanged, which means */
/* If `anode' is NULL, the cache node is left unchanged, which means */
/* that the bitmap could be flushed out of the cache on the next */
/* call to one of the caching sub-system APIs. Don't assume that it */
/* is persistent! */

View File

@ -24,39 +24,41 @@
FT_BEGIN_HEADER
/*@*************************************************************
*
* @type: FT_Stroker
*
* @description:
* opaque handler to a path stroker object
*/
typedef struct FT_StrokerRec_* FT_Stroker;
/*@*************************************************************
*
* @type:
* FT_Stroker
*
* @description:
* Opaque handler to a path stroker object.
*/
typedef struct FT_StrokerRec_* FT_Stroker;
/*@*************************************************************
*
* @enum: FT_Stroker_LineJoin
*
* @description:
* these values determine how two joining lines are rendered
* in a stroker.
*
* @values:
* FT_STROKER_LINEJOIN_ROUND ::
* used to render rounded line joins. circular arcs are used
* to join two lines smoothly
*
* FT_STROKER_LINEJOIN_BEVEL ::
* used to render beveled line joins; i.e. the two joining lines
* are extended until they intersect
*
* FT_STROKER_LINEJOIN_MITER ::
* same as beveled rendering, except that an additional line
* break is added if the angle between the two joining lines
* is too closed (this is useful to avoid unpleasant spikes
* in beveled rendering).
*/
/*@*************************************************************
*
* @enum:
* FT_Stroker_LineJoin
*
* @description:
* These values determine how two joining lines are rendered
* in a stroker.
*
* @values:
* FT_STROKER_LINEJOIN_ROUND ::
* Used to render rounded line joins. Circular arcs are used
* to join two lines smoothly.
*
* FT_STROKER_LINEJOIN_BEVEL ::
* Used to render beveled line joins; i.e., the two joining lines
* are extended until they intersect.
*
* FT_STROKER_LINEJOIN_MITER ::
* Same as beveled rendering, except that an additional line
* break is added if the angle between the two joining lines
* is too closed (this is useful to avoid unpleasant spikes
* in beveled rendering).
*/
typedef enum
{
FT_STROKER_LINEJOIN_ROUND = 0,
@ -66,27 +68,28 @@ FT_BEGIN_HEADER
} FT_Stroker_LineJoin;
/*@*************************************************************
*
* @enum: FT_Stroker_LineCap
*
* @description:
* these values determine how the end of opened sub-paths are
* rendered in a stroke
*
* @values:
* FT_STROKER_LINECAP_BUTT ::
* the end of lines is rendered as a full stop on the last
* point itself
*
* FT_STROKER_LINECAP_ROUND ::
* the end of lines is rendered as a half-circle around the
* last point
*
* FT_STROKER_LINECAP_SQUARE ::
* the end of lines is rendered as a square around the
* last point
*/
/*@*************************************************************
*
* @enum:
* FT_Stroker_LineCap
*
* @description:
* These values determine how the end of opened sub-paths are
* rendered in a stroke.
*
* @values:
* FT_STROKER_LINECAP_BUTT ::
* The end of lines is rendered as a full stop on the last
* point itself.
*
* FT_STROKER_LINECAP_ROUND ::
* The end of lines is rendered as a half-circle around the
* last point.
*
* FT_STROKER_LINECAP_SQUARE ::
* The end of lines is rendered as a square around the
* last point.
*/
typedef enum
{
FT_STROKER_LINECAP_BUTT = 0,
@ -96,30 +99,31 @@ FT_BEGIN_HEADER
} FT_Stroker_LineCap;
/**************************************************************
*
* @enum: FT_StrokerBorder
*
* @description:
* theses values are used to select a given stroke border
* in @FT_Stroker_GetBorderCounts and @FT_Stroker_ExportBorder
*
* @values:
* FT_STROKER_BORDER_LEFT ::
* select the left border, relative to the drawing direction
*
* FT_STROKER_BORDER_RIGHT ::
* select the right border, relative to the drawing direction
*
* @note:
* applications are generally interested in the "inside" and "outside"
* borders. However, there is no direct mapping between these and
* the "left" / "right" ones, since this really depends on the glyph's
* drawing orientation, which varies between font formats
*
* you can however use @FT_Outline_GetInsideBorder and
* @FT_Outline_GetOutsideBorder to get these.
*/
/**************************************************************
*
* @enum:
* FT_StrokerBorder
*
* @description:
* These values are used to select a given stroke border
* in @FT_Stroker_GetBorderCounts and @FT_Stroker_ExportBorder.
*
* @values:
* FT_STROKER_BORDER_LEFT ::
* Select the left border, relative to the drawing direction.
*
* FT_STROKER_BORDER_RIGHT ::
* Select the right border, relative to the drawing direction.
*
* @note:
* Applications are generally interested in the `inside' and `outside'
* borders. However, there is no direct mapping between these and
* the `left' / `right' ones, since this really depends on the glyph's
* drawing orientation, which varies between font formats.
*
* You can however use @FT_Outline_GetInsideBorder and
* @FT_Outline_GetOutsideBorder to get these.
*/
typedef enum
{
FT_STROKER_BORDER_LEFT = 0,
@ -128,80 +132,100 @@ FT_BEGIN_HEADER
} FT_StrokerBorder;
/**************************************************************
*
* @function: FT_Outline_GetInsideBorder
*
* @description:
* retrieve the @FT_StrokerBorder value corresponding to the
* "inside" borders of a given outline
*
* @input:
* outline :: source outline handle
*
* @return:
* border index. @FT_STROKER_BORDER_LEFT for empty or invalid outlines
*/
/**************************************************************
*
* @function:
* FT_Outline_GetInsideBorder
*
* @description:
* Retrieve the @FT_StrokerBorder value corresponding to the
* `inside' borders of a given outline.
*
* @input:
* outline ::
* The source outline handle.
*
* @return:
* The border index. @FT_STROKER_BORDER_LEFT for empty or invalid
* outlines.
*/
FT_EXPORT( FT_StrokerBorder )
FT_Outline_GetInsideBorder( FT_Outline* outline );
/**************************************************************
*
* @function: FT_Outline_GetOutsideBorder
*
* @description:
* retrieve the @FT_StrokerBorder value corresponding to the
* "outside" borders of a given outline
*
* @input:
* outline :: source outline handle
*
* @return:
* border index. @FT_STROKER_BORDER_LEFT for empty or invalid outlines
*/
/**************************************************************
*
* @function:
* FT_Outline_GetOutsideBorder
*
* @description:
* Retrieve the @FT_StrokerBorder value corresponding to the
* `outside' borders of a given outline.
*
* @input:
* outline ::
* The source outline handle.
*
* @return:
* The border index. @FT_STROKER_BORDER_LEFT for empty or invalid
* outlines.
*/
FT_EXPORT( FT_StrokerBorder )
FT_Outline_GetOutsideBorder( FT_Outline* outline );
/**************************************************************
*
* @function: FT_Stroker_New
*
* @description:
* create a new stroker object
*
* @input:
* memory :: memory manager handle
*
* @output:
* new stroker object handle, NULL in case of error
*
* @return:
* error code. 0 means success
*/
/**************************************************************
*
* @function:
* FT_Stroker_New
*
* @description:
* Create a new stroker object.
*
* @input:
* memory ::
* The memory manager handle.
*
* @output:
* A new stroker object handle. NULL in case of error.
*
* @return:
* FreeType error code. 0 means success.
*/
FT_EXPORT( FT_Error )
FT_Stroker_New( FT_Memory memory,
FT_Stroker *astroker );
/**************************************************************
*
* @function: FT_Stroker_Set
*
* @description:
* reset a stroker object's attributes
*
* @input:
* stroker :: target stroker handle
* radius :: border radius
* line_cap :: line cap style
* line_join :: line join style
* miter_limit :: miter limit for the FT_STROKER_LINEJOIN_MITER style,
* expressed as 16.16 fixed point value.
* @note:
* the radius is expressed in the same units that the outline coordinates.
*/
/**************************************************************
*
* @function:
* FT_Stroker_Set
*
* @description:
* Reset a stroker object's attributes.
*
* @input:
* stroker ::
* The target stroker handle.
*
* radius ::
* The border radius.
*
* line_cap ::
* The line cap style.
*
* line_join ::
* The line join style.
*
* miter_limit ::
* The miter limit for the FT_STROKER_LINEJOIN_MITER style,
* expressed as 16.16 fixed point value.
*
* @note:
* The radius is expressed in the same units that the outline
* coordinates.
*/
FT_EXPORT( void )
FT_Stroker_Set( FT_Stroker stroker,
FT_Fixed radius,
@ -210,152 +234,187 @@ FT_BEGIN_HEADER
FT_Fixed miter_limit );
/**************************************************************
*
* @function: FT_Stroker_ParseOutline
*
* @description:
* a convenient function used to parse a whole outline with
* the stroker. The resulting outline(s) can be retrieved
* later by functions like @FT_Stroker_GetCounts and @FT_Stroker_Export
*
* @input:
* stroker :: target stroker handle
* outline :: source outline
* opened :: boolean. if TRUE, the outline is treated as an open path,
* instead of a closed one
*
* @return:*
* error code. 0 means success
*
* @note:
* if 'opened' is 0 (the default), the outline is treated as a closed path,
* and the stroker will generate two distinct "border" outlines
*
* if 'opened' is 1, the outline is processed as an open path, and the
* stroker will generate a single "stroke" outline
*/
/**************************************************************
*
* @function:
* FT_Stroker_ParseOutline
*
* @description:
* A convenience function used to parse a whole outline with
* the stroker. The resulting outline(s) can be retrieved
* later by functions like @FT_Stroker_GetCounts and @FT_Stroker_Export.
*
* @input:
* stroker ::
* The target stroker handle.
*
* outline ::
* The source outline.
*
* opened ::
* A boolean. If TRUE, the outline is treated as an open path
* instead of a closed one.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* If `opened' is 0 (the default), the outline is treated as a closed
* path, and the stroker will generate two distinct `border' outlines.
*
* If `opened' is 1, the outline is processed as an open path, and the
* stroker will generate a single `stroke' outline.
*/
FT_EXPORT( FT_Error )
FT_Stroker_ParseOutline( FT_Stroker stroker,
FT_Outline* outline,
FT_Bool opened );
/**************************************************************
*
* @function: FT_Stroker_BeginSubPath
*
* @description:
* start a new sub-path in the stroker
*
* @input:
* stroker :: target stroker handle
* to :: pointer to start vector
* open :: boolean. if TRUE, the sub-path is treated as an open
* one
*
* @return:*
* error code. 0 means success
*
* @note:
* this function is useful when you need to stroke a path that is
* not stored as a @FT_Outline object
*/
/**************************************************************
*
* @function:
* FT_Stroker_BeginSubPath
*
* @description:
* Start a new sub-path in the stroker.
*
* @input:
* stroker ::
* The target stroker handle.
*
* to ::
* A pointer to the start vector.
*
* open ::
* A boolean. If TRUE, the sub-path is treated as an open one.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* This function is useful when you need to stroke a path that is
* not stored as a @FT_Outline object.
*/
FT_EXPORT( FT_Error )
FT_Stroker_BeginSubPath( FT_Stroker stroker,
FT_Vector* to,
FT_Bool open );
/**************************************************************
*
* @function: FT_Stroker_EndSubPath
*
* @description:
* close the current sub-path in the stroker
*
* @input:
* stroker :: target stroker handle
*
* @return:
* error code. 0 means success
*
* @note:
* you should call this function after @FT_Stroker_BeginSubPath.
* if the subpath was not "opened", this function will "draw" a
* single line segment to the start position when needed.
*/
/**************************************************************
*
* @function:
* FT_Stroker_EndSubPath
*
* @description:
* Close the current sub-path in the stroker.
*
* @input:
* stroker ::
* The target stroker handle.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* You should call this function after @FT_Stroker_BeginSubPath.
* If the subpath was not `opened', this function will `draw' a
* single line segment to the start position when needed.
*/
FT_EXPORT( FT_Error )
FT_Stroker_EndSubPath( FT_Stroker stroker );
/**************************************************************
*
* @function: FT_Stroker_LineTo
*
* @description:
* "draw" a single line segment in the stroker's current sub-path,
* from the last position
*
* @input:
* stroker :: target stroker handle
* to :: pointer to destination point
*
* @return:
* error code. 0 means success
*
* @note:
* you should call this function between @FT_Stroker_BeginSubPath and
* @FT_Stroker_EndSubPath
*/
/**************************************************************
*
* @function:
* FT_Stroker_LineTo
*
* @description:
* `Draw' a single line segment in the stroker's current sub-path,
* from the last position.
*
* @input:
* stroker ::
* The target stroker handle.
*
* to ::
* A pointer to the destination point.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* You should call this function between @FT_Stroker_BeginSubPath and
* @FT_Stroker_EndSubPath.
*/
FT_EXPORT( FT_Error )
FT_Stroker_LineTo( FT_Stroker stroker,
FT_Vector* to );
/**************************************************************
*
* @function: FT_Stroker_ConicTo
*
* @description:
* "draw" a single quadratic bezier in the stroker's current sub-path,
* from the last position
*
* @input:
* stroker :: target stroker handle
* control :: pointer to bezier control point
* to :: pointer to destination point
*
* @return:
* error code. 0 means success
*
* @note:
* you should call this function between @FT_Stroker_BeginSubPath and
* @FT_Stroker_EndSubPath
*/
/**************************************************************
*
* @function:
* FT_Stroker_ConicTo
*
* @description:
* `Draw; a single quadratic bezier in the stroker's current sub-path,
* from the last position.
*
* @input:
* stroker ::
* The target stroker handle.
*
* control ::
* A pointer to a Bézier control point.
*
* to ::
* A pointer to the destination point.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* You should call this function between @FT_Stroker_BeginSubPath and
* @FT_Stroker_EndSubPath.
*/
FT_EXPORT( FT_Error )
FT_Stroker_ConicTo( FT_Stroker stroker,
FT_Vector* control,
FT_Vector* to );
/**************************************************************
*
* @function: FT_Stroker_CubicTo
*
* @description:
* "draw" a single cubic bezier in the stroker's current sub-path,
* from the last position
*
* @input:
* stroker :: target stroker handle
* control1 :: pointer to first bezier control point
* control2 :: pointer to second bezier control point
* to :: pointer to destination point
*
* @return:
* error code. 0 means success
*
* @note:
* you should call this function between @FT_Stroker_BeginSubPath and
* @FT_Stroker_EndSubPath
*/
/**************************************************************
*
* @function:
* FT_Stroker_CubicTo
*
* @description:
* `Draw' a single cubic Bézier in the stroker's current sub-path,
* from the last position.
*
* @input:
* stroker ::
* The target stroker handle.
*
* control1 ::
* A pointer to the first Bézier control point.
*
* control2 ::
* A pointer to second Bézier control point.
*
* to ::
* A pointer to the destination point.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* You should call this function between @FT_Stroker_BeginSubPath and
* @FT_Stroker_EndSubPath.
*/
FT_EXPORT( FT_Error )
FT_Stroker_CubicTo( FT_Stroker stroker,
FT_Vector* control1,
@ -363,162 +422,165 @@ FT_BEGIN_HEADER
FT_Vector* to );
/**************************************************************
*
* @function: FT_Stroker_GetBorderCounts
*
* @description:
* call this function once you finished parsing your paths
* with the stroker. It will return the number of points and
* contours necessary to export one of the "border" or "stroke"
* outlines generated by the stroker.
*
* @input:
* stroker :: target stroker handle
* border :: border index
*
* @output:
* anum_points :: number of points
* anum_contours :: number of contours
*
* @return:
* error code. 0 means success
*
* @note:
* when an outline, or a sub-path, is "closed", the stroker generates
* two independent 'border' outlines, named 'left' and 'right'
*
* when the outline, or a sub-path, is "opened", the stroker merges
* the 'border' outlines with caps. The 'left' border receives all
* points, while the 'right' border becomes empty.
*
* use the function @FT_Stroker_GetCounts instead if you want to
* retrieve the counts associated to both borders.
*/
/**************************************************************
*
* @function:
* FT_Stroker_GetBorderCounts
*
* @description:
* Vall this function once you have finished parsing your paths
* with the stroker. It will return the number of points and
* contours necessary to export one of the `border' or `stroke'
* outlines generated by the stroker.
*
* @input:
* stroker ::
* The target stroker handle.
*
* border ::
* The border index.
*
* @output:
* anum_points ::
* The number of points.
*
* anum_contours ::
* The number of contours.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* When an outline, or a sub-path, is `closed', the stroker generates
* two independent `border' outlines, named `left' and `right'.
*
* When the outline, or a sub-path, is `opened', the stroker merges
* the `border' outlines with caps. The `left' border receives all
* points, while the `right' border becomes empty.
*
* Use the function @FT_Stroker_GetCounts instead if you want to
* retrieve the counts associated to both borders.
*/
FT_EXPORT( FT_Error )
FT_Stroker_GetBorderCounts( FT_Stroker stroker,
FT_StrokerBorder border,
FT_UInt *anum_points,
FT_UInt *anum_contours );
/**************************************************************
*
* @function: FT_Stroker_ExportBorder
*
* @description:
* call this function after @FT_Stroker_GetBorderCounts to
* export the corresponding border to your own @FT_Outline
* structure.
*
* note that this function will append the border points and
* contours to your outline, but will not try to resize its
* arrays.
*
* @input:
* stroker :: target stroker handle
* border :: border index
* outline :: target outline handle
*
* @return:
* error code. 0 means success
*
* @note:
* always call this function after @FT_Stroker_GetBorderCounts to
* get sure that there is enough room in your @FT_Outline object to
* receive all new data.
*
* when an outline, or a sub-path, is "closed", the stroker generates
* two independent 'border' outlines, named 'left' and 'right'
*
* when the outline, or a sub-path, is "opened", the stroker merges
* the 'border' outlines with caps. The 'left' border receives all
* points, while the 'right' border becomes empty.
*
* use the function @FT_Stroker_Export instead if you want to
* retrieve all borders at once
*/
/**************************************************************
*
* @function:
* FT_Stroker_ExportBorder
*
* @description:
* Call this function after @FT_Stroker_GetBorderCounts to
* export the corresponding border to your own @FT_Outline
* structure.
*
* Note that this function will append the border points and
* contours to your outline, but will not try to resize its
* arrays.
*
* @input:
* stroker ::
* The target stroker handle.
*
* border ::
* The border index.
*
* outline ::
* The target outline handle.
*
* @note:
* Always call this function after @FT_Stroker_GetBorderCounts to
* get sure that there is enough room in your @FT_Outline object to
* receive all new data.
*
* When an outline, or a sub-path, is `closed', the stroker generates
* two independent `border' outlines, named `left' and `right'
*
* When the outline, or a sub-path, is `opened', the stroker merges
* the `border' outlines with caps. The `left' border receives all
* points, while the `right' border becomes empty.
*
* Use the function @FT_Stroker_Export instead if you want to
* retrieve all borders at once.
*/
FT_EXPORT( void )
FT_Stroker_ExportBorder( FT_Stroker stroker,
FT_StrokerBorder border,
FT_Outline* outline );
/**************************************************************
*
* @function: FT_Stroker_GetCounts
*
* @description:
* call this function once you finished parsing your paths
* with the stroker. It will return the number of points and
* contours necessary to export all points/borders from the stroked
* outline/path.
*
* @input:
* stroker :: target stroker handle
*
* @output:
* anum_points :: number of points
* anum_contours :: number of contours
*
* @return:
* error code. 0 means success
*
* @note:
*/
/**************************************************************
*
* @function:
* FT_Stroker_GetCounts
*
* @description:
* Call this function once you have finished parsing your paths
* with the stroker. It returns the number of points and
* contours necessary to export all points/borders from the stroked
* outline/path.
*
* @input:
* stroker ::
* The target stroker handle.
*
* @output:
* anum_points ::
* The number of points.
*
* anum_contours ::
* The number of contours.
*
* @return:
* FreeType error code. 0 means success.
*/
FT_EXPORT( FT_Error )
FT_Stroker_GetCounts( FT_Stroker stroker,
FT_UInt *anum_points,
FT_UInt *anum_contours );
/**************************************************************
*
* @function: FT_Stroker_ExportBorder
*
* @description:
* call this function after @FT_Stroker_GetBorderCounts to
* export the corresponding border to your own @FT_Outline
* structure.
*
* note that this function will append the border points and
* contours to your outline, but will not try to resize its
* arrays.
*
* @input:
* stroker :: target stroker handle
* border :: border index
* outline :: target outline handle
*
* @return:
* error code. 0 means success
*
* @note:
* always call this function after @FT_Stroker_GetBorderCounts to
* get sure that there is enough room in your @FT_Outline object to
* receive all new data.
*
* when an outline, or a sub-path, is "closed", the stroker generates
* two independent 'border' outlines, named 'left' and 'right'
*
* when the outline, or a sub-path, is "opened", the stroker merges
* the 'border' outlines with caps. The 'left' border receives all
* points, while the 'right' border becomes empty.
*
* use the function @FT_Stroker_Export instead if you want to
* retrieve all borders at once
*/
/**************************************************************
*
* @function:
* FT_Stroker_Export
*
* @description:
* Call this function after @FT_Stroker_GetBorderCounts to
* export the all borders to your own @FT_Outline structure.
*
* Note that this function will append the border points and
* contours to your outline, but will not try to resize its
* arrays.
*
* @input:
* stroker ::
* The target stroker handle.
*
* outline ::
* The target outline handle.
*/
FT_EXPORT( void )
FT_Stroker_Export( FT_Stroker stroker,
FT_Outline* outline );
/**************************************************************
*
* @function: FT_Stroker_Done
*
* @description:
* destroy a stroker object
*
* @input:
* stroker :: stroker handle. can be NULL
*/
/**************************************************************
*
* @function:
* FT_Stroker_Done
*
* @description:
* Destroy a stroker object.
*
* @input:
* stroker ::
* A stroker handle. Can be NULL.
*/
FT_EXPORT( void )
FT_Stroker_Done( FT_Stroker stroker );

View File

@ -4,7 +4,7 @@
/* */
/* The FreeType glyph loader (body). */
/* */
/* Copyright 2002 by */
/* Copyright 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -19,6 +19,7 @@
#include <ft2build.h>
#include FT_INTERNAL_GLYPH_LOADER_H
#include FT_INTERNAL_MEMORY_H
#include FT_INTERNAL_OBJECTS_H
#undef FT_COMPONENT
#define FT_COMPONENT trace_gloader

View File

@ -27,20 +27,22 @@
FT_EXPORT_DEF( FT_StrokerBorder )
FT_Outline_GetInsideBorder( FT_Outline* outline )
{
FT_Orientation or = FT_Outline_Get_Orientation( outline );
FT_Orientation o = FT_Outline_Get_Orientation( outline );
return ( or == FT_ORIENTATION_TRUETYPE ) ? FT_STROKER_BORDER_RIGHT
: FT_STROKER_BORDER_LEFT ;
return o == FT_ORIENTATION_TRUETYPE ? FT_STROKER_BORDER_RIGHT
: FT_STROKER_BORDER_LEFT ;
}
FT_EXPORT_DEF( FT_StrokerBorder )
FT_Outline_GetOutsideBorder( FT_Outline* outline )
{
FT_Orientation or = FT_Outline_Get_Orientation( outline );
FT_Orientation o = FT_Outline_Get_Orientation( outline );
return ( or == FT_ORIENTATION_TRUETYPE ) ? FT_STROKER_BORDER_RIGHT
: FT_STROKER_BORDER_LEFT ;
return o == FT_ORIENTATION_TRUETYPE ? FT_STROKER_BORDER_RIGHT
: FT_STROKER_BORDER_LEFT ;
}
@ -1457,6 +1459,7 @@
FT_UInt num_points = 0, num_contours = 0;
FT_Error error;
if ( !stroker || border > 1 )
{
error = FT_Err_Invalid_Argument;
@ -1509,13 +1512,14 @@
FT_EXPORT_DEF( void )
FT_Stroker_ExportBorder( FT_Stroker stroker,
FT_StrokerBorder border,
FT_Outline* outline )
FT_Outline* outline )
{
if ( border == FT_STROKER_BORDER_LEFT ||
border == FT_STROKER_BORDER_RIGHT )
{
FT_StrokeBorder sborder = & stroker->borders[border];
if ( sborder->valid )
ft_stroke_border_export( sborder, outline );
}
@ -1531,8 +1535,6 @@
}
/*
* The following is very similar to FT_Outline_Decompose, except
* that we do support opened paths, and do not scale the outline.

View File

@ -17,6 +17,7 @@
#include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H
#include FT_TRIGONOMETRY_H

View File

@ -2,7 +2,7 @@
FreeType font driver for bdf fonts
Copyright (C) 2001, 2002 by
Copyright (C) 2001, 2002, 2003 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy

2
src/cache/Jamfile vendored
View File

@ -1,4 +1,4 @@
# FreeType 2 src/cache Jamfile (c) 2001 David Turner
# FreeType 2 src/cache Jamfile (c) 2001, 2003 David Turner
#
SubDir FT2_TOP $(FT2_SRC_DIR) cache ;

View File

@ -3,7 +3,7 @@
#
# Copyright 2001, 2002 by
# Copyright 2001, 2002, 2003 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,

2
src/cache/ftcache.c vendored
View File

@ -4,7 +4,7 @@
/* */
/* The FreeType Caching sub-system (body only). */
/* */
/* Copyright 2000-2001 by */
/* Copyright 2000-2001, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */

191
src/cache/ftcbasic.c vendored
View File

@ -1,3 +1,21 @@
/***************************************************************************/
/* */
/* ftcbasic.c */
/* */
/* The FreeType basic cache interface (body). */
/* */
/* Copyright 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#include <ft2build.h>
#include FT_CACHE_H
#include FT_CACHE_INTERNAL_GLYPH_H
@ -8,54 +26,53 @@
#include "ftcerror.h"
/*
* Basic Families
*
*
*/
typedef struct FTC_BasicAttrRec_
/*
* Basic Families
*
*/
typedef struct FTC_BasicAttrRec_
{
FTC_ScalerRec scaler;
FT_UInt load_flags;
} FTC_BasicAttrRec, *FTC_BasicAttrs;
#define FTC_BASIC_ATTR_COMPARE(a,b) \
( FTC_SCALER_COMPARE( &(a)->scaler, &(b)->scaler ) && \
(a)->load_flags == (b)->load_flags )
#define FTC_BASIC_ATTR_COMPARE( a, b ) \
( FTC_SCALER_COMPARE( &(a)->scaler, &(b)->scaler ) && \
(a)->load_flags == (b)->load_flags )
#define FTC_BASIC_ATTR_HASH(a) \
( FTC_SCALER_HASH(&(a)->scaler) + 31*(a)->load_flags )
#define FTC_BASIC_ATTR_HASH( a ) \
( FTC_SCALER_HASH( &(a)->scaler ) + 31*(a)->load_flags )
typedef struct FTC_BasicQueryRec_
typedef struct FTC_BasicQueryRec_
{
FTC_GQueryRec gquery;
FTC_BasicAttrRec attrs;
FTC_GQueryRec gquery;
FTC_BasicAttrRec attrs;
} FTC_BasicQueryRec, *FTC_BasicQuery;
typedef struct FTC_BasicFamilyRec_
typedef struct FTC_BasicFamilyRec_
{
FTC_FamilyRec family;
FTC_BasicAttrRec attrs;
FTC_FamilyRec family;
FTC_BasicAttrRec attrs;
} FTC_BasicFamilyRec, *FTC_BasicFamily;
static FT_Bool
ftc_basic_family_compare( FTC_BasicFamily family,
FTC_BasicQuery query )
ftc_basic_family_compare( FTC_BasicFamily family,
FTC_BasicQuery query )
{
return FT_BOOL( FTC_BASIC_ATTR_COMPARE( &family->attrs, &query->attrs ) );
}
static FT_Error
ftc_basic_family_init( FTC_BasicFamily family,
FTC_BasicQuery query,
FTC_Cache cache )
ftc_basic_family_init( FTC_BasicFamily family,
FTC_BasicQuery query,
FTC_Cache cache )
{
FTC_Family_Init( FTC_FAMILY( family ), cache );
family->attrs = query->attrs;
@ -71,6 +88,7 @@
FT_Face face;
FT_UInt result = 0;
error = FTC_Manager_LookupFace( manager, family->attrs.scaler.face_id,
&face );
if ( !error )
@ -89,16 +107,19 @@
FT_Error error;
FT_Size size;
error = FTC_Manager_LookupSize( manager, &family->attrs.scaler, &size );
if ( !error )
{
FT_Face face = size->face;
FT_Face face = size->face;
error = FT_Load_Glyph( face, gindex, family->attrs.load_flags |
FT_LOAD_RENDER );
error = FT_Load_Glyph( face, gindex,
family->attrs.load_flags | FT_LOAD_RENDER );
if ( !error )
*aface = face;
}
return error;
}
@ -109,10 +130,11 @@
FTC_Cache cache,
FT_Glyph *aglyph )
{
FT_Error error;
FTC_Scaler scaler = &family->attrs.scaler;
FT_Face face;
FT_Size size;
FT_Error error;
FTC_Scaler scaler = &family->attrs.scaler;
FT_Face face;
FT_Size size;
/* we will now load the glyph image */
error = FTC_Manager_LookupSize( cache->manager,
@ -143,6 +165,7 @@
error = FTC_Err_Invalid_Argument;
}
}
Exit:
return error;
}
@ -153,22 +176,22 @@
FTC_FaceID face_id,
FTC_Cache cache )
{
FTC_BasicFamily family = (FTC_BasicFamily) gnode->family;
FTC_BasicFamily family = (FTC_BasicFamily)gnode->family;
FT_Bool result;
result = FT_BOOL( family->attrs.scaler.face_id == face_id );
if ( result )
{
/* we must call this function to avoid this node from appearing
* in later lookups with the same face_id !!
*/
/* we must call this function to avoid this node from appearing
* in later lookups with the same face_id!
*/
FTC_GNode_UnselectFamily( gnode, cache );
}
return result;
}
/*
*
* basic image cache
@ -179,30 +202,29 @@
{
{
sizeof( FTC_BasicFamilyRec ),
(FTC_MruNode_CompareFunc) ftc_basic_family_compare,
(FTC_MruNode_InitFunc) ftc_basic_family_init,
(FTC_MruNode_ResetFunc) NULL,
(FTC_MruNode_DoneFunc) NULL
(FTC_MruNode_CompareFunc)ftc_basic_family_compare,
(FTC_MruNode_InitFunc) ftc_basic_family_init,
(FTC_MruNode_ResetFunc) NULL,
(FTC_MruNode_DoneFunc) NULL
},
(FTC_IFamily_LoadGlyphFunc) ftc_basic_family_load_glyph
(FTC_IFamily_LoadGlyphFunc)ftc_basic_family_load_glyph
};
static const FTC_GCacheClassRec ftc_basic_image_cache_class =
{
{
(FTC_Node_NewFunc) FTC_INode_New,
(FTC_Node_WeightFunc) FTC_INode_Weight,
(FTC_Node_CompareFunc) FTC_GNode_Compare,
(FTC_Node_CompareFunc) ftc_basic_gnode_compare_faceid,
(FTC_Node_FreeFunc) FTC_INode_Free,
(FTC_Node_NewFunc) FTC_INode_New,
(FTC_Node_WeightFunc) FTC_INode_Weight,
(FTC_Node_CompareFunc)FTC_GNode_Compare,
(FTC_Node_CompareFunc)ftc_basic_gnode_compare_faceid,
(FTC_Node_FreeFunc) FTC_INode_Free,
sizeof( FTC_GCacheRec ),
(FTC_Cache_InitFunc) FTC_GCache_Init,
(FTC_Cache_DoneFunc) FTC_GCache_Done
(FTC_Cache_InitFunc) FTC_GCache_Init,
(FTC_Cache_DoneFunc) FTC_GCache_Done
},
(FTC_MruListClass) & ftc_basic_image_family_class
(FTC_MruListClass)&ftc_basic_image_family_class
};
@ -210,8 +232,8 @@
FTC_ImageCache_New( FTC_Manager manager,
FTC_ImageCache *acache )
{
return FTC_GCache_New( manager, & ftc_basic_image_cache_class,
(FTC_GCache*) acache );
return FTC_GCache_New( manager, &ftc_basic_image_cache_class,
(FTC_GCache*)acache );
}
@ -249,7 +271,7 @@
hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + gindex;
#if 1 /* inlining is about 50% faster !! */
#if 1 /* inlining is about 50% faster! */
FTC_GCACHE_LOOKUP_CMP( cache,
ftc_basic_family_compare,
FTC_GNode_Compare,
@ -265,12 +287,12 @@
#endif
if ( !error )
{
*aglyph = FTC_INODE(node)->glyph;
*aglyph = FTC_INODE( node )->glyph;
if ( anode )
{
*anode = FTC_NODE(node);
FTC_NODE(node)->ref_count++;
*anode = FTC_NODE( node );
FTC_NODE( node )->ref_count++;
}
}
@ -279,7 +301,6 @@
}
/*
*
* basic small bitmap cache
@ -291,56 +312,55 @@
{
{
sizeof( FTC_BasicFamilyRec ),
(FTC_MruNode_CompareFunc) ftc_basic_family_compare,
(FTC_MruNode_InitFunc) ftc_basic_family_init,
(FTC_MruNode_ResetFunc) NULL,
(FTC_MruNode_DoneFunc) NULL
(FTC_MruNode_CompareFunc)ftc_basic_family_compare,
(FTC_MruNode_InitFunc) ftc_basic_family_init,
(FTC_MruNode_ResetFunc) NULL,
(FTC_MruNode_DoneFunc) NULL
},
(FTC_SFamily_GetCountFunc) ftc_basic_family_get_count,
(FTC_SFamily_LoadGlyphFunc) ftc_basic_family_load_bitmap
(FTC_SFamily_GetCountFunc) ftc_basic_family_get_count,
(FTC_SFamily_LoadGlyphFunc)ftc_basic_family_load_bitmap
};
static const FTC_GCacheClassRec ftc_basic_sbit_cache_class =
{
{
(FTC_Node_NewFunc) FTC_SNode_New,
(FTC_Node_WeightFunc) FTC_SNode_Weight,
(FTC_Node_CompareFunc) FTC_SNode_Compare,
(FTC_Node_CompareFunc) ftc_basic_gnode_compare_faceid,
(FTC_Node_FreeFunc) FTC_SNode_Free,
(FTC_Node_NewFunc) FTC_SNode_New,
(FTC_Node_WeightFunc) FTC_SNode_Weight,
(FTC_Node_CompareFunc)FTC_SNode_Compare,
(FTC_Node_CompareFunc)ftc_basic_gnode_compare_faceid,
(FTC_Node_FreeFunc) FTC_SNode_Free,
sizeof( FTC_GCacheRec ),
(FTC_Cache_InitFunc) FTC_GCache_Init,
(FTC_Cache_DoneFunc) FTC_GCache_Done
(FTC_Cache_InitFunc) FTC_GCache_Init,
(FTC_Cache_DoneFunc) FTC_GCache_Done
},
(FTC_MruListClass) & ftc_basic_sbit_family_class
(FTC_MruListClass)&ftc_basic_sbit_family_class
};
FT_EXPORT_DEF( FT_Error )
FTC_SBitCache_New( FTC_Manager manager,
FTC_SBitCache *acache )
{
return FTC_GCache_New( manager, & ftc_basic_sbit_cache_class,
(FTC_GCache*) acache );
return FTC_GCache_New( manager, &ftc_basic_sbit_cache_class,
(FTC_GCache*)acache );
}
FT_EXPORT_DEF( FT_Error )
FTC_SBitCache_Lookup( FTC_SBitCache cache,
FTC_ImageType type,
FT_UInt gindex,
FTC_SBit *ansbit,
FTC_Node *anode )
FTC_SBitCache_Lookup( FTC_SBitCache cache,
FTC_ImageType type,
FT_UInt gindex,
FTC_SBit *ansbit,
FTC_Node *anode )
{
FT_Error error;
FTC_BasicQueryRec query;
FTC_SNode node;
FT_UInt32 hash;
if ( anode )
*anode = NULL;
@ -356,12 +376,11 @@
query.attrs.scaler.pixel = 1;
query.attrs.load_flags = type->flags;
/* beware, the hash must be the same for all glyph ranges !!
*/
/* beware, the hash must be the same for all glyph ranges! */
hash = FTC_BASIC_ATTR_HASH( &query.attrs ) +
(gindex/FTC_SBIT_ITEMS_PER_NODE);
gindex / FTC_SBIT_ITEMS_PER_NODE;
#if 1 /* inlining is about 50% faster !! */
#if 1 /* inlining is about 50% faster! */
FTC_GCACHE_LOOKUP_CMP( cache,
ftc_basic_family_compare,
FTC_SNode_Compare,
@ -374,12 +393,12 @@
hash,
gindex,
FTC_GQUERY( &query ),
(FTC_Node*) &node );
(FTC_Node*)&node );
#endif
if ( error )
goto Exit;
*ansbit = node->sbits + ( gindex - FTC_GNODE(node)->gindex );
*ansbit = node->sbits + ( gindex - FTC_GNODE( node )->gindex );
if ( anode )
{
@ -391,3 +410,5 @@
return error;
}
/* END */

169
src/cache/ftccache.c vendored
View File

@ -45,7 +45,8 @@
ftc_node_mru_link( FTC_Node node,
FTC_Manager manager )
{
FTC_MruNode_Prepend( (FTC_MruNode*)&manager->nodes_list, (FTC_MruNode)node );
FTC_MruNode_Prepend( (FTC_MruNode*)&manager->nodes_list,
(FTC_MruNode)node );
manager->num_nodes++;
}
@ -55,7 +56,8 @@
ftc_node_mru_unlink( FTC_Node node,
FTC_Manager manager )
{
FTC_MruNode_Remove( (FTC_MruNode*)&manager->nodes_list, (FTC_MruNode)node );
FTC_MruNode_Remove( (FTC_MruNode*)&manager->nodes_list,
(FTC_MruNode)node );
manager->num_nodes--;
}
@ -65,64 +67,67 @@
ftc_node_mru_up( FTC_Node node,
FTC_Manager manager )
{
FTC_MruNode_Up( (FTC_MruNode*)&manager->nodes_list, (FTC_MruNode)node );
FTC_MruNode_Up( (FTC_MruNode*)&manager->nodes_list,
(FTC_MruNode)node );
}
/* note that this function cannot fail. If we cannot re-size the
* buckets array appropriately, we simply degrade the hash table's
* performance !!
*/
/* Note that this function cannot fail. If we cannot re-size the
* buckets array appropriately, we simply degrade the hash table's
* performance!
*/
static void
ftc_cache_resize( FTC_Cache cache )
{
for (;;)
{
FTC_Node node, *pnode;
FT_UInt p = cache->p;
FT_UInt mask = cache->mask;
FT_UInt count = mask + p + 1; /* number of buckets */
FTC_Node node, *pnode;
FT_UInt p = cache->p;
FT_UInt mask = cache->mask;
FT_UInt count = mask + p + 1; /* number of buckets */
/* do we need to shrink the buckets array ?
*/
/* do we need to shrink the buckets array? */
if ( cache->slack < 0 )
{
FTC_Node new_list = NULL;
FTC_Node new_list = NULL;
/* try to expand the buckets array _before_ splitting
* the bucket lists
*/
if ( p >= mask )
{
FT_Memory memory = cache->memory;
if ( p >= mask )
{
FT_Memory memory = cache->memory;
/* if we can't expand the array, leave immediately */
if ( FT_MEM_RENEW_ARRAY( cache->buckets, (mask+1)*2, (mask+1)*4 ) )
break;
}
if ( FT_MEM_RENEW_ARRAY( cache->buckets, (mask+1)*2, (mask+1)*4 ) )
break;
}
/* split a single bucket */
pnode = cache->buckets + p;
pnode = cache->buckets + p;
for (;;)
{
node = *pnode;
if ( node == NULL )
break;
for (;;)
{
node = *pnode;
if ( node == NULL )
break;
if ( node->hash & ( mask + 1 ) )
{
*pnode = node->link;
node->link = new_list;
new_list = node;
}
else
pnode = &node->link;
}
if ( node->hash & ( mask + 1 ) )
{
*pnode = node->link;
node->link = new_list;
new_list = node;
}
else
pnode = &node->link;
}
cache->buckets[p + mask + 1] = new_list;
cache->buckets[p + mask + 1] = new_list;
cache->slack += FTC_HASH_MAX_LOAD;
cache->slack += FTC_HASH_MAX_LOAD;
if ( p >= mask )
{
@ -132,13 +137,14 @@
else
cache->p = p + 1;
}
/* do we need to expand the buckets array ?
*/
/* do we need to expand the buckets array? */
else if ( cache->slack > (FT_Long)count * FTC_HASH_SUB_LOAD )
{
FT_UInt old_index = p + mask;
FTC_Node* pold;
if ( old_index + 1 <= FTC_HASH_INITIAL_SIZE )
break;
@ -146,8 +152,10 @@
{
FT_Memory memory = cache->memory;
/* if we can't shrink the array, leave immediately */
if ( FT_MEM_RENEW_ARRAY( cache->buckets, ( mask + 1 ) * 2, (mask+1) ) )
/* if we can't shrink the array, leave immediately */
if ( FT_MEM_RENEW_ARRAY( cache->buckets,
( mask + 1 ) * 2, mask + 1 ) )
break;
cache->mask >>= 1;
@ -173,7 +181,6 @@
}
/* remove a node from its cache's hash table */
static void
ftc_node_hash_unlink( FTC_Node node0,
@ -193,6 +200,7 @@
{
FTC_Node node = *pnode;
if ( node == NULL )
{
FT_ERROR(( "ftc_node_hash_unlink: unknown node!\n" ));
@ -213,8 +221,7 @@
}
/* add a node to the "top" of its cache's hash table */
/* add a node to the `top' of its cache's hash table */
static void
ftc_node_hash_link( FTC_Node node,
FTC_Cache cache )
@ -237,8 +244,6 @@
}
/* remove a node from the cache manager */
FT_EXPORT_DEF( void )
ftc_node_destroy( FTC_Node node,
@ -256,7 +261,7 @@
}
#endif
cache = manager->caches[ node->cache_index ];
cache = manager->caches[node->cache_index];
#ifdef FT_DEBUG_ERROR
if ( cache == NULL )
@ -296,19 +301,19 @@
FT_EXPORT_DEF( FT_Error )
FTC_Cache_Init( FTC_Cache cache )
FTC_Cache_Init( FTC_Cache cache )
{
FT_Memory memory = cache->memory;
cache->p = 0;
cache->mask = FTC_HASH_INITIAL_SIZE - 1;
cache->slack = FTC_HASH_INITIAL_SIZE * FTC_HASH_MAX_LOAD;
cache->p = 0;
cache->mask = FTC_HASH_INITIAL_SIZE - 1;
cache->slack = FTC_HASH_INITIAL_SIZE * FTC_HASH_MAX_LOAD;
return ( FT_MEM_NEW_ARRAY( cache->buckets, FTC_HASH_INITIAL_SIZE * 2 ) );
}
FT_EXPORT_DEF( void )
FTC_Cache_Clear( FTC_Cache cache )
{
@ -318,6 +323,7 @@
FT_UFast i;
FT_UInt count;
count = cache->p + cache->mask + 1;
for ( i = 0; i < count; i++ )
@ -353,6 +359,7 @@
{
FT_Memory memory = cache->memory;
FTC_Cache_Clear( cache );
FT_FREE( cache->buckets );
@ -365,11 +372,10 @@
}
static void
ftc_cache_add( FTC_Cache cache,
FT_UInt32 hash,
FTC_Node node )
ftc_cache_add( FTC_Cache cache,
FT_UInt32 hash,
FTC_Node node )
{
node->hash = hash;
node->cache_index = (FT_UInt16) cache->index;
@ -381,6 +387,7 @@
{
FTC_Manager manager = cache->manager;
manager->cur_weight += cache->clazz.node_weight( node, cache );
if ( manager->cur_weight >= manager->max_weight )
@ -402,25 +409,25 @@
FT_Error error;
FTC_Node node;
/*
* try to allocate a new cache node. Note that in case of
* out-of-memory error (OOM), we'll flush the cache a bit,
* then try again.
*
* on each try, the "tries" variable gives the number
* of old nodes we want to flush from the manager's global list
* before the next allocation attempt. it barely doubles on
* each iteration
*
*/
/*
* Try to allocate a new cache node. Note that in case of
* out-of-memory error (OOM), we'll flush the cache a bit,
* then try again.
*
* On each try, the `tries' variable gives the number
* of old nodes we want to flush from the manager's global list
* before the next allocation attempt. It barely doubles on
* each iteration.
*
*/
error = cache->clazz.node_new( &node, query, cache );
if ( error )
goto FlushCache;
AddNode:
/* don't assume that the cache has the same number of buckets, since
* our allocation request might have triggered global cache flushing
*/
/* don't assume that the cache has the same number of buckets, since
* our allocation request might have triggered global cache flushing
*/
ftc_cache_add( cache, hash, node );
Exit:
@ -436,6 +443,7 @@
FTC_Manager manager = cache->manager;
FT_UInt count, tries = 1;
for (;;)
{
error = cache->clazz.node_new( &node, query, cache );
@ -452,7 +460,7 @@
if ( count == tries )
{
count = tries*2;
count = tries * 2;
if ( count < tries || count > manager->num_nodes )
count = manager->num_nodes;
}
@ -510,6 +518,7 @@
{
FTC_Manager manager = cache->manager;
if ( node != manager->nodes_list )
ftc_node_mru_up( node, manager );
}
@ -521,32 +530,33 @@
}
FT_EXPORT_DEF( void )
FTC_Cache_RemoveFaceID( FTC_Cache cache,
FTC_FaceID face_id )
FTC_Cache_RemoveFaceID( FTC_Cache cache,
FTC_FaceID face_id )
{
FT_UFast i, count;
FTC_Manager manager = cache->manager;
FTC_Node frees = NULL;
count = cache->p + cache->mask;
for ( i = 0; i < count; i++ )
{
FTC_Node* bucket = cache->buckets + i;
FTC_Node* pnode = bucket;
for ( ;; )
{
FTC_Node node = *pnode;
if ( node == NULL )
break;
if ( cache->clazz.node_remove_faceid( node, face_id, cache ) )
{
*pnode = node->link;
*pnode = node->link;
node->link = frees;
frees = node;
}
@ -555,12 +565,12 @@
}
}
/* remove all nodes in the free list
*/
/* remove all nodes in the free list */
while ( frees )
{
FTC_Node node;
node = frees;
frees = node->link;
@ -569,10 +579,11 @@
cache->clazz.node_free( node, cache );
cache->slack ++;
cache->slack++;
}
ftc_cache_resize( cache );
}
/* END */

69
src/cache/ftccmap.c vendored
View File

@ -29,6 +29,7 @@
#undef FT_COMPONENT
#define FT_COMPONENT trace_cache
/*************************************************************************/
/* */
/* Each FTC_CMapNode contains a simple array to map a range of character */
@ -47,22 +48,24 @@
#define FTC_CMAP_INDICES_MAX 128
/* compute a query/node hash */
#define FTC_CMAP_HASH( faceid, index, charcode ) \
( FTC_FACE_ID_HASH( faceid ) + 211*( index ) + ((char_code) / FTC_CMAP_INDICES_MAX) )
#define FTC_CMAP_HASH( faceid, index, charcode ) \
( FTC_FACE_ID_HASH( faceid ) + 211 * ( index ) + \
( (char_code) / FTC_CMAP_INDICES_MAX ) )
/* the charmap query */
typedef struct FTC_CMapQueryRec_
{
FTC_FaceID face_id;
FT_UInt cmap_index;
FT_UInt32 char_code;
FTC_FaceID face_id;
FT_UInt cmap_index;
FT_UInt32 char_code;
} FTC_CMapQueryRec, *FTC_CMapQuery;
#define FTC_CMAP_QUERY(x) ((FTC_CMapQuery)(x))
#define FTC_CMAP_QUERY_HASH(x) FTC_CMAP_HASH( (x)->face_id, (x)->cmap_index, (x)->char_code )
#define FTC_CMAP_QUERY( x ) ((FTC_CMapQuery)(x))
#define FTC_CMAP_QUERY_HASH( x ) \
FTC_CMAP_HASH( (x)->face_id, (x)->cmap_index, (x)->char_code )
/* the cmap cache node */
/* the cmap cache node */
typedef struct FTC_CMapNodeRec_
{
FTC_NodeRec node;
@ -74,7 +77,8 @@
} FTC_CMapNodeRec, *FTC_CMapNode;
#define FTC_CMAP_NODE( x ) ( (FTC_CMapNode)( x ) )
#define FTC_CMAP_NODE_HASH(x) FTC_CMAP_HASH( (x)->face_id, (x)->cmap_index, (x)->first )
#define FTC_CMAP_NODE_HASH( x ) \
FTC_CMAP_HASH( (x)->face_id, (x)->cmap_index, (x)->first )
/* if (indices[n] == FTC_CMAP_UNKNOWN), we assume that the corresponding */
/* glyph indices haven't been queried through FT_Get_Glyph_Index() yet */
@ -90,14 +94,15 @@
/*************************************************************************/
/* no need for specific finalizer; we use "ftc_node_done" directly */
/* no need for specific finalizer; we use `ftc_node_done' directly */
FT_CALLBACK_DEF( void )
ftc_cmap_node_free( FTC_CMapNode node,
FTC_Cache cache )
ftc_cmap_node_free( FTC_CMapNode node,
FTC_Cache cache )
{
FT_Memory memory = cache->memory;
FT_FREE( node );
}
@ -113,6 +118,7 @@
FTC_CMapNode node;
FT_UInt nn;
if ( !FT_NEW( node ) )
{
node->face_id = query->face_id;
@ -149,8 +155,10 @@
{
FT_UInt32 offset = (FT_UInt32)( query->char_code - node->first );
return FT_BOOL( offset < FTC_CMAP_INDICES_MAX );
}
return 0;
}
@ -162,6 +170,7 @@
return FT_BOOL( node->face_id == face_id );
}
/*************************************************************************/
/*************************************************************************/
/***** *****/
@ -174,17 +183,18 @@
FT_CALLBACK_TABLE_DEF
const FTC_CacheClassRec ftc_cmap_cache_class =
{
(FTC_Node_NewFunc) ftc_cmap_node_new,
(FTC_Node_WeightFunc) ftc_cmap_node_weight,
(FTC_Node_CompareFunc) ftc_cmap_node_compare,
(FTC_Node_CompareFunc) ftc_cmap_node_remove_faceid,
(FTC_Node_FreeFunc) ftc_cmap_node_free,
(FTC_Node_NewFunc) ftc_cmap_node_new,
(FTC_Node_WeightFunc) ftc_cmap_node_weight,
(FTC_Node_CompareFunc)ftc_cmap_node_compare,
(FTC_Node_CompareFunc)ftc_cmap_node_remove_faceid,
(FTC_Node_FreeFunc) ftc_cmap_node_free,
sizeof ( FTC_CacheRec ),
(FTC_Cache_InitFunc) FTC_Cache_Init,
(FTC_Cache_DoneFunc) FTC_Cache_Done,
(FTC_Cache_InitFunc) FTC_Cache_Init,
(FTC_Cache_DoneFunc) FTC_Cache_Done,
};
/* documentation is in ftccmap.h */
FT_EXPORT_DEF( FT_Error )
@ -192,9 +202,11 @@
FTC_CMapCache *acache )
{
return FTC_Manager_RegisterCache( manager,
& ftc_cmap_cache_class,
&ftc_cmap_cache_class,
FTC_CACHE_P( acache ) );
}
/* documentation is in ftccmap.h */
FT_EXPORT_DEF( FT_UInt )
@ -234,10 +246,11 @@
FT_ASSERT( (FT_UInt)( char_code - node->first ) < FTC_CMAP_INDICES_MAX );
gindex = node->indices[ char_code - node->first ];
gindex = node->indices[char_code - node->first];
if ( gindex == FTC_CMAP_UNKNOWN )
{
FT_Face face;
FT_Face face;
gindex = 0;
@ -249,23 +262,25 @@
{
FT_CharMap old, cmap = NULL;
old = face->charmap;
cmap = face->charmaps[ cmap_index ];
if (old != cmap)
old = face->charmap;
cmap = face->charmaps[cmap_index];
if ( old != cmap )
FT_Set_Charmap( face, cmap );
gindex = FT_Get_Char_Index( face, char_code );
if (old != cmap)
if ( old != cmap )
FT_Set_Charmap( face, old );
}
node->indices[ char_code - node->first ] = gindex;
node->indices[char_code - node->first] = gindex;
}
Exit:
return gindex;
}
/* END */

33
src/cache/ftcglyph.c vendored
View File

@ -4,7 +4,7 @@
/* */
/* FreeType Glyph Image (FT_Glyph) cache (body). */
/* */
/* Copyright 2000-2001 by */
/* Copyright 2000-2001, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -39,16 +39,16 @@
FT_EXPORT_DEF( void )
FTC_GNode_UnselectFamily( FTC_GNode gnode,
FTC_Cache cache )
FTC_GNode_UnselectFamily( FTC_GNode gnode,
FTC_Cache cache )
{
FTC_Family family = gnode->family;
gnode->family = NULL;
if ( family && --family->num_nodes <= 0 )
{
FTC_MruList_Remove( & FTC_GCACHE(cache)->families, (FTC_MruNode)family );
}
FTC_MruList_Remove( &FTC_GCACHE( cache )->families,
(FTC_MruNode)family );
}
@ -84,7 +84,8 @@
FTC_Family_Init( FTC_Family family,
FTC_Cache cache )
{
FTC_GCacheClass clazz = FTC_CACHE__GCACHE_CLASS(cache);
FTC_GCacheClass clazz = FTC_CACHE__GCACHE_CLASS( cache );
family->clazz = clazz->family_class;
family->num_nodes = 0;
@ -97,17 +98,18 @@
{
FT_Error error;
error = FTC_Cache_Init( FTC_CACHE(cache) );
error = FTC_Cache_Init( FTC_CACHE( cache ) );
if ( !error )
{
FTC_GCacheClass clazz = (FTC_GCacheClass) FTC_CACHE(cache)->org_class;
FTC_GCacheClass clazz = (FTC_GCacheClass)FTC_CACHE( cache )->org_class;
FTC_MruList_Init( &cache->families,
clazz->family_class,
0, /* no maximum here !! */
0, /* no maximum here! */
cache,
FTC_CACHE(cache)->memory );
FTC_CACHE( cache )->memory );
}
return error;
}
@ -125,8 +127,8 @@
FTC_GCacheClass clazz,
FTC_GCache *acache )
{
return FTC_Manager_RegisterCache( manager, (FTC_CacheClass) clazz,
(FTC_Cache*) acache );
return FTC_Manager_RegisterCache( manager, (FTC_CacheClass)clazz,
(FTC_Cache*)acache );
}
@ -137,13 +139,14 @@
FTC_GQuery query,
FTC_Node *anode )
{
FT_Error error;
FT_Error error;
query->gindex = gindex;
FTC_MRULIST_LOOKUP( &cache->families, query, query->family, error );
if ( !error )
error = FTC_Cache_Lookup( FTC_CACHE(cache), hash, query, anode );
error = FTC_Cache_Lookup( FTC_CACHE( cache ), hash, query, anode );
return error;
}

View File

@ -4,7 +4,7 @@
/* */
/* FreeType Image cache (body). */
/* */
/* Copyright 2000-2001 by */
/* Copyright 2000-2001, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -31,6 +31,7 @@
{
FT_Memory memory = cache->memory;
if ( inode->glyph )
{
FT_Done_Glyph( inode->glyph );
@ -52,6 +53,7 @@
FT_Error error;
FTC_INode inode;
if ( !FT_NEW( inode ) )
{
FTC_GNode gnode = FTC_GNODE( inode );
@ -59,12 +61,15 @@
FT_UInt gindex = gquery->gindex;
FTC_IFamilyClass clazz = FTC_CACHE__IFAMILY_CLASS( cache );
/* initialize its inner fields */
FTC_GNode_Init( gnode, gindex, family );
/* we will now load the glyph image */
error = clazz->family_load_glyph( family, gindex, cache, &inode->glyph );
error = clazz->family_load_glyph( family, gindex, cache,
&inode->glyph );
}
*pinode = inode;
return error;
}

115
src/cache/ftcmanag.c vendored
View File

@ -4,7 +4,7 @@
/* */
/* FreeType Cache Manager (body). */
/* */
/* Copyright 2000-2001, 2002 by */
/* Copyright 2000-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -33,19 +33,22 @@
static FT_Error
ftc_scaler_lookup_size( FTC_Manager manager,
FTC_Scaler scaler,
FT_Size *asize )
ftc_scaler_lookup_size( FTC_Manager manager,
FTC_Scaler scaler,
FT_Size *asize )
{
FT_Face face;
FT_Size size = NULL;
FT_Error error;
error = FTC_Manager_LookupFace( manager, scaler->face_id, &face );
if ( error ) goto Exit;
if ( error )
goto Exit;
error = FT_New_Size( face, &size );
if ( error ) goto Exit;
if ( error )
goto Exit;
FT_Activate_Size( size );
@ -66,11 +69,11 @@
}
typedef struct FTC_SizeNodeRec_
typedef struct FTC_SizeNodeRec_
{
FTC_MruNodeRec node;
FT_Size size;
FTC_ScalerRec scaler;
FTC_MruNodeRec node;
FT_Size size;
FTC_ScalerRec scaler;
} FTC_SizeNodeRec, *FTC_SizeNode;
@ -80,6 +83,7 @@
{
FT_Size size = node->size;
if ( size )
FT_Done_Size( size );
}
@ -91,15 +95,15 @@
{
FTC_Scaler scaler0 = &node->scaler;
return FTC_SCALER_COMPARE( scaler0, scaler );
}
FT_CALLBACK_DEF( FT_Error )
ftc_size_node_init( FTC_SizeNode node,
FTC_Scaler scaler,
FTC_Manager manager )
ftc_size_node_init( FTC_SizeNode node,
FTC_Scaler scaler,
FTC_Manager manager )
{
node->scaler = scaler[0];
@ -108,9 +112,9 @@
FT_CALLBACK_DEF( FT_Error )
ftc_size_node_reset( FTC_SizeNode node,
FTC_Scaler scaler,
FTC_Manager manager )
ftc_size_node_reset( FTC_SizeNode node,
FTC_Scaler scaler,
FTC_Manager manager )
{
FT_Done_Size( node->size );
@ -123,14 +127,14 @@
static const FTC_MruListClassRec ftc_size_list_class =
{
sizeof( FTC_SizeNodeRec ),
(FTC_MruNode_CompareFunc) ftc_size_node_compare,
(FTC_MruNode_InitFunc) ftc_size_node_init,
(FTC_MruNode_ResetFunc) ftc_size_node_reset,
(FTC_MruNode_DoneFunc) ftc_size_node_done
(FTC_MruNode_CompareFunc)ftc_size_node_compare,
(FTC_MruNode_InitFunc) ftc_size_node_init,
(FTC_MruNode_ResetFunc) ftc_size_node_reset,
(FTC_MruNode_DoneFunc) ftc_size_node_done
};
/* helper function used by ftc_face_node_done */
/* helper function used by ftc_face_node_done */
static FT_Bool
ftc_size_node_compare_faceid( FTC_SizeNode node,
FTC_FaceID face_id )
@ -140,9 +144,9 @@
FT_EXPORT_DEF( FT_Error )
FTC_Manager_LookupSize( FTC_Manager manager,
FTC_Scaler scaler,
FT_Size *asize )
FTC_Manager_LookupSize( FTC_Manager manager,
FTC_Scaler scaler,
FT_Size *asize )
{
FT_Error error;
FTC_SizeNode node;
@ -163,6 +167,7 @@
{
FTC_Scaler scaler0 = &node->scaler;
if ( FTC_SCALER_COMPARE( scaler0, scaler ) )
goto Found;
}
@ -195,13 +200,13 @@
} FTC_FaceNodeRec, *FTC_FaceNode;
FT_CALLBACK_DEF( FT_Error )
ftc_face_node_init( FTC_FaceNode node,
FTC_FaceID face_id,
FTC_Manager manager )
{
FT_Error error;
FT_Error error;
node->face_id = face_id;
@ -215,6 +220,7 @@
if ( node->face->size )
FT_Done_Size( node->face->size );
}
return error;
}
@ -226,9 +232,9 @@
/* we must begin by removing all scalers for the target face */
/* from the manager's list */
FTC_MruList_RemoveSelection(
& manager->sizes,
(FTC_MruNode_CompareFunc) ftc_size_node_compare_faceid,
node->face_id );
& manager->sizes,
(FTC_MruNode_CompareFunc)ftc_size_node_compare_faceid,
node->face_id );
/* all right, we can discard the face now */
FT_Done_Face( node->face );
@ -249,14 +255,13 @@
{
sizeof( FTC_FaceNodeRec),
(FTC_MruNode_CompareFunc) ftc_face_node_compare,
(FTC_MruNode_InitFunc) ftc_face_node_init,
(FTC_MruNode_ResetFunc) NULL,
(FTC_MruNode_DoneFunc) ftc_face_node_done
(FTC_MruNode_CompareFunc)ftc_face_node_compare,
(FTC_MruNode_InitFunc) ftc_face_node_init,
(FTC_MruNode_ResetFunc) NULL,
(FTC_MruNode_DoneFunc) ftc_face_node_done
};
/* documentation is in ftcache.h */
FT_EXPORT_DEF( FT_Error )
@ -296,8 +301,6 @@
}
/*************************************************************************/
/*************************************************************************/
/***** *****/
@ -385,6 +388,7 @@
{
FTC_Cache cache = manager->caches[idx];
if ( cache )
{
cache->clazz.cache_done( cache );
@ -439,17 +443,16 @@
do
{
FTC_Cache cache = manager->caches[ node->cache_index ];
FTC_Cache cache = manager->caches[node->cache_index];
if ( (FT_UInt)node->cache_index >= manager->num_caches )
FT_ERROR(( "FTC_Manager_Check: invalid node (cache index = %ld\n",
node->cache_index ));
else
{
weight += cache->clazz.node_weight( node, cache );
}
node = FTC_NODE__NEXT(node);
node = FTC_NODE__NEXT( node );
} while ( node != first );
@ -468,7 +471,7 @@
do
{
count++;
node = FTC_NODE__NEXT(node);
node = FTC_NODE__NEXT( node );
} while ( node != first );
@ -510,14 +513,14 @@
if ( manager->cur_weight < manager->max_weight || first == NULL )
return;
/* go to last node - it's a circular list */
node = FTC_NODE__PREV(first);
/* go to last node -- it's a circular list */
node = FTC_NODE__PREV( first );
do
{
FTC_Node prev;
prev = ( node == first ) ? NULL : FTC_NODE__PREV(node);
prev = ( node == first ) ? NULL : FTC_NODE__PREV( node );
if ( node->ref_count <= 0 )
ftc_node_destroy( node, manager );
@ -532,8 +535,8 @@
FT_EXPORT_DEF( FT_Error )
FTC_Manager_RegisterCache( FTC_Manager manager,
FTC_CacheClass clazz,
FTC_Cache *acache )
FTC_CacheClass clazz,
FTC_Cache *acache )
{
FT_Error error = FTC_Err_Invalid_Argument;
FTC_Cache cache = NULL;
@ -543,6 +546,7 @@
{
FT_Memory memory = manager->memory;
if ( manager->num_caches >= FTC_MAX_CACHES )
{
error = FTC_Err_Too_Many_Caches;
@ -570,7 +574,7 @@
goto Exit;
}
manager->caches[ manager->num_caches++ ] = cache;
manager->caches[manager->num_caches++] = cache;
}
}
@ -582,13 +586,14 @@
FT_EXPORT_DEF( FT_UInt )
FTC_Manager_FlushN( FTC_Manager manager,
FT_UInt count )
FT_UInt count )
{
FTC_Node first = manager->nodes_list;
FTC_Node node;
FT_UInt result;
/* try to remove "count" nodes from the list */
/* try to remove `count' nodes from the list */
if ( first == NULL ) /* empty list! */
return 0;
@ -596,10 +601,10 @@
node = FTC_NODE__PREV(first);
for ( result = 0; result < count; )
{
FTC_Node prev = FTC_NODE__PREV(node);
FTC_Node prev = FTC_NODE__PREV( node );
/* don't touch locked nodes */
/* don't touch locked nodes */
if ( node->ref_count <= 0 )
{
ftc_node_destroy( node, manager );
@ -621,9 +626,9 @@
{
FT_UInt nn;
/* this will remove all FTC_SizeNode that correspond to
* the face_id as well
*/
/* this will remove all FTC_SizeNode that correspond to
* the face_id as well
*/
FTC_MruList_RemoveSelection( &manager->faces, NULL, face_id );
for ( nn = 0; nn < manager->num_caches; nn++ )

101
src/cache/ftcmru.c vendored
View File

@ -1,3 +1,21 @@
/***************************************************************************/
/* */
/* ftcmru.c */
/* */
/* FreeType MRU support (body). */
/* */
/* Copyright 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#include <ft2build.h>
#include FT_CACHE_H
#include FT_CACHE_INTERNAL_MRU_H
@ -6,29 +24,34 @@
#include "ftcerror.h"
FT_EXPORT_DEF( void )
FTC_MruNode_Prepend( FTC_MruNode *plist,
FTC_MruNode node )
{
FTC_MruNode first = *plist;
if ( first )
{
FTC_MruNode last = first->prev;
#ifdef FT_DEBUG_ERROR
{
FTC_MruNode cnode = first;
do
{
if ( cnode == node )
{
fprintf( stderr, "FTC_MruNode_Prepend: invalid action !!\n" );
exit(2);
fprintf( stderr, "FTC_MruNode_Prepend: invalid action!\n" );
exit( 2 );
}
cnode = cnode->next;
}
while ( cnode != first );
} while ( cnode != first );
}
#endif
@ -52,12 +75,14 @@
{
FTC_MruNode first = *plist;
FT_ASSERT( first != NULL );
if ( first != node )
{
FTC_MruNode prev, next, last;
#ifdef FT_DEBUG_ERROR
{
FTC_MruNode cnode = first;
@ -66,11 +91,11 @@
if ( cnode == node )
goto Ok;
cnode = cnode->next;
}
while ( cnode != first );
fprintf( stderr, "FTC_MruNode_Up: invalid action !!\n" );
exit(2);
} while ( cnode != first );
fprintf( stderr, "FTC_MruNode_Up: invalid action!\n" );
exit( 2 );
Ok:
}
#endif
@ -85,7 +110,7 @@
last->next = node;
first->prev = node;
node->next = first;
node->next = first;
node->prev = last;
*plist = node;
@ -100,21 +125,24 @@
FTC_MruNode first = *plist;
FTC_MruNode prev, next;
FT_ASSERT( first != NULL );
#ifdef FT_DEBUG_ERROR
{
FTC_MruNode cnode = first;
do
{
if ( cnode == node )
goto Ok;
cnode = cnode->next;
}
while ( cnode != first );
fprintf( stderr, "FTC_MruNode_Remove: invalid action !!\n" );
exit(2);
} while ( cnode != first );
fprintf( stderr, "FTC_MruNode_Remove: invalid action!\n" );
exit( 2 );
Ok:
}
#endif
@ -134,8 +162,7 @@
}
else if ( node == first )
*plist = next;
}
}
FT_EXPORT_DEF( void )
@ -171,14 +198,14 @@
}
FT_EXPORT_DEF( FTC_MruNode )
FTC_MruList_Find( FTC_MruList list,
FT_Pointer key )
FT_Pointer key )
{
FTC_MruNode_CompareFunc compare = list->clazz.node_compare;
FTC_MruNode first, node;
first = list->nodes;
node = NULL;
@ -191,23 +218,24 @@
return node;
node = node->next;
} while ( node != first);
}
while ( node != first) ;
}
return NULL;
}
FT_EXPORT_DEF( FT_Error )
FTC_MruList_New( FTC_MruList list,
FT_Pointer key,
FTC_MruNode *anode )
FTC_MruList_New( FTC_MruList list,
FT_Pointer key,
FTC_MruNode *anode )
{
FT_Error error;
FTC_MruNode node;
FT_Memory memory = list->memory;
if ( list->num_nodes >= list->max_nodes && list->max_nodes > 0 )
{
node = list->nodes->prev;
@ -254,11 +282,12 @@
FT_EXPORT( FT_Error )
FTC_MruList_Lookup( FTC_MruList list,
FT_Pointer key,
FTC_MruNode *anode )
FT_Pointer key,
FTC_MruNode *anode )
{
FTC_MruNode node;
node = FTC_MruList_Find( list, key );
if ( node == NULL )
return FTC_MruList_New( list, key, anode );
@ -269,8 +298,8 @@
FT_EXPORT_DEF( void )
FTC_MruList_Remove( FTC_MruList list,
FTC_MruNode node )
FTC_MruList_Remove( FTC_MruList list,
FTC_MruNode node )
{
FTC_MruNode_Remove( &list->nodes, node );
list->num_nodes--;
@ -278,23 +307,25 @@
{
FT_Memory memory = list->memory;
if ( list->clazz.node_done )
list->clazz.node_done( node, list->data );
FT_FREE( node );
}
if ( list->clazz.node_done )
list->clazz.node_done( node, list->data );
FT_FREE( node );
}
}
FT_EXPORT_DEF( void )
FTC_MruList_RemoveSelection( FTC_MruList list,
FTC_MruNode_CompareFunc select,
FTC_MruNode_CompareFunc selection,
FT_Pointer key )
{
FTC_MruNode first, node, next;
first = list->nodes;
while ( first && select( first, key ) )
while ( first && selection( first, key ) )
{
FTC_MruList_Remove( list, first );
first = list->nodes;
@ -307,7 +338,7 @@
{
next = node->next;
if ( select( node, key ) )
if ( selection( node, key ) )
FTC_MruList_Remove( list, node );
node = next;
@ -315,5 +346,5 @@
}
}
/* END */
/* END */

BIN
src/cache/ftcsbits.c vendored

Binary file not shown.

View File

@ -1,4 +1,4 @@
# FreeType 2 src/cff Jamfile (c) 2001 David Turner
# FreeType 2 src/cff Jamfile (c) 2001, 2002 David Turner
#
SubDir FT2_TOP $(FT2_SRC_DIR) cff ;

View File

@ -4,7 +4,7 @@
/* */
/* FreeType OpenType driver component (body only). */
/* */
/* Copyright 1996-2001 by */
/* Copyright 1996-2001, 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */

View File

@ -62,7 +62,7 @@ FT_BEGIN_HEADER
FT_LOCAL( FT_Byte )
cff_fd_select_get( CFF_FDSelect select,
cff_fd_select_get( CFF_FDSelect fdselect,
FT_UInt glyph_index );

View File

@ -4,7 +4,7 @@
/* */
/* CFF token stream parser (specification) */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */

View File

@ -1,4 +1,4 @@
# FreeType 2 src/pshinter Jamfile (c) 2001 David Turner
# FreeType 2 src/pshinter Jamfile (c) 2001, 2003 David Turner
#
SubDir FT2_TOP $(FT2_SRC_DIR) pshinter ;

View File

@ -4,7 +4,7 @@
/* */
/* Postscript (Type1/Type2) hints recorder (specification). */
/* */
/* Copyright 2001, 2002 by */
/* Copyright 2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */

View File

@ -4,7 +4,7 @@
/* */
/* Single object library component. */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */

View File

@ -4,7 +4,7 @@
/* */
/* TrueType new character mapping table (cmap) support (specification). */
/* */
/* Copyright 2002 by */
/* Copyright 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */

View File

@ -4,7 +4,7 @@
/* */
/* Type 42 font data types (specification only). */
/* */
/* Copyright 2002 by Roberto Alameda. */
/* Copyright 2002, 2003 by Roberto Alameda. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */

View File

@ -4,7 +4,7 @@
/* */
/* FreeType font driver for Windows FNT/FON files */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */