forked from minhngoc25a/freetype2
Formatting.
* src/truetype/ttpload.c (tt_face_load_loca): Fix typo. * src/sfnt/ttkern.c: Include `ttkern.h'. (FT_COMPONENT): Updated. * include/freetype/internal/fttrace.h: Add entry for `ttkern'. * src/sfnt/ttsbit0.c: s/FT_Err_/SFNT_Err_/. Decorate constants with `U' and `L' where necessary. * src/sfnt/ttcmap.c (tt_cmap4_next): Remove unused variable.
This commit is contained in:
parent
7305f62767
commit
e793092d0a
209
ChangeLog
209
ChangeLog
|
@ -1,45 +1,163 @@
|
||||||
|
2005-02-28 Werner Lemberg <wl@gnu.org>
|
||||||
|
|
||||||
|
* src/truetype/ttpload.c (tt_face_load_loca): Fix typo.
|
||||||
|
|
||||||
|
* src/sfnt/ttkern.c: Include `ttkern.h'.
|
||||||
|
(FT_COMPONENT): Updated.
|
||||||
|
|
||||||
|
* include/freetype/internal/fttrace.h: Add entry for `ttkern'.
|
||||||
|
|
||||||
|
* src/sfnt/ttsbit0.c: s/FT_Err_/SFNT_Err_/.
|
||||||
|
Decorate constants with `U' and `L' where necessary.
|
||||||
|
|
||||||
|
* src/sfnt/ttcmap.c (tt_cmap4_next): Remove unused variable.
|
||||||
|
|
||||||
2005-02-28 David Turner <david@freetype.org>
|
2005-02-28 David Turner <david@freetype.org>
|
||||||
|
|
||||||
* src/base/ftdbgmem.c (FT_DumpMemory): added sorting of memory sources
|
* src/base/ftdbgmem.c (FT_DumpMemory): Added sorting of memory
|
||||||
according to decreasing maximum cumulative allocations.
|
sources according to decreasing maximum cumulative allocations.
|
||||||
|
(ft_mem_source_compare): New auxiliary function.
|
||||||
|
|
||||||
* include/freetype/internal/tttypes.h, src/sfnt/ttsbit.c, src/sfnt/ttsbit0.c,
|
* src/sfnt/ttsbit0.c: New file, implementing a heap-optimized
|
||||||
src/truetype/ttobjs.c, src/cff/cffobjs.c, src/sfnt/sfobjs.c: implementing new
|
embedded bitmap loader.
|
||||||
heap-optimized embedded bitmap loader. This one also fixes bug #12107
|
|
||||||
|
|
||||||
* src/sfnt/sfobjs.c: fixed bug that prevented loading SFNT fonts without
|
* src/sfnt/ttsbit.c: Include `ft2build.h', FT_INTERNAL_DEBUG_H,
|
||||||
a 'kern' table.
|
FT_INTERNAL_STREAM_H, FT_TRUETYPE_TAGS_H.
|
||||||
|
Load `ttsbit0.c' if FT_OPTIMIZE_MEMORY is set, otherwise use
|
||||||
|
file contents.
|
||||||
|
(tt_face_load_sbit_strikes): Set up root fields to indicate the
|
||||||
|
strikes. This fixes Savannah bug #12107.
|
||||||
|
Use `static' keyword for `sbit_line_metrics_field',
|
||||||
|
`strike_start_fields', `strike_end_fields'.
|
||||||
|
|
||||||
|
* include/freetype/internal/tttypes.h (TT_FaceRec): Define
|
||||||
|
`sbit_table', `sbit_table_size', `sbit_num_strikes' if
|
||||||
|
FT_OPTIMIZE_MEMORY is set.
|
||||||
|
Don't define `num_sbit_strikes' and `sbit_strikes' if
|
||||||
|
FT_OPTIMIZE_MEMORY is set.
|
||||||
|
|
||||||
|
* src/cff/cffobjs.c (sbit_size_reset): Handle FT_OPTIMIZE_MEMORY.
|
||||||
|
|
||||||
|
* src/sfnt/sfobjs.c (sfnt_load_face): Fixed bug that prevented
|
||||||
|
loading SFNT fonts without a `kern' table.
|
||||||
|
Properly pass root->face_flags.
|
||||||
|
Remove code for TT_CONFIG_OPTION_EMBEDDED_BITMAPS.
|
||||||
|
|
||||||
|
* src/sfnt/sfdriver.c (sfnt_interface)
|
||||||
|
[TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: Don't use `tt_find_sbit_image'
|
||||||
|
and `tt_load_sbit_metrics'.
|
||||||
|
|
||||||
|
* src/sfnt/ttcmap.c: Optimize linear charmap scanning for Format 4.
|
||||||
|
(OPT_CMAP4): New macro.
|
||||||
|
(TT_CMap4Rec) [OPT_CMAP4]: New structure.
|
||||||
|
(tt_cmap4_init, tt_cmap4_set_range, tt_cmap4_next, tt_cmap4_reset)
|
||||||
|
[OPT_CMAP4]: New functions.
|
||||||
|
(tt_cmap4_char_next) [OPT_CMAP4]: Use `tt_cmap4_next' and
|
||||||
|
`tt_cmap4_reset'.
|
||||||
|
(tt_cmap4_class_rec) [OPT_CMAP4]: Use `TT_CMap4Rec' and
|
||||||
|
`tt_cmap4_init'.
|
||||||
|
|
||||||
|
* src/truetype/ttobjs.c (Reset_SBit_Size): Handle
|
||||||
|
FT_OPTIMIZE_MEMORY.
|
||||||
|
|
||||||
|
* src/autofit/afhints.h (AF_PointRec, AF_SegmentRec, AF_EdgeRec):
|
||||||
|
Optimize member types.
|
||||||
|
|
||||||
|
* src/autofit/afloader.c (af_loader_done): Call
|
||||||
|
`af_glyph_hints_done'.
|
||||||
|
|
||||||
2005-02-27 David Turner <david@freetype.org>
|
2005-02-27 David Turner <david@freetype.org>
|
||||||
|
|
||||||
* src/sfnt/ttkern.c (tt_face_load_kern): fixing a small bug which returned
|
* src/sfnt/ttkern.c (tt_face_load_kern): Fix a small bug which
|
||||||
invalid (random) values for the horizontal kerning
|
caused invalid (random) return values for the horizontal kerning.
|
||||||
|
|
||||||
2005-02-25 David Turner <david@freetype.org>
|
2005-02-25 David Turner <david@freetype.org>
|
||||||
|
|
||||||
* many, many files: several memory optimizations were implemented to
|
Implement several memory optimizations to drastically reduce the
|
||||||
drastically reduce the heap usage of FreeType, especially in the case
|
heap usage of FreeType, especially in the case of memory-mapped
|
||||||
of memory-mapped files. The idea is to avoid loading and decoding tables
|
files. The idea is to avoid loading and decoding tables in the
|
||||||
in the heap, and instead access the raw data whenever possible (i.e.
|
heap, and instead access the raw data whenever possible (i.e., when
|
||||||
when it doesn't compromise performance).
|
it doesn't compromise performance).
|
||||||
|
|
||||||
This had several impacts: first, opening vera.ttf uses a ridiculous amount
|
This has several benefits: For example, opening vera.ttf now uses
|
||||||
of memory (when the FT_Library footprint is accounted for), until you start
|
just a small amount of memory (even when the FT_Library footprint is
|
||||||
loading glyphs. Even then, you'll save at least 20 Kb compared to the non
|
accounted for), until you start loading glyphs. Even then, you save
|
||||||
optimized case. performance of various operations, including open/close
|
at least 20KB compared to the non-optimized case. Performance of
|
||||||
has also been dramatically improved.
|
various operations, including open and close, has also been
|
||||||
|
dramatically improved.
|
||||||
|
|
||||||
More optimisations to come. The auto-hinter eats memory like crazy? This
|
More optimizations to come, especially for the auto-hinter.
|
||||||
must be stopped...
|
|
||||||
|
* include/freetype/internal/sfnt.h (TT_Face_GetKerningFunc): New
|
||||||
|
function type.
|
||||||
|
(SFNT_Interface): Add it.
|
||||||
|
|
||||||
|
* include/freetype/internal/tttypes.h (TT_HdmxEntryRec, TT_HdmxRec,
|
||||||
|
TT_Kern0_PairRec): Don't define if FT_OPTIMIZE_MEMORY is set.
|
||||||
|
(TT_FaceRec): Define `horz_metrics', `horz_metrics_size',
|
||||||
|
`vert_metrics', `vert_metrics_size', `hdmx_table',
|
||||||
|
`hdmx_table_size', `hdmx_record_count', `hdmx_record_size',
|
||||||
|
`hdmx_record_sizes', `kern_table', `kern_table_size,
|
||||||
|
`num_kern_tables', `kern_avail_bits', `kern_order_bits' if
|
||||||
|
FT_OPTIMIZE_MEMORY is set.
|
||||||
|
Don't define `hdmx', `num_kern_pairs', `kern_table_index',
|
||||||
|
`kern_pairs' if FT_OPTIMIZE_MEMORY is set.
|
||||||
|
|
||||||
|
* src/base/ftdbgmem.c (ft_mem_table_set): Don't shadow variable.
|
||||||
|
Fix compiler warning.
|
||||||
|
|
||||||
|
* src/cff/cffdrivr.c (Get_Kerning): Renamed to...
|
||||||
|
(cff_get_kerning): This. Simplify.
|
||||||
|
(cff_driver_class): Updated.
|
||||||
|
|
||||||
|
* src/sfnt/Jamfile (_sources): Add `ttkern'.
|
||||||
|
* src/sfnt/rules.mk (SFNT_DRV_SRC): Add `ttkern.c'.
|
||||||
|
|
||||||
|
* src/sfnt/sfdriver.c (sfnt_interface): Add `tt_face_get_kerning'.
|
||||||
|
|
||||||
|
* src/sfnt/sfnt.c: Include `ttkern.c'.
|
||||||
|
|
||||||
|
* src/sfnt/sfobjs.c: Include `ttkern.h'.
|
||||||
|
(sfnt_load_face): Consider the `kern' and `gasp' table as optional.
|
||||||
|
(sfnt_done_face): Call `tt_face_done_kern'.
|
||||||
|
Handle horizontal metrics for FT_OPTIMIZE_MEMORY.
|
||||||
|
|
||||||
|
* src/sfnt/ttkern.c, src/sfnt/ttkern.h: New files. Code has been
|
||||||
|
taken from `ttload.c' and `ttload.h'.
|
||||||
|
Provide special versions of `tt_face_load_kern',
|
||||||
|
`tt_face_get_kerning', and `tt_face_done_kern' for
|
||||||
|
FT_OPTIMIZE_MEMORY.
|
||||||
|
|
||||||
|
* src/sfnt/ttload.c (tt_face_load_metrics, tt_face_load_hdmx,
|
||||||
|
tt_face_free_hdmx): Provide version for FT_OPTIMIZE_MEMORY.
|
||||||
|
(tt_face_load_kern, tt_kern_pair_compare, TT_KERN_INDEX): Moved to
|
||||||
|
`ttkern.c'.
|
||||||
|
|
||||||
|
* src/sfnt/ttload.h: Updated.
|
||||||
|
|
||||||
|
* src/sfnt/ttsbit.c (sbit_metrics_field): Add `static' keyword.
|
||||||
|
|
||||||
|
* src/truetype/ttdriver.c (Get_Kerning): Renamed to...
|
||||||
|
(tt_get_kerning): This. Simplify.
|
||||||
|
(tt_driver_class): Updated.
|
||||||
|
|
||||||
|
* src/truetype/ttgload.c (TT_Get_Metrics): Renamed to...
|
||||||
|
(tt_face_get_metrics): This. Provide version for FT_OPTIMIZE_MEMORY.
|
||||||
|
Update all callers.
|
||||||
|
(Get_Advance_Widths): Replaced with...
|
||||||
|
(Get_Advance_WidthPtr): This. Provide version for
|
||||||
|
FT_OPTIMIZE_MEMORY.
|
||||||
|
Update all callers.
|
||||||
|
|
||||||
|
* src/truetype/ttgload.h: Updated.
|
||||||
|
|
||||||
2005-02-22 David Turner <david@freetype.org>
|
2005-02-22 David Turner <david@freetype.org>
|
||||||
|
|
||||||
* src/base/ftdbgmem.c: adding the ability to list all allocation sites
|
* src/base/ftdbgmem.c: Partly rewritten. Added the ability to list
|
||||||
in the memory debugger. Also a new function FT_DumpMemory() was added.
|
all allocation sites in the memory debugger. Also a new function
|
||||||
It is only available in builds with FT_DEBUG_MEMORY defined, and you
|
FT_DumpMemory() was added. It is only available in builds with
|
||||||
must declare it in your own code to use it, i.e. with something
|
FT_DEBUG_MEMORY defined, and you must declare it in your own code to
|
||||||
like:
|
use it, i.e., with something like:
|
||||||
|
|
||||||
extern void FT_DumpMemory( FT_Memory );
|
extern void FT_DumpMemory( FT_Memory );
|
||||||
|
|
||||||
|
@ -47,26 +165,39 @@
|
||||||
|
|
||||||
FT_DumpMemory( memory );
|
FT_DumpMemory( memory );
|
||||||
|
|
||||||
* include/freetype/config/ftoptions.h: disabling TrueType bytecode
|
* include/freetype/config/ftoption.h
|
||||||
interpreter !
|
(TT_CONFIG_OPTION_BYTECODE_INTERPRETER): Comment out definition --
|
||||||
|
again.
|
||||||
|
(FT_OPTIMIZE_MEMORY): New configuration macro to control various
|
||||||
|
optimizations for reducing the heap footprint of memory-mapped
|
||||||
|
TrueType files.
|
||||||
|
|
||||||
* include/freetype/internal/ftmemory.h: adding FT_ARRAY_ZERO, as a
|
* include/freetype/internal/ftmemory.h (FT_ARRAY_ZERO): New
|
||||||
convenience macro.
|
convenience macro.
|
||||||
|
|
||||||
* include/freetype/config/ftoption.h, include/freetype/internal/ttypes.h,
|
* include/freetype/internal/tttypes.h (TT_FaceRec)
|
||||||
src/truetype/ttpload.c, src/truetype/ttpload.h, src/truetype/ttgload.c:
|
[FT_OPTIMIZE_MEMORY]: Use optimized types for `num_locations' and
|
||||||
added the temporary configuration FT_OPTIMIZE_MEMORY to control various
|
`glyph_locations'.
|
||||||
optimizations used to reduce the heap footprint of memory-mapped TrueType
|
|
||||||
files.
|
|
||||||
|
|
||||||
* src/truetype/ttpload.c (tt_face_load_loca, tt_face_get_location,
|
* src/truetype/ttgload.c (load_truetype_glyph): Call
|
||||||
tt_face_done_loca): when FT_OPTIMIZE_MEMORY is set, the locations table
|
`tt_face_get_location'.
|
||||||
is read directly from memory-mapped streams, instead of being decoded
|
|
||||||
|
* src/truetype/ttobjs.c (tt_face_init)
|
||||||
|
[FT_CONFIG_OPTION_INCREMENTAL]: Improve error handling.
|
||||||
|
(tt_face_done): Call `tt_face_done_loca'.
|
||||||
|
|
||||||
|
* src/truetype/ttpload.c (tt_face_get_location, tt_face_done_loca):
|
||||||
|
New functions. If FT_OPTIMIZE_MEMORY is set, the locations table is
|
||||||
|
read directly from memory-mapped streams, instead of being decoded
|
||||||
into the heap.
|
into the heap.
|
||||||
|
(tt_face_load_loca) [FT_OPTIMIZE_MEMORY]: New implementation.
|
||||||
* src/truetype/ttpload.c: only load the CVT and fpgm tables when the
|
(tt_face_load_cvt, tt_face_load_fpgm): Only load table if the
|
||||||
bytecode interpreter is compiled in.
|
bytecode interpreter is compiled in.
|
||||||
|
|
||||||
|
* src/truetype/ttpload.h: Updated.
|
||||||
|
|
||||||
|
* src/autohint/ahglyph.c (ah_outline_load): Improve allocation
|
||||||
|
logic.
|
||||||
|
|
||||||
2005-02-20 Werner Lemberg <wl@gnu.org>
|
2005-02-20 Werner Lemberg <wl@gnu.org>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* User-selectable configuration macros (specification only). */
|
/* User-selectable configuration macros (specification only). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002, 2003, 2004 by */
|
/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
@ -568,6 +568,11 @@ FT_BEGIN_HEADER
|
||||||
|
|
||||||
#endif /* FT_CONFIG_OPTION_CHESTER_HINTS */
|
#endif /* FT_CONFIG_OPTION_CHESTER_HINTS */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This temporary macro is used to control various optimizations for
|
||||||
|
* reducing the heap footprint of memory-mapped TrueType files.
|
||||||
|
*
|
||||||
|
*/
|
||||||
#define FT_OPTIMIZE_MEMORY
|
#define FT_OPTIMIZE_MEMORY
|
||||||
|
|
||||||
FT_END_HEADER
|
FT_END_HEADER
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* The FreeType memory management macros (specification). */
|
/* The FreeType memory management macros (specification). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002, 2004 by */
|
/* Copyright 1996-2001, 2002, 2004, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* Tracing handling (specification only). */
|
/* Tracing handling (specification only). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 2002, 2004 by */
|
/* Copyright 2002, 2004, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
@ -43,6 +43,7 @@ FT_TRACE_DEF( cache ) /* cache sub-system (ftcache.c, etc.) */
|
||||||
/* SFNT driver components */
|
/* SFNT driver components */
|
||||||
FT_TRACE_DEF( sfobjs ) /* SFNT object handler (sfobjs.c) */
|
FT_TRACE_DEF( sfobjs ) /* SFNT object handler (sfobjs.c) */
|
||||||
FT_TRACE_DEF( ttcmap ) /* charmap handler (ttcmap.c) */
|
FT_TRACE_DEF( ttcmap ) /* charmap handler (ttcmap.c) */
|
||||||
|
FT_TRACE_DEF( ttkern ) /* kerning handler (ttkern.c) */
|
||||||
FT_TRACE_DEF( ttload ) /* basic TrueType tables (ttload.c) */
|
FT_TRACE_DEF( ttload ) /* basic TrueType tables (ttload.c) */
|
||||||
FT_TRACE_DEF( ttpost ) /* PS table processing (ttpost.c) */
|
FT_TRACE_DEF( ttpost ) /* PS table processing (ttpost.c) */
|
||||||
FT_TRACE_DEF( ttsbit ) /* TrueType sbit handling (ttsbit.c) */
|
FT_TRACE_DEF( ttsbit ) /* TrueType sbit handling (ttsbit.c) */
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* High-level `sfnt' driver interface (specification). */
|
/* High-level `sfnt' driver interface (specification). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002, 2003, 2004 by */
|
/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
@ -477,25 +477,28 @@ FT_BEGIN_HEADER
|
||||||
typedef void
|
typedef void
|
||||||
(*TT_Free_Table_Func)( TT_Face face );
|
(*TT_Free_Table_Func)( TT_Face face );
|
||||||
|
|
||||||
/**
|
|
||||||
* @functype: TT_Face_GetKerningFunc
|
/*
|
||||||
|
* @functype:
|
||||||
|
* TT_Face_GetKerningFunc
|
||||||
*
|
*
|
||||||
* @description:
|
* @description:
|
||||||
* return the horizontal kerning value between two glyphs
|
* Return the horizontal kerning value between two glyphs.
|
||||||
*
|
*
|
||||||
* @input:
|
* @input:
|
||||||
* face :: handle to source face object
|
* face :: A handle to the source face object.
|
||||||
* left_glyph :: left glyph index
|
* left_glyph :: The left glyph index.
|
||||||
* right_glyph :: right glyph index
|
* right_glyph :: The right glyph index.
|
||||||
*
|
*
|
||||||
* @return:
|
* @return:
|
||||||
* kerning value in font units.
|
* The kerning value in font units.
|
||||||
*/
|
*/
|
||||||
typedef FT_Int
|
typedef FT_Int
|
||||||
(*TT_Face_GetKerningFunc)( TT_Face face,
|
(*TT_Face_GetKerningFunc)( TT_Face face,
|
||||||
FT_UInt left_glyph,
|
FT_UInt left_glyph,
|
||||||
FT_UInt right_glyph );
|
FT_UInt right_glyph );
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* <Struct> */
|
/* <Struct> */
|
||||||
|
@ -552,7 +555,7 @@ FT_BEGIN_HEADER
|
||||||
TT_Load_SBit_Image_Func load_sbit_image;
|
TT_Load_SBit_Image_Func load_sbit_image;
|
||||||
TT_Free_Table_Func free_sbits;
|
TT_Free_Table_Func free_sbits;
|
||||||
|
|
||||||
/* sett `ttkern.h' */
|
/* see `ttkern.h' */
|
||||||
TT_Face_GetKerningFunc get_kerning;
|
TT_Face_GetKerningFunc get_kerning;
|
||||||
|
|
||||||
/* see `ttpost.h' */
|
/* see `ttpost.h' */
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
/* Basic SFNT/TrueType type definitions and interface (specification */
|
/* Basic SFNT/TrueType type definitions and interface (specification */
|
||||||
/* only). */
|
/* only). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002, 2004 by */
|
/* Copyright 1996-2001, 2002, 2004, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
@ -310,7 +310,9 @@ FT_BEGIN_HEADER
|
||||||
|
|
||||||
} TT_GaspRec;
|
} TT_GaspRec;
|
||||||
|
|
||||||
|
|
||||||
#ifndef FT_OPTIMIZE_MEMORY
|
#ifndef FT_OPTIMIZE_MEMORY
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* <Struct> */
|
/* <Struct> */
|
||||||
|
@ -360,6 +362,7 @@ FT_BEGIN_HEADER
|
||||||
|
|
||||||
} TT_HdmxRec, *TT_Hdmx;
|
} TT_HdmxRec, *TT_Hdmx;
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* <Struct> */
|
/* <Struct> */
|
||||||
|
@ -385,6 +388,7 @@ FT_BEGIN_HEADER
|
||||||
FT_FWord value; /* kerning value */
|
FT_FWord value; /* kerning value */
|
||||||
|
|
||||||
} TT_Kern0_PairRec, *TT_Kern0_Pair;
|
} TT_Kern0_PairRec, *TT_Kern0_Pair;
|
||||||
|
|
||||||
#endif /* !OPTIMIZE_MEMORY */
|
#endif /* !OPTIMIZE_MEMORY */
|
||||||
|
|
||||||
|
|
||||||
|
@ -1285,11 +1289,11 @@ FT_BEGIN_HEADER
|
||||||
/* */
|
/* */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
|
/* the glyph locations */
|
||||||
#ifdef FT_OPTIMIZE_MEMORY
|
#ifdef FT_OPTIMIZE_MEMORY
|
||||||
FT_UInt num_locations;
|
FT_UInt num_locations;
|
||||||
FT_Byte* glyph_locations;
|
FT_Byte* glyph_locations;
|
||||||
#else
|
#else
|
||||||
/* the glyph locations */
|
|
||||||
FT_UShort num_locations;
|
FT_UShort num_locations;
|
||||||
FT_Long* glyph_locations;
|
FT_Long* glyph_locations;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
/* Routines used to load and analyze a given glyph before hinting */
|
/* Routines used to load and analyze a given glyph before hinting */
|
||||||
/* (body). */
|
/* (body). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 2000-2001, 2002, 2003, 2004 Catharon Productions Inc. */
|
/* Copyright 2000-2001, 2002, 2003, 2004, 2005 Catharon Productions Inc. */
|
||||||
/* Author: David Turner */
|
/* Author: David Turner */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the Catharon Typography Project and shall only */
|
/* This file is part of the Catharon Typography Project and shall only */
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* Memory debugger (body). */
|
/* Memory debugger (body). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 2001, 2002, 2003, 2004 by */
|
/* Copyright 2001, 2002, 2003, 2004, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
@ -27,24 +27,28 @@
|
||||||
|
|
||||||
#ifdef FT_DEBUG_MEMORY
|
#ifdef FT_DEBUG_MEMORY
|
||||||
|
|
||||||
#define KEEPALIVE /* keep-alive means that free-d blocks aren't released
|
#define KEEPALIVE /* `Keep alive' means that freed blocks aren't released
|
||||||
* to the heap. This is useful to detect double-frees
|
* to the heap. This is useful to detect double-frees
|
||||||
* or weird heap corruption, but it will use gobs of
|
* or weird heap corruption, but it uses large amounts of
|
||||||
* memory however.
|
* memory, however.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
FT_DumpMemory( FT_Memory memory );
|
FT_DumpMemory( FT_Memory memory );
|
||||||
|
|
||||||
|
|
||||||
typedef struct FT_MemSourceRec_* FT_MemSource;
|
typedef struct FT_MemSourceRec_* FT_MemSource;
|
||||||
typedef struct FT_MemNodeRec_* FT_MemNode;
|
typedef struct FT_MemNodeRec_* FT_MemNode;
|
||||||
typedef struct FT_MemTableRec_* FT_MemTable;
|
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_MemSourceRec_
|
typedef struct FT_MemSourceRec_
|
||||||
{
|
{
|
||||||
const char* file_name;
|
const char* file_name;
|
||||||
|
@ -65,7 +69,9 @@
|
||||||
|
|
||||||
} FT_MemSourceRec;
|
} FT_MemSourceRec;
|
||||||
|
|
||||||
/* we don't need a resizable array for the memory sources, because
|
|
||||||
|
/*
|
||||||
|
* We don't need a resizable array for the memory sources, because
|
||||||
* their number is pretty limited within FreeType.
|
* their number is pretty limited within FreeType.
|
||||||
*/
|
*/
|
||||||
#define FT_MEM_SOURCE_BUCKETS 128
|
#define FT_MEM_SOURCE_BUCKETS 128
|
||||||
|
@ -127,9 +133,9 @@
|
||||||
#define FT_FILENAME( x ) ((x) ? (x) : "unknown file")
|
#define FT_FILENAME( x ) ((x) ? (x) : "unknown file")
|
||||||
|
|
||||||
|
|
||||||
/* I hate these prime numbers. I'd better implement L-Hashing
|
/*
|
||||||
* which is 10% faster and doesn't require divisions, but
|
* Prime numbers are ugly to handle. It would be better to implement
|
||||||
* I'm too lazy at the moment.
|
* L-Hashing, which is 10% faster and doesn't require divisions.
|
||||||
*/
|
*/
|
||||||
static const FT_UInt ft_mem_primes[] =
|
static const FT_UInt ft_mem_primes[] =
|
||||||
{
|
{
|
||||||
|
@ -186,9 +192,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
ft_mem_debug_panic( const char* fmt, ... )
|
ft_mem_debug_panic( const char* fmt,
|
||||||
|
... )
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
@ -327,6 +333,7 @@
|
||||||
{
|
{
|
||||||
FT_ULong i;
|
FT_ULong i;
|
||||||
|
|
||||||
|
|
||||||
FT_DumpMemory( table->memory );
|
FT_DumpMemory( table->memory );
|
||||||
|
|
||||||
if ( table )
|
if ( table )
|
||||||
|
@ -334,8 +341,7 @@
|
||||||
FT_Long leak_count = 0;
|
FT_Long leak_count = 0;
|
||||||
FT_ULong leaks = 0;
|
FT_ULong leaks = 0;
|
||||||
|
|
||||||
/* remove all blocks from the table, revealing leaked ones
|
/* remove all blocks from the table, revealing leaked ones */
|
||||||
*/
|
|
||||||
for ( i = 0; i < table->size; i++ )
|
for ( i = 0; i < table->size; i++ )
|
||||||
{
|
{
|
||||||
FT_MemNode *pnode = table->buckets + i, next, node = *pnode;
|
FT_MemNode *pnode = table->buckets + i, next, node = *pnode;
|
||||||
|
@ -368,18 +374,19 @@
|
||||||
}
|
}
|
||||||
table->buckets[i] = 0;
|
table->buckets[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ft_mem_table_free( table, table->buckets );
|
ft_mem_table_free( table, table->buckets );
|
||||||
table->buckets = NULL;
|
table->buckets = NULL;
|
||||||
|
|
||||||
table->size = 0;
|
table->size = 0;
|
||||||
table->nodes = 0;
|
table->nodes = 0;
|
||||||
|
|
||||||
/* remove all sources
|
/* remove all sources */
|
||||||
*/
|
|
||||||
for ( i = 0; i < FT_MEM_SOURCE_BUCKETS; i++ )
|
for ( i = 0; i < FT_MEM_SOURCE_BUCKETS; i++ )
|
||||||
{
|
{
|
||||||
FT_MemSource source, next;
|
FT_MemSource source, next;
|
||||||
|
|
||||||
|
|
||||||
for ( source = table->sources[i]; source != NULL; source = next )
|
for ( source = table->sources[i]; source != NULL; source = next )
|
||||||
{
|
{
|
||||||
next = source->link;
|
next = source->link;
|
||||||
|
@ -438,8 +445,11 @@
|
||||||
FT_UInt32 hash;
|
FT_UInt32 hash;
|
||||||
FT_MemSource node, *pnode;
|
FT_MemSource node, *pnode;
|
||||||
|
|
||||||
hash = (FT_UInt32)(void*)table->file_name + (FT_UInt32)(5*table->line_no);
|
|
||||||
|
hash = (FT_UInt32)(void*)table->file_name +
|
||||||
|
(FT_UInt32)( 5 * table->line_no );
|
||||||
pnode = &table->sources[hash % FT_MEM_SOURCE_BUCKETS];
|
pnode = &table->sources[hash % FT_MEM_SOURCE_BUCKETS];
|
||||||
|
|
||||||
for ( ;; )
|
for ( ;; )
|
||||||
{
|
{
|
||||||
node = *pnode;
|
node = *pnode;
|
||||||
|
@ -458,7 +468,6 @@
|
||||||
ft_mem_debug_panic(
|
ft_mem_debug_panic(
|
||||||
"not enough memory to perform memory debugging\n" );
|
"not enough memory to perform memory debugging\n" );
|
||||||
|
|
||||||
|
|
||||||
node->file_name = table->file_name;
|
node->file_name = table->file_name;
|
||||||
node->line_no = table->line_no;
|
node->line_no = table->line_no;
|
||||||
|
|
||||||
|
@ -493,21 +502,22 @@
|
||||||
{
|
{
|
||||||
FT_MemSource source;
|
FT_MemSource source;
|
||||||
|
|
||||||
|
|
||||||
pnode = ft_mem_table_get_nodep( table, address );
|
pnode = ft_mem_table_get_nodep( table, address );
|
||||||
node = *pnode;
|
node = *pnode;
|
||||||
if ( node )
|
if ( node )
|
||||||
{
|
{
|
||||||
if ( node->size < 0 )
|
if ( node->size < 0 )
|
||||||
{
|
{
|
||||||
/* this block was already freed. This means that our memory is */
|
/* This block was already freed. Our memory is now completely */
|
||||||
/* now completely corrupted! */
|
/* corrupted! */
|
||||||
/* this can only happen in keep-alive mode */
|
/* This can only happen in keep-alive mode. */
|
||||||
ft_mem_debug_panic(
|
ft_mem_debug_panic(
|
||||||
"memory heap corrupted (allocating freed block)" );
|
"memory heap corrupted (allocating freed block)" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* this block was already allocated. This means that our memory */
|
/* This block was already allocated. This means that our memory */
|
||||||
/* is also corrupted! */
|
/* is also corrupted! */
|
||||||
ft_mem_debug_panic(
|
ft_mem_debug_panic(
|
||||||
"memory heap corrupted (re-allocating allocated block at"
|
"memory heap corrupted (re-allocating allocated block at"
|
||||||
|
@ -577,6 +587,7 @@
|
||||||
{
|
{
|
||||||
FT_MemSource source;
|
FT_MemSource source;
|
||||||
|
|
||||||
|
|
||||||
if ( node->size < 0 )
|
if ( node->size < 0 )
|
||||||
ft_mem_debug_panic(
|
ft_mem_debug_panic(
|
||||||
"freeing memory block at %p more than once at (%s:%ld)\n"
|
"freeing memory block at %p more than once at (%s:%ld)\n"
|
||||||
|
@ -586,7 +597,7 @@
|
||||||
FT_FILENAME( node->source->file_name ), node->source->line_no,
|
FT_FILENAME( node->source->file_name ), node->source->line_no,
|
||||||
FT_FILENAME( node->free_file_name ), node->free_line_no );
|
FT_FILENAME( node->free_file_name ), node->free_line_no );
|
||||||
|
|
||||||
/* scramble the node's content for additionnals safety */
|
/* scramble the node's content for additional safety */
|
||||||
FT_MEM_SET( address, 0xF3, node->size );
|
FT_MEM_SET( address, 0xF3, node->size );
|
||||||
table->alloc_current -= node->size;
|
table->alloc_current -= node->size;
|
||||||
|
|
||||||
|
@ -714,7 +725,7 @@
|
||||||
"trying to reallocate %p to size 0 (current is %ld) in (%s:%ld)",
|
"trying to reallocate %p to size 0 (current is %ld) in (%s:%ld)",
|
||||||
block, cur_size, file_name, line_no );
|
block, cur_size, file_name, line_no );
|
||||||
|
|
||||||
/* check 'cur_size' value */
|
/* check `cur_size' value */
|
||||||
pnode = ft_mem_table_get_nodep( table, (FT_Byte*)block );
|
pnode = ft_mem_table_get_nodep( table, (FT_Byte*)block );
|
||||||
node = *pnode;
|
node = *pnode;
|
||||||
if ( !node )
|
if ( !node )
|
||||||
|
@ -761,6 +772,7 @@
|
||||||
{
|
{
|
||||||
const char* p;
|
const char* p;
|
||||||
|
|
||||||
|
|
||||||
memory->user = table;
|
memory->user = table;
|
||||||
memory->alloc = ft_mem_debug_alloc;
|
memory->alloc = ft_mem_debug_alloc;
|
||||||
memory->realloc = ft_mem_debug_realloc;
|
memory->realloc = ft_mem_debug_realloc;
|
||||||
|
@ -771,6 +783,7 @@
|
||||||
{
|
{
|
||||||
FT_Long total_max = ft_atol( p );
|
FT_Long total_max = ft_atol( p );
|
||||||
|
|
||||||
|
|
||||||
if ( total_max > 0 )
|
if ( total_max > 0 )
|
||||||
{
|
{
|
||||||
table->bound_total = 1;
|
table->bound_total = 1;
|
||||||
|
@ -783,6 +796,7 @@
|
||||||
{
|
{
|
||||||
FT_Long total_count = ft_atol( p );
|
FT_Long total_count = ft_atol( p );
|
||||||
|
|
||||||
|
|
||||||
if ( total_count > 0 )
|
if ( total_count > 0 )
|
||||||
{
|
{
|
||||||
table->bound_count = 1;
|
table->bound_count = 1;
|
||||||
|
@ -795,6 +809,7 @@
|
||||||
{
|
{
|
||||||
FT_Long keep_alive = ft_atol( p );
|
FT_Long keep_alive = ft_atol( p );
|
||||||
|
|
||||||
|
|
||||||
if ( keep_alive > 0 )
|
if ( keep_alive > 0 )
|
||||||
table->keep_alive = 1;
|
table->keep_alive = 1;
|
||||||
}
|
}
|
||||||
|
@ -839,6 +854,7 @@
|
||||||
table->file_name = file_name;
|
table->file_name = file_name;
|
||||||
table->line_no = line_no;
|
table->line_no = line_no;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FT_Alloc( memory, size, P );
|
return FT_Alloc( memory, size, P );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -859,6 +875,7 @@
|
||||||
table->file_name = file_name;
|
table->file_name = file_name;
|
||||||
table->line_no = line_no;
|
table->line_no = line_no;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FT_Realloc( memory, current, size, P );
|
return FT_Realloc( memory, current, size, P );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -899,6 +916,7 @@
|
||||||
table->file_name = file_name;
|
table->file_name = file_name;
|
||||||
table->line_no = line_no;
|
table->line_no = line_no;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FT_QRealloc( memory, current, size, P );
|
return FT_QRealloc( memory, current, size, P );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -917,6 +935,7 @@
|
||||||
table->file_name = file_name;
|
table->file_name = file_name;
|
||||||
table->line_no = line_no;
|
table->line_no = line_no;
|
||||||
}
|
}
|
||||||
|
|
||||||
FT_Free( memory, (void **)block );
|
FT_Free( memory, (void **)block );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -928,6 +947,7 @@
|
||||||
FT_MemSource s1 = *(FT_MemSource*)p1;
|
FT_MemSource s1 = *(FT_MemSource*)p1;
|
||||||
FT_MemSource s2 = *(FT_MemSource*)p2;
|
FT_MemSource s2 = *(FT_MemSource*)p2;
|
||||||
|
|
||||||
|
|
||||||
if ( s2->max_size > s1->max_size )
|
if ( s2->max_size > s1->max_size )
|
||||||
return 1;
|
return 1;
|
||||||
else if ( s2->max_size < s1->max_size )
|
else if ( s2->max_size < s1->max_size )
|
||||||
|
@ -951,11 +971,13 @@
|
||||||
FT_UInt nn, count;
|
FT_UInt nn, count;
|
||||||
const char* fmt;
|
const char* fmt;
|
||||||
|
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for ( ; bucket < limit; bucket++ )
|
for ( ; bucket < limit; bucket++ )
|
||||||
{
|
{
|
||||||
FT_MemSource source = *bucket;
|
FT_MemSource source = *bucket;
|
||||||
|
|
||||||
|
|
||||||
for ( ; source; source = source->link )
|
for ( ; source; source = source->link )
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -967,23 +989,28 @@
|
||||||
{
|
{
|
||||||
FT_MemSource source = *bucket;
|
FT_MemSource source = *bucket;
|
||||||
|
|
||||||
|
|
||||||
for ( ; source; source = source->link )
|
for ( ; source; source = source->link )
|
||||||
sources[count++] = source;
|
sources[count++] = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
ft_qsort( sources, count, sizeof ( *sources ), ft_mem_source_compare );
|
ft_qsort( sources, count, sizeof ( *sources ), ft_mem_source_compare );
|
||||||
|
|
||||||
printf( "FreeType Memory Dump: current=%ld max=%ld total=%ld count=%ld\n",
|
printf( "FreeType Memory Dump: "
|
||||||
table->alloc_current, table->alloc_max, table->alloc_total, table->alloc_count );
|
"current=%ld max=%ld total=%ld count=%ld\n",
|
||||||
|
table->alloc_current, table->alloc_max,
|
||||||
|
table->alloc_total, table->alloc_count );
|
||||||
printf( " block block sizes sizes sizes source\n" );
|
printf( " block block sizes sizes sizes source\n" );
|
||||||
printf( " count high sum highsum max location\n" );
|
printf( " count high sum highsum max location\n" );
|
||||||
printf( "-------------------------------------------------\n" );
|
printf( "-------------------------------------------------\n" );
|
||||||
|
|
||||||
fmt = "%6ld %6ld %8ld %8ld %8ld %s:%d\n";
|
fmt = "%6ld %6ld %8ld %8ld %8ld %s:%d\n";
|
||||||
|
|
||||||
for ( nn = 0; nn < count; nn++ )
|
for ( nn = 0; nn < count; nn++ )
|
||||||
{
|
{
|
||||||
FT_MemSource source = sources[nn];
|
FT_MemSource source = sources[nn];
|
||||||
|
|
||||||
|
|
||||||
printf( fmt,
|
printf( fmt,
|
||||||
source->cur_blocks, source->max_blocks,
|
source->cur_blocks, source->max_blocks,
|
||||||
source->cur_size, source->max_size, source->cur_max,
|
source->cur_size, source->max_size, source->cur_max,
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* OpenType font driver implementation (body). */
|
/* OpenType font driver implementation (body). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002, 2003, 2004 by */
|
/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
@ -105,13 +105,14 @@
|
||||||
TT_Face face = (TT_Face)ttface;
|
TT_Face face = (TT_Face)ttface;
|
||||||
SFNT_Service sfnt = face->sfnt;
|
SFNT_Service sfnt = face->sfnt;
|
||||||
|
|
||||||
|
|
||||||
kerning->x = 0;
|
kerning->x = 0;
|
||||||
kerning->y = 0;
|
kerning->y = 0;
|
||||||
|
|
||||||
if ( sfnt )
|
if ( sfnt )
|
||||||
kerning->x = sfnt->get_kerning( face, left_glyph, right_glyph );
|
kerning->x = sfnt->get_kerning( face, left_glyph, right_glyph );
|
||||||
|
|
||||||
return 0;
|
return CFF_Err_Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* OpenType objects manager (body). */
|
/* OpenType objects manager (body). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002, 2003, 2004 by */
|
/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
@ -81,7 +81,9 @@
|
||||||
if ( !error )
|
if ( !error )
|
||||||
{
|
{
|
||||||
/* XXX: TODO: move this code to the SFNT module where it belongs */
|
/* XXX: TODO: move this code to the SFNT module where it belongs */
|
||||||
|
|
||||||
#ifdef FT_OPTIMIZE_MEMORY
|
#ifdef FT_OPTIMIZE_MEMORY
|
||||||
|
|
||||||
FT_Byte* strike = face->sbit_table + 8 + strike_index*48;
|
FT_Byte* strike = face->sbit_table + 8 + strike_index*48;
|
||||||
|
|
||||||
sbit_metrics->ascender = (FT_Char)strike[16] << 6; /* hori.ascender */
|
sbit_metrics->ascender = (FT_Char)strike[16] << 6; /* hori.ascender */
|
||||||
|
@ -94,6 +96,7 @@
|
||||||
) << 6;
|
) << 6;
|
||||||
|
|
||||||
#else /* !OPTIMIZE_MEMORY */
|
#else /* !OPTIMIZE_MEMORY */
|
||||||
|
|
||||||
TT_SBit_Strike strike = face->sbit_strikes + strike_index;
|
TT_SBit_Strike strike = face->sbit_strikes + strike_index;
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,6 +107,7 @@
|
||||||
sbit_metrics->max_advance = ( strike->hori.min_origin_SB +
|
sbit_metrics->max_advance = ( strike->hori.min_origin_SB +
|
||||||
strike->hori.max_width +
|
strike->hori.max_width +
|
||||||
strike->hori.min_advance_SB ) << 6;
|
strike->hori.min_advance_SB ) << 6;
|
||||||
|
|
||||||
#endif /* !OPTIMIZE_MEMORY */
|
#endif /* !OPTIMIZE_MEMORY */
|
||||||
|
|
||||||
/* XXX: Is this correct? */
|
/* XXX: Is this correct? */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# FreeType 2 src/sfnt Jamfile (c) 2001, 2002, 2004 David Turner
|
# FreeType 2 src/sfnt Jamfile (c) 2001, 2002, 2004, 2005 David Turner
|
||||||
#
|
#
|
||||||
|
|
||||||
SubDir FT2_TOP $(FT2_SRC_DIR) sfnt ;
|
SubDir FT2_TOP $(FT2_SRC_DIR) sfnt ;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
# Copyright 1996-2000, 2002, 2003, 2004 by
|
# Copyright 1996-2000, 2002, 2003, 2004, 2005 by
|
||||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||||
#
|
#
|
||||||
# This file is part of the FreeType project, and may only be used, modified,
|
# This file is part of the FreeType project, and may only be used, modified,
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* High-level SFNT driver interface (body). */
|
/* High-level SFNT driver interface (body). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002, 2003, 2004 by */
|
/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
@ -366,8 +366,8 @@
|
||||||
/* see `ttsbit.h' and `sfnt.h' */
|
/* see `ttsbit.h' and `sfnt.h' */
|
||||||
tt_face_set_sbit_strike,
|
tt_face_set_sbit_strike,
|
||||||
tt_face_load_sbit_strikes,
|
tt_face_load_sbit_strikes,
|
||||||
NULL /* tt_find_sbit_image */,
|
0 /* tt_find_sbit_image */,
|
||||||
NULL /* tt_load_sbit_metrics */,
|
0 /* tt_load_sbit_metrics */,
|
||||||
tt_face_load_sbit_image,
|
tt_face_load_sbit_image,
|
||||||
tt_face_free_sbit_strikes,
|
tt_face_free_sbit_strikes,
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* Single object library component. */
|
/* Single object library component. */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002, 2003, 2004 by */
|
/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* SFNT object management (base). */
|
/* SFNT object management (base). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002, 2003, 2004 by */
|
/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
@ -511,7 +511,7 @@
|
||||||
(void)LOAD_( gasp );
|
(void)LOAD_( gasp );
|
||||||
(void)LOAD_( kerning );
|
(void)LOAD_( kerning );
|
||||||
|
|
||||||
error = 0;
|
error = SFNT_Err_Ok;
|
||||||
|
|
||||||
face->root.family_name = tt_face_get_name( face,
|
face->root.family_name = tt_face_get_name( face,
|
||||||
TT_NAME_ID_PREFERRED_FAMILY );
|
TT_NAME_ID_PREFERRED_FAMILY );
|
||||||
|
@ -780,6 +780,7 @@
|
||||||
{
|
{
|
||||||
FT_Stream stream = FT_FACE_STREAM( face );
|
FT_Stream stream = FT_FACE_STREAM( face );
|
||||||
|
|
||||||
|
|
||||||
FT_FRAME_RELEASE( face->horz_metrics );
|
FT_FRAME_RELEASE( face->horz_metrics );
|
||||||
FT_FRAME_RELEASE( face->vert_metrics );
|
FT_FRAME_RELEASE( face->vert_metrics );
|
||||||
face->horz_metrics_size = 0;
|
face->horz_metrics_size = 0;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* TrueType character mapping table (cmap) support (body). */
|
/* TrueType character mapping table (cmap) support (body). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 2002, 2003, 2004 by */
|
/* Copyright 2002, 2003, 2004, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
@ -649,6 +649,7 @@
|
||||||
{
|
{
|
||||||
FT_Byte* p;
|
FT_Byte* p;
|
||||||
|
|
||||||
|
|
||||||
cmap->cmap.data = table;
|
cmap->cmap.data = table;
|
||||||
|
|
||||||
p = table + 2;
|
p = table + 2;
|
||||||
|
@ -665,7 +666,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static FT_Int
|
static FT_Int
|
||||||
tt_cmap4_set_range( TT_CMap4 cmap,
|
tt_cmap4_set_range( TT_CMap4 cmap,
|
||||||
FT_UInt range_index )
|
FT_UInt range_index )
|
||||||
|
@ -674,10 +674,12 @@
|
||||||
FT_Byte* p;
|
FT_Byte* p;
|
||||||
FT_UInt num_ranges = cmap->num_ranges;
|
FT_UInt num_ranges = cmap->num_ranges;
|
||||||
|
|
||||||
|
|
||||||
while ( range_index < num_ranges )
|
while ( range_index < num_ranges )
|
||||||
{
|
{
|
||||||
FT_UInt offset;
|
FT_UInt offset;
|
||||||
|
|
||||||
|
|
||||||
p = table + 14 + range_index * 2;
|
p = table + 14 + range_index * 2;
|
||||||
cmap->cur_end = FT_PEEK_USHORT( p );
|
cmap->cur_end = FT_PEEK_USHORT( p );
|
||||||
|
|
||||||
|
@ -690,7 +692,7 @@
|
||||||
p += num_ranges * 2;
|
p += num_ranges * 2;
|
||||||
offset = FT_PEEK_SHORT( p );
|
offset = FT_PEEK_SHORT( p );
|
||||||
|
|
||||||
if ( offset != 0xFFFF )
|
if ( offset != 0xFFFFU )
|
||||||
{
|
{
|
||||||
cmap->cur_values = offset ? p + offset : NULL;
|
cmap->cur_values = offset ? p + offset : NULL;
|
||||||
cmap->cur_range = range_index;
|
cmap->cur_range = range_index;
|
||||||
|
@ -712,9 +714,9 @@
|
||||||
static void
|
static void
|
||||||
tt_cmap4_next( TT_CMap4 cmap )
|
tt_cmap4_next( TT_CMap4 cmap )
|
||||||
{
|
{
|
||||||
FT_UInt num_ranges = cmap->num_ranges;
|
|
||||||
FT_UInt charcode = cmap->cur_charcode + 1;
|
FT_UInt charcode = cmap->cur_charcode + 1;
|
||||||
|
|
||||||
|
|
||||||
cmap->old_charcode = cmap->cur_charcode;
|
cmap->old_charcode = cmap->cur_charcode;
|
||||||
|
|
||||||
for ( ;; )
|
for ( ;; )
|
||||||
|
@ -723,19 +725,22 @@
|
||||||
FT_UInt end = cmap->cur_end;
|
FT_UInt end = cmap->cur_end;
|
||||||
FT_Int delta = cmap->cur_delta;
|
FT_Int delta = cmap->cur_delta;
|
||||||
|
|
||||||
|
|
||||||
if ( charcode <= end )
|
if ( charcode <= end )
|
||||||
{
|
{
|
||||||
if ( values )
|
if ( values )
|
||||||
{
|
{
|
||||||
FT_Byte* p = values + 2 * ( charcode - cmap->cur_start );
|
FT_Byte* p = values + 2 * ( charcode - cmap->cur_start );
|
||||||
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
FT_UInt gindex = FT_NEXT_USHORT( p );
|
FT_UInt gindex = FT_NEXT_USHORT( p );
|
||||||
|
|
||||||
|
|
||||||
if ( gindex != 0 )
|
if ( gindex != 0 )
|
||||||
{
|
{
|
||||||
gindex = (FT_UInt)((gindex + delta) & 0xFFFF);
|
gindex = (FT_UInt)( ( gindex + delta ) & 0xFFFFU );
|
||||||
if ( gindex != 0 )
|
if ( gindex != 0 )
|
||||||
{
|
{
|
||||||
cmap->cur_charcode = charcode;
|
cmap->cur_charcode = charcode;
|
||||||
|
@ -743,8 +748,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} while ( ++charcode <= end );
|
||||||
while ( ++charcode <= end );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -752,19 +756,18 @@
|
||||||
{
|
{
|
||||||
FT_UInt gindex = (FT_UInt)( ( charcode + delta ) & 0xFFFFU );
|
FT_UInt gindex = (FT_UInt)( ( charcode + delta ) & 0xFFFFU );
|
||||||
|
|
||||||
|
|
||||||
if ( gindex != 0 )
|
if ( gindex != 0 )
|
||||||
{
|
{
|
||||||
cmap->cur_charcode = charcode;
|
cmap->cur_charcode = charcode;
|
||||||
cmap->cur_gindex = gindex;
|
cmap->cur_gindex = gindex;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
} while ( ++charcode <= end );
|
||||||
while ( ++charcode <= end );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we need to find another range
|
/* we need to find another range */
|
||||||
*/
|
|
||||||
if ( tt_cmap4_set_range( cmap, cmap->cur_range + 1 ) < 0 )
|
if ( tt_cmap4_set_range( cmap, cmap->cur_range + 1 ) < 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1092,6 +1095,7 @@
|
||||||
{
|
{
|
||||||
TT_CMap4 cmap4 = (TT_CMap4)cmap;
|
TT_CMap4 cmap4 = (TT_CMap4)cmap;
|
||||||
|
|
||||||
|
|
||||||
if ( char_code == cmap4->old_charcode )
|
if ( char_code == cmap4->old_charcode )
|
||||||
{
|
{
|
||||||
result = cmap4->cur_charcode;
|
result = cmap4->cur_charcode;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* ttkern.h */
|
/* ttkern.c */
|
||||||
/* */
|
/* */
|
||||||
/* Load the basic TrueType kerning table. This doesn't handle */
|
/* Load the basic TrueType kerning table. This doesn't handle */
|
||||||
/* kerning data within the GPOS table at the moment. */
|
/* kerning data within the GPOS table at the moment. */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002, 2003, 2004 by */
|
/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
@ -21,6 +21,7 @@
|
||||||
#include FT_INTERNAL_DEBUG_H
|
#include FT_INTERNAL_DEBUG_H
|
||||||
#include FT_INTERNAL_STREAM_H
|
#include FT_INTERNAL_STREAM_H
|
||||||
#include FT_TRUETYPE_TAGS_H
|
#include FT_TRUETYPE_TAGS_H
|
||||||
|
#include "ttkern.h"
|
||||||
#include "ttload.h"
|
#include "ttload.h"
|
||||||
|
|
||||||
#include "sferrors.h"
|
#include "sferrors.h"
|
||||||
|
@ -33,7 +34,7 @@
|
||||||
/* messages during execution. */
|
/* messages during execution. */
|
||||||
/* */
|
/* */
|
||||||
#undef FT_COMPONENT
|
#undef FT_COMPONENT
|
||||||
#define FT_COMPONENT trace_ttload
|
#define FT_COMPONENT trace_ttkern
|
||||||
|
|
||||||
|
|
||||||
#undef TT_KERN_INDEX
|
#undef TT_KERN_INDEX
|
||||||
|
@ -90,6 +91,7 @@
|
||||||
FT_Byte* p_next;
|
FT_Byte* p_next;
|
||||||
FT_UInt32 mask = 1UL << nn;
|
FT_UInt32 mask = 1UL << nn;
|
||||||
|
|
||||||
|
|
||||||
if ( p + 6 > p_limit )
|
if ( p + 6 > p_limit )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -104,7 +106,8 @@
|
||||||
|
|
||||||
p_next += length;
|
p_next += length;
|
||||||
|
|
||||||
if ( (coverage & ~8) != 0x0001 || /* only use horizontal kerning tables */
|
/* only use horizontal kerning tables */
|
||||||
|
if ( ( coverage & ~8 ) != 0x0001 ||
|
||||||
p + 8 > p_limit )
|
p + 8 > p_limit )
|
||||||
goto NextTable;
|
goto NextTable;
|
||||||
|
|
||||||
|
@ -116,14 +119,16 @@
|
||||||
|
|
||||||
avail |= mask;
|
avail |= mask;
|
||||||
|
|
||||||
/* now, try to see if the pairs in this table are ordered.
|
/*
|
||||||
* when they are, we'll be able to use binary search
|
* Now check whether the pairs in this table are ordered.
|
||||||
|
* We then can use binary search.
|
||||||
*/
|
*/
|
||||||
if ( num_pairs > 0 )
|
if ( num_pairs > 0 )
|
||||||
{
|
{
|
||||||
FT_UInt count;
|
FT_UInt count;
|
||||||
FT_UInt old_pair;
|
FT_UInt old_pair;
|
||||||
|
|
||||||
|
|
||||||
old_pair = FT_NEXT_ULONG( p );
|
old_pair = FT_NEXT_ULONG( p );
|
||||||
p += 2;
|
p += 2;
|
||||||
|
|
||||||
|
@ -131,6 +136,7 @@
|
||||||
{
|
{
|
||||||
FT_UInt32 cur_pair;
|
FT_UInt32 cur_pair;
|
||||||
|
|
||||||
|
|
||||||
cur_pair = FT_NEXT_ULONG( p );
|
cur_pair = FT_NEXT_ULONG( p );
|
||||||
if ( cur_pair <= old_pair )
|
if ( cur_pair <= old_pair )
|
||||||
break;
|
break;
|
||||||
|
@ -161,6 +167,7 @@
|
||||||
{
|
{
|
||||||
FT_Stream stream = face->root.stream;
|
FT_Stream stream = face->root.stream;
|
||||||
|
|
||||||
|
|
||||||
FT_FRAME_RELEASE( face->kern_table );
|
FT_FRAME_RELEASE( face->kern_table );
|
||||||
face->kern_table_size = 0;
|
face->kern_table_size = 0;
|
||||||
face->num_kern_tables = 0;
|
face->num_kern_tables = 0;
|
||||||
|
@ -179,6 +186,7 @@
|
||||||
FT_Byte* p = face->kern_table;
|
FT_Byte* p = face->kern_table;
|
||||||
FT_Byte* p_limit = p + face->kern_table_size;
|
FT_Byte* p_limit = p + face->kern_table_size;
|
||||||
|
|
||||||
|
|
||||||
p += 4;
|
p += 4;
|
||||||
mask = 0x0001;
|
mask = 0x0001;
|
||||||
|
|
||||||
|
@ -191,6 +199,7 @@
|
||||||
FT_UInt coverage = FT_NEXT_USHORT( p );
|
FT_UInt coverage = FT_NEXT_USHORT( p );
|
||||||
FT_Int value = 0;
|
FT_Int value = 0;
|
||||||
|
|
||||||
|
|
||||||
next = base + length;
|
next = base + length;
|
||||||
|
|
||||||
if ( ( face->kern_avail_bits & mask ) == 0 )
|
if ( ( face->kern_avail_bits & mask ) == 0 )
|
||||||
|
@ -206,6 +215,7 @@
|
||||||
FT_UInt num_pairs = FT_NEXT_USHORT( p );
|
FT_UInt num_pairs = FT_NEXT_USHORT( p );
|
||||||
FT_ULong key0 = TT_KERN_INDEX( left_glyph, right_glyph );
|
FT_ULong key0 = TT_KERN_INDEX( left_glyph, right_glyph );
|
||||||
|
|
||||||
|
|
||||||
p += 6;
|
p += 6;
|
||||||
|
|
||||||
if ( face->kern_order_bits & mask ) /* binary search */
|
if ( face->kern_order_bits & mask ) /* binary search */
|
||||||
|
@ -214,12 +224,14 @@
|
||||||
FT_UInt max = num_pairs;
|
FT_UInt max = num_pairs;
|
||||||
FT_Byte* q;
|
FT_Byte* q;
|
||||||
|
|
||||||
|
|
||||||
while ( min < max )
|
while ( min < max )
|
||||||
{
|
{
|
||||||
FT_UInt mid = ( min + max ) >> 1;
|
FT_UInt mid = ( min + max ) >> 1;
|
||||||
FT_Byte* q = p + 6 * mid;
|
FT_Byte* q = p + 6 * mid;
|
||||||
FT_ULong key;
|
FT_ULong key;
|
||||||
|
|
||||||
|
|
||||||
key = FT_NEXT_ULONG( q );
|
key = FT_NEXT_ULONG( q );
|
||||||
|
|
||||||
if ( key == key0 )
|
if ( key == key0 )
|
||||||
|
@ -237,10 +249,12 @@
|
||||||
{
|
{
|
||||||
FT_UInt count = num_pairs;
|
FT_UInt count = num_pairs;
|
||||||
|
|
||||||
|
|
||||||
for ( ; count > 0; count-- )
|
for ( ; count > 0; count-- )
|
||||||
{
|
{
|
||||||
FT_ULong key = FT_NEXT_ULONG( p );
|
FT_ULong key = FT_NEXT_ULONG( p );
|
||||||
|
|
||||||
|
|
||||||
if ( key == key0 )
|
if ( key == key0 )
|
||||||
{
|
{
|
||||||
value = FT_PEEK_SHORT( p );
|
value = FT_PEEK_SHORT( p );
|
||||||
|
@ -252,7 +266,8 @@
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* we don't support format 2 because we've never seen a single font
|
/*
|
||||||
|
* We don't support format 2 because we've never seen a single font
|
||||||
* using it in real life...
|
* using it in real life...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -263,7 +278,7 @@
|
||||||
goto NextTable;
|
goto NextTable;
|
||||||
|
|
||||||
Found:
|
Found:
|
||||||
if ( coverage & 8 ) /* overide or addition */
|
if ( coverage & 8 ) /* overide or add */
|
||||||
result = value;
|
result = value;
|
||||||
else
|
else
|
||||||
result += value;
|
result += value;
|
||||||
|
@ -276,8 +291,7 @@
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else /* !OPTIMIZE_MEMORY */
|
||||||
#else /* !OPTMIZE_MEMORY */
|
|
||||||
|
|
||||||
FT_CALLBACK_DEF( int )
|
FT_CALLBACK_DEF( int )
|
||||||
tt_kern_pair_compare( const void* a,
|
tt_kern_pair_compare( const void* a,
|
||||||
|
@ -400,6 +414,7 @@
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FT_CALLBACK_DEF( int )
|
FT_CALLBACK_DEF( int )
|
||||||
tt_kern_pair_compare( const void* a,
|
tt_kern_pair_compare( const void* a,
|
||||||
const void* b )
|
const void* b )
|
||||||
|
@ -410,9 +425,9 @@
|
||||||
FT_ULong index1 = TT_KERN_INDEX( pair1->left, pair1->right );
|
FT_ULong index1 = TT_KERN_INDEX( pair1->left, pair1->right );
|
||||||
FT_ULong index2 = TT_KERN_INDEX( pair2->left, pair2->right );
|
FT_ULong index2 = TT_KERN_INDEX( pair2->left, pair2->right );
|
||||||
|
|
||||||
|
return index1 < index2 ? -1
|
||||||
return ( index1 < index2 ? -1 :
|
: ( index1 > index2 ? 1
|
||||||
( index1 > index2 ? 1 : 0 ));
|
: 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -421,12 +436,12 @@
|
||||||
{
|
{
|
||||||
FT_Memory memory = face->root.stream->memory;
|
FT_Memory memory = face->root.stream->memory;
|
||||||
|
|
||||||
|
|
||||||
FT_FREE( face->kern_pairs );
|
FT_FREE( face->kern_pairs );
|
||||||
face->num_kern_pairs = 0;
|
face->num_kern_pairs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL_DEF( FT_Int )
|
FT_LOCAL_DEF( FT_Int )
|
||||||
tt_face_get_kerning( TT_Face face,
|
tt_face_get_kerning( TT_Face face,
|
||||||
FT_UInt left_glyph,
|
FT_UInt left_glyph,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
/* Load the basic TrueType kerning table. This doesn't handle */
|
/* Load the basic TrueType kerning table. This doesn't handle */
|
||||||
/* kerning data within the GPOS table at the moment. */
|
/* kerning data within the GPOS table at the moment. */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002 by */
|
/* Copyright 1996-2001, 2002, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
@ -47,6 +47,7 @@ FT_BEGIN_HEADER
|
||||||
# define TT_FACE_HAS_KERNING( face ) ( (face)->kern_pairs != NULL )
|
# define TT_FACE_HAS_KERNING( face ) ( (face)->kern_pairs != NULL )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
FT_END_HEADER
|
FT_END_HEADER
|
||||||
|
|
||||||
#endif /* __TTKERN_H__ */
|
#endif /* __TTKERN_H__ */
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
/* Load the basic TrueType tables, i.e., tables that can be either in */
|
/* Load the basic TrueType tables, i.e., tables that can be either in */
|
||||||
/* TTF or OTF fonts (body). */
|
/* TTF or OTF fonts (body). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002, 2003, 2004 by */
|
/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
@ -801,6 +801,7 @@
|
||||||
/* FreeType error code. 0 means success. */
|
/* FreeType error code. 0 means success. */
|
||||||
/* */
|
/* */
|
||||||
#ifdef FT_OPTIMIZE_MEMORY
|
#ifdef FT_OPTIMIZE_MEMORY
|
||||||
|
|
||||||
static FT_Error
|
static FT_Error
|
||||||
tt_face_load_metrics( TT_Face face,
|
tt_face_load_metrics( TT_Face face,
|
||||||
FT_Stream stream,
|
FT_Stream stream,
|
||||||
|
@ -822,7 +823,7 @@
|
||||||
ptable = &face->vert_metrics;
|
ptable = &face->vert_metrics;
|
||||||
ptable_size = &face->vert_metrics_size;
|
ptable_size = &face->vert_metrics_size;
|
||||||
|
|
||||||
/* The table is optional, quit silently if it wasn't found */
|
/* The table is optional, quit silently if it wasn't found. */
|
||||||
/* */
|
/* */
|
||||||
/* XXX: Some fonts have a valid vertical header with a non-null */
|
/* XXX: Some fonts have a valid vertical header with a non-null */
|
||||||
/* `number_of_VMetrics' fields, but no corresponding `vmtx' */
|
/* `number_of_VMetrics' fields, but no corresponding `vmtx' */
|
||||||
|
@ -849,7 +850,7 @@
|
||||||
{
|
{
|
||||||
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
||||||
/* If this is an incrementally loaded font and there are */
|
/* If this is an incrementally loaded font and there are */
|
||||||
/* overriding metrics tolerate a missing 'hmtx' table. */
|
/* overriding metrics, tolerate a missing `hmtx' table. */
|
||||||
if ( face->root.internal->incremental_interface &&
|
if ( face->root.internal->incremental_interface &&
|
||||||
face->root.internal->incremental_interface->funcs->
|
face->root.internal->incremental_interface->funcs->
|
||||||
get_glyph_metrics )
|
get_glyph_metrics )
|
||||||
|
@ -876,6 +877,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* !OPTIMIZE_MEMORY */
|
#else /* !OPTIMIZE_MEMORY */
|
||||||
|
|
||||||
static FT_Error
|
static FT_Error
|
||||||
tt_face_load_metrics( TT_Face face,
|
tt_face_load_metrics( TT_Face face,
|
||||||
FT_Stream stream,
|
FT_Stream stream,
|
||||||
|
@ -897,7 +899,7 @@
|
||||||
|
|
||||||
if ( vertical )
|
if ( vertical )
|
||||||
{
|
{
|
||||||
/* The table is optional, quit silently if it wasn't found */
|
/* The table is optional, quit silently if it wasn't found. */
|
||||||
/* */
|
/* */
|
||||||
/* XXX: Some fonts have a valid vertical header with a non-null */
|
/* XXX: Some fonts have a valid vertical header with a non-null */
|
||||||
/* `number_of_VMetrics' fields, but no corresponding `vmtx' */
|
/* `number_of_VMetrics' fields, but no corresponding `vmtx' */
|
||||||
|
@ -927,7 +929,7 @@
|
||||||
|
|
||||||
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
||||||
/* If this is an incrementally loaded font and there are */
|
/* If this is an incrementally loaded font and there are */
|
||||||
/* overriding metrics tolerate a missing 'hmtx' table. */
|
/* overriding metrics, tolerate a missing `hmtx' table. */
|
||||||
if ( face->root.internal->incremental_interface &&
|
if ( face->root.internal->incremental_interface &&
|
||||||
face->root.internal->incremental_interface->funcs->
|
face->root.internal->incremental_interface->funcs->
|
||||||
get_glyph_metrics )
|
get_glyph_metrics )
|
||||||
|
@ -993,9 +995,9 @@
|
||||||
for ( ; cur < limit; cur++ )
|
for ( ; cur < limit; cur++ )
|
||||||
*cur = FT_GET_SHORT();
|
*cur = FT_GET_SHORT();
|
||||||
|
|
||||||
/* we fill up the missing left side bearings with the */
|
/* We fill up the missing left side bearings with the */
|
||||||
/* last valid value. Since this will occur for buggy CJK */
|
/* last valid value. Since this will occur for buggy CJK */
|
||||||
/* fonts usually only, nothing serious will happen */
|
/* fonts usually only, nothing serious will happen. */
|
||||||
if ( num_shorts > num_shorts_checked && num_shorts_checked > 0 )
|
if ( num_shorts > num_shorts_checked && num_shorts_checked > 0 )
|
||||||
{
|
{
|
||||||
FT_Short val = (*shorts)[num_shorts_checked - 1];
|
FT_Short val = (*shorts)[num_shorts_checked - 1];
|
||||||
|
@ -1014,8 +1016,10 @@
|
||||||
Exit:
|
Exit:
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !FT_OPTIMIZE_METRICS */
|
#endif /* !FT_OPTIMIZE_METRICS */
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* <Function> */
|
/* <Function> */
|
||||||
|
@ -1704,6 +1708,7 @@
|
||||||
/* FreeType error code. 0 means success. */
|
/* FreeType error code. 0 means success. */
|
||||||
/* */
|
/* */
|
||||||
#ifdef FT_OPTIMIZE_MEMORY
|
#ifdef FT_OPTIMIZE_MEMORY
|
||||||
|
|
||||||
FT_LOCAL_DEF( FT_Error )
|
FT_LOCAL_DEF( FT_Error )
|
||||||
tt_face_load_hdmx( TT_Face face,
|
tt_face_load_hdmx( TT_Face face,
|
||||||
FT_Stream stream )
|
FT_Stream stream )
|
||||||
|
@ -1715,6 +1720,7 @@
|
||||||
FT_Byte* p;
|
FT_Byte* p;
|
||||||
FT_Byte* limit;
|
FT_Byte* limit;
|
||||||
|
|
||||||
|
|
||||||
/* this table is optional */
|
/* this table is optional */
|
||||||
error = face->goto_table( face, TTAG_hdmx, stream, &table_size );
|
error = face->goto_table( face, TTAG_hdmx, stream, &table_size );
|
||||||
if ( error || table_size < 8 )
|
if ( error || table_size < 8 )
|
||||||
|
@ -1767,11 +1773,13 @@
|
||||||
FT_Stream stream = face->root.stream;
|
FT_Stream stream = face->root.stream;
|
||||||
FT_Memory memory = stream->memory;
|
FT_Memory memory = stream->memory;
|
||||||
|
|
||||||
|
|
||||||
FT_FREE( face->hdmx_record_sizes );
|
FT_FREE( face->hdmx_record_sizes );
|
||||||
FT_FRAME_RELEASE( face->hdmx_table );
|
FT_FRAME_RELEASE( face->hdmx_table );
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* !FT_OPTIMIZE_MEMORY */
|
#else /* !FT_OPTIMIZE_MEMORY */
|
||||||
|
|
||||||
FT_LOCAL_DEF( FT_Error )
|
FT_LOCAL_DEF( FT_Error )
|
||||||
tt_face_load_hdmx( TT_Face face,
|
tt_face_load_hdmx( TT_Face face,
|
||||||
FT_Stream stream )
|
FT_Stream stream )
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
/* Load the basic TrueType tables, i.e., tables that can be either in */
|
/* Load the basic TrueType tables, i.e., tables that can be either in */
|
||||||
/* TTF or OTF fonts (specification). */
|
/* TTF or OTF fonts (specification). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002 by */
|
/* Copyright 1996-2001, 2002, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* TrueType and OpenType embedded bitmap support (body). */
|
/* TrueType and OpenType embedded bitmap support (body). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002, 2003, 2004 by */
|
/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
@ -584,8 +584,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now set up the root fields to indicate the strikes
|
/* now set up the root fields to indicate the strikes */
|
||||||
*/
|
|
||||||
if ( face->num_sbit_strikes )
|
if ( face->num_sbit_strikes )
|
||||||
{
|
{
|
||||||
FT_ULong n;
|
FT_ULong n;
|
||||||
|
@ -1514,6 +1513,7 @@
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* !OPTIMIZE_MEMORY */
|
||||||
|
|
||||||
|
|
||||||
/* END */
|
/* END */
|
||||||
#endif /* !OPTIMIZE_MEMORY */
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* ttsbit.c */
|
/* ttsbit0.c */
|
||||||
/* */
|
/* */
|
||||||
/* TrueType and OpenType embedded bitmap support (body). */
|
/* TrueType and OpenType embedded bitmap support (body). */
|
||||||
|
/* This is a heap-optimized version. */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002, 2003, 2004 by */
|
/* Copyright 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
@ -84,12 +85,11 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL_DEF( FT_Error )
|
FT_LOCAL_DEF( FT_Error )
|
||||||
tt_face_load_sbit_strikes( TT_Face face,
|
tt_face_load_sbit_strikes( TT_Face face,
|
||||||
FT_Stream stream )
|
FT_Stream stream )
|
||||||
{
|
{
|
||||||
FT_Error error = 0;
|
FT_Error error = SFNT_Err_Ok;
|
||||||
FT_Memory memory = stream->memory;
|
FT_Memory memory = stream->memory;
|
||||||
FT_Fixed version;
|
FT_Fixed version;
|
||||||
FT_ULong num_strikes, table_size;
|
FT_ULong num_strikes, table_size;
|
||||||
|
@ -98,6 +98,7 @@
|
||||||
FT_Byte* p_limit;
|
FT_Byte* p_limit;
|
||||||
FT_UInt nn, count;
|
FT_UInt nn, count;
|
||||||
|
|
||||||
|
|
||||||
face->sbit_num_strikes = 0;
|
face->sbit_num_strikes = 0;
|
||||||
|
|
||||||
/* this table is optional */
|
/* this table is optional */
|
||||||
|
@ -125,14 +126,16 @@
|
||||||
version = FT_NEXT_ULONG( p );
|
version = FT_NEXT_ULONG( p );
|
||||||
num_strikes = FT_NEXT_ULONG( p );
|
num_strikes = FT_NEXT_ULONG( p );
|
||||||
|
|
||||||
if ( version != 0x00020000 || num_strikes >= 0x10000UL )
|
if ( version != 0x00020000UL || num_strikes >= 0x10000UL )
|
||||||
{
|
{
|
||||||
FT_ERROR(( "%s: invalid table version !\n", "tt_face_load_sbit_strikes" ));
|
FT_ERROR(( "%s: invalid table version!\n",
|
||||||
|
"tt_face_load_sbit_strikes" ));
|
||||||
error = SFNT_Err_Invalid_File_Format;
|
error = SFNT_Err_Invalid_File_Format;
|
||||||
goto Fail;
|
goto Fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* count the number of strikes available in the table. we're a bit
|
/*
|
||||||
|
* Count the number of strikes available in the table. We are a bit
|
||||||
* paranoid there and don't trust the data.
|
* paranoid there and don't trust the data.
|
||||||
*/
|
*/
|
||||||
count = (FT_UInt)num_strikes;
|
count = (FT_UInt)num_strikes;
|
||||||
|
@ -141,10 +144,10 @@
|
||||||
|
|
||||||
face->sbit_num_strikes = count;
|
face->sbit_num_strikes = count;
|
||||||
|
|
||||||
/* now allocate the root array of F_Bitmap_Size records,
|
/*
|
||||||
* populate them, and that's all there is to it. Unfortunately,
|
* Now allocate the root array of FT_Bitmap_Size records and
|
||||||
* it's not possible to indicate bit depths in the FT_Bitmap_Size
|
* populate them. Unfortunately, it isn't possible to indicate bit
|
||||||
* record. What were we thinking ?
|
* depths in the FT_Bitmap_Size record. This is a design error.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
FT_Memory memory = face->root.stream->memory;
|
FT_Memory memory = face->root.stream->memory;
|
||||||
|
@ -155,6 +158,7 @@
|
||||||
|
|
||||||
FT_Short avgwidth = face->os2.xAvgCharWidth;
|
FT_Short avgwidth = face->os2.xAvgCharWidth;
|
||||||
|
|
||||||
|
|
||||||
if ( FT_NEW_ARRAY( face->root.available_sizes, count ) )
|
if ( FT_NEW_ARRAY( face->root.available_sizes, count ) )
|
||||||
goto Fail;
|
goto Fail;
|
||||||
|
|
||||||
|
@ -163,6 +167,7 @@
|
||||||
FT_Bitmap_Size* bsize = face->root.available_sizes + nn;
|
FT_Bitmap_Size* bsize = face->root.available_sizes + nn;
|
||||||
FT_UInt x_ppem, y_ppem;
|
FT_UInt x_ppem, y_ppem;
|
||||||
|
|
||||||
|
|
||||||
x_ppem = p[44];
|
x_ppem = p[44];
|
||||||
y_ppem = p[45];
|
y_ppem = p[45];
|
||||||
|
|
||||||
|
@ -178,7 +183,6 @@
|
||||||
|
|
||||||
face->root.face_flags |= FT_FACE_FLAG_FIXED_SIZES;
|
face->root.face_flags |= FT_FACE_FLAG_FIXED_SIZES;
|
||||||
face->root.num_fixed_sizes = count;
|
face->root.num_fixed_sizes = count;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Exit:
|
Exit:
|
||||||
|
@ -196,6 +200,7 @@
|
||||||
{
|
{
|
||||||
FT_Stream stream = face->root.stream;
|
FT_Stream stream = face->root.stream;
|
||||||
|
|
||||||
|
|
||||||
FT_FRAME_RELEASE( face->sbit_table );
|
FT_FRAME_RELEASE( face->sbit_table );
|
||||||
face->sbit_table_size = 0;
|
face->sbit_table_size = 0;
|
||||||
face->sbit_num_strikes = 0;
|
face->sbit_num_strikes = 0;
|
||||||
|
@ -212,6 +217,7 @@
|
||||||
FT_Byte* p;
|
FT_Byte* p;
|
||||||
FT_Byte* p_limit;
|
FT_Byte* p_limit;
|
||||||
|
|
||||||
|
|
||||||
if ( x_ppem > 255 ||
|
if ( x_ppem > 255 ||
|
||||||
y_ppem < 1 || y_ppem > 255 )
|
y_ppem < 1 || y_ppem > 255 )
|
||||||
return SFNT_Err_Invalid_PPem;
|
return SFNT_Err_Invalid_PPem;
|
||||||
|
@ -219,6 +225,7 @@
|
||||||
p = face->sbit_table + 8;
|
p = face->sbit_table + 8;
|
||||||
p_limit = p + face->sbit_table_size;
|
p_limit = p + face->sbit_table_size;
|
||||||
count = face->sbit_num_strikes;
|
count = face->sbit_num_strikes;
|
||||||
|
|
||||||
for ( nn = 0; nn < count; nn++ )
|
for ( nn = 0; nn < count; nn++ )
|
||||||
{
|
{
|
||||||
if ( x_ppem == (FT_UInt)p[44] && y_ppem == (FT_UInt)p[45] )
|
if ( x_ppem == (FT_UInt)p[44] && y_ppem == (FT_UInt)p[45] )
|
||||||
|
@ -233,7 +240,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
TT_Face face;
|
TT_Face face;
|
||||||
|
@ -265,6 +271,7 @@
|
||||||
FT_Stream stream = face->root.stream;
|
FT_Stream stream = face->root.stream;
|
||||||
FT_ULong ebdt_size;
|
FT_ULong ebdt_size;
|
||||||
|
|
||||||
|
|
||||||
error = face->goto_table( face, TTAG_EBDT, stream, &ebdt_size );
|
error = face->goto_table( face, TTAG_EBDT, stream, &ebdt_size );
|
||||||
if ( error )
|
if ( error )
|
||||||
error = face->goto_table( face, TTAG_bdat, stream, &ebdt_size );
|
error = face->goto_table( face, TTAG_bdat, stream, &ebdt_size );
|
||||||
|
@ -285,11 +292,11 @@
|
||||||
decoder->eblc_base = face->sbit_table;
|
decoder->eblc_base = face->sbit_table;
|
||||||
decoder->eblc_limit = face->sbit_table + face->sbit_table_size;
|
decoder->eblc_limit = face->sbit_table + face->sbit_table_size;
|
||||||
|
|
||||||
/* now find the strike corresponding to the index
|
/* now find the strike corresponding to the index */
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
FT_Byte* p = decoder->eblc_base + 8 + 48 * strike_index;
|
FT_Byte* p = decoder->eblc_base + 8 + 48 * strike_index;
|
||||||
|
|
||||||
|
|
||||||
decoder->strike_index_array = FT_NEXT_ULONG( p );
|
decoder->strike_index_array = FT_NEXT_ULONG( p );
|
||||||
p += 4;
|
p += 4;
|
||||||
decoder->strike_index_count = FT_NEXT_ULONG( p );
|
decoder->strike_index_count = FT_NEXT_ULONG( p );
|
||||||
|
@ -309,18 +316,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static FT_Error
|
static FT_Error
|
||||||
tt_sbit_decoder_alloc_bitmap( TT_SBitDecoder decoder )
|
tt_sbit_decoder_alloc_bitmap( TT_SBitDecoder decoder )
|
||||||
{
|
{
|
||||||
FT_Error error = 0;
|
FT_Error error = SFNT_Err_Ok;
|
||||||
FT_UInt width, height;
|
FT_UInt width, height;
|
||||||
FT_Bitmap* map = decoder->bitmap;
|
FT_Bitmap* map = decoder->bitmap;
|
||||||
FT_Long size;
|
FT_Long size;
|
||||||
|
|
||||||
|
|
||||||
if ( !decoder->metrics_loaded )
|
if ( !decoder->metrics_loaded )
|
||||||
{
|
{
|
||||||
error = FT_Err_Invalid_Argument;
|
error = SFNT_Err_Invalid_Argument;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,6 +390,7 @@
|
||||||
FT_Byte* p = *pp;
|
FT_Byte* p = *pp;
|
||||||
TT_SBit_Metrics metrics = decoder->metrics;
|
TT_SBit_Metrics metrics = decoder->metrics;
|
||||||
|
|
||||||
|
|
||||||
if ( p + 5 > limit )
|
if ( p + 5 > limit )
|
||||||
goto Fail;
|
goto Fail;
|
||||||
|
|
||||||
|
@ -416,13 +424,10 @@
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
Fail:
|
Fail:
|
||||||
return FT_Err_Invalid_Argument;
|
return SFNT_Err_Invalid_Argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* forward declaration */
|
/* forward declaration */
|
||||||
static FT_Error
|
static FT_Error
|
||||||
tt_sbit_decoder_load_image( TT_SBitDecoder decoder,
|
tt_sbit_decoder_load_image( TT_SBitDecoder decoder,
|
||||||
|
@ -437,8 +442,6 @@
|
||||||
FT_Int y_pos );
|
FT_Int y_pos );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static FT_Error
|
static FT_Error
|
||||||
tt_sbit_decoder_load_byte_aligned( TT_SBitDecoder decoder,
|
tt_sbit_decoder_load_byte_aligned( TT_SBitDecoder decoder,
|
||||||
FT_Byte* p,
|
FT_Byte* p,
|
||||||
|
@ -446,12 +449,13 @@
|
||||||
FT_Int x_pos,
|
FT_Int x_pos,
|
||||||
FT_Int y_pos )
|
FT_Int y_pos )
|
||||||
{
|
{
|
||||||
FT_Error error = 0;
|
FT_Error error = SFNT_Err_Ok;
|
||||||
FT_Byte* line;
|
FT_Byte* line;
|
||||||
FT_Int bit_height, bit_width, pitch, width, height, h;
|
FT_Int bit_height, bit_width, pitch, width, height, h;
|
||||||
FT_Bitmap* bitmap;
|
FT_Bitmap* bitmap;
|
||||||
FT_UInt rval;
|
FT_UInt rval;
|
||||||
|
|
||||||
|
|
||||||
if ( !decoder->bitmap_allocated )
|
if ( !decoder->bitmap_allocated )
|
||||||
{
|
{
|
||||||
error = tt_sbit_decoder_alloc_bitmap( decoder );
|
error = tt_sbit_decoder_alloc_bitmap( decoder );
|
||||||
|
@ -459,8 +463,7 @@
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check that we can write the glyph into the bitmap
|
/* check that we can write the glyph into the bitmap */
|
||||||
*/
|
|
||||||
bitmap = decoder->bitmap;
|
bitmap = decoder->bitmap;
|
||||||
bit_width = bitmap->width;
|
bit_width = bitmap->width;
|
||||||
bit_height = bitmap->rows;
|
bit_height = bitmap->rows;
|
||||||
|
@ -472,18 +475,17 @@
|
||||||
if ( x_pos < 0 || x_pos + width > bit_width ||
|
if ( x_pos < 0 || x_pos + width > bit_width ||
|
||||||
y_pos < 0 || y_pos + height > bit_height )
|
y_pos < 0 || y_pos + height > bit_height )
|
||||||
{
|
{
|
||||||
error = FT_Err_Invalid_File_Format;
|
error = SFNT_Err_Invalid_File_Format;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( p + ( ( width + 7 ) >> 3 ) * height > limit )
|
if ( p + ( ( width + 7 ) >> 3 ) * height > limit )
|
||||||
{
|
{
|
||||||
error = FT_Err_Invalid_File_Format;
|
error = SFNT_Err_Invalid_File_Format;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now do the blit
|
/* now do the blit */
|
||||||
*/
|
|
||||||
line += y_pos * pitch + ( x_pos >> 3 );
|
line += y_pos * pitch + ( x_pos >> 3 );
|
||||||
x_pos &= 7;
|
x_pos &= 7;
|
||||||
|
|
||||||
|
@ -494,6 +496,7 @@
|
||||||
FT_Byte* write = line;
|
FT_Byte* write = line;
|
||||||
FT_Int w;
|
FT_Int w;
|
||||||
|
|
||||||
|
|
||||||
for ( w = width; w >= 8; w -= 8 )
|
for ( w = width; w >= 8; w -= 8 )
|
||||||
{
|
{
|
||||||
write[0] = (FT_Byte)( write[0] | *p++ );
|
write[0] = (FT_Byte)( write[0] | *p++ );
|
||||||
|
@ -501,7 +504,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( w > 0 )
|
if ( w > 0 )
|
||||||
write[0] = (FT_Byte)(write[0] | (*p++ & (0xFF00 >> w)));
|
write[0] = (FT_Byte)( write[0] | ( *p++ & ( 0xFF00U >> w ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* x_pos > 0 */
|
else /* x_pos > 0 */
|
||||||
|
@ -512,6 +515,7 @@
|
||||||
FT_Int w;
|
FT_Int w;
|
||||||
FT_UInt wval = 0;
|
FT_UInt wval = 0;
|
||||||
|
|
||||||
|
|
||||||
for ( w = width; w >= 8; w -= 8 )
|
for ( w = width; w >= 8; w -= 8 )
|
||||||
{
|
{
|
||||||
wval = (FT_UInt)( wval | *p++ );
|
wval = (FT_UInt)( wval | *p++ );
|
||||||
|
@ -521,7 +525,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( w > 0 )
|
if ( w > 0 )
|
||||||
wval = (FT_UInt)(wval | (*p++ & (0xFF00 >> w)));
|
wval = (FT_UInt)(wval | ( *p++ & ( 0xFF00U >> w ) ) );
|
||||||
|
|
||||||
write[0] = (FT_Byte)( write[0] | ( wval >> x_pos ) );
|
write[0] = (FT_Byte)( write[0] | ( wval >> x_pos ) );
|
||||||
}
|
}
|
||||||
|
@ -539,12 +543,13 @@
|
||||||
FT_Int x_pos,
|
FT_Int x_pos,
|
||||||
FT_Int y_pos )
|
FT_Int y_pos )
|
||||||
{
|
{
|
||||||
FT_Error error = 0;
|
FT_Error error = SFNT_Err_Ok;
|
||||||
FT_Byte* line;
|
FT_Byte* line;
|
||||||
FT_Int bit_height, bit_width, pitch, width, height, h;
|
FT_Int bit_height, bit_width, pitch, width, height, h;
|
||||||
FT_Bitmap* bitmap;
|
FT_Bitmap* bitmap;
|
||||||
FT_UInt32 rval;
|
FT_UInt32 rval;
|
||||||
|
|
||||||
|
|
||||||
if ( !decoder->bitmap_allocated )
|
if ( !decoder->bitmap_allocated )
|
||||||
{
|
{
|
||||||
error = tt_sbit_decoder_alloc_bitmap( decoder );
|
error = tt_sbit_decoder_alloc_bitmap( decoder );
|
||||||
|
@ -552,8 +557,7 @@
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check that we can write the glyph into the bitmap
|
/* check that we can write the glyph into the bitmap */
|
||||||
*/
|
|
||||||
bitmap = decoder->bitmap;
|
bitmap = decoder->bitmap;
|
||||||
bit_width = bitmap->width;
|
bit_width = bitmap->width;
|
||||||
bit_height = bitmap->rows;
|
bit_height = bitmap->rows;
|
||||||
|
@ -565,21 +569,20 @@
|
||||||
if ( x_pos < 0 || x_pos + width > bit_width ||
|
if ( x_pos < 0 || x_pos + width > bit_width ||
|
||||||
y_pos < 0 || y_pos + height > bit_height )
|
y_pos < 0 || y_pos + height > bit_height )
|
||||||
{
|
{
|
||||||
error = FT_Err_Invalid_File_Format;
|
error = SFNT_Err_Invalid_File_Format;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( p + ( ( width + 7 ) >> 3 ) * height > limit )
|
if ( p + ( ( width + 7 ) >> 3 ) * height > limit )
|
||||||
{
|
{
|
||||||
error = FT_Err_Invalid_File_Format;
|
error = SFNT_Err_Invalid_File_Format;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now do the blit
|
/* now do the blit */
|
||||||
*/
|
|
||||||
line += y_pos * pitch + ( x_pos >> 3 );
|
line += y_pos * pitch + ( x_pos >> 3 );
|
||||||
x_pos &= 7;
|
x_pos &= 7;
|
||||||
rval = 0x10000;
|
rval = 0x10000UL;
|
||||||
|
|
||||||
for ( h = height; h > 0; h--, line += pitch )
|
for ( h = height; h > 0; h--, line += pitch )
|
||||||
{
|
{
|
||||||
|
@ -587,17 +590,18 @@
|
||||||
FT_UInt32 wval = 0x100 << x_pos;
|
FT_UInt32 wval = 0x100 << x_pos;
|
||||||
FT_Int w;
|
FT_Int w;
|
||||||
|
|
||||||
|
|
||||||
for ( w = width; w >= 8; w -= 8 )
|
for ( w = width; w >= 8; w -= 8 )
|
||||||
{
|
{
|
||||||
if ( rval & 0x10000 )
|
if ( rval & 0x10000UL )
|
||||||
rval = 0x100 | *p++;
|
rval = 0x100 | *p++;
|
||||||
|
|
||||||
wval |= (rval & 0x80);
|
wval |= rval & 0x80;
|
||||||
|
|
||||||
wval <<= 1;
|
wval <<= 1;
|
||||||
rval <<= 1;
|
rval <<= 1;
|
||||||
|
|
||||||
if ( wval & 0x10000 )
|
if ( wval & 0x10000UL )
|
||||||
{
|
{
|
||||||
write[0] = (FT_Byte)( write[0] | ( wval >> 8 ) );
|
write[0] = (FT_Byte)( write[0] | ( wval >> 8 ) );
|
||||||
write += 1;
|
write += 1;
|
||||||
|
@ -643,8 +647,10 @@
|
||||||
FT_Byte dx = FT_NEXT_BYTE( p );
|
FT_Byte dx = FT_NEXT_BYTE( p );
|
||||||
FT_Byte dy = FT_NEXT_BYTE( p );
|
FT_Byte dy = FT_NEXT_BYTE( p );
|
||||||
|
|
||||||
|
|
||||||
/* NB: a recursive call */
|
/* NB: a recursive call */
|
||||||
error = tt_sbit_decoder_load_image( decoder, gindex, x_pos+dx, y_pos+dy );
|
error = tt_sbit_decoder_load_image( decoder, gindex,
|
||||||
|
x_pos + dx, y_pos + dy );
|
||||||
if ( error )
|
if ( error )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -653,7 +659,7 @@
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
Fail:
|
Fail:
|
||||||
error = FT_Err_Invalid_File_Format;
|
error = SFNT_Err_Invalid_File_Format;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,11 +678,11 @@
|
||||||
FT_Byte* p_limit;
|
FT_Byte* p_limit;
|
||||||
FT_Byte* data;
|
FT_Byte* data;
|
||||||
|
|
||||||
/* seek into the EBDT table now
|
|
||||||
*/
|
/* seek into the EBDT table now */
|
||||||
if ( glyph_start + glyph_size > decoder->ebdt_size )
|
if ( glyph_start + glyph_size > decoder->ebdt_size )
|
||||||
{
|
{
|
||||||
error = FT_Err_Invalid_Argument;
|
error = SFNT_Err_Invalid_Argument;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -687,20 +693,23 @@
|
||||||
p = data;
|
p = data;
|
||||||
p_limit = p + glyph_size;
|
p_limit = p + glyph_size;
|
||||||
|
|
||||||
/* read the data, depending on the glyph format
|
/* read the data, depending on the glyph format */
|
||||||
*/
|
|
||||||
switch ( glyph_format )
|
switch ( glyph_format )
|
||||||
{
|
{
|
||||||
case 1: case 2: case 8:
|
case 1:
|
||||||
|
case 2:
|
||||||
|
case 8:
|
||||||
error = tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 0 );
|
error = tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 0 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6: case 7: case 9:
|
case 6:
|
||||||
|
case 7:
|
||||||
|
case 9:
|
||||||
error = tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 1 );
|
error = tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 1 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
error = 0;
|
error = SFNT_Err_Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( error )
|
if ( error )
|
||||||
|
@ -709,13 +718,17 @@
|
||||||
{
|
{
|
||||||
TT_SBitDecoder_LoadFunc loader;
|
TT_SBitDecoder_LoadFunc loader;
|
||||||
|
|
||||||
|
|
||||||
switch ( glyph_format )
|
switch ( glyph_format )
|
||||||
{
|
{
|
||||||
case 1: case 6:
|
case 1:
|
||||||
|
case 6:
|
||||||
loader = tt_sbit_decoder_load_byte_aligned;
|
loader = tt_sbit_decoder_load_byte_aligned;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: case 5: case 7:
|
case 2:
|
||||||
|
case 5:
|
||||||
|
case 7:
|
||||||
loader = tt_sbit_decoder_load_bit_aligned;
|
loader = tt_sbit_decoder_load_bit_aligned;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -751,15 +764,18 @@
|
||||||
FT_Int x_pos,
|
FT_Int x_pos,
|
||||||
FT_Int y_pos )
|
FT_Int y_pos )
|
||||||
{
|
{
|
||||||
/* first, we find the correct strike range that applies to this
|
/*
|
||||||
|
* First, we find the correct strike range that applies to this
|
||||||
* glyph index.
|
* glyph index.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
FT_Byte* p = decoder->eblc_base + decoder->strike_index_array;
|
FT_Byte* p = decoder->eblc_base + decoder->strike_index_array;
|
||||||
FT_Byte* p_limit = decoder->eblc_limit;
|
FT_Byte* p_limit = decoder->eblc_limit;
|
||||||
FT_ULong num_ranges = decoder->strike_index_count;
|
FT_ULong num_ranges = decoder->strike_index_count;
|
||||||
FT_UInt start, end, offset, index_format, image_format;
|
FT_UInt start, end, offset, index_format, image_format;
|
||||||
FT_ULong image_start, image_end, image_offset;
|
FT_ULong image_start, image_end, image_offset;
|
||||||
|
|
||||||
|
|
||||||
if ( p + 8 * num_ranges > p_limit )
|
if ( p + 8 * num_ranges > p_limit )
|
||||||
goto NoBitmap;
|
goto NoBitmap;
|
||||||
|
|
||||||
|
@ -780,16 +796,14 @@
|
||||||
if ( p + 8 > p_limit )
|
if ( p + 8 > p_limit )
|
||||||
goto NoBitmap;
|
goto NoBitmap;
|
||||||
|
|
||||||
/* now, we're going to find the glyph's location and extend within
|
/* now find the glyph's location and extend within the ebdt table */
|
||||||
* the ebdt table
|
|
||||||
*/
|
|
||||||
index_format = FT_NEXT_USHORT( p );
|
index_format = FT_NEXT_USHORT( p );
|
||||||
image_format = FT_NEXT_USHORT( p );
|
image_format = FT_NEXT_USHORT( p );
|
||||||
image_offset = FT_NEXT_ULONG ( p );
|
image_offset = FT_NEXT_ULONG ( p );
|
||||||
|
|
||||||
switch ( index_format )
|
switch ( index_format )
|
||||||
{
|
{
|
||||||
case 1: /* 4-byte offsets relative to 'image_offset' */
|
case 1: /* 4-byte offsets relative to `image_offset' */
|
||||||
{
|
{
|
||||||
p += 4 * ( glyph_index - start );
|
p += 4 * ( glyph_index - start );
|
||||||
if ( p + 8 > p_limit )
|
if ( p + 8 > p_limit )
|
||||||
|
@ -807,6 +821,7 @@
|
||||||
{
|
{
|
||||||
FT_ULong image_size;
|
FT_ULong image_size;
|
||||||
|
|
||||||
|
|
||||||
if ( p + 12 > p_limit )
|
if ( p + 12 > p_limit )
|
||||||
goto NoBitmap;
|
goto NoBitmap;
|
||||||
|
|
||||||
|
@ -838,6 +853,7 @@
|
||||||
{
|
{
|
||||||
FT_ULong mm, num_glyphs;
|
FT_ULong mm, num_glyphs;
|
||||||
|
|
||||||
|
|
||||||
if ( p + 4 > p_limit )
|
if ( p + 4 > p_limit )
|
||||||
goto NoBitmap;
|
goto NoBitmap;
|
||||||
|
|
||||||
|
@ -849,6 +865,7 @@
|
||||||
{
|
{
|
||||||
FT_UInt gindex = FT_NEXT_USHORT( p );
|
FT_UInt gindex = FT_NEXT_USHORT( p );
|
||||||
|
|
||||||
|
|
||||||
if ( gindex == glyph_index )
|
if ( gindex == glyph_index )
|
||||||
{
|
{
|
||||||
image_start = FT_NEXT_USHORT( p );
|
image_start = FT_NEXT_USHORT( p );
|
||||||
|
@ -868,6 +885,7 @@
|
||||||
{
|
{
|
||||||
FT_ULong image_size, mm, num_glyphs;
|
FT_ULong image_size, mm, num_glyphs;
|
||||||
|
|
||||||
|
|
||||||
if ( p + 16 > p_limit )
|
if ( p + 16 > p_limit )
|
||||||
goto NoBitmap;
|
goto NoBitmap;
|
||||||
|
|
||||||
|
@ -884,6 +902,7 @@
|
||||||
{
|
{
|
||||||
FT_UInt gindex = FT_NEXT_USHORT( p );
|
FT_UInt gindex = FT_NEXT_USHORT( p );
|
||||||
|
|
||||||
|
|
||||||
if ( gindex == glyph_index )
|
if ( gindex == glyph_index )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -906,20 +925,18 @@
|
||||||
image_end -= image_start;
|
image_end -= image_start;
|
||||||
image_start = image_offset + image_start;
|
image_start = image_offset + image_start;
|
||||||
|
|
||||||
|
|
||||||
return tt_sbit_decoder_load_bitmap( decoder,
|
return tt_sbit_decoder_load_bitmap( decoder,
|
||||||
image_format,
|
image_format,
|
||||||
image_offset + image_start,
|
image_offset + image_start,
|
||||||
image_end,
|
image_end,
|
||||||
x_pos,
|
x_pos,
|
||||||
y_pos );
|
y_pos );
|
||||||
|
|
||||||
NoBitmap:
|
NoBitmap:
|
||||||
return FT_Err_Invalid_Argument;
|
return SFNT_Err_Invalid_Argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL( FT_Error )
|
FT_LOCAL( FT_Error )
|
||||||
tt_face_load_sbit_image( TT_Face face,
|
tt_face_load_sbit_image( TT_Face face,
|
||||||
FT_ULong strike_index,
|
FT_ULong strike_index,
|
||||||
|
@ -932,6 +949,7 @@
|
||||||
TT_SBitDecoderRec decoder[1];
|
TT_SBitDecoderRec decoder[1];
|
||||||
FT_Error error;
|
FT_Error error;
|
||||||
|
|
||||||
|
|
||||||
error = tt_sbit_decoder_init( decoder, face, strike_index, metrics );
|
error = tt_sbit_decoder_init( decoder, face, strike_index, metrics );
|
||||||
if ( !error )
|
if ( !error )
|
||||||
{
|
{
|
||||||
|
@ -941,3 +959,5 @@
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* TrueType font driver implementation (body). */
|
/* TrueType font driver implementation (body). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002, 2003, 2004 by */
|
/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
@ -107,6 +107,7 @@
|
||||||
TT_Face face = (TT_Face)ttface;
|
TT_Face face = (TT_Face)ttface;
|
||||||
SFNT_Service sfnt = (SFNT_Service)face->sfnt;
|
SFNT_Service sfnt = (SFNT_Service)face->sfnt;
|
||||||
|
|
||||||
|
|
||||||
kerning->x = 0;
|
kerning->x = 0;
|
||||||
kerning->y = 0;
|
kerning->y = 0;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* TrueType Glyph Loader (body). */
|
/* TrueType Glyph Loader (body). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002, 2003, 2004 by */
|
/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
@ -97,6 +97,7 @@
|
||||||
/* near future, but I haven't decided which yet. */
|
/* near future, but I haven't decided which yet. */
|
||||||
/* */
|
/* */
|
||||||
#ifdef FT_OPTIMIZE_MEMORY
|
#ifdef FT_OPTIMIZE_MEMORY
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tt_face_get_metrics( TT_Face face,
|
tt_face_get_metrics( TT_Face face,
|
||||||
FT_Bool vertical,
|
FT_Bool vertical,
|
||||||
|
@ -109,6 +110,7 @@
|
||||||
FT_Byte* limit;
|
FT_Byte* limit;
|
||||||
FT_UShort k;
|
FT_UShort k;
|
||||||
|
|
||||||
|
|
||||||
if ( vertical )
|
if ( vertical )
|
||||||
{
|
{
|
||||||
header = (TT_HoriHeader*)&face->vertical;
|
header = (TT_HoriHeader*)&face->vertical;
|
||||||
|
@ -156,7 +158,9 @@
|
||||||
*aadvance = 0;
|
*aadvance = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
|
#else /* !FT_OPTIMIZE_MEMORY */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tt_face_get_metrics( TT_Face face,
|
tt_face_get_metrics( TT_Face face,
|
||||||
FT_Bool vertical,
|
FT_Bool vertical,
|
||||||
|
@ -164,8 +168,8 @@
|
||||||
FT_Short *abearing,
|
FT_Short *abearing,
|
||||||
FT_UShort *aadvance )
|
FT_UShort *aadvance )
|
||||||
{
|
{
|
||||||
TT_HoriHeader* header = (vertical ? (TT_HoriHeader*)&face->vertical
|
TT_HoriHeader* header = vertical ? (TT_HoriHeader*)&face->vertical
|
||||||
: &face->horizontal);
|
: &face->horizontal;
|
||||||
TT_LongMetrics longs_m;
|
TT_LongMetrics longs_m;
|
||||||
FT_UShort k = header->number_Of_HMetrics;
|
FT_UShort k = header->number_Of_HMetrics;
|
||||||
|
|
||||||
|
@ -188,7 +192,8 @@
|
||||||
*aadvance = ((TT_LongMetrics)header->long_metrics)[k - 1].advance;
|
*aadvance = ((TT_LongMetrics)header->long_metrics)[k - 1].advance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
#endif /* !FT_OPTIMIZE_MEMORY */
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
@ -222,11 +227,13 @@
|
||||||
FT_UInt gindex )
|
FT_UInt gindex )
|
||||||
{
|
{
|
||||||
#ifdef FT_OPTIMIZE_MEMORY
|
#ifdef FT_OPTIMIZE_MEMORY
|
||||||
|
|
||||||
FT_UInt nn;
|
FT_UInt nn;
|
||||||
FT_Byte* result = NULL;
|
FT_Byte* result = NULL;
|
||||||
FT_ULong record_size = face->hdmx_record_size;
|
FT_ULong record_size = face->hdmx_record_size;
|
||||||
FT_Byte* record = face->hdmx_table + 8;
|
FT_Byte* record = face->hdmx_table + 8;
|
||||||
|
|
||||||
|
|
||||||
for ( nn = 0; nn < face->hdmx_record_count; nn++ )
|
for ( nn = 0; nn < face->hdmx_record_count; nn++ )
|
||||||
if ( face->hdmx_record_sizes[nn] == ppem )
|
if ( face->hdmx_record_sizes[nn] == ppem )
|
||||||
{
|
{
|
||||||
|
@ -237,7 +244,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
FT_UShort n;
|
FT_UShort n;
|
||||||
|
|
||||||
|
|
||||||
|
@ -246,6 +255,7 @@
|
||||||
return &face->hdmx.records[n].widths[gindex];
|
return &face->hdmx.records[n].widths[gindex];
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* TrueType Glyph Loader (specification). */
|
/* TrueType Glyph Loader (specification). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002, 2003, 2004 by */
|
/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* Objects manager (body). */
|
/* Objects manager (body). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002, 2003, 2004 by */
|
/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
@ -750,6 +750,7 @@
|
||||||
if ( !error )
|
if ( !error )
|
||||||
{
|
{
|
||||||
/* XXX: TODO: move this code to the SFNT module where it belongs */
|
/* XXX: TODO: move this code to the SFNT module where it belongs */
|
||||||
|
|
||||||
#ifdef FT_OPTIMIZE_MEMORY
|
#ifdef FT_OPTIMIZE_MEMORY
|
||||||
FT_Byte* strike = face->sbit_table + 8 + strike_index*48;
|
FT_Byte* strike = face->sbit_table + 8 + strike_index*48;
|
||||||
|
|
||||||
|
@ -762,7 +763,8 @@
|
||||||
(FT_Char)strike[23] /* min_advance_SB */
|
(FT_Char)strike[23] /* min_advance_SB */
|
||||||
) << 6;
|
) << 6;
|
||||||
|
|
||||||
#else /* !OPTIMIZE_MEMORY */
|
#else /* !FT_OPTIMIZE_MEMORY */
|
||||||
|
|
||||||
TT_SBit_Strike strike = face->sbit_strikes + strike_index;
|
TT_SBit_Strike strike = face->sbit_strikes + strike_index;
|
||||||
|
|
||||||
|
|
||||||
|
@ -773,7 +775,8 @@
|
||||||
sbit_metrics->max_advance = ( strike->hori.min_origin_SB +
|
sbit_metrics->max_advance = ( strike->hori.min_origin_SB +
|
||||||
strike->hori.max_width +
|
strike->hori.max_width +
|
||||||
strike->hori.min_advance_SB ) << 6;
|
strike->hori.min_advance_SB ) << 6;
|
||||||
#endif /* !OPTIMIZE_MEMORY */
|
|
||||||
|
#endif /* !FT_OPTIMIZE_MEMORY */
|
||||||
|
|
||||||
/* XXX: Is this correct? */
|
/* XXX: Is this correct? */
|
||||||
sbit_metrics->height = sbit_metrics->ascender -
|
sbit_metrics->height = sbit_metrics->ascender -
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* TrueType glyph data/program tables loader (body). */
|
/* TrueType glyph data/program tables loader (body). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002, 2004 by */
|
/* Copyright 1996-2001, 2002, 2004, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
@ -79,9 +79,9 @@
|
||||||
|
|
||||||
if ( face->header.Index_To_Loc_Format != 0 )
|
if ( face->header.Index_To_Loc_Format != 0 )
|
||||||
{
|
{
|
||||||
if ( table_len >= 040000 )
|
if ( table_len >= 0x40000 )
|
||||||
{
|
{
|
||||||
FT_TRACE2(( "table too large !!\n" ));
|
FT_TRACE2(( "table too large!\n" ));
|
||||||
error = TT_Err_Invalid_Table;
|
error = TT_Err_Invalid_Table;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
@ -91,16 +91,16 @@
|
||||||
{
|
{
|
||||||
if ( table_len >= 0x20000 )
|
if ( table_len >= 0x20000 )
|
||||||
{
|
{
|
||||||
FT_TRACE2(( "table too large !!\n" ));
|
FT_TRACE2(( "table too large!\n" ));
|
||||||
error = TT_Err_Invalid_Table;
|
error = TT_Err_Invalid_Table;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
face->num_locations = (FT_UInt)( table_len >> 1 );
|
face->num_locations = (FT_UInt)( table_len >> 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
/* extract the frame. We don't need to decompress it since
|
* Extract the frame. We don't need to decompress it since
|
||||||
* we'll be able to parse it directly
|
* we are able to parse it directly.
|
||||||
*/
|
*/
|
||||||
if ( FT_FRAME_EXTRACT( table_len, face->glyph_locations ) )
|
if ( FT_FRAME_EXTRACT( table_len, face->glyph_locations ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
@ -121,7 +121,9 @@
|
||||||
FT_Byte* p;
|
FT_Byte* p;
|
||||||
FT_Byte* p_limit;
|
FT_Byte* p_limit;
|
||||||
|
|
||||||
|
|
||||||
pos1 = pos2 = 0;
|
pos1 = pos2 = 0;
|
||||||
|
|
||||||
if ( gindex < face->num_locations )
|
if ( gindex < face->num_locations )
|
||||||
{
|
{
|
||||||
if ( face->header.Index_To_Loc_Format != 0 )
|
if ( face->header.Index_To_Loc_Format != 0 )
|
||||||
|
@ -162,14 +164,15 @@
|
||||||
{
|
{
|
||||||
FT_Stream stream = face->root.stream;
|
FT_Stream stream = face->root.stream;
|
||||||
|
|
||||||
|
|
||||||
FT_FRAME_RELEASE( face->glyph_locations );
|
FT_FRAME_RELEASE( face->glyph_locations );
|
||||||
face->num_locations = 0;
|
face->num_locations = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#else /* !FT_OPTIMIZE_MEMORY */
|
#else /* !FT_OPTIMIZE_MEMORY */
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL_DEF( FT_Error )
|
FT_LOCAL_DEF( FT_Error )
|
||||||
tt_face_load_loca( TT_Face face,
|
tt_face_load_loca( TT_Face face,
|
||||||
FT_Stream stream )
|
FT_Stream stream )
|
||||||
|
@ -224,6 +227,7 @@
|
||||||
|
|
||||||
if ( FT_FRAME_ENTER( face->num_locations * 2L ) )
|
if ( FT_FRAME_ENTER( face->num_locations * 2L ) )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
{
|
{
|
||||||
FT_Long* loc = face->glyph_locations;
|
FT_Long* loc = face->glyph_locations;
|
||||||
FT_Long* limit = loc + face->num_locations;
|
FT_Long* limit = loc + face->num_locations;
|
||||||
|
@ -232,6 +236,7 @@
|
||||||
for ( ; loc < limit; loc++ )
|
for ( ; loc < limit; loc++ )
|
||||||
*loc = (FT_Long)( (FT_ULong)FT_GET_USHORT() * 2 );
|
*loc = (FT_Long)( (FT_ULong)FT_GET_USHORT() * 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
FT_FRAME_EXIT();
|
FT_FRAME_EXIT();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,6 +255,7 @@
|
||||||
FT_ULong offset;
|
FT_ULong offset;
|
||||||
FT_UInt count;
|
FT_UInt count;
|
||||||
|
|
||||||
|
|
||||||
offset = face->glyph_locations[gindex];
|
offset = face->glyph_locations[gindex];
|
||||||
count = 0;
|
count = 0;
|
||||||
|
|
||||||
|
@ -266,12 +272,12 @@
|
||||||
{
|
{
|
||||||
FT_Memory memory = face->root.memory;
|
FT_Memory memory = face->root.memory;
|
||||||
|
|
||||||
|
|
||||||
FT_FREE( face->glyph_locations );
|
FT_FREE( face->glyph_locations );
|
||||||
face->num_locations = 0;
|
face->num_locations = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* !FT_OPTIMIZE_MEMORY */
|
#endif /* !FT_OPTIMIZE_MEMORY */
|
||||||
|
|
||||||
|
|
||||||
|
@ -345,10 +351,13 @@
|
||||||
Exit:
|
Exit:
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
#else /* !BYTECODE_INTERPRETER */
|
#else /* !FT_CONFIG_OPTION_BYTECODE_INTERPRETER */
|
||||||
|
|
||||||
FT_UNUSED( face );
|
FT_UNUSED( face );
|
||||||
FT_UNUSED( stream );
|
FT_UNUSED( stream );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,10 +432,13 @@
|
||||||
Exit:
|
Exit:
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
#else /* !BYTECODE_INTERPRETER */
|
#else /* !FT_CONFIG_OPTION_BYTECODE_INTERPRETER */
|
||||||
|
|
||||||
FT_UNUSED( face );
|
FT_UNUSED( face );
|
||||||
FT_UNUSED( stream );
|
FT_UNUSED( stream );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* TrueType glyph data/program tables loader (specification). */
|
/* TrueType glyph data/program tables loader (specification). */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright 1996-2001, 2002 by */
|
/* Copyright 1996-2001, 2002, 2005 by */
|
||||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||||
/* */
|
/* */
|
||||||
/* This file is part of the FreeType project, and may only be used, */
|
/* This file is part of the FreeType project, and may only be used, */
|
||||||
|
|
Loading…
Reference in New Issue