2018-06-03 09:01:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
*
|
|
|
|
* sfdriver.c
|
|
|
|
*
|
|
|
|
* High-level SFNT driver interface (body).
|
|
|
|
*
|
2023-01-17 09:18:25 +01:00
|
|
|
* Copyright (C) 1996-2023 by
|
2018-06-03 09:01:17 +02:00
|
|
|
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
|
|
|
*
|
|
|
|
* This file is part of the FreeType project, and may only be used,
|
|
|
|
* modified, and distributed under the terms of the FreeType project
|
|
|
|
* license, LICENSE.TXT. By continuing to use, modify, or distribute
|
|
|
|
* this file you indicate that you have read the license and
|
|
|
|
* understand and accept it fully.
|
|
|
|
*
|
|
|
|
*/
|
2000-06-05 07:26:15 +02:00
|
|
|
|
2000-12-08 17:17:16 +01:00
|
|
|
|
2020-06-08 13:31:55 +02:00
|
|
|
#include <freetype/internal/ftdebug.h>
|
|
|
|
#include <freetype/internal/sfnt.h>
|
|
|
|
#include <freetype/internal/ftobjs.h>
|
|
|
|
#include <freetype/ttnameid.h>
|
2000-06-05 07:26:15 +02:00
|
|
|
|
2001-03-20 12:14:24 +01:00
|
|
|
#include "sfdriver.h"
|
|
|
|
#include "ttload.h"
|
|
|
|
#include "sfobjs.h"
|
2000-07-08 21:51:42 +02:00
|
|
|
|
2003-09-12 22:32:51 +02:00
|
|
|
#include "sferrors.h"
|
|
|
|
|
2000-11-29 16:18:54 +01:00
|
|
|
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
2001-03-20 12:14:24 +01:00
|
|
|
#include "ttsbit.h"
|
2000-11-29 16:18:54 +01:00
|
|
|
#endif
|
|
|
|
|
[sfnt] Preliminary support of coloured layer outlines.
This commit enables OpenType's COLR/CPAL table handling; a typical
application are color emojis that can be scaled to any size.
If the color palette does not exist or is invalid, the rendering
step rasterizes the outline instead. The current implementation
assumes that the foreground is black.
Enable this by defining option TT_CONFIG_OPTION_COLOR_LAYERS.
There are still some issues with metrics; additionally, an API to
fetch color layers is missing.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_COLOR_LAYERS): New macro.
* include/freetype/internal/ftobjs.h (FT_Glyph_LayerRec,
FT_Colr_InternalRec): New structures.
(FT_Slot_InternalRec): Add `color_layers' field.
* include/freetype/internal/sfnt.h (TT_Load_Colr_Layer_Func,
TT_Blend_Colr_Func): New function types.
(SFNT_Interface): Add `load_colr', `free_colr', `load_colr_layer',
and `colr_blend' fields.
* include/freetype/internal/tttypes.h (TT_FaceRec): Add
`colr_and_cpal' field.
* include/freetype/internal/tttags. (TTAG_COLR, TTAG_CPAL): New
macros.
* src/sfnt/ttcolr.c, src/sfnt/ttcolr.h: New files.
* src/base/ftobjs.c (ft_glyphslot_done, FT_Render_Glyph_Internal):
Handle glyph color layers.
* src/sfnt/Jamfile (_sources), src/sfnt/rules.mk (SFNT_DRV_SRC): Add
`ttcolr.c'.
* src/sfnt/sfdriver.c: Include `ttcolr.h'.
(PUT_COLOR_LAYERS): New macro.
Update call to `FT_DEFINE_SFNT_INTERFACE'.
* src/sfnt/sfnt.c: Include `ttcolr.c'.
* src/sfnt/sfobjs.c (sfnt_load_face): Load `COLR' and `CPAL' tables.
(sfnt_done_face): Updated.
* src/truetype/ttgload.c (TT_Load_Glyph): Handle color layers.
2018-05-13 03:25:09 +02:00
|
|
|
#ifdef TT_CONFIG_OPTION_COLOR_LAYERS
|
|
|
|
#include "ttcolr.h"
|
2018-06-14 11:32:47 +02:00
|
|
|
#include "ttcpal.h"
|
[sfnt] Preliminary support of coloured layer outlines.
This commit enables OpenType's COLR/CPAL table handling; a typical
application are color emojis that can be scaled to any size.
If the color palette does not exist or is invalid, the rendering
step rasterizes the outline instead. The current implementation
assumes that the foreground is black.
Enable this by defining option TT_CONFIG_OPTION_COLOR_LAYERS.
There are still some issues with metrics; additionally, an API to
fetch color layers is missing.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_COLOR_LAYERS): New macro.
* include/freetype/internal/ftobjs.h (FT_Glyph_LayerRec,
FT_Colr_InternalRec): New structures.
(FT_Slot_InternalRec): Add `color_layers' field.
* include/freetype/internal/sfnt.h (TT_Load_Colr_Layer_Func,
TT_Blend_Colr_Func): New function types.
(SFNT_Interface): Add `load_colr', `free_colr', `load_colr_layer',
and `colr_blend' fields.
* include/freetype/internal/tttypes.h (TT_FaceRec): Add
`colr_and_cpal' field.
* include/freetype/internal/tttags. (TTAG_COLR, TTAG_CPAL): New
macros.
* src/sfnt/ttcolr.c, src/sfnt/ttcolr.h: New files.
* src/base/ftobjs.c (ft_glyphslot_done, FT_Render_Glyph_Internal):
Handle glyph color layers.
* src/sfnt/Jamfile (_sources), src/sfnt/rules.mk (SFNT_DRV_SRC): Add
`ttcolr.c'.
* src/sfnt/sfdriver.c: Include `ttcolr.h'.
(PUT_COLOR_LAYERS): New macro.
Update call to `FT_DEFINE_SFNT_INTERFACE'.
* src/sfnt/sfnt.c: Include `ttcolr.c'.
* src/sfnt/sfobjs.c (sfnt_load_face): Load `COLR' and `CPAL' tables.
(sfnt_done_face): Updated.
* src/truetype/ttgload.c (TT_Load_Glyph): Handle color layers.
2018-05-13 03:25:09 +02:00
|
|
|
#endif
|
|
|
|
|
2021-12-26 04:20:44 +01:00
|
|
|
#ifdef FT_CONFIG_OPTION_SVG
|
|
|
|
#include "ttsvg.h"
|
|
|
|
#endif
|
|
|
|
|
2000-11-29 16:18:54 +01:00
|
|
|
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
2001-03-20 12:14:24 +01:00
|
|
|
#include "ttpost.h"
|
2000-11-29 16:18:54 +01:00
|
|
|
#endif
|
|
|
|
|
* include/freetype/config/ftoption.h,
include/freetype/config/ftstdlib.h,
include/freetype/internal/tttypes.h,
src/sfnt/Jamfile, src/sfnt/rules.mk, src/sfnt/sfdriver.c,
src/sfnt/ttbdf.h, src/sfnt/ttbdf.c, src/sfnt/sfobjs.c:
Added support for an embedded 'BDF ' table within SFNT-based
bitmap font files. This is used to store atoms & properties from
the original BDF fonts that were used to generate the font file.
the feature is controled by TT_CONFIG_OPTION_BDF within 'ftoption.h'
and is used to implement FT_Get_BDF_Property for these font files.
At the moment, this is still experimental, the BDF table format isn't
cast into stone yet.
2005-12-14 21:38:15 +01:00
|
|
|
#ifdef TT_CONFIG_OPTION_BDF
|
|
|
|
#include "ttbdf.h"
|
2020-06-08 13:31:55 +02:00
|
|
|
#include <freetype/internal/services/svbdf.h>
|
* include/freetype/config/ftoption.h,
include/freetype/config/ftstdlib.h,
include/freetype/internal/tttypes.h,
src/sfnt/Jamfile, src/sfnt/rules.mk, src/sfnt/sfdriver.c,
src/sfnt/ttbdf.h, src/sfnt/ttbdf.c, src/sfnt/sfobjs.c:
Added support for an embedded 'BDF ' table within SFNT-based
bitmap font files. This is used to store atoms & properties from
the original BDF fonts that were used to generate the font file.
the feature is controled by TT_CONFIG_OPTION_BDF within 'ftoption.h'
and is used to implement FT_Get_BDF_Property for these font files.
At the moment, this is still experimental, the BDF table format isn't
cast into stone yet.
2005-12-14 21:38:15 +01:00
|
|
|
#endif
|
|
|
|
|
2004-08-29 18:50:09 +02:00
|
|
|
#include "ttcmap.h"
|
2005-03-03 18:09:08 +01:00
|
|
|
#include "ttkern.h"
|
2006-02-15 07:05:52 +01:00
|
|
|
#include "ttmtx.h"
|
2003-12-17 15:28:22 +01:00
|
|
|
|
2020-06-08 13:31:55 +02:00
|
|
|
#include <freetype/internal/services/svgldict.h>
|
|
|
|
#include <freetype/internal/services/svpostnm.h>
|
|
|
|
#include <freetype/internal/services/svsfnt.h>
|
|
|
|
#include <freetype/internal/services/svttcmap.h>
|
2003-11-04 19:24:20 +01:00
|
|
|
|
2017-03-17 07:52:30 +01:00
|
|
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
2020-06-08 13:31:55 +02:00
|
|
|
#include <freetype/ftmm.h>
|
|
|
|
#include <freetype/internal/services/svmm.h>
|
2017-03-17 07:52:30 +01:00
|
|
|
#endif
|
|
|
|
|
2012-08-24 13:41:24 +02:00
|
|
|
|
2018-06-03 09:01:17 +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.
|
|
|
|
*/
|
2009-07-31 17:32:24 +02:00
|
|
|
#undef FT_COMPONENT
|
2018-08-15 18:13:17 +02:00
|
|
|
#define FT_COMPONENT sfdriver
|
2009-07-31 17:32:24 +02:00
|
|
|
|
2003-11-04 19:24:20 +01:00
|
|
|
|
2012-08-24 13:41:24 +02:00
|
|
|
/*
|
2018-06-03 09:01:17 +02:00
|
|
|
* SFNT TABLE SERVICE
|
2012-08-24 13:41:24 +02:00
|
|
|
*
|
|
|
|
*/
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2023-05-06 23:59:25 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
|
|
sfnt_load_table( FT_Face face, /* TT_Face */
|
|
|
|
FT_ULong tag,
|
|
|
|
FT_Long offset,
|
|
|
|
FT_Byte* buffer,
|
|
|
|
FT_ULong* length )
|
|
|
|
{
|
|
|
|
TT_Face ttface = (TT_Face)face;
|
|
|
|
|
|
|
|
|
|
|
|
return tt_face_load_any( ttface, tag, offset, buffer, length );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( void* )
|
|
|
|
get_sfnt_table( FT_Face face, /* TT_Face */
|
2001-06-28 01:25:46 +02:00
|
|
|
FT_Sfnt_Tag tag )
|
2000-05-27 00:13:17 +02:00
|
|
|
{
|
2023-05-06 23:59:25 +02:00
|
|
|
TT_Face ttface = (TT_Face)face;
|
|
|
|
|
2000-05-27 00:13:17 +02:00
|
|
|
void* table;
|
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
|
|
|
|
switch ( tag )
|
2000-05-27 00:13:17 +02:00
|
|
|
{
|
2014-12-03 10:18:34 +01:00
|
|
|
case FT_SFNT_HEAD:
|
2023-05-06 23:59:25 +02:00
|
|
|
table = &ttface->header;
|
2000-06-05 07:26:15 +02:00
|
|
|
break;
|
|
|
|
|
2014-12-03 10:18:34 +01:00
|
|
|
case FT_SFNT_HHEA:
|
2023-05-06 23:59:25 +02:00
|
|
|
table = &ttface->horizontal;
|
2000-06-05 07:26:15 +02:00
|
|
|
break;
|
|
|
|
|
2014-12-03 10:18:34 +01:00
|
|
|
case FT_SFNT_VHEA:
|
2023-05-06 23:59:25 +02:00
|
|
|
table = ttface->vertical_info ? &ttface->vertical : NULL;
|
2000-06-05 07:26:15 +02:00
|
|
|
break;
|
|
|
|
|
2014-12-03 10:18:34 +01:00
|
|
|
case FT_SFNT_OS2:
|
2023-05-06 23:59:25 +02:00
|
|
|
table = ( ttface->os2.version == 0xFFFFU ) ? NULL : &ttface->os2;
|
2000-06-05 07:26:15 +02:00
|
|
|
break;
|
|
|
|
|
2014-12-03 10:18:34 +01:00
|
|
|
case FT_SFNT_POST:
|
2023-05-06 23:59:25 +02:00
|
|
|
table = &ttface->postscript;
|
2000-06-05 07:26:15 +02:00
|
|
|
break;
|
|
|
|
|
2014-12-03 10:18:34 +01:00
|
|
|
case FT_SFNT_MAXP:
|
2023-05-06 23:59:25 +02:00
|
|
|
table = &ttface->max_profile;
|
2000-06-05 07:26:15 +02:00
|
|
|
break;
|
|
|
|
|
2014-12-03 10:18:34 +01:00
|
|
|
case FT_SFNT_PCLT:
|
2023-05-06 23:59:25 +02:00
|
|
|
table = ttface->pclt.Version ? &ttface->pclt : NULL;
|
2000-06-05 07:26:15 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2014-12-03 10:18:34 +01:00
|
|
|
table = NULL;
|
2000-05-27 00:13:17 +02:00
|
|
|
}
|
2000-06-05 07:26:15 +02:00
|
|
|
|
2000-05-27 00:13:17 +02:00
|
|
|
return table;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-06 23:59:25 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
|
|
sfnt_table_info( FT_Face face, /* TT_Face */
|
2004-08-11 07:25:37 +02:00
|
|
|
FT_UInt idx,
|
|
|
|
FT_ULong *tag,
|
2009-06-28 20:09:17 +02:00
|
|
|
FT_ULong *offset,
|
2004-08-11 07:25:37 +02:00
|
|
|
FT_ULong *length )
|
|
|
|
{
|
2023-05-06 23:59:25 +02:00
|
|
|
TT_Face ttface = (TT_Face)face;
|
|
|
|
|
|
|
|
|
2011-03-09 06:18:28 +01:00
|
|
|
if ( !offset || !length )
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Invalid_Argument );
|
2004-08-11 07:25:37 +02:00
|
|
|
|
2011-03-09 06:18:28 +01:00
|
|
|
if ( !tag )
|
2023-05-06 23:59:25 +02:00
|
|
|
*length = ttface->num_tables;
|
2011-03-09 06:18:28 +01:00
|
|
|
else
|
|
|
|
{
|
2023-05-06 23:59:25 +02:00
|
|
|
if ( idx >= ttface->num_tables )
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Table_Missing );
|
2004-08-11 07:25:37 +02:00
|
|
|
|
2023-05-06 23:59:25 +02:00
|
|
|
*tag = ttface->dir_tables[idx].Tag;
|
|
|
|
*offset = ttface->dir_tables[idx].Offset;
|
|
|
|
*length = ttface->dir_tables[idx].Length;
|
2011-03-09 06:18:28 +01:00
|
|
|
}
|
2004-08-11 07:25:37 +02:00
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2004-08-11 07:25:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_DEFINE_SERVICE_SFNT_TABLEREC(
|
|
|
|
sfnt_service_sfnt_table,
|
2016-09-17 17:12:50 +02:00
|
|
|
|
2023-05-06 23:59:25 +02:00
|
|
|
(FT_SFNT_TableLoadFunc)sfnt_load_table, /* load_table */
|
2015-10-30 08:07:56 +01:00
|
|
|
(FT_SFNT_TableGetFunc) get_sfnt_table, /* get_table */
|
2016-09-17 17:12:50 +02:00
|
|
|
(FT_SFNT_TableInfoFunc)sfnt_table_info /* table_info */
|
|
|
|
)
|
2003-11-04 19:24:20 +01:00
|
|
|
|
|
|
|
|
2000-07-19 19:13:03 +02:00
|
|
|
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
2000-07-20 08:57:41 +02:00
|
|
|
|
2012-08-24 13:41:24 +02:00
|
|
|
/*
|
2018-06-03 09:01:17 +02:00
|
|
|
* GLYPH DICT SERVICE
|
2012-08-24 13:41:24 +02:00
|
|
|
*
|
|
|
|
*/
|
* include/freetype/internal/ftserv.h,
include/freetype/internal/service/svpfr.h,
include/freetype/internal/pfr.h,
src/base/ftpfr.c:
migrating the functions of "ftpfr.h" to the new
service-base internal API
* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c:
removing various compiler warnings
2003-09-21 18:04:05 +02:00
|
|
|
|
2023-05-06 23:59:25 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2016-12-08 08:59:34 +01:00
|
|
|
sfnt_get_glyph_name( FT_Face face,
|
2001-06-28 01:25:46 +02:00
|
|
|
FT_UInt glyph_index,
|
|
|
|
FT_Pointer buffer,
|
|
|
|
FT_UInt buffer_max )
|
2000-07-19 19:13:03 +02:00
|
|
|
{
|
|
|
|
FT_String* gname;
|
|
|
|
FT_Error error;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-07-20 08:57:41 +02:00
|
|
|
|
2016-12-08 08:59:34 +01:00
|
|
|
error = tt_face_get_ps_name( (TT_Face)face, glyph_index, &gname );
|
2007-02-12 15:55:03 +01:00
|
|
|
if ( !error )
|
|
|
|
FT_STRCPYN( buffer, gname, buffer_max );
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-07-19 19:13:03 +02:00
|
|
|
return error;
|
2000-10-31 21:42:18 +01:00
|
|
|
}
|
2000-07-20 08:57:41 +02:00
|
|
|
|
|
|
|
|
2023-05-06 23:59:25 +02:00
|
|
|
FT_CALLBACK_DEF( FT_UInt )
|
2019-04-06 06:37:42 +02:00
|
|
|
sfnt_get_name_index( FT_Face face,
|
|
|
|
const FT_String* glyph_name )
|
2009-01-18 11:53:29 +01:00
|
|
|
{
|
2016-12-08 08:59:34 +01:00
|
|
|
TT_Face ttface = (TT_Face)face;
|
2012-08-24 13:41:24 +02:00
|
|
|
|
|
|
|
FT_UInt i, max_gid = FT_UINT_MAX;
|
2009-07-31 17:32:24 +02:00
|
|
|
|
2009-01-18 11:53:29 +01:00
|
|
|
|
2016-12-08 08:59:34 +01:00
|
|
|
if ( face->num_glyphs < 0 )
|
2009-07-31 17:32:24 +02:00
|
|
|
return 0;
|
2016-12-08 08:59:34 +01:00
|
|
|
else if ( (FT_ULong)face->num_glyphs < FT_UINT_MAX )
|
|
|
|
max_gid = (FT_UInt)face->num_glyphs;
|
2009-07-31 17:32:24 +02:00
|
|
|
else
|
2020-07-28 07:33:40 +02:00
|
|
|
FT_TRACE0(( "Ignore glyph names for invalid GID 0x%08x - 0x%08lx\n",
|
2016-12-08 08:59:34 +01:00
|
|
|
FT_UINT_MAX, face->num_glyphs ));
|
2009-01-18 11:53:29 +01:00
|
|
|
|
2009-07-31 17:32:24 +02:00
|
|
|
for ( i = 0; i < max_gid; i++ )
|
2009-01-18 11:53:29 +01:00
|
|
|
{
|
|
|
|
FT_String* gname;
|
2016-12-08 08:59:34 +01:00
|
|
|
FT_Error error = tt_face_get_ps_name( ttface, i, &gname );
|
2009-01-18 11:53:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
if ( error )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ( !ft_strcmp( glyph_name, gname ) )
|
2009-07-31 17:32:24 +02:00
|
|
|
return i;
|
2009-01-18 11:53:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_DEFINE_SERVICE_GLYPHDICTREC(
|
|
|
|
sfnt_service_glyph_dict,
|
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
(FT_GlyphDict_GetNameFunc) sfnt_get_glyph_name, /* get_name */
|
|
|
|
(FT_GlyphDict_NameIndexFunc)sfnt_get_name_index /* name_index */
|
|
|
|
)
|
* include/freetype/ftmm.h, include/freetype/ftmodule.h,
include/freetype/tttables.h, include/freetype/config/ftconfig.h,
include/freetype/internal/ftobjs.h,
include/freetype/internal/ftserv.h,
include/freetype/internal/internal.h,
include/freetype/internal/sfnt.h,
include/freetype/internal/tttypes.h,
include/freetype/internal/services/bdf.h,
include/freetype/internal/services/glyfdict.h,
include/freetype/internal/services/multmast.h,
include/freetype/internal/services/postname.h,
include/freetype/internal/services/sfnt.h,
include/freetype/internal/services/xf86name.h,
src/base/ftbdf.c, src/base/ftmm.c, src/base/ftobjs.c,
src/base/ftxf86.c, src/bdf/bdfdrivr.c, src/cff/cffdrivr.c,
src/cid/cidriver.c, src/pcf/pcfdrivr.c, src/sfnt/sfdriver.c,
src/truetype/ttdriver.c, src/type1/t1driver.c, src/type42/t42drivr.c:
heavy internal modifications to introduce the concept of
"module services". This is the first step towards a massive
simplification of the engine's internals, in order to
get rid of various numbers of hacks.
Note that this changes will break source & binary compatibility
for authors of external font drivers.
Maybe 2.1.6 will be called 2.2.0 after all :-)
2003-09-11 21:51:54 +02:00
|
|
|
|
|
|
|
#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
|
|
|
|
|
2003-09-17 07:26:33 +02:00
|
|
|
|
2012-08-24 13:41:24 +02:00
|
|
|
/*
|
2018-06-03 09:01:17 +02:00
|
|
|
* POSTSCRIPT NAME SERVICE
|
2012-08-24 13:41:24 +02:00
|
|
|
*
|
|
|
|
*/
|
* include/freetype/internal/ftserv.h,
include/freetype/internal/service/svpfr.h,
include/freetype/internal/pfr.h,
src/base/ftpfr.c:
migrating the functions of "ftpfr.h" to the new
service-base internal API
* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c:
removing various compiler warnings
2003-09-21 18:04:05 +02:00
|
|
|
|
2017-02-28 15:11:21 +01:00
|
|
|
/* an array representing allowed ASCII characters in a PS string */
|
|
|
|
static const unsigned char sfnt_ps_map[16] =
|
|
|
|
{
|
|
|
|
/* 4 0 C 8 */
|
|
|
|
0x00, 0x00, /* 0x00: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 */
|
|
|
|
0x00, 0x00, /* 0x10: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 */
|
|
|
|
0xDE, 0x7C, /* 0x20: 1 1 0 1 1 1 1 0 0 1 1 1 1 1 0 0 */
|
|
|
|
0xFF, 0xAF, /* 0x30: 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 */
|
|
|
|
0xFF, 0xFF, /* 0x40: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 */
|
|
|
|
0xFF, 0xD7, /* 0x50: 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 */
|
|
|
|
0xFF, 0xFF, /* 0x60: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 */
|
|
|
|
0xFF, 0x57 /* 0x70: 1 1 1 1 1 1 1 1 0 1 0 1 0 1 1 1 */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
sfnt_is_postscript( int c )
|
|
|
|
{
|
|
|
|
unsigned int cc;
|
|
|
|
|
|
|
|
|
|
|
|
if ( c < 0 || c >= 0x80 )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
cc = (unsigned int)c;
|
|
|
|
|
|
|
|
return sfnt_ps_map[cc >> 3] & ( 1 << ( cc & 0x07 ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-03-14 19:32:12 +01:00
|
|
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
|
|
|
|
2017-03-14 21:50:22 +01:00
|
|
|
/* Only ASCII letters and digits are taken for a variation font */
|
|
|
|
/* instance's PostScript name. */
|
|
|
|
/* */
|
|
|
|
/* `ft_isalnum' is a macro, but we need a function here, thus */
|
|
|
|
/* this definition. */
|
|
|
|
static int
|
|
|
|
sfnt_is_alphanumeric( int c )
|
|
|
|
{
|
|
|
|
return ft_isalnum( c );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-03-14 19:32:12 +01:00
|
|
|
/* the implementation of MurmurHash3 is taken and adapted from */
|
|
|
|
/* https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp */
|
|
|
|
|
|
|
|
#define ROTL32( x, r ) ( x << r ) | ( x >> ( 32 - r ) )
|
|
|
|
|
|
|
|
|
2017-03-15 11:35:26 +01:00
|
|
|
static FT_UInt32
|
2017-03-14 19:32:12 +01:00
|
|
|
fmix32( FT_UInt32 h )
|
|
|
|
{
|
|
|
|
h ^= h >> 16;
|
|
|
|
h *= 0x85ebca6b;
|
|
|
|
h ^= h >> 13;
|
|
|
|
h *= 0xc2b2ae35;
|
|
|
|
h ^= h >> 16;
|
|
|
|
|
|
|
|
return h;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-03-15 11:35:26 +01:00
|
|
|
static void
|
|
|
|
murmur_hash_3_128( const void* key,
|
|
|
|
const unsigned int len,
|
|
|
|
FT_UInt32 seed,
|
|
|
|
void* out )
|
2017-03-14 19:32:12 +01:00
|
|
|
{
|
|
|
|
const FT_Byte* data = (const FT_Byte*)key;
|
2017-03-15 11:35:26 +01:00
|
|
|
const int nblocks = (int)len / 16;
|
2017-03-14 19:32:12 +01:00
|
|
|
|
|
|
|
FT_UInt32 h1 = seed;
|
|
|
|
FT_UInt32 h2 = seed;
|
|
|
|
FT_UInt32 h3 = seed;
|
|
|
|
FT_UInt32 h4 = seed;
|
|
|
|
|
|
|
|
const FT_UInt32 c1 = 0x239b961b;
|
|
|
|
const FT_UInt32 c2 = 0xab0e9789;
|
|
|
|
const FT_UInt32 c3 = 0x38b34ae5;
|
|
|
|
const FT_UInt32 c4 = 0xa1e38b93;
|
|
|
|
|
|
|
|
const FT_UInt32* blocks = (const FT_UInt32*)( data + nblocks * 16 );
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
|
|
for( i = -nblocks; i; i++ )
|
|
|
|
{
|
|
|
|
FT_UInt32 k1 = blocks[i * 4 + 0];
|
|
|
|
FT_UInt32 k2 = blocks[i * 4 + 1];
|
|
|
|
FT_UInt32 k3 = blocks[i * 4 + 2];
|
|
|
|
FT_UInt32 k4 = blocks[i * 4 + 3];
|
|
|
|
|
|
|
|
|
|
|
|
k1 *= c1;
|
|
|
|
k1 = ROTL32( k1, 15 );
|
|
|
|
k1 *= c2;
|
|
|
|
h1 ^= k1;
|
|
|
|
|
|
|
|
h1 = ROTL32( h1, 19 );
|
|
|
|
h1 += h2;
|
|
|
|
h1 = h1 * 5 + 0x561ccd1b;
|
|
|
|
|
|
|
|
k2 *= c2;
|
|
|
|
k2 = ROTL32( k2, 16 );
|
|
|
|
k2 *= c3;
|
|
|
|
h2 ^= k2;
|
|
|
|
|
|
|
|
h2 = ROTL32( h2, 17 );
|
|
|
|
h2 += h3;
|
|
|
|
h2 = h2 * 5 + 0x0bcaa747;
|
|
|
|
|
|
|
|
k3 *= c3;
|
|
|
|
k3 = ROTL32( k3, 17 );
|
|
|
|
k3 *= c4;
|
|
|
|
h3 ^= k3;
|
|
|
|
|
|
|
|
h3 = ROTL32( h3, 15 );
|
|
|
|
h3 += h4;
|
|
|
|
h3 = h3 * 5 + 0x96cd1c35;
|
|
|
|
|
|
|
|
k4 *= c4;
|
|
|
|
k4 = ROTL32( k4, 18 );
|
|
|
|
k4 *= c1;
|
|
|
|
h4 ^= k4;
|
|
|
|
|
|
|
|
h4 = ROTL32( h4, 13 );
|
|
|
|
h4 += h1;
|
|
|
|
h4 = h4 * 5 + 0x32ac3b17;
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
const FT_Byte* tail = (const FT_Byte*)( data + nblocks * 16 );
|
|
|
|
|
|
|
|
FT_UInt32 k1 = 0;
|
|
|
|
FT_UInt32 k2 = 0;
|
|
|
|
FT_UInt32 k3 = 0;
|
|
|
|
FT_UInt32 k4 = 0;
|
|
|
|
|
|
|
|
|
|
|
|
switch ( len & 15 )
|
|
|
|
{
|
|
|
|
case 15:
|
2017-03-15 11:35:26 +01:00
|
|
|
k4 ^= (FT_UInt32)tail[14] << 16;
|
2023-02-08 19:36:10 +01:00
|
|
|
FALL_THROUGH;
|
2017-03-14 19:32:12 +01:00
|
|
|
case 14:
|
2017-03-15 11:35:26 +01:00
|
|
|
k4 ^= (FT_UInt32)tail[13] << 8;
|
2023-02-08 19:36:10 +01:00
|
|
|
FALL_THROUGH;
|
2017-03-14 19:32:12 +01:00
|
|
|
case 13:
|
2017-03-15 11:35:26 +01:00
|
|
|
k4 ^= (FT_UInt32)tail[12];
|
2017-03-14 19:32:12 +01:00
|
|
|
k4 *= c4;
|
|
|
|
k4 = ROTL32( k4, 18 );
|
|
|
|
k4 *= c1;
|
|
|
|
h4 ^= k4;
|
2023-02-08 19:36:10 +01:00
|
|
|
FALL_THROUGH;
|
2017-03-14 19:32:12 +01:00
|
|
|
|
|
|
|
case 12:
|
2017-03-15 11:35:26 +01:00
|
|
|
k3 ^= (FT_UInt32)tail[11] << 24;
|
2023-02-08 19:36:10 +01:00
|
|
|
FALL_THROUGH;
|
2017-03-14 19:32:12 +01:00
|
|
|
case 11:
|
2017-03-15 11:35:26 +01:00
|
|
|
k3 ^= (FT_UInt32)tail[10] << 16;
|
2023-02-08 19:36:10 +01:00
|
|
|
FALL_THROUGH;
|
2017-03-14 19:32:12 +01:00
|
|
|
case 10:
|
2017-03-15 11:35:26 +01:00
|
|
|
k3 ^= (FT_UInt32)tail[9] << 8;
|
2023-02-08 19:36:10 +01:00
|
|
|
FALL_THROUGH;
|
2017-03-14 19:32:12 +01:00
|
|
|
case 9:
|
2017-03-15 11:35:26 +01:00
|
|
|
k3 ^= (FT_UInt32)tail[8];
|
2017-03-14 19:32:12 +01:00
|
|
|
k3 *= c3;
|
|
|
|
k3 = ROTL32( k3, 17 );
|
|
|
|
k3 *= c4;
|
|
|
|
h3 ^= k3;
|
2023-02-08 19:36:10 +01:00
|
|
|
FALL_THROUGH;
|
2017-03-14 19:32:12 +01:00
|
|
|
|
|
|
|
case 8:
|
2017-03-15 11:35:26 +01:00
|
|
|
k2 ^= (FT_UInt32)tail[7] << 24;
|
2023-02-08 19:36:10 +01:00
|
|
|
FALL_THROUGH;
|
2017-03-14 19:32:12 +01:00
|
|
|
case 7:
|
2017-03-15 11:35:26 +01:00
|
|
|
k2 ^= (FT_UInt32)tail[6] << 16;
|
2023-02-08 19:36:10 +01:00
|
|
|
FALL_THROUGH;
|
2017-03-14 19:32:12 +01:00
|
|
|
case 6:
|
2017-03-15 11:35:26 +01:00
|
|
|
k2 ^= (FT_UInt32)tail[5] << 8;
|
2023-02-08 19:36:10 +01:00
|
|
|
FALL_THROUGH;
|
2017-03-14 19:32:12 +01:00
|
|
|
case 5:
|
2017-03-15 11:35:26 +01:00
|
|
|
k2 ^= (FT_UInt32)tail[4];
|
2017-03-14 19:32:12 +01:00
|
|
|
k2 *= c2;
|
|
|
|
k2 = ROTL32( k2, 16 );
|
|
|
|
k2 *= c3;
|
|
|
|
h2 ^= k2;
|
2023-02-08 19:36:10 +01:00
|
|
|
FALL_THROUGH;
|
2017-03-14 19:32:12 +01:00
|
|
|
|
|
|
|
case 4:
|
2017-03-15 11:35:26 +01:00
|
|
|
k1 ^= (FT_UInt32)tail[3] << 24;
|
2023-02-08 19:36:10 +01:00
|
|
|
FALL_THROUGH;
|
2017-03-14 19:32:12 +01:00
|
|
|
case 3:
|
2017-03-15 11:35:26 +01:00
|
|
|
k1 ^= (FT_UInt32)tail[2] << 16;
|
2023-02-08 19:36:10 +01:00
|
|
|
FALL_THROUGH;
|
2017-03-14 19:32:12 +01:00
|
|
|
case 2:
|
2017-03-15 11:35:26 +01:00
|
|
|
k1 ^= (FT_UInt32)tail[1] << 8;
|
2023-02-08 19:36:10 +01:00
|
|
|
FALL_THROUGH;
|
2017-03-14 19:32:12 +01:00
|
|
|
case 1:
|
2017-03-15 11:35:26 +01:00
|
|
|
k1 ^= (FT_UInt32)tail[0];
|
2017-03-14 19:32:12 +01:00
|
|
|
k1 *= c1;
|
|
|
|
k1 = ROTL32( k1, 15 );
|
|
|
|
k1 *= c2;
|
|
|
|
h1 ^= k1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
h1 ^= len;
|
|
|
|
h2 ^= len;
|
|
|
|
h3 ^= len;
|
|
|
|
h4 ^= len;
|
|
|
|
|
|
|
|
h1 += h2;
|
|
|
|
h1 += h3;
|
|
|
|
h1 += h4;
|
|
|
|
|
|
|
|
h2 += h1;
|
|
|
|
h3 += h1;
|
|
|
|
h4 += h1;
|
|
|
|
|
|
|
|
h1 = fmix32( h1 );
|
|
|
|
h2 = fmix32( h2 );
|
|
|
|
h3 = fmix32( h3 );
|
|
|
|
h4 = fmix32( h4 );
|
|
|
|
|
|
|
|
h1 += h2;
|
|
|
|
h1 += h3;
|
|
|
|
h1 += h4;
|
|
|
|
|
|
|
|
h2 += h1;
|
|
|
|
h3 += h1;
|
|
|
|
h4 += h1;
|
|
|
|
|
|
|
|
((FT_UInt32*)out)[0] = h1;
|
|
|
|
((FT_UInt32*)out)[1] = h2;
|
|
|
|
((FT_UInt32*)out)[2] = h3;
|
|
|
|
((FT_UInt32*)out)[3] = h4;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
|
|
|
|
|
|
|
|
|
2017-02-28 15:11:21 +01:00
|
|
|
typedef int (*char_type_func)( int c );
|
|
|
|
|
|
|
|
|
2018-09-15 06:14:18 +02:00
|
|
|
/* Handling of PID/EID 3/0 and 3/1 is the same. */
|
2017-02-23 22:58:14 +01:00
|
|
|
#define IS_WIN( n ) ( (n)->platformID == 3 && \
|
2018-09-12 08:08:09 +02:00
|
|
|
( (n)->encodingID == 1 || (n)->encodingID == 0 ) )
|
2017-02-23 22:58:14 +01:00
|
|
|
|
|
|
|
#define IS_APPLE( n ) ( (n)->platformID == 1 && \
|
2018-09-12 08:08:09 +02:00
|
|
|
(n)->encodingID == 0 )
|
2017-02-23 22:58:14 +01:00
|
|
|
|
2017-03-14 21:50:22 +01:00
|
|
|
static char*
|
2017-02-28 15:11:21 +01:00
|
|
|
get_win_string( FT_Memory memory,
|
|
|
|
FT_Stream stream,
|
|
|
|
TT_Name entry,
|
|
|
|
char_type_func char_type,
|
|
|
|
FT_Bool report_invalid_characters )
|
2001-10-17 15:48:10 +02:00
|
|
|
{
|
2022-01-28 04:55:34 +01:00
|
|
|
FT_Error error;
|
2001-10-17 15:48:10 +02:00
|
|
|
|
2017-03-17 07:52:30 +01:00
|
|
|
char* result = NULL;
|
2017-03-14 21:50:22 +01:00
|
|
|
FT_String* r;
|
|
|
|
FT_Char* p;
|
|
|
|
FT_UInt len;
|
2001-12-05 02:22:05 +01:00
|
|
|
|
2002-05-28 01:52:01 +02:00
|
|
|
|
2021-04-24 01:22:51 +02:00
|
|
|
if ( FT_QALLOC( result, entry->stringLength / 2 + 1 ) )
|
2017-02-23 22:58:14 +01:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if ( FT_STREAM_SEEK( entry->stringOffset ) ||
|
|
|
|
FT_FRAME_ENTER( entry->stringLength ) )
|
2018-09-12 08:08:09 +02:00
|
|
|
goto get_win_string_error;
|
2001-12-05 02:22:05 +01:00
|
|
|
|
2017-02-23 22:58:14 +01:00
|
|
|
r = (FT_String*)result;
|
|
|
|
p = (FT_Char*)stream->cursor;
|
2002-05-28 01:52:01 +02:00
|
|
|
|
2017-02-23 22:58:14 +01:00
|
|
|
for ( len = entry->stringLength / 2; len > 0; len--, p += 2 )
|
|
|
|
{
|
2018-09-12 08:08:09 +02:00
|
|
|
if ( p[0] == 0 && char_type( p[1] ) )
|
|
|
|
*r++ = p[1];
|
|
|
|
else
|
2017-02-28 15:11:21 +01:00
|
|
|
{
|
2018-09-12 08:08:09 +02:00
|
|
|
if ( report_invalid_characters )
|
|
|
|
FT_TRACE0(( "get_win_string:"
|
|
|
|
" Character 0x%X invalid in PS name string\n",
|
|
|
|
((unsigned)p[0])*256 + (unsigned)p[1] ));
|
2023-04-25 09:30:30 +02:00
|
|
|
continue;
|
2017-02-28 15:11:21 +01:00
|
|
|
}
|
2002-03-05 17:12:57 +01:00
|
|
|
}
|
2023-04-25 09:30:30 +02:00
|
|
|
*r = '\0';
|
2002-05-28 01:52:01 +02:00
|
|
|
|
2017-02-23 22:58:14 +01:00
|
|
|
FT_FRAME_EXIT();
|
2003-04-23 21:48:24 +02:00
|
|
|
|
2023-04-25 09:30:30 +02:00
|
|
|
if ( r != result )
|
2018-09-12 08:08:09 +02:00
|
|
|
return result;
|
|
|
|
|
|
|
|
get_win_string_error:
|
|
|
|
FT_FREE( result );
|
|
|
|
|
|
|
|
entry->stringLength = 0;
|
|
|
|
entry->stringOffset = 0;
|
|
|
|
FT_FREE( entry->string );
|
|
|
|
|
|
|
|
return NULL;
|
2017-02-23 22:58:14 +01:00
|
|
|
}
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-05-28 01:52:01 +02:00
|
|
|
|
2017-03-14 21:50:22 +01:00
|
|
|
static char*
|
2017-02-28 15:11:21 +01:00
|
|
|
get_apple_string( FT_Memory memory,
|
|
|
|
FT_Stream stream,
|
|
|
|
TT_Name entry,
|
|
|
|
char_type_func char_type,
|
|
|
|
FT_Bool report_invalid_characters )
|
2017-02-23 22:58:14 +01:00
|
|
|
{
|
2022-01-28 04:55:34 +01:00
|
|
|
FT_Error error;
|
2002-05-28 01:52:01 +02:00
|
|
|
|
2017-03-17 07:52:30 +01:00
|
|
|
char* result = NULL;
|
2017-03-14 21:50:22 +01:00
|
|
|
FT_String* r;
|
|
|
|
FT_Char* p;
|
|
|
|
FT_UInt len;
|
2002-05-28 01:52:01 +02:00
|
|
|
|
|
|
|
|
2021-04-24 01:22:51 +02:00
|
|
|
if ( FT_QALLOC( result, entry->stringLength + 1 ) )
|
2017-02-23 22:58:14 +01:00
|
|
|
return NULL;
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2017-02-28 15:11:21 +01:00
|
|
|
if ( FT_STREAM_SEEK( entry->stringOffset ) ||
|
|
|
|
FT_FRAME_ENTER( entry->stringLength ) )
|
2018-09-12 08:08:09 +02:00
|
|
|
goto get_apple_string_error;
|
2002-03-05 17:12:57 +01:00
|
|
|
|
2017-02-28 15:11:21 +01:00
|
|
|
r = (FT_String*)result;
|
|
|
|
p = (FT_Char*)stream->cursor;
|
|
|
|
|
|
|
|
for ( len = entry->stringLength; len > 0; len--, p++ )
|
|
|
|
{
|
|
|
|
if ( char_type( *p ) )
|
|
|
|
*r++ = *p;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( report_invalid_characters )
|
|
|
|
FT_TRACE0(( "get_apple_string:"
|
|
|
|
" Character `%c' (0x%X) invalid in PS name string\n",
|
|
|
|
*p, *p ));
|
2023-04-25 09:30:30 +02:00
|
|
|
continue;
|
2017-02-28 15:11:21 +01:00
|
|
|
}
|
|
|
|
}
|
2023-04-25 09:30:30 +02:00
|
|
|
*r = '\0';
|
2017-02-28 15:11:21 +01:00
|
|
|
|
|
|
|
FT_FRAME_EXIT();
|
2017-02-23 22:58:14 +01:00
|
|
|
|
2023-04-25 09:30:30 +02:00
|
|
|
if ( r != result )
|
2018-09-12 08:08:09 +02:00
|
|
|
return result;
|
|
|
|
|
|
|
|
get_apple_string_error:
|
|
|
|
FT_FREE( result );
|
|
|
|
|
|
|
|
entry->stringOffset = 0;
|
|
|
|
entry->stringLength = 0;
|
|
|
|
FT_FREE( entry->string );
|
|
|
|
|
|
|
|
return NULL;
|
2017-02-23 22:58:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-06 23:59:25 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Bool )
|
2017-03-05 19:06:41 +01:00
|
|
|
sfnt_get_name_id( TT_Face face,
|
|
|
|
FT_UShort id,
|
|
|
|
FT_Int *win,
|
|
|
|
FT_Int *apple )
|
2017-02-23 22:58:14 +01:00
|
|
|
{
|
2017-02-26 11:23:07 +01:00
|
|
|
FT_Int n;
|
2017-02-23 22:58:14 +01:00
|
|
|
|
|
|
|
|
2017-02-26 11:23:07 +01:00
|
|
|
*win = -1;
|
|
|
|
*apple = -1;
|
2017-02-23 22:58:14 +01:00
|
|
|
|
|
|
|
for ( n = 0; n < face->num_names; n++ )
|
|
|
|
{
|
|
|
|
TT_Name name = face->name_table.names + n;
|
2002-03-26 03:38:39 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2017-02-26 11:23:07 +01:00
|
|
|
if ( name->nameID == id && name->stringLength > 0 )
|
2002-03-05 17:12:57 +01:00
|
|
|
{
|
2019-01-18 13:25:23 +01:00
|
|
|
if ( IS_WIN( name ) && ( name->languageID == 0x409 || *win == -1 ) )
|
2017-02-26 11:23:07 +01:00
|
|
|
*win = n;
|
2017-02-23 22:58:14 +01:00
|
|
|
|
2019-01-18 13:25:23 +01:00
|
|
|
if ( IS_APPLE( name ) && ( name->languageID == 0 || *apple == -1 ) )
|
2017-02-26 11:23:07 +01:00
|
|
|
*apple = n;
|
2001-10-17 15:48:10 +02:00
|
|
|
}
|
|
|
|
}
|
2001-12-05 02:22:05 +01:00
|
|
|
|
2017-02-28 15:11:21 +01:00
|
|
|
return ( *win >= 0 ) || ( *apple >= 0 );
|
2017-02-26 11:23:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-03-14 19:40:50 +01:00
|
|
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
|
|
|
|
2017-03-14 21:50:22 +01:00
|
|
|
/*
|
|
|
|
The maximum length of an axis value descriptor.
|
|
|
|
|
|
|
|
We need 65536 different values for the decimal fraction; this fits
|
|
|
|
nicely into five decimal places. Consequently, it consists of
|
|
|
|
|
|
|
|
. the minus sign if the number is negative,
|
|
|
|
. up to five characters for the digits before the decimal point,
|
|
|
|
. the decimal point if there is a fractional part, and
|
|
|
|
. up to five characters for the digits after the decimal point.
|
|
|
|
|
|
|
|
We also need one byte for the leading `_' character and up to four
|
|
|
|
bytes for the axis tag.
|
|
|
|
*/
|
|
|
|
#define MAX_VALUE_DESCRIPTOR_LEN ( 1 + 5 + 1 + 5 + 1 + 4 )
|
|
|
|
|
|
|
|
|
|
|
|
/* the maximum length of PostScript font names */
|
|
|
|
#define MAX_PS_NAME_LEN 127
|
|
|
|
|
|
|
|
|
2017-03-14 19:40:50 +01:00
|
|
|
/*
|
2022-06-21 17:08:04 +02:00
|
|
|
* Find the shortest decimal representation of a 16.16 fixed-point
|
2018-06-03 09:01:17 +02:00
|
|
|
* number. The function fills `buf' with the result, returning a pointer
|
|
|
|
* to the position after the representation's last byte.
|
2017-03-14 19:40:50 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
static char*
|
|
|
|
fixed2float( FT_Int fixed,
|
|
|
|
char* buf )
|
|
|
|
{
|
|
|
|
char* p;
|
|
|
|
char* q;
|
|
|
|
char tmp[5];
|
|
|
|
|
|
|
|
FT_Int int_part;
|
|
|
|
FT_Int frac_part;
|
|
|
|
|
|
|
|
FT_Int i;
|
|
|
|
|
|
|
|
|
|
|
|
p = buf;
|
|
|
|
|
|
|
|
if ( fixed == 0 )
|
|
|
|
{
|
|
|
|
*p++ = '0';
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( fixed < 0 )
|
|
|
|
{
|
|
|
|
*p++ = '-';
|
2018-07-16 18:45:23 +02:00
|
|
|
fixed = NEG_INT( fixed );
|
2017-03-14 19:40:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int_part = ( fixed >> 16 ) & 0xFFFF;
|
|
|
|
frac_part = fixed & 0xFFFF;
|
|
|
|
|
|
|
|
/* get digits of integer part (in reverse order) */
|
|
|
|
q = tmp;
|
|
|
|
while ( int_part > 0 )
|
|
|
|
{
|
|
|
|
*q++ = '0' + int_part % 10;
|
|
|
|
int_part /= 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* copy digits in correct order to buffer */
|
|
|
|
while ( q > tmp )
|
|
|
|
*p++ = *--q;
|
|
|
|
|
|
|
|
if ( !frac_part )
|
|
|
|
return p;
|
|
|
|
|
|
|
|
/* save position of point */
|
|
|
|
q = p;
|
|
|
|
*p++ = '.';
|
|
|
|
|
|
|
|
/* apply rounding */
|
|
|
|
frac_part = frac_part * 10 + 5;
|
|
|
|
|
|
|
|
/* get digits of fractional part */
|
|
|
|
for ( i = 0; i < 5; i++ )
|
|
|
|
{
|
2017-03-15 11:35:26 +01:00
|
|
|
*p++ = '0' + (char)( frac_part / 0x10000L );
|
2017-03-14 19:40:50 +01:00
|
|
|
|
|
|
|
frac_part %= 0x10000L;
|
|
|
|
if ( !frac_part )
|
|
|
|
break;
|
|
|
|
|
|
|
|
frac_part *= 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
If the remainder stored in `frac_part' (after the last FOR loop) is
|
|
|
|
smaller than 34480*10, the resulting decimal value minus 0.00001 is
|
|
|
|
an equivalent representation of `fixed'.
|
|
|
|
|
|
|
|
The above FOR loop always finds the larger of the two values; I
|
2022-06-21 17:08:04 +02:00
|
|
|
verified this by iterating over all possible fixed-point numbers.
|
2017-03-14 19:40:50 +01:00
|
|
|
|
|
|
|
If the remainder is 17232*10, both values are equally good, and we
|
|
|
|
take the next even number (following IEEE 754's `round to nearest,
|
|
|
|
ties to even' rounding rule).
|
|
|
|
|
|
|
|
If the remainder is smaller than 17232*10, the lower of the two
|
|
|
|
numbers is nearer to the exact result (values 17232 and 34480 were
|
2022-06-21 17:08:04 +02:00
|
|
|
also found by testing all possible fixed-point values).
|
2017-03-14 19:40:50 +01:00
|
|
|
|
|
|
|
We use this to find a shorter decimal representation. If not ending
|
|
|
|
with digit zero, we take the representation with less error.
|
|
|
|
*/
|
|
|
|
p--;
|
|
|
|
if ( p - q == 5 ) /* five digits? */
|
|
|
|
{
|
|
|
|
/* take the representation that has zero as the last digit */
|
|
|
|
if ( frac_part < 34480 * 10 &&
|
|
|
|
*p == '1' )
|
|
|
|
*p = '0';
|
|
|
|
|
|
|
|
/* otherwise use the one with less error */
|
|
|
|
else if ( frac_part == 17232 * 10 &&
|
|
|
|
*p & 1 )
|
|
|
|
*p -= 1;
|
|
|
|
|
|
|
|
else if ( frac_part < 17232 * 10 &&
|
|
|
|
*p != '0' )
|
|
|
|
*p -= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* remove trailing zeros */
|
|
|
|
while ( *p == '0' )
|
|
|
|
*p-- = '\0';
|
|
|
|
|
|
|
|
return p + 1;
|
|
|
|
}
|
|
|
|
|
2017-03-14 21:50:22 +01:00
|
|
|
|
|
|
|
static const char hexdigits[16] =
|
|
|
|
{
|
|
|
|
'0', '1', '2', '3', '4', '5', '6', '7',
|
|
|
|
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
|
|
|
|
};
|
2017-03-14 19:40:50 +01:00
|
|
|
|
|
|
|
|
2017-02-26 11:23:07 +01:00
|
|
|
static const char*
|
2017-03-14 21:50:22 +01:00
|
|
|
sfnt_get_var_ps_name( TT_Face face )
|
2017-02-26 11:23:07 +01:00
|
|
|
{
|
2017-03-14 21:50:22 +01:00
|
|
|
FT_Error error;
|
|
|
|
FT_Memory memory = face->root.memory;
|
2017-02-26 11:23:07 +01:00
|
|
|
|
2017-03-14 21:50:22 +01:00
|
|
|
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
|
2017-02-26 11:23:07 +01:00
|
|
|
|
2017-03-14 21:50:22 +01:00
|
|
|
FT_UInt num_coords;
|
|
|
|
FT_Fixed* coords;
|
|
|
|
FT_MM_Var* mm_var;
|
2017-02-26 11:23:07 +01:00
|
|
|
|
2017-03-14 21:50:22 +01:00
|
|
|
FT_Int found, win, apple;
|
|
|
|
FT_UInt i, j;
|
|
|
|
|
|
|
|
char* result = NULL;
|
|
|
|
char* p;
|
2017-02-28 15:11:21 +01:00
|
|
|
|
2017-03-14 21:50:22 +01:00
|
|
|
|
|
|
|
if ( !face->var_postscript_prefix )
|
2017-02-28 15:11:21 +01:00
|
|
|
{
|
2017-03-14 21:50:22 +01:00
|
|
|
FT_UInt len;
|
|
|
|
|
|
|
|
|
|
|
|
/* check whether we have a Variations PostScript Name Prefix */
|
|
|
|
found = sfnt_get_name_id( face,
|
|
|
|
TT_NAME_ID_VARIATIONS_PREFIX,
|
|
|
|
&win,
|
|
|
|
&apple );
|
|
|
|
if ( !found )
|
|
|
|
{
|
|
|
|
/* otherwise use the typographic family name */
|
|
|
|
found = sfnt_get_name_id( face,
|
|
|
|
TT_NAME_ID_TYPOGRAPHIC_FAMILY,
|
|
|
|
&win,
|
|
|
|
&apple );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !found )
|
|
|
|
{
|
2023-04-25 09:54:09 +02:00
|
|
|
/* according to the 'name' documentation in the OpenType */
|
|
|
|
/* specification the font family name is to be used if the */
|
|
|
|
/* typographic family name is missing, so let's do that */
|
2017-03-14 21:50:22 +01:00
|
|
|
found = sfnt_get_name_id( face,
|
|
|
|
TT_NAME_ID_FONT_FAMILY,
|
|
|
|
&win,
|
|
|
|
&apple );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !found )
|
|
|
|
{
|
|
|
|
FT_TRACE0(( "sfnt_get_var_ps_name:"
|
|
|
|
" Can't construct PS name prefix for font instances\n" ));
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2017-02-28 15:11:21 +01:00
|
|
|
/* prefer Windows entries over Apple */
|
|
|
|
if ( win != -1 )
|
|
|
|
result = get_win_string( face->root.memory,
|
2017-02-23 22:58:14 +01:00
|
|
|
face->name_table.stream,
|
2017-02-28 15:11:21 +01:00
|
|
|
face->name_table.names + win,
|
2017-03-14 21:50:22 +01:00
|
|
|
sfnt_is_alphanumeric,
|
|
|
|
0 );
|
2018-09-12 08:08:09 +02:00
|
|
|
if ( !result && apple != -1 )
|
2017-02-28 15:11:21 +01:00
|
|
|
result = get_apple_string( face->root.memory,
|
|
|
|
face->name_table.stream,
|
|
|
|
face->name_table.names + apple,
|
2017-03-14 21:50:22 +01:00
|
|
|
sfnt_is_alphanumeric,
|
|
|
|
0 );
|
|
|
|
|
2018-09-13 08:58:49 +02:00
|
|
|
if ( !result )
|
|
|
|
{
|
|
|
|
FT_TRACE0(( "sfnt_get_var_ps_name:"
|
|
|
|
" No valid PS name prefix for font instances found\n" ));
|
2023-04-25 09:54:09 +02:00
|
|
|
/* XXX It probably makes sense to never let this fail */
|
|
|
|
/* since an arbitrary prefix should work, too. */
|
|
|
|
/* On the other hand, it is very unlikely that */
|
|
|
|
/* we ever reach this code at all. */
|
2018-09-13 08:58:49 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
len = ft_strlen( result );
|
2017-03-14 21:50:22 +01:00
|
|
|
|
|
|
|
/* sanitize if necessary; we reserve space for 36 bytes (a 128bit */
|
|
|
|
/* checksum as a hex number, preceded by `-' and followed by three */
|
|
|
|
/* ASCII dots, to be used if the constructed PS name would be too */
|
|
|
|
/* long); this is also sufficient for a single instance */
|
|
|
|
if ( len > MAX_PS_NAME_LEN - ( 1 + 32 + 3 ) )
|
|
|
|
{
|
|
|
|
len = MAX_PS_NAME_LEN - ( 1 + 32 + 3 );
|
|
|
|
result[len] = '\0';
|
|
|
|
|
|
|
|
FT_TRACE0(( "sfnt_get_var_ps_name:"
|
2021-02-04 07:44:06 +01:00
|
|
|
" Shortening variation PS name prefix\n" ));
|
|
|
|
FT_TRACE0(( " "
|
2017-03-14 21:50:22 +01:00
|
|
|
" to %d characters\n", len ));
|
|
|
|
}
|
|
|
|
|
|
|
|
face->var_postscript_prefix = result;
|
|
|
|
face->var_postscript_prefix_len = len;
|
2017-02-28 15:11:21 +01:00
|
|
|
}
|
2017-02-23 22:58:14 +01:00
|
|
|
|
2017-03-14 21:50:22 +01:00
|
|
|
mm->get_var_blend( FT_FACE( face ),
|
|
|
|
&num_coords,
|
|
|
|
&coords,
|
|
|
|
NULL,
|
|
|
|
&mm_var );
|
|
|
|
|
2017-10-07 13:14:38 +02:00
|
|
|
if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) &&
|
|
|
|
!FT_IS_VARIATION( FT_FACE( face ) ) )
|
2017-03-14 21:50:22 +01:00
|
|
|
{
|
|
|
|
SFNT_Service sfnt = (SFNT_Service)face->sfnt;
|
|
|
|
|
|
|
|
FT_Long instance = ( ( face->root.face_index & 0x7FFF0000L ) >> 16 ) - 1;
|
|
|
|
FT_UInt psid = mm_var->namedstyle[instance].psid;
|
|
|
|
|
|
|
|
char* ps_name = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
/* try first to load the name string with index `postScriptNameID' */
|
|
|
|
if ( psid == 6 ||
|
|
|
|
( psid > 255 && psid < 32768 ) )
|
|
|
|
(void)sfnt->get_name( face, (FT_UShort)psid, &ps_name );
|
|
|
|
|
|
|
|
if ( ps_name )
|
|
|
|
{
|
|
|
|
result = ps_name;
|
2017-03-15 11:35:26 +01:00
|
|
|
p = result + ft_strlen( result ) + 1;
|
|
|
|
|
2017-03-14 21:50:22 +01:00
|
|
|
goto check_length;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* otherwise construct a name using `subfamilyNameID' */
|
|
|
|
FT_UInt strid = mm_var->namedstyle[instance].strid;
|
|
|
|
|
|
|
|
char* subfamily_name;
|
|
|
|
char* s;
|
|
|
|
|
|
|
|
|
|
|
|
(void)sfnt->get_name( face, (FT_UShort)strid, &subfamily_name );
|
|
|
|
|
|
|
|
if ( !subfamily_name )
|
|
|
|
{
|
|
|
|
FT_TRACE1(( "sfnt_get_var_ps_name:"
|
2021-02-04 07:44:06 +01:00
|
|
|
" can't construct named instance PS name;\n" ));
|
|
|
|
FT_TRACE1(( " "
|
2017-03-14 21:50:22 +01:00
|
|
|
" trying to construct normal instance PS name\n" ));
|
|
|
|
goto construct_instance_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* after the prefix we have character `-' followed by the */
|
|
|
|
/* subfamily name (using only characters a-z, A-Z, and 0-9) */
|
2021-04-24 01:22:51 +02:00
|
|
|
if ( FT_QALLOC( result, face->var_postscript_prefix_len +
|
|
|
|
1 + ft_strlen( subfamily_name ) + 1 ) )
|
2017-03-14 21:50:22 +01:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
ft_strcpy( result, face->var_postscript_prefix );
|
|
|
|
|
|
|
|
p = result + face->var_postscript_prefix_len;
|
|
|
|
*p++ = '-';
|
|
|
|
|
|
|
|
s = subfamily_name;
|
|
|
|
while ( *s )
|
|
|
|
{
|
|
|
|
if ( ft_isalnum( *s ) )
|
|
|
|
*p++ = *s;
|
|
|
|
s++;
|
|
|
|
}
|
|
|
|
*p++ = '\0';
|
|
|
|
|
|
|
|
FT_FREE( subfamily_name );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FT_Var_Axis* axis;
|
|
|
|
|
|
|
|
|
|
|
|
construct_instance_name:
|
|
|
|
axis = mm_var->axis;
|
|
|
|
|
2021-04-24 01:22:51 +02:00
|
|
|
if ( FT_QALLOC( result,
|
|
|
|
face->var_postscript_prefix_len +
|
|
|
|
num_coords * MAX_VALUE_DESCRIPTOR_LEN + 1 ) )
|
2017-03-14 21:50:22 +01:00
|
|
|
return NULL;
|
|
|
|
|
|
|
|
p = result;
|
|
|
|
|
|
|
|
ft_strcpy( p, face->var_postscript_prefix );
|
|
|
|
p += face->var_postscript_prefix_len;
|
|
|
|
|
|
|
|
for ( i = 0; i < num_coords; i++, coords++, axis++ )
|
|
|
|
{
|
2017-03-15 11:35:26 +01:00
|
|
|
char t;
|
2017-03-14 21:50:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* omit axis value descriptor if it is identical */
|
|
|
|
/* to the default axis value */
|
|
|
|
if ( *coords == axis->def )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
*p++ = '_';
|
|
|
|
p = fixed2float( *coords, p );
|
|
|
|
|
2017-03-15 11:35:26 +01:00
|
|
|
t = (char)( axis->tag >> 24 );
|
2017-03-14 21:50:22 +01:00
|
|
|
if ( t != ' ' && ft_isalnum( t ) )
|
|
|
|
*p++ = t;
|
2017-03-15 11:35:26 +01:00
|
|
|
t = (char)( axis->tag >> 16 );
|
2017-03-14 21:50:22 +01:00
|
|
|
if ( t != ' ' && ft_isalnum( t ) )
|
|
|
|
*p++ = t;
|
2017-03-15 11:35:26 +01:00
|
|
|
t = (char)( axis->tag >> 8 );
|
2017-03-14 21:50:22 +01:00
|
|
|
if ( t != ' ' && ft_isalnum( t ) )
|
|
|
|
*p++ = t;
|
2017-03-15 11:35:26 +01:00
|
|
|
t = (char)axis->tag;
|
2017-03-14 21:50:22 +01:00
|
|
|
if ( t != ' ' && ft_isalnum( t ) )
|
|
|
|
*p++ = t;
|
|
|
|
}
|
2021-04-24 01:22:51 +02:00
|
|
|
*p++ = '\0';
|
2017-03-14 21:50:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
check_length:
|
|
|
|
if ( p - result > MAX_PS_NAME_LEN )
|
|
|
|
{
|
|
|
|
/* the PS name is too long; replace the part after the prefix with */
|
|
|
|
/* a checksum; we use MurmurHash 3 with a hash length of 128 bit */
|
|
|
|
|
|
|
|
FT_UInt32 seed = 123456789;
|
|
|
|
|
|
|
|
FT_UInt32 hash[4];
|
|
|
|
FT_UInt32* h;
|
|
|
|
|
|
|
|
|
|
|
|
murmur_hash_3_128( result, p - result, seed, hash );
|
|
|
|
|
|
|
|
p = result + face->var_postscript_prefix_len;
|
|
|
|
*p++ = '-';
|
|
|
|
|
|
|
|
/* we convert the hash value to hex digits from back to front */
|
|
|
|
p += 32 + 3;
|
|
|
|
h = hash + 3;
|
|
|
|
|
|
|
|
*p-- = '\0';
|
|
|
|
*p-- = '.';
|
|
|
|
*p-- = '.';
|
|
|
|
*p-- = '.';
|
|
|
|
|
|
|
|
for ( i = 0; i < 4; i++, h-- )
|
|
|
|
{
|
|
|
|
FT_UInt32 v = *h;
|
|
|
|
|
|
|
|
|
|
|
|
for ( j = 0; j < 8; j++ )
|
|
|
|
{
|
|
|
|
*p-- = hexdigits[v & 0xF];
|
|
|
|
v >>= 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
|
|
|
|
|
|
|
|
|
2023-05-06 23:59:25 +02:00
|
|
|
FT_CALLBACK_DEF( const char* )
|
|
|
|
sfnt_get_ps_name( FT_Face face ) /* TT_Face */
|
2017-03-14 21:50:22 +01:00
|
|
|
{
|
2023-05-06 23:59:25 +02:00
|
|
|
TT_Face ttface = (TT_Face)face;
|
|
|
|
|
2017-03-14 21:50:22 +01:00
|
|
|
FT_Int found, win, apple;
|
|
|
|
const char* result = NULL;
|
|
|
|
|
|
|
|
|
2023-05-06 23:59:25 +02:00
|
|
|
if ( ttface->postscript_name )
|
|
|
|
return ttface->postscript_name;
|
2017-03-14 21:50:22 +01:00
|
|
|
|
|
|
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
2023-05-06 23:59:25 +02:00
|
|
|
if ( ttface->blend &&
|
|
|
|
( FT_IS_NAMED_INSTANCE( face ) ||
|
|
|
|
FT_IS_VARIATION( face ) ) )
|
2017-03-14 21:50:22 +01:00
|
|
|
{
|
2023-05-06 23:59:25 +02:00
|
|
|
ttface->postscript_name = sfnt_get_var_ps_name( ttface );
|
|
|
|
return ttface->postscript_name;
|
2017-03-14 21:50:22 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* scan the name table to see whether we have a Postscript name here, */
|
|
|
|
/* either in Macintosh or Windows platform encodings */
|
2023-05-06 23:59:25 +02:00
|
|
|
found = sfnt_get_name_id( ttface, TT_NAME_ID_PS_NAME, &win, &apple );
|
2017-03-14 21:50:22 +01:00
|
|
|
if ( !found )
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
/* prefer Windows entries over Apple */
|
|
|
|
if ( win != -1 )
|
2023-05-06 23:59:25 +02:00
|
|
|
result = get_win_string( FT_FACE_MEMORY( face ),
|
|
|
|
ttface->name_table.stream,
|
|
|
|
ttface->name_table.names + win,
|
2017-03-14 21:50:22 +01:00
|
|
|
sfnt_is_postscript,
|
|
|
|
1 );
|
2018-09-12 08:08:09 +02:00
|
|
|
if ( !result && apple != -1 )
|
2023-05-06 23:59:25 +02:00
|
|
|
result = get_apple_string( FT_FACE_MEMORY( face ),
|
|
|
|
ttface->name_table.stream,
|
|
|
|
ttface->name_table.names + apple,
|
2017-03-14 21:50:22 +01:00
|
|
|
sfnt_is_postscript,
|
|
|
|
1 );
|
|
|
|
|
2023-05-06 23:59:25 +02:00
|
|
|
ttface->postscript_name = result;
|
2017-02-23 22:58:14 +01:00
|
|
|
|
2002-03-20 11:47:38 +01:00
|
|
|
return result;
|
2001-10-17 15:48:10 +02:00
|
|
|
}
|
|
|
|
|
2012-08-24 13:41:24 +02:00
|
|
|
|
|
|
|
FT_DEFINE_SERVICE_PSFONTNAMEREC(
|
|
|
|
sfnt_service_ps_name,
|
2016-09-17 17:12:50 +02:00
|
|
|
|
|
|
|
(FT_PsName_GetFunc)sfnt_get_ps_name /* get_ps_font_name */
|
|
|
|
)
|
2001-10-17 15:48:10 +02:00
|
|
|
|
* include/freetype/ftmm.h, include/freetype/ftmodule.h,
include/freetype/tttables.h, include/freetype/config/ftconfig.h,
include/freetype/internal/ftobjs.h,
include/freetype/internal/ftserv.h,
include/freetype/internal/internal.h,
include/freetype/internal/sfnt.h,
include/freetype/internal/tttypes.h,
include/freetype/internal/services/bdf.h,
include/freetype/internal/services/glyfdict.h,
include/freetype/internal/services/multmast.h,
include/freetype/internal/services/postname.h,
include/freetype/internal/services/sfnt.h,
include/freetype/internal/services/xf86name.h,
src/base/ftbdf.c, src/base/ftmm.c, src/base/ftobjs.c,
src/base/ftxf86.c, src/bdf/bdfdrivr.c, src/cff/cffdrivr.c,
src/cid/cidriver.c, src/pcf/pcfdrivr.c, src/sfnt/sfdriver.c,
src/truetype/ttdriver.c, src/type1/t1driver.c, src/type42/t42drivr.c:
heavy internal modifications to introduce the concept of
"module services". This is the first step towards a massive
simplification of the engine's internals, in order to
get rid of various numbers of hacks.
Note that this changes will break source & binary compatibility
for authors of external font drivers.
Maybe 2.1.6 will be called 2.2.0 after all :-)
2003-09-11 21:51:54 +02:00
|
|
|
|
2005-12-20 13:01:58 +01:00
|
|
|
/*
|
2018-06-03 09:01:17 +02:00
|
|
|
* TT CMAP INFO
|
2005-12-20 13:01:58 +01:00
|
|
|
*/
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_DEFINE_SERVICE_TTCMAPSREC(
|
|
|
|
tt_service_get_cmap_info,
|
2016-09-17 17:12:50 +02:00
|
|
|
|
|
|
|
(TT_CMap_Info_GetFunc)tt_get_cmap_info /* get_cmap_info */
|
|
|
|
)
|
2003-12-17 15:28:22 +01:00
|
|
|
|
2005-12-20 13:01:58 +01:00
|
|
|
|
* include/freetype/config/ftoption.h,
include/freetype/config/ftstdlib.h,
include/freetype/internal/tttypes.h,
src/sfnt/Jamfile, src/sfnt/rules.mk, src/sfnt/sfdriver.c,
src/sfnt/ttbdf.h, src/sfnt/ttbdf.c, src/sfnt/sfobjs.c:
Added support for an embedded 'BDF ' table within SFNT-based
bitmap font files. This is used to store atoms & properties from
the original BDF fonts that were used to generate the font file.
the feature is controled by TT_CONFIG_OPTION_BDF within 'ftoption.h'
and is used to implement FT_Get_BDF_Property for these font files.
At the moment, this is still experimental, the BDF table format isn't
cast into stone yet.
2005-12-14 21:38:15 +01:00
|
|
|
#ifdef TT_CONFIG_OPTION_BDF
|
|
|
|
|
|
|
|
static FT_Error
|
2023-05-06 23:59:25 +02:00
|
|
|
sfnt_get_charset_id( FT_Face face,
|
* include/freetype/config/ftoption.h,
include/freetype/config/ftstdlib.h,
include/freetype/internal/tttypes.h,
src/sfnt/Jamfile, src/sfnt/rules.mk, src/sfnt/sfdriver.c,
src/sfnt/ttbdf.h, src/sfnt/ttbdf.c, src/sfnt/sfobjs.c:
Added support for an embedded 'BDF ' table within SFNT-based
bitmap font files. This is used to store atoms & properties from
the original BDF fonts that were used to generate the font file.
the feature is controled by TT_CONFIG_OPTION_BDF within 'ftoption.h'
and is used to implement FT_Get_BDF_Property for these font files.
At the moment, this is still experimental, the BDF table format isn't
cast into stone yet.
2005-12-14 21:38:15 +01:00
|
|
|
const char* *acharset_encoding,
|
|
|
|
const char* *acharset_registry )
|
|
|
|
{
|
2005-12-20 13:01:58 +01:00
|
|
|
BDF_PropertyRec encoding, registry;
|
|
|
|
FT_Error error;
|
|
|
|
|
|
|
|
|
|
|
|
/* XXX: I don't know whether this is correct, since
|
|
|
|
* tt_face_find_bdf_prop only returns something correct if we have
|
* builds/amiga/src/base/ftsystem.c, devel/ftoption.h
include/freetype/ftcache.h, include/freetype/ftoutln.h,
include/freetype/cache/ftccache.h, include/freetype/cache/ftccmap.h,
include/freetype/config/ftoption.h, include/freetype/internal/ftcalc.h,
include/freetype/internal/ftdriver.h,
include/freetype/internal/ftmemory.h,
include/freetype/internal/ftobjs.h, include/freetype/internal/ftrfork.h,
include/freetype/internal/psaux.h, include/freetype/internal/sfnt.h,
include/freetype/internal/t1types.h, include/freetype/internal/tttypes.h,
src/base/ftcalc.c, src/base/ftdbgmem.c, src/base/ftobjs.c,
src/base/ftsystem.c, src/base/ftutil.c, src/bdf/bdfdrivr.c,
src/cache/ftccache.c, src/cache/ftccback.h, src/cache/ftccmap.c,
src/cache/ftcmanag.c, src/cff/cffdrivr.c, src/cid/cidriver.c,
src/pcf/pcfdrivr.c, src/pfr/pfrdrivr.c, src/psaux/psauxmod.c,
src/sfnt/sfdriver.c, src/truetype/ttdriver.c, src/type1/t1driver.c,
src/type1/t1objs.c, src/type42/t42drivr.c, src/winfonts/winfnt.c:
massive changes to the internals to respect the internal object layouts
and exported functions of FreeType 2.1.7. Note that the cache sub-system
cannot be fully retrofitted, unfortunately.
2006-02-16 23:45:31 +01:00
|
|
|
* previously selected a size that is listed in the BDF table.
|
2005-12-20 13:01:58 +01:00
|
|
|
* Should we change the BDF table format to include single offsets
|
|
|
|
* for `CHARSET_REGISTRY' and `CHARSET_ENCODING'?
|
|
|
|
*/
|
* include/freetype/config/ftoption.h,
include/freetype/config/ftstdlib.h,
include/freetype/internal/tttypes.h,
src/sfnt/Jamfile, src/sfnt/rules.mk, src/sfnt/sfdriver.c,
src/sfnt/ttbdf.h, src/sfnt/ttbdf.c, src/sfnt/sfobjs.c:
Added support for an embedded 'BDF ' table within SFNT-based
bitmap font files. This is used to store atoms & properties from
the original BDF fonts that were used to generate the font file.
the feature is controled by TT_CONFIG_OPTION_BDF within 'ftoption.h'
and is used to implement FT_Get_BDF_Property for these font files.
At the moment, this is still experimental, the BDF table format isn't
cast into stone yet.
2005-12-14 21:38:15 +01:00
|
|
|
error = tt_face_find_bdf_prop( face, "CHARSET_REGISTRY", ®istry );
|
|
|
|
if ( !error )
|
|
|
|
{
|
|
|
|
error = tt_face_find_bdf_prop( face, "CHARSET_ENCODING", &encoding );
|
|
|
|
if ( !error )
|
|
|
|
{
|
|
|
|
if ( registry.type == BDF_PROPERTY_TYPE_ATOM &&
|
|
|
|
encoding.type == BDF_PROPERTY_TYPE_ATOM )
|
|
|
|
{
|
|
|
|
*acharset_encoding = encoding.u.atom;
|
|
|
|
*acharset_registry = registry.u.atom;
|
|
|
|
}
|
|
|
|
else
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_Argument );
|
* include/freetype/config/ftoption.h,
include/freetype/config/ftstdlib.h,
include/freetype/internal/tttypes.h,
src/sfnt/Jamfile, src/sfnt/rules.mk, src/sfnt/sfdriver.c,
src/sfnt/ttbdf.h, src/sfnt/ttbdf.c, src/sfnt/sfobjs.c:
Added support for an embedded 'BDF ' table within SFNT-based
bitmap font files. This is used to store atoms & properties from
the original BDF fonts that were used to generate the font file.
the feature is controled by TT_CONFIG_OPTION_BDF within 'ftoption.h'
and is used to implement FT_Get_BDF_Property for these font files.
At the moment, this is still experimental, the BDF table format isn't
cast into stone yet.
2005-12-14 21:38:15 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_DEFINE_SERVICE_BDFRec(
|
|
|
|
sfnt_service_bdf,
|
2016-09-17 17:12:50 +02:00
|
|
|
|
2015-10-30 08:07:56 +01:00
|
|
|
(FT_BDF_GetCharsetIdFunc)sfnt_get_charset_id, /* get_charset_id */
|
2016-09-17 17:12:50 +02:00
|
|
|
(FT_BDF_GetPropertyFunc) tt_face_find_bdf_prop /* get_property */
|
|
|
|
)
|
2012-08-24 13:41:24 +02:00
|
|
|
|
* include/freetype/config/ftoption.h,
include/freetype/config/ftstdlib.h,
include/freetype/internal/tttypes.h,
src/sfnt/Jamfile, src/sfnt/rules.mk, src/sfnt/sfdriver.c,
src/sfnt/ttbdf.h, src/sfnt/ttbdf.c, src/sfnt/sfobjs.c:
Added support for an embedded 'BDF ' table within SFNT-based
bitmap font files. This is used to store atoms & properties from
the original BDF fonts that were used to generate the font file.
the feature is controled by TT_CONFIG_OPTION_BDF within 'ftoption.h'
and is used to implement FT_Get_BDF_Property for these font files.
At the moment, this is still experimental, the BDF table format isn't
cast into stone yet.
2005-12-14 21:38:15 +01:00
|
|
|
|
|
|
|
#endif /* TT_CONFIG_OPTION_BDF */
|
|
|
|
|
* include/freetype/ftmm.h, include/freetype/ftmodule.h,
include/freetype/tttables.h, include/freetype/config/ftconfig.h,
include/freetype/internal/ftobjs.h,
include/freetype/internal/ftserv.h,
include/freetype/internal/internal.h,
include/freetype/internal/sfnt.h,
include/freetype/internal/tttypes.h,
include/freetype/internal/services/bdf.h,
include/freetype/internal/services/glyfdict.h,
include/freetype/internal/services/multmast.h,
include/freetype/internal/services/postname.h,
include/freetype/internal/services/sfnt.h,
include/freetype/internal/services/xf86name.h,
src/base/ftbdf.c, src/base/ftmm.c, src/base/ftobjs.c,
src/base/ftxf86.c, src/bdf/bdfdrivr.c, src/cff/cffdrivr.c,
src/cid/cidriver.c, src/pcf/pcfdrivr.c, src/sfnt/sfdriver.c,
src/truetype/ttdriver.c, src/type1/t1driver.c, src/type42/t42drivr.c:
heavy internal modifications to introduce the concept of
"module services". This is the first step towards a massive
simplification of the engine's internals, in order to
get rid of various numbers of hacks.
Note that this changes will break source & binary compatibility
for authors of external font drivers.
Maybe 2.1.6 will be called 2.2.0 after all :-)
2003-09-11 21:51:54 +02:00
|
|
|
|
2005-12-20 13:01:58 +01:00
|
|
|
/*
|
2018-06-03 09:01:17 +02:00
|
|
|
* SERVICE LIST
|
2005-12-20 13:01:58 +01:00
|
|
|
*/
|
* include/freetype/ftmm.h, include/freetype/ftmodule.h,
include/freetype/tttables.h, include/freetype/config/ftconfig.h,
include/freetype/internal/ftobjs.h,
include/freetype/internal/ftserv.h,
include/freetype/internal/internal.h,
include/freetype/internal/sfnt.h,
include/freetype/internal/tttypes.h,
include/freetype/internal/services/bdf.h,
include/freetype/internal/services/glyfdict.h,
include/freetype/internal/services/multmast.h,
include/freetype/internal/services/postname.h,
include/freetype/internal/services/sfnt.h,
include/freetype/internal/services/xf86name.h,
src/base/ftbdf.c, src/base/ftmm.c, src/base/ftobjs.c,
src/base/ftxf86.c, src/bdf/bdfdrivr.c, src/cff/cffdrivr.c,
src/cid/cidriver.c, src/pcf/pcfdrivr.c, src/sfnt/sfdriver.c,
src/truetype/ttdriver.c, src/type1/t1driver.c, src/type42/t42drivr.c:
heavy internal modifications to introduce the concept of
"module services". This is the first step towards a massive
simplification of the engine's internals, in order to
get rid of various numbers of hacks.
Note that this changes will break source & binary compatibility
for authors of external font drivers.
Maybe 2.1.6 will be called 2.2.0 after all :-)
2003-09-11 21:51:54 +02:00
|
|
|
|
Position Independent Code (PIC) support in sfnt driver.
* include/freetype/internal/services/svbdf.h add macros to init
instances of FT_Service_BDFRec.
* include/freetype/internal/services/svgldict.h add macros to init
instances of FT_Service_GlyphDictRec.
* include/freetype/internal/services/svpostnm.h add macros to init
instances of FT_Service_PsFontNameRec.
* include/freetype/internal/services/svsfnt.h add macros to init
instances of FT_Service_SFNT_TableRec.
* include/freetype/internal/services/svttcmap.h add macros to init
instances of FT_Service_TTCMapsRec.
* include/freetype/internal/sfnt.h add macros to init
instances of SFNT_Interface.
* src/sfnt/sfdriver.h declare sfnt_module_class using macros from
ftmodapi.h, when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/sfnt/sfdriver.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
sfnt_service_sfnt_table, sfnt_service_glyph_dict, sfnt_service_ps_name
tt_service_get_cmap_info, sfnt_service_bdf, sfnt_interface,
sfnt_module_class, and sfnt_services array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
* src/sfnt/ttcmap.h add macros to init
instances of TT_CMap_ClassRec.
* src/sfnt/ttcmap.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
tt_cmap0_class_rec, tt_cmap2_class_rec, tt_cmap4_class_rec
tt_cmap6_class_rec, tt_cmap8_class_rec, tt_cmap10_class_rec,
tt_cmap12_class_rec, tt_cmap14_class_rec and tt_cmap_classes array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
The content of tt_cmap_classes is now described in the
new file 'ttcmapc.h'.
New Files:
* src/sfnt/sfntpic.h declare struct to hold PIC globals for sfnt
driver and macros to access them.
* src/sfnt/sfntpic.c implement functions to allocate, destroy and
initialize PIC globals for sfnt driver.
* src/sfnt/ttcmapc.h describing the content of
tt_cmap_classes allocated in ttcmap.c
* src/sfnt/sfnt.c add new file to build: sfntpic.c.
* src/sfnt/jamfile add new files to FT2_MULTI build: sfntpic.c.
2009-04-05 17:08:32 +02:00
|
|
|
#if defined TT_CONFIG_OPTION_POSTSCRIPT_NAMES && defined TT_CONFIG_OPTION_BDF
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_DEFINE_SERVICEDESCREC5(
|
|
|
|
sfnt_services,
|
2016-09-17 17:12:50 +02:00
|
|
|
|
Remove FT_CONFIG_OPTION_PIC and related code.
*/* [FT_CONFIG_OPTION_PIC]: Remove all code guarded by this
preprocessor symbol.
*/*: Replace `XXX_GET' macros (which could be either a function in
PIC mode or an array in non-PIC mode) with `xxx' arrays.
* include/freetype/internal/ftpic.h, src/autofit/afpic.c,
src/autofit/afpic.h, src/base/basepic.c, src/base/basepic.h,
src/base/ftpic.c, src/cff/cffpic.c, src/cff/cffpic.h,
src/pshinter/pshpic.c, src/pshinter/pshpic.h, src/psnames/pspic.c,
src/psnames/pspic.h, src/raster/rastpic.c, src/raster/rastpic.h,
src/sfnt/sfntpic.c, src/sfnt/sfntpic.h, src/smooth/ftspic.c,
src/smooth/ftspic.h, src/truetype/ttpic.c, src/truetype/ttpic.h:
Removed.
2018-05-02 20:27:48 +02:00
|
|
|
FT_SERVICE_ID_SFNT_TABLE, &sfnt_service_sfnt_table,
|
|
|
|
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &sfnt_service_ps_name,
|
|
|
|
FT_SERVICE_ID_GLYPH_DICT, &sfnt_service_glyph_dict,
|
|
|
|
FT_SERVICE_ID_BDF, &sfnt_service_bdf,
|
|
|
|
FT_SERVICE_ID_TT_CMAP, &tt_service_get_cmap_info )
|
Position Independent Code (PIC) support in sfnt driver.
* include/freetype/internal/services/svbdf.h add macros to init
instances of FT_Service_BDFRec.
* include/freetype/internal/services/svgldict.h add macros to init
instances of FT_Service_GlyphDictRec.
* include/freetype/internal/services/svpostnm.h add macros to init
instances of FT_Service_PsFontNameRec.
* include/freetype/internal/services/svsfnt.h add macros to init
instances of FT_Service_SFNT_TableRec.
* include/freetype/internal/services/svttcmap.h add macros to init
instances of FT_Service_TTCMapsRec.
* include/freetype/internal/sfnt.h add macros to init
instances of SFNT_Interface.
* src/sfnt/sfdriver.h declare sfnt_module_class using macros from
ftmodapi.h, when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/sfnt/sfdriver.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
sfnt_service_sfnt_table, sfnt_service_glyph_dict, sfnt_service_ps_name
tt_service_get_cmap_info, sfnt_service_bdf, sfnt_interface,
sfnt_module_class, and sfnt_services array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
* src/sfnt/ttcmap.h add macros to init
instances of TT_CMap_ClassRec.
* src/sfnt/ttcmap.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
tt_cmap0_class_rec, tt_cmap2_class_rec, tt_cmap4_class_rec
tt_cmap6_class_rec, tt_cmap8_class_rec, tt_cmap10_class_rec,
tt_cmap12_class_rec, tt_cmap14_class_rec and tt_cmap_classes array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
The content of tt_cmap_classes is now described in the
new file 'ttcmapc.h'.
New Files:
* src/sfnt/sfntpic.h declare struct to hold PIC globals for sfnt
driver and macros to access them.
* src/sfnt/sfntpic.c implement functions to allocate, destroy and
initialize PIC globals for sfnt driver.
* src/sfnt/ttcmapc.h describing the content of
tt_cmap_classes allocated in ttcmap.c
* src/sfnt/sfnt.c add new file to build: sfntpic.c.
* src/sfnt/jamfile add new files to FT2_MULTI build: sfntpic.c.
2009-04-05 17:08:32 +02:00
|
|
|
#elif defined TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_DEFINE_SERVICEDESCREC4(
|
|
|
|
sfnt_services,
|
2016-09-17 17:12:50 +02:00
|
|
|
|
Remove FT_CONFIG_OPTION_PIC and related code.
*/* [FT_CONFIG_OPTION_PIC]: Remove all code guarded by this
preprocessor symbol.
*/*: Replace `XXX_GET' macros (which could be either a function in
PIC mode or an array in non-PIC mode) with `xxx' arrays.
* include/freetype/internal/ftpic.h, src/autofit/afpic.c,
src/autofit/afpic.h, src/base/basepic.c, src/base/basepic.h,
src/base/ftpic.c, src/cff/cffpic.c, src/cff/cffpic.h,
src/pshinter/pshpic.c, src/pshinter/pshpic.h, src/psnames/pspic.c,
src/psnames/pspic.h, src/raster/rastpic.c, src/raster/rastpic.h,
src/sfnt/sfntpic.c, src/sfnt/sfntpic.h, src/smooth/ftspic.c,
src/smooth/ftspic.h, src/truetype/ttpic.c, src/truetype/ttpic.h:
Removed.
2018-05-02 20:27:48 +02:00
|
|
|
FT_SERVICE_ID_SFNT_TABLE, &sfnt_service_sfnt_table,
|
|
|
|
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &sfnt_service_ps_name,
|
|
|
|
FT_SERVICE_ID_GLYPH_DICT, &sfnt_service_glyph_dict,
|
|
|
|
FT_SERVICE_ID_TT_CMAP, &tt_service_get_cmap_info )
|
Position Independent Code (PIC) support in sfnt driver.
* include/freetype/internal/services/svbdf.h add macros to init
instances of FT_Service_BDFRec.
* include/freetype/internal/services/svgldict.h add macros to init
instances of FT_Service_GlyphDictRec.
* include/freetype/internal/services/svpostnm.h add macros to init
instances of FT_Service_PsFontNameRec.
* include/freetype/internal/services/svsfnt.h add macros to init
instances of FT_Service_SFNT_TableRec.
* include/freetype/internal/services/svttcmap.h add macros to init
instances of FT_Service_TTCMapsRec.
* include/freetype/internal/sfnt.h add macros to init
instances of SFNT_Interface.
* src/sfnt/sfdriver.h declare sfnt_module_class using macros from
ftmodapi.h, when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/sfnt/sfdriver.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
sfnt_service_sfnt_table, sfnt_service_glyph_dict, sfnt_service_ps_name
tt_service_get_cmap_info, sfnt_service_bdf, sfnt_interface,
sfnt_module_class, and sfnt_services array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
* src/sfnt/ttcmap.h add macros to init
instances of TT_CMap_ClassRec.
* src/sfnt/ttcmap.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
tt_cmap0_class_rec, tt_cmap2_class_rec, tt_cmap4_class_rec
tt_cmap6_class_rec, tt_cmap8_class_rec, tt_cmap10_class_rec,
tt_cmap12_class_rec, tt_cmap14_class_rec and tt_cmap_classes array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
The content of tt_cmap_classes is now described in the
new file 'ttcmapc.h'.
New Files:
* src/sfnt/sfntpic.h declare struct to hold PIC globals for sfnt
driver and macros to access them.
* src/sfnt/sfntpic.c implement functions to allocate, destroy and
initialize PIC globals for sfnt driver.
* src/sfnt/ttcmapc.h describing the content of
tt_cmap_classes allocated in ttcmap.c
* src/sfnt/sfnt.c add new file to build: sfntpic.c.
* src/sfnt/jamfile add new files to FT2_MULTI build: sfntpic.c.
2009-04-05 17:08:32 +02:00
|
|
|
#elif defined TT_CONFIG_OPTION_BDF
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_DEFINE_SERVICEDESCREC4(
|
|
|
|
sfnt_services,
|
2016-09-17 17:12:50 +02:00
|
|
|
|
Remove FT_CONFIG_OPTION_PIC and related code.
*/* [FT_CONFIG_OPTION_PIC]: Remove all code guarded by this
preprocessor symbol.
*/*: Replace `XXX_GET' macros (which could be either a function in
PIC mode or an array in non-PIC mode) with `xxx' arrays.
* include/freetype/internal/ftpic.h, src/autofit/afpic.c,
src/autofit/afpic.h, src/base/basepic.c, src/base/basepic.h,
src/base/ftpic.c, src/cff/cffpic.c, src/cff/cffpic.h,
src/pshinter/pshpic.c, src/pshinter/pshpic.h, src/psnames/pspic.c,
src/psnames/pspic.h, src/raster/rastpic.c, src/raster/rastpic.h,
src/sfnt/sfntpic.c, src/sfnt/sfntpic.h, src/smooth/ftspic.c,
src/smooth/ftspic.h, src/truetype/ttpic.c, src/truetype/ttpic.h:
Removed.
2018-05-02 20:27:48 +02:00
|
|
|
FT_SERVICE_ID_SFNT_TABLE, &sfnt_service_sfnt_table,
|
|
|
|
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &sfnt_service_ps_name,
|
|
|
|
FT_SERVICE_ID_BDF, &sfnt_service_bdf,
|
|
|
|
FT_SERVICE_ID_TT_CMAP, &tt_service_get_cmap_info )
|
Position Independent Code (PIC) support in sfnt driver.
* include/freetype/internal/services/svbdf.h add macros to init
instances of FT_Service_BDFRec.
* include/freetype/internal/services/svgldict.h add macros to init
instances of FT_Service_GlyphDictRec.
* include/freetype/internal/services/svpostnm.h add macros to init
instances of FT_Service_PsFontNameRec.
* include/freetype/internal/services/svsfnt.h add macros to init
instances of FT_Service_SFNT_TableRec.
* include/freetype/internal/services/svttcmap.h add macros to init
instances of FT_Service_TTCMapsRec.
* include/freetype/internal/sfnt.h add macros to init
instances of SFNT_Interface.
* src/sfnt/sfdriver.h declare sfnt_module_class using macros from
ftmodapi.h, when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/sfnt/sfdriver.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
sfnt_service_sfnt_table, sfnt_service_glyph_dict, sfnt_service_ps_name
tt_service_get_cmap_info, sfnt_service_bdf, sfnt_interface,
sfnt_module_class, and sfnt_services array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
* src/sfnt/ttcmap.h add macros to init
instances of TT_CMap_ClassRec.
* src/sfnt/ttcmap.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
tt_cmap0_class_rec, tt_cmap2_class_rec, tt_cmap4_class_rec
tt_cmap6_class_rec, tt_cmap8_class_rec, tt_cmap10_class_rec,
tt_cmap12_class_rec, tt_cmap14_class_rec and tt_cmap_classes array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
The content of tt_cmap_classes is now described in the
new file 'ttcmapc.h'.
New Files:
* src/sfnt/sfntpic.h declare struct to hold PIC globals for sfnt
driver and macros to access them.
* src/sfnt/sfntpic.c implement functions to allocate, destroy and
initialize PIC globals for sfnt driver.
* src/sfnt/ttcmapc.h describing the content of
tt_cmap_classes allocated in ttcmap.c
* src/sfnt/sfnt.c add new file to build: sfntpic.c.
* src/sfnt/jamfile add new files to FT2_MULTI build: sfntpic.c.
2009-04-05 17:08:32 +02:00
|
|
|
#else
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_DEFINE_SERVICEDESCREC3(
|
|
|
|
sfnt_services,
|
2016-09-17 17:12:50 +02:00
|
|
|
|
Remove FT_CONFIG_OPTION_PIC and related code.
*/* [FT_CONFIG_OPTION_PIC]: Remove all code guarded by this
preprocessor symbol.
*/*: Replace `XXX_GET' macros (which could be either a function in
PIC mode or an array in non-PIC mode) with `xxx' arrays.
* include/freetype/internal/ftpic.h, src/autofit/afpic.c,
src/autofit/afpic.h, src/base/basepic.c, src/base/basepic.h,
src/base/ftpic.c, src/cff/cffpic.c, src/cff/cffpic.h,
src/pshinter/pshpic.c, src/pshinter/pshpic.h, src/psnames/pspic.c,
src/psnames/pspic.h, src/raster/rastpic.c, src/raster/rastpic.h,
src/sfnt/sfntpic.c, src/sfnt/sfntpic.h, src/smooth/ftspic.c,
src/smooth/ftspic.h, src/truetype/ttpic.c, src/truetype/ttpic.h:
Removed.
2018-05-02 20:27:48 +02:00
|
|
|
FT_SERVICE_ID_SFNT_TABLE, &sfnt_service_sfnt_table,
|
|
|
|
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &sfnt_service_ps_name,
|
|
|
|
FT_SERVICE_ID_TT_CMAP, &tt_service_get_cmap_info )
|
* include/freetype/internal/ftserv.h,
include/freetype/internal/service/svpfr.h,
include/freetype/internal/pfr.h,
src/base/ftpfr.c:
migrating the functions of "ftpfr.h" to the new
service-base internal API
* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c:
removing various compiler warnings
2003-09-21 18:04:05 +02:00
|
|
|
#endif
|
2000-07-20 08:57:41 +02:00
|
|
|
|
2000-07-19 19:13:03 +02:00
|
|
|
|
2001-06-28 01:25:46 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Module_Interface )
|
* 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
|
|
|
sfnt_get_interface( FT_Module module,
|
2002-04-30 08:37:52 +02:00
|
|
|
const char* module_interface )
|
2000-05-27 00:13:17 +02:00
|
|
|
{
|
2012-01-13 22:40:03 +01:00
|
|
|
FT_UNUSED( module );
|
2012-08-24 13:41:24 +02:00
|
|
|
|
Remove FT_CONFIG_OPTION_PIC and related code.
*/* [FT_CONFIG_OPTION_PIC]: Remove all code guarded by this
preprocessor symbol.
*/*: Replace `XXX_GET' macros (which could be either a function in
PIC mode or an array in non-PIC mode) with `xxx' arrays.
* include/freetype/internal/ftpic.h, src/autofit/afpic.c,
src/autofit/afpic.h, src/base/basepic.c, src/base/basepic.h,
src/base/ftpic.c, src/cff/cffpic.c, src/cff/cffpic.h,
src/pshinter/pshpic.c, src/pshinter/pshpic.h, src/psnames/pspic.c,
src/psnames/pspic.h, src/raster/rastpic.c, src/raster/rastpic.h,
src/sfnt/sfntpic.c, src/sfnt/sfntpic.h, src/smooth/ftspic.c,
src/smooth/ftspic.h, src/truetype/ttpic.c, src/truetype/ttpic.h:
Removed.
2018-05-02 20:27:48 +02:00
|
|
|
return ft_service_list_lookup( sfnt_services, module_interface );
|
2000-05-27 00:13:17 +02:00
|
|
|
}
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
|
Position Independent Code (PIC) support in sfnt driver.
* include/freetype/internal/services/svbdf.h add macros to init
instances of FT_Service_BDFRec.
* include/freetype/internal/services/svgldict.h add macros to init
instances of FT_Service_GlyphDictRec.
* include/freetype/internal/services/svpostnm.h add macros to init
instances of FT_Service_PsFontNameRec.
* include/freetype/internal/services/svsfnt.h add macros to init
instances of FT_Service_SFNT_TableRec.
* include/freetype/internal/services/svttcmap.h add macros to init
instances of FT_Service_TTCMapsRec.
* include/freetype/internal/sfnt.h add macros to init
instances of SFNT_Interface.
* src/sfnt/sfdriver.h declare sfnt_module_class using macros from
ftmodapi.h, when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/sfnt/sfdriver.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
sfnt_service_sfnt_table, sfnt_service_glyph_dict, sfnt_service_ps_name
tt_service_get_cmap_info, sfnt_service_bdf, sfnt_interface,
sfnt_module_class, and sfnt_services array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
* src/sfnt/ttcmap.h add macros to init
instances of TT_CMap_ClassRec.
* src/sfnt/ttcmap.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
tt_cmap0_class_rec, tt_cmap2_class_rec, tt_cmap4_class_rec
tt_cmap6_class_rec, tt_cmap8_class_rec, tt_cmap10_class_rec,
tt_cmap12_class_rec, tt_cmap14_class_rec and tt_cmap_classes array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
The content of tt_cmap_classes is now described in the
new file 'ttcmapc.h'.
New Files:
* src/sfnt/sfntpic.h declare struct to hold PIC globals for sfnt
driver and macros to access them.
* src/sfnt/sfntpic.c implement functions to allocate, destroy and
initialize PIC globals for sfnt driver.
* src/sfnt/ttcmapc.h describing the content of
tt_cmap_classes allocated in ttcmap.c
* src/sfnt/sfnt.c add new file to build: sfntpic.c.
* src/sfnt/jamfile add new files to FT2_MULTI build: sfntpic.c.
2009-04-05 17:08:32 +02:00
|
|
|
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
2012-08-24 13:41:24 +02:00
|
|
|
#define PUT_EMBEDDED_BITMAPS( a ) a
|
Position Independent Code (PIC) support in sfnt driver.
* include/freetype/internal/services/svbdf.h add macros to init
instances of FT_Service_BDFRec.
* include/freetype/internal/services/svgldict.h add macros to init
instances of FT_Service_GlyphDictRec.
* include/freetype/internal/services/svpostnm.h add macros to init
instances of FT_Service_PsFontNameRec.
* include/freetype/internal/services/svsfnt.h add macros to init
instances of FT_Service_SFNT_TableRec.
* include/freetype/internal/services/svttcmap.h add macros to init
instances of FT_Service_TTCMapsRec.
* include/freetype/internal/sfnt.h add macros to init
instances of SFNT_Interface.
* src/sfnt/sfdriver.h declare sfnt_module_class using macros from
ftmodapi.h, when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/sfnt/sfdriver.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
sfnt_service_sfnt_table, sfnt_service_glyph_dict, sfnt_service_ps_name
tt_service_get_cmap_info, sfnt_service_bdf, sfnt_interface,
sfnt_module_class, and sfnt_services array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
* src/sfnt/ttcmap.h add macros to init
instances of TT_CMap_ClassRec.
* src/sfnt/ttcmap.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
tt_cmap0_class_rec, tt_cmap2_class_rec, tt_cmap4_class_rec
tt_cmap6_class_rec, tt_cmap8_class_rec, tt_cmap10_class_rec,
tt_cmap12_class_rec, tt_cmap14_class_rec and tt_cmap_classes array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
The content of tt_cmap_classes is now described in the
new file 'ttcmapc.h'.
New Files:
* src/sfnt/sfntpic.h declare struct to hold PIC globals for sfnt
driver and macros to access them.
* src/sfnt/sfntpic.c implement functions to allocate, destroy and
initialize PIC globals for sfnt driver.
* src/sfnt/ttcmapc.h describing the content of
tt_cmap_classes allocated in ttcmap.c
* src/sfnt/sfnt.c add new file to build: sfntpic.c.
* src/sfnt/jamfile add new files to FT2_MULTI build: sfntpic.c.
2009-04-05 17:08:32 +02:00
|
|
|
#else
|
2012-08-24 13:41:24 +02:00
|
|
|
#define PUT_EMBEDDED_BITMAPS( a ) NULL
|
Position Independent Code (PIC) support in sfnt driver.
* include/freetype/internal/services/svbdf.h add macros to init
instances of FT_Service_BDFRec.
* include/freetype/internal/services/svgldict.h add macros to init
instances of FT_Service_GlyphDictRec.
* include/freetype/internal/services/svpostnm.h add macros to init
instances of FT_Service_PsFontNameRec.
* include/freetype/internal/services/svsfnt.h add macros to init
instances of FT_Service_SFNT_TableRec.
* include/freetype/internal/services/svttcmap.h add macros to init
instances of FT_Service_TTCMapsRec.
* include/freetype/internal/sfnt.h add macros to init
instances of SFNT_Interface.
* src/sfnt/sfdriver.h declare sfnt_module_class using macros from
ftmodapi.h, when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/sfnt/sfdriver.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
sfnt_service_sfnt_table, sfnt_service_glyph_dict, sfnt_service_ps_name
tt_service_get_cmap_info, sfnt_service_bdf, sfnt_interface,
sfnt_module_class, and sfnt_services array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
* src/sfnt/ttcmap.h add macros to init
instances of TT_CMap_ClassRec.
* src/sfnt/ttcmap.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
tt_cmap0_class_rec, tt_cmap2_class_rec, tt_cmap4_class_rec
tt_cmap6_class_rec, tt_cmap8_class_rec, tt_cmap10_class_rec,
tt_cmap12_class_rec, tt_cmap14_class_rec and tt_cmap_classes array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
The content of tt_cmap_classes is now described in the
new file 'ttcmapc.h'.
New Files:
* src/sfnt/sfntpic.h declare struct to hold PIC globals for sfnt
driver and macros to access them.
* src/sfnt/sfntpic.c implement functions to allocate, destroy and
initialize PIC globals for sfnt driver.
* src/sfnt/ttcmapc.h describing the content of
tt_cmap_classes allocated in ttcmap.c
* src/sfnt/sfnt.c add new file to build: sfntpic.c.
* src/sfnt/jamfile add new files to FT2_MULTI build: sfntpic.c.
2009-04-05 17:08:32 +02:00
|
|
|
#endif
|
2012-08-24 13:41:24 +02:00
|
|
|
|
[sfnt] Preliminary support of coloured layer outlines.
This commit enables OpenType's COLR/CPAL table handling; a typical
application are color emojis that can be scaled to any size.
If the color palette does not exist or is invalid, the rendering
step rasterizes the outline instead. The current implementation
assumes that the foreground is black.
Enable this by defining option TT_CONFIG_OPTION_COLOR_LAYERS.
There are still some issues with metrics; additionally, an API to
fetch color layers is missing.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_COLOR_LAYERS): New macro.
* include/freetype/internal/ftobjs.h (FT_Glyph_LayerRec,
FT_Colr_InternalRec): New structures.
(FT_Slot_InternalRec): Add `color_layers' field.
* include/freetype/internal/sfnt.h (TT_Load_Colr_Layer_Func,
TT_Blend_Colr_Func): New function types.
(SFNT_Interface): Add `load_colr', `free_colr', `load_colr_layer',
and `colr_blend' fields.
* include/freetype/internal/tttypes.h (TT_FaceRec): Add
`colr_and_cpal' field.
* include/freetype/internal/tttags. (TTAG_COLR, TTAG_CPAL): New
macros.
* src/sfnt/ttcolr.c, src/sfnt/ttcolr.h: New files.
* src/base/ftobjs.c (ft_glyphslot_done, FT_Render_Glyph_Internal):
Handle glyph color layers.
* src/sfnt/Jamfile (_sources), src/sfnt/rules.mk (SFNT_DRV_SRC): Add
`ttcolr.c'.
* src/sfnt/sfdriver.c: Include `ttcolr.h'.
(PUT_COLOR_LAYERS): New macro.
Update call to `FT_DEFINE_SFNT_INTERFACE'.
* src/sfnt/sfnt.c: Include `ttcolr.c'.
* src/sfnt/sfobjs.c (sfnt_load_face): Load `COLR' and `CPAL' tables.
(sfnt_done_face): Updated.
* src/truetype/ttgload.c (TT_Load_Glyph): Handle color layers.
2018-05-13 03:25:09 +02:00
|
|
|
#ifdef TT_CONFIG_OPTION_COLOR_LAYERS
|
|
|
|
#define PUT_COLOR_LAYERS( a ) a
|
|
|
|
#else
|
|
|
|
#define PUT_COLOR_LAYERS( a ) NULL
|
|
|
|
#endif
|
|
|
|
|
2021-12-26 04:20:44 +01:00
|
|
|
#ifdef FT_CONFIG_OPTION_SVG
|
|
|
|
#define PUT_SVG_SUPPORT( a ) a
|
|
|
|
#else
|
|
|
|
#define PUT_SVG_SUPPORT( a ) NULL
|
|
|
|
#endif
|
|
|
|
|
2020-12-16 16:12:30 +01:00
|
|
|
#define PUT_COLOR_LAYERS_V1( a ) PUT_COLOR_LAYERS( a )
|
|
|
|
|
Position Independent Code (PIC) support in sfnt driver.
* include/freetype/internal/services/svbdf.h add macros to init
instances of FT_Service_BDFRec.
* include/freetype/internal/services/svgldict.h add macros to init
instances of FT_Service_GlyphDictRec.
* include/freetype/internal/services/svpostnm.h add macros to init
instances of FT_Service_PsFontNameRec.
* include/freetype/internal/services/svsfnt.h add macros to init
instances of FT_Service_SFNT_TableRec.
* include/freetype/internal/services/svttcmap.h add macros to init
instances of FT_Service_TTCMapsRec.
* include/freetype/internal/sfnt.h add macros to init
instances of SFNT_Interface.
* src/sfnt/sfdriver.h declare sfnt_module_class using macros from
ftmodapi.h, when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/sfnt/sfdriver.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
sfnt_service_sfnt_table, sfnt_service_glyph_dict, sfnt_service_ps_name
tt_service_get_cmap_info, sfnt_service_bdf, sfnt_interface,
sfnt_module_class, and sfnt_services array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
* src/sfnt/ttcmap.h add macros to init
instances of TT_CMap_ClassRec.
* src/sfnt/ttcmap.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
tt_cmap0_class_rec, tt_cmap2_class_rec, tt_cmap4_class_rec
tt_cmap6_class_rec, tt_cmap8_class_rec, tt_cmap10_class_rec,
tt_cmap12_class_rec, tt_cmap14_class_rec and tt_cmap_classes array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
The content of tt_cmap_classes is now described in the
new file 'ttcmapc.h'.
New Files:
* src/sfnt/sfntpic.h declare struct to hold PIC globals for sfnt
driver and macros to access them.
* src/sfnt/sfntpic.c implement functions to allocate, destroy and
initialize PIC globals for sfnt driver.
* src/sfnt/ttcmapc.h describing the content of
tt_cmap_classes allocated in ttcmap.c
* src/sfnt/sfnt.c add new file to build: sfntpic.c.
* src/sfnt/jamfile add new files to FT2_MULTI build: sfntpic.c.
2009-04-05 17:08:32 +02:00
|
|
|
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
2012-08-24 13:41:24 +02:00
|
|
|
#define PUT_PS_NAMES( a ) a
|
Position Independent Code (PIC) support in sfnt driver.
* include/freetype/internal/services/svbdf.h add macros to init
instances of FT_Service_BDFRec.
* include/freetype/internal/services/svgldict.h add macros to init
instances of FT_Service_GlyphDictRec.
* include/freetype/internal/services/svpostnm.h add macros to init
instances of FT_Service_PsFontNameRec.
* include/freetype/internal/services/svsfnt.h add macros to init
instances of FT_Service_SFNT_TableRec.
* include/freetype/internal/services/svttcmap.h add macros to init
instances of FT_Service_TTCMapsRec.
* include/freetype/internal/sfnt.h add macros to init
instances of SFNT_Interface.
* src/sfnt/sfdriver.h declare sfnt_module_class using macros from
ftmodapi.h, when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/sfnt/sfdriver.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
sfnt_service_sfnt_table, sfnt_service_glyph_dict, sfnt_service_ps_name
tt_service_get_cmap_info, sfnt_service_bdf, sfnt_interface,
sfnt_module_class, and sfnt_services array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
* src/sfnt/ttcmap.h add macros to init
instances of TT_CMap_ClassRec.
* src/sfnt/ttcmap.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
tt_cmap0_class_rec, tt_cmap2_class_rec, tt_cmap4_class_rec
tt_cmap6_class_rec, tt_cmap8_class_rec, tt_cmap10_class_rec,
tt_cmap12_class_rec, tt_cmap14_class_rec and tt_cmap_classes array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
The content of tt_cmap_classes is now described in the
new file 'ttcmapc.h'.
New Files:
* src/sfnt/sfntpic.h declare struct to hold PIC globals for sfnt
driver and macros to access them.
* src/sfnt/sfntpic.c implement functions to allocate, destroy and
initialize PIC globals for sfnt driver.
* src/sfnt/ttcmapc.h describing the content of
tt_cmap_classes allocated in ttcmap.c
* src/sfnt/sfnt.c add new file to build: sfntpic.c.
* src/sfnt/jamfile add new files to FT2_MULTI build: sfntpic.c.
2009-04-05 17:08:32 +02:00
|
|
|
#else
|
2012-08-24 13:41:24 +02:00
|
|
|
#define PUT_PS_NAMES( a ) NULL
|
Position Independent Code (PIC) support in sfnt driver.
* include/freetype/internal/services/svbdf.h add macros to init
instances of FT_Service_BDFRec.
* include/freetype/internal/services/svgldict.h add macros to init
instances of FT_Service_GlyphDictRec.
* include/freetype/internal/services/svpostnm.h add macros to init
instances of FT_Service_PsFontNameRec.
* include/freetype/internal/services/svsfnt.h add macros to init
instances of FT_Service_SFNT_TableRec.
* include/freetype/internal/services/svttcmap.h add macros to init
instances of FT_Service_TTCMapsRec.
* include/freetype/internal/sfnt.h add macros to init
instances of SFNT_Interface.
* src/sfnt/sfdriver.h declare sfnt_module_class using macros from
ftmodapi.h, when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/sfnt/sfdriver.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
sfnt_service_sfnt_table, sfnt_service_glyph_dict, sfnt_service_ps_name
tt_service_get_cmap_info, sfnt_service_bdf, sfnt_interface,
sfnt_module_class, and sfnt_services array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
* src/sfnt/ttcmap.h add macros to init
instances of TT_CMap_ClassRec.
* src/sfnt/ttcmap.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
tt_cmap0_class_rec, tt_cmap2_class_rec, tt_cmap4_class_rec
tt_cmap6_class_rec, tt_cmap8_class_rec, tt_cmap10_class_rec,
tt_cmap12_class_rec, tt_cmap14_class_rec and tt_cmap_classes array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
The content of tt_cmap_classes is now described in the
new file 'ttcmapc.h'.
New Files:
* src/sfnt/sfntpic.h declare struct to hold PIC globals for sfnt
driver and macros to access them.
* src/sfnt/sfntpic.c implement functions to allocate, destroy and
initialize PIC globals for sfnt driver.
* src/sfnt/ttcmapc.h describing the content of
tt_cmap_classes allocated in ttcmap.c
* src/sfnt/sfnt.c add new file to build: sfntpic.c.
* src/sfnt/jamfile add new files to FT2_MULTI build: sfntpic.c.
2009-04-05 17:08:32 +02:00
|
|
|
#endif
|
2006-02-17 09:07:09 +01:00
|
|
|
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_DEFINE_SFNT_INTERFACE(
|
|
|
|
sfnt_interface,
|
2016-09-17 17:12:50 +02:00
|
|
|
|
2016-08-26 08:42:27 +02:00
|
|
|
tt_face_goto_table, /* TT_Loader_GotoTableFunc goto_table */
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2016-08-26 08:42:27 +02:00
|
|
|
sfnt_init_face, /* TT_Init_Face_Func init_face */
|
|
|
|
sfnt_load_face, /* TT_Load_Face_Func load_face */
|
|
|
|
sfnt_done_face, /* TT_Done_Face_Func done_face */
|
|
|
|
sfnt_get_interface, /* FT_Module_Requester get_interface */
|
2000-05-27 00:13:17 +02:00
|
|
|
|
2016-08-26 08:42:27 +02:00
|
|
|
tt_face_load_any, /* TT_Load_Any_Func load_any */
|
* builds/amiga/src/base/ftsystem.c, devel/ftoption.h
include/freetype/ftcache.h, include/freetype/ftoutln.h,
include/freetype/cache/ftccache.h, include/freetype/cache/ftccmap.h,
include/freetype/config/ftoption.h, include/freetype/internal/ftcalc.h,
include/freetype/internal/ftdriver.h,
include/freetype/internal/ftmemory.h,
include/freetype/internal/ftobjs.h, include/freetype/internal/ftrfork.h,
include/freetype/internal/psaux.h, include/freetype/internal/sfnt.h,
include/freetype/internal/t1types.h, include/freetype/internal/tttypes.h,
src/base/ftcalc.c, src/base/ftdbgmem.c, src/base/ftobjs.c,
src/base/ftsystem.c, src/base/ftutil.c, src/bdf/bdfdrivr.c,
src/cache/ftccache.c, src/cache/ftccback.h, src/cache/ftccmap.c,
src/cache/ftcmanag.c, src/cff/cffdrivr.c, src/cid/cidriver.c,
src/pcf/pcfdrivr.c, src/pfr/pfrdrivr.c, src/psaux/psauxmod.c,
src/sfnt/sfdriver.c, src/truetype/ttdriver.c, src/type1/t1driver.c,
src/type1/t1objs.c, src/type42/t42drivr.c, src/winfonts/winfnt.c:
massive changes to the internals to respect the internal object layouts
and exported functions of FreeType 2.1.7. Note that the cache sub-system
cannot be fully retrofitted, unfortunately.
2006-02-16 23:45:31 +01:00
|
|
|
|
2016-08-26 08:42:27 +02:00
|
|
|
tt_face_load_head, /* TT_Load_Table_Func load_head */
|
|
|
|
tt_face_load_hhea, /* TT_Load_Metrics_Func load_hhea */
|
|
|
|
tt_face_load_cmap, /* TT_Load_Table_Func load_cmap */
|
|
|
|
tt_face_load_maxp, /* TT_Load_Table_Func load_maxp */
|
|
|
|
tt_face_load_os2, /* TT_Load_Table_Func load_os2 */
|
|
|
|
tt_face_load_post, /* TT_Load_Table_Func load_post */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2016-08-26 08:42:27 +02:00
|
|
|
tt_face_load_name, /* TT_Load_Table_Func load_name */
|
|
|
|
tt_face_free_name, /* TT_Free_Table_Func free_name */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2016-08-26 08:42:27 +02:00
|
|
|
tt_face_load_kern, /* TT_Load_Table_Func load_kern */
|
|
|
|
tt_face_load_gasp, /* TT_Load_Table_Func load_gasp */
|
|
|
|
tt_face_load_pclt, /* TT_Load_Table_Func load_init */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-11-07 07:30:29 +01:00
|
|
|
/* see `ttload.h' */
|
2012-08-24 13:41:24 +02:00
|
|
|
PUT_EMBEDDED_BITMAPS( tt_face_load_bhed ),
|
2016-08-26 08:42:27 +02:00
|
|
|
/* TT_Load_Table_Func load_bhed */
|
2012-08-24 13:41:24 +02:00
|
|
|
PUT_EMBEDDED_BITMAPS( tt_face_load_sbit_image ),
|
2016-08-26 08:42:27 +02:00
|
|
|
/* TT_Load_SBit_Image_Func load_sbit_image */
|
2005-02-26 01:12:04 +01:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
/* see `ttpost.h' */
|
2012-08-24 13:41:24 +02:00
|
|
|
PUT_PS_NAMES( tt_face_get_ps_name ),
|
2016-08-26 08:42:27 +02:00
|
|
|
/* TT_Get_PS_Name_Func get_psname */
|
2012-08-24 13:41:24 +02:00
|
|
|
PUT_PS_NAMES( tt_face_free_ps_names ),
|
2016-08-26 08:42:27 +02:00
|
|
|
/* TT_Free_Table_Func free_psnames */
|
2000-07-01 16:06:46 +02:00
|
|
|
|
2006-02-17 09:07:09 +01:00
|
|
|
/* since version 2.1.8 */
|
2016-08-26 08:42:27 +02:00
|
|
|
tt_face_get_kerning, /* TT_Face_GetKerningFunc get_kerning */
|
* builds/amiga/src/base/ftsystem.c, devel/ftoption.h
include/freetype/ftcache.h, include/freetype/ftoutln.h,
include/freetype/cache/ftccache.h, include/freetype/cache/ftccmap.h,
include/freetype/config/ftoption.h, include/freetype/internal/ftcalc.h,
include/freetype/internal/ftdriver.h,
include/freetype/internal/ftmemory.h,
include/freetype/internal/ftobjs.h, include/freetype/internal/ftrfork.h,
include/freetype/internal/psaux.h, include/freetype/internal/sfnt.h,
include/freetype/internal/t1types.h, include/freetype/internal/tttypes.h,
src/base/ftcalc.c, src/base/ftdbgmem.c, src/base/ftobjs.c,
src/base/ftsystem.c, src/base/ftutil.c, src/bdf/bdfdrivr.c,
src/cache/ftccache.c, src/cache/ftccback.h, src/cache/ftccmap.c,
src/cache/ftcmanag.c, src/cff/cffdrivr.c, src/cid/cidriver.c,
src/pcf/pcfdrivr.c, src/pfr/pfrdrivr.c, src/psaux/psauxmod.c,
src/sfnt/sfdriver.c, src/truetype/ttdriver.c, src/type1/t1driver.c,
src/type1/t1objs.c, src/type42/t42drivr.c, src/winfonts/winfnt.c:
massive changes to the internals to respect the internal object layouts
and exported functions of FreeType 2.1.7. Note that the cache sub-system
cannot be fully retrofitted, unfortunately.
2006-02-16 23:45:31 +01:00
|
|
|
|
2006-02-17 09:07:09 +01:00
|
|
|
/* since version 2.2 */
|
2016-08-26 08:42:27 +02:00
|
|
|
tt_face_load_font_dir, /* TT_Load_Table_Func load_font_dir */
|
|
|
|
tt_face_load_hmtx, /* TT_Load_Metrics_Func load_hmtx */
|
* builds/amiga/src/base/ftsystem.c, devel/ftoption.h
include/freetype/ftcache.h, include/freetype/ftoutln.h,
include/freetype/cache/ftccache.h, include/freetype/cache/ftccmap.h,
include/freetype/config/ftoption.h, include/freetype/internal/ftcalc.h,
include/freetype/internal/ftdriver.h,
include/freetype/internal/ftmemory.h,
include/freetype/internal/ftobjs.h, include/freetype/internal/ftrfork.h,
include/freetype/internal/psaux.h, include/freetype/internal/sfnt.h,
include/freetype/internal/t1types.h, include/freetype/internal/tttypes.h,
src/base/ftcalc.c, src/base/ftdbgmem.c, src/base/ftobjs.c,
src/base/ftsystem.c, src/base/ftutil.c, src/bdf/bdfdrivr.c,
src/cache/ftccache.c, src/cache/ftccback.h, src/cache/ftccmap.c,
src/cache/ftcmanag.c, src/cff/cffdrivr.c, src/cid/cidriver.c,
src/pcf/pcfdrivr.c, src/pfr/pfrdrivr.c, src/psaux/psauxmod.c,
src/sfnt/sfdriver.c, src/truetype/ttdriver.c, src/type1/t1driver.c,
src/type1/t1objs.c, src/type42/t42drivr.c, src/winfonts/winfnt.c:
massive changes to the internals to respect the internal object layouts
and exported functions of FreeType 2.1.7. Note that the cache sub-system
cannot be fully retrofitted, unfortunately.
2006-02-16 23:45:31 +01:00
|
|
|
|
|
|
|
/* see `ttsbit.h' and `sfnt.h' */
|
2013-07-18 13:13:12 +02:00
|
|
|
PUT_EMBEDDED_BITMAPS( tt_face_load_sbit ),
|
2016-08-26 08:42:27 +02:00
|
|
|
/* TT_Load_Table_Func load_eblc */
|
2013-07-18 13:13:12 +02:00
|
|
|
PUT_EMBEDDED_BITMAPS( tt_face_free_sbit ),
|
2016-08-26 08:42:27 +02:00
|
|
|
/* TT_Free_Table_Func free_eblc */
|
* builds/amiga/src/base/ftsystem.c, devel/ftoption.h
include/freetype/ftcache.h, include/freetype/ftoutln.h,
include/freetype/cache/ftccache.h, include/freetype/cache/ftccmap.h,
include/freetype/config/ftoption.h, include/freetype/internal/ftcalc.h,
include/freetype/internal/ftdriver.h,
include/freetype/internal/ftmemory.h,
include/freetype/internal/ftobjs.h, include/freetype/internal/ftrfork.h,
include/freetype/internal/psaux.h, include/freetype/internal/sfnt.h,
include/freetype/internal/t1types.h, include/freetype/internal/tttypes.h,
src/base/ftcalc.c, src/base/ftdbgmem.c, src/base/ftobjs.c,
src/base/ftsystem.c, src/base/ftutil.c, src/bdf/bdfdrivr.c,
src/cache/ftccache.c, src/cache/ftccback.h, src/cache/ftccmap.c,
src/cache/ftcmanag.c, src/cff/cffdrivr.c, src/cid/cidriver.c,
src/pcf/pcfdrivr.c, src/pfr/pfrdrivr.c, src/psaux/psauxmod.c,
src/sfnt/sfdriver.c, src/truetype/ttdriver.c, src/type1/t1driver.c,
src/type1/t1objs.c, src/type42/t42drivr.c, src/winfonts/winfnt.c:
massive changes to the internals to respect the internal object layouts
and exported functions of FreeType 2.1.7. Note that the cache sub-system
cannot be fully retrofitted, unfortunately.
2006-02-16 23:45:31 +01:00
|
|
|
|
2012-08-24 13:41:24 +02:00
|
|
|
PUT_EMBEDDED_BITMAPS( tt_face_set_sbit_strike ),
|
2020-12-16 16:12:30 +01:00
|
|
|
/* TT_Set_SBit_Strike_Func set_sbit_strike */
|
2012-08-24 13:41:24 +02:00
|
|
|
PUT_EMBEDDED_BITMAPS( tt_face_load_strike_metrics ),
|
2020-12-16 16:12:30 +01:00
|
|
|
/* TT_Load_Strike_Metrics_Func load_strike_metrics */
|
[sfnt] Preliminary support of coloured layer outlines.
This commit enables OpenType's COLR/CPAL table handling; a typical
application are color emojis that can be scaled to any size.
If the color palette does not exist or is invalid, the rendering
step rasterizes the outline instead. The current implementation
assumes that the foreground is black.
Enable this by defining option TT_CONFIG_OPTION_COLOR_LAYERS.
There are still some issues with metrics; additionally, an API to
fetch color layers is missing.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_COLOR_LAYERS): New macro.
* include/freetype/internal/ftobjs.h (FT_Glyph_LayerRec,
FT_Colr_InternalRec): New structures.
(FT_Slot_InternalRec): Add `color_layers' field.
* include/freetype/internal/sfnt.h (TT_Load_Colr_Layer_Func,
TT_Blend_Colr_Func): New function types.
(SFNT_Interface): Add `load_colr', `free_colr', `load_colr_layer',
and `colr_blend' fields.
* include/freetype/internal/tttypes.h (TT_FaceRec): Add
`colr_and_cpal' field.
* include/freetype/internal/tttags. (TTAG_COLR, TTAG_CPAL): New
macros.
* src/sfnt/ttcolr.c, src/sfnt/ttcolr.h: New files.
* src/base/ftobjs.c (ft_glyphslot_done, FT_Render_Glyph_Internal):
Handle glyph color layers.
* src/sfnt/Jamfile (_sources), src/sfnt/rules.mk (SFNT_DRV_SRC): Add
`ttcolr.c'.
* src/sfnt/sfdriver.c: Include `ttcolr.h'.
(PUT_COLOR_LAYERS): New macro.
Update call to `FT_DEFINE_SFNT_INTERFACE'.
* src/sfnt/sfnt.c: Include `ttcolr.c'.
* src/sfnt/sfobjs.c (sfnt_load_face): Load `COLR' and `CPAL' tables.
(sfnt_done_face): Updated.
* src/truetype/ttgload.c (TT_Load_Glyph): Handle color layers.
2018-05-13 03:25:09 +02:00
|
|
|
|
2018-06-13 08:46:27 +02:00
|
|
|
PUT_COLOR_LAYERS( tt_face_load_cpal ),
|
|
|
|
/* TT_Load_Table_Func load_cpal */
|
[sfnt] Preliminary support of coloured layer outlines.
This commit enables OpenType's COLR/CPAL table handling; a typical
application are color emojis that can be scaled to any size.
If the color palette does not exist or is invalid, the rendering
step rasterizes the outline instead. The current implementation
assumes that the foreground is black.
Enable this by defining option TT_CONFIG_OPTION_COLOR_LAYERS.
There are still some issues with metrics; additionally, an API to
fetch color layers is missing.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_COLOR_LAYERS): New macro.
* include/freetype/internal/ftobjs.h (FT_Glyph_LayerRec,
FT_Colr_InternalRec): New structures.
(FT_Slot_InternalRec): Add `color_layers' field.
* include/freetype/internal/sfnt.h (TT_Load_Colr_Layer_Func,
TT_Blend_Colr_Func): New function types.
(SFNT_Interface): Add `load_colr', `free_colr', `load_colr_layer',
and `colr_blend' fields.
* include/freetype/internal/tttypes.h (TT_FaceRec): Add
`colr_and_cpal' field.
* include/freetype/internal/tttags. (TTAG_COLR, TTAG_CPAL): New
macros.
* src/sfnt/ttcolr.c, src/sfnt/ttcolr.h: New files.
* src/base/ftobjs.c (ft_glyphslot_done, FT_Render_Glyph_Internal):
Handle glyph color layers.
* src/sfnt/Jamfile (_sources), src/sfnt/rules.mk (SFNT_DRV_SRC): Add
`ttcolr.c'.
* src/sfnt/sfdriver.c: Include `ttcolr.h'.
(PUT_COLOR_LAYERS): New macro.
Update call to `FT_DEFINE_SFNT_INTERFACE'.
* src/sfnt/sfnt.c: Include `ttcolr.c'.
* src/sfnt/sfobjs.c (sfnt_load_face): Load `COLR' and `CPAL' tables.
(sfnt_done_face): Updated.
* src/truetype/ttgload.c (TT_Load_Glyph): Handle color layers.
2018-05-13 03:25:09 +02:00
|
|
|
PUT_COLOR_LAYERS( tt_face_load_colr ),
|
|
|
|
/* TT_Load_Table_Func load_colr */
|
2018-06-13 08:46:27 +02:00
|
|
|
PUT_COLOR_LAYERS( tt_face_free_cpal ),
|
|
|
|
/* TT_Free_Table_Func free_cpal */
|
[sfnt] Preliminary support of coloured layer outlines.
This commit enables OpenType's COLR/CPAL table handling; a typical
application are color emojis that can be scaled to any size.
If the color palette does not exist or is invalid, the rendering
step rasterizes the outline instead. The current implementation
assumes that the foreground is black.
Enable this by defining option TT_CONFIG_OPTION_COLOR_LAYERS.
There are still some issues with metrics; additionally, an API to
fetch color layers is missing.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_COLOR_LAYERS): New macro.
* include/freetype/internal/ftobjs.h (FT_Glyph_LayerRec,
FT_Colr_InternalRec): New structures.
(FT_Slot_InternalRec): Add `color_layers' field.
* include/freetype/internal/sfnt.h (TT_Load_Colr_Layer_Func,
TT_Blend_Colr_Func): New function types.
(SFNT_Interface): Add `load_colr', `free_colr', `load_colr_layer',
and `colr_blend' fields.
* include/freetype/internal/tttypes.h (TT_FaceRec): Add
`colr_and_cpal' field.
* include/freetype/internal/tttags. (TTAG_COLR, TTAG_CPAL): New
macros.
* src/sfnt/ttcolr.c, src/sfnt/ttcolr.h: New files.
* src/base/ftobjs.c (ft_glyphslot_done, FT_Render_Glyph_Internal):
Handle glyph color layers.
* src/sfnt/Jamfile (_sources), src/sfnt/rules.mk (SFNT_DRV_SRC): Add
`ttcolr.c'.
* src/sfnt/sfdriver.c: Include `ttcolr.h'.
(PUT_COLOR_LAYERS): New macro.
Update call to `FT_DEFINE_SFNT_INTERFACE'.
* src/sfnt/sfnt.c: Include `ttcolr.c'.
* src/sfnt/sfobjs.c (sfnt_load_face): Load `COLR' and `CPAL' tables.
(sfnt_done_face): Updated.
* src/truetype/ttgload.c (TT_Load_Glyph): Handle color layers.
2018-05-13 03:25:09 +02:00
|
|
|
PUT_COLOR_LAYERS( tt_face_free_colr ),
|
|
|
|
/* TT_Free_Table_Func free_colr */
|
2018-06-12 05:53:58 +02:00
|
|
|
PUT_COLOR_LAYERS( tt_face_palette_set ),
|
|
|
|
/* TT_Set_Palette_Func set_palette */
|
2018-06-14 21:02:49 +02:00
|
|
|
PUT_COLOR_LAYERS( tt_face_get_colr_layer ),
|
|
|
|
/* TT_Get_Colr_Layer_Func get_colr_layer */
|
2020-12-16 16:12:30 +01:00
|
|
|
|
|
|
|
PUT_COLOR_LAYERS_V1( tt_face_get_colr_glyph_paint ),
|
2021-07-28 16:36:57 +02:00
|
|
|
/* TT_Get_Color_Glyph_Paint_Func get_colr_glyph_paint */
|
|
|
|
PUT_COLOR_LAYERS_V1( tt_face_get_color_glyph_clipbox ),
|
|
|
|
/* TT_Get_Color_Glyph_ClipBox_Func get_clipbox */
|
2020-12-16 16:12:30 +01:00
|
|
|
PUT_COLOR_LAYERS_V1( tt_face_get_paint_layers ),
|
2021-07-28 16:36:57 +02:00
|
|
|
/* TT_Get_Paint_Layers_Func get_paint_layers */
|
2020-12-16 16:12:30 +01:00
|
|
|
PUT_COLOR_LAYERS_V1( tt_face_get_colorline_stops ),
|
2021-07-28 16:36:57 +02:00
|
|
|
/* TT_Get_Paint get_paint */
|
2020-12-16 16:12:30 +01:00
|
|
|
PUT_COLOR_LAYERS_V1( tt_face_get_paint ),
|
2021-07-28 16:36:57 +02:00
|
|
|
/* TT_Get_Colorline_Stops_Func get_colorline_stops */
|
2020-12-16 16:12:30 +01:00
|
|
|
|
[sfnt] Preliminary support of coloured layer outlines.
This commit enables OpenType's COLR/CPAL table handling; a typical
application are color emojis that can be scaled to any size.
If the color palette does not exist or is invalid, the rendering
step rasterizes the outline instead. The current implementation
assumes that the foreground is black.
Enable this by defining option TT_CONFIG_OPTION_COLOR_LAYERS.
There are still some issues with metrics; additionally, an API to
fetch color layers is missing.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_OPTION_COLOR_LAYERS): New macro.
* include/freetype/internal/ftobjs.h (FT_Glyph_LayerRec,
FT_Colr_InternalRec): New structures.
(FT_Slot_InternalRec): Add `color_layers' field.
* include/freetype/internal/sfnt.h (TT_Load_Colr_Layer_Func,
TT_Blend_Colr_Func): New function types.
(SFNT_Interface): Add `load_colr', `free_colr', `load_colr_layer',
and `colr_blend' fields.
* include/freetype/internal/tttypes.h (TT_FaceRec): Add
`colr_and_cpal' field.
* include/freetype/internal/tttags. (TTAG_COLR, TTAG_CPAL): New
macros.
* src/sfnt/ttcolr.c, src/sfnt/ttcolr.h: New files.
* src/base/ftobjs.c (ft_glyphslot_done, FT_Render_Glyph_Internal):
Handle glyph color layers.
* src/sfnt/Jamfile (_sources), src/sfnt/rules.mk (SFNT_DRV_SRC): Add
`ttcolr.c'.
* src/sfnt/sfdriver.c: Include `ttcolr.h'.
(PUT_COLOR_LAYERS): New macro.
Update call to `FT_DEFINE_SFNT_INTERFACE'.
* src/sfnt/sfnt.c: Include `ttcolr.c'.
* src/sfnt/sfobjs.c (sfnt_load_face): Load `COLR' and `CPAL' tables.
(sfnt_done_face): Updated.
* src/truetype/ttgload.c (TT_Load_Glyph): Handle color layers.
2018-05-13 03:25:09 +02:00
|
|
|
PUT_COLOR_LAYERS( tt_face_colr_blend_layer ),
|
|
|
|
/* TT_Blend_Colr_Func colr_blend */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2016-08-26 08:42:27 +02:00
|
|
|
tt_face_get_metrics, /* TT_Get_Metrics_Func get_metrics */
|
2015-07-07 14:04:44 +02:00
|
|
|
|
2017-03-05 19:06:41 +01:00
|
|
|
tt_face_get_name, /* TT_Get_Name_Func get_name */
|
2021-12-26 04:20:44 +01:00
|
|
|
sfnt_get_name_id, /* TT_Get_Name_ID_Func get_name_id */
|
|
|
|
|
|
|
|
PUT_SVG_SUPPORT( tt_face_load_svg ),
|
|
|
|
/* TT_Load_Table_Func load_svg */
|
|
|
|
PUT_SVG_SUPPORT( tt_face_free_svg ),
|
|
|
|
/* TT_Free_Table_Func free_svg */
|
|
|
|
PUT_SVG_SUPPORT( tt_face_load_svg_doc )
|
|
|
|
/* TT_Load_Svg_Doc_Func load_svg_doc */
|
Position Independent Code (PIC) support in sfnt driver.
* include/freetype/internal/services/svbdf.h add macros to init
instances of FT_Service_BDFRec.
* include/freetype/internal/services/svgldict.h add macros to init
instances of FT_Service_GlyphDictRec.
* include/freetype/internal/services/svpostnm.h add macros to init
instances of FT_Service_PsFontNameRec.
* include/freetype/internal/services/svsfnt.h add macros to init
instances of FT_Service_SFNT_TableRec.
* include/freetype/internal/services/svttcmap.h add macros to init
instances of FT_Service_TTCMapsRec.
* include/freetype/internal/sfnt.h add macros to init
instances of SFNT_Interface.
* src/sfnt/sfdriver.h declare sfnt_module_class using macros from
ftmodapi.h, when FT_CONFIG_OPTION_PIC is defined create and destroy
functions will be declared.
* src/sfnt/sfdriver.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
sfnt_service_sfnt_table, sfnt_service_glyph_dict, sfnt_service_ps_name
tt_service_get_cmap_info, sfnt_service_bdf, sfnt_interface,
sfnt_module_class, and sfnt_services array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
* src/sfnt/ttcmap.h add macros to init
instances of TT_CMap_ClassRec.
* src/sfnt/ttcmap.c when FT_CONFIG_OPTION_PIC is defined
the following structs:
tt_cmap0_class_rec, tt_cmap2_class_rec, tt_cmap4_class_rec
tt_cmap6_class_rec, tt_cmap8_class_rec, tt_cmap10_class_rec,
tt_cmap12_class_rec, tt_cmap14_class_rec and tt_cmap_classes array
will have functions to init or create and destroy them
instead of being allocated in the global scope.
And macros will be used from sfntpic.h in order to access them
from the pic_container.
The content of tt_cmap_classes is now described in the
new file 'ttcmapc.h'.
New Files:
* src/sfnt/sfntpic.h declare struct to hold PIC globals for sfnt
driver and macros to access them.
* src/sfnt/sfntpic.c implement functions to allocate, destroy and
initialize PIC globals for sfnt driver.
* src/sfnt/ttcmapc.h describing the content of
tt_cmap_classes allocated in ttcmap.c
* src/sfnt/sfnt.c add new file to build: sfntpic.c.
* src/sfnt/jamfile add new files to FT2_MULTI build: sfntpic.c.
2009-04-05 17:08:32 +02:00
|
|
|
)
|
2000-05-17 01:44:38 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_DEFINE_MODULE(
|
|
|
|
sfnt_module_class,
|
2012-01-16 18:00:24 +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
|
|
|
0, /* not a font driver or renderer */
|
2011-11-30 10:46:53 +01:00
|
|
|
sizeof ( FT_ModuleRec ),
|
2000-07-02 02:27:53 +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
|
|
|
"sfnt", /* driver name */
|
2000-06-25 08:47:11 +02:00
|
|
|
0x10000L, /* driver version 1.0 */
|
|
|
|
0x20000L, /* driver requires FreeType 2.0 or higher */
|
2000-07-02 02:27:53 +02:00
|
|
|
|
Remove FT_CONFIG_OPTION_PIC and related code.
*/* [FT_CONFIG_OPTION_PIC]: Remove all code guarded by this
preprocessor symbol.
*/*: Replace `XXX_GET' macros (which could be either a function in
PIC mode or an array in non-PIC mode) with `xxx' arrays.
* include/freetype/internal/ftpic.h, src/autofit/afpic.c,
src/autofit/afpic.h, src/base/basepic.c, src/base/basepic.h,
src/base/ftpic.c, src/cff/cffpic.c, src/cff/cffpic.h,
src/pshinter/pshpic.c, src/pshinter/pshpic.h, src/psnames/pspic.c,
src/psnames/pspic.h, src/raster/rastpic.c, src/raster/rastpic.h,
src/sfnt/sfntpic.c, src/sfnt/sfntpic.h, src/smooth/ftspic.c,
src/smooth/ftspic.h, src/truetype/ttpic.c, src/truetype/ttpic.h:
Removed.
2018-05-02 20:27:48 +02:00
|
|
|
(const void*)&sfnt_interface, /* module specific interface */
|
2000-07-02 02:27:53 +02:00
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
(FT_Module_Constructor)NULL, /* module_init */
|
|
|
|
(FT_Module_Destructor) NULL, /* module_done */
|
|
|
|
(FT_Module_Requester) sfnt_get_interface /* get_interface */
|
|
|
|
)
|
2000-07-02 02:27:53 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
/* END */
|