Formatting.
Cleaning up of ChangeLog. * docs/license.txt: s/X Windows/X Window System/. * src/raster/ftraster.c: Fix definition condition of MEM_Set(). * src/smooth/ftgrays.c (M_Y): Change value to 192. * src/base/ftdbgmem.c (ft_mem_table_destroy): Fix printf() parameter. Remove unused variable. * src/cache/ftcimage.c (ftc_image_node_init, ftc_image_node_compare): Remove unused variables. * src/cache/ftcsbits.c (ftc_sbit_node_weight): Remove unused variable. * src/raster/ftraster.c (MEM_Set): Move definition down to avoid compiler warning. * src/autohint/ahhint.c (ah_hinter_hint_edges): Use UNUSED() to avoid compiler warnings. * src/pcf/pcfread.c (tableNames): Use `const'. (pcf_read_TOC): Change counter name to avoid compiler warning. Use `const'. * src/pshinter/pshrec.c (ps_hints_close): Remove redundant declaration. * src/pshinter/pshalgo1.c (psh1_hint_table_init): Rename variables to avoid shadowing. * src/pshinter/pshalgo2.c (psh2_hint_table_activate_mask): Ditto. * src/type1/t1objs.h: Remove double declarations of `T1_Size_Init()' and `T1_Size_Done()'.
This commit is contained in:
parent
d0e6ad636f
commit
c3b2160869
328
ChangeLog
328
ChangeLog
@ -1,121 +1,178 @@
|
||||
2001-11-20 Antoine Leca <antoineleca@multimania.com>
|
||||
2001-12-05 David Krause <freetype@davidkrause.com>
|
||||
|
||||
* docs/license.txt: s/X Windows/X Window System/.
|
||||
|
||||
2001-12-04 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* src/raster/ftraster.c: Fix definition condition of MEM_Set().
|
||||
* src/smooth/ftgrays.c (M_Y): Change value to 192.
|
||||
* src/base/ftdbgmem.c (ft_mem_table_destroy): Fix printf() parameter.
|
||||
Remove unused variable.
|
||||
* src/cache/ftcimage.c (ftc_image_node_init,
|
||||
ftc_image_node_compare): Remove unused variables.
|
||||
* src/cache/ftcsbits.c (ftc_sbit_node_weight): Remove unused
|
||||
variable.
|
||||
* src/raster/ftraster.c (MEM_Set): Move definition down to avoid
|
||||
compiler warning.
|
||||
* src/autohint/ahhint.c (ah_hinter_hint_edges): Use UNUSED() to
|
||||
avoid compiler warnings.
|
||||
* src/pcf/pcfread.c (tableNames): Use `const'.
|
||||
(pcf_read_TOC): Change counter name to avoid compiler warning.
|
||||
Use `const'.
|
||||
* src/pshinter/pshrec.c (ps_hints_close): Remove redundant
|
||||
declaration.
|
||||
* src/pshinter/pshalgo1.c (psh1_hint_table_init): Rename variables
|
||||
to avoid shadowing.
|
||||
* src/pshinter/pshalgo2.c (psh2_hint_table_activate_mask): Ditto.
|
||||
* src/type1/t1objs.h: Remove double declarations of `T1_Size_Init()'
|
||||
and `T1_Size_Done()'.
|
||||
|
||||
2001-11-20 Antoine Leca <antoineleca@multimania.com>
|
||||
|
||||
* 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 OS/2 (TT_UCR_SURROGATES)
|
||||
which with OpenType v.1.3 now means "there is a character beyond
|
||||
FFFF in this font". Thanks to Detlef Wuerkner <TetiSoft@apg.lahn.de>
|
||||
for noticing this.
|
||||
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
|
||||
<TetiSoft@apg.lahn.de> for noticing this.
|
||||
|
||||
2001-11-20 David Turner <david@freetype.org>
|
||||
2001-11-20 David Turner <david@freetype.org>
|
||||
|
||||
* src/pshinter/{pshalgo2.c, pshalgo1.c}: fixed stupid bug in sorting
|
||||
routine that created nasty alignment artefacts.
|
||||
* src/pshinter/{pshalgo2.c, pshalgo1.c}: Fixed stupid bug in sorting
|
||||
routine that created nasty alignment artefacts.
|
||||
|
||||
* src/pshinter/pshrec.c, tests/gview.c: debugging updates..
|
||||
* src/pshinter/pshrec.c, tests/gview.c: Debugging updates.
|
||||
|
||||
* src/smooth/ftgrays.c: de-activated experimental gamme support,
|
||||
apparently, "optimal" gamma tables depend on the monitor type,
|
||||
resolution and general karma, so it's better to compute them outside
|
||||
of the rasterizer itself..
|
||||
* src/smooth/ftgrays.c: De-activated experimental gamma support.
|
||||
Apparently, `optimal' gamma tables depend on the monitor type,
|
||||
resolution and general karma, so it's better to compute them outside
|
||||
of the rasterizer itself.
|
||||
(gray_convert_glyph): Use `volatile' keyword.
|
||||
|
||||
2001-10-29 David Turner <david@freetype.org>
|
||||
|
||||
2001-10-29 David Turner <david@freetype.org>
|
||||
Adding experimental `gamma' support. This produces smoother glyphs
|
||||
at small sizes for very little cost.
|
||||
|
||||
* src/smooth/ftgrays.c: adding experimental "gamma" support. This
|
||||
produces smoother glyphs at small sizes for very little cost
|
||||
* src/smooth/ftgrays.c (grays_init_gamma): New function.
|
||||
(gray_raster_new): Use it.
|
||||
|
||||
* src/autohint/ahglyph.c, src/autohint/ahhint.c: various fixes to
|
||||
the auto-hinter. They merely improve the output of sans-serif fonts.
|
||||
Note that there are still problems with serifed fonts and composites
|
||||
(accented characters)
|
||||
Various fixes to the auto-hinter. They merely improve the output of
|
||||
sans-serif fonts. Note that there are still problems with serifed
|
||||
fonts and composites (accented characters).
|
||||
|
||||
* tests/gview.c: updated the debugging glyph viewer to show the
|
||||
hints generated by the "autohint" module
|
||||
* src/autohint/ahglyph.c (ah_outline_load,
|
||||
ah_outline_link_segments): Implement it.
|
||||
Fix typos.
|
||||
(ah_outline_save, ah_outline_compute_segments): Fix typos.
|
||||
* src/autohint/ahhint.c (ah_align_serif_edge): New argument
|
||||
`vertical'. Implement improvement.
|
||||
(ah_hint_edges_3, ah_hinter_hint_edges): Implement it.
|
||||
Fix typos.
|
||||
(ah_hinter_align_strong_points, ah_hinter_align_weak_points): Fix
|
||||
typos.
|
||||
(ah_hinter_load): Set `ah_debug_hinter' if DEBUG_HINTER is defined.
|
||||
* src/autohint/ahmodule.c: Implement support for DEBUG_HINTER macro.
|
||||
* src/autohint/ahtypes.h: Ditto.
|
||||
(AH_Hinter): Remove `disable_horz_edges' and `disable_vert_edges'
|
||||
(making them global as `ah_debug_disable_horz' and
|
||||
`ah_debug_disable_vert').
|
||||
Fix typos.
|
||||
|
||||
* tests/gview.c: Updated the debugging glyph viewer to show the
|
||||
hints generated by the "autohint" module.
|
||||
|
||||
2001-10-27 David Turner <david@freetype.org>
|
||||
2001-10-27 David Turner <david@freetype.org>
|
||||
|
||||
* src/cache/ftchunk.c (ftc_chunk_cache_lookup): fixed a bug that
|
||||
* src/cache/ftcchunk.c (ftc_chunk_cache_lookup): Fixed a bug that
|
||||
considerably lowered the performance of the abstract chunk cache.
|
||||
|
||||
2001-10-26 David Turner <david@freetype.org>
|
||||
|
||||
* 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 work well here.. but probably needs a bit more testing..
|
||||
2001-10-26 David Turner <david@freetype.org>
|
||||
|
||||
* 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
|
||||
work well here, but probably needs a bit more testing.
|
||||
|
||||
2001-10-26 Leonard Rosenthol <leonardr@lazerware.com>
|
||||
|
||||
* updated Mac OS README (builds/mac/) to reflect my taking over
|
||||
the project and that is now being actively maintained.
|
||||
* builds/mac/README: Updated to reflect my taking over the project
|
||||
and that is now being actively maintained.
|
||||
|
||||
* Applied patches from Paul Miller (<paulm@profoundeffects.com>)
|
||||
to /src/base/ftmac.c to support loading a face other than the
|
||||
* src/base/ftmac.c (parse_fond): Applied patches from Paul Miller
|
||||
<paulm@profoundeffects.com> to support loading a face other than the
|
||||
first from a FOND resource.
|
||||
|
||||
(FT_New_Face_From_FOND): Updated.
|
||||
|
||||
2001-10-25 Leonard Rosenthol <leonardr@lazerware.com>
|
||||
|
||||
* update CodeWarrior project for Mac OS (builds/mac/ftlib.prj)
|
||||
for latest version (7) of CWPro and for recent changes to the
|
||||
FT source tree.
|
||||
|
||||
* builds/mac/ftlib.prj: Update of CodeWarrior project file for Mac
|
||||
OS for latest version (7) of CWPro and for recent changes to the FT
|
||||
source tree.
|
||||
|
||||
2001-10-25 David Turner <david@freetype.org>
|
||||
|
||||
* include/freetype/config/ftoption.h: updated comment to explain
|
||||
* include/freetype/config/ftoption.h: Updated comments to explain
|
||||
precisely how to use project-specific macro definitions without
|
||||
modifying this file manually..
|
||||
modifying this file manually.
|
||||
|
||||
(FT_CONFIG_FORCE_INT64): Define.
|
||||
|
||||
2001-10-24 Tom Kacvinsky <tkacvins@freetype.org>
|
||||
(FT_DEBUG_MEMORY): New macro.
|
||||
|
||||
* builds/unix/ftsystem.c (FT_New_Memory): Added a missing `{'.
|
||||
2001-10-24 Tom Kacvinsky <tkacvins@freetype.org>
|
||||
|
||||
* builds/unix/ftsystem.c (FT_New_Memory): Added a missing `{'.
|
||||
|
||||
2001-10-23 David Turner <david@freetype.org>
|
||||
|
||||
* include/freetype/internal/ftmemory.h, src/base/ftdbgmem.c:
|
||||
improvements to the memory debugger to report more information in
|
||||
case of errors. Also, some allocations that occured through
|
||||
REALLOC couldn't be previously catched correctly..
|
||||
Improvements to the memory debugger to report more information in
|
||||
case of errors. Also, some allocations that occured through REALLOC
|
||||
couldn't be previously catched correctly.
|
||||
|
||||
* src/autohint/ahglyph.c (ah_outline_compute_segments,
|
||||
ah_outline_compute_edges), src/raster/ftraster.c (ft_black_new),
|
||||
src/smooth/ftgrays.c (gray_render_span, gray_raster_new): Replaced
|
||||
liberal uses of memset() by the MEM_Set() macro.
|
||||
|
||||
* src/autohint/ahglyph.c, src/raster/ftraster.c,
|
||||
src/smooth/ftgrays.c: replaced liberal uses of "memset" by the
|
||||
MEM_Set macro instead..
|
||||
2001-10-23 David Turner <david@freetype.org>
|
||||
|
||||
* src/raster/ftraster.c (Update): Removed to be inlined in ...
|
||||
(Sort): Updated.
|
||||
|
||||
2001-10-22 David Turner <david@freetype.org>
|
||||
|
||||
* builds/unix/ftsystem.c, builds/vms/ftsystem.c,
|
||||
builds/amiga/ftsystem.c, src/base/ftdbgmem.c: updated the memory
|
||||
debugger and platform-specific implementations of 'ftsystem' in order
|
||||
to be able to debug memory allocations on Unix, VMS and Amiga too !!
|
||||
* builds/unix/ftsystem.c (FT_New_Memory, FT_Done_Memory),
|
||||
builds/vms/ftsystem.c (FT_New_Memory, FT_Done_Memory),
|
||||
builds/amiga/ftsystem.c (FT_New_Memory, FT_Done_Memory),
|
||||
src/base/ftdbgmem.c: Updated the memory debugger and
|
||||
platform-specific implementations of `ftsystem' in order to be able
|
||||
to debug memory allocations on Unix, VMS and Amiga too!
|
||||
|
||||
* src/pshinter/pshalgo2.c (psh2_hint_table_record_mask): removed some
|
||||
bogus warnings..
|
||||
* src/pshinter/pshalgo2.c (psh2_hint_table_record_mask): Removed
|
||||
some bogus warnings.
|
||||
|
||||
* include/freetype/internal/ftmemory.h, src/base/ftdbgmem.c: modified
|
||||
the debugging memory manager to report the location (source file name
|
||||
+ line number) where leaked memory blocks are allocated in the source
|
||||
file.. funny, isn't it ??
|
||||
* include/freetype/internal/ftmemory.h, src/base/ftdbgmem.c:
|
||||
Modified the debugging memory manager to report the location (source
|
||||
file name + line number) where leaked memory blocks are allocated in
|
||||
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 will record
|
||||
every memory block allocated and report simple errors like memory
|
||||
leaks and double deletes.
|
||||
* src/base/ftdbgmem.c: New debugging memory manager. You must
|
||||
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.
|
||||
|
||||
* include/freetype/config/ftoption.h: added the FT_DEBUG_MEMORY macro
|
||||
definition
|
||||
* src/base/Jamfile: Include ftdbgmem.
|
||||
* src/base/rules.mk: Ditto.
|
||||
* src/base/ftbase.c: Include ftdbgmem.c.
|
||||
|
||||
* src/base/ftsystem.c (FT_New_Memory, FT_Done_Memory): modified the
|
||||
* include/freetype/config/ftoption.h: Added the FT_DEBUG_MEMORY
|
||||
macro definition.
|
||||
|
||||
* src/base/ftsystem.c (FT_New_Memory, FT_Done_Memory): Modified the
|
||||
base component to use the debugging memory manager when the macro
|
||||
FT_DEBUG_MEMORY is defined..
|
||||
FT_DEBUG_MEMORY is defined.
|
||||
|
||||
2001-10-21 Tom Kacvinsky <tkacvins@freetype.org>
|
||||
|
||||
@ -129,12 +186,11 @@
|
||||
* src/cff/cffload.c (CFF_Done_Font): Free the subfonts array to
|
||||
avoid a memory leak.
|
||||
|
||||
2001-10-21 David Turner <david@freetype.org>
|
||||
2001-10-21 David Turner <david@freetype.org>
|
||||
|
||||
* src/pshinter/pshalgo2.c, src/pshinter/pshalgo1.c,
|
||||
src/pshinter/pshglob.c: removing compiler warnings in pedantic modes
|
||||
(in multi-object compilation mode, mainly)
|
||||
|
||||
src/pshinter/pshglob.c: Removing compiler warnings in pedantic modes
|
||||
(in multi-object compilation mode, mainly).
|
||||
|
||||
2001-10-20 Tom Kacvinsky <tkacvins@freetype.org>
|
||||
|
||||
@ -150,91 +206,90 @@
|
||||
objects were not deallocated when the objects were parsed the
|
||||
second time.
|
||||
|
||||
2001-10-19 David Turner <david@freetype.org>
|
||||
|
||||
2001-10-19 David Turner <david@freetype.org>
|
||||
* src/smooth/ftgrays.c, src/pshinter/pshglob.h,
|
||||
src/pshinter/pshrec.c, src/pshinter/pshalgo2.c: Getting rid of
|
||||
compiler warnings.
|
||||
|
||||
* src/smooth/ftgrays.c, src/pshinter/pshglob.h, src/pshinter/pshrec.c,
|
||||
src/pshinter/pshalgo2.c: getting rid of compiler warnings
|
||||
* src/pshinter/module.mk, src/pshinter/rules.mk: Adding control
|
||||
files to build the PostScript hinter with the "old" build system.
|
||||
|
||||
* src/pshinter/module.mk, src/pshinter/rules.mk: adding control files
|
||||
to build the postscript hinter with the "old" build system
|
||||
2001-10-19 Jacob Jansen <joukj@hrem.stm.tudelft.nl>
|
||||
|
||||
2001-10-19 Jacob Jansen <joukj@hrem.stm.tudelft.nl>
|
||||
|
||||
* descrip.mms, src/pshinter/descrip.mms: updates to the VMS build
|
||||
* descrip.mms, src/pshinter/descrip.mms: Updates to the VMS build
|
||||
files.
|
||||
|
||||
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. The old one
|
||||
contained a bug (yes !!) that made FreeType return incorrect glyph
|
||||
names for certain glyphs..
|
||||
* src/psnames/pstables.h, src/tools/glnames.py: Rewrote the
|
||||
"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.
|
||||
|
||||
* src/truetype/ttdriver.c: changing computation of pixel size from
|
||||
character size to use rounding. This is an experiment to see if this
|
||||
gives values similar to Windows for scaled ascent/descent/etc..
|
||||
* src/truetype/ttdriver.c (Set_Char_Sizes): Changing computation of
|
||||
pixel size from character size to use rounding. This is an
|
||||
experiment to see whether this gives values similar to Windows for
|
||||
scaled ascent/descent/etc.
|
||||
|
||||
* src/base/ftcalc.c (FT_Div64by32): changed the implementation
|
||||
slightly since the original code was mis-compiled on Mac machines
|
||||
using the MPW C compiler..
|
||||
* src/base/ftcalc.c (FT_Div64by32): Changed the implementation
|
||||
slightly since the original code was mis-compiled on Mac machines
|
||||
using the MPW C compiler.
|
||||
|
||||
* src/base/ftobjs.c (FT_Realloc): when a memory block was grown
|
||||
through FT_Realloc, the new bytes were not set to 0, which created
|
||||
some strange bugs in the Postscript hinter
|
||||
* src/base/ftobjs.c (FT_Realloc): When a memory block was grown
|
||||
through FT_Realloc(), the new bytes were not set to 0, which created
|
||||
some strange bugs in the PostScript hinter.
|
||||
(destroy_face): Don't deallocate unconditionally.
|
||||
|
||||
* src/cid/cidgload.c: adding support to new postscript hinter
|
||||
* src/cid/cidgload.c (CID_Compute_Max_Advance, CID_Load_Glyph):
|
||||
Adding support to new PostScript hinter.
|
||||
|
||||
* include/freetype/internal/psglobal.h,
|
||||
include/freetype/internal/pshints.h,
|
||||
include/freetype/config/ftmodule.h,
|
||||
src/pshinter/Jamfile,
|
||||
src/pshinter/pshalgo.h,
|
||||
src/pshinter/pshalgo1.h,
|
||||
src/pshinter/pshalgo1.c,
|
||||
src/pshinter/pshalgo2.h,
|
||||
src/pshinter/pshalgo2.c,
|
||||
src/pshinter/pshglob.h,
|
||||
src/pshinter/pshglob.c,
|
||||
src/pshinter/pshinter.c,
|
||||
src/pshinter/pshmod.c,
|
||||
src/pshinter/pshmod.h,
|
||||
src/pshinter/pshrec.c,
|
||||
src/pshinter/pshrec.h : Adding new postscript hinter module
|
||||
|
||||
* include/freetype/internal/ftobjs.h,
|
||||
include/freetype/internal/internal.h,
|
||||
include/freetype/internal/psaux.h,
|
||||
include/freetype/internal/t1types.h,
|
||||
src/psaux/psobjs.c,
|
||||
src/psaux/psobjs.h,
|
||||
src/psaux/t1decode.h,
|
||||
src/psaux/t1decode.c,
|
||||
src/type1/t1driver.c,
|
||||
src/type1/t1gload.c,
|
||||
src/type1/t1objs.c,
|
||||
src/type1/t1objs.h : updates to use the new postscript hinter
|
||||
|
||||
* 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..
|
||||
* include/freetype/internal/psglobal.h,
|
||||
include/freetype/internal/pshints.h,
|
||||
include/freetype/config/ftmodule.h, src/pshinter/Jamfile,
|
||||
src/pshinter/pshalgo.h, src/pshinter/pshalgo1.h,
|
||||
src/pshinter/pshalgo1.c, src/pshinter/pshalgo2.h,
|
||||
src/pshinter/pshalgo2.c, src/pshinter/pshglob.h,
|
||||
src/pshinter/pshglob.c, src/pshinter/pshinter.c,
|
||||
src/pshinter/pshmod.c, src/pshinter/pshmod.h, src/pshinter/pshrec.c,
|
||||
src/pshinter/pshrec.h: Adding new PostScript hinter module.
|
||||
|
||||
* include/freetype/internal/ftobjs.h,
|
||||
include/freetype/internal/internal.h,
|
||||
include/freetype/internal/psaux.h,
|
||||
include/freetype/internal/t1types.h, src/psaux/psobjs.c,
|
||||
src/psaux/psobjs.h, src/psaux/t1decode.h, src/psaux/t1decode.c,
|
||||
src/type1/t1driver.c, src/type1/t1gload.c, src/type1/t1objs.c,
|
||||
src/type1/t1objs.h: Updates to use the new PostScript hinter.
|
||||
|
||||
* 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.
|
||||
|
||||
2001-10-17 David Turner <david@freetype.org>
|
||||
|
||||
|
||||
* Version 2.0.5 released.
|
||||
=========================
|
||||
|
||||
|
||||
* include/freetype/freetype.h, include/internal/ftobjs.h,
|
||||
src/base/ftobjs.c, src/sfnt/sfdriver.c, type1/t1driver.c,
|
||||
cid/cidriver.c: Adding a new function named 'FT_Get_Postscript_Name' to
|
||||
retrieve the Postscript name of a given font. Should work with all
|
||||
formats except pure CFF/CEF fonts (this will be added soon).
|
||||
src/base/ftobjs.c, src/type1/t1driver.c: Adding a new function named
|
||||
'FT_Get_Postscript_Name' to retrieve the PostScript name of a given
|
||||
font. Should work with all formats except pure CFF/CEF fonts (this
|
||||
will be added soon).
|
||||
|
||||
* README, docs/CHANGES: updated for 2.0.5 release
|
||||
* src/cid/cidriver (cid_get_postscript_name): New function.
|
||||
(CID_Get_Interface): Handle `postscript_name' interface.
|
||||
|
||||
* src/sfnt/sfdriver.c (get_sfnt_postscript_name): New function.
|
||||
(SFNT_Get_Interface): Handle `postscript_name' interface.
|
||||
|
||||
* src/type1/t1driver.c (t1_get_ps_name): New function.
|
||||
(Get_Interface): Handle `postscript_name' interface.
|
||||
|
||||
* README, docs/CHANGES: Updated for 2.0.5 release.
|
||||
|
||||
2001-10-08 David Turner <david@freetype.org>
|
||||
|
||||
@ -1418,7 +1473,7 @@
|
||||
2001-01-01 Francesco Zappa Nardelli <francesco.zappa.nardelli@ens.fr>
|
||||
|
||||
* src/pcf/*: New driver module for PCF font format (used in
|
||||
X Windows).
|
||||
X Window System).
|
||||
* include/freetype/internal/ftdebug.h (FT_Trace): Added values for
|
||||
PCF driver.
|
||||
* include/freetype/internal/pcftypes.h: New file.
|
||||
@ -1665,9 +1720,11 @@
|
||||
|
||||
2000-12-01 David Turner <david.turner@freetype.org>
|
||||
|
||||
|
||||
* Version 2.0.1 released.
|
||||
=========================
|
||||
|
||||
|
||||
* 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.
|
||||
@ -1873,6 +1930,7 @@
|
||||
|
||||
2000-11-09 David Turner <david@freetype.org>
|
||||
|
||||
|
||||
* Version 2.0 released.
|
||||
=======================
|
||||
|
||||
|
1
Jamfile
1
Jamfile
@ -21,7 +21,6 @@ if $(DEBUG_HINTER)
|
||||
}
|
||||
|
||||
|
||||
|
||||
# We need "freetype2/include" in the current include path in order to
|
||||
# compile any part of FreeType 2.
|
||||
#
|
||||
|
@ -9,41 +9,41 @@
|
||||
* (These amiga.lib functions work under AmigaOS V33 and up)
|
||||
*/
|
||||
extern APTR __asm AsmCreatePool(register __d0 ULONG memFlags,
|
||||
register __d1 ULONG puddleSize,
|
||||
register __d2 ULONG threshSize,
|
||||
register __a6 struct ExecBase *SysBase);
|
||||
register __d1 ULONG puddleSize,
|
||||
register __d2 ULONG threshSize,
|
||||
register __a6 struct ExecBase *SysBase);
|
||||
|
||||
extern VOID __asm AsmDeletePool(register __a0 APTR poolHeader,
|
||||
register __a6 struct ExecBase *SysBase);
|
||||
register __a6 struct ExecBase *SysBase);
|
||||
|
||||
extern APTR __asm AsmAllocPooled(register __a0 APTR poolHeader,
|
||||
register __d0 ULONG memSize,
|
||||
register __a6 struct ExecBase *SysBase);
|
||||
register __d0 ULONG memSize,
|
||||
register __a6 struct ExecBase *SysBase);
|
||||
|
||||
extern VOID __asm AsmFreePooled(register __a0 APTR poolHeader,
|
||||
register __a1 APTR memory,
|
||||
register __d0 ULONG memSize,
|
||||
register __a6 struct ExecBase *SysBase);
|
||||
register __a1 APTR memory,
|
||||
register __d0 ULONG memSize,
|
||||
register __a6 struct ExecBase *SysBase);
|
||||
|
||||
|
||||
// TetiSoft: C implementation of AllocVecPooled (see autodoc exec/AllocPooled)
|
||||
APTR AllocVecPooled(APTR poolHeader, ULONG memSize)
|
||||
{
|
||||
ULONG newSize = memSize + 4;
|
||||
ULONG *mem = AsmAllocPooled(poolHeader, newSize, SysBase);
|
||||
ULONG newSize = memSize + 4;
|
||||
ULONG *mem = AsmAllocPooled(poolHeader, newSize, SysBase);
|
||||
|
||||
if (!mem)
|
||||
return NULL;
|
||||
*mem = newSize;
|
||||
return mem + 1;
|
||||
if (!mem)
|
||||
return NULL;
|
||||
*mem = newSize;
|
||||
return mem + 1;
|
||||
}
|
||||
|
||||
// TetiSoft: C implementation of FreeVecPooled (see autodoc exec/AllocPooled)
|
||||
void FreeVecPooled(APTR poolHeader, APTR memory)
|
||||
{
|
||||
ULONG *realmem = (ULONG *)memory - 1;
|
||||
ULONG *realmem = (ULONG *)memory - 1;
|
||||
|
||||
AsmFreePooled(poolHeader, realmem, *realmem, SysBase);
|
||||
AsmFreePooled(poolHeader, realmem, *realmem, SysBase);
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
@ -215,7 +215,7 @@ void FreeVecPooled(APTR poolHeader, APTR memory)
|
||||
/* We use the macro STREAM_FILE for convenience to extract the */
|
||||
/* system-specific stream handle from a given FreeType stream object */
|
||||
//#define STREAM_FILE( stream ) ( (FILE*)stream->descriptor.pointer )
|
||||
#define STREAM_FILE( stream ) ( (BPTR)stream->descriptor.pointer ) // TetiSoft
|
||||
#define STREAM_FILE( stream ) ( (BPTR)stream->descriptor.pointer ) // TetiSoft
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
@ -233,7 +233,7 @@ void FreeVecPooled(APTR poolHeader, APTR memory)
|
||||
ft_close_stream( FT_Stream stream )
|
||||
{
|
||||
// fclose( STREAM_FILE( stream ) );
|
||||
Close( STREAM_FILE( stream ) ); // TetiSoft
|
||||
Close( STREAM_FILE( stream ) ); // TetiSoft
|
||||
|
||||
stream->descriptor.pointer = NULL;
|
||||
stream->size = 0;
|
||||
@ -268,13 +268,13 @@ void FreeVecPooled(APTR poolHeader, APTR memory)
|
||||
unsigned long count )
|
||||
{
|
||||
// FILE* file;
|
||||
BPTR file; // TetiSoft
|
||||
BPTR file; // TetiSoft
|
||||
|
||||
|
||||
file = STREAM_FILE( stream );
|
||||
|
||||
// fseek( file, offset, SEEK_SET );
|
||||
Seek( file, offset, OFFSET_BEGINNING ); // TetiSoft
|
||||
Seek( file, offset, OFFSET_BEGINNING ); // TetiSoft
|
||||
|
||||
// return (unsigned long)fread( buffer, 1, count, file );
|
||||
return (unsigned long)FRead( file, buffer, 1, count);
|
||||
@ -288,15 +288,15 @@ void FreeVecPooled(APTR poolHeader, APTR memory)
|
||||
FT_Stream astream )
|
||||
{
|
||||
// FILE* file;
|
||||
BPTR file; // TetiSoft
|
||||
struct FileInfoBlock *fib; // TetiSoft
|
||||
BPTR file; // TetiSoft
|
||||
struct FileInfoBlock *fib; // TetiSoft
|
||||
|
||||
|
||||
if ( !astream )
|
||||
return FT_Err_Invalid_Stream_Handle;
|
||||
|
||||
// file = fopen( filepathname, "rb" );
|
||||
file = Open( filepathname, MODE_OLDFILE ); // TetiSoft
|
||||
file = Open( filepathname, MODE_OLDFILE ); // TetiSoft
|
||||
if ( !file )
|
||||
{
|
||||
FT_ERROR(( "FT_New_Stream:" ));
|
||||
@ -346,7 +346,6 @@ void FreeVecPooled(APTR poolHeader, APTR memory)
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef FT_DEBUG_MEMORY
|
||||
|
||||
extern FT_Int
|
||||
|
@ -7,4 +7,4 @@ The library will be built as a static lib in the obj/ folder.
|
||||
Current maintainer: Leonard Rosenthol, <leonardr@lazerware.com>
|
||||
Originally prepared by Just van Rossum, <just@letterror.com>
|
||||
|
||||
This directory is now actively maintained as part of the FreeType Project
|
||||
This directory is now actively maintained as part of the FreeType Project.
|
||||
|
81
docs/BUGS
81
docs/BUGS
@ -12,7 +12,7 @@ we can use abbreviations here, like:
|
||||
|
||||
"David" for David Turner
|
||||
"Werner" for Werner Lemberg
|
||||
etc.
|
||||
etc.
|
||||
|
||||
"Reproduceable" indicates whether the bug could be reproduced by the
|
||||
development team or not (it can be specific to a given platform), whether it
|
||||
@ -108,7 +108,6 @@ BAD-TT-RENDERING
|
||||
bytecode-hinted glyphs! Something seems to be really broken here!
|
||||
|
||||
|
||||
|
||||
BAD-THIN-LINES
|
||||
|
||||
It seems that the anti-aliased renderer in FreeType has problems rendering
|
||||
@ -116,7 +115,6 @@ BAD-THIN-LINES
|
||||
FT_Outline_Render() function.
|
||||
|
||||
|
||||
|
||||
NOT-WINDOWS-METRICS
|
||||
|
||||
FreeType doesn't always return the same metrics as Windows for ascender,
|
||||
@ -128,68 +126,61 @@ NOT-WINDOWS-METRICS
|
||||
BAD-T1-CHARMAP
|
||||
|
||||
Type1 driver doesn't read "cacute" and "lslash" characters from iso8859-2
|
||||
charset. Those characters are mapped as MAC-one in glnames.py, so they
|
||||
charset. Those characters are mapped as MAC-one in glnames.py, so they
|
||||
cannot be shown in Adobe Type1 fonts.
|
||||
|
||||
(this was due to a bug in the "glnames.py" script used to generate the
|
||||
table of glyph names in 'src/psaux/pstables.h')
|
||||
(This was due to a bug in the "glnames.py" script used to generate the
|
||||
table of glyph names in 'src/psaux/pstables.h'.)
|
||||
|
||||
|
||||
BAD-UNIXXX-NAMES
|
||||
|
||||
Glyph names like uniXXXX are not recognized as they should be.
|
||||
It seems that code in psmodule.c for uniXXXX glyph names was
|
||||
never tested. The patch is very simple.
|
||||
Glyph names like uniXXXX are not recognized as they should be. It seems
|
||||
that code in psmodule.c for uniXXXX glyph names was never tested. The
|
||||
patch is very simple.
|
||||
|
||||
(a simple bug that was left un-noticed due to the fact that I don't have
|
||||
any Postscript font that use this convention, unfortunately..)
|
||||
(A simple bug that was left un-noticed due to the fact that I don't have
|
||||
any Postscript font that use this convention, unfortunately.)
|
||||
|
||||
|
||||
ADVANCED-COMPOSITES
|
||||
|
||||
Provided by George Williams <pfaedit@users.sourceforge.net>:
|
||||
|
||||
I notice that truetype/ttgload.c only supports Apple's
|
||||
definition of offsets for composit glyphs. Apple and
|
||||
Microsoft behave differently if there is a scale
|
||||
factor. OpenType defines some bits to disambiguate.
|
||||
I notice that truetype/ttgload.c only supports Apple's definition of
|
||||
offsets for composite glyphs. Apple and Microsoft behave differently if
|
||||
there is a scale factor. OpenType defines some bits to disambiguate.
|
||||
|
||||
(a problem in both 2.0.4 and 2.0.5)
|
||||
(A problem in both 2.0.4 and 2.0.5.)
|
||||
|
||||
Apple says
|
||||
(http://fonts.apple.com/TTRefMan/RM06/Chap6glyf.html)
|
||||
that if flags&ARGS_ARE_XY is set then the offsets
|
||||
should be scaled by the scale factors (as you have
|
||||
done), but they also say something very cryptic about
|
||||
what happens when the component is rotated at 45°
|
||||
(which you do not support)-- See the "Important" note
|
||||
at the bottom.
|
||||
Apple says (http://fonts.apple.com/TTRefMan/RM06/Chap6glyf.html) that if
|
||||
flags&ARGS_ARE_XY is set then the offsets should be scaled by the scale
|
||||
factors (as you have done), but they also say something very cryptic
|
||||
about what happens when the component is rotated at 45° (which you do
|
||||
not support) -- See the "Important" note at the bottom.
|
||||
|
||||
The old truetype spec from Microsoft did not mention
|
||||
this. The OpenType spec
|
||||
(http://www.microsoft.com/typography/otspec/glyf.htm,
|
||||
http://partners.adobe.com/asn/developer/opentype/glyf.html)
|
||||
efines two new bits to disambiguate:
|
||||
SCALED_COMPONENT_OFFSET 11
|
||||
Composite designed to have the component offset scaled
|
||||
(designed for Apple rasterizer)
|
||||
UNSCALED_COMPONENT_OFFSET 12
|
||||
Composite designed not to have the component offset
|
||||
scaled (designed for the Microsoft TrueType rasterizer)
|
||||
The old truetype spec from Microsoft did not mention this. The OpenType
|
||||
spec (http://www.microsoft.com/typography/otspec/glyf.htm,
|
||||
http://partners.adobe.com/asn/developer/opentype/glyf.html) defines two
|
||||
new bits to disambiguate:
|
||||
|
||||
SCALED_COMPONENT_OFFSET 11
|
||||
Composite designed to have the component offset scaled (designed for
|
||||
Apple rasterizer)
|
||||
|
||||
UNSCALED_COMPONENT_OFFSET 12
|
||||
Composite designed not to have the component offset scaled (designed
|
||||
for the Microsoft TrueType rasterizer)
|
||||
|
||||
Perhaps you could add a load_flag to allow the user to
|
||||
define the default setting?
|
||||
Perhaps you could add a load_flag to allow the user to define the
|
||||
default setting?
|
||||
|
||||
David says:
|
||||
|
||||
Wow, I was not even aware of this, it will probably take a little
|
||||
time to implement since I don't have any font that implement these
|
||||
"features", and also because I believe that we're running out of
|
||||
bits for "load_flag", some other way to set preferences is probably
|
||||
needed..
|
||||
Wow, I was not even aware of this, it will probably take a little time
|
||||
to implement since I don't have any font that implement these
|
||||
"features", and also because I believe that we're running out of bits
|
||||
for "load_flag", some other way to set preferences is probably needed.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
=== end of file ===
|
||||
|
14
docs/CHANGES
14
docs/CHANGES
@ -1,13 +1,13 @@
|
||||
LATEST CHANGES BETWEEN 2.0.6 and 2.0.5
|
||||
|
||||
- a new Postscript hinter module has been added to support native hints
|
||||
in the following formats: Postscript Type 1, Postscript CID and CFF/CEF
|
||||
- A new Postscript hinter module has been added to support native hints in
|
||||
the following formats: Postscript Type 1, Postscript CID and CFF/CEF.
|
||||
|
||||
(for now, only the Type 1 driver uses it, the "cid" and "cff" drivers
|
||||
will be updated shortly)
|
||||
(For now, only the Type 1 driver uses it; the "cid" and "cff" drivers
|
||||
will be updated shortly.)
|
||||
|
||||
- "glnames.py" still contained a bug !! that made FreeType return invalid
|
||||
names for certain glyphs..
|
||||
- "glnames.py" still contained a bug that made FreeType return invalid
|
||||
names for certain glyphs.
|
||||
|
||||
============================================================================
|
||||
|
||||
@ -44,7 +44,7 @@ LATEST CHANGES BETWEEN 2.0.5 and 2.0.4
|
||||
index of a given glyph name, when found in a face.
|
||||
|
||||
- Added a new function named "FT_Get_Postscript_Name" to retrieve the
|
||||
"unique" Postscript font name of a given face
|
||||
"unique" Postscript font name of a given face.
|
||||
|
||||
- Added a new public header size named FT_SIZES_H (or <freetype/ftsizes.h>)
|
||||
providing new FT_Size-management functions: FT_New_Size, FT_Activate_Size,
|
||||
|
@ -6,5 +6,6 @@ fits your needs best:
|
||||
|
||||
. The GNU General Public License, in file `docs/GPL.txt'.
|
||||
|
||||
The contributed PCF driver comes with a license similar to that of X Windows
|
||||
which is compatible to the above two licenses (see file src/pcf/readme).
|
||||
The contributed PCF driver comes with a license similar to that of X Window
|
||||
System which is compatible to the above two licenses (see file
|
||||
src/pcf/readme).
|
||||
|
46
include/freetype/cache/ftcchunk.h
vendored
46
include/freetype/cache/ftcchunk.h
vendored
@ -58,9 +58,9 @@ FT_BEGIN_HEADER
|
||||
#define FTC_MAX_CHUNK_SETS 16
|
||||
|
||||
|
||||
typedef struct FTC_ChunkNodeRec_* FTC_ChunkNode;
|
||||
typedef struct FTC_ChunkSetRec_* FTC_ChunkSet;
|
||||
typedef struct FTC_ChunkCacheRec_* FTC_ChunkCache;
|
||||
typedef struct FTC_ChunkNodeRec_* FTC_ChunkNode;
|
||||
typedef struct FTC_ChunkSetRec_* FTC_ChunkSet;
|
||||
typedef struct FTC_ChunkCacheRec_* FTC_ChunkCache;
|
||||
|
||||
typedef struct FTC_ChunkNodeRec_
|
||||
{
|
||||
@ -72,42 +72,42 @@ FT_BEGIN_HEADER
|
||||
|
||||
} FTC_ChunkNodeRec;
|
||||
|
||||
#define FTC_CHUNK_NODE(x) ((FTC_ChunkNode)(x))
|
||||
#define FTC_CHUNK_NODE( x ) ((FTC_ChunkNode)( x ))
|
||||
|
||||
/* a chunk set is used to categorize chunks of a given type */
|
||||
typedef struct FTC_ChunkSetRec_
|
||||
/* a chunk set is used to categorize chunks of a given type */
|
||||
typedef struct FTC_ChunkSetRec_
|
||||
{
|
||||
FT_LruNodeRec lru;
|
||||
FT_UFast hash;
|
||||
FTC_ChunkCache ccache;
|
||||
FT_Fast num_chunks;
|
||||
FT_UInt item_total; /* total number of glyphs in set */
|
||||
FT_UInt item_size; /* size of each glyph item in set */
|
||||
FT_UInt item_count; /* number of glyph items per chunk */
|
||||
FT_LruNodeRec lru;
|
||||
FT_UFast hash;
|
||||
FTC_ChunkCache ccache;
|
||||
FT_Fast num_chunks;
|
||||
FT_UInt item_total; /* total number of glyphs in set */
|
||||
FT_UInt item_size; /* size of each glyph item in set */
|
||||
FT_UInt item_count; /* number of glyph items per chunk */
|
||||
|
||||
} FTC_ChunkSetRec;
|
||||
|
||||
#define FTC_CHUNK_SET(x) ((FTC_ChunkSet)(x))
|
||||
#define FTC_CHUNK_SET( x ) ((FTC_ChunkSet)( x ))
|
||||
|
||||
#define FTC_CHUNK_SET_MEMORY(x) ((x)->ccache->cache.memory)
|
||||
#define FTC_CHUNK_SET_MEMORY( x ) (( x )->ccache->cache.memory)
|
||||
|
||||
/* the abstract chunk cache class */
|
||||
typedef struct FTC_ChunkCacheRec_
|
||||
/* the abstract chunk cache class */
|
||||
typedef struct FTC_ChunkCacheRec_
|
||||
{
|
||||
FTC_CacheRec cache;
|
||||
FT_LruList cset_lru; /* LRU list of chunk sets */
|
||||
FTC_CacheRec cache;
|
||||
FT_LruList cset_lru; /* LRU list of chunk sets */
|
||||
|
||||
} FTC_ChunkCacheRec;
|
||||
|
||||
#define FTC_CHUNK_CACHE(x) ((FTC_ChunkCache)(x))
|
||||
#define FTC_CHUNK_CACHE( x ) ((FTC_ChunkCache)( x ))
|
||||
|
||||
|
||||
typedef struct FTC_ChunkQueryRec_
|
||||
typedef struct FTC_ChunkQueryRec_
|
||||
{
|
||||
/* input */
|
||||
/* input */
|
||||
FT_UInt gindex; /* glyph index */
|
||||
|
||||
/* output */
|
||||
/* output */
|
||||
FTC_ChunkSet cset;
|
||||
|
||||
} FTC_ChunkQueryRec, *FTC_ChunkQuery;
|
||||
|
97
include/freetype/cache/ftcglyph.h
vendored
97
include/freetype/cache/ftcglyph.h
vendored
@ -64,61 +64,62 @@
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
/* each glyph set is caracterized by a "glyph set type" which must be */
|
||||
/* defined by sub-classes.. */
|
||||
typedef struct FTC_GlyphSetRec_* FTC_GlyphSet;
|
||||
/* each glyph set is caracterized by a "glyph set type" which must be */
|
||||
/* defined by sub-classes */
|
||||
typedef struct FTC_GlyphSetRec_* FTC_GlyphSet;
|
||||
|
||||
/* handle to a glyph cache node */
|
||||
typedef struct FTC_GlyphNodeRec_* FTC_GlyphNode;
|
||||
/* handle to a glyph cache node */
|
||||
typedef struct FTC_GlyphNodeRec_* FTC_GlyphNode;
|
||||
|
||||
/* a glyph cache, its nodes are all glyph-specific */
|
||||
typedef struct FTC_GlyphCacheRec_* FTC_GlyphCache;
|
||||
/* a glyph cache; its nodes are all glyph-specific */
|
||||
typedef struct FTC_GlyphCacheRec_* FTC_GlyphCache;
|
||||
|
||||
/* glyph sets class handle */
|
||||
typedef const struct FTC_GlyphSet_ClassRec_* FTC_GlyphSet_Class;
|
||||
/* glyph sets class handle */
|
||||
typedef const struct FTC_GlyphSet_ClassRec_* FTC_GlyphSet_Class;
|
||||
|
||||
|
||||
/* size should be 24 bytes on 32-bit machines */
|
||||
/* note that the node's hash is ((gset->hash << 16) | glyph_index) */
|
||||
/* this _must_ be set properly by the glyph node initializer */
|
||||
/* */
|
||||
typedef struct FTC_GlyphNodeRec_
|
||||
/* Size should be 24 bytes on 32-bit machines. */
|
||||
/* Note that the node's hash is ((gset->hash << 16) | glyph_index); */
|
||||
/* this _must_ be set properly by the glyph node initializer. */
|
||||
/* */
|
||||
typedef struct FTC_GlyphNodeRec_
|
||||
{
|
||||
FTC_NodeRec node;
|
||||
FTC_GlyphSet gset;
|
||||
FTC_NodeRec node;
|
||||
FTC_GlyphSet gset;
|
||||
|
||||
} FTC_GlyphNodeRec;
|
||||
|
||||
#define FTC_GLYPH_NODE(x) ((FTC_GlyphNode)(x))
|
||||
#define FTC_GLYPH_NODE_P(x) ((FTC_GlyphNode*)(x))
|
||||
#define FTC_GLYPH_NODE( x ) ((FTC_GlyphNode)( x ))
|
||||
#define FTC_GLYPH_NODE_P( x ) ((FTC_GlyphNode*)( x ))
|
||||
|
||||
|
||||
/* the glyph set structure. each glyph set is used to model a set of */
|
||||
/* glyphs of the same "type". The type itself is defined in sub-classes */
|
||||
/* */
|
||||
/* for example, the "image cache" uses face_id + character_pixel_sizes + */
|
||||
/* image_format to characterize glyph sets.. */
|
||||
/* */
|
||||
/* a pure "master outlines" cache would only use face_id, etc.. */
|
||||
/* */
|
||||
/* The glyph set structure. Each glyph set is used to model a set of */
|
||||
/* glyphs of the same "type". The type itself is defined in */
|
||||
/* sub-classes. */
|
||||
/* */
|
||||
/* For example, the "image cache" uses face_id + character_pixel_sizes + */
|
||||
/* image_format to characterize glyph sets. */
|
||||
/* */
|
||||
/* A pure "master outlines" cache would only use face_id, etc. */
|
||||
/* */
|
||||
typedef struct FTC_GlyphSetRec_
|
||||
{
|
||||
FT_LruNodeRec lru; /* glyph sets are LRU nodes within */
|
||||
FTC_GlyphCache gcache; /* parent cache.. */
|
||||
FT_UFast hash; /* must be set by initializer !! */
|
||||
FT_Fast num_glyphs; /* destroyed when 0.. */
|
||||
FTC_GlyphCache gcache; /* parent cache */
|
||||
FT_UFast hash; /* must be set by initializer! */
|
||||
FT_Fast num_glyphs; /* destroyed when 0 */
|
||||
|
||||
} FTC_GlyphSetRec;
|
||||
|
||||
#define FTC_GLYPH_SET(x) ((FTC_GlyphSet)(x))
|
||||
#define FTC_GLYPH_SET_P(x) ((FTC_GlyphSet*)(x))
|
||||
#define FTC_GLYPH_SET( x ) ((FTC_GlyphSet)( x ))
|
||||
#define FTC_GLYPH_SET_P( x ) ((FTC_GlyphSet*)( x ))
|
||||
|
||||
#define FTC_GLYPH_SET_MEMORY(x) ((x)->gcache->cache.memory)
|
||||
#define FTC_GLYPH_SET_MEMORY( x ) (( x )->gcache->cache.memory)
|
||||
|
||||
|
||||
/* retrieve glyph index of glyph node */
|
||||
#define FTC_GLYPH_NODE_GINDEX(x) \
|
||||
((FT_UInt)(FTC_GLYPH_NODE(x)->node.hash & 0xFFFF))
|
||||
/* retrieve glyph index of glyph node */
|
||||
#define FTC_GLYPH_NODE_GINDEX( x ) \
|
||||
((FT_UInt)(FTC_GLYPH_NODE( x )->node.hash & 0xFFFF))
|
||||
|
||||
/* the abstract glyph cache object */
|
||||
typedef struct FTC_GlyphCacheRec_
|
||||
@ -128,16 +129,16 @@ FT_BEGIN_HEADER
|
||||
|
||||
} FTC_GlyphCacheRec;
|
||||
|
||||
#define FTC_GLYPH_CACHE(x) ((FTC_GlyphCache)(x))
|
||||
#define FTC_GLYPH_CACHE_P(x) ((FTC_GlyphCache*)(x))
|
||||
#define FTC_GLYPH_CACHE( x ) ((FTC_GlyphCache)( x ))
|
||||
#define FTC_GLYPH_CACHE_P( x ) ((FTC_GlyphCache*)( x ))
|
||||
|
||||
|
||||
typedef struct FTC_GlyphQueryRec_
|
||||
typedef struct FTC_GlyphQueryRec_
|
||||
{
|
||||
/* input */
|
||||
/* input */
|
||||
FT_UInt gindex;
|
||||
|
||||
/* output */
|
||||
/* output */
|
||||
FTC_GlyphSet gset;
|
||||
|
||||
} FTC_GlyphQueryRec, *FTC_GlyphQuery;
|
||||
@ -150,37 +151,37 @@ FT_BEGIN_HEADER
|
||||
/* cache sub-system internals. */
|
||||
/* */
|
||||
|
||||
/* must be called by derived FTC_Node_InitFunc routines */
|
||||
/* must be called by derived FTC_Node_InitFunc routines */
|
||||
FT_EXPORT( void )
|
||||
ftc_glyph_node_init( FTC_GlyphNode node,
|
||||
FT_UInt gindex, /* glyph index for node */
|
||||
FTC_GlyphSet gset );
|
||||
|
||||
/* must be called by derived FTC_Node_DoneFunc routines */
|
||||
/* must be called by derived FTC_Node_DoneFunc routines */
|
||||
FT_EXPORT( void )
|
||||
ftc_glyph_node_done( FTC_GlyphNode node );
|
||||
|
||||
|
||||
/* can be used as a FTC_LruNode_InitFunc or called by sub-classes */
|
||||
/* can be used as an FTC_LruNode_InitFunc or called by sub-classes */
|
||||
FT_EXPORT( FT_Error )
|
||||
ftc_glyph_set_init( FTC_GlyphSet gset,
|
||||
FT_LruList list );
|
||||
|
||||
/* can be used as a FTC_LruNode_DoneFunc or called by sub-classes */
|
||||
/* can be used as an FTC_LruNode_DoneFunc or called by sub-classes */
|
||||
FT_EXPORT( void )
|
||||
ftc_glyph_set_done( FTC_GlyphSet gset );
|
||||
|
||||
|
||||
/* can be used as a FTC_Cache_DoneFunc or called by sub-classes */
|
||||
/* can be used as an FTC_Cache_DoneFunc or called by sub-classes */
|
||||
FT_EXPORT( void )
|
||||
ftc_glyph_cache_done( FTC_GlyphCache cache );
|
||||
ftc_glyph_cache_done( FTC_GlyphCache cache );
|
||||
|
||||
/* must be called in a FTC_Cache_InitFunc !! */
|
||||
/* must be called in an FTC_Cache_InitFunc! */
|
||||
FT_EXPORT( FT_Error )
|
||||
ftc_glyph_cache_init( FTC_GlyphCache cache,
|
||||
FT_LruList_Class gset_class );
|
||||
|
||||
/* can be called directly or from sub-classes */
|
||||
/* can be called directly or from sub-classes */
|
||||
FT_EXPORT( FT_Error )
|
||||
ftc_glyph_cache_lookup( FTC_GlyphCache cache,
|
||||
FTC_GlyphQuery query,
|
||||
|
16
include/freetype/cache/ftcimage.h
vendored
16
include/freetype/cache/ftcimage.h
vendored
@ -95,14 +95,16 @@ FT_BEGIN_HEADER
|
||||
|
||||
} FTC_Image_Desc;
|
||||
|
||||
/* */
|
||||
#define FTC_IMAGE_DESC_COMPARE( d1, d2 ) \
|
||||
( FTC_FONT_COMPARE( &(d1)->font, &(d2)->font ) && \
|
||||
(d1)->image_type == (d2)->image_type )
|
||||
|
||||
#define FTC_IMAGE_DESC_HASH(d) \
|
||||
(FT_UFast)( FTC_FONT_HASH(&(d)->font) ^ \
|
||||
((d)->image_type << 4) )
|
||||
/* */
|
||||
#define FTC_IMAGE_DESC_COMPARE( d1, d2 ) \
|
||||
( FTC_FONT_COMPARE( &(d1)->font, &(d2)->font ) && \
|
||||
(d1)->image_type == (d2)->image_type )
|
||||
|
||||
#define FTC_IMAGE_DESC_HASH( d ) \
|
||||
(FT_UFast)( FTC_FONT_HASH(&(d)->font) ^ \
|
||||
((d)->image_type << 4) )
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
|
109
include/freetype/cache/ftcmanag.h
vendored
109
include/freetype/cache/ftcmanag.h
vendored
@ -81,20 +81,20 @@ FT_BEGIN_HEADER
|
||||
|
||||
#define FTC_MAX_FACES_DEFAULT 2
|
||||
#define FTC_MAX_SIZES_DEFAULT 4
|
||||
#define FTC_MAX_BYTES_DEFAULT 100000L /* 200kByte by default! */
|
||||
#define FTC_MAX_BYTES_DEFAULT 100000L /* 100kByte by default! */
|
||||
|
||||
/* maximum number of caches registered in a single manager */
|
||||
#define FTC_MAX_CACHES 16
|
||||
|
||||
|
||||
/* handle to cache object */
|
||||
/* handle to cache object */
|
||||
typedef struct FTC_CacheRec_* FTC_Cache;
|
||||
|
||||
/* handle to cache class */
|
||||
/* handle to cache class */
|
||||
typedef const struct FTC_Cache_ClassRec_* FTC_Cache_Class;
|
||||
|
||||
/* handle to cache node */
|
||||
typedef struct FTC_NodeRec_* FTC_Node;
|
||||
/* handle to cache node */
|
||||
typedef struct FTC_NodeRec_* FTC_Node;
|
||||
|
||||
|
||||
|
||||
@ -113,7 +113,7 @@ FT_BEGIN_HEADER
|
||||
/* */
|
||||
/* sizes_list :: The lru list of FT_Size objects in the cache. */
|
||||
/* */
|
||||
/* max_weight :: The maximum cache pool weight.. */
|
||||
/* max_weight :: The maximum cache pool weight. */
|
||||
/* */
|
||||
/* cur_weight :: The current cache pool weight. */
|
||||
/* */
|
||||
@ -195,23 +195,23 @@ FT_BEGIN_HEADER
|
||||
/* */
|
||||
|
||||
|
||||
/* structure size should be 20 bytes on 32-bits machines */
|
||||
typedef struct FTC_NodeRec_
|
||||
/* structure size should be 20 bytes on 32-bits machines */
|
||||
typedef struct FTC_NodeRec_
|
||||
{
|
||||
FTC_Node mru_next; /* circular mru list pointer */
|
||||
FTC_Node mru_prev; /* circular mru list pointer */
|
||||
FTC_Node link; /* used for hashing.. */
|
||||
FT_UInt32 hash; /* used for hashing too.. */
|
||||
FT_UShort cache_index; /* index of cache the node belongs to */
|
||||
FT_Short ref_count; /* reference count for this node.. */
|
||||
FTC_Node mru_next; /* circular mru list pointer */
|
||||
FTC_Node mru_prev; /* circular mru list pointer */
|
||||
FTC_Node link; /* used for hashing */
|
||||
FT_UInt32 hash; /* used for hashing too */
|
||||
FT_UShort cache_index; /* index of cache the node belongs to */
|
||||
FT_Short ref_count; /* reference count for this node */
|
||||
|
||||
} FTC_NodeRec;
|
||||
|
||||
#define FTC_NODE(x) ((FTC_Node)(x))
|
||||
#define FTC_NODE_P(x) ((FTC_Node*)(x))
|
||||
#define FTC_NODE( x ) ((FTC_Node)( x ))
|
||||
#define FTC_NODE_P( x ) ((FTC_Node*)( x ))
|
||||
|
||||
|
||||
/* each cache really implements a dynamic hash table to manage its nodes */
|
||||
/* each cache really implements a dynamic hash table to manage its nodes */
|
||||
typedef struct FTC_CacheRec_
|
||||
{
|
||||
FTC_Manager manager;
|
||||
@ -228,41 +228,42 @@ FT_BEGIN_HEADER
|
||||
} FTC_CacheRec;
|
||||
|
||||
|
||||
#define FTC_CACHE(x) ((FTC_Cache)(x))
|
||||
#define FTC_CACHE_P(x) ((FTC_Cache*)(x))
|
||||
#define FTC_CACHE( x ) ((FTC_Cache)( x ))
|
||||
#define FTC_CACHE_P( x ) ((FTC_Cache*)( x ))
|
||||
|
||||
|
||||
/* initialize a given cache */
|
||||
/* initialize a given cache */
|
||||
typedef FT_Error
|
||||
(*FTC_Cache_InitFunc)( FTC_Cache cache );
|
||||
(*FTC_Cache_InitFunc)( FTC_Cache cache );
|
||||
|
||||
/* finalize a given cache */
|
||||
/* finalize a given cache */
|
||||
typedef void
|
||||
(*FTC_Cache_DoneFunc)( FTC_Cache cache );
|
||||
(*FTC_Cache_DoneFunc)( FTC_Cache cache );
|
||||
|
||||
/* initialize a new cache node */
|
||||
/* initialize a new cache node */
|
||||
typedef FT_Error
|
||||
(*FTC_Node_InitFunc)( FTC_Node node,
|
||||
FT_Pointer type,
|
||||
FTC_Cache cache );
|
||||
|
||||
/* compute the weight of a given cache node */
|
||||
/* compute the weight of a given cache node */
|
||||
typedef FT_ULong
|
||||
(*FTC_Node_WeightFunc)( FTC_Node node,
|
||||
FTC_Cache cache );
|
||||
(*FTC_Node_WeightFunc)( FTC_Node node,
|
||||
FTC_Cache cache );
|
||||
|
||||
/* compare a node to a given key pair */
|
||||
/* compare a node to a given key pair */
|
||||
typedef FT_Bool
|
||||
(*FTC_Node_CompareFunc)( FTC_Node node,
|
||||
FT_Pointer key,
|
||||
FTC_Cache cache );
|
||||
(*FTC_Node_CompareFunc)( FTC_Node node,
|
||||
FT_Pointer key,
|
||||
FTC_Cache cache );
|
||||
|
||||
/* finalize a given cache node */
|
||||
/* finalize a given cache node */
|
||||
typedef void
|
||||
(*FTC_Node_DoneFunc)( FTC_Node node,
|
||||
FTC_Cache cache );
|
||||
(*FTC_Node_DoneFunc)( FTC_Node node,
|
||||
FTC_Cache cache );
|
||||
|
||||
typedef struct FTC_Cache_ClassRec_
|
||||
|
||||
typedef struct FTC_Cache_ClassRec_
|
||||
{
|
||||
FT_UInt cache_size;
|
||||
FTC_Cache_InitFunc cache_init;
|
||||
@ -278,9 +279,9 @@ FT_BEGIN_HEADER
|
||||
|
||||
/* */
|
||||
|
||||
#define FTC_CACHE_RESIZE_TEST(c) \
|
||||
( (c)->nodes*3 < (c)->size || \
|
||||
(c)->size*3 < (c)->nodes )
|
||||
#define FTC_CACHE_RESIZE_TEST( c ) \
|
||||
( (c)->nodes*3 < (c)->size || \
|
||||
(c)->size*3 < (c)->nodes )
|
||||
|
||||
|
||||
/* this must be used internally for the moment */
|
||||
@ -290,35 +291,35 @@ FT_BEGIN_HEADER
|
||||
FTC_Cache *acache );
|
||||
|
||||
|
||||
/* can be used directory as FTC_Cache_DoneFunc, or called by custom */
|
||||
/* cache finalizers.. */
|
||||
/* can be used directly as FTC_Cache_DoneFunc(), or called by custom */
|
||||
/* cache finalizers */
|
||||
FT_EXPORT( void )
|
||||
ftc_cache_done( FTC_Cache cache );
|
||||
|
||||
/* initalize the hash table within the cache */
|
||||
/* initalize the hash table within the cache */
|
||||
FT_EXPORT( FT_Error )
|
||||
ftc_cache_init( FTC_Cache cache );
|
||||
|
||||
/* can be used when FTC_CACHE_RESIZE_TEST returns TRUE after a node */
|
||||
/* insertion.. */
|
||||
FT_EXPORT(void)
|
||||
/* can be used when FTC_CACHE_RESIZE_TEST returns TRUE after a node */
|
||||
/* insertion */
|
||||
FT_EXPORT( void )
|
||||
ftc_cache_resize( FTC_Cache cache );
|
||||
|
||||
|
||||
/* can be called when the key's hash value has been computed */
|
||||
FT_EXPORT(FT_Error)
|
||||
ftc_cache_lookup_node( FTC_Cache cache,
|
||||
FT_UFast key_hash,
|
||||
FT_Pointer key,
|
||||
FTC_Node *anode );
|
||||
/* can be called when the key's hash value has been computed */
|
||||
FT_EXPORT( FT_Error )
|
||||
ftc_cache_lookup_node( FTC_Cache cache,
|
||||
FT_UFast key_hash,
|
||||
FT_Pointer key,
|
||||
FTC_Node *anode );
|
||||
|
||||
/* can be called to increment a node's reference count */
|
||||
FT_EXPORT(void)
|
||||
/* can be called to increment a node's reference count */
|
||||
FT_EXPORT( void )
|
||||
ftc_node_ref( FTC_Node node,
|
||||
FTC_Cache cache );
|
||||
|
||||
/* can be called to decrement a node's reference count */
|
||||
FT_EXPORT(void)
|
||||
/* can be called to decrement a node's reference count */
|
||||
FT_EXPORT( void )
|
||||
ftc_node_unref( FTC_Node node,
|
||||
FTC_Cache cache );
|
||||
|
||||
|
47
include/freetype/cache/ftlru.h
vendored
47
include/freetype/cache/ftlru.h
vendored
@ -73,11 +73,12 @@ FT_BEGIN_HEADER
|
||||
typedef struct FT_LruListRec_* FT_LruList;
|
||||
|
||||
/* list class handle */
|
||||
typedef const struct FT_LruList_ClassRec_* FT_LruList_Class;
|
||||
typedef const struct FT_LruList_ClassRec_* FT_LruList_Class;
|
||||
|
||||
/* an list node handle */
|
||||
typedef struct FT_LruNodeRec_* FT_LruNode;
|
||||
/* a list node handle */
|
||||
typedef struct FT_LruNodeRec_* FT_LruNode;
|
||||
|
||||
|
||||
/* the list node structure */
|
||||
typedef struct FT_LruNodeRec_
|
||||
{
|
||||
@ -100,40 +101,40 @@ FT_BEGIN_HEADER
|
||||
} FT_LruListRec;
|
||||
|
||||
|
||||
/* initialize a list list */
|
||||
/* initialize a list list */
|
||||
typedef FT_Error (*FT_LruList_InitFunc)( FT_LruList list );
|
||||
|
||||
/* finalize a list list */
|
||||
/* finalize a list list */
|
||||
typedef void (*FT_LruList_DoneFunc)( FT_LruList list );
|
||||
|
||||
/* this method is used to initialize a new list element node */
|
||||
/* this method is used to initialize a new list element node */
|
||||
typedef FT_Error (*FT_LruNode_InitFunc)( FT_LruNode node,
|
||||
FT_LruKey key,
|
||||
FT_LruList list );
|
||||
|
||||
/* this method is used to finalize a given list element node */
|
||||
/* this method is used to finalize a given list element node */
|
||||
typedef void (*FT_LruNode_DoneFunc)( FT_LruNode node,
|
||||
FT_LruList list );
|
||||
|
||||
/* If defined, this method is called when the list if full */
|
||||
/* during the lookup process -- it is used to change the contents */
|
||||
/* of a list element node, instead of calling `done_element()', */
|
||||
/* then `init_element'. Set it to 0 for default behaviour. */
|
||||
/* If defined, this method is called when the list if full */
|
||||
/* during the lookup process -- it is used to change the contents */
|
||||
/* of a list element node, instead of calling `done_element()', */
|
||||
/* then `init_element()'. Set it to 0 for default behaviour. */
|
||||
typedef FT_Error (*FT_LruNode_FlushFunc)( FT_LruNode node,
|
||||
FT_LruKey new_key,
|
||||
FT_LruList list );
|
||||
|
||||
/* If defined, this method is used to compare a list element node */
|
||||
/* with a given key during a lookup. If set to 0, the `key' */
|
||||
/* fields will be directly compared instead. */
|
||||
/* If defined, this method is used to compare a list element node */
|
||||
/* with a given key during a lookup. If set to 0, the `key' */
|
||||
/* fields will be directly compared instead. */
|
||||
typedef FT_Bool (*FT_LruNode_CompareFunc)( FT_LruNode node,
|
||||
FT_LruKey key,
|
||||
FT_LruList list );
|
||||
|
||||
/* A selector is used to indicate whether a given list element node */
|
||||
/* is part of a selection for FT_LruList_Remove_Selection(). The function */
|
||||
/* must return true (i.e., non-null) to indicate that the node is part */
|
||||
/* of it. */
|
||||
/* A selector is used to indicate whether a given list element node */
|
||||
/* is part of a selection for FT_LruList_Remove_Selection(). The */
|
||||
/* functrion must return true (i.e., non-null) to indicate that the */
|
||||
/* node is part of it. */
|
||||
typedef FT_Bool (*FT_LruNode_SelectFunc)( FT_LruNode node,
|
||||
FT_Pointer data,
|
||||
FT_LruList list );
|
||||
@ -154,8 +155,8 @@ FT_BEGIN_HEADER
|
||||
} FT_LruList_ClassRec;
|
||||
|
||||
|
||||
/* the following functions must be exported in the case where applications */
|
||||
/* would want to write their own cache classes.. */
|
||||
/* The following functions must be exported in the case where */
|
||||
/* applications would want to write their own cache classes. */
|
||||
|
||||
FT_EXPORT( FT_Error )
|
||||
FT_LruList_New( FT_LruList_Class clazz,
|
||||
@ -173,9 +174,9 @@ FT_BEGIN_HEADER
|
||||
|
||||
|
||||
FT_EXPORT( FT_Error )
|
||||
FT_LruList_Lookup( FT_LruList list,
|
||||
FT_LruKey key,
|
||||
FT_LruNode *anode );
|
||||
FT_LruList_Lookup( FT_LruList list,
|
||||
FT_LruKey key,
|
||||
FT_LruNode *anode );
|
||||
|
||||
|
||||
FT_EXPORT( void )
|
||||
|
@ -30,41 +30,39 @@ FT_BEGIN_HEADER
|
||||
/* */
|
||||
/* USER-SELECTABLE CONFIGURATION MACROS */
|
||||
/* */
|
||||
/* this file contains the default configuration macro definitions for */
|
||||
/* a standard build of the FreeType library. There are three ways to */
|
||||
/* This file contains the default configuration macro definitions for */
|
||||
/* a standard build of the FreeType library. There are three ways to */
|
||||
/* use this file to build project-specific versions of the library: */
|
||||
/* */
|
||||
/* - you can modify this file by hand, but this is not recommended */
|
||||
/* in cases where you'd like to build several versions of the */
|
||||
/* library from a single source directory */
|
||||
/* - You can modify this file by hand, but this is not recommended in */
|
||||
/* cases where you would like to build several versions of the */
|
||||
/* library from a single source directory. */
|
||||
/* */
|
||||
/* */
|
||||
/* - you can put a copy of this file in your build directory, more */
|
||||
/* - You can put a copy of this file in your build directory, more */
|
||||
/* precisely in "$BUILD/freetype/config/ftoption.h", where "$BUILD" */
|
||||
/* is the name of a directory that is included _before_ the */
|
||||
/* FreeType include path during compilation. */
|
||||
/* is the name of a directory that is included _before_ the FreeType */
|
||||
/* include path during compilation. */
|
||||
/* */
|
||||
/* the default FreeType Makefiles and Jamfiles use the build */
|
||||
/* The default FreeType Makefiles and Jamfiles use the build */
|
||||
/* directory "builds/<system>" by default, but you can easily change */
|
||||
/* that for your own projects */
|
||||
/* that for your own projects. */
|
||||
/* */
|
||||
/* - Copy the file <ft2build.h> to "$BUILD/ft2build.h" and modify it */
|
||||
/* slightly to pre-define the macro FT_CONFIG_OPTIONS_H used to */
|
||||
/* locate this file during the build. For example, */
|
||||
/* */
|
||||
/* - copy the file <ft2build.h> to "$BUILD/ft2build.h" and modify */
|
||||
/* it slightly to pre-define the macro FT_CONFIG_OPTIONS_H used */
|
||||
/* to locate this file during the build. For example: */
|
||||
/* */
|
||||
/* #define FT_CONFIG_OPTIONS_H <myftoptions.h> */
|
||||
/* #include <freetype/config/ftheader.h> */
|
||||
/* #define FT_CONFIG_OPTIONS_H <myftoptions.h> */
|
||||
/* #include <freetype/config/ftheader.h> */
|
||||
/* */
|
||||
/* will use "$BUILD/myftoptions.h" instead of this file for macro */
|
||||
/* definitions. */
|
||||
/* */
|
||||
/* note also that you can similarly pre-define the macro */
|
||||
/* FT_CONFIG_MODULES_H used to locate the file listing the modules */
|
||||
/* that are statically linked to the library at compile time. */
|
||||
/* by default, this file is <freetype/config/ftmodule.h> */
|
||||
/* Note also that you can similarly pre-define the macro */
|
||||
/* FT_CONFIG_MODULES_H used to locate the file listing of the modules */
|
||||
/* that are statically linked to the library at compile time. By */
|
||||
/* default, this file is <freetype/config/ftmodule.h>. */
|
||||
/* */
|
||||
/* we highly recommend using the third method whenever possible */
|
||||
/* We highly recommend using the third method whenever possible. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
@ -111,7 +109,7 @@ FT_BEGIN_HEADER
|
||||
/* */
|
||||
/* More details can be found in the files ftmoderr.h and fterrors.h. */
|
||||
/* */
|
||||
#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS
|
||||
#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
@ -195,7 +193,7 @@ FT_BEGIN_HEADER
|
||||
/* file "ftconfig.h" either statically, or through Autoconf */
|
||||
/* on platforms that support it. */
|
||||
/* */
|
||||
#undef FT_CONFIG_OPTION_FORCE_INT64
|
||||
#undef FT_CONFIG_OPTION_FORCE_INT64
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
@ -251,8 +249,9 @@ FT_BEGIN_HEADER
|
||||
/* */
|
||||
/* Don't define any of these macros to compile in `release' mode! */
|
||||
/* */
|
||||
#define FT_DEBUG_LEVEL_ERROR
|
||||
#define FT_DEBUG_LEVEL_TRACE
|
||||
#define FT_DEBUG_LEVEL_ERROR
|
||||
#define FT_DEBUG_LEVEL_TRACE
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
@ -260,13 +259,14 @@ FT_BEGIN_HEADER
|
||||
/* */
|
||||
/* FreeType now comes with an integrated memory debugger that is */
|
||||
/* capable of detecting simple errors like memory leaks or double */
|
||||
/* deletes. To compile it within your build of the library, you should */
|
||||
/* define FT_DEBUG_MEMORY here. */
|
||||
/* deletes. To compile it within your build of the library, you */
|
||||
/* should define FT_DEBUG_MEMORY here. */
|
||||
/* */
|
||||
/* note that the memory debugger is only activated at runtime when */
|
||||
/* when the _environment_ variable "FT_DEBUG_MEMORY" is also defined ! */
|
||||
/* Note that the memory debugger is only activated at runtime when */
|
||||
/* when the _environment_ variable "FT_DEBUG_MEMORY" is also defined! */
|
||||
/* */
|
||||
#define FT_DEBUG_MEMORY
|
||||
#define FT_DEBUG_MEMORY
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
@ -275,7 +275,7 @@ FT_BEGIN_HEADER
|
||||
/* Used for debugging, this configuration macro should disappear */
|
||||
/* soon. */
|
||||
/* */
|
||||
#undef FT_CONFIG_OPTION_OLD_CALCS
|
||||
#undef FT_CONFIG_OPTION_OLD_CALCS
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
@ -375,7 +375,7 @@ FT_BEGIN_HEADER
|
||||
/* By undefining this, you will only compile the code necessary to load */
|
||||
/* TrueType glyphs without hinting. */
|
||||
/* */
|
||||
#undef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
||||
#undef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -145,6 +145,7 @@ FT_BEGIN_HEADER
|
||||
/* FT_Get_Kerning */
|
||||
/* FT_Kerning_Mode */
|
||||
/* FT_Get_Glyph_Name */
|
||||
/* FT_Get_Postscript_Name */
|
||||
/* */
|
||||
/* FT_CharMapRec */
|
||||
/* FT_Select_Charmap */
|
||||
@ -2292,15 +2293,14 @@ FT_BEGIN_HEADER
|
||||
/* FT_Get_Postscript_Name */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Retrieves the ASCII Postscript name of a given face, when */
|
||||
/* available. This should only work with Postscript and TrueType */
|
||||
/* fonts.. */
|
||||
/* Retrieves the ASCII Postscript name of a given face, if available. */
|
||||
/* This should only work with Postscript and TrueType fonts. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* face :: handle to source face object. */
|
||||
/* face :: A handle to the source face object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* pointer to face's Postscript name. NULL when un-available */
|
||||
/* A pointer to the face's Postscript name. NULL if un-available. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* The returned pointer is owned by the face and will be destroyed */
|
||||
|
@ -142,19 +142,21 @@ FT_BEGIN_HEADER
|
||||
|
||||
} FTC_FontRec;
|
||||
|
||||
|
||||
/* */
|
||||
|
||||
#define FTC_FONT_COMPARE(f1,f2) \
|
||||
( (f1)->face_id == (f2)->face_id && \
|
||||
(f1)->pix_width == (f2)->pix_width && \
|
||||
(f1)->pix_height == (f2)->pix_height )
|
||||
#define FTC_FONT_COMPARE( f1, f2 ) \
|
||||
( (f1)->face_id == (f2)->face_id && \
|
||||
(f1)->pix_width == (f2)->pix_width && \
|
||||
(f1)->pix_height == (f2)->pix_height )
|
||||
|
||||
#define FTC_FACE_ID_HASH(i) ((FT_UInt32)(FT_Pointer)(i))
|
||||
#define FTC_FACE_ID_HASH( i ) ((FT_UInt32)(FT_Pointer)( i ))
|
||||
|
||||
#define FTC_FONT_HASH( f ) \
|
||||
(FT_UInt32)( FTC_FACE_ID_HASH((f)->face_id) ^ \
|
||||
((f)->pix_width << 8) ^ \
|
||||
((f)->pix_height) )
|
||||
|
||||
#define FTC_FONT_HASH(f) \
|
||||
(FT_UInt32)( FTC_FACE_ID_HASH((f)->face_id) ^ \
|
||||
((f)->pix_width << 8) ^ \
|
||||
((f)->pix_height) )
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
|
@ -108,6 +108,7 @@ FT_BEGIN_HEADER
|
||||
FT_Long size,
|
||||
void* *P );
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
@ -171,7 +172,6 @@ FT_BEGIN_HEADER
|
||||
void** P );
|
||||
|
||||
|
||||
|
||||
/* This `#include' is needed by the MEM_xxx() macros; it should be */
|
||||
/* available on all platforms we know of. */
|
||||
#include <string.h>
|
||||
@ -183,7 +183,6 @@ FT_BEGIN_HEADER
|
||||
#define MEM_Move( dest, source, count ) memmove( dest, source, count )
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* We now support closures to produce completely reentrant code. This */
|
||||
@ -200,41 +199,44 @@ FT_BEGIN_HEADER
|
||||
|
||||
#ifdef FT_DEBUG_MEMORY
|
||||
|
||||
# define MEM_Alloc( _pointer_, _size_ ) \
|
||||
FT_Alloc_Debug( memory, _size_, (void**)&(_pointer_), __FILE__, __LINE__ )
|
||||
#define MEM_Alloc( _pointer_, _size_ ) \
|
||||
FT_Alloc_Debug( memory, _size_, \
|
||||
(void**)&(_pointer_), __FILE__, __LINE__ )
|
||||
|
||||
# define MEM_Alloc_Array( _pointer_, _count_, _type_ ) \
|
||||
FT_Alloc_Debug( memory, (_count_)*sizeof ( _type_ ), \
|
||||
#define MEM_Alloc_Array( _pointer_, _count_, _type_ ) \
|
||||
FT_Alloc_Debug( memory, (_count_)*sizeof ( _type_ ), \
|
||||
(void**)&(_pointer_), __FILE__, __LINE__ )
|
||||
|
||||
#define MEM_Realloc( _pointer_, _current_, _size_ ) \
|
||||
FT_Realloc_Debug( memory, _current_, _size_, \
|
||||
(void**)&(_pointer_), __FILE__, __LINE__ )
|
||||
|
||||
# define MEM_Realloc( _pointer_, _current_, _size_ ) \
|
||||
FT_Realloc_Debug( memory, _current_, _size_, (void**)&(_pointer_), __FILE__, __LINE__ )
|
||||
#define MEM_Realloc_Array( _pointer_, _current_, _new_, _type_ ) \
|
||||
FT_Realloc_Debug( memory, (_current_)*sizeof ( _type_ ), \
|
||||
(_new_)*sizeof ( _type_ ), \
|
||||
(void**)&(_pointer_), __FILE__, __LINE__ )
|
||||
|
||||
# define MEM_Realloc_Array( _pointer_, _current_, _new_, _type_ ) \
|
||||
FT_Realloc_Debug( memory, (_current_)*sizeof ( _type_ ), \
|
||||
(_new_)*sizeof ( _type_ ), (void**)&(_pointer_), __FILE__, __LINE__ )
|
||||
|
||||
# define MEM_Free( _pointer_ ) \
|
||||
#define MEM_Free( _pointer_ ) \
|
||||
FT_Free_Debug( memory, (void**)&(_pointer_), __FILE__, __LINE__ )
|
||||
|
||||
#else /* !FT_DEBUG_MEMORY */
|
||||
|
||||
# define MEM_Alloc( _pointer_, _size_ ) \
|
||||
FT_Alloc( memory, _size_, (void**)&(_pointer_) )
|
||||
#define MEM_Alloc( _pointer_, _size_ ) \
|
||||
FT_Alloc( memory, _size_, (void**)&(_pointer_) )
|
||||
|
||||
# define MEM_Alloc_Array( _pointer_, _count_, _type_ ) \
|
||||
FT_Alloc( memory, (_count_)*sizeof ( _type_ ), \
|
||||
(void**)&(_pointer_) )
|
||||
#define MEM_Alloc_Array( _pointer_, _count_, _type_ ) \
|
||||
FT_Alloc( memory, (_count_)*sizeof ( _type_ ), \
|
||||
(void**)&(_pointer_) )
|
||||
|
||||
# define MEM_Realloc( _pointer_, _current_, _size_ ) \
|
||||
FT_Realloc( memory, _current_, _size_, (void**)&(_pointer_) )
|
||||
#define MEM_Realloc( _pointer_, _current_, _size_ ) \
|
||||
FT_Realloc( memory, _current_, _size_, (void**)&(_pointer_) )
|
||||
|
||||
# define MEM_Realloc_Array( _pointer_, _current_, _new_, _type_ ) \
|
||||
FT_Realloc( memory, (_current_)*sizeof ( _type_ ), \
|
||||
#define MEM_Realloc_Array( _pointer_, _current_, _new_, _type_ ) \
|
||||
FT_Realloc( memory, (_current_)*sizeof ( _type_ ), \
|
||||
(_new_)*sizeof ( _type_ ), (void**)&(_pointer_) )
|
||||
|
||||
# define MEM_Free( _pointer_ ) \
|
||||
FT_Free( memory, (void**)&(_pointer_) )
|
||||
#define MEM_Free( _pointer_ ) \
|
||||
FT_Free( memory, (void**)&(_pointer_) )
|
||||
|
||||
#endif /* !FT_DEBUG_MEMORY */
|
||||
|
||||
@ -245,16 +247,16 @@ FT_BEGIN_HEADER
|
||||
#define REALLOC( _pointer_, _current_, _size_ ) \
|
||||
FT_SET_ERROR( MEM_Realloc( _pointer_, _current_, _size_ ) )
|
||||
|
||||
#define ALLOC_ARRAY( _pointer_, _count_, _type_ ) \
|
||||
FT_SET_ERROR( MEM_Alloc( _pointer_, \
|
||||
(_count_)*sizeof ( _type_ ) ) )
|
||||
#define ALLOC_ARRAY( _pointer_, _count_, _type_ ) \
|
||||
FT_SET_ERROR( MEM_Alloc( _pointer_, \
|
||||
(_count_)*sizeof ( _type_ ) ) )
|
||||
|
||||
#define REALLOC_ARRAY( _pointer_, _current_, _count_, _type_ ) \
|
||||
FT_SET_ERROR( MEM_Realloc( _pointer_, \
|
||||
(_current_)*sizeof ( _type_ ), \
|
||||
(_count_)*sizeof ( _type_ ) ) )
|
||||
#define REALLOC_ARRAY( _pointer_, _current_, _count_, _type_ ) \
|
||||
FT_SET_ERROR( MEM_Realloc( _pointer_, \
|
||||
(_current_)*sizeof ( _type_ ), \
|
||||
(_count_)*sizeof ( _type_ ) ) )
|
||||
|
||||
#define FREE( _pointer_ ) \
|
||||
#define FREE( _pointer_ ) \
|
||||
MEM_Free( _pointer_ )
|
||||
|
||||
|
||||
|
@ -171,15 +171,15 @@ FT_BEGIN_HEADER
|
||||
/* glyph_delta :: The 2d translation vector corresponding to */
|
||||
/* the glyph transformation, if necessary. */
|
||||
/* */
|
||||
/* glyph_hints :: format-specific glyph hints management */
|
||||
/* glyph_hints :: Format-specific glyph hints management. */
|
||||
/* */
|
||||
typedef struct FT_Slot_InternalRec_
|
||||
typedef struct FT_Slot_InternalRec_
|
||||
{
|
||||
FT_GlyphLoader* loader;
|
||||
FT_Bool glyph_transformed;
|
||||
FT_Matrix glyph_matrix;
|
||||
FT_Vector glyph_delta;
|
||||
void* glyph_hints;
|
||||
FT_GlyphLoader* loader;
|
||||
FT_Bool glyph_transformed;
|
||||
FT_Matrix glyph_matrix;
|
||||
FT_Vector glyph_delta;
|
||||
void* glyph_hints;
|
||||
|
||||
} FT_GlyphSlot_InternalRec;
|
||||
|
||||
@ -636,7 +636,7 @@ FT_BEGIN_HEADER
|
||||
FT_UInt render_mode );
|
||||
|
||||
typedef const char*
|
||||
(*FT_PSName_Requester)( FT_Face face );
|
||||
(*FT_PSName_Requester)( FT_Face face );
|
||||
|
||||
typedef FT_Error
|
||||
(*FT_Glyph_Name_Requester)( FT_Face face,
|
||||
|
@ -24,28 +24,28 @@
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
#define FT_INTERNAL_OBJECTS_H <freetype/internal/ftobjs.h>
|
||||
#define FT_INTERNAL_STREAM_H <freetype/internal/ftstream.h>
|
||||
#define FT_INTERNAL_MEMORY_H <freetype/internal/ftmemory.h>
|
||||
#define FT_INTERNAL_EXTENSION_H <freetype/internal/ftextend.h>
|
||||
#define FT_INTERNAL_DEBUG_H <freetype/internal/ftdebug.h>
|
||||
#define FT_INTERNAL_CALC_H <freetype/internal/ftcalc.h>
|
||||
#define FT_INTERNAL_DRIVER_H <freetype/internal/ftdriver.h>
|
||||
#define FT_INTERNAL_EXTEND_H <freetype/internal/ftextend.h>
|
||||
#define FT_INTERNAL_OBJECTS_H <freetype/internal/ftobjs.h>
|
||||
#define FT_INTERNAL_STREAM_H <freetype/internal/ftstream.h>
|
||||
#define FT_INTERNAL_MEMORY_H <freetype/internal/ftmemory.h>
|
||||
#define FT_INTERNAL_EXTENSION_H <freetype/internal/ftextend.h>
|
||||
#define FT_INTERNAL_DEBUG_H <freetype/internal/ftdebug.h>
|
||||
#define FT_INTERNAL_CALC_H <freetype/internal/ftcalc.h>
|
||||
#define FT_INTERNAL_DRIVER_H <freetype/internal/ftdriver.h>
|
||||
#define FT_INTERNAL_EXTEND_H <freetype/internal/ftextend.h>
|
||||
|
||||
#define FT_INTERNAL_SFNT_H <freetype/internal/sfnt.h>
|
||||
#define FT_INTERNAL_SFNT_H <freetype/internal/sfnt.h>
|
||||
|
||||
#define FT_INTERNAL_TRUETYPE_TYPES_H <freetype/internal/tttypes.h>
|
||||
#define FT_INTERNAL_TYPE1_TYPES_H <freetype/internal/t1types.h>
|
||||
#define FT_INTERNAL_CFF_TYPES_H <freetype/internal/cfftypes.h>
|
||||
#define FT_INTERNAL_FNT_TYPES_H <freetype/internal/fnttypes.h>
|
||||
#define FT_INTERNAL_TRUETYPE_TYPES_H <freetype/internal/tttypes.h>
|
||||
#define FT_INTERNAL_TYPE1_TYPES_H <freetype/internal/t1types.h>
|
||||
#define FT_INTERNAL_CFF_TYPES_H <freetype/internal/cfftypes.h>
|
||||
#define FT_INTERNAL_FNT_TYPES_H <freetype/internal/fnttypes.h>
|
||||
|
||||
#define FT_INTERNAL_POSTSCRIPT_NAMES_H <freetype/internal/psnames.h>
|
||||
#define FT_INTERNAL_POSTSCRIPT_AUX_H <freetype/internal/psaux.h>
|
||||
#define FT_INTERNAL_POSTSCRIPT_HINTS_H <freetype/internal/pshints.h>
|
||||
#define FT_INTERNAL_POSTSCRIPT_GLOBALS_H <freetype/internal/psglobal.h>
|
||||
#define FT_INTERNAL_POSTSCRIPT_NAMES_H <freetype/internal/psnames.h>
|
||||
#define FT_INTERNAL_POSTSCRIPT_AUX_H <freetype/internal/psaux.h>
|
||||
#define FT_INTERNAL_POSTSCRIPT_HINTS_H <freetype/internal/pshints.h>
|
||||
#define FT_INTERNAL_POSTSCRIPT_GLOBALS_H <freetype/internal/psglobal.h>
|
||||
|
||||
#define FT_INTERNAL_AUTOHINT_H <freetype/internal/autohint.h>
|
||||
#define FT_INTERNAL_AUTOHINT_H <freetype/internal/autohint.h>
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -426,11 +426,12 @@ FT_BEGIN_HEADER
|
||||
|
||||
typedef struct T1_Builder_Funcs_
|
||||
{
|
||||
void (*init)( T1_Builder* builder,
|
||||
FT_Face face,
|
||||
FT_Size size,
|
||||
FT_GlyphSlot slot,
|
||||
FT_Bool hinting );
|
||||
void
|
||||
(*init)( T1_Builder* builder,
|
||||
FT_Face face,
|
||||
FT_Size size,
|
||||
FT_GlyphSlot slot,
|
||||
FT_Bool hinting );
|
||||
|
||||
void
|
||||
(*done)( T1_Builder* builder );
|
||||
@ -586,20 +587,23 @@ FT_BEGIN_HEADER
|
||||
|
||||
struct T1_Decoder_Funcs_
|
||||
{
|
||||
FT_Error (*init) ( T1_Decoder* decoder,
|
||||
FT_Face face,
|
||||
FT_Size size,
|
||||
FT_GlyphSlot slot,
|
||||
FT_Byte** glyph_names,
|
||||
T1_Blend* blend,
|
||||
FT_Bool hinting,
|
||||
T1_Decoder_Callback callback );
|
||||
FT_Error
|
||||
(*init) ( T1_Decoder* decoder,
|
||||
FT_Face face,
|
||||
FT_Size size,
|
||||
FT_GlyphSlot slot,
|
||||
FT_Byte** glyph_names,
|
||||
T1_Blend* blend,
|
||||
FT_Bool hinting,
|
||||
T1_Decoder_Callback callback );
|
||||
|
||||
void (*done) ( T1_Decoder* decoder );
|
||||
void
|
||||
(*done) ( T1_Decoder* decoder );
|
||||
|
||||
FT_Error (*parse_charstrings)( T1_Decoder* decoder,
|
||||
FT_Byte* base,
|
||||
FT_UInt len );
|
||||
FT_Error
|
||||
(*parse_charstrings)( T1_Decoder* decoder,
|
||||
FT_Byte* base,
|
||||
FT_UInt len );
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,141 +1,186 @@
|
||||
#ifndef __PSGLOBALS_H__
|
||||
#define __PSGLOBALS_H__
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* psglobal.h */
|
||||
/* */
|
||||
/* Global PostScript hinting structures (specification only). */
|
||||
/* */
|
||||
/* Copyright 2001 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
/***** *****/
|
||||
/***** PUBLIC STRUCTURES & API *****/
|
||||
/***** *****/
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
|
||||
#ifndef __PSGLOBAL_H__
|
||||
#define __PSGLOBAL_H__
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
/***** *****/
|
||||
/***** PUBLIC STRUCTURES & API *****/
|
||||
/***** *****/
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
|
||||
#if 0
|
||||
/****************************************************************
|
||||
*
|
||||
* @constant: PS_GLOBALS_MAX_BLUE_ZONES
|
||||
*
|
||||
* @description:
|
||||
* the maximum number of blue zones in a font global hints
|
||||
* structure. See @PS_Globals_BluesRec
|
||||
*/
|
||||
#define PS_GLOBALS_MAX_BLUE_ZONES 16
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* @constant: PS_GLOBALS_MAX_STD_WIDTHS
|
||||
*
|
||||
* @description:
|
||||
* the maximum number of standard and snap widths in either the
|
||||
* horizontal or vertical direction. See @PS_Globals_WidthsRec
|
||||
*/
|
||||
#define PS_GLOBALS_MAX_STD_WIDTHS 16
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* @constant: */
|
||||
/* PS_GLOBALS_MAX_BLUE_ZONES */
|
||||
/* */
|
||||
/* @description: */
|
||||
/* The maximum number of blue zones in a font global hints structure. */
|
||||
/* See @PS_Globals_BluesRec. */
|
||||
/* */
|
||||
#define PS_GLOBALS_MAX_BLUE_ZONES 16
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* @type: PS_Globals
|
||||
*
|
||||
* @description:
|
||||
* a handle to a @PS_GlobalsRec structure used to
|
||||
* describe the global hints of a given font
|
||||
*/
|
||||
typedef struct PS_GlobalsRec_* PS_Globals;
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* @struct: PS_Globals_BluesRec
|
||||
*
|
||||
* @description:
|
||||
* a structure used to model the global blue zones of a given
|
||||
* font
|
||||
*
|
||||
* @fields:
|
||||
* count :: number of blue zones
|
||||
* zones :: an array of (count*2) coordinates describing the zones
|
||||
*
|
||||
* count_family :: number of family blue zones
|
||||
* zones_family :: an array of (count_family*2) coordinates describing
|
||||
* the family blue zones
|
||||
*
|
||||
* scale :: the blue scale to be used (fixed float)
|
||||
* shift :: the blue shift to be used
|
||||
* fuzz :: the blue fuzz to be used
|
||||
*
|
||||
* @note:
|
||||
* each blue zone is modeled by a (reference,overshoot) coordinate pair
|
||||
* in the table. zones can be placed in any order..
|
||||
*/
|
||||
typedef struct PS_Globals_BluesRec
|
||||
{
|
||||
FT_UInt count;
|
||||
FT_Int16 zones[ 2*PS_GLOBALS_MAX_BLUE_ZONES ];
|
||||
|
||||
FT_UInt count_family;
|
||||
FT_Int16 zones_family[ 2*PS_GLOBALS_MAX_BLUE_ZONES ];
|
||||
|
||||
FT_Fixed scale;
|
||||
FT_Int16 shift;
|
||||
FT_Int16 fuzz;
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* @constant: */
|
||||
/* PS_GLOBALS_MAX_STD_WIDTHS */
|
||||
/* */
|
||||
/* @description: */
|
||||
/* The maximum number of standard and snap widths in either the */
|
||||
/* horizontal or vertical direction. See @PS_Globals_WidthsRec. */
|
||||
/* */
|
||||
#define PS_GLOBALS_MAX_STD_WIDTHS 16
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* @type: */
|
||||
/* PS_Globals */
|
||||
/* */
|
||||
/* @description: */
|
||||
/* A handle to a @PS_GlobalsRec structure used to describe the global */
|
||||
/* hints of a given font. */
|
||||
/* */
|
||||
typedef struct PS_GlobalsRec_* PS_Globals;
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* @struct: */
|
||||
/* PS_Globals_BluesRec */
|
||||
/* */
|
||||
/* @description: */
|
||||
/* A structure used to model the global blue zones of a given font. */
|
||||
/* */
|
||||
/* @fields: */
|
||||
/* count :: The number of blue zones. */
|
||||
/* */
|
||||
/* zones :: An array of (count*2) coordinates describing the */
|
||||
/* zones. */
|
||||
/* */
|
||||
/* count_family :: The number of family blue zones. */
|
||||
/* */
|
||||
/* zones_family :: An array of (count_family*2) coordinates describing */
|
||||
/* the family blue zones. */
|
||||
/* */
|
||||
/* scale :: The blue scale to be used (fixed float). */
|
||||
/* */
|
||||
/* shift :: The blue shift to be used. */
|
||||
/* */
|
||||
/* fuzz :: Te blue fuzz to be used. */
|
||||
/* */
|
||||
/* @note: */
|
||||
/* Each blue zone is modeled by a (reference,overshoot) coordinate */
|
||||
/* pair in the table. Zones can be placed in any order. */
|
||||
/* */
|
||||
typedef struct PS_Globals_BluesRec_
|
||||
{
|
||||
FT_UInt count;
|
||||
FT_Int16 zones[2 * PS_GLOBALS_MAX_BLUE_ZONES];
|
||||
|
||||
FT_UInt count_family;
|
||||
FT_Int16 zones_family[2 * PS_GLOBALS_MAX_BLUE_ZONES];
|
||||
|
||||
FT_Fixed scale;
|
||||
FT_Int16 shift;
|
||||
FT_Int16 fuzz;
|
||||
|
||||
} PS_Globals_BluesRec, *PS_Globals_Blues;
|
||||
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* @type: PS_Global_Widths;
|
||||
*
|
||||
* @description:
|
||||
* a handle to a @PS_Globals_WidthsRec structure used to model
|
||||
* the global standard and snap widths in a given direction
|
||||
*/
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* @type: */
|
||||
/* PS_Global_Widths */
|
||||
/* */
|
||||
/* @description: */
|
||||
/* A handle to a @PS_Globals_WidthsRec structure used to model the */
|
||||
/* global standard and snap widths in a given direction. */
|
||||
/* */
|
||||
typedef struct PS_Globals_WidthsRec_* PS_Globals_Widths;
|
||||
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* @struct: PS_Globals_WidthsRec
|
||||
*
|
||||
* @description:
|
||||
* a structure used to model the global standard and snap widths
|
||||
* in a given font
|
||||
*
|
||||
* @fields:
|
||||
* count :: number of widths
|
||||
* widths :: an array of 'count' widths in font units.
|
||||
*
|
||||
* @note:
|
||||
* 'widths[0]' must be the standard width or height, while
|
||||
* remaining elements of the array are snap widths or heights
|
||||
*/
|
||||
typedef struct PS_Globals_WidthsRec_
|
||||
{
|
||||
FT_UInt count;
|
||||
FT_Int16 widths[ PS_GLOBALS_MAX_STD_WIDTHS ];
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* @struct: */
|
||||
/* PS_Globals_WidthsRec */
|
||||
/* */
|
||||
/* @description: */
|
||||
/* A structure used to model the global standard and snap widths in a */
|
||||
/* given font. */
|
||||
/* */
|
||||
/* @fields: */
|
||||
/* count :: The number of widths. */
|
||||
/* */
|
||||
/* widths :: An array of `count' widths in font units. */
|
||||
/* */
|
||||
/* @note: */
|
||||
/* `widths[0]' must be the standard width or height, while remaining */
|
||||
/* elements of the array are snap widths or heights. */
|
||||
/* */
|
||||
typedef struct PS_Globals_WidthsRec_
|
||||
{
|
||||
FT_UInt count;
|
||||
FT_Int16 widths[PS_GLOBALS_MAX_STD_WIDTHS];
|
||||
|
||||
} PS_Globals_WidthsRec;
|
||||
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* @struct: PS_Globals_GlobalsRec
|
||||
*
|
||||
* @description:
|
||||
* a structure used to model the global hints for a given font
|
||||
*
|
||||
* @fields:
|
||||
* horizontal :: horizontal widths
|
||||
* vertical :: vertical heights
|
||||
* blues :: blue zones
|
||||
*/
|
||||
typedef struct PS_GlobalsRec_
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* @struct: */
|
||||
/* PS_GlobalsRec */
|
||||
/* */
|
||||
/* @description: */
|
||||
/* A structure used to model the global hints for a given font. */
|
||||
/* */
|
||||
/* @fields: */
|
||||
/* horizontal :: The horizontal widths. */
|
||||
/* */
|
||||
/* vertical :: The vertical heights. */
|
||||
/* */
|
||||
/* blues :: The blue zones. */
|
||||
/* */
|
||||
typedef struct PS_GlobalsRec_
|
||||
{
|
||||
PS_Globals_WidthsRec horizontal;
|
||||
PS_Globals_WidthsRec vertical;
|
||||
PS_Globals_BluesRec blues;
|
||||
|
||||
} PS_GlobalsRec;
|
||||
|
||||
|
||||
#endif
|
||||
} PS_GlobalsRec;
|
||||
|
||||
#endif
|
||||
|
||||
/* */
|
||||
|
||||
#endif /* __PS_GLOBALS_H__ */
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* __PS_GLOBAL_H__ */
|
||||
|
||||
|
||||
/* END */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -26,6 +26,7 @@
|
||||
#include FT_INTERNAL_POSTSCRIPT_NAMES_H
|
||||
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
@ -173,7 +174,7 @@ FT_BEGIN_HEADER
|
||||
/* support for Multiple Masters fonts */
|
||||
T1_Blend* blend;
|
||||
|
||||
/* since FT 2.1 - interface to Postscript hinter */
|
||||
/* since FT 2.1 - interface to PostScript hinter */
|
||||
void* pshinter;
|
||||
|
||||
} T1_FaceRec;
|
||||
|
@ -316,8 +316,8 @@ FT_BEGIN_HEADER
|
||||
#if 1 /* this used to be this value (and it still is in many places) */
|
||||
#define TT_MS_LANGID_CHINESE_MACAU 0x1404
|
||||
#else /* but beware, Microsoft may change its mind...
|
||||
the most recent Word reference has the following: :-( */
|
||||
#define TT_MS_LANGID_CHINESE_MACAU TT_MS_LANGID_CHINESE_HONG_KONG
|
||||
the most recent Word reference has the following: */
|
||||
#define TT_MS_LANGID_CHINESE_MACAU TT_MS_LANGID_CHINESE_HONG_KONG
|
||||
#endif
|
||||
|
||||
#define TT_MS_LANGID_CZECH_CZECH_REPUBLIC 0x0405
|
||||
@ -432,7 +432,7 @@ FT_BEGIN_HEADER
|
||||
#define TT_MS_LANGID_MALTESE_MALTA 0x043a
|
||||
#define TT_MS_LANGID_SAAMI_LAPONIA 0x043b
|
||||
|
||||
#if 0 /* this seems to be a previous invertion */
|
||||
#if 0 /* this seems to be a previous invertion */
|
||||
#define TT_MS_LANGID_IRISH_GAELIC_IRELAND 0x043c
|
||||
#define TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM 0x083c
|
||||
#else
|
||||
@ -460,15 +460,15 @@ FT_BEGIN_HEADER
|
||||
#define TT_MS_LANGID_SANSKRIT_INDIA 0x044f
|
||||
#define TT_MS_LANGID_KONKANI_INDIA 0x0457
|
||||
|
||||
/* new as of 2001-01-01 */
|
||||
/* new as of 2001-01-01 */
|
||||
#define TT_MS_LANGID_ARABIC_GENERAL 0x0001
|
||||
#define TT_MS_LANGID_CHINESE_GENERAL 0x0004
|
||||
#define TT_MS_LANGID_ENGLISH_GENERAL 0x0009
|
||||
#define TT_MS_LANGID_FRENCH_WEST_INDIES 0x1c0c
|
||||
#define TT_MS_LANGID_FRENCH_REUNION 0x200c
|
||||
#define TT_MS_LANGID_FRENCH_CONGO 0x240c
|
||||
/* which was formerly: */
|
||||
#define TT_MS_LANGID_FRENCH_ZAIRE TT_MS_LANGID_FRENCH_CONGO
|
||||
/* which was formerly: */
|
||||
#define TT_MS_LANGID_FRENCH_ZAIRE TT_MS_LANGID_FRENCH_CONGO
|
||||
|
||||
#define TT_MS_LANGID_FRENCH_SENEGAL 0x280c
|
||||
#define TT_MS_LANGID_FRENCH_CAMEROON 0x2c0c
|
||||
@ -479,20 +479,20 @@ FT_BEGIN_HEADER
|
||||
#define TT_MS_LANGID_TAJIK_TAJIKISTAN 0x0428
|
||||
#define TT_MS_LANGID_YIDDISH_GERMANY 0x043d
|
||||
#define TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN 0x0440
|
||||
/* alias declared in Windows 2000 */
|
||||
/* alias declared in Windows 2000 */
|
||||
#define TT_MS_LANGID_KIRGHIZ_KIRGHIZ_REPUBLIC \
|
||||
TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN
|
||||
TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN
|
||||
|
||||
#define TT_MS_LANGID_TURKMEN_TURKMENISTAN 0x0442
|
||||
#define TT_MS_LANGID_MONGOLIAN_MONGOLIA /* Cyrillic */ 0x0450
|
||||
|
||||
/* this seems to be inconsistant... :-(
|
||||
* here is the current "official" way: */
|
||||
/* the following seems to be inconsistent;
|
||||
here is the current "official" way: */
|
||||
#define TT_MS_LANGID_TIBETAN_BHUTAN 0x0451
|
||||
/* and now here is what is used by Passport SDK */
|
||||
/* and here is what is used by Passport SDK */
|
||||
#define TT_MS_LANGID_TIBETAN_CHINA 0x0451
|
||||
#define TT_MS_LANGID_DZONGHKA_BHUTAN 0x0851
|
||||
/* end of inconsistency */
|
||||
/* end of inconsistency */
|
||||
|
||||
#define TT_MS_LANGID_WELSH_WALES 0x0452
|
||||
#define TT_MS_LANGID_KHMER_CAMBODIA 0x0453
|
||||
@ -501,15 +501,15 @@ FT_BEGIN_HEADER
|
||||
#define TT_MS_LANGID_GALICIAN_SPAIN 0x0456
|
||||
#define TT_MS_LANGID_MANIPURI_INDIA 0x0458
|
||||
#define TT_MS_LANGID_SINDHI_INDIA 0x0459
|
||||
/* the following one is only encountered in Microsoft RTF specification */
|
||||
/* the following one is only encountered in Microsoft RTF specification */
|
||||
#define TT_MS_LANGID_KASHMIRI_PAKISTAN 0x0460
|
||||
/* the following one is not in the Passport list, looks like an omission */
|
||||
/* the following one is not in the Passport list, looks like an omission */
|
||||
#define TT_MS_LANGID_KASHMIRI_INDIA 0x0860
|
||||
#define TT_MS_LANGID_NEPALI_NEPAL 0x0461
|
||||
#define TT_MS_LANGID_NEPALI_INDIA 0x0861
|
||||
#define TT_MS_LANGID_FRISIAN_NETHERLANDS 0x0462
|
||||
|
||||
/* new as of 2001-03-01 (from Office Xp) */
|
||||
/* new as of 2001-03-01 (from Office Xp) */
|
||||
#define TT_MS_LANGID_ENGLISH_HONG_KONG 0x3c09
|
||||
#define TT_MS_LANGID_ENGLISH_INDIA 0x4009
|
||||
#define TT_MS_LANGID_ENGLISH_MALAYSIA 0x4409
|
||||
@ -524,48 +524,50 @@ FT_BEGIN_HEADER
|
||||
#define TT_MS_LANGID_PASHTO_AFGHANISTAN 0x0463
|
||||
#define TT_MS_LANGID_FILIPINO_PHILIPPINES 0x0464
|
||||
#define TT_MS_LANGID_DHIVEHI_MALDIVES 0x0465
|
||||
/* alias declared in Windows 2000 */
|
||||
#define TT_MS_LANGID_DIVEHI_MALDIVES TT_MS_LANGID_DHIVEHI_MALDIVES
|
||||
/* for language codes from 0x0466 to 0x0471, see below */
|
||||
/* alias declared in Windows 2000 */
|
||||
#define TT_MS_LANGID_DIVEHI_MALDIVES TT_MS_LANGID_DHIVEHI_MALDIVES
|
||||
/* for language codes from 0x0466 to 0x0471 see below */
|
||||
#define TT_MS_LANGID_OROMO_ETHIOPIA 0x0472
|
||||
#define TT_MS_LANGID_TIGRIGNA_ETHIOPIA 0x0473
|
||||
#define TT_MS_LANGID_TIGRIGNA_ERYTHREA 0x0873
|
||||
/* also spelled in the `Passport SDK' list as: */
|
||||
#define TT_MS_LANGID_TIGRIGNA_ERYTREA TT_MS_LANGID_TIGRIGNA_ERYTHREA
|
||||
/* also spelled in the `Passport SDK' list as: */
|
||||
#define TT_MS_LANGID_TIGRIGNA_ERYTREA TT_MS_LANGID_TIGRIGNA_ERYTHREA
|
||||
|
||||
/* New additions from Windows Xp/Passport SDK. AL 2001-11-10. */
|
||||
/* New additions from Windows Xp/Passport SDK 2001-11-10. */
|
||||
|
||||
/* don't ask me what this one means... :-(
|
||||
* note it is currently commented out
|
||||
#define TT_MS_LANGID_GREEK_GREECE2 0x2008
|
||||
* end of comment to avoid strange code */
|
||||
/* don't ask what this one means... It is commented out currently. */
|
||||
#if 0
|
||||
#define TT_MS_LANGID_GREEK_GREECE2 0x2008
|
||||
#endif
|
||||
|
||||
#define TT_MS_LANGID_SPANISH_UNITED_STATES 0x540a
|
||||
/* these following two blatently violate MS specs, by using a sublang>0x1F */
|
||||
#define TT_MS_LANGID_SPANISH_LATIN_AMERICA 0xE40a
|
||||
#define TT_MS_LANGID_FRENCH_NORTH_AFRICA 0xE40c
|
||||
#define TT_MS_LANGID_SPANISH_UNITED_STATES 0x540a
|
||||
/* The following two IDs blatantly violate MS specs by using a */
|
||||
/* sublanguage > 0x1F. */
|
||||
#define TT_MS_LANGID_SPANISH_LATIN_AMERICA 0xE40a
|
||||
#define TT_MS_LANGID_FRENCH_NORTH_AFRICA 0xE40c
|
||||
|
||||
#define TT_MS_LANGID_FRENCH_MOROCCO 0x380c
|
||||
#define TT_MS_LANGID_FRENCH_HAITI 0x3c0c
|
||||
#define TT_MS_LANGID_BENGALI_BANGLADESH 0x0845
|
||||
#define TT_MS_LANGID_PUNJABI_ARABIC_PAKISTAN 0x0846
|
||||
#define TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN 0x0850
|
||||
#define TT_MS_LANGID_EDO_NIGERIA 0x0466
|
||||
#define TT_MS_LANGID_FULFULDE_NIGERIA 0x0467
|
||||
#define TT_MS_LANGID_HAUSA_NIGERIA 0x0468
|
||||
#define TT_MS_LANGID_IBIBIO_NIGERIA 0x0469
|
||||
#define TT_MS_LANGID_YORUBA_NIGERIA 0x046a
|
||||
/* language codes from 0x046b to 0x046f are (still) unknown. */
|
||||
#define TT_MS_LANGID_IGBO_NIGERIA 0x0470
|
||||
#define TT_MS_LANGID_KANURI_NIGERIA 0x0471
|
||||
#define TT_MS_LANGID_GUARANI_PARAGUAY 0x0474
|
||||
#define TT_MS_LANGID_HAWAIIAN_UNITED_STATES 0x0475
|
||||
#define TT_MS_LANGID_LATIN 0x0476
|
||||
#define TT_MS_LANGID_SOMALI_SOMALIA 0x0477
|
||||
/* Note Yi does not have a (proper) ISO639-2 code, since it is mostly not
|
||||
* written (but OTOH the peculiar writing system is worth studying). */
|
||||
#define TT_MS_LANGID_YI_CHINA 0x0478
|
||||
#define TT_MS_LANGID_PAPIAMENTU_NETHERLANDS_ANTILLES 0x0479
|
||||
#define TT_MS_LANGID_FRENCH_MOROCCO 0x380c
|
||||
#define TT_MS_LANGID_FRENCH_HAITI 0x3c0c
|
||||
#define TT_MS_LANGID_BENGALI_BANGLADESH 0x0845
|
||||
#define TT_MS_LANGID_PUNJABI_ARABIC_PAKISTAN 0x0846
|
||||
#define TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN 0x0850
|
||||
#define TT_MS_LANGID_EDO_NIGERIA 0x0466
|
||||
#define TT_MS_LANGID_FULFULDE_NIGERIA 0x0467
|
||||
#define TT_MS_LANGID_HAUSA_NIGERIA 0x0468
|
||||
#define TT_MS_LANGID_IBIBIO_NIGERIA 0x0469
|
||||
#define TT_MS_LANGID_YORUBA_NIGERIA 0x046a
|
||||
/* language codes from 0x046b to 0x046f are (still) unknown. */
|
||||
#define TT_MS_LANGID_IGBO_NIGERIA 0x0470
|
||||
#define TT_MS_LANGID_KANURI_NIGERIA 0x0471
|
||||
#define TT_MS_LANGID_GUARANI_PARAGUAY 0x0474
|
||||
#define TT_MS_LANGID_HAWAIIAN_UNITED_STATES 0x0475
|
||||
#define TT_MS_LANGID_LATIN 0x0476
|
||||
#define TT_MS_LANGID_SOMALI_SOMALIA 0x0477
|
||||
/* Note: Yi does not have a (proper) ISO 639-2 code, since it is mostly */
|
||||
/* not written (but OTOH the peculiar writing system is worth */
|
||||
/* studying). */
|
||||
#define TT_MS_LANGID_YI_CHINA 0x0478
|
||||
#define TT_MS_LANGID_PAPIAMENTU_NETHERLANDS_ANTILLES 0x0479
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
@ -582,7 +584,7 @@ FT_BEGIN_HEADER
|
||||
#define TT_NAME_ID_PS_NAME 6
|
||||
#define TT_NAME_ID_TRADEMARK 7
|
||||
|
||||
/* the following values are from the OpenType spec */
|
||||
/* the following values are from the OpenType spec */
|
||||
#define TT_NAME_ID_MANUFACTURER 8
|
||||
#define TT_NAME_ID_DESIGNER 9
|
||||
#define TT_NAME_ID_DESCRIPTION 10
|
||||
@ -590,15 +592,15 @@ FT_BEGIN_HEADER
|
||||
#define TT_NAME_ID_DESIGNER_URL 12
|
||||
#define TT_NAME_ID_LICENSE 13
|
||||
#define TT_NAME_ID_LICENSE_URL 14
|
||||
/* number 15 is reserved */
|
||||
/* number 15 is reserved */
|
||||
#define TT_NAME_ID_PREFERRED_FAMILY 16
|
||||
#define TT_NAME_ID_PREFERRED_SUBFAMILY 17
|
||||
#define TT_NAME_ID_MAC_FULL_NAME 18
|
||||
|
||||
/* The following code is new as of 2000-01-21 */
|
||||
/* The following code is new as of 2000-01-21 */
|
||||
#define TT_NAME_ID_SAMPLE_TEXT 19
|
||||
|
||||
/* This is new in OpenType 1.3 */
|
||||
/* This is new in OpenType 1.3 */
|
||||
#define TT_NAME_ID_CID_FINDFONT_NAME 20
|
||||
|
||||
|
||||
@ -744,7 +746,7 @@ FT_BEGIN_HEADER
|
||||
/* U+DC00-U+DFFF */
|
||||
/* According to OpenType specs v.1.3+, setting bit 57 implies that there */
|
||||
/* is at least one codepoint beyond the Basic Multilingual Plane that is */
|
||||
/* supported by this font. So really means: U+10000-U+10FFFD */
|
||||
/* supported by this font. So it really means: >= U+10000 */
|
||||
|
||||
/* Bit 58 is reserved for Unicode SubRanges */
|
||||
|
||||
|
@ -596,11 +596,11 @@
|
||||
|
||||
if ( point->out_dir != ah_dir_none )
|
||||
goto Is_Weak_Point;
|
||||
|
||||
|
||||
angle_in = ah_angle( &ivec );
|
||||
angle_out = ah_angle( &ovec );
|
||||
delta = angle_in - angle_out;
|
||||
|
||||
|
||||
if ( delta > AH_PI )
|
||||
delta = AH_2PI - delta;
|
||||
|
||||
@ -952,7 +952,7 @@
|
||||
best_score = seg1->score;
|
||||
else
|
||||
best_score = 32000;
|
||||
|
||||
|
||||
for ( seg2 = segments; seg2 < segment_limit; seg2++ )
|
||||
if ( seg1 != seg2 && seg1->dir + seg2->dir == 0 )
|
||||
{
|
||||
|
@ -380,9 +380,12 @@
|
||||
FT_Bool no_horz_edges,
|
||||
FT_Bool no_vert_edges )
|
||||
{
|
||||
#if 0
|
||||
#if 0
|
||||
ah_debug_disable_horz = no_horz_edges;
|
||||
ah_debug_disable_vert = no_vert_edges;
|
||||
#else
|
||||
UNUSED( no_horz_edges );
|
||||
UNUSED( no_vert_edges );
|
||||
#endif
|
||||
/* AH_Interpolate_Blue_Edges( hinter ); -- doesn't seem to help */
|
||||
/* reduce the problem of the disappearing eye in the `e' of Times... */
|
||||
|
@ -83,7 +83,7 @@ FT_BEGIN_HEADER
|
||||
/* detected and later hinted through strong interpolation to correct */
|
||||
/* some unpleasant artefacts. */
|
||||
/* */
|
||||
#undef AH_OPTION_NO_STRONG_INTERPOLATION
|
||||
#undef AH_OPTION_NO_STRONG_INTERPOLATION
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
|
@ -511,7 +511,7 @@
|
||||
if ( s < 0 )
|
||||
{
|
||||
x->lo = (FT_UInt32)-(FT_Int32)x->lo;
|
||||
x->hi = ~x->hi + !( x->lo );
|
||||
x->hi = ~x->hi + !x->lo;
|
||||
}
|
||||
s ^= y; y = ABS( y );
|
||||
|
||||
@ -563,7 +563,7 @@
|
||||
if ( s < 0 )
|
||||
{
|
||||
x->lo = (FT_UInt32)-(FT_Int32)x->lo;
|
||||
x->hi = ~x->hi + !( x->lo );
|
||||
x->hi = ~x->hi + !x->lo;
|
||||
}
|
||||
s ^= y; y = ABS( y );
|
||||
|
||||
|
@ -1,3 +1,21 @@
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftdbgmem.c */
|
||||
/* */
|
||||
/* Memory debugger (body). */
|
||||
/* */
|
||||
/* Copyright 2001 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_CONFIG_CONFIG_H
|
||||
#include FT_INTERNAL_DEBUG_H
|
||||
@ -6,6 +24,7 @@
|
||||
#include FT_ERRORS_H
|
||||
#include FT_TYPES_H
|
||||
|
||||
|
||||
#ifdef FT_DEBUG_MEMORY
|
||||
|
||||
|
||||
@ -17,48 +36,51 @@
|
||||
typedef struct FT_MemNodeRec_* FT_MemNode;
|
||||
typedef struct FT_MemTableRec_* FT_MemTable;
|
||||
|
||||
#define FT_MEM_VAL(addr) ((FT_ULong)(FT_Pointer)(addr))
|
||||
#define FT_MEM_VAL( addr ) ((FT_ULong)(FT_Pointer)( addr ))
|
||||
|
||||
typedef struct FT_MemNodeRec_
|
||||
typedef struct FT_MemNodeRec_
|
||||
{
|
||||
FT_Byte* address;
|
||||
FT_Long size; /* < 0 if the block was freed */
|
||||
|
||||
const char* alloc_file_name;
|
||||
|
||||
const char* alloc_file_name;
|
||||
FT_Long alloc_line_no;
|
||||
|
||||
const char* free_file_name;
|
||||
|
||||
const char* free_file_name;
|
||||
FT_Long free_line_no;
|
||||
|
||||
FT_MemNode link;
|
||||
|
||||
} FT_MemNodeRec;
|
||||
|
||||
typedef struct FT_MemTableRec_
|
||||
} FT_MemNodeRec;
|
||||
|
||||
|
||||
typedef struct FT_MemTableRec_
|
||||
{
|
||||
FT_ULong size;
|
||||
FT_ULong nodes;
|
||||
FT_MemNode* buckets;
|
||||
FT_ULong size;
|
||||
FT_ULong nodes;
|
||||
FT_MemNode* buckets;
|
||||
|
||||
FT_ULong alloc_total;
|
||||
FT_ULong alloc_current;
|
||||
FT_ULong alloc_max;
|
||||
|
||||
const char* file_name;
|
||||
FT_Long line_no;
|
||||
FT_ULong alloc_total;
|
||||
FT_ULong alloc_current;
|
||||
FT_ULong alloc_max;
|
||||
|
||||
FT_Memory memory;
|
||||
FT_Pointer memory_user;
|
||||
const char* file_name;
|
||||
FT_Long line_no;
|
||||
|
||||
FT_Memory memory;
|
||||
FT_Pointer memory_user;
|
||||
FT_Alloc_Func alloc;
|
||||
FT_Free_Func free;
|
||||
FT_Realloc_Func realloc;
|
||||
|
||||
} FT_MemTableRec;
|
||||
|
||||
#define FT_MEM_SIZE_MIN 7
|
||||
#define FT_MEM_SIZE_MAX 13845163
|
||||
} FT_MemTableRec;
|
||||
|
||||
|
||||
#define FT_MEM_SIZE_MIN 7
|
||||
#define FT_MEM_SIZE_MAX 13845163
|
||||
|
||||
#define FT_FILENAME( x ) ((x) ? (x) : "unknown file")
|
||||
|
||||
#define FT_FILENAME(x) ((x) ? (x) : "unknown file")
|
||||
|
||||
static const FT_UInt ft_mem_primes[] =
|
||||
{
|
||||
@ -125,7 +147,9 @@
|
||||
{
|
||||
FT_UInt i;
|
||||
|
||||
for ( i = 0; i < sizeof(ft_mem_primes)/sizeof(ft_mem_primes[0]); i++ )
|
||||
|
||||
for ( i = 0;
|
||||
i < sizeof ( ft_mem_primes ) / sizeof ( ft_mem_primes[0] ); i++ )
|
||||
if ( ft_mem_primes[i] > num )
|
||||
return ft_mem_primes[i];
|
||||
|
||||
@ -140,19 +164,22 @@
|
||||
FT_Memory memory = table->memory;
|
||||
FT_Pointer block;
|
||||
|
||||
|
||||
memory->user = table->memory_user;
|
||||
block = table->alloc( memory, size );
|
||||
memory->user = table;
|
||||
|
||||
return block;
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ft_mem_table_free( FT_MemTable table,
|
||||
FT_Pointer block )
|
||||
{
|
||||
FT_Memory memory = table->memory;
|
||||
|
||||
|
||||
memory->user = table->memory_user;
|
||||
table->free( memory, block );
|
||||
memory->user = table;
|
||||
@ -164,40 +191,44 @@
|
||||
{
|
||||
FT_ULong new_size;
|
||||
|
||||
|
||||
new_size = ft_mem_closest_prime( table->nodes );
|
||||
if (new_size != table->size)
|
||||
if ( new_size != table->size )
|
||||
{
|
||||
FT_MemNode* new_buckets ;
|
||||
FT_ULong i;
|
||||
|
||||
new_buckets = ft_mem_table_alloc( table, new_size * sizeof(FT_MemNode) );
|
||||
|
||||
new_buckets = ft_mem_table_alloc( table,
|
||||
new_size * sizeof ( FT_MemNode ) );
|
||||
if ( new_buckets == NULL )
|
||||
return;
|
||||
|
||||
MEM_Set( new_buckets, 0, sizeof(FT_MemNode)*new_size );
|
||||
|
||||
|
||||
MEM_Set( new_buckets, 0, sizeof ( FT_MemNode ) * new_size );
|
||||
|
||||
for ( i = 0; i < table->size; i++ )
|
||||
{
|
||||
FT_MemNode node, next, *pnode;
|
||||
FT_ULong hash;
|
||||
|
||||
|
||||
node = table->buckets[i];
|
||||
while (node)
|
||||
while ( node )
|
||||
{
|
||||
next = node->link;
|
||||
hash = FT_MEM_VAL(node->address) % new_size;
|
||||
hash = FT_MEM_VAL( node->address ) % new_size;
|
||||
pnode = new_buckets + hash;
|
||||
|
||||
node->link = pnode[0];
|
||||
pnode[0] = node;
|
||||
|
||||
node = next;
|
||||
node = next;
|
||||
}
|
||||
}
|
||||
|
||||
if ( table->buckets )
|
||||
ft_mem_table_free( table, table->buckets );
|
||||
|
||||
|
||||
table->buckets = new_buckets;
|
||||
table->size = new_size;
|
||||
}
|
||||
@ -209,73 +240,78 @@
|
||||
{
|
||||
FT_MemTable table;
|
||||
|
||||
table = memory->alloc( memory, sizeof(*table) );
|
||||
if ( table == NULL ) goto Exit;
|
||||
|
||||
MEM_Set( table, 0, sizeof(*table) );
|
||||
|
||||
table = memory->alloc( memory, sizeof ( *table ) );
|
||||
if ( table == NULL )
|
||||
goto Exit;
|
||||
|
||||
MEM_Set( table, 0, sizeof ( *table ) );
|
||||
|
||||
table->size = FT_MEM_SIZE_MIN;
|
||||
table->nodes = 0;
|
||||
|
||||
table->memory = memory;
|
||||
|
||||
table->memory = memory;
|
||||
|
||||
table->memory_user = memory->user;
|
||||
|
||||
|
||||
table->alloc = memory->alloc;
|
||||
table->realloc = memory->realloc;
|
||||
table->free = memory->free;
|
||||
|
||||
table->buckets = memory->alloc( memory, table->size * sizeof(FT_MemNode) );
|
||||
table->buckets = memory->alloc( memory,
|
||||
table->size * sizeof ( FT_MemNode ) );
|
||||
if ( table->buckets )
|
||||
MEM_Set( table->buckets, 0, sizeof(FT_MemNode)*table->size );
|
||||
MEM_Set( table->buckets, 0, sizeof ( FT_MemNode ) * table->size );
|
||||
else
|
||||
{
|
||||
memory->free( memory, table );
|
||||
table = NULL;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
||||
Exit:
|
||||
return table;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
ft_mem_table_destroy( FT_MemTable table )
|
||||
{
|
||||
FT_ULong i;
|
||||
FT_ULong i;
|
||||
|
||||
|
||||
if ( table )
|
||||
{
|
||||
FT_Memory memory = table->memory;
|
||||
FT_Long leak_count = 0;
|
||||
FT_ULong leaks = 0;
|
||||
|
||||
|
||||
|
||||
for ( i = 0; i < table->size; i++ )
|
||||
{
|
||||
FT_MemNode *pnode = table->buckets + i, next, node = *pnode;
|
||||
|
||||
while (node)
|
||||
|
||||
while ( node )
|
||||
{
|
||||
next = node->link;
|
||||
node->link = 0;
|
||||
|
||||
next = node->link;
|
||||
node->link = 0;
|
||||
|
||||
if ( node->size > 0 )
|
||||
{
|
||||
printf( "leaked memory block at address %p, size %8ld in (%s:%d)\n",
|
||||
node->address, node->size,
|
||||
FT_FILENAME( node->alloc_file_name ),
|
||||
node->alloc_line_no );
|
||||
|
||||
printf(
|
||||
"leaked memory block at address %p, size %8ld in (%s:%ld)\n",
|
||||
node->address, node->size,
|
||||
FT_FILENAME( node->alloc_file_name ),
|
||||
node->alloc_line_no );
|
||||
|
||||
leak_count++;
|
||||
leaks += node->size;
|
||||
|
||||
|
||||
ft_mem_table_free( table, node->address );
|
||||
}
|
||||
|
||||
|
||||
node->address = NULL;
|
||||
node->size = 0;
|
||||
|
||||
|
||||
free( node );
|
||||
node = next;
|
||||
}
|
||||
@ -288,32 +324,35 @@
|
||||
table->nodes = 0;
|
||||
free( table );
|
||||
|
||||
printf( "FreeType: total memory allocations = %ld\n", table->alloc_total );
|
||||
printf( "FreeType: maximum memory footprint = %ld\n", table->alloc_max );
|
||||
|
||||
printf(
|
||||
"FreeType: total memory allocations = %ld\n", table->alloc_total );
|
||||
printf(
|
||||
"FreeType: maximum memory footprint = %ld\n", table->alloc_max );
|
||||
|
||||
if ( leak_count > 0 )
|
||||
ft_mem_debug_panic( "FreeType: %ld bytes of memory leaked in %ld blocks\n",
|
||||
leaks, leak_count );
|
||||
printf( "FreeType: no memory leaks detected !!\n" );
|
||||
ft_mem_debug_panic(
|
||||
"FreeType: %ld bytes of memory leaked in %ld blocks\n",
|
||||
leaks, leak_count );
|
||||
printf( "FreeType: No memory leaks detected!\n" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static FT_MemNode*
|
||||
ft_mem_table_get_nodep( FT_MemTable table,
|
||||
FT_Byte* address )
|
||||
FT_Byte* address )
|
||||
{
|
||||
FT_ULong hash;
|
||||
FT_MemNode *pnode, node;
|
||||
FT_ULong hash;
|
||||
FT_MemNode *pnode, node;
|
||||
|
||||
hash = FT_MEM_VAL(address);
|
||||
pnode = table->buckets + (hash % table->size);
|
||||
|
||||
hash = FT_MEM_VAL( address );
|
||||
pnode = table->buckets + ( hash % table->size );
|
||||
|
||||
for (;;)
|
||||
{
|
||||
node = pnode[0];
|
||||
if (!node)
|
||||
if ( !node )
|
||||
break;
|
||||
|
||||
if ( node->address == address )
|
||||
@ -325,7 +364,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
ft_mem_table_set( FT_MemTable table,
|
||||
FT_Byte* address,
|
||||
@ -333,41 +371,44 @@
|
||||
{
|
||||
FT_MemNode *pnode, node;
|
||||
|
||||
if (table)
|
||||
|
||||
if ( table )
|
||||
{
|
||||
pnode = ft_mem_table_get_nodep( table, address );
|
||||
node = *pnode;
|
||||
if (node)
|
||||
if ( node )
|
||||
{
|
||||
if ( node->size < 0 )
|
||||
{
|
||||
/* this block was already freed. this means that our memory is */
|
||||
/* now completely corrupted !! */
|
||||
ft_mem_debug_panic( "memory heap corrupted (allocating freed block)" );
|
||||
/* this block was already freed. This means that our memory is */
|
||||
/* now completely corrupted! */
|
||||
ft_mem_debug_panic(
|
||||
"memory heap corrupted (allocating freed block)" );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* this block was already allocated. this means that our memory */
|
||||
/* is also corrupted !! */
|
||||
ft_mem_debug_panic( "memory heap corrupted (re-allocating allocated block)" );
|
||||
/* this block was already allocated. This means that our memory */
|
||||
/* is also corrupted! */
|
||||
ft_mem_debug_panic(
|
||||
"memory heap corrupted (re-allocating allocated block)" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* we need to create a new node in this table */
|
||||
node = ft_mem_table_alloc( table, sizeof(*node) );
|
||||
node = ft_mem_table_alloc( table, sizeof ( *node ) );
|
||||
if ( node == NULL )
|
||||
ft_mem_debug_panic( "not enough memory to run memory tests" );
|
||||
|
||||
node->address = address;
|
||||
node->size = size;
|
||||
node->address = address;
|
||||
node->size = size;
|
||||
|
||||
node->alloc_file_name = table->file_name;
|
||||
node->alloc_line_no = table->line_no;
|
||||
|
||||
node->free_file_name = NULL;
|
||||
node->free_line_no = 0;
|
||||
node->free_file_name = NULL;
|
||||
node->free_line_no = 0;
|
||||
|
||||
node->link = pnode[0];
|
||||
node->link = pnode[0];
|
||||
|
||||
pnode[0] = node;
|
||||
table->nodes++;
|
||||
@ -377,8 +418,8 @@
|
||||
if ( table->alloc_current > table->alloc_max )
|
||||
table->alloc_max = table->alloc_current;
|
||||
|
||||
if ( table->nodes*3 < table->size ||
|
||||
table->size *3 < table->nodes )
|
||||
if ( table->nodes * 3 < table->size ||
|
||||
table->size * 3 < table->nodes )
|
||||
ft_mem_table_resize( table );
|
||||
}
|
||||
}
|
||||
@ -388,27 +429,26 @@
|
||||
ft_mem_table_remove( FT_MemTable table,
|
||||
FT_Byte* address )
|
||||
{
|
||||
if (table)
|
||||
if ( table )
|
||||
{
|
||||
FT_MemNode *pnode, node;
|
||||
|
||||
|
||||
pnode = ft_mem_table_get_nodep( table, address );
|
||||
node = *pnode;
|
||||
if (node)
|
||||
if ( node )
|
||||
{
|
||||
if ( node->size < 0 )
|
||||
ft_mem_debug_panic( "freeing memory block at %p more than once at (%s:%ld)\n"
|
||||
"block allocated at (%s:%ld) and released at (%s:%ld)",
|
||||
address,
|
||||
FT_FILENAME(table->file_name),
|
||||
table->line_no,
|
||||
FT_FILENAME(node->alloc_file_name),
|
||||
node->alloc_line_no,
|
||||
FT_FILENAME(node->free_file_name),
|
||||
node->free_line_no );
|
||||
|
||||
ft_mem_debug_panic(
|
||||
"freeing memory block at %p more than once at (%s:%ld)\n"
|
||||
"block allocated at (%s:%ld) and released at (%s:%ld)",
|
||||
address,
|
||||
FT_FILENAME( table->file_name ), table->line_no,
|
||||
FT_FILENAME( node->alloc_file_name ), node->alloc_line_no,
|
||||
FT_FILENAME( node->free_file_name ), node->free_line_no );
|
||||
|
||||
/* we simply invert the node's size to indicate that the node */
|
||||
/* was freed. We also change its content.. */
|
||||
/* was freed. We also change its contents. */
|
||||
MEM_Set( address, 0xF3, node->size );
|
||||
|
||||
table->alloc_current -= node->size;
|
||||
@ -417,10 +457,10 @@
|
||||
node->free_line_no = table->line_no;
|
||||
}
|
||||
else
|
||||
ft_mem_debug_panic( "trying to free unknown block at %p in (%s:%ld)\n",
|
||||
address,
|
||||
FT_FILENAME( table->file_name ),
|
||||
table->line_no );
|
||||
ft_mem_debug_panic(
|
||||
"trying to free unknown block at %p in (%s:%ld)\n",
|
||||
address,
|
||||
FT_FILENAME( table->file_name ), table->line_no );
|
||||
}
|
||||
}
|
||||
|
||||
@ -432,16 +472,17 @@
|
||||
FT_MemTable table = memory->user;
|
||||
FT_Byte* block;
|
||||
|
||||
|
||||
if ( size <= 0 )
|
||||
ft_mem_debug_panic( "negative block size allocation (%ld)", size );
|
||||
|
||||
|
||||
block = ft_mem_table_alloc( table, size );
|
||||
if ( block )
|
||||
ft_mem_table_set( table, block, (FT_ULong)size );
|
||||
|
||||
table->file_name = NULL;
|
||||
table->line_no = 0;
|
||||
|
||||
|
||||
return (FT_Pointer) block;
|
||||
}
|
||||
|
||||
@ -451,21 +492,21 @@
|
||||
FT_Pointer block )
|
||||
{
|
||||
FT_MemTable table = memory->user;
|
||||
|
||||
|
||||
|
||||
if ( block == NULL )
|
||||
ft_mem_debug_panic( "trying to free NULL in (%s:%ld)",
|
||||
FT_FILENAME( table->file_name ),
|
||||
table->line_no );
|
||||
|
||||
|
||||
ft_mem_table_remove( table, (FT_Byte*)block );
|
||||
|
||||
|
||||
/* we never really free the block */
|
||||
table->file_name = NULL;
|
||||
table->line_no = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern FT_Pointer
|
||||
ft_mem_debug_realloc( FT_Memory memory,
|
||||
FT_Long cur_size,
|
||||
@ -476,34 +517,37 @@
|
||||
FT_MemNode node, *pnode;
|
||||
FT_Pointer new_block;
|
||||
|
||||
const char* file_name = FT_FILENAME(table->file_name);
|
||||
const char* file_name = FT_FILENAME( table->file_name );
|
||||
FT_Long line_no = table->line_no;
|
||||
|
||||
|
||||
if ( block == NULL || cur_size == 0 )
|
||||
ft_mem_debug_panic( "trying to reallocate NULL in (%s:%ld)",
|
||||
file_name, line_no );
|
||||
|
||||
|
||||
if ( new_size <= 0 )
|
||||
ft_mem_debug_panic( "trying to reallocate %p to size 0 (current is %ld)"
|
||||
" in (%s:%ld)",
|
||||
block, cur_size, file_name, line_no );
|
||||
|
||||
/* check 'cur_size' value */
|
||||
ft_mem_debug_panic(
|
||||
"trying to reallocate %p to size 0 (current is %ld) in (%s:%ld)",
|
||||
block, cur_size, file_name, line_no );
|
||||
|
||||
/* check 'cur_size' value */
|
||||
pnode = ft_mem_table_get_nodep( table, (FT_Byte*)block );
|
||||
node = *pnode;
|
||||
if (!node)
|
||||
ft_mem_debug_panic( "trying to reallocate unknown block at %p in (%s:%ld)",
|
||||
block, file_name, line_no );
|
||||
|
||||
if ( !node )
|
||||
ft_mem_debug_panic(
|
||||
"trying to reallocate unknown block at %p in (%s:%ld)",
|
||||
block, file_name, line_no );
|
||||
|
||||
if ( node->size <= 0 )
|
||||
ft_mem_debug_panic( "trying to reallocate freed block at %p in (%s:%ld)",
|
||||
block, file_name, line_no );
|
||||
|
||||
ft_mem_debug_panic(
|
||||
"trying to reallocate freed block at %p in (%s:%ld)",
|
||||
block, file_name, line_no );
|
||||
|
||||
if ( node->size != cur_size )
|
||||
ft_mem_debug_panic( "invalid realloc request for %p. cur_size is "
|
||||
"%ld instead of %ld in (%s:%ld)",
|
||||
block, cur_size, node->size, file_name, line_no );
|
||||
|
||||
|
||||
new_block = ft_mem_debug_alloc( memory, new_size );
|
||||
if ( new_block == NULL )
|
||||
return NULL;
|
||||
@ -514,19 +558,20 @@
|
||||
table->line_no = line_no;
|
||||
|
||||
ft_mem_debug_free( memory, (FT_Byte*)block );
|
||||
|
||||
|
||||
return new_block;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
extern FT_Int
|
||||
ft_mem_debug_init( FT_Memory memory )
|
||||
{
|
||||
FT_MemTable table;
|
||||
FT_Int result = 0;
|
||||
|
||||
if ( getenv( "FT_DEBUG_MEMORY") )
|
||||
{
|
||||
|
||||
if ( getenv( "FT_DEBUG_MEMORY" ) )
|
||||
{
|
||||
table = ft_mem_table_new( memory );
|
||||
if ( table )
|
||||
{
|
||||
@ -538,20 +583,21 @@
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
extern void
|
||||
ft_mem_debug_done( FT_Memory memory )
|
||||
{
|
||||
FT_MemTable table = memory->user;
|
||||
|
||||
|
||||
|
||||
if ( table )
|
||||
{
|
||||
memory->free = table->free;
|
||||
memory->realloc = table->realloc;
|
||||
memory->alloc = table->alloc;
|
||||
|
||||
|
||||
ft_mem_table_destroy( table );
|
||||
memory->user = NULL;
|
||||
}
|
||||
@ -566,7 +612,8 @@
|
||||
FT_Long line_no )
|
||||
{
|
||||
FT_MemTable table = memory->user;
|
||||
|
||||
|
||||
|
||||
if ( table )
|
||||
{
|
||||
table->file_name = file_name;
|
||||
@ -585,7 +632,8 @@
|
||||
FT_Long line_no )
|
||||
{
|
||||
FT_MemTable table = memory->user;
|
||||
|
||||
|
||||
|
||||
if ( table )
|
||||
{
|
||||
table->file_name = file_name;
|
||||
@ -602,7 +650,8 @@
|
||||
FT_Long line_no )
|
||||
{
|
||||
FT_MemTable table = memory->user;
|
||||
|
||||
|
||||
|
||||
if ( table )
|
||||
{
|
||||
table->file_name = file_name;
|
||||
@ -613,8 +662,11 @@
|
||||
|
||||
|
||||
#else /* !FT_DEBUG_MEMORY */
|
||||
|
||||
/* ansi C doesn't like empty source files */
|
||||
|
||||
/* ANSI C doesn't like empty source files */
|
||||
extern const FT_Byte _debug_mem_dummy = 0;
|
||||
|
||||
#endif /* !FT_DEBUG_MEMORY */
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -239,21 +239,22 @@
|
||||
*have_sfnt = 0;
|
||||
lwfn_file_name[0] = 0;
|
||||
|
||||
fond = (FamRec*)fond_data;
|
||||
assoc = (AsscEntry*)( fond_data + sizeof ( FamRec ) + 2 );
|
||||
fond = (FamRec*)fond_data;
|
||||
assoc = (AsscEntry*)( fond_data + sizeof ( FamRec ) + 2 );
|
||||
base_assoc = assoc;
|
||||
assoc += face_index; /* add on the face_index! */
|
||||
assoc += face_index; /* add on the face_index! */
|
||||
|
||||
/* if the face at this index is not scalable, fall back to the first one (old behavior) */
|
||||
/* if the face at this index is not scalable,
|
||||
fall back to the first one (old behavior) */
|
||||
if ( assoc->fontSize == 0 )
|
||||
{
|
||||
*have_sfnt = 1;
|
||||
*sfnt_id = assoc->fontID;
|
||||
*sfnt_id = assoc->fontID;
|
||||
}
|
||||
else if (base_assoc->fontSize == 0)
|
||||
else if ( base_assoc->fontSize == 0 )
|
||||
{
|
||||
*have_sfnt = 1;
|
||||
*sfnt_id = base_assoc->fontID;
|
||||
*sfnt_id = base_assoc->fontID;
|
||||
}
|
||||
|
||||
if ( fond->ffStylOff )
|
||||
@ -647,7 +648,7 @@
|
||||
FT_Error error = FT_Err_Unknown_File_Format;
|
||||
|
||||
|
||||
GetResInfo(fond, &fond_id, &fond_type, fond_name);
|
||||
GetResInfo( fond, &fond_id, &fond_type, fond_name );
|
||||
if ( ResError() != noErr || fond_type != 'FOND' )
|
||||
return FT_Err_Invalid_File_Format;
|
||||
|
||||
|
@ -1920,6 +1920,7 @@
|
||||
{
|
||||
const char* result = NULL;
|
||||
|
||||
|
||||
if ( !face )
|
||||
goto Exit;
|
||||
|
||||
@ -1927,13 +1928,15 @@
|
||||
if ( !result )
|
||||
{
|
||||
/* now, lookup for glyph name */
|
||||
FT_Driver driver = face->driver;
|
||||
FT_Module_Class* clazz = FT_MODULE_CLASS( driver );
|
||||
FT_Driver driver = face->driver;
|
||||
FT_Module_Class* clazz = FT_MODULE_CLASS( driver );
|
||||
|
||||
|
||||
if ( clazz->get_interface )
|
||||
{
|
||||
FT_PSName_Requester requester;
|
||||
|
||||
|
||||
requester = (FT_PSName_Requester)clazz->get_interface(
|
||||
FT_MODULE( driver ), "postscript_name" );
|
||||
if ( requester )
|
||||
|
55
src/cache/ftcchunk.c
vendored
55
src/cache/ftcchunk.c
vendored
@ -34,15 +34,17 @@
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
#define FTC_CSET_CHUNK_INDEX(cset,gindex) \
|
||||
( (gindex) / (cset)->item_count )
|
||||
|
||||
#define FTC_CSET_START(cset,gindex) \
|
||||
( FTC_CSET_CHUNK_INDEX(cset,gindex) * (cset)->item_count )
|
||||
|
||||
#define FTC_CSET_HASH(cset,gindex) \
|
||||
((FT_UFast)( ((cset)->hash << 16) | \
|
||||
(FTC_CSET_CHUNK_INDEX(cset,gindex) & 0xFFFF) ))
|
||||
#define FTC_CSET_CHUNK_INDEX( cset, gindex ) \
|
||||
( (gindex) / (cset)->item_count )
|
||||
|
||||
#define FTC_CSET_START( cset, gindex ) \
|
||||
( FTC_CSET_CHUNK_INDEX( cset, gindex ) * (cset)->item_count )
|
||||
|
||||
#define FTC_CSET_HASH( cset, gindex ) \
|
||||
( (FT_UFast)( ( (cset)->hash << 16 ) | \
|
||||
( FTC_CSET_CHUNK_INDEX( cset, gindex ) & 0xFFFF ) ) )
|
||||
|
||||
|
||||
/* create a new chunk node, setting its cache index and ref count */
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
@ -54,10 +56,11 @@
|
||||
FTC_ChunkCache ccache = cset->ccache;
|
||||
FT_Error error = 0;
|
||||
FT_UInt len;
|
||||
FT_UInt start = FTC_CSET_START(cset,gindex);
|
||||
FT_UInt start = FTC_CSET_START( cset, gindex );
|
||||
|
||||
|
||||
cnode->cset = cset;
|
||||
cnode->node.hash = FTC_CSET_HASH(cset,gindex);
|
||||
cnode->node.hash = FTC_CSET_HASH( cset, gindex );
|
||||
cnode->item_start = start;
|
||||
|
||||
len = cset->item_total - start;
|
||||
@ -70,10 +73,11 @@
|
||||
{
|
||||
FT_Memory memory = ccache->cache.memory;
|
||||
|
||||
|
||||
error = MEM_Alloc( cnode->items, cset->item_size * cnode->item_count );
|
||||
}
|
||||
|
||||
if (!error )
|
||||
if ( !error )
|
||||
cset->num_chunks++;
|
||||
|
||||
return error;
|
||||
@ -83,21 +87,21 @@
|
||||
FT_EXPORT_DEF( void )
|
||||
ftc_chunk_node_done( FTC_ChunkNode cnode )
|
||||
{
|
||||
FTC_ChunkSet cset = cnode->cset;
|
||||
FTC_ChunkSet cset = cnode->cset;
|
||||
FT_Memory memory = cset->ccache->cache.memory;
|
||||
|
||||
|
||||
/* destroy the node */
|
||||
FREE( cnode->items );
|
||||
cnode->item_count = 0;
|
||||
cnode->item_start = 0;
|
||||
|
||||
/* remove from parent set table - eventually destroy the set */
|
||||
/* remove from parent set table -- eventually destroy the set */
|
||||
if ( --cset->num_chunks <= 0 )
|
||||
FT_LruList_Remove( cset->ccache->cset_lru, (FT_LruNode) cset );
|
||||
FT_LruList_Remove( cset->ccache->cset_lru, (FT_LruNode)cset );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
@ -143,9 +147,9 @@
|
||||
|
||||
|
||||
FT_EXPORT_DEF( void )
|
||||
ftc_chunk_cache_done( FTC_ChunkCache ccache )
|
||||
ftc_chunk_cache_done( FTC_ChunkCache ccache )
|
||||
{
|
||||
ftc_cache_done( FTC_CACHE(ccache) );
|
||||
ftc_cache_done( FTC_CACHE( ccache ) );
|
||||
|
||||
/* simply delete all remaining glyph sets */
|
||||
if ( ccache->cset_lru )
|
||||
@ -156,15 +160,16 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
ftc_chunk_cache_init( FTC_ChunkCache ccache,
|
||||
FT_LruList_Class cset_class )
|
||||
{
|
||||
FT_Error error;
|
||||
|
||||
error = ftc_cache_init( FTC_CACHE(ccache) );
|
||||
if (error) goto Exit;
|
||||
|
||||
error = ftc_cache_init( FTC_CACHE( ccache ) );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
error = FT_LruList_New( cset_class, 0, ccache,
|
||||
ccache->cache.memory,
|
||||
@ -174,7 +179,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
ftc_chunk_cache_lookup( FTC_ChunkCache ccache,
|
||||
FTC_ChunkQuery query,
|
||||
@ -183,14 +187,15 @@
|
||||
FT_LruNode node;
|
||||
FT_Error error;
|
||||
|
||||
|
||||
error = FT_LruList_Lookup( ccache->cset_lru, query, &node );
|
||||
if ( !error )
|
||||
{
|
||||
FTC_ChunkSet cset = FTC_CHUNK_SET(node);
|
||||
FT_UFast hash = FTC_CSET_HASH( cset, query->gindex );
|
||||
FTC_ChunkSet cset = FTC_CHUNK_SET( node );
|
||||
FT_UFast hash = FTC_CSET_HASH( cset, query->gindex );
|
||||
|
||||
error = ftc_cache_lookup_node( FTC_CACHE(ccache), hash, query,
|
||||
FTC_NODE_P(anode) );
|
||||
error = ftc_cache_lookup_node( FTC_CACHE( ccache ), hash, query,
|
||||
FTC_NODE_P( anode ) );
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
35
src/cache/ftcglyph.c
vendored
35
src/cache/ftcglyph.c
vendored
@ -35,8 +35,9 @@
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
#define FTC_GSET_HASH(gset,gindex) \
|
||||
((FT_UFast)(((gset)->hash << 16) | ((gindex) & 0xFFFF)))
|
||||
|
||||
#define FTC_GSET_HASH( gset, gindex ) \
|
||||
( (FT_UFast)( ( (gset)->hash << 16 ) | ( (gindex) & 0xFFFF ) ) )
|
||||
|
||||
|
||||
/* create a new glyph node, setting its cache index and ref count */
|
||||
@ -59,14 +60,14 @@
|
||||
/* will happen! */
|
||||
|
||||
FT_EXPORT_DEF( void )
|
||||
ftc_glyph_node_done( FTC_GlyphNode gnode )
|
||||
ftc_glyph_node_done( FTC_GlyphNode gnode )
|
||||
{
|
||||
FTC_GlyphSet gset = gnode->gset;
|
||||
|
||||
if ( --gset->num_glyphs <= 0 )
|
||||
FT_LruList_Remove( gset->gcache->gset_lru, (FT_LruNode) gset );
|
||||
}
|
||||
|
||||
if ( --gset->num_glyphs <= 0 )
|
||||
FT_LruList_Remove( gset->gcache->gset_lru, (FT_LruNode)gset );
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
@ -77,12 +78,14 @@
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
ftc_glyph_set_init( FTC_GlyphSet gset,
|
||||
FT_LruList lru )
|
||||
FT_LruList lru )
|
||||
{
|
||||
FTC_GlyphCache gcache = lru->user_data;
|
||||
|
||||
|
||||
gset->gcache = gcache;
|
||||
gset->num_glyphs = 0;
|
||||
|
||||
@ -94,7 +97,7 @@
|
||||
ftc_glyph_set_done( FTC_GlyphSet gset )
|
||||
{
|
||||
/* for now, nothing to be done here */
|
||||
FT_UNUSED(gset);
|
||||
FT_UNUSED( gset );
|
||||
}
|
||||
|
||||
|
||||
@ -108,7 +111,7 @@
|
||||
|
||||
|
||||
FT_EXPORT_DEF( void )
|
||||
ftc_glyph_cache_done( FTC_GlyphCache gcache )
|
||||
ftc_glyph_cache_done( FTC_GlyphCache gcache )
|
||||
{
|
||||
/* remove all nodes in the cache */
|
||||
ftc_cache_done( &gcache->cache );
|
||||
@ -128,8 +131,10 @@
|
||||
{
|
||||
FT_Error error;
|
||||
|
||||
error = ftc_cache_init( FTC_CACHE(gcache) );
|
||||
if (error) goto Exit;
|
||||
|
||||
error = ftc_cache_init( FTC_CACHE( gcache ) );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
error = FT_LruList_New( gset_class, 0, gcache,
|
||||
gcache->cache.memory,
|
||||
@ -147,18 +152,18 @@
|
||||
FT_LruNode node;
|
||||
FT_Error error;
|
||||
|
||||
|
||||
error = FT_LruList_Lookup( gcache->gset_lru, query, &node );
|
||||
if ( !error )
|
||||
{
|
||||
FTC_GlyphSet gset = (FTC_GlyphSet) node;
|
||||
FTC_GlyphSet gset = (FTC_GlyphSet)node;
|
||||
FT_UFast hash = FTC_GSET_HASH( gset, query->gindex );
|
||||
|
||||
error = ftc_cache_lookup_node( FTC_CACHE(gcache), hash, query,
|
||||
FTC_NODE_P(anode) );
|
||||
error = ftc_cache_lookup_node( FTC_CACHE( gcache ), hash, query,
|
||||
FTC_NODE_P( anode ) );
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* END */
|
||||
|
138
src/cache/ftcimage.c
vendored
138
src/cache/ftcimage.c
vendored
@ -36,8 +36,10 @@
|
||||
|
||||
} FTC_ImageNodeRec, *FTC_ImageNode;
|
||||
|
||||
#define FTC_IMAGE_NODE(x) ((FTC_ImageNode)(x))
|
||||
#define FTC_IMAGE_NODE_GINDEX(x) FTC_GLYPH_NODE_GINDEX(x)
|
||||
|
||||
#define FTC_IMAGE_NODE( x ) ((FTC_ImageNode)( x ))
|
||||
#define FTC_IMAGE_NODE_GINDEX( x ) FTC_GLYPH_NODE_GINDEX( x )
|
||||
|
||||
|
||||
/* the glyph image set type */
|
||||
typedef struct FTC_ImageSetRec_
|
||||
@ -47,16 +49,16 @@
|
||||
|
||||
} FTC_ImageSetRec, *FTC_ImageSet;
|
||||
|
||||
#define FTC_IMAGE_SET(x) ((FTC_ImageSet)(x))
|
||||
|
||||
#define FTC_IMAGE_SET_MEMORY(x) FTC_GLYPH_SET_MEMORY(&(x)->gset)
|
||||
#define FTC_IMAGE_SET( x ) ((FTC_ImageSet)( x ))
|
||||
#define FTC_IMAGE_SET_MEMORY( x ) FTC_GLYPH_SET_MEMORY( &(x)->gset )
|
||||
|
||||
|
||||
typedef struct FTC_ImageQueryRec_
|
||||
typedef struct FTC_ImageQueryRec_
|
||||
{
|
||||
FTC_GlyphQueryRec glyph;
|
||||
FTC_Image_Desc desc;
|
||||
|
||||
|
||||
} FTC_ImageQueryRec, *FTC_ImageQuery;
|
||||
|
||||
|
||||
@ -69,11 +71,11 @@
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/* finalize a given glyph image node */
|
||||
/* finalize a given glyph image node */
|
||||
FT_CALLBACK_DEF( void )
|
||||
ftc_image_node_done( FTC_ImageNode inode )
|
||||
{
|
||||
if (inode->glyph)
|
||||
if ( inode->glyph )
|
||||
{
|
||||
FT_Done_Glyph( inode->glyph );
|
||||
inode->glyph = NULL;
|
||||
@ -81,19 +83,20 @@
|
||||
}
|
||||
|
||||
|
||||
/* initialize a new glyph image node */
|
||||
/* initialize a new glyph image node */
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
ftc_image_node_init( FTC_ImageNode inode,
|
||||
FTC_GlyphQuery query )
|
||||
{
|
||||
FTC_ImageSet iset = FTC_IMAGE_SET( query->gset );
|
||||
FT_Memory memory = FTC_IMAGE_SET_MEMORY( iset );
|
||||
FT_Error error;
|
||||
FT_Face face;
|
||||
FT_Size size;
|
||||
FTC_ImageSet iset = FTC_IMAGE_SET( query->gset );
|
||||
FT_Error error;
|
||||
FT_Face face;
|
||||
FT_Size size;
|
||||
|
||||
|
||||
/* initialize its inner fields */
|
||||
ftc_glyph_node_init( FTC_GLYPH_NODE(inode), query->gindex, query->gset );
|
||||
ftc_glyph_node_init( FTC_GLYPH_NODE( inode ),
|
||||
query->gindex, query->gset );
|
||||
|
||||
/* we will now load the glyph image */
|
||||
error = FTC_Manager_Lookup_Size( iset->gset.gcache->cache.manager,
|
||||
@ -152,9 +155,9 @@
|
||||
error = FTC_Err_Invalid_Argument;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* in case of error */
|
||||
ftc_glyph_node_done( FTC_GLYPH_NODE(inode) );
|
||||
ftc_glyph_node_done( FTC_GLYPH_NODE( inode ) );
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
@ -167,6 +170,7 @@
|
||||
FT_ULong size = 0;
|
||||
FT_Glyph glyph = inode->glyph;
|
||||
|
||||
|
||||
switch ( glyph->format )
|
||||
{
|
||||
case ft_glyph_format_bitmap:
|
||||
@ -187,7 +191,7 @@
|
||||
|
||||
outg = (FT_OutlineGlyph)glyph;
|
||||
size = outg->outline.n_points *
|
||||
( sizeof( FT_Vector ) + sizeof ( FT_Byte ) ) +
|
||||
( sizeof ( FT_Vector ) + sizeof ( FT_Byte ) ) +
|
||||
outg->outline.n_contours * sizeof ( FT_Short ) +
|
||||
sizeof ( *outg );
|
||||
}
|
||||
@ -202,22 +206,19 @@
|
||||
}
|
||||
|
||||
|
||||
/* this function assumes that the desired node's glyph set has been */
|
||||
/* set by a previous call to ftc_image_set_compare.. */
|
||||
/* */
|
||||
/* this function assumes that the desired node's glyph set has been */
|
||||
/* set by a previous call to ftc_image_set_compare() */
|
||||
/* */
|
||||
FT_CALLBACK_DEF( FT_Bool )
|
||||
ftc_image_node_compare( FTC_ImageNode inode,
|
||||
FTC_ImageQuery iquery )
|
||||
{
|
||||
FTC_ImageSet iset = FTC_IMAGE_SET(inode->gnode.gset);
|
||||
|
||||
/* only if same glyph index and image set description */
|
||||
return FT_BOOL( iquery->glyph.gindex == FTC_IMAGE_NODE_GINDEX(inode) &&
|
||||
/* only if same glyph index and image set description */
|
||||
return FT_BOOL( iquery->glyph.gindex == FTC_IMAGE_NODE_GINDEX( inode ) &&
|
||||
iquery->glyph.gset == inode->gnode.gset );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
@ -234,10 +235,10 @@
|
||||
{
|
||||
ftc_glyph_set_init( &iset->gset, lru );
|
||||
iset->description = query->desc;
|
||||
|
||||
/* now compute hash from description - this is _very_ important */
|
||||
iset->gset.hash = FTC_IMAGE_DESC_HASH(&query->desc);
|
||||
query->glyph.gset = FTC_GLYPH_SET(iset);
|
||||
|
||||
/* now compute hash from description -- this is _very_ important */
|
||||
iset->gset.hash = FTC_IMAGE_DESC_HASH( &query->desc );
|
||||
query->glyph.gset = FTC_GLYPH_SET( iset );
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -249,11 +250,13 @@
|
||||
{
|
||||
FT_Bool result;
|
||||
|
||||
|
||||
/* we must set iquery.glyph.gset for faster glyph node comparisons */
|
||||
result = FT_BOOL( FTC_IMAGE_DESC_COMPARE( &iset->description, &iquery->desc ) );
|
||||
result = FT_BOOL( FTC_IMAGE_DESC_COMPARE( &iset->description,
|
||||
&iquery->desc ) );
|
||||
if ( result )
|
||||
iquery->glyph.gset = &iset->gset;
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -261,15 +264,15 @@
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const FT_LruList_ClassRec ftc_image_set_class =
|
||||
{
|
||||
sizeof( FT_LruListRec ),
|
||||
(FT_LruList_InitFunc) NULL,
|
||||
(FT_LruList_DoneFunc) NULL,
|
||||
|
||||
sizeof( FTC_ImageSetRec ),
|
||||
(FT_LruNode_InitFunc) ftc_image_set_init,
|
||||
(FT_LruNode_DoneFunc) ftc_glyph_set_init,
|
||||
(FT_LruNode_FlushFunc) NULL,
|
||||
(FT_LruNode_CompareFunc) ftc_image_set_compare
|
||||
sizeof ( FT_LruListRec ),
|
||||
(FT_LruList_InitFunc) NULL,
|
||||
(FT_LruList_DoneFunc) NULL,
|
||||
|
||||
sizeof ( FTC_ImageSetRec ),
|
||||
(FT_LruNode_InitFunc) ftc_image_set_init,
|
||||
(FT_LruNode_DoneFunc) ftc_glyph_set_init,
|
||||
(FT_LruNode_FlushFunc) NULL,
|
||||
(FT_LruNode_CompareFunc)ftc_image_set_compare
|
||||
};
|
||||
|
||||
|
||||
@ -285,22 +288,23 @@
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
ftc_image_cache_init( FTC_Image_Cache cache )
|
||||
{
|
||||
return ftc_glyph_cache_init( (FTC_GlyphCache) cache, &ftc_image_set_class );
|
||||
return ftc_glyph_cache_init( (FTC_GlyphCache)cache,
|
||||
&ftc_image_set_class );
|
||||
}
|
||||
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const FTC_Cache_ClassRec ftc_image_cache_class =
|
||||
{
|
||||
sizeof( FTC_GlyphCacheRec ),
|
||||
(FTC_Cache_InitFunc) ftc_image_cache_init,
|
||||
(FTC_Cache_DoneFunc) ftc_glyph_cache_done,
|
||||
|
||||
sizeof( FTC_ImageNodeRec ),
|
||||
(FTC_Node_InitFunc) ftc_image_node_init,
|
||||
(FTC_Node_WeightFunc) ftc_image_node_weight,
|
||||
(FTC_Node_CompareFunc) ftc_image_node_compare,
|
||||
(FTC_Node_DoneFunc) ftc_image_node_done
|
||||
sizeof ( FTC_GlyphCacheRec ),
|
||||
(FTC_Cache_InitFunc) ftc_image_cache_init,
|
||||
(FTC_Cache_DoneFunc) ftc_glyph_cache_done,
|
||||
|
||||
sizeof ( FTC_ImageNodeRec ),
|
||||
(FTC_Node_InitFunc) ftc_image_node_init,
|
||||
(FTC_Node_WeightFunc) ftc_image_node_weight,
|
||||
(FTC_Node_CompareFunc)ftc_image_node_compare,
|
||||
(FTC_Node_DoneFunc) ftc_image_node_done
|
||||
};
|
||||
|
||||
|
||||
@ -312,8 +316,8 @@
|
||||
{
|
||||
return FTC_Manager_Register_Cache(
|
||||
manager,
|
||||
(FTC_Cache_Class) &ftc_image_cache_class,
|
||||
FTC_CACHE_P(acache) );
|
||||
(FTC_Cache_Class)&ftc_image_cache_class,
|
||||
FTC_CACHE_P( acache ) );
|
||||
}
|
||||
|
||||
|
||||
@ -329,47 +333,46 @@
|
||||
FTC_ImageQueryRec query;
|
||||
FTC_ImageNode node;
|
||||
FT_Error error;
|
||||
|
||||
/* some argument checks are delayed to ftc_glyph_cache_lookup */
|
||||
|
||||
|
||||
/* some argument checks are delayed to ftc_glyph_cache_lookup() */
|
||||
if ( !cache || !desc || !aglyph )
|
||||
return FTC_Err_Invalid_Argument;
|
||||
|
||||
*aglyph = NULL;
|
||||
|
||||
|
||||
if ( anode )
|
||||
*anode = NULL;
|
||||
|
||||
query.glyph.gindex = gindex;
|
||||
query.glyph.gset = NULL;
|
||||
query.desc = *desc;
|
||||
error = ftc_glyph_cache_lookup( FTC_GLYPH_CACHE(cache),
|
||||
error = ftc_glyph_cache_lookup( FTC_GLYPH_CACHE( cache ),
|
||||
&query.glyph,
|
||||
(FTC_GlyphNode*) &node );
|
||||
if (!error)
|
||||
(FTC_GlyphNode*)&node );
|
||||
if ( !error )
|
||||
{
|
||||
*aglyph = node->glyph;
|
||||
|
||||
if (anode)
|
||||
|
||||
if ( anode )
|
||||
{
|
||||
*anode = (FTC_Node) node;
|
||||
*anode = (FTC_Node)node;
|
||||
FTC_NODE(node)->ref_count++;
|
||||
}
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FT_EXPORT_DEF( void )
|
||||
FTC_Image_Cache_Release( FTC_Image_Cache icache,
|
||||
FTC_Node node )
|
||||
{
|
||||
ftc_node_unref( node, FTC_CACHE(icache) );
|
||||
ftc_node_unref( node, FTC_CACHE( icache ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FTC_Image_Cache_Lookup( FTC_Image_Cache icache,
|
||||
FTC_Image_Desc* desc,
|
||||
@ -380,5 +383,4 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* END */
|
||||
|
228
src/cache/ftcmanag.c
vendored
228
src/cache/ftcmanag.c
vendored
@ -31,7 +31,7 @@
|
||||
#undef FT_COMPONENT
|
||||
#define FT_COMPONENT trace_cache
|
||||
|
||||
#define FTC_LRU_GET_MANAGER( lru ) ((FTC_Manager)(lru)->user_data)
|
||||
#define FTC_LRU_GET_MANAGER( lru ) ( (FTC_Manager)(lru)->user_data )
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
@ -42,11 +42,11 @@
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
typedef struct FTC_FaceNodeRec_* FTC_FaceNode;
|
||||
typedef struct FTC_FaceNodeRec_* FTC_FaceNode;
|
||||
typedef struct FTC_SizeNodeRec_* FTC_SizeNode;
|
||||
|
||||
typedef struct FTC_SizeNodeRec_* FTC_SizeNode;
|
||||
|
||||
typedef struct FTC_FaceNodeRec_
|
||||
typedef struct FTC_FaceNodeRec_
|
||||
{
|
||||
FT_LruNodeRec lru;
|
||||
FT_Face face;
|
||||
@ -54,7 +54,7 @@
|
||||
} FTC_FaceNodeRec;
|
||||
|
||||
|
||||
typedef struct FTC_SizeNodeRec_
|
||||
typedef struct FTC_SizeNodeRec_
|
||||
{
|
||||
FT_LruNodeRec lru;
|
||||
FT_Size size;
|
||||
@ -62,13 +62,12 @@
|
||||
} FTC_SizeNodeRec;
|
||||
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
ftc_face_node_init( FTC_FaceNode node,
|
||||
FTC_FaceID face_id,
|
||||
FT_LruList list )
|
||||
ftc_face_node_init( FTC_FaceNode node,
|
||||
FTC_FaceID face_id,
|
||||
FT_LruList list )
|
||||
{
|
||||
FTC_Manager manager = FTC_LRU_GET_MANAGER(list);
|
||||
FTC_Manager manager = FTC_LRU_GET_MANAGER( list );
|
||||
FT_Error error;
|
||||
|
||||
|
||||
@ -87,27 +86,27 @@
|
||||
}
|
||||
|
||||
|
||||
/* helper function for ftc_manager_done_face() */
|
||||
FT_CALLBACK_DEF( FT_Bool )
|
||||
ftc_size_node_select( FTC_SizeNode node,
|
||||
FT_Face face )
|
||||
{
|
||||
return FT_BOOL( node->size->face == face );
|
||||
}
|
||||
/* helper function for ftc_manager_done_face() */
|
||||
FT_CALLBACK_DEF( FT_Bool )
|
||||
ftc_size_node_select( FTC_SizeNode node,
|
||||
FT_Face face )
|
||||
{
|
||||
return FT_BOOL( node->size->face == face );
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( void )
|
||||
ftc_face_node_done( FTC_FaceNode node,
|
||||
FT_LruList list )
|
||||
{
|
||||
FTC_Manager manager = FTC_LRU_GET_MANAGER(list);
|
||||
FTC_Manager manager = FTC_LRU_GET_MANAGER( list );
|
||||
FT_Face face = node->face;
|
||||
|
||||
|
||||
/* we must begin by removing all sizes for the target face */
|
||||
/* from the manager's list */
|
||||
FT_LruList_Remove_Selection( manager->sizes_list,
|
||||
(FT_LruNode_SelectFunc) ftc_size_node_select,
|
||||
(FT_LruNode_SelectFunc)ftc_size_node_select,
|
||||
face );
|
||||
|
||||
/* all right, we can discard the face now */
|
||||
@ -117,17 +116,17 @@
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const FT_LruList_ClassRec ftc_face_list_class =
|
||||
const FT_LruList_ClassRec ftc_face_list_class =
|
||||
{
|
||||
sizeof( FT_LruListRec ),
|
||||
(FT_LruList_InitFunc) 0,
|
||||
(FT_LruList_DoneFunc) 0,
|
||||
sizeof ( FT_LruListRec ),
|
||||
(FT_LruList_InitFunc) 0,
|
||||
(FT_LruList_DoneFunc) 0,
|
||||
|
||||
sizeof( FTC_FaceNodeRec ),
|
||||
(FT_LruNode_InitFunc) ftc_face_node_init,
|
||||
(FT_LruNode_DoneFunc) ftc_face_node_done,
|
||||
(FT_LruNode_FlushFunc) 0, /* no flushing needed.. */
|
||||
(FT_LruNode_CompareFunc) 0, /* direct comparison of FTC_FaceID handles */
|
||||
sizeof ( FTC_FaceNodeRec ),
|
||||
(FT_LruNode_InitFunc) ftc_face_node_init,
|
||||
(FT_LruNode_DoneFunc) ftc_face_node_done,
|
||||
(FT_LruNode_FlushFunc) 0, /* no flushing needed */
|
||||
(FT_LruNode_CompareFunc)0, /* direct comparison of FTC_FaceID handles */
|
||||
};
|
||||
|
||||
|
||||
@ -149,7 +148,6 @@
|
||||
} FTC_SizeQueryRec, *FTC_SizeQuery;
|
||||
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
ftc_size_node_init( FTC_SizeNode node,
|
||||
FTC_SizeQuery query )
|
||||
@ -179,7 +177,7 @@
|
||||
FT_CALLBACK_DEF( void )
|
||||
ftc_size_node_done( FTC_SizeNode node )
|
||||
{
|
||||
if (node->size)
|
||||
if ( node->size )
|
||||
{
|
||||
FT_Done_Size( node->size );
|
||||
node->size = NULL;
|
||||
@ -222,9 +220,10 @@
|
||||
{
|
||||
FT_Size size = node->size;
|
||||
|
||||
return FT_BOOL( size->face == query->face &&
|
||||
(FT_UInt) size->metrics.x_ppem == query->width &&
|
||||
(FT_UInt) size->metrics.y_ppem == query->height );
|
||||
|
||||
return FT_BOOL( size->face == query->face &&
|
||||
(FT_UInt)size->metrics.x_ppem == query->width &&
|
||||
(FT_UInt)size->metrics.y_ppem == query->height );
|
||||
}
|
||||
|
||||
|
||||
@ -232,14 +231,14 @@
|
||||
const FT_LruList_ClassRec ftc_size_list_class =
|
||||
{
|
||||
sizeof ( FT_LruListRec ),
|
||||
(FT_LruList_InitFunc) 0,
|
||||
(FT_LruList_DoneFunc) 0,
|
||||
(FT_LruList_InitFunc) 0,
|
||||
(FT_LruList_DoneFunc) 0,
|
||||
|
||||
sizeof( FTC_SizeNodeRec ),
|
||||
(FT_LruNode_InitFunc) ftc_size_node_init,
|
||||
(FT_LruNode_DoneFunc) ftc_size_node_done,
|
||||
(FT_LruNode_FlushFunc) ftc_size_node_flush,
|
||||
(FT_LruNode_CompareFunc) ftc_size_node_compare
|
||||
sizeof ( FTC_SizeNodeRec ),
|
||||
(FT_LruNode_InitFunc) ftc_size_node_init,
|
||||
(FT_LruNode_DoneFunc) ftc_size_node_done,
|
||||
(FT_LruNode_FlushFunc) ftc_size_node_flush,
|
||||
(FT_LruNode_CompareFunc)ftc_size_node_compare
|
||||
};
|
||||
|
||||
|
||||
@ -308,8 +307,6 @@
|
||||
manager->request_face = requester;
|
||||
manager->request_data = req_data;
|
||||
|
||||
|
||||
|
||||
*amanager = manager;
|
||||
|
||||
Exit:
|
||||
@ -368,7 +365,7 @@
|
||||
FT_EXPORT_DEF( void )
|
||||
FTC_Manager_Reset( FTC_Manager manager )
|
||||
{
|
||||
if (manager )
|
||||
if ( manager )
|
||||
{
|
||||
FT_LruList_Reset( manager->sizes_list );
|
||||
FT_LruList_Reset( manager->faces_list );
|
||||
@ -387,6 +384,7 @@
|
||||
FT_Error error;
|
||||
FTC_FaceNode node;
|
||||
|
||||
|
||||
if ( aface == NULL )
|
||||
return FTC_Err_Bad_Argument;
|
||||
|
||||
@ -395,10 +393,10 @@
|
||||
if ( !manager )
|
||||
return FTC_Err_Invalid_Cache_Handle;
|
||||
|
||||
error = FT_LruList_Lookup( manager->faces_list,
|
||||
(FT_LruKey) face_id,
|
||||
(FT_LruNode*) &node );
|
||||
if (!error)
|
||||
error = FT_LruList_Lookup( manager->faces_list,
|
||||
(FT_LruKey)face_id,
|
||||
(FT_LruNode*)&node );
|
||||
if ( !error )
|
||||
*aface = node->face;
|
||||
|
||||
return error;
|
||||
@ -435,8 +433,8 @@
|
||||
query.height = font->pix_height;
|
||||
|
||||
error = FT_LruList_Lookup( manager->sizes_list,
|
||||
(FT_LruKey) &query,
|
||||
(FT_LruNode*) &node );
|
||||
(FT_LruKey)&query,
|
||||
(FT_LruNode*)&node );
|
||||
if ( !error )
|
||||
{
|
||||
/* select the size as the current one for this face */
|
||||
@ -451,18 +449,18 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* add a new node to the head of the manager's circular MRU list */
|
||||
/* add a new node to the head of the manager's circular MRU list */
|
||||
static void
|
||||
ftc_node_mru_link( FTC_Node node,
|
||||
FTC_Manager manager )
|
||||
{
|
||||
FTC_Node first = manager->nodes_list;
|
||||
|
||||
if (first)
|
||||
|
||||
if ( first )
|
||||
{
|
||||
node->mru_prev = first->mru_prev;
|
||||
node->mru_next = first;
|
||||
node->mru_prev = first->mru_prev;
|
||||
node->mru_next = first;
|
||||
|
||||
first->mru_prev->mru_next = node;
|
||||
first->mru_prev = node;
|
||||
@ -472,12 +470,13 @@
|
||||
node->mru_next = node;
|
||||
node->mru_prev = node;
|
||||
}
|
||||
|
||||
manager->nodes_list = node;
|
||||
manager->num_nodes++;
|
||||
}
|
||||
|
||||
|
||||
/* remove a node from the manager's MRU list */
|
||||
/* remove a node from the manager's MRU list */
|
||||
static void
|
||||
ftc_node_mru_unlink( FTC_Node node,
|
||||
FTC_Manager manager )
|
||||
@ -486,12 +485,13 @@
|
||||
FTC_Node next = node->mru_next;
|
||||
FTC_Node first = manager->nodes_list;
|
||||
|
||||
|
||||
prev->mru_next = next;
|
||||
next->mru_prev = prev;
|
||||
|
||||
if ( node->mru_next == first )
|
||||
{
|
||||
/* this is the last node in the list, update its head pointer */
|
||||
/* this is the last node in the list; update its head pointer */
|
||||
if ( node == first )
|
||||
manager->nodes_list = NULL;
|
||||
else
|
||||
@ -504,13 +504,14 @@
|
||||
}
|
||||
|
||||
|
||||
/* move a node to the head of the manager's MRU list */
|
||||
/* move a node to the head of the manager's MRU list */
|
||||
static void
|
||||
ftc_node_mru_up( FTC_Node node,
|
||||
FTC_Manager manager )
|
||||
{
|
||||
FTC_Node first = manager->nodes_list;
|
||||
|
||||
|
||||
if ( node != first )
|
||||
{
|
||||
ftc_node_mru_unlink( node, manager );
|
||||
@ -519,18 +520,19 @@
|
||||
}
|
||||
|
||||
|
||||
/* remove a node from its cache's hash table */
|
||||
/* remove a node from its cache's hash table */
|
||||
static void
|
||||
ftc_node_hash_unlink( FTC_Node node,
|
||||
FTC_Cache cache )
|
||||
{
|
||||
FTC_Node *pnode = cache->buckets + (node->hash % cache->size);
|
||||
FTC_Node *pnode = cache->buckets + ( node->hash % cache->size );
|
||||
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if ( *pnode == NULL )
|
||||
{
|
||||
FT_ERROR(( "FreeType.cache.hash_unlink: unknown node !!\n" ));
|
||||
FT_ERROR(( "FreeType.cache.hash_unlink: unknown node!\n" ));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -548,12 +550,13 @@
|
||||
}
|
||||
|
||||
|
||||
/* 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 )
|
||||
{
|
||||
FTC_Node *pnode = cache->buckets + (node->hash % cache->size);
|
||||
FTC_Node *pnode = cache->buckets + ( node->hash % cache->size );
|
||||
|
||||
|
||||
node->link = *pnode;
|
||||
*pnode = node;
|
||||
@ -562,9 +565,7 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* remove a node from the cache manager */
|
||||
/* remove a node from the cache manager */
|
||||
static void
|
||||
ftc_node_destroy( FTC_Node node,
|
||||
FTC_Manager manager )
|
||||
@ -573,6 +574,7 @@
|
||||
FTC_Cache cache;
|
||||
FTC_Cache_Class clazz;
|
||||
|
||||
|
||||
#ifdef FT_DEBUG_ERROR
|
||||
/* find node's cache */
|
||||
if ( node->cache_index >= FTC_MAX_CACHES )
|
||||
@ -582,7 +584,7 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
cache = manager->caches[ node->cache_index ];
|
||||
cache = manager->caches[node->cache_index];
|
||||
|
||||
#ifdef FT_DEBUG_ERROR
|
||||
if ( cache == NULL )
|
||||
@ -616,50 +618,56 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
FT_EXPORT_DEF(void)
|
||||
FT_EXPORT_DEF( void )
|
||||
FTC_Manager_Check( FTC_Manager manager )
|
||||
{
|
||||
FTC_Node node, first;
|
||||
|
||||
|
||||
first = manager->nodes_list;
|
||||
|
||||
/* check node weights */
|
||||
if (first)
|
||||
if ( first )
|
||||
{
|
||||
FT_ULong weight = 0;
|
||||
|
||||
|
||||
node = first;
|
||||
|
||||
do
|
||||
{
|
||||
FTC_Cache cache = manager->caches[node->cache_index];
|
||||
|
||||
|
||||
weight += cache->clazz->node_weight( node, cache );
|
||||
node = node->mru_next;
|
||||
}
|
||||
while (node != first);
|
||||
node = node->mru_next;
|
||||
|
||||
} while ( node != first );
|
||||
|
||||
if ( weight != manager->cur_weight )
|
||||
FT_ERROR(( "FTC_Manager_Compress: invalid weight %ld instead of %ld\n",
|
||||
manager->cur_weight, weight ));
|
||||
FT_ERROR((
|
||||
"FTC_Manager_Compress: invalid weight %ld instead of %ld\n",
|
||||
manager->cur_weight, weight ));
|
||||
}
|
||||
|
||||
/* check circular list */
|
||||
if (first)
|
||||
if ( first )
|
||||
{
|
||||
FT_UFast count = 0;
|
||||
|
||||
|
||||
node = first;
|
||||
do
|
||||
{
|
||||
count++;
|
||||
node = node->mru_next;
|
||||
}
|
||||
while (node != first);
|
||||
|
||||
} while ( node != first );
|
||||
|
||||
if ( count != manager->num_nodes )
|
||||
FT_ERROR(( "FTC_Manager_Compress: invalid cache node count %d instead of %d\n",
|
||||
manager->num_nodes, count ));
|
||||
FT_ERROR((
|
||||
"FTC_Manager_Compress: invalid cache node count %d instead of %d\n",
|
||||
manager->num_nodes, count ));
|
||||
}
|
||||
}
|
||||
|
||||
@ -675,19 +683,20 @@
|
||||
{
|
||||
FTC_Node node, first;
|
||||
|
||||
|
||||
if ( !manager )
|
||||
return;
|
||||
|
||||
first = manager->nodes_list;
|
||||
first = manager->nodes_list;
|
||||
|
||||
#if 0
|
||||
FTC_Manager_Check( manager );
|
||||
|
||||
FT_ERROR(( "compressing, weight = %ld, max = %ld, nodes = %d\n",
|
||||
manager->cur_weight, manager->max_weight, manager->num_nodes ));
|
||||
manager->cur_weight, manager->max_weight,
|
||||
manager->num_nodes ));
|
||||
#endif
|
||||
|
||||
|
||||
if ( manager->cur_weight < manager->max_weight || first == NULL )
|
||||
return;
|
||||
|
||||
@ -697,16 +706,16 @@
|
||||
{
|
||||
FTC_Node prev = node->mru_prev;
|
||||
|
||||
|
||||
prev = ( node == first ) ? NULL : node->mru_prev;
|
||||
|
||||
if ( node->ref_count <= 0 )
|
||||
ftc_node_destroy( node, manager );
|
||||
|
||||
node = prev;
|
||||
}
|
||||
while ( node && manager->cur_weight > manager->max_weight );
|
||||
}
|
||||
|
||||
} while ( node && manager->cur_weight > manager->max_weight );
|
||||
}
|
||||
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
@ -746,8 +755,8 @@
|
||||
cache->memory = memory;
|
||||
cache->clazz = clazz;
|
||||
|
||||
/* THIS IS VERY IMPORTANT! IT WILL WRETCH THE MANAGER */
|
||||
/* IF IT IS NOT SET CORRECTLY */
|
||||
/* THIS IS VERY IMPORTANT! IT WILL WRETCH THE MANAGER */
|
||||
/* IF IT IS NOT SET CORRECTLY */
|
||||
cache->cache_index = index;
|
||||
|
||||
if ( clazz->cache_init )
|
||||
@ -781,8 +790,8 @@
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
#define FTC_PRIMES_MIN 7
|
||||
#define FTC_PRIMES_MAX 13845163
|
||||
#define FTC_PRIMES_MIN 7
|
||||
#define FTC_PRIMES_MAX 13845163
|
||||
|
||||
static const FT_UInt ftc_primes[] =
|
||||
{
|
||||
@ -829,7 +838,8 @@
|
||||
{
|
||||
FT_UInt i;
|
||||
|
||||
for ( i = 0; i < sizeof(ftc_primes)/sizeof(ftc_primes[0]); i++ )
|
||||
|
||||
for ( i = 0; i < sizeof ( ftc_primes ) / sizeof ( ftc_primes[0] ); i++ )
|
||||
if ( ftc_primes[i] > num )
|
||||
return ftc_primes[i];
|
||||
|
||||
@ -842,6 +852,7 @@
|
||||
{
|
||||
FT_UFast new_size;
|
||||
|
||||
|
||||
new_size = ftc_prime_closest( cache->nodes );
|
||||
if ( new_size != cache->size )
|
||||
{
|
||||
@ -850,6 +861,7 @@
|
||||
FTC_Node* new_buckets ;
|
||||
FT_ULong i;
|
||||
|
||||
|
||||
if ( ALLOC_ARRAY( new_buckets, new_size, FTC_Node ) )
|
||||
return;
|
||||
|
||||
@ -858,8 +870,9 @@
|
||||
FTC_Node node, next, *pnode;
|
||||
FT_UFast hash;
|
||||
|
||||
|
||||
node = cache->buckets[i];
|
||||
while (node)
|
||||
while ( node )
|
||||
{
|
||||
next = node->link;
|
||||
hash = node->hash % new_size;
|
||||
@ -868,7 +881,7 @@
|
||||
node->link = pnode[0];
|
||||
pnode[0] = node;
|
||||
|
||||
node = next;
|
||||
node = next;
|
||||
}
|
||||
}
|
||||
|
||||
@ -887,6 +900,7 @@
|
||||
FT_Memory memory = cache->memory;
|
||||
FT_Error error;
|
||||
|
||||
|
||||
cache->nodes = 0;
|
||||
cache->size = FTC_PRIMES_MIN;
|
||||
|
||||
@ -898,7 +912,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
FT_EXPORT_DEF( void )
|
||||
ftc_cache_done( FTC_Cache cache )
|
||||
{
|
||||
@ -909,11 +922,12 @@
|
||||
FTC_Manager manager = cache->manager;
|
||||
FT_UFast i;
|
||||
|
||||
|
||||
for ( i = 0; i < cache->size; i++ )
|
||||
{
|
||||
FTC_Node *pnode = cache->buckets + i, next, node = *pnode;
|
||||
|
||||
while (node)
|
||||
while ( node )
|
||||
{
|
||||
next = node->link;
|
||||
node->link = NULL;
|
||||
@ -941,11 +955,10 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* lookup a node in "top" of its cache's hash table */
|
||||
/* if not found, create a new node.. */
|
||||
/* */
|
||||
FT_EXPORT_DEF(FT_Error)
|
||||
/* Look up a node in "top" of its cache's hash table. */
|
||||
/* If not found, create a new node. */
|
||||
/* */
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
ftc_cache_lookup_node( FTC_Cache cache,
|
||||
FT_UFast key_hash,
|
||||
FT_Pointer key,
|
||||
@ -953,17 +966,20 @@
|
||||
{
|
||||
FT_Error error = 0;
|
||||
FTC_Node result = NULL;
|
||||
FTC_Node* bucket = cache->buckets + (key_hash % cache->size);
|
||||
FTC_Node* bucket = cache->buckets + ( key_hash % cache->size );
|
||||
|
||||
|
||||
if ( *bucket )
|
||||
{
|
||||
FTC_Node* pnode = bucket;
|
||||
FTC_Node_CompareFunc compare = cache->clazz->node_compare;
|
||||
|
||||
for ( ;; )
|
||||
|
||||
for (;;)
|
||||
{
|
||||
FTC_Node node;
|
||||
|
||||
|
||||
node = *pnode;
|
||||
if ( node == NULL )
|
||||
break;
|
||||
@ -997,6 +1013,7 @@
|
||||
FT_Memory memory = cache->memory;
|
||||
FTC_Node node;
|
||||
|
||||
|
||||
if ( ALLOC( node, clazz->node_size ) )
|
||||
goto Exit;
|
||||
|
||||
@ -1026,7 +1043,7 @@
|
||||
}
|
||||
|
||||
/* try to resize the hash table when appropriate */
|
||||
if ( FTC_CACHE_RESIZE_TEST(cache) )
|
||||
if ( FTC_CACHE_RESIZE_TEST( cache ) )
|
||||
ftc_cache_resize( cache );
|
||||
|
||||
result = node;
|
||||
@ -1038,9 +1055,9 @@
|
||||
}
|
||||
|
||||
|
||||
/* maybe these functions will disappear later */
|
||||
/* maybe the next two functions will disappear eventually */
|
||||
|
||||
FT_EXPORT_DEF(void)
|
||||
FT_EXPORT_DEF( void )
|
||||
ftc_node_ref( FTC_Node node,
|
||||
FTC_Cache cache )
|
||||
{
|
||||
@ -1049,8 +1066,7 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
FT_EXPORT_DEF(void)
|
||||
FT_EXPORT_DEF( void )
|
||||
ftc_node_unref( FTC_Node node,
|
||||
FTC_Cache cache )
|
||||
{
|
||||
|
105
src/cache/ftcsbits.c
vendored
105
src/cache/ftcsbits.c
vendored
@ -33,7 +33,7 @@
|
||||
|
||||
|
||||
/* handle to sbit set */
|
||||
typedef struct FTC_SBitSetRec_* FTC_SBitSet;
|
||||
typedef struct FTC_SBitSetRec_* FTC_SBitSet;
|
||||
|
||||
/* sbit set structure */
|
||||
typedef struct FTC_SBitSetRec_
|
||||
@ -43,12 +43,12 @@
|
||||
|
||||
} FTC_SBitSetRec;
|
||||
|
||||
#define FTC_SBIT_SET(x) ((FTC_SBitSet)(x))
|
||||
|
||||
#define FTC_SBIT_SET_MEMORY(x) FTC_CHUNK_SET_MEMORY(&(x)->cset)
|
||||
#define FTC_SBIT_SET( x ) ( (FTC_SBitSet)(x) )
|
||||
#define FTC_SBIT_SET_MEMORY( x ) FTC_CHUNK_SET_MEMORY( &(x)->cset )
|
||||
|
||||
|
||||
typedef struct FTC_SBitQueryRec_
|
||||
typedef struct FTC_SBitQueryRec_
|
||||
{
|
||||
FTC_ChunkQueryRec chunk;
|
||||
FTC_Image_Desc desc;
|
||||
@ -73,6 +73,7 @@
|
||||
FT_UInt count = cnode->item_count;
|
||||
FTC_SBit sbit = (FTC_SBit) cnode->items;
|
||||
|
||||
|
||||
if ( sbit )
|
||||
{
|
||||
for ( ; count > 0; sbit++, count-- )
|
||||
@ -107,7 +108,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
static FT_Error
|
||||
ftc_sbit_node_load( FTC_ChunkNode cnode,
|
||||
FT_UInt gindex,
|
||||
@ -122,6 +122,7 @@
|
||||
|
||||
FTC_SBit sbit;
|
||||
|
||||
|
||||
if ( gindex < (FT_UInt)cnode->item_start ||
|
||||
gindex >= (FT_UInt)cnode->item_start + cnode->item_count )
|
||||
{
|
||||
@ -129,7 +130,7 @@
|
||||
return FTC_Err_Invalid_Argument;
|
||||
}
|
||||
|
||||
sbit = (FTC_SBit)cnode->items + (gindex - cnode->item_start);
|
||||
sbit = (FTC_SBit)cnode->items + ( gindex - cnode->item_start );
|
||||
|
||||
error = FTC_Manager_Lookup_Size( cset->ccache->cache.manager,
|
||||
&sbitset->desc.font,
|
||||
@ -154,8 +155,9 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
FT_ERROR(( "FreeType.cache.sbit_load: cannot load scalable glyphs in an"
|
||||
" sbit cache, please check your arguments!\n" ));
|
||||
FT_ERROR((
|
||||
"FreeType.cache.sbit_load: cannot load scalable glyphs in an"
|
||||
" sbit cache, please check your arguments!\n" ));
|
||||
error = FTC_Err_Invalid_Argument;
|
||||
goto Exit;
|
||||
}
|
||||
@ -225,7 +227,7 @@
|
||||
|
||||
/* now, compute size */
|
||||
if ( asize )
|
||||
*asize = ABS(sbit->pitch) * sbit->height;
|
||||
*asize = ABS( sbit->pitch ) * sbit->height;
|
||||
|
||||
} /* glyph dimensions ok */
|
||||
|
||||
@ -237,9 +239,9 @@
|
||||
/* */
|
||||
if ( error )
|
||||
{
|
||||
sbit->width = 255;
|
||||
error = 0;
|
||||
/* sbit->buffer == NULL too !! */
|
||||
sbit->width = 255;
|
||||
error = 0;
|
||||
/* sbit->buffer == NULL too! */
|
||||
}
|
||||
}
|
||||
|
||||
@ -252,7 +254,8 @@
|
||||
ftc_sbit_node_init( FTC_ChunkNode cnode,
|
||||
FTC_ChunkQuery query )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Error error;
|
||||
|
||||
|
||||
error = ftc_chunk_node_init( cnode,
|
||||
query->cset,
|
||||
@ -270,22 +273,20 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* this function is important because it is both part of */
|
||||
/* an FTC_ChunkSet_Class and an FTC_CacheNode_Class */
|
||||
/* */
|
||||
FT_CALLBACK_DEF( FT_ULong )
|
||||
ftc_sbit_node_weight( FTC_ChunkNode cnode )
|
||||
{
|
||||
FT_ULong size;
|
||||
FTC_ChunkSet cset = cnode->cset;
|
||||
FT_UInt count = cnode->item_count;
|
||||
FT_Int pitch;
|
||||
FTC_SBit sbit = (FTC_SBit) cnode->items;
|
||||
FT_ULong size;
|
||||
FT_UInt count = cnode->item_count;
|
||||
FT_Int pitch;
|
||||
FTC_SBit sbit = (FTC_SBit) cnode->items;
|
||||
|
||||
|
||||
/* the node itself */
|
||||
size = sizeof ( *cnode );
|
||||
size = sizeof ( *cnode );
|
||||
|
||||
/* the sbit records */
|
||||
size += cnode->item_count * sizeof ( FTC_SBitRec );
|
||||
@ -317,6 +318,7 @@
|
||||
FT_UInt offset = (FT_UInt)(gindex - cnode->item_start);
|
||||
FT_Bool result;
|
||||
|
||||
|
||||
result = FT_BOOL( offset < (FT_UInt)cnode->item_count &&
|
||||
creq->cset == cnode->cset );
|
||||
if ( result )
|
||||
@ -324,13 +326,17 @@
|
||||
/* check if we need to load the glyph bitmap now */
|
||||
FTC_SBit sbit = (FTC_SBit)cnode->items + offset;
|
||||
|
||||
|
||||
if ( sbit->buffer == NULL && sbit->width != 255 )
|
||||
{
|
||||
FT_ULong size;
|
||||
|
||||
|
||||
ftc_sbit_node_load( cnode, gindex, &size );
|
||||
cache->manager->cur_weight += size;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -354,6 +360,7 @@
|
||||
FT_Error error;
|
||||
FT_Face face;
|
||||
|
||||
|
||||
sset->desc = query->desc;
|
||||
|
||||
/* we need to compute "cquery.item_total" now */
|
||||
@ -362,14 +369,14 @@
|
||||
&face );
|
||||
if ( !error )
|
||||
{
|
||||
ftc_chunk_set_init( FTC_CHUNK_SET(sset),
|
||||
sizeof( FTC_SBitRec ),
|
||||
ftc_chunk_set_init( FTC_CHUNK_SET( sset ),
|
||||
sizeof ( FTC_SBitRec ),
|
||||
FTC_SBIT_ITEMS_PER_NODE,
|
||||
face->num_glyphs,
|
||||
FTC_CHUNK_CACHE(lru->user_data) );
|
||||
FTC_CHUNK_CACHE( lru->user_data ) );
|
||||
|
||||
/* now compute hash from description - this is _very_ important */
|
||||
/* for good performance.. */
|
||||
/* now compute hash from description -- this is _very_ important */
|
||||
/* for good performance */
|
||||
sset->cset.hash = FTC_IMAGE_DESC_HASH( &sset->desc );
|
||||
query->chunk.cset = &sset->cset;
|
||||
}
|
||||
@ -378,16 +385,16 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Bool )
|
||||
ftc_sbit_set_compare( FTC_SBitSet sset,
|
||||
FTC_SBitQuery query )
|
||||
{
|
||||
FT_Bool result;
|
||||
|
||||
|
||||
/* we need to set the "cquery.cset" field or our query for */
|
||||
/* faster glyph comparisons in ftc_sbit_node_compare.. */
|
||||
/* */
|
||||
/* faster glyph comparisons in ftc_sbit_node_compare() */
|
||||
/* */
|
||||
result = FT_BOOL( FTC_IMAGE_DESC_COMPARE( &sset->desc, &query->desc ) );
|
||||
if ( result )
|
||||
query->chunk.cset = &sset->cset;
|
||||
@ -396,23 +403,21 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const FT_LruList_ClassRec ftc_sbit_set_class =
|
||||
{
|
||||
sizeof( FT_LruListRec ),
|
||||
(FT_LruList_InitFunc) NULL,
|
||||
(FT_LruList_DoneFunc) NULL,
|
||||
sizeof ( FT_LruListRec ),
|
||||
(FT_LruList_InitFunc) NULL,
|
||||
(FT_LruList_DoneFunc) NULL,
|
||||
|
||||
sizeof( FTC_SBitSetRec ),
|
||||
(FT_LruNode_InitFunc) ftc_sbit_set_init,
|
||||
(FT_LruNode_DoneFunc) ftc_chunk_set_done,
|
||||
(FT_LruNode_FlushFunc) NULL,
|
||||
(FT_LruNode_CompareFunc) ftc_sbit_set_compare,
|
||||
sizeof ( FTC_SBitSetRec ),
|
||||
(FT_LruNode_InitFunc) ftc_sbit_set_init,
|
||||
(FT_LruNode_DoneFunc) ftc_chunk_set_done,
|
||||
(FT_LruNode_FlushFunc) NULL,
|
||||
(FT_LruNode_CompareFunc)ftc_sbit_set_compare,
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
@ -425,22 +430,23 @@
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
ftc_sbit_cache_init( FTC_SBit_Cache scache )
|
||||
{
|
||||
return ftc_chunk_cache_init( FTC_CHUNK_CACHE(scache),
|
||||
return ftc_chunk_cache_init( FTC_CHUNK_CACHE( scache ),
|
||||
&ftc_sbit_set_class );
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const FTC_Cache_ClassRec ftc_sbit_cache_class =
|
||||
{
|
||||
sizeof( FTC_ChunkCacheRec ),
|
||||
sizeof ( FTC_ChunkCacheRec ),
|
||||
(FTC_Cache_InitFunc) ftc_sbit_cache_init,
|
||||
(FTC_Cache_DoneFunc) ftc_chunk_cache_done,
|
||||
|
||||
sizeof( FTC_ChunkNodeRec ),
|
||||
(FTC_Node_InitFunc) ftc_sbit_node_init,
|
||||
(FTC_Node_WeightFunc) ftc_sbit_node_weight,
|
||||
(FTC_Node_CompareFunc) ftc_sbit_node_compare,
|
||||
(FTC_Node_DoneFunc) ftc_sbit_node_done
|
||||
sizeof ( FTC_ChunkNodeRec ),
|
||||
(FTC_Node_InitFunc) ftc_sbit_node_init,
|
||||
(FTC_Node_WeightFunc) ftc_sbit_node_weight,
|
||||
(FTC_Node_CompareFunc)ftc_sbit_node_compare,
|
||||
(FTC_Node_DoneFunc) ftc_sbit_node_done
|
||||
};
|
||||
|
||||
|
||||
@ -450,10 +456,9 @@
|
||||
FTC_SBit_Cache_New( FTC_Manager manager,
|
||||
FTC_SBit_Cache *acache )
|
||||
{
|
||||
return FTC_Manager_Register_Cache(
|
||||
manager,
|
||||
&ftc_sbit_cache_class,
|
||||
(FTC_Cache*) acache );
|
||||
return FTC_Manager_Register_Cache( manager,
|
||||
&ftc_sbit_cache_class,
|
||||
(FTC_Cache*)acache );
|
||||
}
|
||||
|
||||
|
||||
@ -484,7 +489,7 @@
|
||||
error = ftc_chunk_cache_lookup( ccache, &query.chunk, &node );
|
||||
if ( !error )
|
||||
{
|
||||
*ansbit = (FTC_SBit) node->items + (gindex - node->item_start);
|
||||
*ansbit = (FTC_SBit)node->items + ( gindex - node->item_start );
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
16
src/cache/ftlru.c
vendored
16
src/cache/ftlru.c
vendored
@ -35,6 +35,7 @@
|
||||
FT_Error error;
|
||||
FT_LruList list;
|
||||
|
||||
|
||||
if ( !alist || !clazz )
|
||||
return FTC_Err_Invalid_Argument;
|
||||
|
||||
@ -72,6 +73,7 @@
|
||||
FT_Memory memory;
|
||||
FT_LruList_Class clazz;
|
||||
|
||||
|
||||
if ( !list )
|
||||
return;
|
||||
|
||||
@ -87,7 +89,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
FT_EXPORT_DEF( void )
|
||||
FT_LruList_Reset( FT_LruList list )
|
||||
{
|
||||
@ -107,6 +108,7 @@
|
||||
{
|
||||
FT_LruNode next = node->next;
|
||||
|
||||
|
||||
if ( clazz->node_done )
|
||||
clazz->node_done( node, list );
|
||||
|
||||
@ -179,7 +181,7 @@
|
||||
{
|
||||
*pnode = node->next;
|
||||
node->next = list->nodes;
|
||||
list->nodes = node;
|
||||
list->nodes = node;
|
||||
}
|
||||
result = node;
|
||||
goto Exit;
|
||||
@ -193,9 +195,10 @@
|
||||
if ( list->max_nodes > 0 && list->num_nodes >= list->max_nodes )
|
||||
{
|
||||
/* this list list is full; we will now flush */
|
||||
/* the oldest node, if there's one !! */
|
||||
/* the oldest node, if there's one! */
|
||||
FT_LruNode last = *plast;
|
||||
|
||||
|
||||
if ( last )
|
||||
{
|
||||
if ( clazz->node_flush )
|
||||
@ -223,7 +226,7 @@
|
||||
}
|
||||
|
||||
/* in case of error during the flush or done/init cycle, */
|
||||
/* we need to discard the node.. */
|
||||
/* we need to discard the node */
|
||||
if ( clazz->node_done )
|
||||
clazz->node_done( last, list );
|
||||
|
||||
@ -258,13 +261,13 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
FT_EXPORT_DEF( void )
|
||||
FT_LruList_Remove( FT_LruList list,
|
||||
FT_LruNode node )
|
||||
{
|
||||
FT_LruNode *pnode;
|
||||
|
||||
|
||||
if ( !list || !node )
|
||||
return;
|
||||
|
||||
@ -276,6 +279,7 @@
|
||||
FT_Memory memory = list->memory;
|
||||
FT_LruList_Class clazz = list->clazz;
|
||||
|
||||
|
||||
*pnode = node->next;
|
||||
node->next = NULL;
|
||||
|
||||
@ -292,7 +296,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
FT_EXPORT_DEF( void )
|
||||
FT_LruList_Remove_Selection( FT_LruList list,
|
||||
FT_LruNode_SelectFunc select_func,
|
||||
@ -302,6 +305,7 @@
|
||||
FT_LruList_Class clazz;
|
||||
FT_Memory memory;
|
||||
|
||||
|
||||
if ( !list || !select_func )
|
||||
return;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* */
|
||||
/* cffload.c */
|
||||
/* */
|
||||
/* OpenType and CFF data/program tables loader (body) */
|
||||
/* OpenType and CFF data/program tables loader (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2001 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
@ -2242,7 +2242,8 @@
|
||||
cff_done_index( &font->name_index );
|
||||
cff_done_index( &font->charstrings_index );
|
||||
|
||||
/* release font dictionaries, but only if working with a CID keyed CFF font */
|
||||
/* release font dictionaries, but only if working with */
|
||||
/* a CID keyed CFF font */
|
||||
if ( font->num_subfonts > 0 )
|
||||
{
|
||||
for ( index = 0; index < font->num_subfonts; index++ )
|
||||
|
@ -158,7 +158,7 @@
|
||||
0, /* glyph slot */
|
||||
0, /* glyph names! XXX */
|
||||
0, /* blend == 0 */
|
||||
0, /* hinting == FALSE */
|
||||
0, /* hinting == 0 */
|
||||
cid_load_glyph );
|
||||
if ( error )
|
||||
return error;
|
||||
|
@ -185,7 +185,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const FT_Driver_Class t1cid_driver_class =
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ THE SOFTWARE.
|
||||
|
||||
|
||||
#if defined( FT_DEBUG_LEVEL_TRACE )
|
||||
static char* tableNames[] =
|
||||
static const char* tableNames[] =
|
||||
{
|
||||
"prop", "accl", "mtrcs", "bmps", "imtrcs",
|
||||
"enc", "swidth", "names", "accel"
|
||||
@ -95,7 +95,7 @@ THE SOFTWARE.
|
||||
PCF_Table tables;
|
||||
|
||||
FT_Memory memory = FT_FACE(face)->memory;
|
||||
unsigned int i;
|
||||
unsigned int n;
|
||||
|
||||
|
||||
if ( FILE_Seek ( 0 ) ||
|
||||
@ -109,7 +109,7 @@ THE SOFTWARE.
|
||||
return PCF_Err_Out_Of_Memory;
|
||||
|
||||
tables = face->toc.tables;
|
||||
for ( i = 0; i < toc->count; i++ )
|
||||
for ( n = 0; n < toc->count; n++ )
|
||||
{
|
||||
if ( READ_Fields( pcf_table_header, tables ) )
|
||||
goto Exit;
|
||||
@ -119,8 +119,8 @@ THE SOFTWARE.
|
||||
#if defined( FT_DEBUG_LEVEL_TRACE )
|
||||
|
||||
{
|
||||
unsigned int i,j;
|
||||
char* name = "?";
|
||||
unsigned int i, j;
|
||||
const char *name = "?";
|
||||
|
||||
|
||||
FT_TRACE4(( "Tables count: %ld\n", face->toc.count ));
|
||||
@ -129,7 +129,7 @@ THE SOFTWARE.
|
||||
{
|
||||
for( j = 0; j < sizeof ( tableNames ) / sizeof ( tableNames[0] ); j++ )
|
||||
if ( tables[i].type == (unsigned int)( 1 << j ) )
|
||||
name=tableNames[j];
|
||||
name = tableNames[j];
|
||||
FT_TRACE4(( "Table %d: type=%-6s format=0x%04lX "
|
||||
"size=0x%06lX (%8ld) offset=0x%04lX\n",
|
||||
i, name,
|
||||
|
@ -1086,15 +1086,15 @@
|
||||
FT_GlyphLoader* loader = glyph->internal->loader;
|
||||
|
||||
|
||||
builder->loader = loader;
|
||||
builder->base = &loader->base.outline;
|
||||
builder->current = &loader->current.outline;
|
||||
builder->loader = loader;
|
||||
builder->base = &loader->base.outline;
|
||||
builder->current = &loader->current.outline;
|
||||
FT_GlyphLoader_Rewind( loader );
|
||||
|
||||
builder->hints_globals = size->internal;
|
||||
builder->hints_funcs = 0;
|
||||
|
||||
if (hinting)
|
||||
if ( hinting )
|
||||
builder->hints_funcs = glyph->internal->glyph_hints;
|
||||
}
|
||||
|
||||
|
@ -177,6 +177,7 @@ FT_BEGIN_HEADER
|
||||
FT_Pos x,
|
||||
FT_Pos y );
|
||||
|
||||
|
||||
FT_LOCAL void
|
||||
T1_Builder_Close_Contour( T1_Builder* builder );
|
||||
|
||||
|
@ -141,7 +141,8 @@
|
||||
FT_String* name = (FT_String*)decoder->glyph_names[n];
|
||||
|
||||
|
||||
if ( name && name[0] == glyph_name[0] && strcmp( name,glyph_name ) == 0 )
|
||||
if ( name && name[0] == glyph_name[0] &&
|
||||
strcmp( name,glyph_name ) == 0 )
|
||||
return n;
|
||||
}
|
||||
|
||||
@ -290,6 +291,7 @@
|
||||
{
|
||||
FT_Outline dummy;
|
||||
|
||||
|
||||
dummy.n_points = (short)( base->n_points - n_base_points );
|
||||
dummy.points = base->points + n_base_points;
|
||||
|
||||
@ -337,6 +339,7 @@
|
||||
|
||||
T1_Hints_Funcs hinter;
|
||||
|
||||
|
||||
/* we don't want to touch the source code -- use macro trick */
|
||||
#define start_point T1_Builder_Start_Point
|
||||
#define check_points T1_Builder_Check_Points
|
||||
@ -738,7 +741,7 @@
|
||||
/* apply hints to the loaded glyph outline now */
|
||||
hinter->apply( hinter->hints,
|
||||
builder->current,
|
||||
(PSH_Globals) builder->hints_globals );
|
||||
(PSH_Globals)builder->hints_globals );
|
||||
}
|
||||
|
||||
/* add current outline to the glyph slot */
|
||||
@ -1086,7 +1089,7 @@
|
||||
}
|
||||
|
||||
|
||||
/* parse a single Type 1 glyph */
|
||||
/* parse a single Type 1 glyph */
|
||||
FT_LOCAL_DEF FT_Error
|
||||
T1_Decoder_Parse_Glyph( T1_Decoder* decoder,
|
||||
FT_UInt glyph )
|
||||
@ -1095,7 +1098,7 @@
|
||||
}
|
||||
|
||||
|
||||
/* initialise T1 decoder */
|
||||
/* initialise T1 decoder */
|
||||
FT_LOCAL_DEF FT_Error
|
||||
T1_Decoder_Init( T1_Decoder* decoder,
|
||||
FT_Face face,
|
||||
@ -1137,7 +1140,7 @@
|
||||
}
|
||||
|
||||
|
||||
/* finalize T1 decoder */
|
||||
/* finalize T1 decoder */
|
||||
FT_LOCAL_DEF void
|
||||
T1_Decoder_Done( T1_Decoder* decoder )
|
||||
{
|
||||
|
@ -20,4 +20,4 @@ SubDirHdrs [ FT2_SubDir src pshinter ] ;
|
||||
Library $(FT2_LIB) : $(_sources).c ;
|
||||
}
|
||||
|
||||
# end of src/psaux Jamfile
|
||||
# end of src/pshinter Jamfile
|
||||
|
@ -1,19 +1,44 @@
|
||||
#ifndef __PS_HINTER_ALGO_H__
|
||||
#define __PS_HINTER_ALGO_H__
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* pshalgo.h */
|
||||
/* */
|
||||
/* This header file defines the used hinting algorithm. */
|
||||
/* */
|
||||
/* Copyright 2001 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef __PSHALGO_H__
|
||||
#define __PSHALGO_H__
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
/* define to choose hinting algorithm */
|
||||
#define PSH_ALGORITHM_2
|
||||
#define PSH_ALGORITHM_2
|
||||
|
||||
#ifdef PSH_ALGORITHM_1
|
||||
# include "pshalgo1.h"
|
||||
# define PS_HINTS_APPLY_FUNC ps1_hints_apply
|
||||
|
||||
#include "pshalgo1.h"
|
||||
#define PS_HINTS_APPLY_FUNC ps1_hints_apply
|
||||
|
||||
#else
|
||||
# include "pshalgo2.h"
|
||||
# define PS_HINTS_APPLY_FUNC ps2_hints_apply
|
||||
|
||||
#include "pshalgo2.h"
|
||||
#define PS_HINTS_APPLY_FUNC ps2_hints_apply
|
||||
|
||||
#endif
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* __PS_HINTER_ALGO_H__ */
|
||||
#endif /* __PSHALGO_H__ */
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -1,13 +1,33 @@
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* pshalgo1.c */
|
||||
/* */
|
||||
/* PostScript hinting algorithm 1 (body). */
|
||||
/* */
|
||||
/* Copyright 2001 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_INTERNAL_OBJECTS_H
|
||||
#include FT_INTERNAL_DEBUG_H
|
||||
#include "pshalgo1.h"
|
||||
|
||||
|
||||
#ifdef DEBUG_HINTER
|
||||
extern PSH1_Hint_Table ps1_debug_hint_table = 0;
|
||||
extern PSH1_HintFunc ps1_debug_hint_func = 0;
|
||||
extern PSH1_Hint_Table ps1_debug_hint_table = 0;
|
||||
extern PSH1_HintFunc ps1_debug_hint_func = 0;
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/***** *****/
|
||||
@ -16,7 +36,7 @@
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
|
||||
/* return true iff two stem hints overlap */
|
||||
/* return true iff two stem hints overlap */
|
||||
static FT_Int
|
||||
psh1_hint_overlap( PSH1_Hint hint1,
|
||||
PSH1_Hint hint2 )
|
||||
@ -26,7 +46,7 @@
|
||||
}
|
||||
|
||||
|
||||
/* destroy hints table */
|
||||
/* destroy hints table */
|
||||
static void
|
||||
psh1_hint_table_done( PSH1_Hint_Table table,
|
||||
FT_Memory memory )
|
||||
@ -43,28 +63,30 @@
|
||||
}
|
||||
|
||||
|
||||
/* deactivate all hints in a table */
|
||||
/* deactivate all hints in a table */
|
||||
static void
|
||||
psh1_hint_table_deactivate( PSH1_Hint_Table table )
|
||||
{
|
||||
FT_UInt count = table->max_hints;
|
||||
FT_UInt count = table->max_hints;
|
||||
PSH1_Hint hint = table->hints;
|
||||
|
||||
|
||||
for ( ; count > 0; count--, hint++ )
|
||||
{
|
||||
psh1_hint_deactivate(hint);
|
||||
psh1_hint_deactivate( hint );
|
||||
hint->order = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* internal function used to record a new hint */
|
||||
/* internal function used to record a new hint */
|
||||
static void
|
||||
psh1_hint_table_record( PSH1_Hint_Table table,
|
||||
FT_UInt index )
|
||||
{
|
||||
PSH1_Hint hint = table->hints + index;
|
||||
|
||||
|
||||
if ( index >= table->max_hints )
|
||||
{
|
||||
FT_ERROR(( "%s.activate: invalid hint index %d\n", index ));
|
||||
@ -72,18 +94,19 @@
|
||||
}
|
||||
|
||||
/* ignore active hints */
|
||||
if ( psh1_hint_is_active(hint) )
|
||||
if ( psh1_hint_is_active( hint ) )
|
||||
return;
|
||||
|
||||
psh1_hint_activate(hint);
|
||||
psh1_hint_activate( hint );
|
||||
|
||||
/* now scan the current active hint set in order to determine */
|
||||
/* if we're overlapping with another segment.. */
|
||||
/* if we are overlapping with another segment */
|
||||
{
|
||||
PSH1_Hint* sorted = table->sort_global;
|
||||
FT_UInt count = table->num_hints;
|
||||
PSH1_Hint hint2;
|
||||
|
||||
|
||||
hint->parent = 0;
|
||||
for ( ; count > 0; count--, sorted++ )
|
||||
{
|
||||
@ -98,12 +121,10 @@
|
||||
}
|
||||
|
||||
if ( table->num_hints < table->max_hints )
|
||||
table->sort_global[ table->num_hints++ ] = hint;
|
||||
table->sort_global[table->num_hints++] = hint;
|
||||
else
|
||||
{
|
||||
FT_ERROR(( "%s.activate: too many sorted hints !! BUG !!\n",
|
||||
FT_ERROR(( "%s.activate: too many sorted hints! BUG!\n",
|
||||
"ps.fitter" ));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -115,13 +136,12 @@
|
||||
FT_Byte* cursor = hint_mask->bytes;
|
||||
FT_UInt index, limit;
|
||||
|
||||
|
||||
limit = hint_mask->num_bits;
|
||||
|
||||
if ( limit != table->max_hints )
|
||||
{
|
||||
FT_ERROR(( "%s.activate_mask: invalid bit count (%d instead of %d)\n",
|
||||
"ps.fitter", hint_mask->num_bits, table->max_hints ));
|
||||
}
|
||||
|
||||
for ( index = 0; index < limit; index++ )
|
||||
{
|
||||
@ -139,7 +159,7 @@
|
||||
}
|
||||
|
||||
|
||||
/* create hints table */
|
||||
/* create hints table */
|
||||
static FT_Error
|
||||
psh1_hint_table_init( PSH1_Hint_Table table,
|
||||
PS_Hint_Table hints,
|
||||
@ -150,12 +170,13 @@
|
||||
FT_UInt count = hints->num_hints;
|
||||
FT_Error error;
|
||||
|
||||
FT_UNUSED(counter_masks);
|
||||
FT_UNUSED( counter_masks );
|
||||
|
||||
|
||||
/* allocate our tables */
|
||||
if ( ALLOC_ARRAY( table->sort, 2*count, PSH1_Hint ) ||
|
||||
ALLOC_ARRAY( table->hints, count, PSH1_HintRec ) ||
|
||||
ALLOC_ARRAY( table->zones, 2*count+1, PSH1_ZoneRec ) )
|
||||
if ( ALLOC_ARRAY( table->sort, 2 * count, PSH1_Hint ) ||
|
||||
ALLOC_ARRAY( table->hints, count, PSH1_HintRec ) ||
|
||||
ALLOC_ARRAY( table->zones, 2 * count + 1, PSH1_ZoneRec ) )
|
||||
goto Exit;
|
||||
|
||||
table->max_hints = count;
|
||||
@ -164,10 +185,11 @@
|
||||
table->num_zones = 0;
|
||||
table->zone = 0;
|
||||
|
||||
/* now, initialise the "hints" array */
|
||||
/* now, initialize the "hints" array */
|
||||
{
|
||||
PSH1_Hint write = table->hints;
|
||||
PS_Hint read = hints->hints;
|
||||
PS_Hint read = hints->hints;
|
||||
|
||||
|
||||
for ( ; count > 0; count--, write++, read++ )
|
||||
{
|
||||
@ -177,28 +199,30 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* we now need to determine the initial "parent" stems, first */
|
||||
/* we now need to determine the initial "parent" stems; first */
|
||||
/* activate the hints that are given by the initial hint masks */
|
||||
if ( hint_masks )
|
||||
{
|
||||
FT_UInt count = hint_masks->num_masks;
|
||||
PS_Mask mask = hint_masks->masks;
|
||||
FT_UInt Count = hint_masks->num_masks;
|
||||
PS_Mask Mask = hint_masks->masks;
|
||||
|
||||
|
||||
table->hint_masks = hint_masks;
|
||||
|
||||
for ( ; count > 0; count--, mask++ )
|
||||
psh1_hint_table_record_mask( table, mask );
|
||||
for ( ; Count > 0; Count--, Mask++ )
|
||||
psh1_hint_table_record_mask( table, Mask );
|
||||
}
|
||||
|
||||
/* now, do a linear parse in case some hints were left alone */
|
||||
if ( table->num_hints != table->max_hints )
|
||||
{
|
||||
FT_UInt index, count;
|
||||
FT_UInt Index, Count;
|
||||
|
||||
FT_ERROR(( "%s.init: missing/incorrect hint masks !!\n" ));
|
||||
|
||||
FT_ERROR(( "%s.init: missing/incorrect hint masks!\n" ));
|
||||
count = table->max_hints;
|
||||
for ( index = 0; index < count; index++ )
|
||||
psh1_hint_table_record( table, index );
|
||||
for ( Index = 0; Index < Count; Index++ )
|
||||
psh1_hint_table_record( table, Index );
|
||||
}
|
||||
|
||||
Exit:
|
||||
@ -206,7 +230,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
psh1_hint_table_activate_mask( PSH1_Hint_Table table,
|
||||
PS_Mask hint_mask )
|
||||
@ -215,6 +238,7 @@
|
||||
FT_Byte* cursor = hint_mask->bytes;
|
||||
FT_UInt index, limit, count;
|
||||
|
||||
|
||||
limit = hint_mask->num_bits;
|
||||
count = 0;
|
||||
|
||||
@ -232,12 +256,14 @@
|
||||
{
|
||||
PSH1_Hint hint = &table->hints[index];
|
||||
|
||||
if ( !psh1_hint_is_active(hint) )
|
||||
|
||||
if ( !psh1_hint_is_active( hint ) )
|
||||
{
|
||||
PSH1_Hint* sort = table->sort;
|
||||
FT_UInt count2;
|
||||
PSH1_Hint* sort = table->sort;
|
||||
FT_UInt count2;
|
||||
PSH1_Hint hint2;
|
||||
|
||||
|
||||
for ( count2 = count; count2 > 0; count2--, sort++ )
|
||||
{
|
||||
hint2 = sort[0];
|
||||
@ -255,10 +281,8 @@
|
||||
if ( count < table->max_hints )
|
||||
table->sort[count++] = hint;
|
||||
else
|
||||
{
|
||||
FT_ERROR(( "%s.activate_mask: too many active hints\n",
|
||||
"psf.hint" ));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -267,44 +291,41 @@
|
||||
}
|
||||
table->num_hints = count;
|
||||
|
||||
/* now, sort the hints, they're guaranteed to not overlap */
|
||||
/* so we can compare their "org_pos" field directly.. */
|
||||
/* now, sort the hints; they are guaranteed to not overlap */
|
||||
/* so we can compare their "org_pos" field directly */
|
||||
{
|
||||
FT_Int i1, i2;
|
||||
FT_Int i1, i2;
|
||||
PSH1_Hint hint1, hint2;
|
||||
PSH1_Hint* sort = table->sort;
|
||||
|
||||
|
||||
/* a simple bubble sort will do, since in 99% of cases, the hints */
|
||||
/* will be already sorted.. and the sort will be linear */
|
||||
/* will be already sorted; and the sort will be linear */
|
||||
for ( i1 = 1; i1 < (FT_Int)count; i1++ )
|
||||
{
|
||||
hint1 = sort[i1];
|
||||
for ( i2 = i1-1; i2 >= 0; i2-- )
|
||||
|
||||
for ( i2 = i1 - 1; i2 >= 0; i2-- )
|
||||
{
|
||||
hint2 = sort[i2];
|
||||
if ( hint2->org_pos < hint1->org_pos )
|
||||
break;
|
||||
|
||||
sort[i2+1] = hint2;
|
||||
sort[i2] = hint1;
|
||||
sort[i2 + 1] = hint2;
|
||||
sort[i2] = hint1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/***** *****/
|
||||
/***** HINTS GRID-FITTING AND OPTIMISATION *****/
|
||||
/***** *****/
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** HINTS GRID-FITTING AND OPTIMIZATION *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
#ifdef DEBUG_HINTER
|
||||
void
|
||||
@ -316,21 +337,23 @@
|
||||
PSH1_Hint hint;
|
||||
FT_UInt count;
|
||||
|
||||
|
||||
for ( count = 0; count < table->num_hints; count++ )
|
||||
{
|
||||
hint = table->sort[count];
|
||||
if ( psh1_hint_is_active(hint) )
|
||||
if ( psh1_hint_is_active( hint ) )
|
||||
{
|
||||
hint->cur_pos = FT_MulFix( hint->org_pos, scale ) + delta;
|
||||
hint->cur_len = FT_MulFix( hint->org_len, scale );
|
||||
|
||||
if (ps1_debug_hint_func)
|
||||
if ( ps1_debug_hint_func )
|
||||
ps1_debug_hint_func( hint, vertical );
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
FT_LOCAL_DEF FT_Error
|
||||
psh1_hint_table_optimize( PSH1_Hint_Table table,
|
||||
PSH_Globals globals,
|
||||
@ -341,7 +364,8 @@
|
||||
FT_Fixed scale = dim->scale_mult;
|
||||
FT_Fixed delta = dim->scale_delta;
|
||||
|
||||
FT_UNUSED(outline);
|
||||
FT_UNUSED( outline );
|
||||
|
||||
|
||||
#ifdef DEBUG_HINTER
|
||||
if ( ps_debug_no_vert_hints && vertical )
|
||||
@ -358,91 +382,91 @@
|
||||
#endif
|
||||
|
||||
/* XXXX: for now, we only scale the hints to test all other aspects */
|
||||
/* of the Postscript Hinter.. */
|
||||
/* of the PostScript hinter */
|
||||
{
|
||||
PSH1_Hint hint;
|
||||
FT_UInt count;
|
||||
|
||||
|
||||
for ( count = 0; count < table->num_hints; count++ )
|
||||
{
|
||||
hint = table->sort[count];
|
||||
if ( psh1_hint_is_active(hint) )
|
||||
if ( psh1_hint_is_active( hint ) )
|
||||
{
|
||||
# if 1
|
||||
FT_Pos pos = FT_MulFix( hint->org_pos, scale ) + delta;
|
||||
FT_Pos len = FT_MulFix( hint->org_len, scale );
|
||||
#if 1
|
||||
FT_Pos pos = FT_MulFix( hint->org_pos, scale ) + delta;
|
||||
FT_Pos len = FT_MulFix( hint->org_len, scale );
|
||||
|
||||
FT_Pos fit_center;
|
||||
FT_Pos fit_len;
|
||||
FT_Pos fit_center;
|
||||
FT_Pos fit_len;
|
||||
|
||||
PSH_AlignmentRec align;
|
||||
|
||||
|
||||
/* compute fitted width/height */
|
||||
fit_len = psh_dimension_snap_width( dim, hint->org_len );
|
||||
if ( fit_len < 64 )
|
||||
fit_len = 64;
|
||||
else
|
||||
fit_len = (fit_len + 32 ) & -64;
|
||||
fit_len = ( fit_len + 32 ) & -64;
|
||||
|
||||
hint->cur_len = fit_len;
|
||||
|
||||
/* check blue zones for horizontal stems */
|
||||
align.align = 0;
|
||||
align.align_bot = align.align_top = 0;
|
||||
if (!vertical)
|
||||
if ( !vertical )
|
||||
{
|
||||
psh_blues_snap_stem( &globals->blues,
|
||||
hint->org_pos + hint->org_len,
|
||||
hint->org_pos,
|
||||
&align );
|
||||
hint->org_pos + hint->org_len,
|
||||
hint->org_pos,
|
||||
&align );
|
||||
}
|
||||
|
||||
switch (align.align)
|
||||
switch ( align.align )
|
||||
{
|
||||
case PSH_BLUE_ALIGN_TOP:
|
||||
{
|
||||
/* the top of the stem is aligned against a blue zone */
|
||||
hint->cur_pos = align.align_top - fit_len;
|
||||
break;
|
||||
}
|
||||
case PSH_BLUE_ALIGN_TOP:
|
||||
/* the top of the stem is aligned against a blue zone */
|
||||
hint->cur_pos = align.align_top - fit_len;
|
||||
break;
|
||||
|
||||
case PSH_BLUE_ALIGN_BOT:
|
||||
{
|
||||
/* the bottom of the stem is aligned against a blue zone */
|
||||
hint->cur_pos = align.align_bot;
|
||||
break;
|
||||
}
|
||||
case PSH_BLUE_ALIGN_BOT:
|
||||
/* the bottom of the stem is aligned against a blue zone */
|
||||
hint->cur_pos = align.align_bot;
|
||||
break;
|
||||
|
||||
case PSH_BLUE_ALIGN_TOP | PSH_BLUE_ALIGN_BOT:
|
||||
{
|
||||
/* both edges of the stem are aligned against blue zones */
|
||||
hint->cur_pos = align.align_bot;
|
||||
hint->cur_len = align.align_top - align.align_bot;
|
||||
}
|
||||
break;
|
||||
case PSH_BLUE_ALIGN_TOP | PSH_BLUE_ALIGN_BOT:
|
||||
/* both edges of the stem are aligned against blue zones */
|
||||
hint->cur_pos = align.align_bot;
|
||||
hint->cur_len = align.align_top - align.align_bot;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* normal processing */
|
||||
if ( (fit_len/64) & 1 )
|
||||
{
|
||||
/* odd number of pixels */
|
||||
fit_center = ((pos + (len >> 1)) & -64) + 32;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* even number of pixels */
|
||||
fit_center = (pos + (len >> 1) + 32) & -64;
|
||||
}
|
||||
default:
|
||||
/* normal processing */
|
||||
if ( ( fit_len / 64 ) & 1 )
|
||||
{
|
||||
/* odd number of pixels */
|
||||
fit_center = ( ( pos + ( len >> 1 ) ) & -64 ) + 32;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* even number of pixels */
|
||||
fit_center = ( pos + ( len >> 1 ) + 32 ) & -64;
|
||||
}
|
||||
|
||||
hint->cur_pos = fit_center - (fit_len >> 1);
|
||||
hint->cur_pos = fit_center - ( fit_len >> 1 );
|
||||
}
|
||||
|
||||
# else
|
||||
hint->cur_pos = (FT_MulFix( hint->org_pos, scale ) + delta + 32) & -64;
|
||||
hint->cur_len = FT_MulFix( hint->org_len, scale );
|
||||
|
||||
hint->cur_pos = ( FT_MulFix( hint->org_pos, scale ) + delta + 32 )
|
||||
& -64;
|
||||
hint->cur_len = FT_MulFix( hint->org_len, scale );
|
||||
|
||||
# endif
|
||||
|
||||
#ifdef DEBUG_HINTER
|
||||
if (ps1_debug_hint_func)
|
||||
if ( ps1_debug_hint_func )
|
||||
ps1_debug_hint_func( hint, vertical );
|
||||
#endif
|
||||
}
|
||||
@ -453,22 +477,20 @@
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** POINTS INTERPOLATION ROUTINES *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/***** *****/
|
||||
/***** POINTS INTERPOLATION ROUTINES *****/
|
||||
/***** *****/
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
|
||||
#define PSH1_ZONE_MIN -3200000
|
||||
#define PSH1_ZONE_MAX +3200000
|
||||
|
||||
#define PSH1_ZONE_MIN -3200000
|
||||
#define PSH1_ZONE_MAX +3200000
|
||||
|
||||
#define xxDEBUG_ZONES
|
||||
|
||||
|
||||
#ifdef DEBUG_ZONES
|
||||
|
||||
#include <stdio.h>
|
||||
@ -477,26 +499,27 @@
|
||||
print_zone( PSH1_Zone zone )
|
||||
{
|
||||
printf( "zone [scale,delta,min,max] = [%.3f,%.3f,%d,%d]\n",
|
||||
zone->scale/65536.0,
|
||||
zone->delta/64.0,
|
||||
zone->scale / 65536.0,
|
||||
zone->delta / 64.0,
|
||||
zone->min,
|
||||
zone->max );
|
||||
}
|
||||
|
||||
#else
|
||||
# define print_zone(x) do { } while (0)
|
||||
#define print_zone( x ) do { } while ( 0 )
|
||||
#endif
|
||||
|
||||
/* setup interpolation zones once the hints have been grid-fitted */
|
||||
/* by the optimizer.. */
|
||||
/* setup interpolation zones once the hints have been grid-fitted */
|
||||
/* by the optimizer */
|
||||
static void
|
||||
psh1_hint_table_setup_zones( PSH1_Hint_Table table,
|
||||
FT_Fixed scale,
|
||||
FT_Fixed delta )
|
||||
{
|
||||
FT_UInt count;
|
||||
PSH1_Zone zone;
|
||||
PSH1_Hint *sort, hint, hint2;
|
||||
FT_UInt count;
|
||||
PSH1_Zone zone;
|
||||
PSH1_Hint *sort, hint, hint2;
|
||||
|
||||
|
||||
zone = table->zones;
|
||||
|
||||
@ -513,10 +536,11 @@
|
||||
return;
|
||||
}
|
||||
|
||||
/* the first zone is before the first hint */
|
||||
/* the first zone is before the first hint */
|
||||
/* x' = (x-x0)*s + x0' = x*s + ( x0' - x0*s ) */
|
||||
sort = table->sort;
|
||||
hint = sort[0];
|
||||
|
||||
sort = table->sort;
|
||||
hint = sort[0];
|
||||
|
||||
zone->scale = scale;
|
||||
zone->delta = hint->cur_pos - FT_MulFix( hint->org_pos, scale );
|
||||
@ -531,6 +555,7 @@
|
||||
{
|
||||
FT_Fixed scale2;
|
||||
|
||||
|
||||
if ( hint->org_len > 0 )
|
||||
{
|
||||
/* setup a zone for inner-stem interpolation */
|
||||
@ -557,25 +582,28 @@
|
||||
/* setup zone for inter-stem interpolation */
|
||||
/* (x'-x1') = (x-x1)*(x2'-x1')/(x2-x1) */
|
||||
/* x' = x*s3 + x1' - x1*s3 */
|
||||
|
||||
scale2 = FT_DivFix( hint2->cur_pos - (hint->cur_pos + hint->cur_len),
|
||||
hint2->org_pos - (hint->org_pos + hint->org_len) );
|
||||
zone->scale = scale2;
|
||||
zone->min = hint->org_pos + hint->org_len;
|
||||
zone->max = hint2->org_pos;
|
||||
zone->delta = hint->cur_pos + hint->cur_len - FT_MulFix( zone->min, scale2 );
|
||||
zone->delta = hint->cur_pos + hint->cur_len -
|
||||
FT_MulFix( zone->min, scale2 );
|
||||
|
||||
print_zone( zone );
|
||||
|
||||
zone++;
|
||||
|
||||
hint = hint2;
|
||||
hint = hint2;
|
||||
}
|
||||
|
||||
/* the last zone */
|
||||
zone->scale = scale;
|
||||
zone->min = hint->org_pos + hint->org_len;
|
||||
zone->max = PSH1_ZONE_MAX;
|
||||
zone->delta = hint->cur_pos + hint->cur_len - FT_MulFix( zone->min, scale );
|
||||
zone->delta = hint->cur_pos + hint->cur_len -
|
||||
FT_MulFix( zone->min, scale );
|
||||
|
||||
print_zone( zone );
|
||||
|
||||
@ -586,13 +614,14 @@
|
||||
}
|
||||
|
||||
|
||||
/* tune a single coordinate with the current interpolation zones */
|
||||
/* tune a single coordinate with the current interpolation zones */
|
||||
static FT_Pos
|
||||
psh1_hint_table_tune_coord( PSH1_Hint_Table table,
|
||||
FT_Int coord )
|
||||
{
|
||||
PSH1_Zone zone;
|
||||
|
||||
|
||||
zone = table->zone;
|
||||
|
||||
if ( coord < zone->min )
|
||||
@ -603,8 +632,8 @@
|
||||
break;
|
||||
|
||||
zone--;
|
||||
}
|
||||
while ( coord < zone->min );
|
||||
|
||||
} while ( coord < zone->min );
|
||||
table->zone = zone;
|
||||
}
|
||||
else if ( coord > zone->max )
|
||||
@ -615,8 +644,8 @@
|
||||
break;
|
||||
|
||||
zone++;
|
||||
}
|
||||
while ( coord > zone->max );
|
||||
|
||||
} while ( coord > zone->max );
|
||||
table->zone = zone;
|
||||
}
|
||||
|
||||
@ -624,8 +653,8 @@
|
||||
}
|
||||
|
||||
|
||||
/* tune a given outline with current interpolation zones */
|
||||
/* the function only works in a single dimension.. */
|
||||
/* tune a given outline with current interpolation zones. */
|
||||
/* The function only works in a single dimension. */
|
||||
static void
|
||||
psh1_hint_table_tune_outline( PSH1_Hint_Table table,
|
||||
FT_Outline* outline,
|
||||
@ -636,15 +665,17 @@
|
||||
FT_UInt count, first, last;
|
||||
PS_Mask_Table hint_masks = table->hint_masks;
|
||||
PS_Mask mask;
|
||||
PSH_Dimension dim = &globals->dimension[vertical];
|
||||
PSH_Dimension dim = &globals->dimension[vertical];
|
||||
FT_Fixed scale = dim->scale_mult;
|
||||
FT_Fixed delta = dim->scale_delta;
|
||||
|
||||
|
||||
if ( hint_masks && hint_masks->num_masks > 0 )
|
||||
{
|
||||
first = 0;
|
||||
mask = hint_masks->masks;
|
||||
count = hint_masks->num_masks;
|
||||
|
||||
for ( ; count > 0; count--, mask++ )
|
||||
{
|
||||
last = mask->end_point;
|
||||
@ -654,6 +685,7 @@
|
||||
FT_Vector* vec;
|
||||
FT_Int count2;
|
||||
|
||||
|
||||
psh1_hint_table_activate_mask( table, mask );
|
||||
psh1_hint_table_optimize( table, globals, outline, vertical );
|
||||
psh1_hint_table_setup_zones( table, scale, delta );
|
||||
@ -661,10 +693,12 @@
|
||||
|
||||
vec = outline->points + first;
|
||||
count2 = last - first;
|
||||
|
||||
for ( ; count2 > 0; count2--, vec++ )
|
||||
{
|
||||
FT_Pos x, *px;
|
||||
|
||||
|
||||
px = vertical ? &vec->x : &vec->y;
|
||||
x = *px;
|
||||
|
||||
@ -679,6 +713,7 @@
|
||||
{
|
||||
FT_Vector* vec;
|
||||
|
||||
|
||||
vec = outline->points;
|
||||
count = outline->n_points;
|
||||
|
||||
@ -696,13 +731,13 @@
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/***** *****/
|
||||
/***** HIGH-LEVEL INTERFACE *****/
|
||||
/***** *****/
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** HIGH-LEVEL INTERFACE *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
FT_Error
|
||||
ps1_hints_apply( PS_Hints ps_hints,
|
||||
@ -713,18 +748,21 @@
|
||||
FT_Error error = 0;
|
||||
FT_Int dimension;
|
||||
|
||||
|
||||
for ( dimension = 1; dimension >= 0; dimension-- )
|
||||
{
|
||||
PS_Dimension dim = &ps_hints->dimension[dimension];
|
||||
|
||||
/* initialise hints table */
|
||||
memset( &hints, 0, sizeof(hints) );
|
||||
|
||||
/* initialize hints table */
|
||||
memset( &hints, 0, sizeof ( hints ) );
|
||||
error = psh1_hint_table_init( &hints,
|
||||
&dim->hints,
|
||||
&dim->masks,
|
||||
&dim->counters,
|
||||
ps_hints->memory );
|
||||
if (error) goto Exit;
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
psh1_hint_table_tune_outline( &hints,
|
||||
outline,
|
||||
@ -737,3 +775,6 @@
|
||||
Exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* */
|
||||
/* pshalgo1.h */
|
||||
/* */
|
||||
/* First (basic) Postscript hinting routines */
|
||||
/* PostScript hinting algorithm 1 (specification). */
|
||||
/* */
|
||||
/* Copyright 2001 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
@ -15,58 +15,61 @@
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
#ifndef __PS_HINTER_ALGO1_H__
|
||||
#define __PS_HINTER_ALGO1_H__
|
||||
|
||||
#ifndef __PSHALGO1_H__
|
||||
#define __PSHALGO1_H__
|
||||
|
||||
#include "pshrec.h"
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
typedef struct PSH1_HintRec_* PSH1_Hint;
|
||||
typedef struct PSH1_HintRec_* PSH1_Hint;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PSH1_HINT_FLAG_GHOST = PS_HINT_FLAG_GHOST,
|
||||
PSH1_HINT_FLAG_BOTTOM = PS_HINT_FLAG_BOTTOM,
|
||||
PSH1_HINT_FLAG_ACTIVE = 4
|
||||
|
||||
|
||||
} PSH1_Hint_Flags;
|
||||
|
||||
#define psh1_hint_is_active(x) (((x)->flags & PSH1_HINT_FLAG_ACTIVE) != 0)
|
||||
#define psh1_hint_is_ghost(x) (((x)->flags & PSH1_HINT_FLAG_GHOST ) != 0)
|
||||
#define psh1_hint_is_active( x ) \
|
||||
( ( (x)->flags & PSH1_HINT_FLAG_ACTIVE ) != 0 )
|
||||
#define psh1_hint_is_ghost( x ) \
|
||||
( ( (x)->flags & PSH1_HINT_FLAG_GHOST ) != 0 )
|
||||
|
||||
#define psh1_hint_activate(x) (x)->flags |= PSH1_HINT_FLAG_ACTIVE
|
||||
#define psh1_hint_deactivate(x) (x)->flags &= ~PSH1_HINT_FLAG_ACTIVE
|
||||
#define psh1_hint_activate( x ) (x)->flags |= PSH1_HINT_FLAG_ACTIVE
|
||||
#define psh1_hint_deactivate( x ) (x)->flags &= ~PSH1_HINT_FLAG_ACTIVE
|
||||
|
||||
typedef struct PSH1_HintRec_
|
||||
typedef struct PSH1_HintRec_
|
||||
{
|
||||
FT_Int org_pos;
|
||||
FT_Int org_len;
|
||||
FT_Pos cur_pos;
|
||||
FT_Pos cur_len;
|
||||
|
||||
FT_UInt flags;
|
||||
|
||||
FT_Int org_pos;
|
||||
FT_Int org_len;
|
||||
FT_Pos cur_pos;
|
||||
FT_Pos cur_len;
|
||||
|
||||
FT_UInt flags;
|
||||
|
||||
PSH1_Hint parent;
|
||||
FT_Int order;
|
||||
|
||||
FT_Int order;
|
||||
|
||||
} PSH1_HintRec;
|
||||
|
||||
|
||||
/* this is an interpolation zone used for strong points */
|
||||
/* weak points are interpolated according to their strong */
|
||||
/* neighbours.. */
|
||||
typedef struct PSH1_ZoneRec_
|
||||
/* this is an interpolation zone used for strong points; */
|
||||
/* weak points are interpolated according to their strong */
|
||||
/* neighbours */
|
||||
typedef struct PSH1_ZoneRec_
|
||||
{
|
||||
FT_Fixed scale;
|
||||
FT_Fixed delta;
|
||||
FT_Pos min;
|
||||
FT_Pos max;
|
||||
|
||||
|
||||
} PSH1_ZoneRec, *PSH1_Zone;
|
||||
|
||||
|
||||
typedef struct PSH1_Hint_TableRec_
|
||||
typedef struct PSH1_Hint_TableRec_
|
||||
{
|
||||
FT_UInt max_hints;
|
||||
FT_UInt num_hints;
|
||||
@ -78,23 +81,29 @@ FT_BEGIN_HEADER
|
||||
PSH1_Zone zone;
|
||||
PS_Mask_Table hint_masks;
|
||||
PS_Mask_Table counter_masks;
|
||||
|
||||
|
||||
} PSH1_Hint_TableRec, *PSH1_Hint_Table;
|
||||
|
||||
|
||||
extern FT_Error
|
||||
ps1_hints_apply( PS_Hints ps_hints,
|
||||
FT_Outline* outline,
|
||||
PSH_Globals globals );
|
||||
ps1_hints_apply( PS_Hints ps_hints,
|
||||
FT_Outline* outline,
|
||||
PSH_Globals globals );
|
||||
|
||||
|
||||
#ifdef DEBUG_HINTER
|
||||
extern PSH1_Hint_Table ps1_debug_hint_table;
|
||||
|
||||
typedef void (*PSH1_HintFunc)( PSH1_Hint hint, FT_Bool vertical );
|
||||
extern PSH1_HintFunc ps1_debug_hint_func;
|
||||
typedef void
|
||||
(*PSH1_HintFunc)( PSH1_Hint hint,
|
||||
FT_Bool vertical );
|
||||
|
||||
extern PSH1_HintFunc ps1_debug_hint_func;
|
||||
#endif
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* __PS_HINTER_FITTER_H__ */
|
||||
#endif /* __PSHALGO1_H__ */
|
||||
|
||||
|
||||
/* END */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
/* */
|
||||
/* pshalgo2.h */
|
||||
/* */
|
||||
/* First (basic) Postscript hinting routines */
|
||||
/* PostScript hinting algorithm 2 (specification). */
|
||||
/* */
|
||||
/* Copyright 2001 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
@ -15,16 +15,20 @@
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
#ifndef __PS_HINTER_ALGO2_H__
|
||||
#define __PS_HINTER_ALGO2_H__
|
||||
|
||||
#ifndef __PSHALGO2_H__
|
||||
#define __PSHALGO2_H__
|
||||
|
||||
|
||||
#include "pshrec.h"
|
||||
#include "pshglob.h"
|
||||
#include FT_TRIGONOMETRY_H
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
typedef struct PSH2_HintRec_* PSH2_Hint;
|
||||
|
||||
typedef struct PSH2_HintRec_* PSH2_Hint;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@ -32,17 +36,20 @@ FT_BEGIN_HEADER
|
||||
PSH2_HINT_BOTTOM = PS_HINT_FLAG_BOTTOM,
|
||||
PSH2_HINT_ACTIVE = 4,
|
||||
PSH2_HINT_FITTED = 8
|
||||
|
||||
} PSH2_Hint_Flags;
|
||||
|
||||
#define psh2_hint_is_active(x) (((x)->flags & PSH2_HINT_ACTIVE) != 0)
|
||||
#define psh2_hint_is_ghost(x) (((x)->flags & PSH2_HINT_GHOST) != 0)
|
||||
#define psh2_hint_is_fitted(x) (((x)->flags & PSH2_HINT_FITTED) != 0)
|
||||
|
||||
#define psh2_hint_activate(x) (x)->flags |= PSH2_HINT_ACTIVE
|
||||
#define psh2_hint_deactivate(x) (x)->flags &= ~PSH2_HINT_ACTIVE
|
||||
#define psh2_hint_set_fitted(x) (x)->flags |= PSH2_HINT_FITTED
|
||||
#define psh2_hint_is_active( x ) ( ( (x)->flags & PSH2_HINT_ACTIVE ) != 0 )
|
||||
#define psh2_hint_is_ghost( x ) ( ( (x)->flags & PSH2_HINT_GHOST ) != 0 )
|
||||
#define psh2_hint_is_fitted( x ) ( ( (x)->flags & PSH2_HINT_FITTED ) != 0 )
|
||||
|
||||
typedef struct PSH2_HintRec_
|
||||
#define psh2_hint_activate( x ) (x)->flags |= PSH2_HINT_ACTIVE
|
||||
#define psh2_hint_deactivate( x ) (x)->flags &= ~PSH2_HINT_ACTIVE
|
||||
#define psh2_hint_set_fitted( x ) (x)->flags |= PSH2_HINT_FITTED
|
||||
|
||||
|
||||
typedef struct PSH2_HintRec_
|
||||
{
|
||||
FT_Int org_pos;
|
||||
FT_Int org_len;
|
||||
@ -55,10 +62,10 @@ FT_BEGIN_HEADER
|
||||
} PSH2_HintRec;
|
||||
|
||||
|
||||
/* this is an interpolation zone used for strong points */
|
||||
/* weak points are interpolated according to their strong */
|
||||
/* neighbours.. */
|
||||
typedef struct PSH2_ZoneRec_
|
||||
/* this is an interpolation zone used for strong points; */
|
||||
/* weak points are interpolated according to their strong */
|
||||
/* neighbours */
|
||||
typedef struct PSH2_ZoneRec_
|
||||
{
|
||||
FT_Fixed scale;
|
||||
FT_Fixed delta;
|
||||
@ -68,7 +75,7 @@ FT_BEGIN_HEADER
|
||||
} PSH2_ZoneRec, *PSH2_Zone;
|
||||
|
||||
|
||||
typedef struct PSH2_Hint_TableRec_
|
||||
typedef struct PSH2_Hint_TableRec_
|
||||
{
|
||||
FT_UInt max_hints;
|
||||
FT_UInt num_hints;
|
||||
@ -89,11 +96,11 @@ FT_BEGIN_HEADER
|
||||
|
||||
enum
|
||||
{
|
||||
PSH2_DIR_NONE = 4,
|
||||
PSH2_DIR_UP = 1,
|
||||
PSH2_DIR_DOWN = -1,
|
||||
PSH2_DIR_LEFT = -2,
|
||||
PSH2_DIR_RIGHT = 2
|
||||
PSH2_DIR_NONE = 4,
|
||||
PSH2_DIR_UP = 1,
|
||||
PSH2_DIR_DOWN = -1,
|
||||
PSH2_DIR_LEFT = -2,
|
||||
PSH2_DIR_RIGHT = 2
|
||||
};
|
||||
|
||||
enum
|
||||
@ -105,7 +112,7 @@ FT_BEGIN_HEADER
|
||||
};
|
||||
|
||||
|
||||
typedef struct PSH2_PointRec_
|
||||
typedef struct PSH2_PointRec_
|
||||
{
|
||||
PSH2_Point prev;
|
||||
PSH2_Point next;
|
||||
@ -130,15 +137,16 @@ FT_BEGIN_HEADER
|
||||
} PSH2_PointRec;
|
||||
|
||||
|
||||
#define psh2_point_is_strong(p) ((p)->flags & PSH2_POINT_STRONG)
|
||||
#define psh2_point_is_fitted(p) ((p)->flags & PSH2_POINT_FITTED)
|
||||
#define psh2_point_is_smooth(p) ((p)->flags & PSH2_POINT_SMOOTH)
|
||||
#define psh2_point_is_strong( p ) ( (p)->flags & PSH2_POINT_STRONG )
|
||||
#define psh2_point_is_fitted( p ) ( (p)->flags & PSH2_POINT_FITTED )
|
||||
#define psh2_point_is_smooth( p ) ( (p)->flags & PSH2_POINT_SMOOTH )
|
||||
|
||||
#define psh2_point_set_strong(p) (p)->flags |= PSH2_POINT_STRONG
|
||||
#define psh2_point_set_fitted(p) (p)->flags |= PSH2_POINT_FITTED
|
||||
#define psh2_point_set_smooth(p) (p)->flags |= PSH2_POINT_SMOOTH
|
||||
#define psh2_point_set_strong( p ) (p)->flags |= PSH2_POINT_STRONG
|
||||
#define psh2_point_set_fitted( p ) (p)->flags |= PSH2_POINT_FITTED
|
||||
#define psh2_point_set_smooth( p ) (p)->flags |= PSH2_POINT_SMOOTH
|
||||
|
||||
typedef struct PSH2_ContourRec_
|
||||
|
||||
typedef struct PSH2_ContourRec_
|
||||
{
|
||||
PSH2_Point start;
|
||||
FT_UInt count;
|
||||
@ -146,8 +154,7 @@ FT_BEGIN_HEADER
|
||||
} PSH2_ContourRec;
|
||||
|
||||
|
||||
|
||||
typedef struct PSH2_GlyphRec_
|
||||
typedef struct PSH2_GlyphRec_
|
||||
{
|
||||
FT_UInt num_points;
|
||||
FT_UInt num_contours;
|
||||
@ -168,20 +175,28 @@ FT_BEGIN_HEADER
|
||||
|
||||
|
||||
#ifdef DEBUG_HINTER
|
||||
extern PSH2_Hint_Table ps2_debug_hint_table;
|
||||
extern PSH2_Hint_Table ps2_debug_hint_table;
|
||||
|
||||
typedef void (*PSH2_HintFunc)( PSH2_Hint hint, FT_Bool vertical );
|
||||
extern PSH2_HintFunc ps2_debug_hint_func;
|
||||
typedef void
|
||||
(*PSH2_HintFunc)( PSH2_Hint hint,
|
||||
FT_Bool vertical );
|
||||
|
||||
extern PSH2_Glyph ps2_debug_glyph;
|
||||
extern PSH2_HintFunc ps2_debug_hint_func;
|
||||
|
||||
extern PSH2_Glyph ps2_debug_glyph;
|
||||
#endif
|
||||
|
||||
|
||||
extern FT_Error
|
||||
ps2_hints_apply( PS_Hints ps_hints,
|
||||
FT_Outline* outline,
|
||||
PSH_Globals globals );
|
||||
ps2_hints_apply( PS_Hints ps_hints,
|
||||
FT_Outline* outline,
|
||||
PSH_Globals globals );
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* __PS_HINTS_ALGO_2_H__ */
|
||||
|
||||
#endif /* __PSHALGO2_H__ */
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -1,27 +1,45 @@
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* pshglob.c */
|
||||
/* */
|
||||
/* PostScript hinter global hinting management (body). */
|
||||
/* Inspired by the new auto-hinter module. */
|
||||
/* */
|
||||
/* Copyright 2001 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_FREETYPE_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
#include "pshglob.h"
|
||||
|
||||
#ifdef DEBUG_HINTER
|
||||
extern PSH_Globals ps_debug_globals = 0;
|
||||
#endif
|
||||
extern PSH_Globals ps_debug_globals = 0;
|
||||
#endif
|
||||
|
||||
/* "simple" ps hinter globals management, inspired from the new auto-hinter */
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** STANDARD WIDTHS *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** STANDARD WIDTHS *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
/* scale the widths/heights table */
|
||||
|
||||
/* scale the widths/heights table */
|
||||
static void
|
||||
psh_globals_scale_widths( PSH_Globals globals,
|
||||
FT_UInt direction )
|
||||
psh_globals_scale_widths( PSH_Globals globals,
|
||||
FT_UInt direction )
|
||||
{
|
||||
PSH_Dimension dim = &globals->dimension[direction];
|
||||
PSH_Widths std = &dim->std;
|
||||
@ -29,6 +47,7 @@
|
||||
PSH_Width width = std->widths;
|
||||
FT_Fixed scale = dim->scale_mult;
|
||||
|
||||
|
||||
for ( ; count > 0; count--, width++ )
|
||||
{
|
||||
width->cur = FT_MulFix( width->org, scale );
|
||||
@ -37,8 +56,7 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* org_width is is font units, result in device pixels, 26.6 format */
|
||||
/* org_width is is font units, result in device pixels, 26.6 format */
|
||||
FT_LOCAL_DEF FT_Pos
|
||||
psh_dimension_snap_width( PSH_Dimension dimension,
|
||||
FT_Int org_width )
|
||||
@ -48,11 +66,13 @@
|
||||
FT_Pos best = 64 + 32 + 2;
|
||||
FT_Pos reference = width;
|
||||
|
||||
|
||||
for ( n = 0; n < dimension->std.count; n++ )
|
||||
{
|
||||
FT_Pos w;
|
||||
FT_Pos dist;
|
||||
|
||||
|
||||
w = dimension->std.widths[n].cur;
|
||||
dist = width - w;
|
||||
if ( dist < 0 )
|
||||
@ -81,13 +101,13 @@
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** BLUE ZONES *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** BLUE ZONES *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
static void
|
||||
psh_blues_set_zones_0( PSH_Blues target,
|
||||
@ -97,19 +117,21 @@
|
||||
PSH_Blue_Table top_table,
|
||||
PSH_Blue_Table bot_table )
|
||||
{
|
||||
FT_UInt count_top = top_table->count;
|
||||
FT_UInt count_bot = bot_table->count;
|
||||
FT_Bool first = 1;
|
||||
FT_UInt count_top = top_table->count;
|
||||
FT_UInt count_bot = bot_table->count;
|
||||
FT_Bool first = 1;
|
||||
|
||||
FT_UNUSED( target );
|
||||
|
||||
|
||||
FT_UNUSED(target);
|
||||
|
||||
for ( ; read_count > 0; read_count -= 2 )
|
||||
{
|
||||
FT_Int reference, delta;
|
||||
FT_UInt count;
|
||||
PSH_Blue_Zone zones, zone;
|
||||
FT_Bool top;
|
||||
|
||||
|
||||
|
||||
/* read blue zone entry, and select target top/bottom zone */
|
||||
top = 0;
|
||||
if ( first || is_others )
|
||||
@ -125,25 +147,26 @@
|
||||
{
|
||||
reference = read[0];
|
||||
delta = read[1] - reference;
|
||||
|
||||
|
||||
zones = top_table->zones;
|
||||
count = count_top;
|
||||
top = 1;
|
||||
}
|
||||
|
||||
|
||||
/* insert into sorted table */
|
||||
zone = zones;
|
||||
zone = zones;
|
||||
for ( ; count > 0; count--, zone++ )
|
||||
{
|
||||
if ( reference < zone->org_ref )
|
||||
break;
|
||||
|
||||
|
||||
if ( reference == zone->org_ref )
|
||||
{
|
||||
FT_Int delta0 = zone->org_delta;
|
||||
|
||||
/* we have two zones on the same reference position */
|
||||
/* only keep the largest one.. */
|
||||
|
||||
/* we have two zones on the same reference position -- */
|
||||
/* only keep the largest one */
|
||||
if ( delta < 0 )
|
||||
{
|
||||
if ( delta < delta0 )
|
||||
@ -157,102 +180,109 @@
|
||||
goto Skip;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for ( ; count > 0; count-- )
|
||||
zone[count] = zone[count-1];
|
||||
|
||||
|
||||
zone->org_ref = reference;
|
||||
zone->org_delta = delta;
|
||||
|
||||
|
||||
if ( top )
|
||||
count_top ++;
|
||||
count_top++;
|
||||
else
|
||||
count_bot ++;
|
||||
|
||||
count_bot++;
|
||||
|
||||
Skip:
|
||||
read += 2;
|
||||
}
|
||||
}
|
||||
|
||||
top_table->count = count_top;
|
||||
bot_table->count = count_bot;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* re-read blue zones from the original fonts, and store them into out */
|
||||
/* private structure. This function re-orders, sanitizes and fuzz-expands */
|
||||
/* the zones as well.. */
|
||||
/* Re-read blue zones from the original fonts and store them into out */
|
||||
/* private structure. This function re-orders, sanitizes and */
|
||||
/* fuzz-expands the zones as well. */
|
||||
static void
|
||||
psh_blues_set_zones( PSH_Blues target,
|
||||
FT_UInt count,
|
||||
FT_Short* blues,
|
||||
FT_UInt count_others,
|
||||
FT_Short* other_blues,
|
||||
FT_Int fuzz,
|
||||
FT_Int family )
|
||||
psh_blues_set_zones( PSH_Blues target,
|
||||
FT_UInt count,
|
||||
FT_Short* blues,
|
||||
FT_UInt count_others,
|
||||
FT_Short* other_blues,
|
||||
FT_Int fuzz,
|
||||
FT_Int family )
|
||||
{
|
||||
PSH_Blue_Table top_table, bot_table;
|
||||
FT_Int count_top, count_bot;
|
||||
|
||||
|
||||
|
||||
if ( family )
|
||||
{
|
||||
top_table = &target->family_top;
|
||||
bot_table = &target->family_bottom;
|
||||
top_table = &target->family_top;
|
||||
bot_table = &target->family_bottom;
|
||||
}
|
||||
else
|
||||
{
|
||||
top_table = &target->normal_top;
|
||||
bot_table = &target->normal_bottom;
|
||||
top_table = &target->normal_top;
|
||||
bot_table = &target->normal_bottom;
|
||||
}
|
||||
|
||||
/* read the input blue zones, and build two sorted tables */
|
||||
/* (one for the top zones, the other for the bottom zones */
|
||||
|
||||
/* read the input blue zones, and build two sorted tables */
|
||||
/* (one for the top zones, the other for the bottom zones) */
|
||||
top_table->count = 0;
|
||||
bot_table->count = 0;
|
||||
|
||||
|
||||
/* first, the blues */
|
||||
psh_blues_set_zones_0( target, 0, count, blues, top_table, bot_table );
|
||||
psh_blues_set_zones_0( target, 1, count_others, other_blues, top_table, bot_table );
|
||||
|
||||
psh_blues_set_zones_0( target, 0,
|
||||
count, blues, top_table, bot_table );
|
||||
psh_blues_set_zones_0( target, 1,
|
||||
count_others, other_blues, top_table, bot_table );
|
||||
|
||||
count_top = top_table->count;
|
||||
count_bot = bot_table->count;
|
||||
|
||||
|
||||
/* sanitize top table */
|
||||
if ( count_top > 0 )
|
||||
{
|
||||
PSH_Blue_Zone zone = top_table->zones;
|
||||
|
||||
|
||||
|
||||
for ( count = count_top; count > 0; count--, zone++ )
|
||||
{
|
||||
FT_Int delta;
|
||||
|
||||
|
||||
|
||||
if ( count > 1 )
|
||||
{
|
||||
delta = zone[1].org_ref - zone[0].org_ref;
|
||||
if ( zone->org_delta > delta )
|
||||
zone->org_delta = delta;
|
||||
}
|
||||
|
||||
|
||||
zone->org_bottom = zone->org_ref;
|
||||
zone->org_top = zone->org_delta + zone->org_ref;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* sanitize bottom table */
|
||||
if ( count_bot > 0 )
|
||||
{
|
||||
PSH_Blue_Zone zone = bot_table->zones;
|
||||
|
||||
|
||||
for ( count = count_bot; count > 0; count--, zone++ )
|
||||
{
|
||||
FT_Int delta;
|
||||
|
||||
|
||||
|
||||
if ( count > 1 )
|
||||
{
|
||||
delta = zone[0].org_ref - zone[1].org_ref;
|
||||
if ( zone->org_delta < delta )
|
||||
zone->org_delta = delta;
|
||||
}
|
||||
|
||||
|
||||
zone->org_top = zone->org_ref;
|
||||
zone->org_bottom = zone->org_delta + zone->org_ref;
|
||||
}
|
||||
@ -263,38 +293,38 @@
|
||||
FT_Int dim, top, bot, delta;
|
||||
PSH_Blue_Zone zone;
|
||||
|
||||
|
||||
zone = top_table->zones;
|
||||
count = count_top;
|
||||
|
||||
|
||||
for ( dim = 1; dim >= 0; dim-- )
|
||||
{
|
||||
if ( count > 0 )
|
||||
{
|
||||
/* expand the bottom of the lowest zone normally */
|
||||
zone->org_bottom -= fuzz;
|
||||
|
||||
/* expand the top and bottom of intermediate zones */
|
||||
|
||||
/* expand the top and bottom of intermediate zones; */
|
||||
/* checking that the interval is smaller than the fuzz */
|
||||
top = zone->org_top;
|
||||
|
||||
|
||||
for ( count--; count > 0; count-- )
|
||||
{
|
||||
bot = zone[1].org_bottom;
|
||||
delta = bot - top;
|
||||
if ( delta < 2*fuzz )
|
||||
{
|
||||
zone[0].org_top = zone[1].org_bottom = top + delta/2;
|
||||
}
|
||||
|
||||
if ( delta < 2 * fuzz )
|
||||
zone[0].org_top = zone[1].org_bottom = top + delta / 2;
|
||||
else
|
||||
{
|
||||
zone[0].org_top = top + fuzz;
|
||||
zone[1].org_bottom = bot - fuzz;
|
||||
}
|
||||
|
||||
|
||||
zone++;
|
||||
top = zone->org_top;
|
||||
}
|
||||
|
||||
|
||||
/* expand the top of the highest zone normally */
|
||||
zone->org_top = top + fuzz;
|
||||
}
|
||||
@ -305,8 +335,7 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* reset the blues table when the device transform changes */
|
||||
/* reset the blues table when the device transform changes */
|
||||
static void
|
||||
psh_blues_scale_zones( PSH_Blues blues,
|
||||
FT_Fixed scale,
|
||||
@ -315,41 +344,51 @@
|
||||
FT_UInt count;
|
||||
FT_UInt num;
|
||||
PSH_Blue_Table table = 0;
|
||||
|
||||
|
||||
|
||||
for ( num = 0; num < 4; num++ )
|
||||
{
|
||||
PSH_Blue_Zone zone;
|
||||
|
||||
switch (num)
|
||||
|
||||
|
||||
switch ( num )
|
||||
{
|
||||
case 0: table = &blues->normal_top; break;
|
||||
case 1: table = &blues->normal_bottom; break;
|
||||
case 2: table = &blues->family_top; break;
|
||||
default: table = &blues->family_bottom;
|
||||
case 0:
|
||||
table = &blues->normal_top;
|
||||
break;
|
||||
case 1:
|
||||
table = &blues->normal_bottom;
|
||||
break;
|
||||
case 2:
|
||||
table = &blues->family_top;
|
||||
break;
|
||||
default:
|
||||
table = &blues->family_bottom;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
zone = table->zones;
|
||||
count = table->count;
|
||||
for ( ; count > 0; count--, zone++ )
|
||||
{
|
||||
zone->cur_top = FT_MulFix( zone->org_top, scale ) + delta;
|
||||
zone->cur_top = FT_MulFix( zone->org_top, scale ) + delta;
|
||||
zone->cur_bottom = FT_MulFix( zone->org_bottom, scale ) + delta;
|
||||
zone->cur_ref = FT_MulFix( zone->org_ref, scale ) + delta;
|
||||
zone->cur_delta = FT_MulFix( zone->org_delta, scale );
|
||||
|
||||
zone->cur_ref = FT_MulFix( zone->org_ref, scale ) + delta;
|
||||
zone->cur_delta = FT_MulFix( zone->org_delta, scale );
|
||||
|
||||
/* round scaled reference position */
|
||||
zone->cur_ref = ( zone->cur_ref + 32 ) & -64;
|
||||
|
||||
#if 0
|
||||
#if 0
|
||||
if ( zone->cur_ref > zone->cur_top )
|
||||
zone->cur_ref -= 64;
|
||||
else if ( zone->cur_ref < zone->cur_bottom )
|
||||
zone->cur_ref += 64;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX: we should process the family / normal tables here !! */
|
||||
|
||||
/* XXX: we should process the family / normal tables here! */
|
||||
}
|
||||
|
||||
|
||||
@ -362,18 +401,20 @@
|
||||
PSH_Blue_Table table;
|
||||
FT_UInt count;
|
||||
PSH_Blue_Zone zone;
|
||||
|
||||
|
||||
|
||||
alignment->align = 0;
|
||||
|
||||
|
||||
/* lookup stem top in top zones table */
|
||||
table = &blues->normal_top;
|
||||
count = table->count;
|
||||
zone = table->zones;
|
||||
|
||||
for ( ; count > 0; count--, zone++ )
|
||||
{
|
||||
if ( stem_top < zone->org_bottom )
|
||||
break;
|
||||
|
||||
|
||||
if ( stem_top <= zone->org_top )
|
||||
{
|
||||
alignment->align |= PSH_BLUE_ALIGN_TOP;
|
||||
@ -382,10 +423,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* lookup stem bottom in bottom zones table */
|
||||
/* look up stem bottom in bottom zones table */
|
||||
table = &blues->normal_bottom;
|
||||
count = table->count;
|
||||
zone = table->zones;
|
||||
|
||||
for ( ; count > 0; count--, zone++ )
|
||||
{
|
||||
if ( stem_bot < zone->org_bottom )
|
||||
@ -401,39 +443,40 @@
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** GLOBAL HINTS *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** GLOBAL HINTS *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
static void
|
||||
psh_globals_destroy( PSH_Globals globals )
|
||||
{
|
||||
if (globals)
|
||||
if ( globals )
|
||||
{
|
||||
FT_Memory memory;
|
||||
|
||||
|
||||
|
||||
memory = globals->memory;
|
||||
globals->dimension[0].std.count = 0;
|
||||
globals->dimension[1].std.count = 0;
|
||||
|
||||
globals->dimension[1].std.count = 0;
|
||||
|
||||
globals->blues.normal_top.count = 0;
|
||||
globals->blues.normal_bottom.count = 0;
|
||||
globals->blues.family_top.count = 0;
|
||||
globals->blues.family_bottom.count = 0;
|
||||
|
||||
|
||||
FREE( globals );
|
||||
|
||||
#ifdef DEBUG_HINTER
|
||||
ps_debug_globals = 0;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static FT_Error
|
||||
psh_globals_new( FT_Memory memory,
|
||||
T1_Private* priv,
|
||||
@ -441,22 +484,25 @@
|
||||
{
|
||||
PSH_Globals globals;
|
||||
FT_Error error;
|
||||
|
||||
if ( !ALLOC( globals, sizeof(*globals) ) )
|
||||
|
||||
|
||||
if ( !ALLOC( globals, sizeof ( *globals ) ) )
|
||||
{
|
||||
FT_UInt count;
|
||||
FT_Short* read;
|
||||
|
||||
|
||||
|
||||
globals->memory = memory;
|
||||
|
||||
/* copy standard widths */
|
||||
/* copy standard widths */
|
||||
{
|
||||
PSH_Dimension dim = &globals->dimension[1];
|
||||
PSH_Width write = dim->std.widths;
|
||||
|
||||
|
||||
|
||||
write->org = priv->standard_width[1];
|
||||
write++;
|
||||
|
||||
|
||||
read = priv->snap_widths;
|
||||
for ( count = priv->num_snap_widths; count > 0; count-- )
|
||||
{
|
||||
@ -464,7 +510,7 @@
|
||||
write++;
|
||||
read++;
|
||||
}
|
||||
|
||||
|
||||
dim->std.count = write - dim->std.widths;
|
||||
}
|
||||
|
||||
@ -472,10 +518,11 @@
|
||||
{
|
||||
PSH_Dimension dim = &globals->dimension[0];
|
||||
PSH_Width write = dim->std.widths;
|
||||
|
||||
|
||||
|
||||
write->org = priv->standard_height[1];
|
||||
write++;
|
||||
|
||||
|
||||
read = priv->snap_heights;
|
||||
for ( count = priv->num_snap_heights; count > 0; count-- )
|
||||
{
|
||||
@ -486,12 +533,12 @@
|
||||
|
||||
dim->std.count = write - dim->std.widths;
|
||||
}
|
||||
|
||||
/* copy blue zones */
|
||||
|
||||
/* copy blue zones */
|
||||
psh_blues_set_zones( &globals->blues, priv->num_blue_values,
|
||||
priv->blue_values, priv->num_other_blues,
|
||||
priv->other_blues, priv->blue_fuzz, 0 );
|
||||
|
||||
|
||||
psh_blues_set_zones( &globals->blues, priv->num_family_blues,
|
||||
priv->family_blues, priv->num_family_other_blues,
|
||||
priv->family_other_blues, priv->blue_fuzz, 1 );
|
||||
@ -503,31 +550,31 @@
|
||||
|
||||
#ifdef DEBUG_HINTER
|
||||
ps_debug_globals = globals;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
*aglobals = globals;
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static FT_Error
|
||||
psh_globals_set_scale( PSH_Globals globals,
|
||||
FT_Fixed x_scale,
|
||||
FT_Fixed y_scale,
|
||||
FT_Fixed x_delta,
|
||||
FT_Fixed y_delta )
|
||||
psh_globals_set_scale( PSH_Globals globals,
|
||||
FT_Fixed x_scale,
|
||||
FT_Fixed y_scale,
|
||||
FT_Fixed x_delta,
|
||||
FT_Fixed y_delta )
|
||||
{
|
||||
PSH_Dimension dim = &globals->dimension[0];
|
||||
|
||||
PSH_Dimension dim = &globals->dimension[0];
|
||||
|
||||
|
||||
dim = &globals->dimension[0];
|
||||
if ( x_scale != dim->scale_mult ||
|
||||
x_delta != dim->scale_delta )
|
||||
{
|
||||
dim->scale_mult = x_scale;
|
||||
dim->scale_delta = x_delta;
|
||||
|
||||
|
||||
psh_globals_scale_widths( globals, 0 );
|
||||
}
|
||||
|
||||
@ -553,3 +600,6 @@
|
||||
funcs->set_scale = psh_globals_set_scale;
|
||||
funcs->destroy = psh_globals_destroy;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* */
|
||||
/* pshglob.h */
|
||||
/* */
|
||||
/* Postscript hinter globals hints management. */
|
||||
/* PostScript hinter global hinting management. */
|
||||
/* */
|
||||
/* Copyright 2001 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
@ -15,46 +15,54 @@
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
#ifndef __PS_HINTER_GLOBALS_H__
|
||||
#define __PS_HINTER_GLOBALS_H__
|
||||
|
||||
#ifndef __PSHGLOB_H__
|
||||
#define __PSHGLOB_H__
|
||||
|
||||
|
||||
#include FT_FREETYPE_H
|
||||
#include FT_INTERNAL_POSTSCRIPT_GLOBALS_H
|
||||
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
/***** *****/
|
||||
/***** GLOBAL HINTS INTERNALS *****/
|
||||
/***** *****/
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* @constant: PS_GLOBALS_MAX_BLUE_ZONES
|
||||
*
|
||||
* @description:
|
||||
* the maximum number of blue zones in a font global hints
|
||||
* structure. See @PS_Globals_BluesRec
|
||||
*/
|
||||
#define PS_GLOBALS_MAX_BLUE_ZONES 16
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* @constant: PS_GLOBALS_MAX_STD_WIDTHS
|
||||
*
|
||||
* @description:
|
||||
* the maximum number of standard and snap widths in either the
|
||||
* horizontal or vertical direction. See @PS_Globals_WidthsRec
|
||||
*/
|
||||
#define PS_GLOBALS_MAX_STD_WIDTHS 16
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** GLOBAL HINTS INTERNALS *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
/* standard and snap width */
|
||||
typedef struct PSH_WidthRec_
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* @constant: */
|
||||
/* PS_GLOBALS_MAX_BLUE_ZONES */
|
||||
/* */
|
||||
/* @description: */
|
||||
/* The maximum number of blue zones in a font global hints structure. */
|
||||
/* See @PS_Globals_BluesRec. */
|
||||
/* */
|
||||
#define PS_GLOBALS_MAX_BLUE_ZONES 16
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* @constant: */
|
||||
/* PS_GLOBALS_MAX_STD_WIDTHS */
|
||||
/* */
|
||||
/* @description: */
|
||||
/* The maximum number of standard and snap widths in either the */
|
||||
/* horizontal or vertical direction. See @PS_Globals_WidthsRec. */
|
||||
/* */
|
||||
#define PS_GLOBALS_MAX_STD_WIDTHS 16
|
||||
|
||||
|
||||
/* standard and snap width */
|
||||
typedef struct PSH_WidthRec_
|
||||
{
|
||||
FT_Int org;
|
||||
FT_Pos cur;
|
||||
@ -63,51 +71,50 @@ FT_BEGIN_HEADER
|
||||
} PSH_WidthRec, *PSH_Width;
|
||||
|
||||
|
||||
/* standard and snap widths table */
|
||||
typedef struct PSH_WidthsRec_
|
||||
/* standard and snap widths table */
|
||||
typedef struct PSH_WidthsRec_
|
||||
{
|
||||
FT_UInt count;
|
||||
PSH_WidthRec widths[ PS_GLOBALS_MAX_STD_WIDTHS ];
|
||||
PSH_WidthRec widths[PS_GLOBALS_MAX_STD_WIDTHS];
|
||||
|
||||
} PSH_WidthsRec, *PSH_Widths;
|
||||
|
||||
|
||||
typedef struct PSH_DimensionRec_
|
||||
typedef struct PSH_DimensionRec_
|
||||
{
|
||||
PSH_WidthsRec std;
|
||||
FT_Fixed scale_mult;
|
||||
FT_Fixed scale_delta;
|
||||
|
||||
|
||||
} PSH_DimensionRec, *PSH_Dimension;
|
||||
|
||||
|
||||
|
||||
/* blue zone descriptor */
|
||||
typedef struct PSH_Blue_ZoneRec_
|
||||
/* blue zone descriptor */
|
||||
typedef struct PSH_Blue_ZoneRec_
|
||||
{
|
||||
FT_Int org_ref;
|
||||
FT_Int org_delta;
|
||||
FT_Int org_top;
|
||||
FT_Int org_bottom;
|
||||
|
||||
FT_Pos cur_ref;
|
||||
FT_Pos cur_delta;
|
||||
FT_Pos cur_bottom;
|
||||
FT_Pos cur_top;
|
||||
FT_Int org_ref;
|
||||
FT_Int org_delta;
|
||||
FT_Int org_top;
|
||||
FT_Int org_bottom;
|
||||
|
||||
FT_Pos cur_ref;
|
||||
FT_Pos cur_delta;
|
||||
FT_Pos cur_bottom;
|
||||
FT_Pos cur_top;
|
||||
|
||||
} PSH_Blue_ZoneRec, *PSH_Blue_Zone;
|
||||
|
||||
|
||||
typedef struct PSH_Blue_TableRec_
|
||||
typedef struct PSH_Blue_TableRec_
|
||||
{
|
||||
FT_UInt count;
|
||||
PSH_Blue_ZoneRec zones[ PS_GLOBALS_MAX_BLUE_ZONES ];
|
||||
|
||||
PSH_Blue_ZoneRec zones[PS_GLOBALS_MAX_BLUE_ZONES];
|
||||
|
||||
} PSH_Blue_TableRec, *PSH_Blue_Table;
|
||||
|
||||
|
||||
/* blue zones table */
|
||||
typedef struct PSH_BluesRec_
|
||||
/* blue zones table */
|
||||
typedef struct PSH_BluesRec_
|
||||
{
|
||||
PSH_Blue_TableRec normal_top;
|
||||
PSH_Blue_TableRec normal_bottom;
|
||||
@ -118,8 +125,8 @@ FT_BEGIN_HEADER
|
||||
} PSH_BluesRec, *PSH_Blues;
|
||||
|
||||
|
||||
/* font globals */
|
||||
typedef struct PSH_GlobalsRec_
|
||||
/* font globals */
|
||||
typedef struct PSH_GlobalsRec_
|
||||
{
|
||||
FT_Memory memory;
|
||||
PSH_DimensionRec dimension[2];
|
||||
@ -127,21 +134,21 @@ FT_BEGIN_HEADER
|
||||
|
||||
} PSH_GlobalsRec;
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PSH_BLUE_ALIGN_TOP = 1,
|
||||
PSH_BLUE_ALIGN_BOT = 2
|
||||
|
||||
|
||||
} PSH_Blue_Align;
|
||||
|
||||
|
||||
typedef struct
|
||||
typedef struct PSH_AlignmentRec_
|
||||
{
|
||||
PSH_Blue_Align align;
|
||||
FT_Pos align_top;
|
||||
FT_Pos align_bot;
|
||||
|
||||
PSH_Blue_Align align;
|
||||
FT_Pos align_top;
|
||||
FT_Pos align_bot;
|
||||
|
||||
} PSH_AlignmentRec, *PSH_Alignment;
|
||||
|
||||
|
||||
@ -149,13 +156,13 @@ FT_BEGIN_HEADER
|
||||
psh_globals_funcs_init( PSH_Globals_FuncsRec* funcs );
|
||||
|
||||
|
||||
/* snap a stem width to fitter coordinates. org_width is in font units */
|
||||
/* result is in device pixels (26.6 format).. */
|
||||
/* snap a stem width to fitter coordinates. `org_width' is in font */
|
||||
/* units. The result is in device pixels (26.6 format). */
|
||||
FT_LOCAL FT_Pos
|
||||
psh_dimension_snap_width( PSH_Dimension dimension,
|
||||
FT_Int org_width );
|
||||
|
||||
/* snap a stem to one or two blue zones */
|
||||
/* snap a stem to one or two blue zones */
|
||||
FT_LOCAL void
|
||||
psh_blues_snap_stem( PSH_Blues blues,
|
||||
FT_Int stem_top,
|
||||
@ -164,9 +171,14 @@ FT_BEGIN_HEADER
|
||||
/* */
|
||||
|
||||
#ifdef DEBUG_HINTER
|
||||
extern PSH_Globals ps_debug_globals;
|
||||
#endif
|
||||
extern PSH_Globals ps_debug_globals;
|
||||
#endif
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* __T1_FITTER_GLOBALS_H__ */
|
||||
|
||||
#endif /* __PSHGLOB_H__ */
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -2,9 +2,9 @@
|
||||
/* */
|
||||
/* pshinter.c */
|
||||
/* */
|
||||
/* FreeType Postscript Hinting module */
|
||||
/* FreeType PostScript Hinting module */
|
||||
/* */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* Copyright 2001 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
@ -19,9 +19,9 @@
|
||||
#define FT_MAKE_OPTION_SINGLE_OBJECT
|
||||
|
||||
#include <ft2build.h>
|
||||
#include "pshrec.c"
|
||||
#include "pshrec.c"
|
||||
#include "pshglob.c"
|
||||
#include "pshalgo1.c"
|
||||
#include "pshalgo1.c"
|
||||
#include "pshalgo2.c"
|
||||
#include "pshmod.c"
|
||||
|
||||
|
@ -2,9 +2,9 @@
|
||||
/* */
|
||||
/* pshmod.c */
|
||||
/* */
|
||||
/* FreeType Postscript hinter module implementation (body). */
|
||||
/* FreeType PostScript hinter module implementation (body). */
|
||||
/* */
|
||||
/* Copyright 2000 by */
|
||||
/* Copyright 2001 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
@ -15,26 +15,28 @@
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
#include "pshrec.h"
|
||||
#include "pshalgo.h"
|
||||
|
||||
/* the Postscript Hinter module structure */
|
||||
typedef struct
|
||||
{
|
||||
FT_ModuleRec root;
|
||||
PS_HintsRec ps_hints;
|
||||
|
||||
PSH_Globals_FuncsRec globals_funcs;
|
||||
T1_Hints_FuncsRec t1_funcs;
|
||||
T2_Hints_FuncsRec t2_funcs;
|
||||
/* the Postscript Hinter module structure */
|
||||
typedef struct PS_Hinter_Module_Rec_
|
||||
{
|
||||
FT_ModuleRec root;
|
||||
PS_HintsRec ps_hints;
|
||||
|
||||
PSH_Globals_FuncsRec globals_funcs;
|
||||
T1_Hints_FuncsRec t1_funcs;
|
||||
T2_Hints_FuncsRec t2_funcs;
|
||||
|
||||
} PS_Hinter_ModuleRec, *PS_Hinter_Module;
|
||||
|
||||
|
||||
/* finalize module */
|
||||
FT_CALLBACK_DEF(void)
|
||||
/* finalize module */
|
||||
FT_CALLBACK_DEF( void )
|
||||
ps_hinter_done( PS_Hinter_Module module )
|
||||
{
|
||||
module->t1_funcs.hints = NULL;
|
||||
@ -44,51 +46,52 @@
|
||||
}
|
||||
|
||||
|
||||
/* initialise module, create hints recorder and the interface */
|
||||
FT_CALLBACK_DEF(FT_Error)
|
||||
/* initialize module, create hints recorder and the interface */
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
ps_hinter_init( PS_Hinter_Module module )
|
||||
{
|
||||
FT_Memory memory = module->root.memory;
|
||||
|
||||
|
||||
ps_hints_init( &module->ps_hints, memory );
|
||||
|
||||
psh_globals_funcs_init( &module->globals_funcs );
|
||||
|
||||
t1_hints_funcs_init( &module->t1_funcs );
|
||||
module->t1_funcs.hints = (T1_Hints) & module->ps_hints;
|
||||
module->t1_funcs.hints = (T1_Hints)&module->ps_hints;
|
||||
|
||||
t2_hints_funcs_init( &module->t2_funcs );
|
||||
module->t2_funcs.hints = (T2_Hints) & module->ps_hints;
|
||||
module->t2_funcs.hints = (T2_Hints)&module->ps_hints;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* returns global hints interface */
|
||||
FT_CALLBACK_DEF(PSH_Globals_Funcs)
|
||||
/* returns global hints interface */
|
||||
FT_CALLBACK_DEF( PSH_Globals_Funcs )
|
||||
pshinter_get_globals_funcs( FT_Module module )
|
||||
{
|
||||
return &((PS_Hinter_Module)module)->globals_funcs;
|
||||
}
|
||||
|
||||
|
||||
/* return Type 1 hints interface */
|
||||
FT_CALLBACK_DEF(T1_Hints_Funcs)
|
||||
/* return Type 1 hints interface */
|
||||
FT_CALLBACK_DEF( T1_Hints_Funcs )
|
||||
pshinter_get_t1_funcs( FT_Module module )
|
||||
{
|
||||
return &((PS_Hinter_Module)module)->t1_funcs;
|
||||
}
|
||||
|
||||
|
||||
/* return Type 2 hints interface */
|
||||
FT_CALLBACK_DEF(T2_Hints_Funcs)
|
||||
/* return Type 2 hints interface */
|
||||
FT_CALLBACK_DEF( T2_Hints_Funcs )
|
||||
pshinter_get_t2_funcs( FT_Module module )
|
||||
{
|
||||
return &((PS_Hinter_Module)module)->t2_funcs;
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF(PSHinter_Interface)
|
||||
FT_CALLBACK_DEF( PSHinter_Interface )
|
||||
pshinter_interface =
|
||||
{
|
||||
pshinter_get_globals_funcs,
|
||||
@ -101,14 +104,17 @@
|
||||
const FT_Module_Class pshinter_module_class =
|
||||
{
|
||||
0,
|
||||
sizeof( PS_Hinter_ModuleRec ),
|
||||
sizeof ( PS_Hinter_ModuleRec ),
|
||||
"pshinter",
|
||||
0x10000L,
|
||||
0x20000L,
|
||||
|
||||
&pshinter_interface, /* module-specific interface */
|
||||
&pshinter_interface, /* module-specific interface */
|
||||
|
||||
(FT_Module_Constructor) ps_hinter_init,
|
||||
(FT_Module_Destructor) ps_hinter_done,
|
||||
(FT_Module_Requester) 0 /* no additional interface for now */
|
||||
(FT_Module_Constructor)ps_hinter_init,
|
||||
(FT_Module_Destructor) ps_hinter_done,
|
||||
(FT_Module_Requester) 0 /* no additional interface for now */
|
||||
};
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -2,9 +2,9 @@
|
||||
/* */
|
||||
/* pshmod.h */
|
||||
/* */
|
||||
/* Postscript hinter module interface */
|
||||
/* PostScript hinter module interface (specification). */
|
||||
/* */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* Copyright 2001 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
@ -15,8 +15,9 @@
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
#ifndef __PS_HINTER_MODULE_H__
|
||||
#define __PS_HINTER_MODULE_H__
|
||||
|
||||
#ifndef __PSHMOD_H__
|
||||
#define __PSHMOD_H__
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
@ -31,7 +32,8 @@ FT_BEGIN_HEADER
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* __PS_HINTER_MODULE_H__ */
|
||||
|
||||
#endif /* __PSHMOD_H__ */
|
||||
|
||||
|
||||
/* END */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
/* */
|
||||
/* pshrec.h */
|
||||
/* */
|
||||
/* Postscript (Type1/Type2) hints recorder. */
|
||||
/* Postscript (Type1/Type2) hints recorder (specification). */
|
||||
/* */
|
||||
/* Copyright 2001 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
@ -13,46 +13,54 @@
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/* */
|
||||
/* The functions defined here are called from the Type 1, CID and CFF */
|
||||
/* font drivers to record the hints of a given character/glyph. */
|
||||
/* */
|
||||
/* The hints are recorded in a unified format, and are later processed */
|
||||
/* by the "optimiser" and "fitter" to adjust the outlines to the pixel */
|
||||
/* grid. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
#ifndef __PS_HINTER_RECORD_H__
|
||||
#define __PS_HINTER_RECORD_H__
|
||||
|
||||
/**************************************************************************/
|
||||
/* */
|
||||
/* The functions defined here are called from the Type 1, CID and CFF */
|
||||
/* font drivers to record the hints of a given character/glyph. */
|
||||
/* */
|
||||
/* The hints are recorded in a unified format, and are later processed */
|
||||
/* by the "optimizer" and "fitter" to adjust the outlines to the pixel */
|
||||
/* grid. */
|
||||
/* */
|
||||
/**************************************************************************/
|
||||
|
||||
|
||||
#ifndef __PSHREC_H__
|
||||
#define __PSHREC_H__
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
|
||||
#include "pshglob.h"
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
/***** *****/
|
||||
/***** GLYPH HINTS RECORDER INTERNALS *****/
|
||||
/***** *****/
|
||||
/**********************************************************************/
|
||||
/**********************************************************************/
|
||||
|
||||
/* handle to hint record */
|
||||
typedef struct PS_HintRec_* PS_Hint;
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
/***** *****/
|
||||
/***** GLYPH HINTS RECORDER INTERNALS *****/
|
||||
/***** *****/
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
/* hint types */
|
||||
typedef enum
|
||||
{
|
||||
PS_HINT_TYPE_1 = 1,
|
||||
PS_HINT_TYPE_2 = 2
|
||||
|
||||
} PS_Hint_Type;
|
||||
|
||||
/* handle to hint record */
|
||||
typedef struct PS_HintRec_* PS_Hint;
|
||||
|
||||
/* hint flags */
|
||||
/* hint types */
|
||||
typedef enum
|
||||
{
|
||||
PS_HINT_TYPE_1 = 1,
|
||||
PS_HINT_TYPE_2 = 2
|
||||
|
||||
} PS_Hint_Type;
|
||||
|
||||
|
||||
/* hint flags */
|
||||
typedef enum
|
||||
{
|
||||
PS_HINT_FLAG_GHOST = 1,
|
||||
@ -61,54 +69,54 @@ FT_BEGIN_HEADER
|
||||
} PS_Hint_Flags;
|
||||
|
||||
|
||||
/* hint descriptor */
|
||||
typedef struct PS_HintRec_
|
||||
/* hint descriptor */
|
||||
typedef struct PS_HintRec_
|
||||
{
|
||||
FT_Int pos;
|
||||
FT_Int len;
|
||||
FT_UInt flags;
|
||||
FT_Int pos;
|
||||
FT_Int len;
|
||||
FT_UInt flags;
|
||||
|
||||
} PS_HintRec;
|
||||
|
||||
|
||||
#define ps_hint_is_active(x) ((x)->flags & PS_HINT_FLAG_ACTIVE)
|
||||
#define ps_hint_is_ghost(x) ((x)->flags & PS_HINT_FLAG_GHOST)
|
||||
#define ps_hint_is_bottom(x) ((x)->flags & PS_HINT_FLAG_BOTTOM)
|
||||
#define ps_hint_is_active( x ) ( (x)->flags & PS_HINT_FLAG_ACTIVE )
|
||||
#define ps_hint_is_ghost( x ) ( (x)->flags & PS_HINT_FLAG_GHOST )
|
||||
#define ps_hint_is_bottom( x ) ( (x)->flags & PS_HINT_FLAG_BOTTOM )
|
||||
|
||||
|
||||
/* hints table descriptor */
|
||||
typedef struct PS_Hint_TableRec_
|
||||
/* hints table descriptor */
|
||||
typedef struct PS_Hint_TableRec_
|
||||
{
|
||||
FT_UInt num_hints;
|
||||
FT_UInt max_hints;
|
||||
PS_Hint hints;
|
||||
FT_UInt num_hints;
|
||||
FT_UInt max_hints;
|
||||
PS_Hint hints;
|
||||
|
||||
} PS_Hint_TableRec, *PS_Hint_Table;
|
||||
|
||||
|
||||
/* hint and counter mask descriptor */
|
||||
typedef struct PS_MaskRec_
|
||||
/* hint and counter mask descriptor */
|
||||
typedef struct PS_MaskRec_
|
||||
{
|
||||
FT_UInt num_bits;
|
||||
FT_UInt max_bits;
|
||||
FT_Byte* bytes;
|
||||
FT_UInt end_point;
|
||||
FT_UInt num_bits;
|
||||
FT_UInt max_bits;
|
||||
FT_Byte* bytes;
|
||||
FT_UInt end_point;
|
||||
|
||||
} PS_MaskRec, *PS_Mask;
|
||||
|
||||
|
||||
/* masks and counters table descriptor */
|
||||
typedef struct PS_Mask_TableRec_
|
||||
/* masks and counters table descriptor */
|
||||
typedef struct PS_Mask_TableRec_
|
||||
{
|
||||
FT_UInt num_masks;
|
||||
FT_UInt max_masks;
|
||||
PS_Mask masks;
|
||||
FT_UInt num_masks;
|
||||
FT_UInt max_masks;
|
||||
PS_Mask masks;
|
||||
|
||||
} PS_Mask_TableRec, *PS_Mask_Table;
|
||||
|
||||
|
||||
/* dimension-specific hints descriptor */
|
||||
typedef struct PS_DimensionRec_
|
||||
typedef struct PS_DimensionRec_
|
||||
{
|
||||
PS_Hint_TableRec hints;
|
||||
PS_Mask_TableRec masks;
|
||||
@ -117,49 +125,54 @@ FT_BEGIN_HEADER
|
||||
} PS_DimensionRec, *PS_Dimension;
|
||||
|
||||
|
||||
/* magic value used within PS_HintsRec */
|
||||
/* magic value used within PS_HintsRec */
|
||||
#define PS_HINTS_MAGIC 0x68696e74 /* "hint" */
|
||||
|
||||
|
||||
/* glyph hints descriptor */
|
||||
typedef struct PS_HintsRec_
|
||||
/* glyph hints descriptor */
|
||||
typedef struct PS_HintsRec_
|
||||
{
|
||||
FT_Memory memory;
|
||||
FT_Error error;
|
||||
FT_UInt32 magic;
|
||||
PS_Hint_Type hint_type;
|
||||
PS_DimensionRec dimension[2];
|
||||
FT_Memory memory;
|
||||
FT_Error error;
|
||||
FT_UInt32 magic;
|
||||
PS_Hint_Type hint_type;
|
||||
PS_DimensionRec dimension[2];
|
||||
|
||||
} PS_HintsRec, *PS_Hints;
|
||||
|
||||
/* */
|
||||
/* */
|
||||
|
||||
/* initialise hints recorder */
|
||||
/* initialize hints recorder */
|
||||
FT_LOCAL FT_Error
|
||||
ps_hints_init( PS_Hints hints,
|
||||
FT_Memory memory );
|
||||
|
||||
/* finalize hints recorder */
|
||||
/* finalize hints recorder */
|
||||
FT_LOCAL void
|
||||
ps_hints_done( PS_Hints hints );
|
||||
|
||||
/* initialise Type1 hints recorder interface */
|
||||
/* initialize Type1 hints recorder interface */
|
||||
FT_LOCAL void
|
||||
t1_hints_funcs_init( T1_Hints_FuncsRec* funcs );
|
||||
|
||||
/* initialise Type2 hints recorder interface */
|
||||
|
||||
/* initialize Type2 hints recorder interface */
|
||||
FT_LOCAL void
|
||||
t2_hints_funcs_init( T2_Hints_FuncsRec* funcs );
|
||||
|
||||
|
||||
#ifdef DEBUG_HINTER
|
||||
extern PS_Hints ps_debug_hints;
|
||||
extern int ps_debug_no_horz_hints;
|
||||
extern int ps_debug_no_vert_hints;
|
||||
extern PS_Hints ps_debug_hints;
|
||||
extern int ps_debug_no_horz_hints;
|
||||
extern int ps_debug_no_vert_hints;
|
||||
#endif
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
|
||||
#endif /* __PS_HINTER_RECORD_H__ */
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
|
||||
|
||||
# Copyright 1996-2001 by
|
||||
# Copyright 2001 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
@ -31,14 +31,13 @@ PSHINTER_DRV_SRC := $(PSHINTER_DIR_)pshrec.c \
|
||||
$(PSHINTER_DIR_)pshmod.c \
|
||||
$(PSHINTER_DIR_)pshalgo1.c \
|
||||
$(PSHINTER_DIR_)pshalgo2.c
|
||||
|
||||
|
||||
|
||||
# PSHINTER driver headers
|
||||
#
|
||||
PSHINTER_DRV_H := $(PSHINTER_DRV_SRC:%c=%h)
|
||||
|
||||
|
||||
|
||||
# PSHINTER driver object(s)
|
||||
#
|
||||
# PSHINTER_DRV_OBJ_M is used during `multi' builds.
|
||||
@ -55,7 +54,7 @@ PSHINTER_DRV_SRC_S := $(PSHINTER_DIR_)pshinter.c
|
||||
# PSHINTER driver - single object
|
||||
#
|
||||
$(PSHINTER_DRV_OBJ_S): $(PSHINTER_DRV_SRC_S) $(PSHINTER_DRV_SRC) \
|
||||
$(FREETYPE_H) $(PSHINTER_DRV_H)
|
||||
$(FREETYPE_H) $(PSHINTER_DRV_H)
|
||||
$(PSHINTER_COMPILE) $T$@ $(PSHINTER_DRV_SRC_S)
|
||||
|
||||
|
||||
|
@ -66,8 +66,8 @@
|
||||
|
||||
for ( count = 4; count > 0; count--, p++ )
|
||||
{
|
||||
char c = *p;
|
||||
unsigned int d;
|
||||
char c = *p;
|
||||
unsigned int d;
|
||||
|
||||
|
||||
d = (unsigned char)c - '0';
|
||||
@ -290,7 +290,7 @@
|
||||
const FT_Module_Class psnames_module_class =
|
||||
{
|
||||
0, /* this is not a font driver, nor a renderer */
|
||||
sizeof( FT_ModuleRec ),
|
||||
sizeof ( FT_ModuleRec ),
|
||||
|
||||
"psnames", /* driver name */
|
||||
0x10000L, /* driver version */
|
||||
|
@ -105,10 +105,6 @@
|
||||
/*************************************************************************/
|
||||
/*************************************************************************/
|
||||
|
||||
#ifdef MEM_Set
|
||||
# define MEM_Set(d,s,c) memset(d,s,c)
|
||||
#endif
|
||||
|
||||
/* define DEBUG_RASTER if you want to compile a debugging version */
|
||||
#define xxxDEBUG_RASTER
|
||||
|
||||
@ -190,6 +186,11 @@
|
||||
#endif /* _STANDALONE_ */
|
||||
|
||||
|
||||
#ifndef MEM_Set
|
||||
#define MEM_Set( d, s, c ) memset( d, s, c )
|
||||
#endif
|
||||
|
||||
|
||||
/* FMulDiv means `Fast MulDiv'; it is used in case where `b' is */
|
||||
/* typically a small value and the result of a*b is known to fit into */
|
||||
/* 32 bits. */
|
||||
|
@ -116,7 +116,8 @@
|
||||
{
|
||||
FT_Int n;
|
||||
|
||||
/* shouldn't happen, but just in case to avoid memory leaks */
|
||||
|
||||
/* shouldn't happen, but just in case to avoid memory leaks */
|
||||
if ( face->root.internal->postscript_name )
|
||||
return face->root.internal->postscript_name;
|
||||
|
||||
@ -125,34 +126,36 @@
|
||||
for ( n = 0; n < face->num_names; n++ )
|
||||
{
|
||||
TT_NameRec* name = face->name_table.names + n;
|
||||
|
||||
|
||||
|
||||
if ( name->nameID == 6 )
|
||||
{
|
||||
if ( ( name->platformID == 3 &&
|
||||
name->encodingID == 1 &&
|
||||
name->languageID == 0x409 ) ||
|
||||
|
||||
|
||||
( name->platformID == 1 &&
|
||||
name->encodingID == 0 &&
|
||||
name->languageID == 0 ) )
|
||||
{
|
||||
FT_UInt len = name->stringLength;
|
||||
FT_Error error;
|
||||
FT_Memory memory = face->root.memory;
|
||||
FT_String* result;
|
||||
|
||||
if ( !ALLOC( result, len+1 ) )
|
||||
FT_UInt len = name->stringLength;
|
||||
FT_Error error;
|
||||
FT_Memory memory = face->root.memory;
|
||||
FT_String* result;
|
||||
|
||||
|
||||
if ( !ALLOC( result, len + 1 ) )
|
||||
{
|
||||
memcpy( result, name->string, len );
|
||||
result[len] = '\0';
|
||||
|
||||
|
||||
face->root.internal->postscript_name = result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,8 @@
|
||||
|
||||
|
||||
/* experimental support for gamma correction within the rasterizer */
|
||||
#define xxxGRAYS_USE_GAMMA
|
||||
#define xxxGRAYS_USE_GAMMA
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
@ -144,8 +145,8 @@
|
||||
#endif /* _STANDALONE_ */
|
||||
|
||||
|
||||
#ifndef MEM_Set
|
||||
# define MEM_Set(d,s,c) memset(d,s,c)
|
||||
#ifndef MEM_Set
|
||||
#define MEM_Set( d, s, c ) memset( d, s, c )
|
||||
#endif
|
||||
|
||||
/* define this to dump debugging information */
|
||||
@ -309,8 +310,8 @@
|
||||
void* memory;
|
||||
jmp_buf jump_buffer;
|
||||
|
||||
#ifdef GRAYS_USE_GAMMA
|
||||
FT_Byte gamma[257];
|
||||
#ifdef GRAYS_USE_GAMMA
|
||||
FT_Byte gamma[257];
|
||||
#endif
|
||||
|
||||
} TRaster, *PRaster;
|
||||
@ -1240,6 +1241,7 @@
|
||||
{
|
||||
FT_UInt coverage = spans->coverage;
|
||||
|
||||
|
||||
#ifdef GRAYS_USE_GAMMA
|
||||
coverage = raster->gamma[(FT_Byte)coverage];
|
||||
#endif
|
||||
@ -1974,26 +1976,28 @@
|
||||
/**** RASTER OBJECT CREATION: In standalone mode, we simply use *****/
|
||||
/**** a static object. *****/
|
||||
|
||||
#ifdef GRAYS_USE_GAMMA
|
||||
#ifdef GRAYS_USE_GAMMA
|
||||
|
||||
/* initialize the "gamma" table. Yes, this is really a crummy function */
|
||||
/* but the results look pretty good for something that simple.. */
|
||||
/* but the results look pretty good for something that simple. */
|
||||
/* */
|
||||
#define M_MAX 255
|
||||
#define M_X 128
|
||||
#define M_Y 96
|
||||
#define M_MAX 255
|
||||
#define M_X 128
|
||||
#define M_Y 192
|
||||
|
||||
static void
|
||||
grays_init_gamma( PRaster raster )
|
||||
{
|
||||
FT_UInt x, a;
|
||||
|
||||
|
||||
for ( x = 0; x < 256; x++ )
|
||||
{
|
||||
if ( x <= M_X )
|
||||
a = (x * M_Y + (M_X/2)) / M_X;
|
||||
a = ( x * M_Y + M_X / 2) / M_X;
|
||||
else
|
||||
a = M_Y + ((x-M_X)*(M_MAX-M_Y) + (M_MAX-M_X)/2)/(M_MAX-M_X);
|
||||
a = M_Y + ( ( x - M_X ) * ( M_MAX - M_Y ) +
|
||||
( M_MAX - M_X ) / 2 ) / ( M_MAX - M_X );
|
||||
|
||||
raster->gamma[x] = (FT_Byte)a;
|
||||
}
|
||||
|
@ -1527,7 +1527,7 @@ def dump_mac_indices( file, all_glyphs ):
|
||||
write( " {\n" )
|
||||
|
||||
for name in mac_standard_names:
|
||||
write( " " + repr( all_glyphs.index(name) ) + ",\n" )
|
||||
write( " " + repr( all_glyphs.index( name ) ) + ",\n" )
|
||||
|
||||
write( " 0\n" )
|
||||
write( " };\n" )
|
||||
@ -1634,22 +1634,24 @@ def main():
|
||||
|
||||
count_sid = len( sid_standard_names )
|
||||
|
||||
# mac_extras contains the list of glyph names in the Macintosh standard
|
||||
# encoding which are not in either the Adobe Glyph List or the SID Standard Names
|
||||
# 'mac_extras' contains the list of glyph names in the Macintosh standard
|
||||
# encoding which are not in either the Adobe Glyph List or the SID
|
||||
# Standard Names.
|
||||
#
|
||||
mac_extras = filter_glyph_names( mac_standard_names, adobe_glyph_names() )
|
||||
mac_extras = filter_glyph_names( mac_extras, sid_standard_names )
|
||||
|
||||
# base_list contains the first names of our final glyph names table. It consists
|
||||
# of the "mac_extras" glyph names, followed by the SID Standard names
|
||||
# 'base_list' contains the first names of our final glyph names table.
|
||||
# It consists of the 'mac_extras' glyph names, followed by the SID
|
||||
# Standard names.
|
||||
#
|
||||
mac_extras_count = len( mac_extras )
|
||||
t1_bias = mac_extras_count
|
||||
base_list = mac_extras + sid_standard_names
|
||||
|
||||
# adobe_list contains the glyph names that are in the AGL, but no in
|
||||
# the base_list, they will be placed after base_list glyph names in
|
||||
# our final table..
|
||||
# 'adobe_list' contains the glyph names that are in the AGL, but not in
|
||||
# the base_list; they will be placed after base_list glyph names in
|
||||
# our final table.
|
||||
#
|
||||
adobe_list = filter_glyph_names( adobe_glyph_names(), base_list )
|
||||
adobe_count = len( adobe_list )
|
||||
|
@ -173,7 +173,7 @@
|
||||
(FT_GlyphSlot)glyph,
|
||||
(FT_Byte**)type1->glyph_names,
|
||||
face->blend,
|
||||
FT_BOOL(hinting),
|
||||
FT_BOOL( hinting ),
|
||||
T1_Parse_Glyph );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
@ -241,9 +241,9 @@
|
||||
if ( size && size->root.metrics.y_ppem < 24 )
|
||||
glyph->root.outline.flags |= ft_outline_high_precision;
|
||||
|
||||
/* XXXX: the following needs serious work to work properly with hinting !! */
|
||||
/* XXX: the following needs serious work to work properly with hinting! */
|
||||
#if 0
|
||||
/* apply the font matrix, if any.. */
|
||||
/* apply the font matrix, if any */
|
||||
FT_Outline_Transform( &glyph->root.outline, &font_matrix );
|
||||
|
||||
FT_Outline_Translate( &glyph->root.outline,
|
||||
@ -261,7 +261,7 @@
|
||||
FT_Fixed y_scale = glyph->y_scale;
|
||||
|
||||
|
||||
/* First of all, scale the points, fi we're not hinting */
|
||||
/* First of all, scale the points, if we are not hinting */
|
||||
if ( !hinting )
|
||||
for ( n = cur->n_points; n > 0; n--, vec++ )
|
||||
{
|
||||
|
@ -827,6 +827,7 @@
|
||||
FT_Byte* cur2;
|
||||
FT_Byte* limit;
|
||||
|
||||
|
||||
if ( face->type1.font_name )
|
||||
/* with synthetic fonts, it's possible we get here twice */
|
||||
return;
|
||||
@ -959,6 +960,7 @@
|
||||
FT_Memory memory = parser->root.memory;
|
||||
FT_Error error;
|
||||
|
||||
|
||||
if ( encode->char_index )
|
||||
/* with synthetic fonts, it's possible we get here twice */
|
||||
return;
|
||||
@ -1101,6 +1103,7 @@
|
||||
|
||||
PSAux_Interface* psaux = (PSAux_Interface*)face->psaux;
|
||||
|
||||
|
||||
if ( loader->num_subrs )
|
||||
/* with synthetic fonts, it's possible we get here twice */
|
||||
return;
|
||||
|
@ -47,13 +47,14 @@
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* SIZE FUNCTIONS */
|
||||
/* SIZE FUNCTIONS */
|
||||
/* */
|
||||
/* note that we store the global hints in the size's "internal" root */
|
||||
/* field.. */
|
||||
/* field */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
|
||||
|
||||
static PSH_Globals_Funcs
|
||||
T1_Size_Get_Globals_Funcs( T1_Size size )
|
||||
{
|
||||
@ -61,60 +62,64 @@
|
||||
PSHinter_Interface* pshinter = face->pshinter;
|
||||
FT_Module module;
|
||||
|
||||
module = FT_Get_Module( size->root.face->driver->root.library, "pshinter" );
|
||||
|
||||
module = FT_Get_Module( size->root.face->driver->root.library,
|
||||
"pshinter" );
|
||||
return ( module && pshinter && pshinter->get_globals_funcs )
|
||||
? pshinter->get_globals_funcs( module )
|
||||
: 0 ;
|
||||
}
|
||||
|
||||
|
||||
FT_LOCAL_DEF
|
||||
void T1_Size_Done( T1_Size size )
|
||||
FT_LOCAL_DEF void
|
||||
T1_Size_Done( T1_Size size )
|
||||
{
|
||||
if ( size->root.internal )
|
||||
{
|
||||
PSH_Globals_Funcs funcs;
|
||||
PSH_Globals_Funcs funcs;
|
||||
|
||||
funcs = T1_Size_Get_Globals_Funcs(size);
|
||||
if (funcs)
|
||||
funcs->destroy( (PSH_Globals) size->root.internal );
|
||||
|
||||
funcs = T1_Size_Get_Globals_Funcs( size );
|
||||
if ( funcs )
|
||||
funcs->destroy( (PSH_Globals)size->root.internal );
|
||||
|
||||
size->root.internal = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
FT_LOCAL_DEF
|
||||
FT_Error T1_Size_Init( T1_Size size )
|
||||
FT_LOCAL_DEF FT_Error
|
||||
T1_Size_Init( T1_Size size )
|
||||
{
|
||||
FT_Error error = 0;
|
||||
PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs( size );
|
||||
|
||||
|
||||
if ( funcs )
|
||||
{
|
||||
PSH_Globals globals;
|
||||
T1_Face face = (T1_Face) size->root.face;
|
||||
PSH_Globals globals;
|
||||
T1_Face face = (T1_Face)size->root.face;
|
||||
|
||||
|
||||
error = funcs->create( size->root.face->memory,
|
||||
&face->type1.private_dict, &globals );
|
||||
if (!error)
|
||||
size->root.internal = (FT_Size_Internal)(void*) globals;
|
||||
if ( !error )
|
||||
size->root.internal = (FT_Size_Internal)(void*)globals;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
|
||||
FT_LOCAL_DEF
|
||||
FT_Error T1_Size_Reset( T1_Size size )
|
||||
FT_LOCAL_DEF FT_Error
|
||||
T1_Size_Reset( T1_Size size )
|
||||
{
|
||||
PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs(size);
|
||||
PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs( size );
|
||||
FT_Error error = 0;
|
||||
|
||||
|
||||
if (funcs)
|
||||
error = funcs->set_scale( (PSH_Globals) size->root.internal,
|
||||
if ( funcs )
|
||||
error = funcs->set_scale( (PSH_Globals)size->root.internal,
|
||||
size->root.metrics.x_scale,
|
||||
size->root.metrics.y_scale,
|
||||
0, 0 );
|
||||
@ -178,8 +183,8 @@
|
||||
/* <Input> */
|
||||
/* face :: A typeless pointer to the face object to destroy. */
|
||||
/* */
|
||||
FT_LOCAL_DEF
|
||||
void T1_Face_Done( T1_Face face )
|
||||
FT_LOCAL_DEF void
|
||||
T1_Face_Done( T1_Face face )
|
||||
{
|
||||
FT_Memory memory;
|
||||
T1_Font* type1 = &face->type1;
|
||||
@ -239,7 +244,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
|
@ -105,14 +105,15 @@ FT_BEGIN_HEADER
|
||||
} T1_SizeRec;
|
||||
|
||||
|
||||
FT_LOCAL
|
||||
void T1_Size_Done( T1_Size size );
|
||||
FT_LOCAL void
|
||||
T1_Size_Done( T1_Size size );
|
||||
|
||||
FT_LOCAL
|
||||
FT_Error T1_Size_Reset( T1_Size size );
|
||||
FT_LOCAL FT_Error
|
||||
T1_Size_Reset( T1_Size size );
|
||||
|
||||
FT_LOCAL FT_Error
|
||||
T1_Size_Init( T1_Size size );
|
||||
|
||||
FT_LOCAL
|
||||
FT_Error T1_Size_Init( T1_Size size );
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
@ -148,12 +149,6 @@ FT_BEGIN_HEADER
|
||||
FT_LOCAL void
|
||||
T1_Face_Done( T1_Face face );
|
||||
|
||||
FT_LOCAL FT_Error
|
||||
T1_Size_Init( T1_Size size );
|
||||
|
||||
FT_LOCAL void
|
||||
T1_Size_Done( T1_Size size );
|
||||
|
||||
FT_LOCAL FT_Error
|
||||
T1_GlyphSlot_Init( T1_GlyphSlot slot );
|
||||
|
||||
|
@ -1,10 +1,13 @@
|
||||
SubDir FT2_TOP tests ;
|
||||
# FreeType 2 src Jamfile (c) 2001 David Turner
|
||||
#
|
||||
|
||||
SubDir FT2_TOP tests ;
|
||||
|
||||
test_programs = gview ;
|
||||
|
||||
SubDirHdrs [ FT2_SubDir .. nirvana include ] ;
|
||||
SubDirHdrs [ FT2_SubDir .. nirvana include ] ;
|
||||
|
||||
NV_TOP = [ FT2_SubDir .. .. nirvana ] ;
|
||||
NV_TOP = [ FT2_SubDir .. .. nirvana ] ;
|
||||
|
||||
NIRVANA_LINKLIBS = $(NV_TOP)\\objs\\nirvana$(SUFLIB) ;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user