1999-12-17 00:11:37 +01:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* ttgload.c */
|
|
|
|
/* */
|
|
|
|
/* TrueType Glyph Loader (body). */
|
|
|
|
/* */
|
2005-03-01 03:13:50 +01:00
|
|
|
/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
|
|
|
/* */
|
2000-06-12 21:36:41 +02:00
|
|
|
/* This file is part of the FreeType project, and may only be used, */
|
|
|
|
/* modified, and distributed under the terms of the FreeType project */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
|
|
|
/* this file you indicate that you have read the license and */
|
|
|
|
/* understand and accept it fully. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2000-12-08 17:17:16 +01:00
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
#include <ft2build.h>
|
|
|
|
#include FT_INTERNAL_DEBUG_H
|
|
|
|
#include FT_INTERNAL_CALC_H
|
|
|
|
#include FT_INTERNAL_STREAM_H
|
|
|
|
#include FT_INTERNAL_SFNT_H
|
|
|
|
#include FT_TRUETYPE_TAGS_H
|
|
|
|
#include FT_OUTLINE_H
|
|
|
|
|
2001-03-20 12:14:24 +01:00
|
|
|
#include "ttgload.h"
|
2005-03-03 18:09:08 +01:00
|
|
|
#include "ttpload.h"
|
2000-06-12 21:36:41 +02:00
|
|
|
|
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17.
* src/pcf/pcfutil.c: Use FT_LOCAL_DEF.
* src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H.
Use FT_BEGIN_HEADER and FT_END_HEADER.
Use FT_LOCAL.
2004-04-24 George Williams <gww@silcom.com>
Add support for Apple's distortable font technology (in GX fonts).
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro.
* include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style,
FT_MM_Var): New structures.
(FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New function declarations.
* include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func,
FT_Set_Var_Design_Func): New typedefs.
Update MultiMasters service.
* include/freetype/internal/tttypes.h
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H.
(GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef.
(TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend'
and `blend'.
* include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New
macros.
* include/freetype/internal/fttrace.h: Add `ttgxvar'.
* src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New functions.
* src/sfnt/sfobjs.c (sfnt_load_face)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS
flag for GX var fonts.
* src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files.
* src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.c.
* src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h.
(tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]:
New service.
(tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated.
* src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(TT_Process_Simple_Glyph, load_truetype_glyph)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts.
* src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_done_blend.
* src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_face_vary_cvt.
* src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c.
* src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var
and T1_Set_Var_Design.
* src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros.
(T1_Get_MM_Var, T1_Set_Var_Design): New functions.
* src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New
function declarations.
2004-04-25 22:15:11 +02:00
|
|
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
|
|
|
#include "ttgxvar.h"
|
|
|
|
#endif
|
|
|
|
|
Complete redesign of error codes. Please check ftmoderr.h for more
details.
* include/freetype/internal/cfferrs.h,
include/freetype/internal/tterrors.h,
include/freetype/internal/t1errors.h: Removed. Replaced with files
local to the module. All extra error codes have been moved to
`fterrors.h'.
* src/sfnt/ttpost.h: Move error codes to `fterrors.h'.
* src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h,
src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h,
src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h,
src/smooth/ftsmerrs.h, src/truetype/tterrors.h,
src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the
error names for the module it belongs to.
* include/freetype/ftmoderr.h: New file, defining the module error
offsets. Its structure is similar to `fterrors.h'.
* include/freetype/fterrors.h (FT_NOERRORDEF): New macro.
(FT_ERRORDEF): Redefined to use module error offsets.
All internal error codes are now public; unused error codes have
been removed, some are new.
* include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New
macro.
* include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro.
All other source files have been updated to use the new error codes;
some already existing (internal) error codes local to a module have
been renamed to give them the same name as in the base module.
All make files have been updated to include the local error files.
* src/cid/cidtokens.h: Replaced with...
* src/cid/cidtoken.h: This file for 8+3 consistency.
* src/raster/ftraster.c: Use macros for header file names.
2001-06-06 19:30:41 +02:00
|
|
|
#include "tterrors.h"
|
|
|
|
|
2000-07-08 02:41:13 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
|
|
|
|
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
|
|
|
|
/* messages during execution. */
|
|
|
|
/* */
|
1999-12-17 00:11:37 +01:00
|
|
|
#undef FT_COMPONENT
|
|
|
|
#define FT_COMPONENT trace_ttgload
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Composite font flags. */
|
|
|
|
/* */
|
2002-08-16 14:46:52 +02:00
|
|
|
#define ARGS_ARE_WORDS 0x0001
|
|
|
|
#define ARGS_ARE_XY_VALUES 0x0002
|
|
|
|
#define ROUND_XY_TO_GRID 0x0004
|
|
|
|
#define WE_HAVE_A_SCALE 0x0008
|
|
|
|
/* reserved 0x0010 */
|
|
|
|
#define MORE_COMPONENTS 0x0020
|
|
|
|
#define WE_HAVE_AN_XY_SCALE 0x0040
|
|
|
|
#define WE_HAVE_A_2X2 0x0080
|
|
|
|
#define WE_HAVE_INSTR 0x0100
|
|
|
|
#define USE_MY_METRICS 0x0200
|
|
|
|
#define OVERLAP_COMPOUND 0x0400
|
|
|
|
#define SCALED_COMPONENT_OFFSET 0x0800
|
|
|
|
#define UNSCALED_COMPONENT_OFFSET 0x1000
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-16 21:34:52 +02:00
|
|
|
|
2003-01-08 10:59:17 +01:00
|
|
|
/* Maximum recursion depth we allow for composite glyphs.
|
|
|
|
* The TrueType spec doesn't say anything about recursion,
|
|
|
|
* so it isn't clear that recursion is allowed at all. But
|
|
|
|
* we'll be generous.
|
|
|
|
*/
|
|
|
|
#define TT_MAX_COMPOSITE_RECURSE 5
|
|
|
|
|
|
|
|
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/*************************************************************************/
|
2000-06-12 21:36:41 +02:00
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* TT_Get_Metrics */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* Returns the horizontal or vertical metrics in font units for a */
|
|
|
|
/* given glyph. The metrics are the left side bearing (resp. top */
|
|
|
|
/* side bearing) and advance width (resp. advance height). */
|
|
|
|
/* */
|
2000-06-12 21:36:41 +02:00
|
|
|
/* <Input> */
|
|
|
|
/* header :: A pointer to either the horizontal or vertical metrics */
|
|
|
|
/* structure. */
|
|
|
|
/* */
|
* src/base/ftdbgmem.c (ft_mem_table_resize, ft_mem_table_new,
ft_mem_table_set, ft_mem_debug_alloc, ft_mem_debug_free,
ft_mem_debug_realloc, ft_mem_debug_done, FT_Alloc_Debug,
FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings.
* src/base/ftcalc.c (FT_MulFix): Ditto.
* src/cff/cffdrivr.c (cff_get_name_index): Ditto.
* src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init,
CFF_GlyphSlot_Init): Ditto.
* src/cid/cidobjs.c (CID_GlyphSlot_Init,
CID_Size_Get_Globals_Funcs): Ditto.
* src/type1/t1objs.c (T1_Size_Get_Globals_Funcs, T1_GlyphSlot_Init):
Ditto.
* src/pshinter/pshmod.c (pshinter_interface): Use `static const'.
* src/winfonts/winfnt.c (FNT_Get_Next_Char): Remove unused
variables.
* include/freetype/internal/psaux.h (T1_Builder_Funcs): Renamed
to...
(T1_Builder_FuncsRec): This.
(T1_Builder_Funcs): New typedef.
(PSAux_Interface): Remove compiler warnings.
* src/psaux/psauxmod.c (t1_builder_funcs), src/psaux/psobjs.h
(t1_builder_funcs): Updated.
* src/pshinter/pshglob.h (PSH_Blue_Align): Replaced with ...
(PSH_BLUE_ALIGN_{NONE,TOP,BOT}): New defines.
(PSH_AlignmentRec): Updated.
* include/freetype/internal/ftstream.h (GET_Char, GET_Byte): Fix
typo.
* include/freetype/internal/ftgloadr.h (FT_SubGlyph): Ditto.
* src/base/ftstream (FT_Get_Char): Rename to...
(FT_Stream_Get_Char): This.
* src/base/ftnames.c (FT_Get_Sfnt_Name): s/index/idx/ -- `index' is
a built-in function in gcc, causing warning messages with gcc 3.0.
* src/autohint/ahglyph.c (ah_outline_load): Ditto.
* src/autohint/ahglobal.c (ah_hinter_compute_blues): Ditto.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
ftc_family_table_free, FTC_Manager_Done, FTC_Manager_Register_Cache):
Ditto.
* src/cff/cffload.c (cff_new_index, cff_done_index,
cff_explicit_index, CFF_Access_Element, CFF_Forget_Element,
CFF_Get_Name, CFF_Get_String, CFF_Load_SubFont, CFF_Load_Font,
CFF_Done_Font): Ditto.
* src/psaux/psobjs.c (PS_Table_Add, PS_Parser_LoadField): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_clear_bit,
ps_mask_set_bit, ps_dimension_add_t1stem, ps_hints_t1stem3,
* src/pshinter/pshalgo1.c (psh1_hint_table_record,
psh1_hint_table_record_mask, psh1_hint_table_activate_mask): Ditto.
* src/pshinter/pshalgo2.c (psh2_hint_table_record,
psh2_hint_table_record_mask, psh2_hint_table_activate_mask): Ditto.
* src/sfnt/ttpost.c (Load_Format_20, Load_Format_25,
TT_Get_PS_Name): Ditto.
* src/truetype/ttgload.c (TT_Get_Metrics, Get_HMetrics,
load_truetype_glyph): Ditto.
* src/type1/t1load.c (parse_subrs, T1_Open_Face): Ditto.
* src/type1/t1afm.c (T1_Get_Kerning): Ditto.
* include/freetype/cache/ftcmanag.h (ftc_family_table_free): Ditto.
2002-03-07 22:59:59 +01:00
|
|
|
/* idx :: The glyph index. */
|
2000-06-12 21:36:41 +02:00
|
|
|
/* */
|
|
|
|
/* <Output> */
|
|
|
|
/* bearing :: The bearing, either left side or top side. */
|
|
|
|
/* */
|
|
|
|
/* advance :: The advance width resp. advance height. */
|
|
|
|
/* */
|
|
|
|
/* <Note> */
|
|
|
|
/* This function will much probably move to another component in the */
|
|
|
|
/* near future, but I haven't decided which yet. */
|
|
|
|
/* */
|
2005-02-26 01:12:04 +01:00
|
|
|
#ifdef FT_OPTIMIZE_MEMORY
|
2005-03-01 03:13:50 +01:00
|
|
|
|
2005-02-26 01:12:04 +01:00
|
|
|
static void
|
2005-03-01 03:13:50 +01:00
|
|
|
tt_face_get_metrics( TT_Face face,
|
|
|
|
FT_Bool vertical,
|
|
|
|
FT_UInt idx,
|
|
|
|
FT_Short *abearing,
|
|
|
|
FT_UShort *aadvance )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2005-02-26 01:12:04 +01:00
|
|
|
TT_HoriHeader* header;
|
|
|
|
FT_Byte* p;
|
|
|
|
FT_Byte* limit;
|
|
|
|
FT_UShort k;
|
|
|
|
|
2005-03-01 03:13:50 +01:00
|
|
|
|
2005-02-26 01:12:04 +01:00
|
|
|
if ( vertical )
|
|
|
|
{
|
|
|
|
header = (TT_HoriHeader*)&face->vertical;
|
|
|
|
p = face->vert_metrics;
|
|
|
|
limit = p + face->vert_metrics_size;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
header = &face->horizontal;
|
|
|
|
p = face->horz_metrics;
|
|
|
|
limit = p + face->horz_metrics_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
k = header->number_Of_HMetrics;
|
|
|
|
|
|
|
|
if ( k > 0 )
|
|
|
|
{
|
|
|
|
if ( idx < (FT_UInt)k )
|
|
|
|
{
|
2005-03-01 03:13:50 +01:00
|
|
|
p += 4 * idx;
|
|
|
|
if ( p + 4 >= limit )
|
2005-02-26 01:12:04 +01:00
|
|
|
goto NoData;
|
|
|
|
|
2005-03-01 03:13:50 +01:00
|
|
|
*aadvance = FT_NEXT_USHORT( p );
|
|
|
|
*abearing = FT_NEXT_SHORT( p );
|
2005-02-26 01:12:04 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-03-01 03:13:50 +01:00
|
|
|
p += 4 * ( k - 1 );
|
|
|
|
if ( p + 4 > limit )
|
2005-02-26 01:12:04 +01:00
|
|
|
goto NoData;
|
|
|
|
|
2005-03-01 03:13:50 +01:00
|
|
|
*aadvance = FT_NEXT_USHORT( p );
|
|
|
|
p += 2 + 2 * ( idx - k );
|
|
|
|
if ( p + 2 > limit )
|
2005-02-26 01:12:04 +01:00
|
|
|
*abearing = 0;
|
|
|
|
else
|
2005-03-01 03:13:50 +01:00
|
|
|
*abearing = FT_PEEK_SHORT( p );
|
2005-02-26 01:12:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
NoData:
|
|
|
|
*abearing = 0;
|
|
|
|
*aadvance = 0;
|
|
|
|
}
|
|
|
|
}
|
2005-03-01 03:13:50 +01:00
|
|
|
|
|
|
|
#else /* !FT_OPTIMIZE_MEMORY */
|
|
|
|
|
2005-02-26 01:12:04 +01:00
|
|
|
static void
|
2005-03-01 03:13:50 +01:00
|
|
|
tt_face_get_metrics( TT_Face face,
|
|
|
|
FT_Bool vertical,
|
|
|
|
FT_UInt idx,
|
|
|
|
FT_Short *abearing,
|
|
|
|
FT_UShort *aadvance )
|
2005-02-26 01:12:04 +01:00
|
|
|
{
|
2005-03-01 03:13:50 +01:00
|
|
|
TT_HoriHeader* header = vertical ? (TT_HoriHeader*)&face->vertical
|
|
|
|
: &face->horizontal;
|
2002-04-01 16:25:28 +02:00
|
|
|
TT_LongMetrics longs_m;
|
2005-03-01 03:13:50 +01:00
|
|
|
FT_UShort k = header->number_Of_HMetrics;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
2002-09-05 17:10:54 +02:00
|
|
|
if ( k == 0 )
|
2002-08-21 19:36:20 +02:00
|
|
|
{
|
2005-02-26 01:12:04 +01:00
|
|
|
*abearing = *aadvance = 0;
|
2002-08-21 19:36:20 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
* src/base/ftdbgmem.c (ft_mem_table_resize, ft_mem_table_new,
ft_mem_table_set, ft_mem_debug_alloc, ft_mem_debug_free,
ft_mem_debug_realloc, ft_mem_debug_done, FT_Alloc_Debug,
FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings.
* src/base/ftcalc.c (FT_MulFix): Ditto.
* src/cff/cffdrivr.c (cff_get_name_index): Ditto.
* src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init,
CFF_GlyphSlot_Init): Ditto.
* src/cid/cidobjs.c (CID_GlyphSlot_Init,
CID_Size_Get_Globals_Funcs): Ditto.
* src/type1/t1objs.c (T1_Size_Get_Globals_Funcs, T1_GlyphSlot_Init):
Ditto.
* src/pshinter/pshmod.c (pshinter_interface): Use `static const'.
* src/winfonts/winfnt.c (FNT_Get_Next_Char): Remove unused
variables.
* include/freetype/internal/psaux.h (T1_Builder_Funcs): Renamed
to...
(T1_Builder_FuncsRec): This.
(T1_Builder_Funcs): New typedef.
(PSAux_Interface): Remove compiler warnings.
* src/psaux/psauxmod.c (t1_builder_funcs), src/psaux/psobjs.h
(t1_builder_funcs): Updated.
* src/pshinter/pshglob.h (PSH_Blue_Align): Replaced with ...
(PSH_BLUE_ALIGN_{NONE,TOP,BOT}): New defines.
(PSH_AlignmentRec): Updated.
* include/freetype/internal/ftstream.h (GET_Char, GET_Byte): Fix
typo.
* include/freetype/internal/ftgloadr.h (FT_SubGlyph): Ditto.
* src/base/ftstream (FT_Get_Char): Rename to...
(FT_Stream_Get_Char): This.
* src/base/ftnames.c (FT_Get_Sfnt_Name): s/index/idx/ -- `index' is
a built-in function in gcc, causing warning messages with gcc 3.0.
* src/autohint/ahglyph.c (ah_outline_load): Ditto.
* src/autohint/ahglobal.c (ah_hinter_compute_blues): Ditto.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
ftc_family_table_free, FTC_Manager_Done, FTC_Manager_Register_Cache):
Ditto.
* src/cff/cffload.c (cff_new_index, cff_done_index,
cff_explicit_index, CFF_Access_Element, CFF_Forget_Element,
CFF_Get_Name, CFF_Get_String, CFF_Load_SubFont, CFF_Load_Font,
CFF_Done_Font): Ditto.
* src/psaux/psobjs.c (PS_Table_Add, PS_Parser_LoadField): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_clear_bit,
ps_mask_set_bit, ps_dimension_add_t1stem, ps_hints_t1stem3,
* src/pshinter/pshalgo1.c (psh1_hint_table_record,
psh1_hint_table_record_mask, psh1_hint_table_activate_mask): Ditto.
* src/pshinter/pshalgo2.c (psh2_hint_table_record,
psh2_hint_table_record_mask, psh2_hint_table_activate_mask): Ditto.
* src/sfnt/ttpost.c (Load_Format_20, Load_Format_25,
TT_Get_PS_Name): Ditto.
* src/truetype/ttgload.c (TT_Get_Metrics, Get_HMetrics,
load_truetype_glyph): Ditto.
* src/type1/t1load.c (parse_subrs, T1_Open_Face): Ditto.
* src/type1/t1afm.c (T1_Get_Kerning): Ditto.
* include/freetype/cache/ftcmanag.h (ftc_family_table_free): Ditto.
2002-03-07 22:59:59 +01:00
|
|
|
if ( idx < (FT_UInt)k )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2005-03-01 03:13:50 +01:00
|
|
|
longs_m = (TT_LongMetrics)header->long_metrics + idx;
|
2005-02-26 01:12:04 +01:00
|
|
|
*abearing = longs_m->bearing;
|
|
|
|
*aadvance = longs_m->advance;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-02-26 01:12:04 +01:00
|
|
|
*abearing = ((TT_ShortMetrics*)header->short_metrics)[idx - k];
|
2005-03-01 03:13:50 +01:00
|
|
|
*aadvance = ((TT_LongMetrics)header->long_metrics)[k - 1].advance;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
}
|
2005-03-01 03:13:50 +01:00
|
|
|
|
|
|
|
#endif /* !FT_OPTIMIZE_MEMORY */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
2000-06-12 21:36:41 +02:00
|
|
|
/* */
|
2000-06-25 09:43:15 +02:00
|
|
|
/* Returns the horizontal metrics in font units for a given glyph. If */
|
|
|
|
/* `check' is true, take care of monospaced fonts by returning the */
|
|
|
|
/* advance width maximum. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2001-06-28 09:17:51 +02:00
|
|
|
static void
|
|
|
|
Get_HMetrics( TT_Face face,
|
* src/base/ftdbgmem.c (ft_mem_table_resize, ft_mem_table_new,
ft_mem_table_set, ft_mem_debug_alloc, ft_mem_debug_free,
ft_mem_debug_realloc, ft_mem_debug_done, FT_Alloc_Debug,
FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings.
* src/base/ftcalc.c (FT_MulFix): Ditto.
* src/cff/cffdrivr.c (cff_get_name_index): Ditto.
* src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init,
CFF_GlyphSlot_Init): Ditto.
* src/cid/cidobjs.c (CID_GlyphSlot_Init,
CID_Size_Get_Globals_Funcs): Ditto.
* src/type1/t1objs.c (T1_Size_Get_Globals_Funcs, T1_GlyphSlot_Init):
Ditto.
* src/pshinter/pshmod.c (pshinter_interface): Use `static const'.
* src/winfonts/winfnt.c (FNT_Get_Next_Char): Remove unused
variables.
* include/freetype/internal/psaux.h (T1_Builder_Funcs): Renamed
to...
(T1_Builder_FuncsRec): This.
(T1_Builder_Funcs): New typedef.
(PSAux_Interface): Remove compiler warnings.
* src/psaux/psauxmod.c (t1_builder_funcs), src/psaux/psobjs.h
(t1_builder_funcs): Updated.
* src/pshinter/pshglob.h (PSH_Blue_Align): Replaced with ...
(PSH_BLUE_ALIGN_{NONE,TOP,BOT}): New defines.
(PSH_AlignmentRec): Updated.
* include/freetype/internal/ftstream.h (GET_Char, GET_Byte): Fix
typo.
* include/freetype/internal/ftgloadr.h (FT_SubGlyph): Ditto.
* src/base/ftstream (FT_Get_Char): Rename to...
(FT_Stream_Get_Char): This.
* src/base/ftnames.c (FT_Get_Sfnt_Name): s/index/idx/ -- `index' is
a built-in function in gcc, causing warning messages with gcc 3.0.
* src/autohint/ahglyph.c (ah_outline_load): Ditto.
* src/autohint/ahglobal.c (ah_hinter_compute_blues): Ditto.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
ftc_family_table_free, FTC_Manager_Done, FTC_Manager_Register_Cache):
Ditto.
* src/cff/cffload.c (cff_new_index, cff_done_index,
cff_explicit_index, CFF_Access_Element, CFF_Forget_Element,
CFF_Get_Name, CFF_Get_String, CFF_Load_SubFont, CFF_Load_Font,
CFF_Done_Font): Ditto.
* src/psaux/psobjs.c (PS_Table_Add, PS_Parser_LoadField): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_clear_bit,
ps_mask_set_bit, ps_dimension_add_t1stem, ps_hints_t1stem3,
* src/pshinter/pshalgo1.c (psh1_hint_table_record,
psh1_hint_table_record_mask, psh1_hint_table_activate_mask): Ditto.
* src/pshinter/pshalgo2.c (psh2_hint_table_record,
psh2_hint_table_record_mask, psh2_hint_table_activate_mask): Ditto.
* src/sfnt/ttpost.c (Load_Format_20, Load_Format_25,
TT_Get_PS_Name): Ditto.
* src/truetype/ttgload.c (TT_Get_Metrics, Get_HMetrics,
load_truetype_glyph): Ditto.
* src/type1/t1load.c (parse_subrs, T1_Open_Face): Ditto.
* src/type1/t1afm.c (T1_Get_Kerning): Ditto.
* include/freetype/cache/ftcmanag.h (ftc_family_table_free): Ditto.
2002-03-07 22:59:59 +01:00
|
|
|
FT_UInt idx,
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_Bool check,
|
|
|
|
FT_Short* lsb,
|
|
|
|
FT_UShort* aw )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2005-02-26 01:12:04 +01:00
|
|
|
tt_face_get_metrics( face, 0, idx, lsb, aw );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
if ( check && face->postscript.isFixedPitch )
|
|
|
|
*aw = face->horizontal.advance_Width_Max;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
2000-06-12 21:36:41 +02:00
|
|
|
/* */
|
2002-04-01 16:25:28 +02:00
|
|
|
/* Returns the advance width table for a given pixel size if it is found */
|
|
|
|
/* in the font's `hdmx' table (if any). */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2001-06-28 09:17:51 +02:00
|
|
|
static FT_Byte*
|
2005-02-26 01:12:04 +01:00
|
|
|
Get_Advance_WidthPtr( TT_Face face,
|
|
|
|
FT_Int ppem,
|
|
|
|
FT_UInt gindex )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2005-02-26 01:12:04 +01:00
|
|
|
#ifdef FT_OPTIMIZE_MEMORY
|
2005-03-01 03:13:50 +01:00
|
|
|
|
2005-02-26 01:12:04 +01:00
|
|
|
FT_UInt nn;
|
2005-03-01 03:13:50 +01:00
|
|
|
FT_Byte* result = NULL;
|
2005-02-26 01:12:04 +01:00
|
|
|
FT_ULong record_size = face->hdmx_record_size;
|
|
|
|
FT_Byte* record = face->hdmx_table + 8;
|
|
|
|
|
2005-03-01 03:13:50 +01:00
|
|
|
|
2005-02-26 01:12:04 +01:00
|
|
|
for ( nn = 0; nn < face->hdmx_record_count; nn++ )
|
|
|
|
if ( face->hdmx_record_sizes[nn] == ppem )
|
|
|
|
{
|
|
|
|
gindex += 2;
|
|
|
|
if ( gindex < record_size )
|
|
|
|
result = record + gindex;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
2005-03-01 03:13:50 +01:00
|
|
|
|
2005-02-26 01:12:04 +01:00
|
|
|
#else
|
2005-03-01 03:13:50 +01:00
|
|
|
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_UShort n;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
for ( n = 0; n < face->hdmx.num_records; n++ )
|
|
|
|
if ( face->hdmx.records[n].ppem == ppem )
|
2005-02-26 01:12:04 +01:00
|
|
|
return &face->hdmx.records[n].widths[gindex];
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
return NULL;
|
2005-03-01 03:13:50 +01:00
|
|
|
|
2005-02-26 01:12:04 +01:00
|
|
|
#endif
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Returns the vertical metrics in font units for a given glyph. */
|
|
|
|
/* Greg Hitchcock from Microsoft told us that if there were no `vmtx' */
|
|
|
|
/* table, typoAscender/Descender from the `OS/2' table would be used */
|
|
|
|
/* instead, and if there were no `OS/2' table, use ascender/descender */
|
|
|
|
/* from the `hhea' table. But that is not what Microsoft's rasterizer */
|
|
|
|
/* apparently does: It uses the ppem value as the advance height, and */
|
|
|
|
/* sets the top side bearing to be zero. */
|
|
|
|
/* */
|
|
|
|
/* The monospace `check' is probably not meaningful here, but we leave */
|
|
|
|
/* it in for a consistent interface. */
|
|
|
|
/* */
|
|
|
|
static void
|
|
|
|
Get_VMetrics( TT_Face face,
|
|
|
|
FT_UInt idx,
|
|
|
|
FT_Bool check,
|
|
|
|
FT_Short* tsb,
|
|
|
|
FT_UShort* ah )
|
|
|
|
{
|
|
|
|
FT_UNUSED( check );
|
|
|
|
|
|
|
|
if ( face->vertical_info )
|
2005-02-26 01:12:04 +01:00
|
|
|
tt_face_get_metrics( face, 1, idx, tsb, ah );
|
2004-03-27 09:43:17 +01:00
|
|
|
|
|
|
|
#if 1 /* Emperically determined, at variance with what MS said */
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*tsb = 0;
|
|
|
|
*ah = face->root.units_per_EM;
|
|
|
|
}
|
|
|
|
|
|
|
|
#else /* This is what MS said to do. It isn't what they do, however. */
|
|
|
|
|
|
|
|
else if ( face->os2.version != 0xFFFFU )
|
|
|
|
{
|
|
|
|
*tsb = face->os2.sTypoAscender;
|
|
|
|
*ah = face->os2.sTypoAscender - face->os2.sTypoDescender;
|
|
|
|
}
|
2004-06-21 23:16:56 +02:00
|
|
|
else
|
2004-03-27 09:43:17 +01:00
|
|
|
{
|
|
|
|
*tsb = face->horizontal.Ascender;
|
|
|
|
*ah = face->horizontal.Ascender - face->horizontal.Descender;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-02 15:53:16 +02:00
|
|
|
#define cur_to_org( n, zone ) \
|
2004-01-15 20:07:44 +01:00
|
|
|
FT_ARRAY_COPY( (zone)->org, (zone)->cur, (n) )
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-07-02 15:53:16 +02:00
|
|
|
#define org_to_cur( n, zone ) \
|
2004-01-15 20:07:44 +01:00
|
|
|
FT_ARRAY_COPY( (zone)->cur, (zone)->org, (n) )
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
2000-06-12 21:36:41 +02:00
|
|
|
/* */
|
2002-04-01 16:25:28 +02:00
|
|
|
/* Translates an array of coordinates. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2001-06-28 09:17:51 +02:00
|
|
|
static void
|
|
|
|
translate_array( FT_UInt n,
|
|
|
|
FT_Vector* coords,
|
|
|
|
FT_Pos delta_x,
|
|
|
|
FT_Pos delta_y )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_UInt k;
|
2000-06-12 21:36:41 +02:00
|
|
|
|
2000-07-02 15:53:16 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
if ( delta_x )
|
|
|
|
for ( k = 0; k < n; k++ )
|
|
|
|
coords[k].x += delta_x;
|
|
|
|
|
|
|
|
if ( delta_y )
|
|
|
|
for ( k = 0; k < n; k++ )
|
|
|
|
coords[k].y += delta_y;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-28 09:17:51 +02:00
|
|
|
static void
|
2002-04-01 16:25:28 +02:00
|
|
|
tt_prepare_zone( TT_GlyphZone zone,
|
|
|
|
FT_GlyphLoad load,
|
|
|
|
FT_UInt start_point,
|
|
|
|
FT_UInt start_contour )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2001-06-20 01:03:41 +02:00
|
|
|
zone->n_points = (FT_UShort)( load->outline.n_points - start_point );
|
|
|
|
zone->n_contours = (FT_Short) ( load->outline.n_contours - start_contour );
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
zone->org = load->extra_points + start_point;
|
|
|
|
zone->cur = load->outline.points + start_point;
|
|
|
|
zone->tags = (FT_Byte*)load->outline.tags + start_point;
|
|
|
|
zone->contours = (FT_UShort*)load->outline.contours + start_contour;
|
2000-07-05 06:32:02 +02:00
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
#undef IS_HINTED
|
2000-06-12 21:36:41 +02:00
|
|
|
#define IS_HINTED( flags ) ( ( flags & FT_LOAD_NO_HINTING ) == 0 )
|
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
2002-04-01 16:25:28 +02:00
|
|
|
/* The following functions are used by default with TrueType fonts. */
|
|
|
|
/* However, they can be replaced by alternatives if we need to support */
|
|
|
|
/* TrueType-compressed formats (like MicroType) in the future. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2000-06-25 08:47:11 +02:00
|
|
|
/*************************************************************************/
|
2000-06-23 14:26:14 +02:00
|
|
|
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2002-04-01 16:25:28 +02:00
|
|
|
TT_Access_Glyph_Frame( TT_Loader loader,
|
|
|
|
FT_UInt glyph_index,
|
|
|
|
FT_ULong offset,
|
|
|
|
FT_UInt byte_count )
|
2000-06-23 14:26:14 +02:00
|
|
|
{
|
2000-07-31 20:59:02 +02:00
|
|
|
FT_Error error;
|
|
|
|
FT_Stream stream = loader->stream;
|
|
|
|
|
2000-08-29 20:58:41 +02:00
|
|
|
/* for non-debug mode */
|
|
|
|
FT_UNUSED( glyph_index );
|
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2000-07-31 20:59:02 +02:00
|
|
|
FT_TRACE5(( "Glyph %ld\n", glyph_index ));
|
2000-06-25 08:47:11 +02:00
|
|
|
|
|
|
|
/* the following line sets the `error' variable through macros! */
|
2002-03-20 11:49:31 +01:00
|
|
|
if ( FT_STREAM_SEEK( offset ) || FT_FRAME_ENTER( byte_count ) )
|
2000-07-31 20:59:02 +02:00
|
|
|
return error;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2000-07-31 20:59:02 +02:00
|
|
|
return TT_Err_Ok;
|
2000-07-05 06:32:02 +02:00
|
|
|
}
|
2000-06-23 14:26:14 +02:00
|
|
|
|
|
|
|
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_CALLBACK_DEF( void )
|
2002-04-01 16:25:28 +02:00
|
|
|
TT_Forget_Glyph_Frame( TT_Loader loader )
|
2000-06-23 14:26:14 +02:00
|
|
|
{
|
|
|
|
FT_Stream stream = loader->stream;
|
2000-06-25 08:47:11 +02:00
|
|
|
|
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
FT_FRAME_EXIT();
|
2000-07-05 06:32:02 +02:00
|
|
|
}
|
2000-06-23 14:26:14 +02:00
|
|
|
|
|
|
|
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2002-04-01 16:25:28 +02:00
|
|
|
TT_Load_Glyph_Header( TT_Loader loader )
|
2000-06-23 14:26:14 +02:00
|
|
|
{
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Stream stream = loader->stream;
|
|
|
|
FT_Int byte_len = loader->byte_len - 10;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2002-01-06 17:42:44 +01:00
|
|
|
|
2002-01-06 11:13:40 +01:00
|
|
|
if ( byte_len < 0 )
|
|
|
|
return TT_Err_Invalid_Outline;
|
2000-06-25 08:47:11 +02:00
|
|
|
|
* include/freetype/internal/ftstream.h,
src/base/ftstream.c, src/cff/cffload.c, src/pcf/pcfread.c,
src/sfnt/ttcmap.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c,
src/sfnt/ttpost.c, src/sfnt/ttsbit.c,
src/truetype/ttgload.c, src/truetype/ttpload.c,
src/winfonts/winfnt.c:
changed the definitions of stream macros. Examples:
NEXT_Byte => FT_NEXT_BYTE
NEXT_Short => FT_NEXT_SHORT
NEXT_UShortLE => FT_NEXT_USHORT_LE
READ_Short => FT_READ_SHORT
GET_Long => FT_GET_LONG
etc..
also introduced the FT_PEEK_XXXX functions..
2002-03-22 13:55:23 +01:00
|
|
|
loader->n_contours = FT_GET_SHORT();
|
2000-06-23 14:26:14 +02:00
|
|
|
|
* include/freetype/internal/ftstream.h,
src/base/ftstream.c, src/cff/cffload.c, src/pcf/pcfread.c,
src/sfnt/ttcmap.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c,
src/sfnt/ttpost.c, src/sfnt/ttsbit.c,
src/truetype/ttgload.c, src/truetype/ttpload.c,
src/winfonts/winfnt.c:
changed the definitions of stream macros. Examples:
NEXT_Byte => FT_NEXT_BYTE
NEXT_Short => FT_NEXT_SHORT
NEXT_UShortLE => FT_NEXT_USHORT_LE
READ_Short => FT_READ_SHORT
GET_Long => FT_GET_LONG
etc..
also introduced the FT_PEEK_XXXX functions..
2002-03-22 13:55:23 +01:00
|
|
|
loader->bbox.xMin = FT_GET_SHORT();
|
|
|
|
loader->bbox.yMin = FT_GET_SHORT();
|
|
|
|
loader->bbox.xMax = FT_GET_SHORT();
|
|
|
|
loader->bbox.yMax = FT_GET_SHORT();
|
2000-06-23 14:26:14 +02:00
|
|
|
|
|
|
|
FT_TRACE5(( " # of contours: %d\n", loader->n_contours ));
|
|
|
|
FT_TRACE5(( " xMin: %4d xMax: %4d\n", loader->bbox.xMin,
|
|
|
|
loader->bbox.xMax ));
|
|
|
|
FT_TRACE5(( " yMin: %4d yMax: %4d\n", loader->bbox.yMin,
|
|
|
|
loader->bbox.yMax ));
|
2002-01-06 11:13:40 +01:00
|
|
|
loader->byte_len = byte_len;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
* README: Formatting.
* Jamfile: Fix typo.
* src/cff/cffparse.c: Move error code #defines to...
* include/freetype/internal/cfferrs.h: This file.
* src/cff/cffdrivr.c, src/cff/cffobjs.c, src/cff/cffload.c: Replaced
`FT_Err_*' with `CFF_Err_*'.
* src/cid/cidparse.c: Replaced `FT_Err_*' with `T1_Err_*'.
* src/psaux/psobjs.c, src/psaux/t1decode.c: Ditto.
* src/sfnt/sfobcs.c, src/sfnt/ttload.c: Replaced `FT_Err_*' with
`TT_Err_*'.
* src/truetype/ttgload.c, src/truetype/ttobjs.c: Ditto.
* src/type1/t1gload.c, src/type1/t1load.c, src/type1/t1objs.c,
src/type1/t1parse.c: Replaced `FT_Err_*' with `T1_Err_*'.
* include/freetype/internal/cfferrs.h: Add
`CFF_Err_Unknown_File_Format'.
* include/freetype/internal/t1errors.h: Add
`T1_Err_Unknown_File_Format'.
* include/freetype/internal/tterrors.h: Add
`TT_Err_Unknown_File_Format'.
* src/cff/cffload.h: Add `cff_*_encoding' and `cff_*_charset'
references.
* src/psaux/psobjs.c: Include `FT_INTERNAL_TYPE1_ERRORS_H'.
* src/cff/cffobjs.c (CFF_Init_Face, CFF_Done_Face): Use
FT_LOCAL_DEF.
* src/cid/cidobjs.c (CID_Done_Driver): Ditto.
* src/trutype/ttobjs.c (TT_Init_Face, TT_Done_Face, TT_Init_Size):
Ditto.
* src/type1/t1objs.c (T1_Done_Driver): Ditto.
* src/pcf/pcfdriver.c (PCF_Done_Face): Ditto.
* src/pcf/pcf.h: Use FT_LOCAL for `PCF_Done_Face'.
2001-04-03 01:54:01 +02:00
|
|
|
return TT_Err_Ok;
|
2000-07-05 06:32:02 +02:00
|
|
|
}
|
2000-06-23 14:26:14 +02:00
|
|
|
|
|
|
|
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2002-04-01 16:25:28 +02:00
|
|
|
TT_Load_Simple_Glyph( TT_Loader load )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Error error;
|
|
|
|
FT_Stream stream = load->stream;
|
|
|
|
FT_GlyphLoader gloader = load->gloader;
|
|
|
|
FT_Int n_contours = load->n_contours;
|
|
|
|
FT_Outline* outline;
|
|
|
|
TT_Face face = (TT_Face)load->face;
|
|
|
|
TT_GlyphSlot slot = (TT_GlyphSlot)load->glyph;
|
|
|
|
FT_UShort n_ins;
|
|
|
|
FT_Int n, n_points;
|
|
|
|
FT_Int byte_len = load->byte_len;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
FT_Byte *flag, *flag_limit;
|
|
|
|
FT_Byte c, count;
|
|
|
|
FT_Vector *vec, *vec_limit;
|
|
|
|
FT_Pos x;
|
|
|
|
FT_Short *cont, *cont_limit;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
|
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17.
* src/pcf/pcfutil.c: Use FT_LOCAL_DEF.
* src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H.
Use FT_BEGIN_HEADER and FT_END_HEADER.
Use FT_LOCAL.
2004-04-24 George Williams <gww@silcom.com>
Add support for Apple's distortable font technology (in GX fonts).
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro.
* include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style,
FT_MM_Var): New structures.
(FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New function declarations.
* include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func,
FT_Set_Var_Design_Func): New typedefs.
Update MultiMasters service.
* include/freetype/internal/tttypes.h
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H.
(GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef.
(TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend'
and `blend'.
* include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New
macros.
* include/freetype/internal/fttrace.h: Add `ttgxvar'.
* src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New functions.
* src/sfnt/sfobjs.c (sfnt_load_face)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS
flag for GX var fonts.
* src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files.
* src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.c.
* src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h.
(tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]:
New service.
(tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated.
* src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(TT_Process_Simple_Glyph, load_truetype_glyph)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts.
* src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_done_blend.
* src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_face_vary_cvt.
* src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c.
* src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var
and T1_Set_Var_Design.
* src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros.
(T1_Get_MM_Var, T1_Set_Var_Design): New functions.
* src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New
function declarations.
2004-04-25 22:15:11 +02:00
|
|
|
/* reading the contours' endpoints & number of points */
|
2003-06-09 17:54:18 +02:00
|
|
|
cont = gloader->current.outline.contours;
|
|
|
|
cont_limit = cont + n_contours;
|
2002-01-06 17:42:44 +01:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
/* check space for contours array + instructions count */
|
|
|
|
byte_len -= 2 * ( n_contours + 1 );
|
|
|
|
if ( byte_len < 0 )
|
|
|
|
goto Invalid_Outline;
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
for ( ; cont < cont_limit; cont++ )
|
|
|
|
cont[0] = FT_GET_USHORT();
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
n_points = 0;
|
|
|
|
if ( n_contours > 0 )
|
|
|
|
n_points = cont[-1] + 1;
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
error = FT_GlyphLoader_CheckPoints( gloader, n_points + 4, 0 );
|
2003-06-09 17:54:18 +02:00
|
|
|
if ( error )
|
|
|
|
goto Fail;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
/* we'd better check the contours table right now */
|
|
|
|
outline = &gloader->current.outline;
|
2002-01-06 11:13:40 +01:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
for ( cont = outline->contours + 1; cont < cont_limit; cont++ )
|
|
|
|
if ( cont[-1] >= cont[0] )
|
|
|
|
goto Invalid_Outline;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/* reading the bytecode instructions */
|
2000-06-23 07:02:13 +02:00
|
|
|
slot->control_len = 0;
|
|
|
|
slot->control_data = 0;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
* include/freetype/internal/ftstream.h,
src/base/ftstream.c, src/cff/cffload.c, src/pcf/pcfread.c,
src/sfnt/ttcmap.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c,
src/sfnt/ttpost.c, src/sfnt/ttsbit.c,
src/truetype/ttgload.c, src/truetype/ttpload.c,
src/winfonts/winfnt.c:
changed the definitions of stream macros. Examples:
NEXT_Byte => FT_NEXT_BYTE
NEXT_Short => FT_NEXT_SHORT
NEXT_UShortLE => FT_NEXT_USHORT_LE
READ_Short => FT_READ_SHORT
GET_Long => FT_GET_LONG
etc..
also introduced the FT_PEEK_XXXX functions..
2002-03-22 13:55:23 +01:00
|
|
|
n_ins = FT_GET_USHORT();
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
FT_TRACE5(( " Instructions size: %u\n", n_ins ));
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
if ( n_ins > face->max_profile.maxSizeOfInstructions )
|
|
|
|
{
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_TRACE0(( "TT_Load_Simple_Glyph: Too many instructions!\n" ));
|
Complete redesign of error codes. Please check ftmoderr.h for more
details.
* include/freetype/internal/cfferrs.h,
include/freetype/internal/tterrors.h,
include/freetype/internal/t1errors.h: Removed. Replaced with files
local to the module. All extra error codes have been moved to
`fterrors.h'.
* src/sfnt/ttpost.h: Move error codes to `fterrors.h'.
* src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h,
src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h,
src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h,
src/smooth/ftsmerrs.h, src/truetype/tterrors.h,
src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the
error names for the module it belongs to.
* include/freetype/ftmoderr.h: New file, defining the module error
offsets. Its structure is similar to `fterrors.h'.
* include/freetype/fterrors.h (FT_NOERRORDEF): New macro.
(FT_ERRORDEF): Redefined to use module error offsets.
All internal error codes are now public; unused error codes have
been removed, some are new.
* include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New
macro.
* include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro.
All other source files have been updated to use the new error codes;
some already existing (internal) error codes local to a module have
been renamed to give them the same name as in the base module.
All make files have been updated to include the local error files.
* src/cid/cidtokens.h: Replaced with...
* src/cid/cidtoken.h: This file for 8+3 consistency.
* src/raster/ftraster.c: Use macros for header file names.
2001-06-06 19:30:41 +02:00
|
|
|
error = TT_Err_Too_Many_Hints;
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Fail;
|
|
|
|
}
|
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
byte_len -= (FT_Int)n_ins;
|
2002-01-06 11:13:40 +01:00
|
|
|
if ( byte_len < 0 )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_TRACE0(( "TT_Load_Simple_Glyph: Instruction count mismatch!\n" ));
|
Complete redesign of error codes. Please check ftmoderr.h for more
details.
* include/freetype/internal/cfferrs.h,
include/freetype/internal/tterrors.h,
include/freetype/internal/t1errors.h: Removed. Replaced with files
local to the module. All extra error codes have been moved to
`fterrors.h'.
* src/sfnt/ttpost.h: Move error codes to `fterrors.h'.
* src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h,
src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h,
src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h,
src/smooth/ftsmerrs.h, src/truetype/tterrors.h,
src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the
error names for the module it belongs to.
* include/freetype/ftmoderr.h: New file, defining the module error
offsets. Its structure is similar to `fterrors.h'.
* include/freetype/fterrors.h (FT_NOERRORDEF): New macro.
(FT_ERRORDEF): Redefined to use module error offsets.
All internal error codes are now public; unused error codes have
been removed, some are new.
* include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New
macro.
* include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro.
All other source files have been updated to use the new error codes;
some already existing (internal) error codes local to a module have
been renamed to give them the same name as in the base module.
All make files have been updated to include the local error files.
* src/cid/cidtokens.h: Replaced with...
* src/cid/cidtoken.h: This file for 8+3 consistency.
* src/raster/ftraster.c: Use macros for header file names.
2001-06-06 19:30:41 +02:00
|
|
|
error = TT_Err_Too_Many_Hints;
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Fail;
|
|
|
|
}
|
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
2000-06-25 08:47:11 +02:00
|
|
|
|
|
|
|
if ( ( load->load_flags &
|
2000-06-23 07:02:13 +02:00
|
|
|
( FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING ) ) == 0 &&
|
|
|
|
load->instructions )
|
2000-02-21 17:01:33 +01:00
|
|
|
{
|
2000-06-23 07:02:13 +02:00
|
|
|
slot->control_len = n_ins;
|
|
|
|
slot->control_data = load->instructions;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
FT_MEM_COPY( load->instructions, stream->cursor, (FT_Long)n_ins );
|
2000-02-21 17:01:33 +01:00
|
|
|
}
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
stream->cursor += (FT_Int)n_ins;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/* reading the point tags */
|
2003-06-09 17:54:18 +02:00
|
|
|
flag = (FT_Byte*)outline->tags;
|
|
|
|
flag_limit = flag + n_points;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2004-10-13 07:15:44 +02:00
|
|
|
FT_ASSERT( flag != NULL );
|
|
|
|
|
2003-12-31 09:48:21 +01:00
|
|
|
while ( flag < flag_limit )
|
2003-06-09 17:54:18 +02:00
|
|
|
{
|
|
|
|
if ( --byte_len < 0 )
|
|
|
|
goto Invalid_Outline;
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
*flag++ = c = FT_GET_BYTE();
|
|
|
|
if ( c & 8 )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2002-01-06 11:13:40 +01:00
|
|
|
if ( --byte_len < 0 )
|
|
|
|
goto Invalid_Outline;
|
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
count = FT_GET_BYTE();
|
|
|
|
if ( flag + (FT_Int)count > flag_limit )
|
|
|
|
goto Invalid_Outline;
|
2002-01-06 11:13:40 +01:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
for ( ; count > 0; count-- )
|
|
|
|
*flag++ = c;
|
2002-01-06 11:13:40 +01:00
|
|
|
}
|
2003-06-09 17:54:18 +02:00
|
|
|
}
|
2002-01-06 11:13:40 +01:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
/* check that there is enough room to load the coordinates */
|
|
|
|
for ( flag = (FT_Byte*)outline->tags; flag < flag_limit; flag++ )
|
|
|
|
{
|
|
|
|
if ( *flag & 2 )
|
|
|
|
byte_len -= 1;
|
|
|
|
else if ( ( *flag & 16 ) == 0 )
|
|
|
|
byte_len -= 2;
|
|
|
|
|
|
|
|
if ( *flag & 4 )
|
|
|
|
byte_len -= 1;
|
|
|
|
else if ( ( *flag & 32 ) == 0 )
|
|
|
|
byte_len -= 2;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
if ( byte_len < 0 )
|
|
|
|
goto Invalid_Outline;
|
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/* reading the X coordinates */
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
vec = outline->points;
|
|
|
|
vec_limit = vec + n_points;
|
|
|
|
flag = (FT_Byte*)outline->tags;
|
|
|
|
x = 0;
|
|
|
|
|
|
|
|
for ( ; vec < vec_limit; vec++, flag++ )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2003-06-09 17:54:18 +02:00
|
|
|
FT_Pos y = 0;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
if ( *flag & 2 )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2003-06-09 17:54:18 +02:00
|
|
|
y = (FT_Pos)FT_GET_BYTE();
|
|
|
|
if ( ( *flag & 16 ) == 0 )
|
|
|
|
y = -y;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
2003-06-09 17:54:18 +02:00
|
|
|
else if ( ( *flag & 16 ) == 0 )
|
|
|
|
y = (FT_Pos)FT_GET_SHORT();
|
|
|
|
|
|
|
|
x += y;
|
|
|
|
vec->x = x;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/* reading the Y coordinates */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
vec = gloader->current.outline.points;
|
|
|
|
vec_limit = vec + n_points;
|
|
|
|
flag = (FT_Byte*)outline->tags;
|
|
|
|
x = 0;
|
|
|
|
|
|
|
|
for ( ; vec < vec_limit; vec++, flag++ )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2003-06-09 17:54:18 +02:00
|
|
|
FT_Pos y = 0;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
|
2003-06-09 17:54:18 +02:00
|
|
|
if ( *flag & 4 )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2003-06-09 17:54:18 +02:00
|
|
|
y = (FT_Pos)FT_GET_BYTE();
|
|
|
|
if ( ( *flag & 32 ) == 0 )
|
|
|
|
y = -y;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
2003-06-09 17:54:18 +02:00
|
|
|
else if ( ( *flag & 32 ) == 0 )
|
|
|
|
y = (FT_Pos)FT_GET_SHORT();
|
|
|
|
|
|
|
|
x += y;
|
|
|
|
vec->y = x;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
2000-06-23 07:02:13 +02:00
|
|
|
/* clear the touch tags */
|
|
|
|
for ( n = 0; n < n_points; n++ )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
outline->tags[n] &= FT_CURVE_TAG_ON;
|
2000-06-23 07:02:13 +02:00
|
|
|
|
2001-06-19 10:28:24 +02:00
|
|
|
outline->n_points = (FT_UShort)n_points;
|
|
|
|
outline->n_contours = (FT_Short) n_contours;
|
2000-06-23 14:26:14 +02:00
|
|
|
|
2002-01-06 11:13:40 +01:00
|
|
|
load->byte_len = byte_len;
|
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
Fail:
|
2000-06-23 07:02:13 +02:00
|
|
|
return error;
|
2002-01-06 11:13:40 +01:00
|
|
|
|
|
|
|
Invalid_Outline:
|
|
|
|
error = TT_Err_Invalid_Outline;
|
|
|
|
goto Fail;
|
2000-06-23 14:26:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2002-04-01 16:25:28 +02:00
|
|
|
TT_Load_Composite_Glyph( TT_Loader loader )
|
2000-06-23 14:26:14 +02:00
|
|
|
{
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Error error;
|
|
|
|
FT_Stream stream = loader->stream;
|
|
|
|
FT_GlyphLoader gloader = loader->gloader;
|
2002-03-14 13:56:35 +01:00
|
|
|
FT_SubGlyph subglyph;
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_UInt num_subglyphs;
|
|
|
|
FT_Int byte_len = loader->byte_len;
|
2000-06-23 14:26:14 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-06-23 14:26:14 +02:00
|
|
|
num_subglyphs = 0;
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-06-23 14:26:14 +02:00
|
|
|
do
|
|
|
|
{
|
|
|
|
FT_Fixed xx, xy, yy, yx;
|
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-06-23 14:26:14 +02:00
|
|
|
/* check that we can load a new subglyph */
|
2002-03-14 13:56:35 +01:00
|
|
|
error = FT_GlyphLoader_CheckSubGlyphs( gloader, num_subglyphs + 1 );
|
2000-06-25 08:47:11 +02:00
|
|
|
if ( error )
|
|
|
|
goto Fail;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2002-01-06 17:42:44 +01:00
|
|
|
/* check space */
|
2002-01-06 11:13:40 +01:00
|
|
|
byte_len -= 4;
|
|
|
|
if ( byte_len < 0 )
|
|
|
|
goto Invalid_Composite;
|
|
|
|
|
2000-06-23 14:26:14 +02:00
|
|
|
subglyph = gloader->current.subglyphs + num_subglyphs;
|
|
|
|
|
|
|
|
subglyph->arg1 = subglyph->arg2 = 0;
|
|
|
|
|
* include/freetype/internal/ftstream.h,
src/base/ftstream.c, src/cff/cffload.c, src/pcf/pcfread.c,
src/sfnt/ttcmap.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c,
src/sfnt/ttpost.c, src/sfnt/ttsbit.c,
src/truetype/ttgload.c, src/truetype/ttpload.c,
src/winfonts/winfnt.c:
changed the definitions of stream macros. Examples:
NEXT_Byte => FT_NEXT_BYTE
NEXT_Short => FT_NEXT_SHORT
NEXT_UShortLE => FT_NEXT_USHORT_LE
READ_Short => FT_READ_SHORT
GET_Long => FT_GET_LONG
etc..
also introduced the FT_PEEK_XXXX functions..
2002-03-22 13:55:23 +01:00
|
|
|
subglyph->flags = FT_GET_USHORT();
|
|
|
|
subglyph->index = FT_GET_USHORT();
|
2000-06-23 14:26:14 +02:00
|
|
|
|
2002-01-06 17:42:44 +01:00
|
|
|
/* check space */
|
2002-01-06 11:13:40 +01:00
|
|
|
byte_len -= 2;
|
|
|
|
if ( subglyph->flags & ARGS_ARE_WORDS )
|
|
|
|
byte_len -= 2;
|
|
|
|
if ( subglyph->flags & WE_HAVE_A_SCALE )
|
|
|
|
byte_len -= 2;
|
|
|
|
else if ( subglyph->flags & WE_HAVE_AN_XY_SCALE )
|
|
|
|
byte_len -= 4;
|
|
|
|
else if ( subglyph->flags & WE_HAVE_A_2X2 )
|
|
|
|
byte_len -= 8;
|
|
|
|
|
|
|
|
if ( byte_len < 0 )
|
|
|
|
goto Invalid_Composite;
|
|
|
|
|
2000-06-23 14:26:14 +02:00
|
|
|
/* read arguments */
|
|
|
|
if ( subglyph->flags & ARGS_ARE_WORDS )
|
|
|
|
{
|
* include/freetype/internal/ftstream.h,
src/base/ftstream.c, src/cff/cffload.c, src/pcf/pcfread.c,
src/sfnt/ttcmap.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c,
src/sfnt/ttpost.c, src/sfnt/ttsbit.c,
src/truetype/ttgload.c, src/truetype/ttpload.c,
src/winfonts/winfnt.c:
changed the definitions of stream macros. Examples:
NEXT_Byte => FT_NEXT_BYTE
NEXT_Short => FT_NEXT_SHORT
NEXT_UShortLE => FT_NEXT_USHORT_LE
READ_Short => FT_READ_SHORT
GET_Long => FT_GET_LONG
etc..
also introduced the FT_PEEK_XXXX functions..
2002-03-22 13:55:23 +01:00
|
|
|
subglyph->arg1 = FT_GET_SHORT();
|
|
|
|
subglyph->arg2 = FT_GET_SHORT();
|
2000-06-23 14:26:14 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
* include/freetype/internal/ftstream.h,
src/base/ftstream.c, src/cff/cffload.c, src/pcf/pcfread.c,
src/sfnt/ttcmap.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c,
src/sfnt/ttpost.c, src/sfnt/ttsbit.c,
src/truetype/ttgload.c, src/truetype/ttpload.c,
src/winfonts/winfnt.c:
changed the definitions of stream macros. Examples:
NEXT_Byte => FT_NEXT_BYTE
NEXT_Short => FT_NEXT_SHORT
NEXT_UShortLE => FT_NEXT_USHORT_LE
READ_Short => FT_READ_SHORT
GET_Long => FT_GET_LONG
etc..
also introduced the FT_PEEK_XXXX functions..
2002-03-22 13:55:23 +01:00
|
|
|
subglyph->arg1 = FT_GET_CHAR();
|
|
|
|
subglyph->arg2 = FT_GET_CHAR();
|
2000-06-23 14:26:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* read transform */
|
|
|
|
xx = yy = 0x10000L;
|
|
|
|
xy = yx = 0;
|
|
|
|
|
|
|
|
if ( subglyph->flags & WE_HAVE_A_SCALE )
|
|
|
|
{
|
* include/freetype/internal/ftstream.h,
src/base/ftstream.c, src/cff/cffload.c, src/pcf/pcfread.c,
src/sfnt/ttcmap.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c,
src/sfnt/ttpost.c, src/sfnt/ttsbit.c,
src/truetype/ttgload.c, src/truetype/ttpload.c,
src/winfonts/winfnt.c:
changed the definitions of stream macros. Examples:
NEXT_Byte => FT_NEXT_BYTE
NEXT_Short => FT_NEXT_SHORT
NEXT_UShortLE => FT_NEXT_USHORT_LE
READ_Short => FT_READ_SHORT
GET_Long => FT_GET_LONG
etc..
also introduced the FT_PEEK_XXXX functions..
2002-03-22 13:55:23 +01:00
|
|
|
xx = (FT_Fixed)FT_GET_SHORT() << 2;
|
2000-06-23 14:26:14 +02:00
|
|
|
yy = xx;
|
|
|
|
}
|
|
|
|
else if ( subglyph->flags & WE_HAVE_AN_XY_SCALE )
|
|
|
|
{
|
* include/freetype/internal/ftstream.h,
src/base/ftstream.c, src/cff/cffload.c, src/pcf/pcfread.c,
src/sfnt/ttcmap.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c,
src/sfnt/ttpost.c, src/sfnt/ttsbit.c,
src/truetype/ttgload.c, src/truetype/ttpload.c,
src/winfonts/winfnt.c:
changed the definitions of stream macros. Examples:
NEXT_Byte => FT_NEXT_BYTE
NEXT_Short => FT_NEXT_SHORT
NEXT_UShortLE => FT_NEXT_USHORT_LE
READ_Short => FT_READ_SHORT
GET_Long => FT_GET_LONG
etc..
also introduced the FT_PEEK_XXXX functions..
2002-03-22 13:55:23 +01:00
|
|
|
xx = (FT_Fixed)FT_GET_SHORT() << 2;
|
|
|
|
yy = (FT_Fixed)FT_GET_SHORT() << 2;
|
2000-06-23 14:26:14 +02:00
|
|
|
}
|
|
|
|
else if ( subglyph->flags & WE_HAVE_A_2X2 )
|
|
|
|
{
|
* include/freetype/internal/ftstream.h,
src/base/ftstream.c, src/cff/cffload.c, src/pcf/pcfread.c,
src/sfnt/ttcmap.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c,
src/sfnt/ttpost.c, src/sfnt/ttsbit.c,
src/truetype/ttgload.c, src/truetype/ttpload.c,
src/winfonts/winfnt.c:
changed the definitions of stream macros. Examples:
NEXT_Byte => FT_NEXT_BYTE
NEXT_Short => FT_NEXT_SHORT
NEXT_UShortLE => FT_NEXT_USHORT_LE
READ_Short => FT_READ_SHORT
GET_Long => FT_GET_LONG
etc..
also introduced the FT_PEEK_XXXX functions..
2002-03-22 13:55:23 +01:00
|
|
|
xx = (FT_Fixed)FT_GET_SHORT() << 2;
|
|
|
|
yx = (FT_Fixed)FT_GET_SHORT() << 2;
|
2002-06-26 22:30:37 +02:00
|
|
|
xy = (FT_Fixed)FT_GET_SHORT() << 2;
|
* include/freetype/internal/ftstream.h,
src/base/ftstream.c, src/cff/cffload.c, src/pcf/pcfread.c,
src/sfnt/ttcmap.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c,
src/sfnt/ttpost.c, src/sfnt/ttsbit.c,
src/truetype/ttgload.c, src/truetype/ttpload.c,
src/winfonts/winfnt.c:
changed the definitions of stream macros. Examples:
NEXT_Byte => FT_NEXT_BYTE
NEXT_Short => FT_NEXT_SHORT
NEXT_UShortLE => FT_NEXT_USHORT_LE
READ_Short => FT_READ_SHORT
GET_Long => FT_GET_LONG
etc..
also introduced the FT_PEEK_XXXX functions..
2002-03-22 13:55:23 +01:00
|
|
|
yy = (FT_Fixed)FT_GET_SHORT() << 2;
|
2000-06-23 14:26:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
subglyph->transform.xx = xx;
|
|
|
|
subglyph->transform.xy = xy;
|
|
|
|
subglyph->transform.yx = yx;
|
|
|
|
subglyph->transform.yy = yy;
|
|
|
|
|
|
|
|
num_subglyphs++;
|
2000-07-02 15:53:16 +02:00
|
|
|
|
2000-06-25 09:43:15 +02:00
|
|
|
} while ( subglyph->flags & MORE_COMPONENTS );
|
2000-06-23 14:26:14 +02:00
|
|
|
|
|
|
|
gloader->current.num_subglyphs = num_subglyphs;
|
|
|
|
|
|
|
|
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
|
|
|
{
|
2002-03-20 11:49:31 +01:00
|
|
|
/* we must undo the FT_FRAME_ENTER in order to point to the */
|
2000-06-23 14:26:14 +02:00
|
|
|
/* composite instructions, if we find some. */
|
|
|
|
/* we will process them later... */
|
|
|
|
/* */
|
2002-03-20 11:49:31 +01:00
|
|
|
loader->ins_pos = (FT_ULong)( FT_STREAM_POS() +
|
2001-03-10 18:07:42 +01:00
|
|
|
stream->cursor - stream->limit );
|
2000-06-23 14:26:14 +02:00
|
|
|
}
|
|
|
|
#endif
|
2000-06-23 07:02:13 +02:00
|
|
|
|
2002-01-06 11:13:40 +01:00
|
|
|
loader->byte_len = byte_len;
|
|
|
|
|
2000-06-23 07:02:13 +02:00
|
|
|
Fail:
|
|
|
|
return error;
|
2002-01-06 11:13:40 +01:00
|
|
|
|
|
|
|
Invalid_Composite:
|
|
|
|
error = TT_Err_Invalid_Composite;
|
|
|
|
goto Fail;
|
2000-06-23 07:02:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
2001-06-28 09:17:51 +02:00
|
|
|
TT_Init_Glyph_Loading( TT_Face face )
|
2000-06-25 06:49:19 +02:00
|
|
|
{
|
|
|
|
face->access_glyph_frame = TT_Access_Glyph_Frame;
|
|
|
|
face->read_glyph_header = TT_Load_Glyph_Header;
|
|
|
|
face->read_simple_glyph = TT_Load_Simple_Glyph;
|
|
|
|
face->read_composite_glyph = TT_Load_Composite_Glyph;
|
|
|
|
face->forget_glyph_frame = TT_Forget_Glyph_Frame;
|
|
|
|
}
|
|
|
|
|
2000-06-23 07:02:13 +02:00
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* TT_Process_Simple_Glyph */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Once a simple glyph has been loaded, it needs to be processed. */
|
|
|
|
/* Usually, this means scaling and hinting through bytecode */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* interpretation. */
|
2000-06-23 07:02:13 +02:00
|
|
|
/* */
|
2001-06-28 09:17:51 +02:00
|
|
|
static FT_Error
|
2002-04-01 16:25:28 +02:00
|
|
|
TT_Process_Simple_Glyph( TT_Loader load,
|
|
|
|
FT_Bool debug )
|
2000-06-23 07:02:13 +02:00
|
|
|
{
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_GlyphLoader gloader = load->gloader;
|
|
|
|
FT_Outline* outline = &gloader->current.outline;
|
|
|
|
FT_UInt n_points = outline->n_points;
|
2002-02-19 17:30:15 +01:00
|
|
|
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_UInt n_ins;
|
2002-02-19 17:30:15 +01:00
|
|
|
#endif
|
2002-04-01 16:25:28 +02:00
|
|
|
TT_GlyphZone zone = &load->zone;
|
|
|
|
FT_Error error = TT_Err_Ok;
|
2000-06-23 07:02:13 +02:00
|
|
|
|
2000-07-28 01:29:08 +02:00
|
|
|
FT_UNUSED( debug ); /* used by truetype interpreter only */
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2002-02-19 17:30:15 +01:00
|
|
|
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
2000-06-23 07:02:13 +02:00
|
|
|
n_ins = load->glyph->control_len;
|
2002-02-19 17:30:15 +01:00
|
|
|
#endif
|
2000-06-23 07:02:13 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/* add shadow points */
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
/* Add two horizontal shadow points at n and n+1. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* We need the left side bearing and advance width. */
|
2004-03-27 09:43:17 +01:00
|
|
|
/* Add two vertical shadow points at n+2 and n+3. */
|
|
|
|
/* We need the top side bearing and advance height. */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Vector* pp1;
|
|
|
|
FT_Vector* pp2;
|
2004-03-27 09:43:17 +01:00
|
|
|
FT_Vector* pp3;
|
|
|
|
FT_Vector* pp4;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
/* pp1 = xMin - lsb */
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
pp1 = outline->points + n_points;
|
2000-02-02 13:16:19 +01:00
|
|
|
pp1->x = load->bbox.xMin - load->left_bearing;
|
|
|
|
pp1->y = 0;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
/* pp2 = pp1 + aw */
|
|
|
|
pp2 = pp1 + 1;
|
|
|
|
pp2->x = pp1->x + load->advance;
|
|
|
|
pp2->y = 0;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
/* pp3 = top side bearing */
|
|
|
|
pp3 = pp1 + 2;
|
|
|
|
pp3->x = 0;
|
|
|
|
pp3->y = load->top_bearing + load->bbox.yMax;
|
|
|
|
|
|
|
|
/* pp4 = pp3 - ah */
|
|
|
|
pp4 = pp1 + 3;
|
|
|
|
pp4->x = 0;
|
|
|
|
pp4->y = pp3->y - load->vadvance;
|
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
outline->tags[n_points ] = 0;
|
|
|
|
outline->tags[n_points + 1] = 0;
|
2004-03-27 09:43:17 +01:00
|
|
|
outline->tags[n_points + 2] = 0;
|
|
|
|
outline->tags[n_points + 3] = 0;
|
2000-02-02 13:16:19 +01:00
|
|
|
}
|
2000-06-12 21:36:41 +02:00
|
|
|
|
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17.
* src/pcf/pcfutil.c: Use FT_LOCAL_DEF.
* src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H.
Use FT_BEGIN_HEADER and FT_END_HEADER.
Use FT_LOCAL.
2004-04-24 George Williams <gww@silcom.com>
Add support for Apple's distortable font technology (in GX fonts).
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro.
* include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style,
FT_MM_Var): New structures.
(FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New function declarations.
* include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func,
FT_Set_Var_Design_Func): New typedefs.
Update MultiMasters service.
* include/freetype/internal/tttypes.h
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H.
(GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef.
(TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend'
and `blend'.
* include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New
macros.
* include/freetype/internal/fttrace.h: Add `ttgxvar'.
* src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New functions.
* src/sfnt/sfobjs.c (sfnt_load_face)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS
flag for GX var fonts.
* src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files.
* src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.c.
* src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h.
(tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]:
New service.
(tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated.
* src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(TT_Process_Simple_Glyph, load_truetype_glyph)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts.
* src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_done_blend.
* src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_face_vary_cvt.
* src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c.
* src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var
and T1_Set_Var_Design.
* src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros.
(T1_Get_MM_Var, T1_Set_Var_Design): New functions.
* src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New
function declarations.
2004-04-25 22:15:11 +02:00
|
|
|
/* Note that we return four more points that are not */
|
|
|
|
/* part of the glyph outline. */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
n_points += 4;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17.
* src/pcf/pcfutil.c: Use FT_LOCAL_DEF.
* src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H.
Use FT_BEGIN_HEADER and FT_END_HEADER.
Use FT_LOCAL.
2004-04-24 George Williams <gww@silcom.com>
Add support for Apple's distortable font technology (in GX fonts).
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro.
* include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style,
FT_MM_Var): New structures.
(FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New function declarations.
* include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func,
FT_Set_Var_Design_Func): New typedefs.
Update MultiMasters service.
* include/freetype/internal/tttypes.h
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H.
(GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef.
(TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend'
and `blend'.
* include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New
macros.
* include/freetype/internal/fttrace.h: Add `ttgxvar'.
* src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New functions.
* src/sfnt/sfobjs.c (sfnt_load_face)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS
flag for GX var fonts.
* src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files.
* src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.c.
* src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h.
(tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]:
New service.
(tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated.
* src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(TT_Process_Simple_Glyph, load_truetype_glyph)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts.
* src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_done_blend.
* src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_face_vary_cvt.
* src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c.
* src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var
and T1_Set_Var_Design.
* src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros.
(T1_Get_MM_Var, T1_Set_Var_Design): New functions.
* src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New
function declarations.
2004-04-25 22:15:11 +02:00
|
|
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
|
|
|
|
|
|
|
if ( ((TT_Face)load->face)->doblend )
|
|
|
|
{
|
|
|
|
/* Deltas apply to the unscaled data. */
|
* src/cff/cffobjs.c (cff_size_done, cff_size_init, cff_size_reset,
cff_slot_done, cff_slot_init, cff_face_init, cff_face_done): Access
root fields directly.
* src/cff/cffdrivr.c (Load_Glyph): Access root fields directly.
* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Save current
frame before calling TT_Vary_Get_Glyph_Deltas.
* src/pcf/pcfdrivr.c (PCF_CMapRec): Rename `cmap' to `root' for
consistency.
(pcf_cmap_init, pcf_cmap_done, pcf_cmap_char_index,
pcf_cmap_char_next): Don't use PCF_XXX but FT_XXX arguments which
are typecast to the proper PCF_XXX types within the function.
Update code accordingly.
(pcf_cmap_class): Remove casts.
(PCF_Face_Done, PCF_Face_Init, PCF_Set_Pixel_Size): Don't use
PCF_XXX but FT_XXX arguments which are typecast to the proper
PCF_XXX types within the function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(PCF_Set_Point_Size): New wrapper function.
(PCF_Glyph_Load, pcf_driver_requester): Use FT_CALLBACK_DEF.
(pcf_driver_class): Remove casts.
2004-05-07 09:08:14 +02:00
|
|
|
FT_Vector* deltas;
|
|
|
|
FT_Memory memory = load->face->memory;
|
|
|
|
FT_StreamRec saved_stream = *(load->stream);
|
|
|
|
FT_UInt i;
|
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17.
* src/pcf/pcfutil.c: Use FT_LOCAL_DEF.
* src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H.
Use FT_BEGIN_HEADER and FT_END_HEADER.
Use FT_LOCAL.
2004-04-24 George Williams <gww@silcom.com>
Add support for Apple's distortable font technology (in GX fonts).
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro.
* include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style,
FT_MM_Var): New structures.
(FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New function declarations.
* include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func,
FT_Set_Var_Design_Func): New typedefs.
Update MultiMasters service.
* include/freetype/internal/tttypes.h
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H.
(GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef.
(TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend'
and `blend'.
* include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New
macros.
* include/freetype/internal/fttrace.h: Add `ttgxvar'.
* src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New functions.
* src/sfnt/sfobjs.c (sfnt_load_face)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS
flag for GX var fonts.
* src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files.
* src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.c.
* src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h.
(tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]:
New service.
(tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated.
* src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(TT_Process_Simple_Glyph, load_truetype_glyph)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts.
* src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_done_blend.
* src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_face_vary_cvt.
* src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c.
* src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var
and T1_Set_Var_Design.
* src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros.
(T1_Get_MM_Var, T1_Set_Var_Design): New functions.
* src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New
function declarations.
2004-04-25 22:15:11 +02:00
|
|
|
|
|
|
|
|
* src/cff/cffobjs.c (cff_size_done, cff_size_init, cff_size_reset,
cff_slot_done, cff_slot_init, cff_face_init, cff_face_done): Access
root fields directly.
* src/cff/cffdrivr.c (Load_Glyph): Access root fields directly.
* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Save current
frame before calling TT_Vary_Get_Glyph_Deltas.
* src/pcf/pcfdrivr.c (PCF_CMapRec): Rename `cmap' to `root' for
consistency.
(pcf_cmap_init, pcf_cmap_done, pcf_cmap_char_index,
pcf_cmap_char_next): Don't use PCF_XXX but FT_XXX arguments which
are typecast to the proper PCF_XXX types within the function.
Update code accordingly.
(pcf_cmap_class): Remove casts.
(PCF_Face_Done, PCF_Face_Init, PCF_Set_Pixel_Size): Don't use
PCF_XXX but FT_XXX arguments which are typecast to the proper
PCF_XXX types within the function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(PCF_Set_Point_Size): New wrapper function.
(PCF_Glyph_Load, pcf_driver_requester): Use FT_CALLBACK_DEF.
(pcf_driver_class): Remove casts.
2004-05-07 09:08:14 +02:00
|
|
|
/* TT_Vary_Get_Glyph_Deltas uses a frame, thus we have to save */
|
|
|
|
/* (and restore) the current one */
|
|
|
|
load->stream->cursor = 0;
|
|
|
|
load->stream->limit = 0;
|
|
|
|
|
|
|
|
error = TT_Vary_Get_Glyph_Deltas( (TT_Face)(load->face),
|
|
|
|
load->glyph_index,
|
|
|
|
&deltas,
|
|
|
|
n_points );
|
|
|
|
|
|
|
|
*(load->stream) = saved_stream;
|
|
|
|
|
|
|
|
if ( error )
|
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17.
* src/pcf/pcfutil.c: Use FT_LOCAL_DEF.
* src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H.
Use FT_BEGIN_HEADER and FT_END_HEADER.
Use FT_LOCAL.
2004-04-24 George Williams <gww@silcom.com>
Add support for Apple's distortable font technology (in GX fonts).
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro.
* include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style,
FT_MM_Var): New structures.
(FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New function declarations.
* include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func,
FT_Set_Var_Design_Func): New typedefs.
Update MultiMasters service.
* include/freetype/internal/tttypes.h
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H.
(GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef.
(TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend'
and `blend'.
* include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New
macros.
* include/freetype/internal/fttrace.h: Add `ttgxvar'.
* src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New functions.
* src/sfnt/sfobjs.c (sfnt_load_face)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS
flag for GX var fonts.
* src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files.
* src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.c.
* src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h.
(tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]:
New service.
(tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated.
* src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(TT_Process_Simple_Glyph, load_truetype_glyph)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts.
* src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_done_blend.
* src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_face_vary_cvt.
* src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c.
* src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var
and T1_Set_Var_Design.
* src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros.
(T1_Get_MM_Var, T1_Set_Var_Design): New functions.
* src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New
function declarations.
2004-04-25 22:15:11 +02:00
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
for ( i = 0; i < n_points; ++i )
|
|
|
|
{
|
|
|
|
outline->points[i].x += deltas[i].x;
|
|
|
|
outline->points[i].y += deltas[i].y;
|
|
|
|
}
|
|
|
|
|
|
|
|
FT_FREE( deltas );
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
|
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
/* set up zone for hinting */
|
|
|
|
tt_prepare_zone( zone, &gloader->current, 0, 0 );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
/* eventually scale the glyph */
|
2000-06-25 08:47:11 +02:00
|
|
|
if ( !( load->load_flags & FT_LOAD_NO_SCALE ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
FT_Vector* vec = zone->cur;
|
|
|
|
FT_Vector* limit = vec + n_points;
|
2004-06-21 23:16:56 +02:00
|
|
|
FT_Fixed x_scale = ((TT_Size)load->size)->metrics.x_scale;
|
|
|
|
FT_Fixed y_scale = ((TT_Size)load->size)->metrics.y_scale;
|
2000-07-02 15:53:16 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/* first scale the glyph points */
|
2000-06-12 21:36:41 +02:00
|
|
|
for ( ; vec < limit; vec++ )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2000-02-02 13:16:19 +01:00
|
|
|
vec->x = FT_MulFix( vec->x, x_scale );
|
|
|
|
vec->y = FT_MulFix( vec->y, y_scale );
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
cur_to_org( n_points, zone );
|
2000-06-12 21:36:41 +02:00
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
/* eventually hint the glyph */
|
2000-06-25 08:47:11 +02:00
|
|
|
if ( IS_HINTED( load->load_flags ) )
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
{
|
2004-03-27 09:43:17 +01:00
|
|
|
FT_Pos x = zone->org[n_points-4].x;
|
2000-06-12 21:36:41 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2003-12-24 02:10:46 +01:00
|
|
|
x = FT_PIX_ROUND( x ) - x;
|
2004-11-19 11:35:52 +01:00
|
|
|
translate_array( n_points, zone->org, x, 0 );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
org_to_cur( n_points, zone );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
zone->cur[n_points - 3].x = FT_PIX_ROUND( zone->cur[n_points - 3].x );
|
|
|
|
zone->cur[n_points - 1].y = FT_PIX_ROUND( zone->cur[n_points - 1].y );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
2000-06-25 08:47:11 +02:00
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
/* now consider hinting */
|
|
|
|
if ( n_ins > 0 )
|
|
|
|
{
|
2000-06-23 07:02:13 +02:00
|
|
|
error = TT_Set_CodeRange( load->exec, tt_coderange_glyph,
|
|
|
|
load->exec->glyphIns, n_ins );
|
2000-06-25 08:47:11 +02:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
load->exec->is_composite = FALSE;
|
|
|
|
load->exec->pts = *zone;
|
2004-03-27 09:43:17 +01:00
|
|
|
load->exec->pts.n_points += 4;
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
|
|
|
|
error = TT_Run_Context( load->exec, debug );
|
|
|
|
if ( error && load->exec->pedantic_hinting )
|
2000-06-23 07:02:13 +02:00
|
|
|
goto Exit;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
* README: Formatting.
* Jamfile: Fix typo.
* src/cff/cffparse.c: Move error code #defines to...
* include/freetype/internal/cfferrs.h: This file.
* src/cff/cffdrivr.c, src/cff/cffobjs.c, src/cff/cffload.c: Replaced
`FT_Err_*' with `CFF_Err_*'.
* src/cid/cidparse.c: Replaced `FT_Err_*' with `T1_Err_*'.
* src/psaux/psobjs.c, src/psaux/t1decode.c: Ditto.
* src/sfnt/sfobcs.c, src/sfnt/ttload.c: Replaced `FT_Err_*' with
`TT_Err_*'.
* src/truetype/ttgload.c, src/truetype/ttobjs.c: Ditto.
* src/type1/t1gload.c, src/type1/t1load.c, src/type1/t1objs.c,
src/type1/t1parse.c: Replaced `FT_Err_*' with `T1_Err_*'.
* include/freetype/internal/cfferrs.h: Add
`CFF_Err_Unknown_File_Format'.
* include/freetype/internal/t1errors.h: Add
`T1_Err_Unknown_File_Format'.
* include/freetype/internal/tterrors.h: Add
`TT_Err_Unknown_File_Format'.
* src/cff/cffload.h: Add `cff_*_encoding' and `cff_*_charset'
references.
* src/psaux/psobjs.c: Include `FT_INTERNAL_TYPE1_ERRORS_H'.
* src/cff/cffobjs.c (CFF_Init_Face, CFF_Done_Face): Use
FT_LOCAL_DEF.
* src/cid/cidobjs.c (CID_Done_Driver): Ditto.
* src/trutype/ttobjs.c (TT_Init_Face, TT_Done_Face, TT_Init_Size):
Ditto.
* src/type1/t1objs.c (T1_Done_Driver): Ditto.
* src/pcf/pcfdriver.c (PCF_Done_Face): Ditto.
* src/pcf/pcf.h: Use FT_LOCAL for `PCF_Done_Face'.
2001-04-03 01:54:01 +02:00
|
|
|
error = TT_Err_Ok; /* ignore bytecode errors in non-pedantic mode */
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
2000-06-25 08:47:11 +02:00
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
|
2000-06-25 08:47:11 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* save glyph phantom points */
|
2000-02-02 13:16:19 +01:00
|
|
|
if ( !load->preserve_pps )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2004-03-27 09:43:17 +01:00
|
|
|
load->pp1 = zone->cur[n_points - 4];
|
|
|
|
load->pp2 = zone->cur[n_points - 3];
|
|
|
|
load->pp3 = zone->cur[n_points - 2];
|
|
|
|
load->pp4 = zone->cur[n_points - 1];
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17.
* src/pcf/pcfutil.c: Use FT_LOCAL_DEF.
* src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H.
Use FT_BEGIN_HEADER and FT_END_HEADER.
Use FT_LOCAL.
2004-04-24 George Williams <gww@silcom.com>
Add support for Apple's distortable font technology (in GX fonts).
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro.
* include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style,
FT_MM_Var): New structures.
(FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New function declarations.
* include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func,
FT_Set_Var_Design_Func): New typedefs.
Update MultiMasters service.
* include/freetype/internal/tttypes.h
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H.
(GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef.
(TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend'
and `blend'.
* include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New
macros.
* include/freetype/internal/fttrace.h: Add `ttgxvar'.
* src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New functions.
* src/sfnt/sfobjs.c (sfnt_load_face)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS
flag for GX var fonts.
* src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files.
* src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.c.
* src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h.
(tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]:
New service.
(tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated.
* src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(TT_Process_Simple_Glyph, load_truetype_glyph)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts.
* src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_done_blend.
* src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_face_vary_cvt.
* src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c.
* src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var
and T1_Set_Var_Design.
* src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros.
(T1_Get_MM_Var, T1_Set_Var_Design): New functions.
* src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New
function declarations.
2004-04-25 22:15:11 +02:00
|
|
|
#if defined( TT_CONFIG_OPTION_BYTECODE_INTERPRETER ) || \
|
|
|
|
defined( TT_CONFIG_OPTION_GX_VAR_SUPPORT )
|
2000-06-23 07:02:13 +02:00
|
|
|
Exit:
|
2000-10-31 21:42:18 +01:00
|
|
|
#endif
|
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17.
* src/pcf/pcfutil.c: Use FT_LOCAL_DEF.
* src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H.
Use FT_BEGIN_HEADER and FT_END_HEADER.
Use FT_LOCAL.
2004-04-24 George Williams <gww@silcom.com>
Add support for Apple's distortable font technology (in GX fonts).
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro.
* include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style,
FT_MM_Var): New structures.
(FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New function declarations.
* include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func,
FT_Set_Var_Design_Func): New typedefs.
Update MultiMasters service.
* include/freetype/internal/tttypes.h
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H.
(GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef.
(TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend'
and `blend'.
* include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New
macros.
* include/freetype/internal/fttrace.h: Add `ttgxvar'.
* src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New functions.
* src/sfnt/sfobjs.c (sfnt_load_face)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS
flag for GX var fonts.
* src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files.
* src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.c.
* src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h.
(tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]:
New service.
(tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated.
* src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(TT_Process_Simple_Glyph, load_truetype_glyph)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts.
* src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_done_blend.
* src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_face_vary_cvt.
* src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c.
* src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var
and T1_Set_Var_Design.
* src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros.
(T1_Get_MM_Var, T1_Set_Var_Design): New functions.
* src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New
function declarations.
2004-04-25 22:15:11 +02:00
|
|
|
|
2000-06-23 07:02:13 +02:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
2000-02-02 13:16:19 +01:00
|
|
|
/* load_truetype_glyph */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2000-06-12 21:36:41 +02:00
|
|
|
/* Loads a given truetype glyph. Handles composites and uses a */
|
|
|
|
/* TT_Loader object. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2001-06-28 09:17:51 +02:00
|
|
|
static FT_Error
|
2002-04-01 16:25:28 +02:00
|
|
|
load_truetype_glyph( TT_Loader loader,
|
2003-01-08 10:59:17 +01:00
|
|
|
FT_UInt glyph_index,
|
|
|
|
FT_UInt recurse_count )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2000-07-27 13:20:20 +02:00
|
|
|
|
|
|
|
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Stream stream = loader->stream;
|
2000-07-27 13:20:20 +02:00
|
|
|
#endif
|
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Error error;
|
* src/cff/cffobjs.c (cff_size_done, cff_size_init, cff_size_reset,
cff_slot_done, cff_slot_init, cff_face_init, cff_face_done): Access
root fields directly.
* src/cff/cffdrivr.c (Load_Glyph): Access root fields directly.
* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Save current
frame before calling TT_Vary_Get_Glyph_Deltas.
* src/pcf/pcfdrivr.c (PCF_CMapRec): Rename `cmap' to `root' for
consistency.
(pcf_cmap_init, pcf_cmap_done, pcf_cmap_char_index,
pcf_cmap_char_next): Don't use PCF_XXX but FT_XXX arguments which
are typecast to the proper PCF_XXX types within the function.
Update code accordingly.
(pcf_cmap_class): Remove casts.
(PCF_Face_Done, PCF_Face_Init, PCF_Set_Pixel_Size): Don't use
PCF_XXX but FT_XXX arguments which are typecast to the proper
PCF_XXX types within the function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(PCF_Set_Point_Size): New wrapper function.
(PCF_Glyph_Load, pcf_driver_requester): Use FT_CALLBACK_DEF.
(pcf_driver_class): Remove casts.
2004-05-07 09:08:14 +02:00
|
|
|
TT_Face face = (TT_Face)loader->face;
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_ULong offset;
|
|
|
|
FT_Int contours_count;
|
2002-07-18 17:59:23 +02:00
|
|
|
FT_UInt num_points, count;
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Fixed x_scale, y_scale;
|
|
|
|
FT_GlyphLoader gloader = loader->gloader;
|
|
|
|
FT_Bool opened_frame = 0;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2002-07-18 17:59:23 +02:00
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
* src/cff/cffobjs.c (cff_size_done, cff_size_init, cff_size_reset,
cff_slot_done, cff_slot_init, cff_face_init, cff_face_done): Access
root fields directly.
* src/cff/cffdrivr.c (Load_Glyph): Access root fields directly.
* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Save current
frame before calling TT_Vary_Get_Glyph_Deltas.
* src/pcf/pcfdrivr.c (PCF_CMapRec): Rename `cmap' to `root' for
consistency.
(pcf_cmap_init, pcf_cmap_done, pcf_cmap_char_index,
pcf_cmap_char_next): Don't use PCF_XXX but FT_XXX arguments which
are typecast to the proper PCF_XXX types within the function.
Update code accordingly.
(pcf_cmap_class): Remove casts.
(PCF_Face_Done, PCF_Face_Init, PCF_Set_Pixel_Size): Don't use
PCF_XXX but FT_XXX arguments which are typecast to the proper
PCF_XXX types within the function.
Update code accordingly.
Use FT_CALLBACK_DEF throughout.
(PCF_Set_Point_Size): New wrapper function.
(PCF_Glyph_Load, pcf_driver_requester): Use FT_CALLBACK_DEF.
(pcf_driver_class): Remove casts.
2004-05-07 09:08:14 +02:00
|
|
|
FT_StreamRec inc_stream;
|
|
|
|
FT_Data glyph_data;
|
|
|
|
FT_Bool glyph_data_loaded = 0;
|
2002-07-18 17:59:23 +02:00
|
|
|
#endif
|
2000-07-28 01:29:08 +02:00
|
|
|
|
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17.
* src/pcf/pcfutil.c: Use FT_LOCAL_DEF.
* src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H.
Use FT_BEGIN_HEADER and FT_END_HEADER.
Use FT_LOCAL.
2004-04-24 George Williams <gww@silcom.com>
Add support for Apple's distortable font technology (in GX fonts).
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro.
* include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style,
FT_MM_Var): New structures.
(FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New function declarations.
* include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func,
FT_Set_Var_Design_Func): New typedefs.
Update MultiMasters service.
* include/freetype/internal/tttypes.h
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H.
(GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef.
(TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend'
and `blend'.
* include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New
macros.
* include/freetype/internal/fttrace.h: Add `ttgxvar'.
* src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New functions.
* src/sfnt/sfobjs.c (sfnt_load_face)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS
flag for GX var fonts.
* src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files.
* src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.c.
* src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h.
(tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]:
New service.
(tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated.
* src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(TT_Process_Simple_Glyph, load_truetype_glyph)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts.
* src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_done_blend.
* src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_face_vary_cvt.
* src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c.
* src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var
and T1_Set_Var_Design.
* src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros.
(T1_Get_MM_Var, T1_Set_Var_Design): New functions.
* src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New
function declarations.
2004-04-25 22:15:11 +02:00
|
|
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
|
|
|
FT_Vector *deltas;
|
|
|
|
#endif
|
|
|
|
|
2003-06-04 09:59:58 +02:00
|
|
|
|
2003-01-08 10:59:17 +01:00
|
|
|
if ( recurse_count >= TT_MAX_COMPOSITE_RECURSE )
|
|
|
|
{
|
|
|
|
error = TT_Err_Invalid_Composite;
|
|
|
|
goto Exit;
|
|
|
|
}
|
2002-07-26 11:09:10 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
/* check glyph index */
|
2002-07-18 17:59:23 +02:00
|
|
|
if ( glyph_index >= (FT_UInt)face->root.num_glyphs )
|
2000-02-02 13:16:19 +01:00
|
|
|
{
|
|
|
|
error = TT_Err_Invalid_Glyph_Index;
|
2000-06-23 14:26:14 +02:00
|
|
|
goto Exit;
|
2000-02-02 13:16:19 +01:00
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-02-15 13:54:51 +01:00
|
|
|
loader->glyph_index = glyph_index;
|
* src/base/ftdbgmem.c (ft_mem_table_resize, ft_mem_table_new,
ft_mem_table_set, ft_mem_debug_alloc, ft_mem_debug_free,
ft_mem_debug_realloc, ft_mem_debug_done, FT_Alloc_Debug,
FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings.
* src/base/ftcalc.c (FT_MulFix): Ditto.
* src/cff/cffdrivr.c (cff_get_name_index): Ditto.
* src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init,
CFF_GlyphSlot_Init): Ditto.
* src/cid/cidobjs.c (CID_GlyphSlot_Init,
CID_Size_Get_Globals_Funcs): Ditto.
* src/type1/t1objs.c (T1_Size_Get_Globals_Funcs, T1_GlyphSlot_Init):
Ditto.
* src/pshinter/pshmod.c (pshinter_interface): Use `static const'.
* src/winfonts/winfnt.c (FNT_Get_Next_Char): Remove unused
variables.
* include/freetype/internal/psaux.h (T1_Builder_Funcs): Renamed
to...
(T1_Builder_FuncsRec): This.
(T1_Builder_Funcs): New typedef.
(PSAux_Interface): Remove compiler warnings.
* src/psaux/psauxmod.c (t1_builder_funcs), src/psaux/psobjs.h
(t1_builder_funcs): Updated.
* src/pshinter/pshglob.h (PSH_Blue_Align): Replaced with ...
(PSH_BLUE_ALIGN_{NONE,TOP,BOT}): New defines.
(PSH_AlignmentRec): Updated.
* include/freetype/internal/ftstream.h (GET_Char, GET_Byte): Fix
typo.
* include/freetype/internal/ftgloadr.h (FT_SubGlyph): Ditto.
* src/base/ftstream (FT_Get_Char): Rename to...
(FT_Stream_Get_Char): This.
* src/base/ftnames.c (FT_Get_Sfnt_Name): s/index/idx/ -- `index' is
a built-in function in gcc, causing warning messages with gcc 3.0.
* src/autohint/ahglyph.c (ah_outline_load): Ditto.
* src/autohint/ahglobal.c (ah_hinter_compute_blues): Ditto.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
ftc_family_table_free, FTC_Manager_Done, FTC_Manager_Register_Cache):
Ditto.
* src/cff/cffload.c (cff_new_index, cff_done_index,
cff_explicit_index, CFF_Access_Element, CFF_Forget_Element,
CFF_Get_Name, CFF_Get_String, CFF_Load_SubFont, CFF_Load_Font,
CFF_Done_Font): Ditto.
* src/psaux/psobjs.c (PS_Table_Add, PS_Parser_LoadField): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_clear_bit,
ps_mask_set_bit, ps_dimension_add_t1stem, ps_hints_t1stem3,
* src/pshinter/pshalgo1.c (psh1_hint_table_record,
psh1_hint_table_record_mask, psh1_hint_table_activate_mask): Ditto.
* src/pshinter/pshalgo2.c (psh2_hint_table_record,
psh2_hint_table_record_mask, psh2_hint_table_activate_mask): Ditto.
* src/sfnt/ttpost.c (Load_Format_20, Load_Format_25,
TT_Get_PS_Name): Ditto.
* src/truetype/ttgload.c (TT_Get_Metrics, Get_HMetrics,
load_truetype_glyph): Ditto.
* src/type1/t1load.c (parse_subrs, T1_Open_Face): Ditto.
* src/type1/t1afm.c (T1_Get_Kerning): Ditto.
* include/freetype/cache/ftcmanag.h (ftc_family_table_free): Ditto.
2002-03-07 22:59:59 +01:00
|
|
|
num_points = 0;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
x_scale = 0x10000L;
|
|
|
|
y_scale = 0x10000L;
|
|
|
|
if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2004-06-21 23:16:56 +02:00
|
|
|
x_scale = ((TT_Size)loader->size)->metrics.x_scale;
|
|
|
|
y_scale = ((TT_Size)loader->size)->metrics.y_scale;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
/* get metrics, horizontal and vertical */
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2004-03-27 09:43:17 +01:00
|
|
|
FT_Short left_bearing = 0, top_bearing = 0;
|
|
|
|
FT_UShort advance_width = 0, advance_height = 0;
|
|
|
|
|
2002-07-18 17:59:23 +02:00
|
|
|
|
2003-02-13 18:49:27 +01:00
|
|
|
Get_HMetrics( face, glyph_index,
|
|
|
|
(FT_Bool)!( loader->load_flags &
|
|
|
|
FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ),
|
|
|
|
&left_bearing,
|
|
|
|
&advance_width );
|
2004-03-27 09:43:17 +01:00
|
|
|
Get_VMetrics( face, glyph_index,
|
|
|
|
(FT_Bool)!( loader->load_flags &
|
|
|
|
FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ),
|
|
|
|
&top_bearing,
|
|
|
|
&advance_height );
|
2002-07-26 11:09:10 +02:00
|
|
|
|
2003-02-13 18:49:27 +01:00
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
2002-07-18 17:59:23 +02:00
|
|
|
|
2002-07-26 11:09:10 +02:00
|
|
|
/* If this is an incrementally loaded font see if there are */
|
|
|
|
/* overriding metrics for this glyph. */
|
2002-08-01 17:29:17 +02:00
|
|
|
if ( face->root.internal->incremental_interface &&
|
|
|
|
face->root.internal->incremental_interface->funcs->get_glyph_metrics )
|
2002-07-18 17:59:23 +02:00
|
|
|
{
|
2003-02-13 18:49:27 +01:00
|
|
|
FT_Incremental_MetricsRec metrics;
|
2002-07-26 11:09:10 +02:00
|
|
|
|
2003-04-23 17:50:27 +02:00
|
|
|
|
|
|
|
metrics.bearing_x = left_bearing;
|
|
|
|
metrics.bearing_y = 0;
|
|
|
|
metrics.advance = advance_width;
|
2002-08-01 17:29:17 +02:00
|
|
|
error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
|
|
|
|
face->root.internal->incremental_interface->object,
|
2003-02-13 18:49:27 +01:00
|
|
|
glyph_index, FALSE, &metrics );
|
2002-07-26 11:09:10 +02:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
2003-02-13 18:49:27 +01:00
|
|
|
left_bearing = (FT_Short)metrics.bearing_x;
|
|
|
|
advance_width = (FT_UShort)metrics.advance;
|
2002-07-18 17:59:23 +02:00
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
# if 0
|
|
|
|
/* GWW: Do I do the same for vertical metrics ??? */
|
|
|
|
if ( face->root.internal->incremental_interface &&
|
|
|
|
face->root.internal->incremental_interface->funcs->get_glyph_metrics )
|
|
|
|
{
|
|
|
|
FT_Incremental_MetricsRec metrics;
|
|
|
|
|
|
|
|
|
|
|
|
metrics.bearing_x = 0;
|
|
|
|
metrics.bearing_y = top_bearing;
|
|
|
|
metrics.advance = advance_height;
|
|
|
|
error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
|
|
|
|
face->root.internal->incremental_interface->object,
|
|
|
|
glyph_index, TRUE, &metrics );
|
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
top_bearing = (FT_Short)metrics.bearing_y;
|
|
|
|
advance_height = (FT_UShort)metrics.advance;
|
|
|
|
}
|
|
|
|
# endif
|
|
|
|
|
2002-07-26 11:09:10 +02:00
|
|
|
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
|
2002-07-18 17:59:23 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
loader->left_bearing = left_bearing;
|
|
|
|
loader->advance = advance_width;
|
2004-03-27 09:43:17 +01:00
|
|
|
loader->top_bearing = top_bearing;
|
|
|
|
loader->vadvance = advance_height;
|
2001-06-08 15:29:36 +02:00
|
|
|
|
|
|
|
if ( !loader->linear_def )
|
|
|
|
{
|
|
|
|
loader->linear_def = 1;
|
|
|
|
loader->linear = advance_width;
|
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
2002-07-18 17:59:23 +02:00
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
2002-07-26 11:09:10 +02:00
|
|
|
|
|
|
|
/* Set `offset' to the start of the glyph program relative to the */
|
|
|
|
/* start of the 'glyf' table, and `count' to the length of the */
|
|
|
|
/* glyph program in bytes. */
|
|
|
|
/* */
|
|
|
|
/* If we are loading glyph data via the incremental interface, set */
|
|
|
|
/* the loader stream to a memory stream reading the data returned */
|
|
|
|
/* by the interface. */
|
|
|
|
|
2002-08-01 17:29:17 +02:00
|
|
|
if ( face->root.internal->incremental_interface )
|
2002-07-18 17:59:23 +02:00
|
|
|
{
|
2002-08-01 17:29:17 +02:00
|
|
|
error = face->root.internal->incremental_interface->funcs->get_glyph_data(
|
|
|
|
face->root.internal->incremental_interface->object,
|
|
|
|
glyph_index, &glyph_data );
|
2002-07-26 11:09:10 +02:00
|
|
|
if ( error )
|
2002-07-18 17:59:23 +02:00
|
|
|
goto Exit;
|
2002-07-26 11:09:10 +02:00
|
|
|
|
2002-08-01 17:29:17 +02:00
|
|
|
glyph_data_loaded = 1;
|
2002-08-06 23:47:40 +02:00
|
|
|
offset = 0;
|
|
|
|
count = glyph_data.length;
|
|
|
|
|
2002-07-28 07:05:24 +02:00
|
|
|
FT_MEM_ZERO( &inc_stream, sizeof ( inc_stream ) );
|
2002-08-06 23:47:40 +02:00
|
|
|
FT_Stream_OpenMemory( &inc_stream,
|
|
|
|
glyph_data.pointer, glyph_data.length );
|
|
|
|
|
2002-07-18 17:59:23 +02:00
|
|
|
loader->stream = &inc_stream;
|
|
|
|
}
|
|
|
|
else
|
2002-07-26 11:09:10 +02:00
|
|
|
|
|
|
|
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
|
2002-07-18 17:59:23 +02:00
|
|
|
|
2005-02-22 17:53:06 +01:00
|
|
|
offset = tt_face_get_location( face, glyph_index, &count );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
if ( count == 0 )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2000-02-02 13:16:19 +01:00
|
|
|
/* as described by Frederic Loyer, these are spaces, and */
|
|
|
|
/* not the unknown glyph. */
|
|
|
|
loader->bbox.xMin = 0;
|
|
|
|
loader->bbox.xMax = 0;
|
|
|
|
loader->bbox.yMin = 0;
|
|
|
|
loader->bbox.yMax = 0;
|
|
|
|
|
|
|
|
loader->pp1.x = 0;
|
|
|
|
loader->pp2.x = loader->advance;
|
2004-03-27 09:43:17 +01:00
|
|
|
loader->pp3.y = 0;
|
|
|
|
loader->pp4.y = loader->pp3.y-loader->vadvance;
|
2000-02-02 13:16:19 +01:00
|
|
|
|
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17.
* src/pcf/pcfutil.c: Use FT_LOCAL_DEF.
* src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H.
Use FT_BEGIN_HEADER and FT_END_HEADER.
Use FT_LOCAL.
2004-04-24 George Williams <gww@silcom.com>
Add support for Apple's distortable font technology (in GX fonts).
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro.
* include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style,
FT_MM_Var): New structures.
(FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New function declarations.
* include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func,
FT_Set_Var_Design_Func): New typedefs.
Update MultiMasters service.
* include/freetype/internal/tttypes.h
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H.
(GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef.
(TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend'
and `blend'.
* include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New
macros.
* include/freetype/internal/fttrace.h: Add `ttgxvar'.
* src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New functions.
* src/sfnt/sfobjs.c (sfnt_load_face)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS
flag for GX var fonts.
* src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files.
* src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.c.
* src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h.
(tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]:
New service.
(tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated.
* src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(TT_Process_Simple_Glyph, load_truetype_glyph)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts.
* src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_done_blend.
* src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_face_vary_cvt.
* src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c.
* src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var
and T1_Set_Var_Design.
* src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros.
(T1_Get_MM_Var, T1_Set_Var_Design): New functions.
* src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New
function declarations.
2004-04-25 22:15:11 +02:00
|
|
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
|
|
|
if ( ((TT_Face)(loader->face))->doblend )
|
|
|
|
{
|
|
|
|
/* this must be done before scaling */
|
|
|
|
FT_Memory memory = loader->face->memory;
|
|
|
|
|
|
|
|
|
2004-06-28 16:19:15 +02:00
|
|
|
error = TT_Vary_Get_Glyph_Deltas( (TT_Face)(loader->face),
|
|
|
|
glyph_index, &deltas, 4 );
|
2004-06-24 22:18:24 +02:00
|
|
|
if ( error )
|
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17.
* src/pcf/pcfutil.c: Use FT_LOCAL_DEF.
* src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H.
Use FT_BEGIN_HEADER and FT_END_HEADER.
Use FT_LOCAL.
2004-04-24 George Williams <gww@silcom.com>
Add support for Apple's distortable font technology (in GX fonts).
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro.
* include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style,
FT_MM_Var): New structures.
(FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New function declarations.
* include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func,
FT_Set_Var_Design_Func): New typedefs.
Update MultiMasters service.
* include/freetype/internal/tttypes.h
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H.
(GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef.
(TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend'
and `blend'.
* include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New
macros.
* include/freetype/internal/fttrace.h: Add `ttgxvar'.
* src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New functions.
* src/sfnt/sfobjs.c (sfnt_load_face)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS
flag for GX var fonts.
* src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files.
* src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.c.
* src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h.
(tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]:
New service.
(tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated.
* src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(TT_Process_Simple_Glyph, load_truetype_glyph)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts.
* src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_done_blend.
* src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_face_vary_cvt.
* src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c.
* src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var
and T1_Set_Var_Design.
* src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros.
(T1_Get_MM_Var, T1_Set_Var_Design): New functions.
* src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New
function declarations.
2004-04-25 22:15:11 +02:00
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
loader->pp1.x += deltas[0].x; loader->pp1.y += deltas[0].y;
|
|
|
|
loader->pp2.x += deltas[1].x; loader->pp2.y += deltas[1].y;
|
|
|
|
loader->pp3.x += deltas[2].x; loader->pp3.y += deltas[2].y;
|
|
|
|
loader->pp4.x += deltas[3].x; loader->pp4.y += deltas[3].y;
|
|
|
|
|
|
|
|
FT_FREE( deltas );
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
|
2004-03-27 09:43:17 +01:00
|
|
|
{
|
2000-02-02 13:16:19 +01:00
|
|
|
loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale );
|
2004-03-27 09:43:17 +01:00
|
|
|
loader->pp4.y = FT_MulFix( loader->pp4.y, y_scale );
|
|
|
|
}
|
2000-02-02 13:16:19 +01:00
|
|
|
|
|
|
|
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
2000-06-25 09:43:15 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
if ( loader->exec )
|
2000-02-28 12:23:36 +01:00
|
|
|
loader->exec->glyphSize = 0;
|
2000-06-25 09:43:15 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
#endif
|
2000-07-02 15:53:16 +02:00
|
|
|
|
* README: Formatting.
* Jamfile: Fix typo.
* src/cff/cffparse.c: Move error code #defines to...
* include/freetype/internal/cfferrs.h: This file.
* src/cff/cffdrivr.c, src/cff/cffobjs.c, src/cff/cffload.c: Replaced
`FT_Err_*' with `CFF_Err_*'.
* src/cid/cidparse.c: Replaced `FT_Err_*' with `T1_Err_*'.
* src/psaux/psobjs.c, src/psaux/t1decode.c: Ditto.
* src/sfnt/sfobcs.c, src/sfnt/ttload.c: Replaced `FT_Err_*' with
`TT_Err_*'.
* src/truetype/ttgload.c, src/truetype/ttobjs.c: Ditto.
* src/type1/t1gload.c, src/type1/t1load.c, src/type1/t1objs.c,
src/type1/t1parse.c: Replaced `FT_Err_*' with `T1_Err_*'.
* include/freetype/internal/cfferrs.h: Add
`CFF_Err_Unknown_File_Format'.
* include/freetype/internal/t1errors.h: Add
`T1_Err_Unknown_File_Format'.
* include/freetype/internal/tterrors.h: Add
`TT_Err_Unknown_File_Format'.
* src/cff/cffload.h: Add `cff_*_encoding' and `cff_*_charset'
references.
* src/psaux/psobjs.c: Include `FT_INTERNAL_TYPE1_ERRORS_H'.
* src/cff/cffobjs.c (CFF_Init_Face, CFF_Done_Face): Use
FT_LOCAL_DEF.
* src/cid/cidobjs.c (CID_Done_Driver): Ditto.
* src/trutype/ttobjs.c (TT_Init_Face, TT_Done_Face, TT_Init_Size):
Ditto.
* src/type1/t1objs.c (T1_Done_Driver): Ditto.
* src/pcf/pcfdriver.c (PCF_Done_Face): Ditto.
* src/pcf/pcf.h: Use FT_LOCAL for `PCF_Done_Face'.
2001-04-03 01:54:01 +02:00
|
|
|
error = TT_Err_Ok;
|
2000-06-23 14:26:14 +02:00
|
|
|
goto Exit;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
2002-01-06 17:42:44 +01:00
|
|
|
loader->byte_len = (FT_Int)count;
|
2002-01-06 11:13:40 +01:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
offset = loader->glyf_offset + offset;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-23 14:26:14 +02:00
|
|
|
/* access glyph frame */
|
2000-06-25 06:49:19 +02:00
|
|
|
error = face->access_glyph_frame( loader, glyph_index, offset, count );
|
2000-06-25 08:47:11 +02:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-23 14:26:14 +02:00
|
|
|
opened_frame = 1;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-23 14:26:14 +02:00
|
|
|
/* read first glyph header */
|
2000-06-25 06:49:19 +02:00
|
|
|
error = face->read_glyph_header( loader );
|
2000-06-25 08:47:11 +02:00
|
|
|
if ( error )
|
|
|
|
goto Fail;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-23 14:26:14 +02:00
|
|
|
contours_count = loader->n_contours;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
count -= 10;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
loader->pp1.x = loader->bbox.xMin - loader->left_bearing;
|
|
|
|
loader->pp1.y = 0;
|
|
|
|
loader->pp2.x = loader->pp1.x + loader->advance;
|
|
|
|
loader->pp2.y = 0;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
loader->pp3.x = 0;
|
|
|
|
loader->pp3.y = loader->top_bearing + loader->bbox.yMax;
|
|
|
|
loader->pp4.x = 0;
|
|
|
|
loader->pp4.y = loader->pp3.y - loader->vadvance;
|
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/***********************************************************************/
|
|
|
|
/***********************************************************************/
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
/* if it is a simple glyph, load it */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
if ( contours_count >= 0 )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
/* check that we can add the contours to the glyph */
|
2002-03-14 13:56:35 +01:00
|
|
|
error = FT_GlyphLoader_CheckPoints( gloader, 0, contours_count );
|
2000-06-25 08:47:11 +02:00
|
|
|
if ( error )
|
|
|
|
goto Fail;
|
2000-06-12 21:36:41 +02:00
|
|
|
|
2000-06-25 06:49:19 +02:00
|
|
|
error = face->read_simple_glyph( loader );
|
2000-06-25 08:47:11 +02:00
|
|
|
if ( error )
|
|
|
|
goto Fail;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
2000-07-02 15:53:16 +02:00
|
|
|
|
2000-06-23 07:02:13 +02:00
|
|
|
{
|
2002-04-01 16:25:28 +02:00
|
|
|
TT_Size size = (TT_Size)loader->size;
|
2000-06-25 09:43:15 +02:00
|
|
|
|
|
|
|
|
2000-06-23 07:02:13 +02:00
|
|
|
error = TT_Process_Simple_Glyph( loader,
|
|
|
|
(FT_Bool)( size && size->debug ) );
|
|
|
|
}
|
2000-06-25 09:43:15 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
#else
|
2000-06-25 09:43:15 +02:00
|
|
|
|
2000-07-26 21:04:08 +02:00
|
|
|
error = TT_Process_Simple_Glyph( loader, 0 );
|
2000-06-25 09:43:15 +02:00
|
|
|
|
2000-05-17 01:44:38 +02:00
|
|
|
#endif
|
2000-06-25 09:43:15 +02:00
|
|
|
|
|
|
|
if ( error )
|
|
|
|
goto Fail;
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
|
|
|
|
FT_GlyphLoader_Add( gloader );
|
2000-02-02 13:16:19 +01:00
|
|
|
|
|
|
|
/* Note: We could have put the simple loader source there */
|
|
|
|
/* but the code is fat enough already :-) */
|
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/***********************************************************************/
|
|
|
|
/***********************************************************************/
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
/* otherwise, load a composite! */
|
2003-01-08 10:59:17 +01:00
|
|
|
else if ( contours_count == -1 )
|
2000-02-02 13:16:19 +01:00
|
|
|
{
|
2000-06-23 07:02:13 +02:00
|
|
|
TT_GlyphSlot glyph = (TT_GlyphSlot)loader->glyph;
|
2002-02-19 17:30:15 +01:00
|
|
|
FT_UInt start_point;
|
|
|
|
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
|
|
|
FT_UInt start_contour;
|
2000-07-04 20:12:13 +02:00
|
|
|
FT_ULong ins_pos; /* position of composite instructions, if any */
|
2002-02-19 17:30:15 +01:00
|
|
|
#endif
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
/* for each subglyph, read composite header */
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
start_point = gloader->base.outline.n_points;
|
2002-02-19 17:30:15 +01:00
|
|
|
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
start_contour = gloader->base.outline.n_contours;
|
2002-02-19 17:30:15 +01:00
|
|
|
#endif
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2000-06-25 06:49:19 +02:00
|
|
|
error = face->read_composite_glyph( loader );
|
2000-06-25 08:47:11 +02:00
|
|
|
if ( error )
|
|
|
|
goto Fail;
|
2000-03-28 13:19:28 +02:00
|
|
|
|
2002-02-19 17:30:15 +01:00
|
|
|
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
2000-07-04 20:12:13 +02:00
|
|
|
ins_pos = loader->ins_pos;
|
2002-02-19 17:30:15 +01:00
|
|
|
#endif
|
2000-06-25 06:49:19 +02:00
|
|
|
face->forget_glyph_frame( loader );
|
2000-06-23 14:26:14 +02:00
|
|
|
opened_frame = 0;
|
|
|
|
|
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17.
* src/pcf/pcfutil.c: Use FT_LOCAL_DEF.
* src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H.
Use FT_BEGIN_HEADER and FT_END_HEADER.
Use FT_LOCAL.
2004-04-24 George Williams <gww@silcom.com>
Add support for Apple's distortable font technology (in GX fonts).
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro.
* include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style,
FT_MM_Var): New structures.
(FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New function declarations.
* include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func,
FT_Set_Var_Design_Func): New typedefs.
Update MultiMasters service.
* include/freetype/internal/tttypes.h
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H.
(GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef.
(TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend'
and `blend'.
* include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New
macros.
* include/freetype/internal/fttrace.h: Add `ttgxvar'.
* src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New functions.
* src/sfnt/sfobjs.c (sfnt_load_face)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS
flag for GX var fonts.
* src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files.
* src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.c.
* src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h.
(tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]:
New service.
(tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated.
* src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(TT_Process_Simple_Glyph, load_truetype_glyph)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts.
* src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_done_blend.
* src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_face_vary_cvt.
* src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c.
* src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var
and T1_Set_Var_Design.
* src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros.
(T1_Get_MM_Var, T1_Set_Var_Design): New functions.
* src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New
function declarations.
2004-04-25 22:15:11 +02:00
|
|
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
|
|
|
|
|
|
|
if ( face->doblend )
|
|
|
|
{
|
|
|
|
FT_Int i, limit;
|
|
|
|
FT_SubGlyph subglyph;
|
|
|
|
FT_Memory memory = face->root.memory;
|
|
|
|
|
|
|
|
|
|
|
|
/* this provides additional offsets */
|
|
|
|
/* for each component's translation */
|
|
|
|
|
|
|
|
if ( (error = TT_Vary_Get_Glyph_Deltas(
|
|
|
|
face,
|
|
|
|
glyph_index,
|
|
|
|
&deltas,
|
2004-06-24 22:18:24 +02:00
|
|
|
gloader->current.num_subglyphs + 4 )) != 0 )
|
* src/pcf/pcfdrivr.c: Revert change from 2004-04-17.
* src/pcf/pcfutil.c: Use FT_LOCAL_DEF.
* src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H.
Use FT_BEGIN_HEADER and FT_END_HEADER.
Use FT_LOCAL.
2004-04-24 George Williams <gww@silcom.com>
Add support for Apple's distortable font technology (in GX fonts).
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro.
* include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style,
FT_MM_Var): New structures.
(FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New function declarations.
* include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func,
FT_Set_Var_Design_Func): New typedefs.
Update MultiMasters service.
* include/freetype/internal/tttypes.h
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H.
(GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef.
(TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend'
and `blend'.
* include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New
macros.
* include/freetype/internal/fttrace.h: Add `ttgxvar'.
* src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates,
FT_Set_Var_Blend_Coordinates): New functions.
* src/sfnt/sfobjs.c (sfnt_load_face)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS
flag for GX var fonts.
* src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files.
* src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.c.
* src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h.
(tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]:
New service.
(tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated.
* src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(TT_Process_Simple_Glyph, load_truetype_glyph)
[TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts.
* src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_done_blend.
* src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include
ttgxvar.h.
(tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call
tt_face_vary_cvt.
* src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c.
* src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var
and T1_Set_Var_Design.
* src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros.
(T1_Get_MM_Var, T1_Set_Var_Design): New functions.
* src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New
function declarations.
2004-04-25 22:15:11 +02:00
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
/* Note: No subglyph reallocation here, our pointers are stable. */
|
|
|
|
subglyph = gloader->current.subglyphs + gloader->base.num_subglyphs;
|
|
|
|
limit = gloader->current.num_subglyphs;
|
|
|
|
|
|
|
|
for ( i = 0; i < limit; ++i, ++subglyph )
|
|
|
|
{
|
|
|
|
if ( subglyph->flags & ARGS_ARE_XY_VALUES )
|
|
|
|
{
|
|
|
|
subglyph->arg1 += deltas[i].x;
|
|
|
|
subglyph->arg2 += deltas[i].y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
loader->pp1.x += deltas[i + 0].x; loader->pp1.y += deltas[i + 0].y;
|
|
|
|
loader->pp2.x += deltas[i + 1].x; loader->pp2.y += deltas[i + 1].y;
|
|
|
|
loader->pp3.x += deltas[i + 2].x; loader->pp3.y += deltas[i + 2].y;
|
|
|
|
loader->pp4.x += deltas[i + 3].x; loader->pp4.y += deltas[i + 3].y;
|
|
|
|
|
|
|
|
FT_FREE( deltas );
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
|
|
|
|
|
|
|
|
if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
|
|
|
|
{
|
|
|
|
loader->pp1.x = FT_MulFix( loader->pp1.x, x_scale );
|
|
|
|
loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale );
|
|
|
|
loader->pp3.y = FT_MulFix( loader->pp3.y, y_scale );
|
|
|
|
loader->pp4.y = FT_MulFix( loader->pp4.y, y_scale );
|
|
|
|
}
|
|
|
|
|
2000-03-28 13:19:28 +02:00
|
|
|
/* if the flag FT_LOAD_NO_RECURSE is set, we return the subglyph */
|
2000-06-12 21:36:41 +02:00
|
|
|
/* `as is' in the glyph slot (the client application will be */
|
2002-08-16 14:46:52 +02:00
|
|
|
/* responsible for interpreting these data)... */
|
2000-06-12 21:36:41 +02:00
|
|
|
/* */
|
2000-03-28 13:19:28 +02:00
|
|
|
if ( loader->load_flags & FT_LOAD_NO_RECURSE )
|
|
|
|
{
|
|
|
|
/* set up remaining glyph fields */
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
FT_GlyphLoader_Add( gloader );
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
glyph->num_subglyphs = gloader->base.num_subglyphs;
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
glyph->format = FT_GLYPH_FORMAT_COMPOSITE;
|
2002-04-01 16:25:28 +02:00
|
|
|
glyph->subglyphs = gloader->base.subglyphs;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2000-06-23 14:26:14 +02:00
|
|
|
goto Exit;
|
2000-03-28 13:19:28 +02:00
|
|
|
}
|
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
/*********************************************************************/
|
2000-06-25 09:43:15 +02:00
|
|
|
/*********************************************************************/
|
|
|
|
/*********************************************************************/
|
|
|
|
|
|
|
|
/* Now, read each subglyph independently. */
|
2000-02-02 13:16:19 +01:00
|
|
|
{
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Int n, num_base_points, num_new_points;
|
|
|
|
FT_SubGlyph subglyph = 0;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_UInt num_subglyphs = gloader->current.num_subglyphs;
|
|
|
|
FT_UInt num_base_subgs = gloader->base.num_subglyphs;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2000-06-23 07:02:13 +02:00
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
FT_GlyphLoader_Add( gloader );
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2000-06-28 01:31:53 +02:00
|
|
|
for ( n = 0; n < (FT_Int)num_subglyphs; n++ )
|
2000-02-02 13:16:19 +01:00
|
|
|
{
|
2004-03-27 09:43:17 +01:00
|
|
|
FT_Vector pp1, pp2, pp3, pp4;
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Pos x, y;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-25 09:43:15 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
/* Each time we call load_truetype_glyph in this loop, the */
|
|
|
|
/* value of `gloader.base.subglyphs' can change due to table */
|
|
|
|
/* reallocations. We thus need to recompute the subglyph */
|
|
|
|
/* pointer on each iteration. */
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
subglyph = gloader->base.subglyphs + num_base_subgs + n;
|
2000-06-12 21:36:41 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
pp1 = loader->pp1;
|
|
|
|
pp2 = loader->pp2;
|
2004-03-27 09:43:17 +01:00
|
|
|
pp3 = loader->pp3;
|
|
|
|
pp4 = loader->pp4;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
num_base_points = gloader->base.outline.n_points;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2003-01-08 10:59:17 +01:00
|
|
|
error = load_truetype_glyph( loader, subglyph->index,
|
2003-04-23 17:50:27 +02:00
|
|
|
recurse_count + 1 );
|
2000-06-12 21:36:41 +02:00
|
|
|
if ( error )
|
|
|
|
goto Fail;
|
2000-05-17 22:56:01 +02:00
|
|
|
|
2001-05-16 19:49:07 +02:00
|
|
|
/* restore subglyph pointer */
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
subglyph = gloader->base.subglyphs + num_base_subgs + n;
|
|
|
|
|
2000-02-28 12:23:36 +01:00
|
|
|
if ( subglyph->flags & USE_MY_METRICS )
|
|
|
|
{
|
|
|
|
pp1 = loader->pp1;
|
|
|
|
pp2 = loader->pp2;
|
2004-03-27 09:43:17 +01:00
|
|
|
pp3 = loader->pp3;
|
|
|
|
pp4 = loader->pp4;
|
2000-02-28 12:23:36 +01:00
|
|
|
}
|
|
|
|
else
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2000-02-02 13:16:19 +01:00
|
|
|
loader->pp1 = pp1;
|
|
|
|
loader->pp2 = pp2;
|
2004-03-27 09:43:17 +01:00
|
|
|
loader->pp3 = pp3;
|
|
|
|
loader->pp4 = pp4;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-25 09:43:15 +02:00
|
|
|
num_points = gloader->base.outline.n_points;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
num_new_points = num_points - num_base_points;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
/* now perform the transform required for this subglyph */
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
if ( subglyph->flags & ( WE_HAVE_A_SCALE |
|
|
|
|
WE_HAVE_AN_XY_SCALE |
|
|
|
|
WE_HAVE_A_2X2 ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2000-06-25 08:47:11 +02:00
|
|
|
FT_Vector* cur = gloader->base.outline.points +
|
|
|
|
num_base_points;
|
|
|
|
FT_Vector* org = gloader->base.extra_points +
|
|
|
|
num_base_points;
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Vector* limit = cur + num_new_points;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-25 09:43:15 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
for ( ; cur < limit; cur++, org++ )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
FT_Vector_Transform( cur, &subglyph->transform );
|
|
|
|
FT_Vector_Transform( org, &subglyph->transform );
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* apply offset */
|
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
if ( !( subglyph->flags & ARGS_ARE_XY_VALUES ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2000-06-28 01:31:53 +02:00
|
|
|
FT_UInt k = subglyph->arg1;
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
FT_UInt l = subglyph->arg2;
|
|
|
|
FT_Vector* p1;
|
|
|
|
FT_Vector* p2;
|
2000-06-12 21:36:41 +02:00
|
|
|
|
2000-06-29 05:14:25 +02:00
|
|
|
|
2000-06-28 01:31:53 +02:00
|
|
|
if ( start_point + k >= (FT_UInt)num_base_points ||
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
l >= (FT_UInt)num_new_points )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
|
|
|
error = TT_Err_Invalid_Composite;
|
|
|
|
goto Fail;
|
|
|
|
}
|
|
|
|
|
2000-05-17 01:44:38 +02:00
|
|
|
l += num_base_points;
|
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
p1 = gloader->base.outline.points + start_point + k;
|
|
|
|
p2 = gloader->base.outline.points + start_point + l;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
x = p1->x - p2->x;
|
|
|
|
y = p1->y - p2->y;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-02-02 13:16:19 +01:00
|
|
|
x = subglyph->arg1;
|
|
|
|
y = subglyph->arg2;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-08-16 14:46:52 +02:00
|
|
|
/* Use a default value dependent on */
|
|
|
|
/* TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED. This is useful for old TT */
|
|
|
|
/* fonts which don't set the xxx_COMPONENT_OFFSET bit. */
|
|
|
|
|
|
|
|
#ifdef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED
|
|
|
|
if ( !( subglyph->flags & UNSCALED_COMPONENT_OFFSET ) &&
|
|
|
|
#else
|
|
|
|
if ( ( subglyph->flags & SCALED_COMPONENT_OFFSET ) &&
|
|
|
|
#endif
|
|
|
|
( subglyph->flags & ( WE_HAVE_A_SCALE |
|
|
|
|
WE_HAVE_AN_XY_SCALE |
|
|
|
|
WE_HAVE_A_2X2 )) )
|
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* This algorithm is what Apple documents. But it doesn't work. */
|
|
|
|
/* */
|
|
|
|
int a = subglyph->transform.xx > 0 ? subglyph->transform.xx
|
|
|
|
: -subglyph->transform.xx;
|
|
|
|
int b = subglyph->transform.yx > 0 ? subglyph->transform.yx
|
|
|
|
: -subglyph->transform.yx;
|
|
|
|
int c = subglyph->transform.xy > 0 ? subglyph->transform.xy
|
|
|
|
: -subglyph->transform.xy;
|
|
|
|
int d = subglyph->transform.yy > 0 ? subglyph->transform.yy
|
|
|
|
: -subglyph->transform.yy;
|
|
|
|
int m = a > b ? a : b;
|
|
|
|
int n = c > d ? c : d;
|
|
|
|
|
|
|
|
|
|
|
|
if ( a - b <= 33 && a - b >= -33 )
|
|
|
|
m *= 2;
|
|
|
|
if ( c - d <= 33 && c - d >= -33 )
|
|
|
|
n *= 2;
|
|
|
|
x = FT_MulFix( x, m );
|
|
|
|
y = FT_MulFix( y, n );
|
|
|
|
|
|
|
|
#else /* 0 */
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* This algorithm is a guess and works much better than the above. */
|
|
|
|
/* */
|
* include/freetype/internal/ftdriver.h,
include/freetype/internal/ftobjs.h,
include/freetype/internal/psaux.h, src/cid/cidgload.c,
src/psaux/psobjs.c, src/psaux/t1decode.c, src/psaux/psobjs.h,
src/pshinter/pshrec.c, src/pshinter/pshalgo.c,
src/psnames/psmodule.c, src/raster/ftraster.c, src/sfnt/sfobjs.c,
src/smooth/ftgrays.c, src/smooth/ftsmooth.c, src/truetype/ttobjs.c,
src/truetype/ttdriver.c, src/truetype/ttgload.c, src/type1/t1afm.c,
src/type1/t1gload.c, src/type1/t1gload.h, src/type1/t1load.c,
src/type1/t1objs.c, src/type42/t42parse.c, src/type42/t42parse.h:
Many casts and slight argument type changes to make it work with
a 16bit compiler.
2003-06-05 06:31:05 +02:00
|
|
|
FT_Fixed mac_xscale = FT_SqrtFixed(
|
|
|
|
FT_MulFix( subglyph->transform.xx,
|
|
|
|
subglyph->transform.xx ) +
|
|
|
|
FT_MulFix( subglyph->transform.xy,
|
|
|
|
subglyph->transform.xy) );
|
|
|
|
FT_Fixed mac_yscale = FT_SqrtFixed(
|
|
|
|
FT_MulFix( subglyph->transform.yy,
|
|
|
|
subglyph->transform.yy ) +
|
|
|
|
FT_MulFix( subglyph->transform.yx,
|
|
|
|
subglyph->transform.yx ) );
|
2002-08-16 14:46:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
x = FT_MulFix( x, mac_xscale );
|
|
|
|
y = FT_MulFix( y, mac_yscale );
|
|
|
|
#endif /* 0 */
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2000-02-02 13:16:19 +01:00
|
|
|
x = FT_MulFix( x, x_scale );
|
|
|
|
y = FT_MulFix( y, y_scale );
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
if ( subglyph->flags & ROUND_XY_TO_GRID )
|
2000-06-12 21:36:41 +02:00
|
|
|
{
|
2003-12-24 02:10:46 +01:00
|
|
|
x = FT_PIX_ROUND( x );
|
|
|
|
y = FT_PIX_ROUND( y );
|
2000-06-12 21:36:41 +02:00
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-06-20 12:57:04 +02:00
|
|
|
if ( x || y )
|
2001-05-16 19:49:07 +02:00
|
|
|
{
|
|
|
|
translate_array( num_new_points,
|
|
|
|
gloader->base.outline.points + num_base_points,
|
|
|
|
x, y );
|
|
|
|
|
|
|
|
translate_array( num_new_points,
|
|
|
|
gloader->base.extra_points + num_base_points,
|
|
|
|
x, y );
|
|
|
|
}
|
2000-02-02 13:16:19 +01:00
|
|
|
}
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-25 09:43:15 +02:00
|
|
|
/*******************************************************************/
|
|
|
|
/*******************************************************************/
|
|
|
|
/*******************************************************************/
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-07-02 15:53:16 +02:00
|
|
|
/* we have finished loading all sub-glyphs; now, look for */
|
2000-06-12 21:36:41 +02:00
|
|
|
/* instructions for this composite! */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
2000-06-12 21:36:41 +02:00
|
|
|
|
|
|
|
if ( num_subglyphs > 0 &&
|
|
|
|
loader->exec &&
|
2002-02-19 02:12:23 +01:00
|
|
|
ins_pos > 0 &&
|
2000-06-12 21:36:41 +02:00
|
|
|
subglyph->flags & WE_HAVE_INSTR )
|
2000-02-02 13:16:19 +01:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_UShort n_ins;
|
2000-02-02 13:16:19 +01:00
|
|
|
TT_ExecContext exec = loader->exec;
|
2002-03-14 12:26:29 +01:00
|
|
|
TT_GlyphZone pts;
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Vector* pp1;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
/* read size of instructions */
|
2002-03-20 11:49:31 +01:00
|
|
|
if ( FT_STREAM_SEEK( ins_pos ) ||
|
* include/freetype/internal/ftstream.h,
src/base/ftstream.c, src/cff/cffload.c, src/pcf/pcfread.c,
src/sfnt/ttcmap.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c,
src/sfnt/ttpost.c, src/sfnt/ttsbit.c,
src/truetype/ttgload.c, src/truetype/ttpload.c,
src/winfonts/winfnt.c:
changed the definitions of stream macros. Examples:
NEXT_Byte => FT_NEXT_BYTE
NEXT_Short => FT_NEXT_SHORT
NEXT_UShortLE => FT_NEXT_USHORT_LE
READ_Short => FT_READ_SHORT
GET_Long => FT_GET_LONG
etc..
also introduced the FT_PEEK_XXXX functions..
2002-03-22 13:55:23 +01:00
|
|
|
FT_READ_USHORT( n_ins ) )
|
2000-06-12 21:36:41 +02:00
|
|
|
goto Fail;
|
2000-06-06 22:41:48 +02:00
|
|
|
FT_TRACE5(( " Instructions size = %d\n", n_ins ));
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-07-02 15:53:16 +02:00
|
|
|
/* in some fonts? */
|
2002-04-01 16:25:28 +02:00
|
|
|
if ( n_ins == 0xFFFFU )
|
2000-06-23 07:02:13 +02:00
|
|
|
n_ins = 0;
|
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
/* check it */
|
|
|
|
if ( n_ins > face->max_profile.maxSizeOfInstructions )
|
|
|
|
{
|
2000-06-23 07:02:13 +02:00
|
|
|
FT_TRACE0(( "Too many instructions (%d) in composite glyph %ld\n",
|
|
|
|
n_ins, subglyph->index ));
|
2002-01-03 17:56:59 +01:00
|
|
|
error = TT_Err_Too_Many_Hints;
|
|
|
|
goto Fail;
|
2000-02-02 13:16:19 +01:00
|
|
|
}
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
/* read the instructions */
|
2002-03-20 11:49:31 +01:00
|
|
|
if ( FT_STREAM_READ( exec->glyphIns, n_ins ) )
|
2000-02-02 13:16:19 +01:00
|
|
|
goto Fail;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-23 07:02:13 +02:00
|
|
|
glyph->control_data = exec->glyphIns;
|
|
|
|
glyph->control_len = n_ins;
|
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
error = TT_Set_CodeRange( exec,
|
|
|
|
tt_coderange_glyph,
|
|
|
|
exec->glyphIns,
|
|
|
|
n_ins );
|
2000-06-12 21:36:41 +02:00
|
|
|
if ( error )
|
|
|
|
goto Fail;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
error = FT_GlyphLoader_CheckPoints( gloader, num_points + 4, 0 );
|
2003-06-04 09:59:58 +02:00
|
|
|
if ( error )
|
|
|
|
goto Fail;
|
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
/* prepare the execution context */
|
2000-06-25 08:47:11 +02:00
|
|
|
tt_prepare_zone( &exec->pts, &gloader->base,
|
|
|
|
start_point, start_contour );
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
pts = &exec->pts;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
pts->n_points = (short)( num_points + 4 );
|
2000-07-05 20:23:38 +02:00
|
|
|
pts->n_contours = gloader->base.outline.n_contours;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
/* add phantom points */
|
|
|
|
pp1 = pts->cur + num_points;
|
|
|
|
pp1[0] = loader->pp1;
|
|
|
|
pp1[1] = loader->pp2;
|
2004-03-27 09:43:17 +01:00
|
|
|
pp1[2] = loader->pp3;
|
|
|
|
pp1[3] = loader->pp4;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-29 05:14:25 +02:00
|
|
|
pts->tags[num_points ] = 0;
|
2000-03-09 12:46:25 +01:00
|
|
|
pts->tags[num_points + 1] = 0;
|
2004-03-27 09:43:17 +01:00
|
|
|
pts->tags[num_points + 2] = 0;
|
|
|
|
pts->tags[num_points + 3] = 0;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
/* if hinting, round the phantom points */
|
2000-06-12 21:36:41 +02:00
|
|
|
if ( IS_HINTED( loader->load_flags ) )
|
2000-02-02 13:16:19 +01:00
|
|
|
{
|
2003-12-24 02:10:46 +01:00
|
|
|
pp1[0].x = FT_PIX_ROUND( loader->pp1.x );
|
|
|
|
pp1[1].x = FT_PIX_ROUND( loader->pp2.x );
|
2004-03-27 09:43:17 +01:00
|
|
|
pp1[2].y = FT_PIX_ROUND( loader->pp3.y );
|
|
|
|
pp1[3].y = FT_PIX_ROUND( loader->pp4.y );
|
2000-02-02 13:16:19 +01:00
|
|
|
}
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_UInt k;
|
2000-06-12 21:36:41 +02:00
|
|
|
|
|
|
|
|
2000-07-05 20:23:38 +02:00
|
|
|
for ( k = 0; k < num_points; k++ )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
pts->tags[k] &= FT_CURVE_TAG_ON;
|
2000-02-02 13:16:19 +01:00
|
|
|
}
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
cur_to_org( num_points + 4, pts );
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
/* now consider hinting */
|
2000-06-25 09:43:15 +02:00
|
|
|
if ( IS_HINTED( loader->load_flags ) && n_ins > 0 )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2000-02-02 13:16:19 +01:00
|
|
|
exec->is_composite = TRUE;
|
2000-06-23 07:02:13 +02:00
|
|
|
error = TT_Run_Context( exec, ((TT_Size)loader->size)->debug );
|
2000-02-02 13:16:19 +01:00
|
|
|
if ( error && exec->pedantic_hinting )
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Fail;
|
|
|
|
}
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
/* save glyph origin and advance points */
|
|
|
|
loader->pp1 = pp1[0];
|
|
|
|
loader->pp2 = pp1[1];
|
2004-03-27 09:43:17 +01:00
|
|
|
loader->pp3 = pp1[2];
|
|
|
|
loader->pp4 = pp1[3];
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
2000-06-25 09:43:15 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
|
2000-06-25 09:43:15 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
2000-06-12 21:36:41 +02:00
|
|
|
/* end of composite loading */
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
2003-01-08 10:59:17 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* invalid composite count ( negative but not -1 ) */
|
|
|
|
error = TT_Err_Invalid_Outline;
|
|
|
|
goto Fail;
|
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/***********************************************************************/
|
|
|
|
/***********************************************************************/
|
|
|
|
/***********************************************************************/
|
2000-02-02 13:16:19 +01:00
|
|
|
|
|
|
|
Fail:
|
2000-06-25 08:47:11 +02:00
|
|
|
if ( opened_frame )
|
2000-06-25 06:49:19 +02:00
|
|
|
face->forget_glyph_frame( loader );
|
2000-06-23 14:26:14 +02:00
|
|
|
|
|
|
|
Exit:
|
2002-08-01 17:29:17 +02:00
|
|
|
|
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
2002-08-06 23:47:40 +02:00
|
|
|
if ( glyph_data_loaded )
|
|
|
|
face->root.internal->incremental_interface->funcs->free_glyph_data(
|
|
|
|
face->root.internal->incremental_interface->object,
|
|
|
|
&glyph_data );
|
2002-08-01 17:29:17 +02:00
|
|
|
#endif
|
|
|
|
|
2000-05-17 01:44:38 +02:00
|
|
|
return error;
|
2000-02-02 13:16:19 +01:00
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
2002-07-18 17:59:23 +02:00
|
|
|
static FT_Error
|
2002-03-14 12:26:29 +01:00
|
|
|
compute_glyph_metrics( TT_Loader loader,
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_UInt glyph_index )
|
2000-02-02 13:16:19 +01:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_BBox bbox;
|
2000-06-23 07:02:13 +02:00
|
|
|
TT_Face face = (TT_Face)loader->face;
|
2001-06-18 16:23:45 +02:00
|
|
|
FT_Fixed y_scale;
|
2000-02-02 13:16:19 +01:00
|
|
|
TT_GlyphSlot glyph = loader->glyph;
|
2000-06-23 07:02:13 +02:00
|
|
|
TT_Size size = (TT_Size)loader->size;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-25 09:43:15 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
y_scale = 0x10000L;
|
|
|
|
if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
|
2000-02-02 13:16:19 +01:00
|
|
|
y_scale = size->root.metrics.y_scale;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
if ( glyph->format != FT_GLYPH_FORMAT_COMPOSITE )
|
2000-02-02 13:16:19 +01:00
|
|
|
{
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
glyph->outline.flags &= ~FT_OUTLINE_SINGLE_PASS;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
/* copy outline to our glyph slot */
|
2002-03-14 13:56:35 +01:00
|
|
|
FT_GlyphLoader_CopyPoints( glyph->internal->loader, loader->gloader );
|
2000-11-04 03:52:02 +01:00
|
|
|
glyph->outline = glyph->internal->loader->base.outline;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2000-03-28 13:19:28 +02:00
|
|
|
/* translate array so that (0,0) is the glyph's origin */
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
FT_Outline_Translate( &glyph->outline, -loader->pp1.x, 0 );
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-03-28 13:19:28 +02:00
|
|
|
FT_Outline_Get_CBox( &glyph->outline, &bbox );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
if ( IS_HINTED( loader->load_flags ) )
|
2000-03-28 13:19:28 +02:00
|
|
|
{
|
|
|
|
/* grid-fit the bounding box */
|
2003-12-24 02:10:46 +01:00
|
|
|
bbox.xMin = FT_PIX_FLOOR( bbox.xMin );
|
|
|
|
bbox.yMin = FT_PIX_FLOOR( bbox.yMin );
|
|
|
|
bbox.xMax = FT_PIX_CEIL( bbox.xMax );
|
|
|
|
bbox.yMax = FT_PIX_CEIL( bbox.yMax );
|
2000-03-28 13:19:28 +02:00
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
2000-03-28 13:19:28 +02:00
|
|
|
else
|
|
|
|
bbox = loader->bbox;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
/* get the device-independent horizontal advance. It is scaled later */
|
|
|
|
/* by the base layer. */
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2001-06-08 15:29:36 +02:00
|
|
|
FT_Pos advance = loader->linear;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-07-02 15:53:16 +02:00
|
|
|
/* the flag FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH was introduced to */
|
|
|
|
/* correctly support DynaLab fonts, which have an incorrect */
|
|
|
|
/* `advance_Width_Max' field! It is used, to my knowledge, */
|
|
|
|
/* exclusively in the X-TrueType font server. */
|
|
|
|
/* */
|
2002-04-01 16:25:28 +02:00
|
|
|
if ( face->postscript.isFixedPitch &&
|
2000-06-12 21:36:41 +02:00
|
|
|
( loader->load_flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ) == 0 )
|
1999-12-17 00:11:37 +01:00
|
|
|
advance = face->horizontal.advance_Width_Max;
|
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
/* we need to return the advance in font units in linearHoriAdvance, */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* it will be scaled later by the base layer. */
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
glyph->linearHoriAdvance = advance;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
glyph->metrics.horiBearingX = bbox.xMin;
|
|
|
|
glyph->metrics.horiBearingY = bbox.yMax;
|
2000-02-02 13:16:19 +01:00
|
|
|
glyph->metrics.horiAdvance = loader->pp2.x - loader->pp1.x;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2001-12-14 15:52:58 +01:00
|
|
|
/* don't forget to hint the advance when we need to */
|
|
|
|
if ( IS_HINTED( loader->load_flags ) )
|
2003-12-24 02:10:46 +01:00
|
|
|
glyph->metrics.horiAdvance = FT_PIX_ROUND( glyph->metrics.horiAdvance );
|
2001-12-14 15:52:58 +01:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/* Now take care of vertical metrics. In the case where there is */
|
|
|
|
/* no vertical information within the font (relatively common), make */
|
|
|
|
/* up some metrics by `hand'... */
|
|
|
|
|
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Short top_bearing; /* vertical top side bearing (EM units) */
|
|
|
|
FT_UShort advance_height; /* vertical advance height (EM units) */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Pos left; /* scaled vertical left side bearing */
|
|
|
|
FT_Pos top; /* scaled vertical top side bearing */
|
|
|
|
FT_Pos advance; /* scaled vertical advance height */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2004-06-03 09:56:21 +02:00
|
|
|
|
2002-07-18 17:59:23 +02:00
|
|
|
/* Get the unscaled top bearing and advance height. */
|
2003-02-13 18:49:27 +01:00
|
|
|
if ( face->vertical_info &&
|
1999-12-17 00:11:37 +01:00
|
|
|
face->vertical.number_Of_VMetrics > 0 )
|
|
|
|
{
|
2004-06-03 09:56:21 +02:00
|
|
|
advance_height = (FT_UShort)( loader->pp4.y - loader->pp3.y );
|
|
|
|
top_bearing = (FT_Short)( loader->pp3.y - bbox.yMax );
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-06-12 21:36:41 +02:00
|
|
|
/* Make up the distances from the horizontal header. */
|
|
|
|
|
|
|
|
/* NOTE: The OS/2 values are the only `portable' ones, */
|
|
|
|
/* which is why we use them, if there is an OS/2 */
|
|
|
|
/* table in the font. Otherwise, we use the */
|
|
|
|
/* values defined in the horizontal header. */
|
|
|
|
/* */
|
|
|
|
/* NOTE2: The sTypoDescender is negative, which is why */
|
|
|
|
/* we compute the baseline-to-baseline distance */
|
|
|
|
/* here with: */
|
|
|
|
/* ascender - descender + linegap */
|
|
|
|
/* */
|
2004-03-27 09:43:17 +01:00
|
|
|
/* NOTE3: This is different from what MS's rasterizer */
|
|
|
|
/* appears to do when getting default values */
|
|
|
|
/* for the vertical phantom points. We leave */
|
|
|
|
/* the old code untouched, but relying on */
|
|
|
|
/* phantom points alone might be reasonable */
|
|
|
|
/* (i.e., removing the `if' above). */
|
2002-04-01 16:25:28 +02:00
|
|
|
if ( face->os2.version != 0xFFFFU )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2001-06-20 01:03:41 +02:00
|
|
|
top_bearing = (FT_Short)( face->os2.sTypoLineGap / 2 );
|
2000-06-16 21:34:52 +02:00
|
|
|
advance_height = (FT_UShort)( face->os2.sTypoAscender -
|
2000-06-12 21:36:41 +02:00
|
|
|
face->os2.sTypoDescender +
|
|
|
|
face->os2.sTypoLineGap );
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-06-20 01:03:41 +02:00
|
|
|
top_bearing = (FT_Short)( face->horizontal.Line_Gap / 2 );
|
2000-06-16 21:34:52 +02:00
|
|
|
advance_height = (FT_UShort)( face->horizontal.Ascender +
|
2000-06-12 21:36:41 +02:00
|
|
|
face->horizontal.Descender +
|
|
|
|
face->horizontal.Line_Gap );
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-02-13 18:49:27 +01:00
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
|
|
|
|
|
|
|
/* If this is an incrementally loaded font see if there are */
|
|
|
|
/* overriding metrics for this glyph. */
|
|
|
|
if ( face->root.internal->incremental_interface &&
|
|
|
|
face->root.internal->incremental_interface->funcs->get_glyph_metrics )
|
|
|
|
{
|
|
|
|
FT_Incremental_MetricsRec metrics;
|
2005-03-08 21:24:56 +01:00
|
|
|
FT_Error error = TT_Err_Ok;
|
2003-02-13 18:49:27 +01:00
|
|
|
|
2003-04-23 17:50:27 +02:00
|
|
|
|
|
|
|
metrics.bearing_x = 0;
|
|
|
|
metrics.bearing_y = top_bearing;
|
|
|
|
metrics.advance = advance_height;
|
2003-02-13 18:49:27 +01:00
|
|
|
error =
|
|
|
|
face->root.internal->incremental_interface->funcs->get_glyph_metrics(
|
|
|
|
face->root.internal->incremental_interface->object,
|
|
|
|
glyph_index, TRUE, &metrics );
|
|
|
|
|
|
|
|
if ( error )
|
|
|
|
return error;
|
|
|
|
|
|
|
|
top_bearing = (FT_Short)metrics.bearing_y;
|
|
|
|
advance_height = (FT_UShort)metrics.advance;
|
|
|
|
}
|
|
|
|
|
2004-03-27 09:43:17 +01:00
|
|
|
/* GWW: Do vertical metrics get loaded incrementally too? */
|
|
|
|
|
2003-02-13 18:49:27 +01:00
|
|
|
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
|
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/* We must adjust the top_bearing value from the bounding box given */
|
2003-02-13 18:49:27 +01:00
|
|
|
/* in the glyph header to the bounding box calculated with */
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
/* FT_Get_Outline_CBox(). */
|
2000-01-07 19:44:50 +01:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/* scale the metrics */
|
2000-06-12 21:36:41 +02:00
|
|
|
if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2000-02-02 13:16:19 +01:00
|
|
|
top = FT_MulFix( top_bearing + loader->bbox.yMax, y_scale )
|
|
|
|
- bbox.yMax;
|
|
|
|
advance = FT_MulFix( advance_height, y_scale );
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-02-02 13:16:19 +01:00
|
|
|
top = top_bearing + loader->bbox.yMax - bbox.yMax;
|
1999-12-17 00:11:37 +01:00
|
|
|
advance = advance_height;
|
|
|
|
}
|
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
/* set the advance height in design units. It is scaled later by */
|
|
|
|
/* the base layer. */
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
glyph->linearVertAdvance = advance_height;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
/* XXX: for now, we have no better algorithm for the lsb, but it */
|
|
|
|
/* should work fine. */
|
|
|
|
/* */
|
1999-12-17 00:11:37 +01:00
|
|
|
left = ( bbox.xMin - bbox.xMax ) / 2;
|
|
|
|
|
|
|
|
/* grid-fit them if necessary */
|
2000-06-12 21:36:41 +02:00
|
|
|
if ( IS_HINTED( loader->load_flags ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2003-12-24 02:10:46 +01:00
|
|
|
left = FT_PIX_FLOOR( left );
|
|
|
|
top = FT_PIX_CEIL( top );
|
|
|
|
advance = FT_PIX_ROUND( advance );
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
glyph->metrics.vertBearingX = left;
|
|
|
|
glyph->metrics.vertBearingY = top;
|
|
|
|
glyph->metrics.vertAdvance = advance;
|
|
|
|
}
|
|
|
|
|
2000-06-25 09:43:15 +02:00
|
|
|
/* adjust advance width to the value contained in the hdmx table */
|
2000-02-02 13:16:19 +01:00
|
|
|
if ( !face->postscript.isFixedPitch && size &&
|
2000-06-12 21:36:41 +02:00
|
|
|
IS_HINTED( loader->load_flags ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2005-02-26 01:12:04 +01:00
|
|
|
FT_Byte* widthp = Get_Advance_WidthPtr( face,
|
|
|
|
size->root.metrics.x_ppem,
|
|
|
|
glyph_index );
|
2000-06-25 09:43:15 +02:00
|
|
|
|
|
|
|
|
2005-02-26 01:12:04 +01:00
|
|
|
if ( widthp )
|
|
|
|
glyph->metrics.horiAdvance = *widthp << 6;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* set glyph dimensions */
|
|
|
|
glyph->metrics.width = bbox.xMax - bbox.xMin;
|
|
|
|
glyph->metrics.height = bbox.yMax - bbox.yMin;
|
2002-07-18 17:59:23 +02:00
|
|
|
|
|
|
|
return 0;
|
2000-02-02 13:16:19 +01:00
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* TT_Load_Glyph */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* A function used to load a single glyph within a given glyph slot, */
|
|
|
|
/* for a given size. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* glyph :: A handle to a target slot object where the glyph */
|
|
|
|
/* will be loaded. */
|
|
|
|
/* */
|
|
|
|
/* size :: A handle to the source face size at which the glyph */
|
|
|
|
/* must be scaled/loaded. */
|
|
|
|
/* */
|
|
|
|
/* glyph_index :: The index of the glyph in the font file. */
|
|
|
|
/* */
|
|
|
|
/* load_flags :: A flag indicating what to load for this glyph. The */
|
|
|
|
/* FT_LOAD_XXX constants can be used to control the */
|
|
|
|
/* glyph loading process (e.g., whether the outline */
|
|
|
|
/* should be scaled, whether to load bitmaps or not, */
|
|
|
|
/* whether to hint the outline, etc). */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* FreeType error code. 0 means success. */
|
2000-06-12 21:36:41 +02:00
|
|
|
/* */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
2001-06-28 09:17:51 +02:00
|
|
|
TT_Load_Glyph( TT_Size size,
|
|
|
|
TT_GlyphSlot glyph,
|
2004-04-19 08:13:50 +02:00
|
|
|
FT_UInt glyph_index,
|
2002-09-21 20:43:10 +02:00
|
|
|
FT_Int32 load_flags )
|
2000-02-02 13:16:19 +01:00
|
|
|
{
|
2002-02-28 17:10:29 +01:00
|
|
|
SFNT_Service sfnt;
|
2002-04-01 16:25:28 +02:00
|
|
|
TT_Face face;
|
|
|
|
FT_Stream stream;
|
|
|
|
FT_Error error;
|
|
|
|
TT_LoaderRec loader;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
face = (TT_Face)glyph->face;
|
2002-02-28 17:10:29 +01:00
|
|
|
sfnt = (SFNT_Service)face->sfnt;
|
2000-02-02 13:16:19 +01:00
|
|
|
stream = face->root.stream;
|
2005-03-08 21:24:56 +01:00
|
|
|
error = TT_Err_Ok;
|
2000-03-28 13:19:28 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
if ( !size || ( load_flags & FT_LOAD_NO_SCALE ) ||
|
|
|
|
( load_flags & FT_LOAD_NO_RECURSE ) )
|
2000-02-02 13:16:19 +01:00
|
|
|
{
|
|
|
|
size = NULL;
|
|
|
|
load_flags |= FT_LOAD_NO_SCALE |
|
|
|
|
FT_LOAD_NO_HINTING |
|
|
|
|
FT_LOAD_NO_BITMAP;
|
|
|
|
}
|
|
|
|
|
2000-03-28 13:19:28 +02:00
|
|
|
glyph->num_subglyphs = 0;
|
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
2000-11-07 07:30:29 +01:00
|
|
|
|
|
|
|
/* try to load embedded bitmap if any */
|
|
|
|
/* */
|
|
|
|
/* XXX: The convention should be emphasized in */
|
|
|
|
/* the documents because it can be confusing. */
|
2000-06-12 21:36:41 +02:00
|
|
|
if ( size &&
|
2002-04-01 16:25:28 +02:00
|
|
|
size->strike_index != 0xFFFFU &&
|
2000-11-07 00:07:51 +01:00
|
|
|
sfnt->load_sbits &&
|
|
|
|
( load_flags & FT_LOAD_NO_BITMAP ) == 0 )
|
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
{
|
2002-03-14 12:26:29 +01:00
|
|
|
TT_SBit_MetricsRec metrics;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
error = sfnt->load_sbit_image( face,
|
* include/freetype/internal/ftdriver.h,
include/freetype/internal/ftobjs.h,
include/freetype/internal/psaux.h, src/cid/cidgload.c,
src/psaux/psobjs.c, src/psaux/t1decode.c, src/psaux/psobjs.h,
src/pshinter/pshrec.c, src/pshinter/pshalgo.c,
src/psnames/psmodule.c, src/raster/ftraster.c, src/sfnt/sfobjs.c,
src/smooth/ftgrays.c, src/smooth/ftsmooth.c, src/truetype/ttobjs.c,
src/truetype/ttdriver.c, src/truetype/ttgload.c, src/type1/t1afm.c,
src/type1/t1gload.c, src/type1/t1gload.h, src/type1/t1load.c,
src/type1/t1objs.c, src/type42/t42parse.c, src/type42/t42parse.h:
Many casts and slight argument type changes to make it work with
a 16bit compiler.
2003-06-05 06:31:05 +02:00
|
|
|
(FT_ULong)size->strike_index,
|
2004-04-19 08:13:50 +02:00
|
|
|
glyph_index,
|
* include/freetype/internal/ftdriver.h,
include/freetype/internal/ftobjs.h,
include/freetype/internal/psaux.h, src/cid/cidgload.c,
src/psaux/psobjs.c, src/psaux/t1decode.c, src/psaux/psobjs.h,
src/pshinter/pshrec.c, src/pshinter/pshalgo.c,
src/psnames/psmodule.c, src/raster/ftraster.c, src/sfnt/sfobjs.c,
src/smooth/ftgrays.c, src/smooth/ftsmooth.c, src/truetype/ttobjs.c,
src/truetype/ttdriver.c, src/truetype/ttgload.c, src/type1/t1afm.c,
src/type1/t1gload.c, src/type1/t1gload.h, src/type1/t1load.c,
src/type1/t1objs.c, src/type42/t42parse.c, src/type42/t42parse.h:
Many casts and slight argument type changes to make it work with
a 16bit compiler.
2003-06-05 06:31:05 +02:00
|
|
|
(FT_Int)load_flags,
|
2000-02-02 13:16:19 +01:00
|
|
|
stream,
|
|
|
|
&glyph->bitmap,
|
|
|
|
&metrics );
|
|
|
|
if ( !error )
|
|
|
|
{
|
|
|
|
glyph->outline.n_points = 0;
|
|
|
|
glyph->outline.n_contours = 0;
|
|
|
|
|
2000-06-16 21:34:52 +02:00
|
|
|
glyph->metrics.width = (FT_Pos)metrics.width << 6;
|
|
|
|
glyph->metrics.height = (FT_Pos)metrics.height << 6;
|
2000-02-02 13:16:19 +01:00
|
|
|
|
2000-06-16 21:34:52 +02:00
|
|
|
glyph->metrics.horiBearingX = (FT_Pos)metrics.horiBearingX << 6;
|
|
|
|
glyph->metrics.horiBearingY = (FT_Pos)metrics.horiBearingY << 6;
|
|
|
|
glyph->metrics.horiAdvance = (FT_Pos)metrics.horiAdvance << 6;
|
2000-02-02 13:16:19 +01:00
|
|
|
|
2000-06-16 21:34:52 +02:00
|
|
|
glyph->metrics.vertBearingX = (FT_Pos)metrics.vertBearingX << 6;
|
|
|
|
glyph->metrics.vertBearingY = (FT_Pos)metrics.vertBearingY << 6;
|
|
|
|
glyph->metrics.vertAdvance = (FT_Pos)metrics.vertAdvance << 6;
|
2000-02-02 13:16:19 +01:00
|
|
|
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
glyph->format = FT_GLYPH_FORMAT_BITMAP;
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
|
|
|
|
{
|
2000-07-11 00:03:10 +02:00
|
|
|
glyph->bitmap_left = metrics.vertBearingX;
|
|
|
|
glyph->bitmap_top = metrics.vertBearingY;
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-07-11 00:03:10 +02:00
|
|
|
glyph->bitmap_left = metrics.horiBearingX;
|
|
|
|
glyph->bitmap_top = metrics.horiBearingY;
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
}
|
2000-02-02 13:16:19 +01:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
}
|
2000-06-12 21:36:41 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
|
|
|
|
2001-12-19 23:26:12 +01:00
|
|
|
/* return immediately if we only want the embedded bitmaps */
|
2001-12-19 22:09:16 +01:00
|
|
|
if ( load_flags & FT_LOAD_SBITS_ONLY )
|
* src/winfonts/winfnt.c (FNT_Load_Glyph): Use first_char in
computation of glyph_index.
(FNT_Size_Set_Pixels): To find a strike, first check pixel_height
only, then try to find a better hit by comparing pixel_width also.
Without this fix it isn't possible to access all strikes.
Also compute metrics.max_advance to be in sync with other bitmap
drivers.
* src/base/ftobjs.c (FT_Set_Char_Size): Remove redundant code.
(FT_Set_Pixel_Size): Assign value to `metrics' after validation of
arguments.
Synchronize computation of height and width for bitmap strikes. The
`width' field in the FT_Bitmap_Size structure is now only useful to
enumerate different strikes. The `max_advance' field of the
FT_Size_Metrics structure should be used to get the (maximum) width
of a strike.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Don't use AVERAGE_WIDTH for
computing `available_sizes->width' but make it always equal to
`available_sizes->height'.
* src/pcf/pcfread.c (pcf_load_font): Don't use RESOLUTION_X for
computing `available_sizes->width' but make it always equal to
`available_sizes->height'.
* src/truetype/ttdriver.c (Set_Pixel_Sizes): Pass only single
argument to function.
* src/psnames/psmodule.c (ps_unicode_value): Handle `.' after
`uniXXXX' and `uXXXX[X[X]]'.
* src/bdf/bdfdrivr.c: s/FT_Err_/BDF_Err/.
* src/cache/ftccache.c, src/cache/ftcsbits.c, src/cache/ftlru.c:
s/FT_Err_/FTC_Err_/.
* src/cff/cffcmap.c: s/FT_Err_/CFF_Err_/.
* src/pcf/pcfdrivr.c: s/FT_Err_/PCF_Err_/.
* src/psaux/t1cmap.c: Include psauxerr.h.
s/FT_Err_/PSaux_Err_/.
* src/pshinter/pshnterr.h: New file.
* src/pshinter/rules.mk: Updated.
* src/pshinter/pshalgo.c, src/pshinter/pshrec.c: Include pshnterr.h.
s/FT_Err_/PSH_Err_/.
* src/pfr/pfrdrivr.c, src/pfr/pfrobjs.c, src/pfr/pfrsbit.c:
s/FT_Err_/PFR_Err_/.
* src/sfnt/sfdriver.c, src/sfnt/sfobjs.c, src/sfnt/ttcmap0.c,
src/sfnt/ttload.c: s/FT_Err_/SFNT_Err_/.
* src/truetype/ttgload.c: s/FT_Err_/TT_Err_/.
* src/gzip/ftgzip.c: Load FT_MODULE_ERRORS_H and define
FT_ERR_PREFIX and FT_ERR_BASE.
s/FT_Err_/Gzip_Err_/.
2003-06-22 17:33:53 +02:00
|
|
|
return TT_Err_Invalid_Argument;
|
2001-12-19 22:09:16 +01:00
|
|
|
|
2000-07-02 15:53:16 +02:00
|
|
|
/* seek to the beginning of the glyph table. For Type 42 fonts */
|
2000-06-12 21:36:41 +02:00
|
|
|
/* the table might be accessed from a Postscript stream or something */
|
|
|
|
/* else... */
|
2002-07-26 11:09:10 +02:00
|
|
|
|
2002-07-18 17:59:23 +02:00
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
2002-07-26 11:09:10 +02:00
|
|
|
|
|
|
|
/* Don't look for the glyph table if this is an incremental font. */
|
2002-08-01 17:29:17 +02:00
|
|
|
if ( !face->root.internal->incremental_interface )
|
2002-07-26 11:09:10 +02:00
|
|
|
|
2002-07-18 17:59:23 +02:00
|
|
|
#endif
|
2002-07-26 11:09:10 +02:00
|
|
|
|
|
|
|
{
|
2002-07-18 17:59:23 +02:00
|
|
|
error = face->goto_table( face, TTAG_glyf, stream, 0 );
|
|
|
|
if ( error )
|
|
|
|
{
|
|
|
|
FT_ERROR(( "TT_Load_Glyph: could not access glyph table\n" ));
|
|
|
|
goto Exit;
|
|
|
|
}
|
2002-07-26 11:09:10 +02:00
|
|
|
}
|
2000-02-02 13:16:19 +01:00
|
|
|
|
2002-07-28 07:05:24 +02:00
|
|
|
FT_MEM_ZERO( &loader, sizeof ( loader ) );
|
2000-02-02 13:16:19 +01:00
|
|
|
|
2000-02-21 17:01:33 +01:00
|
|
|
/* update the glyph zone bounds */
|
|
|
|
{
|
2005-03-08 21:24:56 +01:00
|
|
|
FT_GlyphLoader gloader = FT_FACE_DRIVER( face )->glyph_loader;
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
loader.gloader = gloader;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
FT_GlyphLoader_Rewind( gloader );
|
2000-07-05 06:32:02 +02:00
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
tt_prepare_zone( &loader.zone, &gloader->base, 0, 0 );
|
|
|
|
tt_prepare_zone( &loader.base, &gloader->base, 0, 0 );
|
2000-02-21 17:01:33 +01:00
|
|
|
}
|
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
2000-06-12 21:36:41 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
if ( size )
|
|
|
|
{
|
|
|
|
/* query new execution context */
|
2000-06-12 21:36:41 +02:00
|
|
|
loader.exec = size->debug ? size->context : TT_New_Context( face );
|
2000-02-02 13:16:19 +01:00
|
|
|
if ( !loader.exec )
|
|
|
|
return TT_Err_Could_Not_Find_Context;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
TT_Load_Context( loader.exec, face, size );
|
2000-06-23 07:02:13 +02:00
|
|
|
loader.instructions = loader.exec->glyphIns;
|
2000-02-02 13:16:19 +01:00
|
|
|
|
|
|
|
/* load default graphics state - if needed */
|
|
|
|
if ( size->GS.instruct_control & 2 )
|
|
|
|
loader.exec->GS = tt_default_graphics_state;
|
2004-08-07 17:08:33 +02:00
|
|
|
|
|
|
|
loader.exec->pedantic_hinting =
|
|
|
|
FT_BOOL( load_flags & FT_LOAD_PEDANTIC );
|
|
|
|
|
|
|
|
loader.exec->grayscale =
|
|
|
|
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) != FT_LOAD_TARGET_MONO );
|
2000-02-02 13:16:19 +01:00
|
|
|
}
|
2000-06-12 21:36:41 +02:00
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
|
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/* clear all outline flags, except the `owner' one */
|
2000-06-28 06:19:49 +02:00
|
|
|
glyph->outline.flags = 0;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/* let's initialize the rest of our loader now */
|
|
|
|
|
2000-02-02 13:16:19 +01:00
|
|
|
loader.load_flags = load_flags;
|
|
|
|
|
2000-06-23 07:02:13 +02:00
|
|
|
loader.face = (FT_Face)face;
|
|
|
|
loader.size = (FT_Size)size;
|
|
|
|
loader.glyph = (FT_GlyphSlot)glyph;
|
2000-02-02 13:16:19 +01:00
|
|
|
loader.stream = stream;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2002-07-18 17:59:23 +02:00
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
2002-07-26 11:09:10 +02:00
|
|
|
|
2002-08-01 17:29:17 +02:00
|
|
|
if ( face->root.internal->incremental_interface )
|
2002-07-18 17:59:23 +02:00
|
|
|
loader.glyf_offset = 0;
|
2002-07-26 11:09:10 +02:00
|
|
|
else
|
|
|
|
|
2002-07-18 17:59:23 +02:00
|
|
|
#endif
|
2002-07-26 11:09:10 +02:00
|
|
|
|
|
|
|
loader.glyf_offset = FT_STREAM_POS();
|
2000-02-02 13:16:19 +01:00
|
|
|
|
|
|
|
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
2000-06-12 21:36:41 +02:00
|
|
|
|
|
|
|
/* if the cvt program has disabled hinting, the argument */
|
|
|
|
/* is ignored. */
|
|
|
|
if ( size && ( size->GS.instruct_control & 1 ) )
|
2000-02-02 13:16:19 +01:00
|
|
|
loader.load_flags |= FT_LOAD_NO_HINTING;
|
2000-06-12 21:36:41 +02:00
|
|
|
|
|
|
|
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
|
2000-02-02 13:16:19 +01:00
|
|
|
|
|
|
|
/* Main loading loop */
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
glyph->format = FT_GLYPH_FORMAT_OUTLINE;
|
2000-06-12 21:36:41 +02:00
|
|
|
glyph->num_subglyphs = 0;
|
2002-04-01 16:25:28 +02:00
|
|
|
|
2003-01-08 10:59:17 +01:00
|
|
|
error = load_truetype_glyph( &loader, glyph_index, 0 );
|
2000-06-12 21:36:41 +02:00
|
|
|
if ( !error )
|
2000-02-02 13:16:19 +01:00
|
|
|
compute_glyph_metrics( &loader, glyph_index );
|
|
|
|
|
|
|
|
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
2000-06-25 09:43:15 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
if ( !size || !size->debug )
|
2000-02-02 13:16:19 +01:00
|
|
|
TT_Done_Context( loader.exec );
|
2000-06-25 09:43:15 +02:00
|
|
|
|
|
|
|
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-05-05 09:40:16 +02:00
|
|
|
/* Set the `high precision' bit flag. */
|
|
|
|
/* This is _critical_ to get correct output for monochrome */
|
|
|
|
/* TrueType glyphs at all sizes using the bytecode interpreter. */
|
|
|
|
/* */
|
* src/truetype/ttgload.c (TT_Load_Glyph): finally fixing the last
bug that prevented FreeType 2.x and FreeType 1.x to produce
bit-by-bit identical monochrome glyph bitmaps with native TrueType
hinting. The culprit was a single-bit flag that wasn't set
correctly by the TrueType glyph loader !!
* src/otlayout/otlayout.h,
src/otlayout/otlbase.c,
src/otlayout/otlbase.h,
src/otlayout/otlconf.h,
src/otlayout/otlgdef.c,
src/otlayout/otlgdef.h,
src/otlayout/otlgpos.c,
src/otlayout/otlgpos.h,
src/otlayout/otlgsub.c,
src/otlayout/otlgsub.h,
src/otlayout/otljstf.c,
src/otlayout/otljstf.h,
src/otlayout/otltable.c,
src/otlayout/otltable.h,
src/otlayout/otltags.h:
adding OpenType Layout source files. Module is still incomplete
2002-05-04 20:02:59 +02:00
|
|
|
if ( size && size->root.metrics.y_ppem < 24 )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
|
* src/truetype/ttgload.c (TT_Load_Glyph): finally fixing the last
bug that prevented FreeType 2.x and FreeType 1.x to produce
bit-by-bit identical monochrome glyph bitmaps with native TrueType
hinting. The culprit was a single-bit flag that wasn't set
correctly by the TrueType glyph loader !!
* src/otlayout/otlayout.h,
src/otlayout/otlbase.c,
src/otlayout/otlbase.h,
src/otlayout/otlconf.h,
src/otlayout/otlgdef.c,
src/otlayout/otlgdef.h,
src/otlayout/otlgpos.c,
src/otlayout/otlgpos.h,
src/otlayout/otlgsub.c,
src/otlayout/otlgsub.h,
src/otlayout/otljstf.c,
src/otlayout/otljstf.h,
src/otlayout/otltable.c,
src/otlayout/otltable.h,
src/otlayout/otltags.h:
adding OpenType Layout source files. Module is still incomplete
2002-05-04 20:02:59 +02:00
|
|
|
|
2000-02-21 17:01:33 +01:00
|
|
|
Exit:
|
1999-12-17 00:11:37 +01:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* END */
|