2018-06-03 09:01:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
*
|
|
|
|
* ttcmap.c
|
|
|
|
*
|
|
|
|
* TrueType character mapping table (cmap) support (body).
|
|
|
|
*
|
2021-01-17 07:18:48 +01:00
|
|
|
* Copyright (C) 2002-2021 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.
|
|
|
|
*
|
|
|
|
*/
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
|
2020-06-08 13:31:55 +02:00
|
|
|
#include <freetype/internal/ftdebug.h>
|
* include/freetype/internal/ftobjs.h: Don't include
FT_CONFIG_STANDARD_LIBRARY_H.
(FT_Validator, FT_VAlidationLevel, FT_ValidatorRec, FT_VALIDATOR,
ft_validator_init, ft_validator_run, ft_validator_error, FT_INVALID,
FT_INVALID_TOO_SHORT, FT_INVALID_OFFSET, FT_INVALID_FORMAT,
FT_INVALID_GLYPH_ID, FT_INVALID_DATA): Move to...
* include/freetype/internal/ftvalid.h: New file.
Make FT_INVALID return module-specific error codes.
* include/freetype/internal/internal.h (FT_INTERNAL_VALIDATE_H): New
macro.
* include/freetype/fterrors.h: Undefine FT_ERR_PREFIX only if
FT_KEEP_ERR_PREFIX isn't defined.
* src/base/ftobjs.c: Include FT_INTERNAL_VALIDATE_H.
* src/sfnt/ttcmap.h: Don't include FT_INTERNAL_OBJECTS_H but
FT_INTERNAL_VALIDATE_H.
* src/sfnt/ttcmap.c: Don't include FT_INTERNAL_OBJECTS_H but
FT_INTERNAL_VALIDATE_H.
Include sferrors.h before FT_INTERNAL_VALIDATE_H.
s/FT_Err_Ok/SFNT_Err_Ok/.
* src/sfnt/sferrors.h: Define FT_KEEP_ERR_PREFIX.
* src/type1/t1afm.c: Include t1errors.h.
2004-09-06 09:06:56 +02:00
|
|
|
|
2020-06-08 13:31:55 +02:00
|
|
|
#include "sferrors.h" /* must come before `ftvalid.h' */
|
* include/freetype/internal/ftobjs.h: Don't include
FT_CONFIG_STANDARD_LIBRARY_H.
(FT_Validator, FT_VAlidationLevel, FT_ValidatorRec, FT_VALIDATOR,
ft_validator_init, ft_validator_run, ft_validator_error, FT_INVALID,
FT_INVALID_TOO_SHORT, FT_INVALID_OFFSET, FT_INVALID_FORMAT,
FT_INVALID_GLYPH_ID, FT_INVALID_DATA): Move to...
* include/freetype/internal/ftvalid.h: New file.
Make FT_INVALID return module-specific error codes.
* include/freetype/internal/internal.h (FT_INTERNAL_VALIDATE_H): New
macro.
* include/freetype/fterrors.h: Undefine FT_ERR_PREFIX only if
FT_KEEP_ERR_PREFIX isn't defined.
* src/base/ftobjs.c: Include FT_INTERNAL_VALIDATE_H.
* src/sfnt/ttcmap.h: Don't include FT_INTERNAL_OBJECTS_H but
FT_INTERNAL_VALIDATE_H.
* src/sfnt/ttcmap.c: Don't include FT_INTERNAL_OBJECTS_H but
FT_INTERNAL_VALIDATE_H.
Include sferrors.h before FT_INTERNAL_VALIDATE_H.
s/FT_Err_Ok/SFNT_Err_Ok/.
* src/sfnt/sferrors.h: Define FT_KEEP_ERR_PREFIX.
* src/type1/t1afm.c: Include t1errors.h.
2004-09-06 09:06:56 +02:00
|
|
|
|
2020-06-08 13:31:55 +02:00
|
|
|
#include <freetype/internal/ftvalid.h>
|
|
|
|
#include <freetype/internal/ftstream.h>
|
|
|
|
#include <freetype/internal/services/svpscmap.h>
|
2002-02-22 19:28:11 +01:00
|
|
|
#include "ttload.h"
|
2004-08-29 18:50:09 +02:00
|
|
|
#include "ttcmap.h"
|
2017-09-12 08:59:18 +02:00
|
|
|
#include "ttpost.h"
|
2002-02-22 19:28:11 +01: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.
|
|
|
|
*/
|
2002-02-22 19:28:11 +01:00
|
|
|
#undef FT_COMPONENT
|
2018-08-15 18:13:17 +02:00
|
|
|
#define FT_COMPONENT ttcmap
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
#define TT_PEEK_SHORT FT_PEEK_SHORT
|
|
|
|
#define TT_PEEK_USHORT FT_PEEK_USHORT
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
#define TT_PEEK_UINT24 FT_PEEK_UOFF3
|
2002-03-31 20:48:24 +02:00
|
|
|
#define TT_PEEK_LONG FT_PEEK_LONG
|
|
|
|
#define TT_PEEK_ULONG FT_PEEK_ULONG
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
#define TT_NEXT_SHORT FT_NEXT_SHORT
|
|
|
|
#define TT_NEXT_USHORT FT_NEXT_USHORT
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
#define TT_NEXT_UINT24 FT_NEXT_UOFF3
|
2002-03-31 20:48:24 +02:00
|
|
|
#define TT_NEXT_LONG FT_NEXT_LONG
|
|
|
|
#define TT_NEXT_ULONG FT_NEXT_ULONG
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-02-28 17:10:29 +01:00
|
|
|
|
2015-09-24 12:39:38 +02:00
|
|
|
/* Too large glyph index return values are caught in `FT_Get_Char_Index' */
|
|
|
|
/* and `FT_Get_Next_Char' (the latter calls the internal `next' function */
|
|
|
|
/* again in this case). To mark character code return values as invalid */
|
|
|
|
/* it is sufficient to set the corresponding glyph index return value to */
|
|
|
|
/* zero. */
|
|
|
|
|
|
|
|
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2002-03-31 20:48:24 +02:00
|
|
|
tt_cmap_init( TT_CMap cmap,
|
|
|
|
FT_Byte* table )
|
2002-02-28 17:10:29 +01:00
|
|
|
{
|
2002-03-22 16:02:38 +01:00
|
|
|
cmap->data = table;
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2002-03-01 03:26:22 +01:00
|
|
|
}
|
2002-02-28 17:10:29 +01:00
|
|
|
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** FORMAT 0 *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2018-06-03 09:01:17 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* TABLE OVERVIEW
|
|
|
|
* --------------
|
|
|
|
*
|
|
|
|
* NAME OFFSET TYPE DESCRIPTION
|
|
|
|
*
|
|
|
|
* format 0 USHORT must be 0
|
|
|
|
* length 2 USHORT table length in bytes
|
|
|
|
* language 4 USHORT Mac language code
|
|
|
|
* glyph_ids 6 BYTE[256] array of glyph indices
|
|
|
|
* 262
|
|
|
|
*/
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
#ifdef TT_CONFIG_CMAP_FORMAT_0
|
|
|
|
|
2005-05-10 00:11:36 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2002-02-22 19:28:11 +01:00
|
|
|
tt_cmap0_validate( FT_Byte* table,
|
|
|
|
FT_Validator valid )
|
|
|
|
{
|
2014-02-26 19:50:18 +01:00
|
|
|
FT_Byte* p;
|
|
|
|
FT_UInt length;
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2014-02-26 19:50:18 +01:00
|
|
|
if ( table + 2 + 2 > valid->limit )
|
|
|
|
FT_INVALID_TOO_SHORT;
|
|
|
|
|
|
|
|
p = table + 2; /* skip format */
|
|
|
|
length = TT_NEXT_USHORT( p );
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
if ( table + length > valid->limit || length < 262 )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_TOO_SHORT;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
/* check glyph indices whenever necessary */
|
|
|
|
if ( valid->level >= FT_VALIDATE_TIGHT )
|
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_UInt n, idx;
|
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-02-27 22:25:47 +01:00
|
|
|
p = table + 6;
|
2002-02-22 19:28:11 +01:00
|
|
|
for ( n = 0; n < 256; n++ )
|
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
idx = *p++;
|
|
|
|
if ( idx >= TT_VALID_GLYPH_COUNT( valid ) )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_GLYPH_ID;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
}
|
2005-05-10 00:11:36 +02:00
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_CALLBACK_DEF( FT_UInt )
|
2002-03-01 03:26:22 +01:00
|
|
|
tt_cmap0_char_index( TT_CMap cmap,
|
|
|
|
FT_UInt32 char_code )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_Byte* table = cmap->data;
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
|
|
|
return char_code < 256 ? table[6 + char_code] : 0;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-31 17:32:09 +02:00
|
|
|
FT_CALLBACK_DEF( FT_UInt32 )
|
2002-03-31 20:48:24 +02:00
|
|
|
tt_cmap0_char_next( TT_CMap cmap,
|
|
|
|
FT_UInt32 *pchar_code )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_Byte* table = cmap->data;
|
|
|
|
FT_UInt32 charcode = *pchar_code;
|
|
|
|
FT_UInt32 result = 0;
|
|
|
|
FT_UInt gindex = 0;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2008-07-22 22:59:59 +02:00
|
|
|
table += 6; /* go to glyph IDs */
|
2002-03-22 16:02:38 +01:00
|
|
|
while ( ++charcode < 256 )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2002-03-22 16:02:38 +01:00
|
|
|
gindex = table[charcode];
|
2002-02-22 19:28:11 +01:00
|
|
|
if ( gindex != 0 )
|
|
|
|
{
|
2002-03-22 16:02:38 +01:00
|
|
|
result = charcode;
|
2002-02-22 19:28:11 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-03-22 16:02:38 +01:00
|
|
|
*pchar_code = result;
|
|
|
|
return gindex;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
|
2002-02-28 17:10:29 +01:00
|
|
|
|
2003-12-17 15:28:22 +01:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
|
|
tt_cmap0_get_info( TT_CMap cmap,
|
|
|
|
TT_CMapInfo *cmap_info )
|
|
|
|
{
|
|
|
|
FT_Byte* p = cmap->data + 4;
|
|
|
|
|
|
|
|
|
2009-04-04 07:42:38 +02:00
|
|
|
cmap_info->format = 0;
|
2003-12-17 15:28:22 +01:00
|
|
|
cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
|
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2003-12-17 15:28:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_DEFINE_TT_CMAP(
|
|
|
|
tt_cmap0_class_rec,
|
2002-03-01 03:26:22 +01:00
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
sizeof ( TT_CMapRec ),
|
2012-08-24 13:41:24 +02:00
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
(FT_CMap_InitFunc) tt_cmap_init, /* init */
|
|
|
|
(FT_CMap_DoneFunc) NULL, /* done */
|
|
|
|
(FT_CMap_CharIndexFunc)tt_cmap0_char_index, /* char_index */
|
|
|
|
(FT_CMap_CharNextFunc) tt_cmap0_char_next, /* char_next */
|
|
|
|
|
|
|
|
(FT_CMap_CharVarIndexFunc) NULL, /* char_var_index */
|
|
|
|
(FT_CMap_CharVarIsDefaultFunc)NULL, /* char_var_default */
|
|
|
|
(FT_CMap_VariantListFunc) NULL, /* variant_list */
|
|
|
|
(FT_CMap_CharVariantListFunc) NULL, /* charvariant_list */
|
|
|
|
(FT_CMap_VariantCharListFunc) NULL, /* variantchar_list */
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
0,
|
2016-09-17 17:12:50 +02:00
|
|
|
(TT_CMap_ValidateFunc)tt_cmap0_validate, /* validate */
|
|
|
|
(TT_CMap_Info_GetFunc)tt_cmap0_get_info /* get_cmap_info */
|
|
|
|
)
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
#endif /* TT_CONFIG_CMAP_FORMAT_0 */
|
|
|
|
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** FORMAT 2 *****/
|
|
|
|
/***** *****/
|
|
|
|
/***** This is used for certain CJK encodings that encode text in a *****/
|
2015-09-24 12:14:38 +02:00
|
|
|
/***** mixed 8/16 bits encoding along the following lines. *****/
|
2002-03-31 20:48:24 +02:00
|
|
|
/***** *****/
|
|
|
|
/***** * Certain byte values correspond to an 8-bit character code *****/
|
|
|
|
/***** (typically in the range 0..127 for ASCII compatibility). *****/
|
|
|
|
/***** *****/
|
|
|
|
/***** * Certain byte values signal the first byte of a 2-byte *****/
|
|
|
|
/***** character code (but these values are also valid as the *****/
|
|
|
|
/***** second byte of a 2-byte character). *****/
|
|
|
|
/***** *****/
|
|
|
|
/***** The following charmap lookup and iteration functions all *****/
|
2015-09-24 12:14:38 +02:00
|
|
|
/***** assume that the value `charcode' fulfills the following. *****/
|
2002-03-31 20:48:24 +02:00
|
|
|
/***** *****/
|
2018-03-13 11:11:16 +01:00
|
|
|
/***** - For one-byte characters, `charcode' is simply the *****/
|
2002-03-31 20:48:24 +02:00
|
|
|
/***** character code. *****/
|
|
|
|
/***** *****/
|
2018-03-13 11:11:16 +01:00
|
|
|
/***** - For two-byte characters, `charcode' is the 2-byte *****/
|
2015-09-24 12:14:38 +02:00
|
|
|
/***** character code in big endian format. More precisely: *****/
|
2002-03-31 20:48:24 +02:00
|
|
|
/***** *****/
|
|
|
|
/***** (charcode >> 8) is the first byte value *****/
|
|
|
|
/***** (charcode & 0xFF) is the second byte value *****/
|
|
|
|
/***** *****/
|
2015-09-24 12:14:38 +02:00
|
|
|
/***** Note that not all values of `charcode' are valid according *****/
|
|
|
|
/***** to these rules, and the function moderately checks the *****/
|
2002-03-31 20:48:24 +02:00
|
|
|
/***** arguments. *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2018-06-03 09:01:17 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* TABLE OVERVIEW
|
|
|
|
* --------------
|
|
|
|
*
|
|
|
|
* NAME OFFSET TYPE DESCRIPTION
|
|
|
|
*
|
|
|
|
* format 0 USHORT must be 2
|
|
|
|
* length 2 USHORT table length in bytes
|
|
|
|
* language 4 USHORT Mac language code
|
|
|
|
* keys 6 USHORT[256] sub-header keys
|
|
|
|
* subs 518 SUBHEAD[NSUBS] sub-headers array
|
|
|
|
* glyph_ids 518+NSUB*8 USHORT[] glyph ID array
|
|
|
|
*
|
|
|
|
* The `keys' table is used to map charcode high bytes to sub-headers.
|
|
|
|
* The value of `NSUBS' is the number of sub-headers defined in the
|
|
|
|
* table and is computed by finding the maximum of the `keys' table.
|
|
|
|
*
|
|
|
|
* Note that for any `n', `keys[n]' is a byte offset within the `subs'
|
|
|
|
* table, i.e., it is the corresponding sub-header index multiplied
|
|
|
|
* by 8.
|
|
|
|
*
|
|
|
|
* Each sub-header has the following format.
|
|
|
|
*
|
|
|
|
* NAME OFFSET TYPE DESCRIPTION
|
|
|
|
*
|
|
|
|
* first 0 USHORT first valid low-byte
|
|
|
|
* count 2 USHORT number of valid low-bytes
|
|
|
|
* delta 4 SHORT see below
|
|
|
|
* offset 6 USHORT see below
|
|
|
|
*
|
|
|
|
* A sub-header defines, for each high byte, the range of valid
|
|
|
|
* low bytes within the charmap. Note that the range defined by `first'
|
|
|
|
* and `count' must be completely included in the interval [0..255]
|
|
|
|
* according to the specification.
|
|
|
|
*
|
|
|
|
* If a character code is contained within a given sub-header, then
|
|
|
|
* mapping it to a glyph index is done as follows.
|
|
|
|
*
|
|
|
|
* - The value of `offset' is read. This is a _byte_ distance from the
|
|
|
|
* location of the `offset' field itself into a slice of the
|
|
|
|
* `glyph_ids' table. Let's call it `slice' (it is a USHORT[], too).
|
|
|
|
*
|
|
|
|
* - The value `slice[char.lo - first]' is read. If it is 0, there is
|
|
|
|
* no glyph for the charcode. Otherwise, the value of `delta' is
|
|
|
|
* added to it (modulo 65536) to form a new glyph index.
|
|
|
|
*
|
|
|
|
* It is up to the validation routine to check that all offsets fall
|
|
|
|
* within the glyph IDs table (and not within the `subs' table itself or
|
|
|
|
* outside of the CMap).
|
|
|
|
*/
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
#ifdef TT_CONFIG_CMAP_FORMAT_2
|
|
|
|
|
2005-05-10 00:11:36 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2002-02-22 19:28:11 +01:00
|
|
|
tt_cmap2_validate( FT_Byte* table,
|
|
|
|
FT_Validator valid )
|
|
|
|
{
|
2014-02-26 19:50:18 +01:00
|
|
|
FT_Byte* p;
|
|
|
|
FT_UInt length;
|
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
FT_UInt n, max_subs;
|
2014-02-26 19:50:18 +01:00
|
|
|
FT_Byte* keys; /* keys table */
|
|
|
|
FT_Byte* subs; /* sub-headers */
|
|
|
|
FT_Byte* glyph_ids; /* glyph ID array */
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
|
2014-02-26 19:50:18 +01:00
|
|
|
if ( table + 2 + 2 > valid->limit )
|
|
|
|
FT_INVALID_TOO_SHORT;
|
|
|
|
|
|
|
|
p = table + 2; /* skip format */
|
|
|
|
length = TT_NEXT_USHORT( p );
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
if ( table + length > valid->limit || length < 6 + 512 )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_TOO_SHORT;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
keys = table + 6;
|
|
|
|
|
|
|
|
/* parse keys to compute sub-headers count */
|
2002-03-22 16:02:38 +01:00
|
|
|
p = keys;
|
|
|
|
max_subs = 0;
|
2002-02-22 19:28:11 +01:00
|
|
|
for ( n = 0; n < 256; n++ )
|
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_UInt idx = TT_NEXT_USHORT( p );
|
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
/* value must be multiple of 8 */
|
2002-03-31 20:48:24 +02:00
|
|
|
if ( valid->level >= FT_VALIDATE_PARANOID && ( idx & 7 ) != 0 )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_DATA;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
idx >>= 3;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
if ( idx > max_subs )
|
|
|
|
max_subs = idx;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
|
2002-02-27 22:25:47 +01:00
|
|
|
FT_ASSERT( p == table + 518 );
|
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
subs = p;
|
2015-09-24 12:14:38 +02:00
|
|
|
glyph_ids = subs + ( max_subs + 1 ) * 8;
|
2002-02-22 19:28:11 +01:00
|
|
|
if ( glyph_ids > valid->limit )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_TOO_SHORT;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
/* parse sub-headers */
|
|
|
|
for ( n = 0; n <= max_subs; n++ )
|
|
|
|
{
|
2013-08-01 12:20:20 +02:00
|
|
|
FT_UInt first_code, code_count, offset;
|
|
|
|
FT_Int delta;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
first_code = TT_NEXT_USHORT( p );
|
|
|
|
code_count = TT_NEXT_USHORT( p );
|
|
|
|
delta = TT_NEXT_SHORT( p );
|
|
|
|
offset = TT_NEXT_USHORT( p );
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2008-08-19 06:53:02 +02:00
|
|
|
/* many Dynalab fonts have empty sub-headers */
|
|
|
|
if ( code_count == 0 )
|
2008-08-18 06:44:56 +02:00
|
|
|
continue;
|
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
/* check range within 0..255 */
|
|
|
|
if ( valid->level >= FT_VALIDATE_PARANOID )
|
|
|
|
{
|
2018-03-13 11:11:16 +01:00
|
|
|
if ( first_code >= 256 || code_count > 256 - first_code )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_DATA;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* check offset */
|
|
|
|
if ( offset != 0 )
|
|
|
|
{
|
2013-08-01 12:20:20 +02:00
|
|
|
FT_Byte* ids;
|
|
|
|
|
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
ids = p - 2 + offset;
|
2015-02-22 12:03:28 +01:00
|
|
|
if ( ids < glyph_ids || ids + code_count * 2 > table + length )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_OFFSET;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2008-07-22 22:59:59 +02:00
|
|
|
/* check glyph IDs */
|
2002-02-22 19:28:11 +01:00
|
|
|
if ( valid->level >= FT_VALIDATE_TIGHT )
|
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_Byte* limit = p + code_count * 2;
|
|
|
|
FT_UInt idx;
|
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
for ( ; p < limit; )
|
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
idx = TT_NEXT_USHORT( p );
|
|
|
|
if ( idx != 0 )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2015-02-22 12:03:28 +01:00
|
|
|
idx = (FT_UInt)( (FT_Int)idx + delta ) & 0xFFFFU;
|
2002-03-31 20:48:24 +02:00
|
|
|
if ( idx >= TT_VALID_GLYPH_COUNT( valid ) )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_GLYPH_ID;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-05-10 00:11:36 +02:00
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* return sub header corresponding to a given character code */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* NULL on invalid charcode */
|
2002-02-22 19:28:11 +01:00
|
|
|
static FT_Byte*
|
2002-03-01 03:26:22 +01:00
|
|
|
tt_cmap2_get_subheader( FT_Byte* table,
|
|
|
|
FT_UInt32 char_code )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
|
|
|
FT_Byte* result = NULL;
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
|
|
|
if ( char_code < 0x10000UL )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_UInt char_lo = (FT_UInt)( char_code & 0xFF );
|
|
|
|
FT_UInt char_hi = (FT_UInt)( char_code >> 8 );
|
2018-03-13 11:11:16 +01:00
|
|
|
FT_Byte* p = table + 6; /* keys table */
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_Byte* subs = table + 518; /* subheaders table */
|
|
|
|
FT_Byte* sub;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
|
|
|
|
if ( char_hi == 0 )
|
|
|
|
{
|
|
|
|
/* an 8-bit character code -- we use subHeader 0 in this case */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* to test whether the character code is in the charmap */
|
2002-02-22 19:28:11 +01:00
|
|
|
/* */
|
|
|
|
sub = subs; /* jump to first sub-header */
|
|
|
|
|
|
|
|
/* check that the sub-header for this byte is 0, which */
|
2018-03-13 11:11:16 +01:00
|
|
|
/* indicates that it is really a valid one-byte value; */
|
|
|
|
/* otherwise, return 0 */
|
2002-02-22 19:28:11 +01:00
|
|
|
/* */
|
2002-03-31 20:48:24 +02:00
|
|
|
p += char_lo * 2;
|
|
|
|
if ( TT_PEEK_USHORT( p ) != 0 )
|
2002-02-22 19:28:11 +01:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* a 16-bit character code */
|
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
/* jump to key entry */
|
|
|
|
p += char_hi * 2;
|
|
|
|
/* jump to sub-header */
|
|
|
|
sub = subs + ( FT_PAD_FLOOR( TT_PEEK_USHORT( p ), 8 ) );
|
|
|
|
|
|
|
|
/* check that the high byte isn't a valid one-byte value */
|
2002-02-22 19:28:11 +01:00
|
|
|
if ( sub == subs )
|
|
|
|
goto Exit;
|
|
|
|
}
|
2018-03-13 11:11:16 +01:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
result = sub;
|
|
|
|
}
|
2015-09-24 12:14:38 +02:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
Exit:
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_CALLBACK_DEF( FT_UInt )
|
2002-03-01 03:26:22 +01:00
|
|
|
tt_cmap2_char_index( TT_CMap cmap,
|
|
|
|
FT_UInt32 char_code )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_Byte* table = cmap->data;
|
2002-02-22 19:28:11 +01:00
|
|
|
FT_UInt result = 0;
|
|
|
|
FT_Byte* subheader;
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
subheader = tt_cmap2_get_subheader( table, char_code );
|
|
|
|
if ( subheader )
|
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_Byte* p = subheader;
|
|
|
|
FT_UInt idx = (FT_UInt)(char_code & 0xFF);
|
2002-02-22 19:28:11 +01:00
|
|
|
FT_UInt start, count;
|
|
|
|
FT_Int delta;
|
|
|
|
FT_UInt offset;
|
|
|
|
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
start = TT_NEXT_USHORT( p );
|
|
|
|
count = TT_NEXT_USHORT( p );
|
|
|
|
delta = TT_NEXT_SHORT ( p );
|
|
|
|
offset = TT_PEEK_USHORT( p );
|
|
|
|
|
|
|
|
idx -= start;
|
|
|
|
if ( idx < count && offset != 0 )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
p += offset + 2 * idx;
|
|
|
|
idx = TT_PEEK_USHORT( p );
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
if ( idx != 0 )
|
2015-02-22 12:03:28 +01:00
|
|
|
result = (FT_UInt)( (FT_Int)idx + delta ) & 0xFFFFU;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
}
|
2015-09-24 12:14:38 +02:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-31 17:32:09 +02:00
|
|
|
FT_CALLBACK_DEF( FT_UInt32 )
|
2002-03-22 16:02:38 +01:00
|
|
|
tt_cmap2_char_next( TT_CMap cmap,
|
|
|
|
FT_UInt32 *pcharcode )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_Byte* table = cmap->data;
|
|
|
|
FT_UInt gindex = 0;
|
|
|
|
FT_UInt32 result = 0;
|
|
|
|
FT_UInt32 charcode = *pcharcode + 1;
|
|
|
|
FT_Byte* subheader;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
|
|
|
while ( charcode < 0x10000UL )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2002-03-22 16:02:38 +01:00
|
|
|
subheader = tt_cmap2_get_subheader( table, charcode );
|
2002-02-22 19:28:11 +01:00
|
|
|
if ( subheader )
|
|
|
|
{
|
|
|
|
FT_Byte* p = subheader;
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_UInt start = TT_NEXT_USHORT( p );
|
|
|
|
FT_UInt count = TT_NEXT_USHORT( p );
|
|
|
|
FT_Int delta = TT_NEXT_SHORT ( p );
|
|
|
|
FT_UInt offset = TT_PEEK_USHORT( p );
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_UInt char_lo = (FT_UInt)( charcode & 0xFF );
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_UInt pos, idx;
|
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2018-04-26 09:04:39 +02:00
|
|
|
if ( char_lo >= start + count && charcode <= 0xFF )
|
2018-04-19 14:45:19 +02:00
|
|
|
{
|
|
|
|
/* this happens only for a malformed cmap */
|
|
|
|
charcode = 0x100;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
if ( offset == 0 )
|
2017-12-31 10:32:08 +01:00
|
|
|
{
|
|
|
|
if ( charcode == 0x100 )
|
|
|
|
goto Exit; /* this happens only for a malformed cmap */
|
2002-03-22 16:02:38 +01:00
|
|
|
goto Next_SubHeader;
|
2017-12-31 10:32:08 +01:00
|
|
|
}
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
if ( char_lo < start )
|
|
|
|
{
|
|
|
|
char_lo = start;
|
|
|
|
pos = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pos = (FT_UInt)( char_lo - start );
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
p += offset + pos * 2;
|
2003-12-24 02:10:46 +01:00
|
|
|
charcode = FT_PAD_FLOOR( charcode, 256 ) + char_lo;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-22 16:02:38 +01:00
|
|
|
for ( ; pos < count; pos++, charcode++ )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
idx = TT_NEXT_USHORT( p );
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
if ( idx != 0 )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2015-02-22 12:03:28 +01:00
|
|
|
gindex = (FT_UInt)( (FT_Int)idx + delta ) & 0xFFFFU;
|
2002-02-22 19:28:11 +01:00
|
|
|
if ( gindex != 0 )
|
|
|
|
{
|
2002-03-22 16:02:38 +01:00
|
|
|
result = charcode;
|
2002-02-22 19:28:11 +01:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-03-13 11:09:44 +01:00
|
|
|
|
|
|
|
/* if unsuccessful, avoid `charcode' leaving */
|
|
|
|
/* the current 256-character block */
|
|
|
|
if ( count )
|
|
|
|
charcode--;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
|
2018-03-13 11:09:44 +01:00
|
|
|
/* If `charcode' is <= 0xFF, retry with `charcode + 1'. */
|
|
|
|
/* Otherwise jump to the next 256-character block and retry. */
|
2002-02-22 19:28:11 +01:00
|
|
|
Next_SubHeader:
|
2017-12-18 23:32:32 +01:00
|
|
|
if ( charcode <= 0xFF )
|
|
|
|
charcode++;
|
|
|
|
else
|
|
|
|
charcode = FT_PAD_FLOOR( charcode, 0x100 ) + 0x100;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Exit:
|
2002-03-22 16:02:38 +01:00
|
|
|
*pcharcode = result;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-22 16:02:38 +01:00
|
|
|
return gindex;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2003-12-17 15:28:22 +01:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
|
|
tt_cmap2_get_info( TT_CMap cmap,
|
|
|
|
TT_CMapInfo *cmap_info )
|
|
|
|
{
|
|
|
|
FT_Byte* p = cmap->data + 4;
|
|
|
|
|
|
|
|
|
2009-04-04 07:42:38 +02:00
|
|
|
cmap_info->format = 2;
|
2003-12-17 15:28:22 +01:00
|
|
|
cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
|
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2003-12-17 15:28:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_DEFINE_TT_CMAP(
|
|
|
|
tt_cmap2_class_rec,
|
2002-03-01 03:26:22 +01:00
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
sizeof ( TT_CMapRec ),
|
|
|
|
|
|
|
|
(FT_CMap_InitFunc) tt_cmap_init, /* init */
|
|
|
|
(FT_CMap_DoneFunc) NULL, /* done */
|
|
|
|
(FT_CMap_CharIndexFunc)tt_cmap2_char_index, /* char_index */
|
|
|
|
(FT_CMap_CharNextFunc) tt_cmap2_char_next, /* char_next */
|
2012-08-24 13:41:24 +02:00
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
(FT_CMap_CharVarIndexFunc) NULL, /* char_var_index */
|
|
|
|
(FT_CMap_CharVarIsDefaultFunc)NULL, /* char_var_default */
|
|
|
|
(FT_CMap_VariantListFunc) NULL, /* variant_list */
|
|
|
|
(FT_CMap_CharVariantListFunc) NULL, /* charvariant_list */
|
|
|
|
(FT_CMap_VariantCharListFunc) NULL, /* variantchar_list */
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
2,
|
2016-09-17 17:12:50 +02:00
|
|
|
(TT_CMap_ValidateFunc)tt_cmap2_validate, /* validate */
|
|
|
|
(TT_CMap_Info_GetFunc)tt_cmap2_get_info /* get_cmap_info */
|
|
|
|
)
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
#endif /* TT_CONFIG_CMAP_FORMAT_2 */
|
|
|
|
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** FORMAT 4 *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2018-06-03 09:01:17 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* TABLE OVERVIEW
|
|
|
|
* --------------
|
|
|
|
*
|
|
|
|
* NAME OFFSET TYPE DESCRIPTION
|
|
|
|
*
|
|
|
|
* format 0 USHORT must be 4
|
|
|
|
* length 2 USHORT table length
|
|
|
|
* in bytes
|
|
|
|
* language 4 USHORT Mac language code
|
|
|
|
*
|
|
|
|
* segCountX2 6 USHORT 2*NUM_SEGS
|
|
|
|
* searchRange 8 USHORT 2*(1 << LOG_SEGS)
|
|
|
|
* entrySelector 10 USHORT LOG_SEGS
|
|
|
|
* rangeShift 12 USHORT segCountX2 -
|
|
|
|
* searchRange
|
|
|
|
*
|
|
|
|
* endCount 14 USHORT[NUM_SEGS] end charcode for
|
|
|
|
* each segment; last
|
|
|
|
* is 0xFFFF
|
|
|
|
*
|
|
|
|
* pad 14+NUM_SEGS*2 USHORT padding
|
|
|
|
*
|
|
|
|
* startCount 16+NUM_SEGS*2 USHORT[NUM_SEGS] first charcode for
|
|
|
|
* each segment
|
|
|
|
*
|
|
|
|
* idDelta 16+NUM_SEGS*4 SHORT[NUM_SEGS] delta for each
|
|
|
|
* segment
|
|
|
|
* idOffset 16+NUM_SEGS*6 SHORT[NUM_SEGS] range offset for
|
|
|
|
* each segment; can be
|
|
|
|
* zero
|
|
|
|
*
|
|
|
|
* glyphIds 16+NUM_SEGS*8 USHORT[] array of glyph ID
|
|
|
|
* ranges
|
|
|
|
*
|
|
|
|
* Character codes are modelled by a series of ordered (increasing)
|
|
|
|
* intervals called segments. Each segment has start and end codes,
|
|
|
|
* provided by the `startCount' and `endCount' arrays. Segments must
|
|
|
|
* not overlap, and the last segment should always contain the value
|
|
|
|
* 0xFFFF for `endCount'.
|
|
|
|
*
|
|
|
|
* The fields `searchRange', `entrySelector' and `rangeShift' are better
|
|
|
|
* ignored (they are traces of over-engineering in the TrueType
|
|
|
|
* specification).
|
|
|
|
*
|
|
|
|
* Each segment also has a signed `delta', as well as an optional offset
|
|
|
|
* within the `glyphIds' table.
|
|
|
|
*
|
|
|
|
* If a segment's idOffset is 0, the glyph index corresponding to any
|
|
|
|
* charcode within the segment is obtained by adding the value of
|
|
|
|
* `idDelta' directly to the charcode, modulo 65536.
|
|
|
|
*
|
|
|
|
* Otherwise, a glyph index is taken from the glyph IDs sub-array for
|
|
|
|
* the segment, and the value of `idDelta' is added to it.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Finally, note that a lot of fonts contain an invalid last segment,
|
|
|
|
* where `start' and `end' are correctly set to 0xFFFF but both `delta'
|
|
|
|
* and `offset' are incorrect (e.g., `opens___.ttf' which comes with
|
|
|
|
* OpenOffice.org). We need special code to deal with them correctly.
|
|
|
|
*/
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
#ifdef TT_CONFIG_CMAP_FORMAT_4
|
|
|
|
|
2005-05-10 00:11:36 +02:00
|
|
|
typedef struct TT_CMap4Rec_
|
2005-02-28 18:17:47 +01:00
|
|
|
{
|
2005-03-01 03:13:50 +01:00
|
|
|
TT_CMapRec cmap;
|
|
|
|
FT_UInt32 cur_charcode; /* current charcode */
|
|
|
|
FT_UInt cur_gindex; /* current glyph index */
|
|
|
|
|
|
|
|
FT_UInt num_ranges;
|
|
|
|
FT_UInt cur_range;
|
|
|
|
FT_UInt cur_start;
|
|
|
|
FT_UInt cur_end;
|
|
|
|
FT_Int cur_delta;
|
|
|
|
FT_Byte* cur_values;
|
2005-02-28 18:17:47 +01:00
|
|
|
|
|
|
|
} TT_CMap4Rec, *TT_CMap4;
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
|
|
tt_cmap4_init( TT_CMap4 cmap,
|
|
|
|
FT_Byte* table )
|
|
|
|
{
|
2005-03-01 03:13:50 +01:00
|
|
|
FT_Byte* p;
|
|
|
|
|
2005-02-28 18:17:47 +01:00
|
|
|
|
2005-05-10 00:11:36 +02:00
|
|
|
cmap->cmap.data = table;
|
2005-02-28 18:17:47 +01:00
|
|
|
|
|
|
|
p = table + 6;
|
2005-03-01 03:13:50 +01:00
|
|
|
cmap->num_ranges = FT_PEEK_USHORT( p ) >> 1;
|
2009-07-31 17:32:13 +02:00
|
|
|
cmap->cur_charcode = (FT_UInt32)0xFFFFFFFFUL;
|
2005-02-28 18:17:47 +01:00
|
|
|
cmap->cur_gindex = 0;
|
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2005-02-28 18:17:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static FT_Int
|
|
|
|
tt_cmap4_set_range( TT_CMap4 cmap,
|
|
|
|
FT_UInt range_index )
|
|
|
|
{
|
|
|
|
FT_Byte* table = cmap->cmap.data;
|
|
|
|
FT_Byte* p;
|
|
|
|
FT_UInt num_ranges = cmap->num_ranges;
|
|
|
|
|
2005-03-01 03:13:50 +01:00
|
|
|
|
2005-02-28 18:17:47 +01:00
|
|
|
while ( range_index < num_ranges )
|
|
|
|
{
|
|
|
|
FT_UInt offset;
|
|
|
|
|
|
|
|
|
2005-03-01 03:13:50 +01:00
|
|
|
p = table + 14 + range_index * 2;
|
|
|
|
cmap->cur_end = FT_PEEK_USHORT( p );
|
|
|
|
|
|
|
|
p += 2 + num_ranges * 2;
|
|
|
|
cmap->cur_start = FT_PEEK_USHORT( p );
|
2005-02-28 18:17:47 +01:00
|
|
|
|
2005-03-01 03:13:50 +01:00
|
|
|
p += num_ranges * 2;
|
|
|
|
cmap->cur_delta = FT_PEEK_SHORT( p );
|
2005-02-28 18:17:47 +01:00
|
|
|
|
2005-03-01 03:13:50 +01:00
|
|
|
p += num_ranges * 2;
|
* include/freetype/ftimage.h (FT_Raster_RenderFunc),
include/freetype/ftrender.h (FT_Glyph_TransformFunc,
FT_Renderer_Render_Func, FT_Renderer_TransformFunc),
src/base/ftglyph.c (ft_outline_glyph_transform),
src/raster/ftrend1.c (ft_raster1_transform, ft_raster1_render),
src/smooth/ftgrays.c (FT_Outline_Decompose, gray_raster_render),
src/smooth/ftsmooth.c (ft_smooth_transform,
ft_smooth_render_generic, ft_smooth_render, ft_smooth_render_lcd,
ft_smooth_render_lcd_v): Decorate parameters with `const' where
appropriate.
* src/raster/ftraster.c (RASTER_RENDER_POOL): Removed. Obsolete.
(ft_black_render): Decorate parameters with `const' where
appropriate.
* src/sfnt/ttcmap.c (tt_cmap4_set_range): Fix typo (FT_PEEK_SHORT ->
FT_PEEK_USHORT) which caused crashes. Reported by Ismail Donmez
<ismail@kde.org.tr>.
2005-05-11 22:04:35 +02:00
|
|
|
offset = FT_PEEK_USHORT( p );
|
2005-02-28 18:17:47 +01:00
|
|
|
|
2009-03-11 07:47:49 +01:00
|
|
|
/* some fonts have an incorrect last segment; */
|
|
|
|
/* we have to catch it */
|
2009-01-18 14:13:17 +01:00
|
|
|
if ( range_index >= num_ranges - 1 &&
|
|
|
|
cmap->cur_start == 0xFFFFU &&
|
2009-03-11 07:47:49 +01:00
|
|
|
cmap->cur_end == 0xFFFFU )
|
|
|
|
{
|
|
|
|
TT_Face face = (TT_Face)cmap->cmap.cmap.charmap.face;
|
|
|
|
FT_Byte* limit = face->cmap_table + face->cmap_size;
|
|
|
|
|
|
|
|
|
|
|
|
if ( offset && p + offset + 2 > limit )
|
|
|
|
{
|
|
|
|
cmap->cur_delta = 1;
|
|
|
|
offset = 0;
|
|
|
|
}
|
|
|
|
}
|
2009-01-18 14:13:17 +01:00
|
|
|
|
2005-03-01 03:13:50 +01:00
|
|
|
if ( offset != 0xFFFFU )
|
2005-02-28 18:17:47 +01:00
|
|
|
{
|
|
|
|
cmap->cur_values = offset ? p + offset : NULL;
|
|
|
|
cmap->cur_range = range_index;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* we skip empty segments */
|
|
|
|
range_index++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-30 19:47:49 +01:00
|
|
|
/* search the index of the charcode next to cmap->cur_charcode; */
|
|
|
|
/* caller should call tt_cmap4_set_range with proper range */
|
|
|
|
/* before calling this function */
|
|
|
|
/* */
|
2005-02-28 18:17:47 +01:00
|
|
|
static void
|
|
|
|
tt_cmap4_next( TT_CMap4 cmap )
|
|
|
|
{
|
2016-08-25 17:12:46 +02:00
|
|
|
TT_Face face = (TT_Face)cmap->cmap.cmap.charmap.face;
|
|
|
|
FT_Byte* limit = face->cmap_table + face->cmap_size;
|
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
FT_UInt charcode;
|
2007-01-16 07:11:27 +01:00
|
|
|
|
2005-02-28 18:17:47 +01:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
if ( cmap->cur_charcode >= 0xFFFFUL )
|
|
|
|
goto Fail;
|
|
|
|
|
2009-07-31 17:32:09 +02:00
|
|
|
charcode = (FT_UInt)cmap->cur_charcode + 1;
|
2005-03-01 03:13:50 +01:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
if ( charcode < cmap->cur_start )
|
|
|
|
charcode = cmap->cur_start;
|
2005-02-28 18:17:47 +01:00
|
|
|
|
2015-10-31 19:08:27 +01:00
|
|
|
for (;;)
|
2005-02-28 18:17:47 +01:00
|
|
|
{
|
2005-03-01 03:13:50 +01:00
|
|
|
FT_Byte* values = cmap->cur_values;
|
|
|
|
FT_UInt end = cmap->cur_end;
|
|
|
|
FT_Int delta = cmap->cur_delta;
|
|
|
|
|
2005-02-28 18:17:47 +01:00
|
|
|
|
|
|
|
if ( charcode <= end )
|
|
|
|
{
|
|
|
|
if ( values )
|
|
|
|
{
|
2005-03-01 03:13:50 +01:00
|
|
|
FT_Byte* p = values + 2 * ( charcode - cmap->cur_start );
|
|
|
|
|
2005-02-28 18:17:47 +01:00
|
|
|
|
2016-08-25 17:12:46 +02:00
|
|
|
/* if p > limit, the whole segment is invalid */
|
|
|
|
if ( p > limit )
|
|
|
|
goto Next_Segment;
|
|
|
|
|
2005-02-28 18:17:47 +01:00
|
|
|
do
|
|
|
|
{
|
2005-03-01 03:13:50 +01:00
|
|
|
FT_UInt gindex = FT_NEXT_USHORT( p );
|
|
|
|
|
2005-02-28 18:17:47 +01:00
|
|
|
|
2016-08-25 17:12:46 +02:00
|
|
|
if ( gindex )
|
2005-02-28 18:17:47 +01:00
|
|
|
{
|
2015-02-22 12:03:28 +01:00
|
|
|
gindex = (FT_UInt)( (FT_Int)gindex + delta ) & 0xFFFFU;
|
2016-08-25 17:12:46 +02:00
|
|
|
if ( gindex )
|
2005-02-28 18:17:47 +01:00
|
|
|
{
|
|
|
|
cmap->cur_charcode = charcode;
|
|
|
|
cmap->cur_gindex = gindex;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2005-03-01 03:13:50 +01:00
|
|
|
} while ( ++charcode <= end );
|
2005-02-28 18:17:47 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
2015-02-22 12:03:28 +01:00
|
|
|
FT_UInt gindex = (FT_UInt)( (FT_Int)charcode + delta ) & 0xFFFFU;
|
2005-03-01 03:13:50 +01:00
|
|
|
|
2005-02-28 18:17:47 +01:00
|
|
|
|
2016-08-25 17:12:46 +02:00
|
|
|
if ( gindex >= (FT_UInt)face->root.num_glyphs )
|
|
|
|
{
|
|
|
|
/* we have an invalid glyph index; if there is an overflow, */
|
|
|
|
/* we can adjust `charcode', otherwise the whole segment is */
|
|
|
|
/* invalid */
|
|
|
|
gindex = 0;
|
|
|
|
|
|
|
|
if ( (FT_Int)charcode + delta < 0 &&
|
|
|
|
(FT_Int)end + delta >= 0 )
|
|
|
|
charcode = (FT_UInt)( -delta );
|
|
|
|
|
|
|
|
else if ( (FT_Int)charcode + delta < 0x10000L &&
|
|
|
|
(FT_Int)end + delta >= 0x10000L )
|
|
|
|
charcode = (FT_UInt)( 0x10000L - delta );
|
|
|
|
|
|
|
|
else
|
|
|
|
goto Next_Segment;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( gindex )
|
2005-02-28 18:17:47 +01:00
|
|
|
{
|
|
|
|
cmap->cur_charcode = charcode;
|
|
|
|
cmap->cur_gindex = gindex;
|
|
|
|
return;
|
|
|
|
}
|
2005-03-01 03:13:50 +01:00
|
|
|
} while ( ++charcode <= end );
|
2005-02-28 18:17:47 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-25 17:12:46 +02:00
|
|
|
Next_Segment:
|
2005-03-01 03:13:50 +01:00
|
|
|
/* we need to find another range */
|
|
|
|
if ( tt_cmap4_set_range( cmap, cmap->cur_range + 1 ) < 0 )
|
2005-02-28 18:17:47 +01:00
|
|
|
break;
|
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
if ( charcode < cmap->cur_start )
|
|
|
|
charcode = cmap->cur_start;
|
2005-02-28 18:17:47 +01:00
|
|
|
}
|
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
Fail:
|
2009-07-31 17:32:13 +02:00
|
|
|
cmap->cur_charcode = (FT_UInt32)0xFFFFFFFFUL;
|
2005-11-29 12:32:53 +01:00
|
|
|
cmap->cur_gindex = 0;
|
2005-02-28 18:17:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-05-10 00:11:36 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2002-02-22 19:28:11 +01:00
|
|
|
tt_cmap4_validate( FT_Byte* table,
|
|
|
|
FT_Validator valid )
|
|
|
|
{
|
2014-02-26 19:50:18 +01:00
|
|
|
FT_Byte* p;
|
|
|
|
FT_UInt length;
|
|
|
|
|
2002-02-27 22:25:47 +01:00
|
|
|
FT_Byte *ends, *starts, *offsets, *deltas, *glyph_ids;
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_UInt num_segs;
|
2013-03-14 11:21:17 +01:00
|
|
|
FT_Error error = FT_Err_Ok;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-10-07 12:12:43 +02:00
|
|
|
|
2014-02-26 19:50:18 +01:00
|
|
|
if ( table + 2 + 2 > valid->limit )
|
|
|
|
FT_INVALID_TOO_SHORT;
|
|
|
|
|
|
|
|
p = table + 2; /* skip format */
|
|
|
|
length = TT_NEXT_USHORT( p );
|
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
/* in certain fonts, the `length' field is invalid and goes */
|
|
|
|
/* out of bound. We try to correct this here... */
|
* src/pfr/pfrsbit.h, src/pfr/pfrsbit.c, src/pfr/pfrload.c,
src/pfr/pfrgload.c, src/pfr/pfrobjs.c, src/pfr/pfrtypes.h,
Jamfile, src/base/ftobjs.c: adding support for embedded bitmaps to
the PFR driver, and rewriting its kerning loader / handler to use all
kerning pairs in a physical font (and not just the first item).
* src/tools/docmaker/content.py, src/tools/docmaker/sources.py,
src/tools/docmaker/tohtml.py: fixing a few nasty bugs
* src/sfnt/ttcmap0.c: the validator for format 4 sub-tables is
now capable of dealing with invalid "length" fields at the start
of the sub-table. This allows fonts like "mg______.ttf" (i.e.
Marriage) to return accurate charmaps.
2002-10-05 16:57:03 +02:00
|
|
|
if ( table + length > valid->limit )
|
|
|
|
{
|
|
|
|
if ( valid->level >= FT_VALIDATE_TIGHT )
|
|
|
|
FT_INVALID_TOO_SHORT;
|
|
|
|
|
|
|
|
length = (FT_UInt)( valid->limit - table );
|
|
|
|
}
|
|
|
|
|
2014-11-22 06:24:45 +01:00
|
|
|
if ( length < 16 )
|
|
|
|
FT_INVALID_TOO_SHORT;
|
|
|
|
|
2002-02-27 22:25:47 +01:00
|
|
|
p = table + 6;
|
2002-03-31 20:48:24 +02:00
|
|
|
num_segs = TT_NEXT_USHORT( p ); /* read segCountX2 */
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
if ( valid->level >= FT_VALIDATE_PARANOID )
|
|
|
|
{
|
|
|
|
/* check that we have an even value here */
|
|
|
|
if ( num_segs & 1 )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_DATA;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
num_segs /= 2;
|
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
if ( length < 16 + num_segs * 2 * 4 )
|
|
|
|
FT_INVALID_TOO_SHORT;
|
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
/* check the search parameters - even though we never use them */
|
|
|
|
/* */
|
|
|
|
if ( valid->level >= FT_VALIDATE_PARANOID )
|
|
|
|
{
|
2008-07-22 22:59:59 +02:00
|
|
|
/* check the values of `searchRange', `entrySelector', `rangeShift' */
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_UInt search_range = TT_NEXT_USHORT( p );
|
|
|
|
FT_UInt entry_selector = TT_NEXT_USHORT( p );
|
|
|
|
FT_UInt range_shift = TT_NEXT_USHORT( p );
|
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
if ( ( search_range | range_shift ) & 1 ) /* must be even values */
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_DATA;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
search_range /= 2;
|
|
|
|
range_shift /= 2;
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
/* `search range' is the greatest power of 2 that is <= num_segs */
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
if ( search_range > num_segs ||
|
|
|
|
search_range * 2 < num_segs ||
|
|
|
|
search_range + range_shift != num_segs ||
|
|
|
|
search_range != ( 1U << entry_selector ) )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_DATA;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
|
2002-02-27 22:25:47 +01:00
|
|
|
ends = table + 14;
|
2002-03-31 20:48:24 +02:00
|
|
|
starts = table + 16 + num_segs * 2;
|
|
|
|
deltas = starts + num_segs * 2;
|
|
|
|
offsets = deltas + num_segs * 2;
|
|
|
|
glyph_ids = offsets + num_segs * 2;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2009-03-11 07:47:49 +01:00
|
|
|
/* check last segment; its end count value must be 0xFFFF */
|
2002-02-22 19:28:11 +01:00
|
|
|
if ( valid->level >= FT_VALIDATE_PARANOID )
|
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
p = ends + ( num_segs - 1 ) * 2;
|
|
|
|
if ( TT_PEEK_USHORT( p ) != 0xFFFFU )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_DATA;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2008-07-22 22:59:59 +02:00
|
|
|
FT_UInt start, end, offset, n;
|
|
|
|
FT_UInt last_start = 0, last_end = 0;
|
|
|
|
FT_Int delta;
|
2007-01-05 14:15:29 +01:00
|
|
|
FT_Byte* p_start = starts;
|
|
|
|
FT_Byte* p_end = ends;
|
|
|
|
FT_Byte* p_delta = deltas;
|
|
|
|
FT_Byte* p_offset = offsets;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
for ( n = 0; n < num_segs; n++ )
|
|
|
|
{
|
2007-01-05 14:15:29 +01:00
|
|
|
p = p_offset;
|
|
|
|
start = TT_NEXT_USHORT( p_start );
|
|
|
|
end = TT_NEXT_USHORT( p_end );
|
|
|
|
delta = TT_NEXT_SHORT( p_delta );
|
|
|
|
offset = TT_NEXT_USHORT( p_offset );
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-22 23:37:40 +01:00
|
|
|
if ( start > end )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_DATA;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2009-03-11 07:47:49 +01:00
|
|
|
/* this test should be performed at default validation level; */
|
|
|
|
/* unfortunately, some popular Asian fonts have overlapping */
|
|
|
|
/* ranges in their charmaps */
|
|
|
|
/* */
|
2005-11-29 12:32:53 +01:00
|
|
|
if ( start <= last_end && n > 0 )
|
2002-05-01 10:40:32 +02:00
|
|
|
{
|
2005-05-10 00:11:36 +02:00
|
|
|
if ( valid->level >= FT_VALIDATE_TIGHT )
|
2002-05-01 10:40:32 +02:00
|
|
|
FT_INVALID_DATA;
|
2005-05-10 00:11:36 +02:00
|
|
|
else
|
2005-11-29 12:32:53 +01:00
|
|
|
{
|
|
|
|
/* allow overlapping segments, provided their start points */
|
2009-03-11 07:47:49 +01:00
|
|
|
/* and end points, respectively, are in ascending order */
|
2005-11-29 12:32:53 +01:00
|
|
|
/* */
|
|
|
|
if ( last_start > start || last_end > end )
|
|
|
|
error |= TT_CMAP_FLAG_UNSORTED;
|
|
|
|
else
|
2005-11-30 19:47:49 +01:00
|
|
|
error |= TT_CMAP_FLAG_OVERLAPPING;
|
2005-11-29 12:32:53 +01:00
|
|
|
}
|
2002-05-01 10:40:32 +02:00
|
|
|
}
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-09-25 01:39:58 +02:00
|
|
|
if ( offset && offset != 0xFFFFU )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2009-03-11 07:47:49 +01:00
|
|
|
p += offset; /* start of glyph ID array */
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2008-07-22 22:59:59 +02:00
|
|
|
/* check that we point within the glyph IDs table only */
|
2003-04-23 20:21:48 +02:00
|
|
|
if ( valid->level >= FT_VALIDATE_TIGHT )
|
|
|
|
{
|
|
|
|
if ( p < glyph_ids ||
|
|
|
|
p + ( end - start + 1 ) * 2 > table + length )
|
|
|
|
FT_INVALID_DATA;
|
|
|
|
}
|
2009-03-11 07:47:49 +01:00
|
|
|
/* Some fonts handle the last segment incorrectly. In */
|
|
|
|
/* theory, 0xFFFF might point to an ordinary glyph -- */
|
|
|
|
/* a cmap 4 is versatile and could be used for any */
|
|
|
|
/* encoding, not only Unicode. However, reality shows */
|
|
|
|
/* that far too many fonts are sloppy and incorrectly */
|
|
|
|
/* set all fields but `start' and `end' for the last */
|
|
|
|
/* segment if it contains only a single character. */
|
|
|
|
/* */
|
|
|
|
/* We thus omit the test here, delaying it to the */
|
2015-09-24 12:14:38 +02:00
|
|
|
/* routines that actually access the cmap. */
|
2009-03-11 07:47:49 +01:00
|
|
|
else if ( n != num_segs - 1 ||
|
|
|
|
!( start == 0xFFFFU && end == 0xFFFFU ) )
|
2003-04-23 20:21:48 +02:00
|
|
|
{
|
|
|
|
if ( p < glyph_ids ||
|
|
|
|
p + ( end - start + 1 ) * 2 > valid->limit )
|
|
|
|
FT_INVALID_DATA;
|
|
|
|
}
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-02-27 22:25:47 +01:00
|
|
|
/* check glyph indices within the segment range */
|
|
|
|
if ( valid->level >= FT_VALIDATE_TIGHT )
|
|
|
|
{
|
2002-09-25 01:39:58 +02:00
|
|
|
FT_UInt i, idx;
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2002-09-25 01:39:58 +02:00
|
|
|
for ( i = start; i < end; i++ )
|
2002-02-27 22:25:47 +01:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
idx = FT_NEXT_USHORT( p );
|
|
|
|
if ( idx != 0 )
|
2002-02-27 22:25:47 +01:00
|
|
|
{
|
2015-02-22 12:03:28 +01:00
|
|
|
idx = (FT_UInt)( (FT_Int)idx + delta ) & 0xFFFFU;
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
if ( idx >= TT_VALID_GLYPH_COUNT( valid ) )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_GLYPH_ID;
|
2002-02-27 22:25:47 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
2002-09-25 01:39:58 +02:00
|
|
|
else if ( offset == 0xFFFFU )
|
|
|
|
{
|
2008-07-22 22:59:59 +02:00
|
|
|
/* some fonts (erroneously?) use a range offset of 0xFFFF */
|
2002-09-25 01:39:58 +02:00
|
|
|
/* to mean missing glyph in cmap table */
|
|
|
|
/* */
|
2009-03-11 07:47:49 +01:00
|
|
|
if ( valid->level >= FT_VALIDATE_PARANOID ||
|
|
|
|
n != num_segs - 1 ||
|
|
|
|
!( start == 0xFFFFU && end == 0xFFFFU ) )
|
2002-09-25 01:39:58 +02:00
|
|
|
FT_INVALID_DATA;
|
|
|
|
}
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
last_start = start;
|
2005-11-30 19:47:49 +01:00
|
|
|
last_end = end;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
}
|
2005-05-10 00:11:36 +02:00
|
|
|
|
|
|
|
return error;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
static FT_UInt
|
2008-10-09 07:44:23 +02:00
|
|
|
tt_cmap4_char_map_linear( TT_CMap cmap,
|
|
|
|
FT_UInt32* pcharcode,
|
|
|
|
FT_Bool next )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2015-09-30 14:44:29 +02:00
|
|
|
TT_Face face = (TT_Face)cmap->cmap.charmap.face;
|
|
|
|
FT_Byte* limit = face->cmap_table + face->cmap_size;
|
|
|
|
|
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
FT_UInt num_segs2, start, end, offset;
|
|
|
|
FT_Int delta;
|
|
|
|
FT_UInt i, num_segs;
|
|
|
|
FT_UInt32 charcode = *pcharcode;
|
2005-11-30 19:47:49 +01:00
|
|
|
FT_UInt gindex = 0;
|
2005-11-29 12:32:53 +01:00
|
|
|
FT_Byte* p;
|
2015-09-30 14:44:29 +02:00
|
|
|
FT_Byte* q;
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
p = cmap->data + 6;
|
|
|
|
num_segs2 = FT_PAD_FLOOR( TT_PEEK_USHORT( p ), 2 );
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
num_segs = num_segs2 >> 1;
|
2002-06-11 01:03:35 +02:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
if ( !num_segs )
|
|
|
|
return 0;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
if ( next )
|
|
|
|
charcode++;
|
2002-06-11 01:03:35 +02:00
|
|
|
|
2015-09-30 14:44:29 +02:00
|
|
|
if ( charcode > 0xFFFFU )
|
|
|
|
return 0;
|
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
/* linear search */
|
2015-09-30 14:44:29 +02:00
|
|
|
p = cmap->data + 14; /* ends table */
|
|
|
|
q = cmap->data + 16 + num_segs2; /* starts table */
|
2007-01-16 07:11:27 +01:00
|
|
|
|
2015-09-30 14:44:29 +02:00
|
|
|
for ( i = 0; i < num_segs; i++ )
|
|
|
|
{
|
|
|
|
end = TT_NEXT_USHORT( p );
|
|
|
|
start = TT_NEXT_USHORT( q );
|
2002-06-11 01:03:35 +02:00
|
|
|
|
2015-09-30 14:44:29 +02:00
|
|
|
if ( charcode < start )
|
|
|
|
{
|
|
|
|
if ( next )
|
|
|
|
charcode = start;
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
2002-06-11 01:03:35 +02:00
|
|
|
|
2015-09-30 14:44:29 +02:00
|
|
|
Again:
|
|
|
|
if ( charcode <= end )
|
2005-11-29 12:32:53 +01:00
|
|
|
{
|
2015-09-30 14:44:29 +02:00
|
|
|
FT_Byte* r;
|
|
|
|
|
|
|
|
|
|
|
|
r = q - 2 + num_segs2;
|
|
|
|
delta = TT_PEEK_SHORT( r );
|
|
|
|
r += num_segs2;
|
|
|
|
offset = TT_PEEK_USHORT( r );
|
2002-09-25 01:39:58 +02:00
|
|
|
|
2015-09-30 14:44:29 +02:00
|
|
|
/* some fonts have an incorrect last segment; */
|
|
|
|
/* we have to catch it */
|
|
|
|
if ( i >= num_segs - 1 &&
|
|
|
|
start == 0xFFFFU && end == 0xFFFFU )
|
2005-11-29 12:32:53 +01:00
|
|
|
{
|
2015-09-30 14:44:29 +02:00
|
|
|
if ( offset && r + offset + 2 > limit )
|
2009-03-11 07:47:49 +01:00
|
|
|
{
|
2015-09-30 14:44:29 +02:00
|
|
|
delta = 1;
|
|
|
|
offset = 0;
|
|
|
|
}
|
|
|
|
}
|
2009-03-11 07:47:49 +01:00
|
|
|
|
2015-09-30 14:44:29 +02:00
|
|
|
if ( offset == 0xFFFFU )
|
|
|
|
continue;
|
2009-03-11 07:47:49 +01:00
|
|
|
|
2015-09-30 14:44:29 +02:00
|
|
|
if ( offset )
|
|
|
|
{
|
|
|
|
r += offset + ( charcode - start ) * 2;
|
2008-07-22 22:59:59 +02:00
|
|
|
|
2015-09-30 14:44:29 +02:00
|
|
|
/* if r > limit, the whole segment is invalid */
|
|
|
|
if ( next && r > limit )
|
2005-11-29 12:32:53 +01:00
|
|
|
continue;
|
2002-06-11 01:03:35 +02:00
|
|
|
|
2015-09-30 14:44:29 +02:00
|
|
|
gindex = TT_PEEK_USHORT( r );
|
|
|
|
if ( gindex )
|
2015-10-01 14:16:03 +02:00
|
|
|
{
|
2015-09-30 14:44:29 +02:00
|
|
|
gindex = (FT_UInt)( (FT_Int)gindex + delta ) & 0xFFFFU;
|
2015-10-01 14:16:03 +02:00
|
|
|
if ( gindex >= (FT_UInt)face->root.num_glyphs )
|
|
|
|
gindex = 0;
|
|
|
|
}
|
2015-09-30 14:44:29 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gindex = (FT_UInt)( (FT_Int)charcode + delta ) & 0xFFFFU;
|
|
|
|
|
|
|
|
if ( next && gindex >= (FT_UInt)face->root.num_glyphs )
|
2005-11-29 12:32:53 +01:00
|
|
|
{
|
2015-09-30 14:44:29 +02:00
|
|
|
/* we have an invalid glyph index; if there is an overflow, */
|
|
|
|
/* we can adjust `charcode', otherwise the whole segment is */
|
|
|
|
/* invalid */
|
2015-10-01 20:00:27 +02:00
|
|
|
gindex = 0;
|
|
|
|
|
2015-09-30 14:44:29 +02:00
|
|
|
if ( (FT_Int)charcode + delta < 0 &&
|
|
|
|
(FT_Int)end + delta >= 0 )
|
|
|
|
charcode = (FT_UInt)( -delta );
|
2015-10-01 20:00:27 +02:00
|
|
|
|
2015-09-30 14:44:29 +02:00
|
|
|
else if ( (FT_Int)charcode + delta < 0x10000L &&
|
|
|
|
(FT_Int)end + delta >= 0x10000L )
|
|
|
|
charcode = (FT_UInt)( 0x10000L - delta );
|
2015-10-01 20:00:27 +02:00
|
|
|
|
2015-09-30 14:44:29 +02:00
|
|
|
else
|
|
|
|
continue;
|
2002-05-01 10:40:32 +02:00
|
|
|
}
|
2015-09-30 14:44:29 +02:00
|
|
|
}
|
2005-11-29 12:32:53 +01:00
|
|
|
|
2015-09-30 14:44:29 +02:00
|
|
|
if ( next && !gindex )
|
|
|
|
{
|
|
|
|
if ( charcode >= 0xFFFFU )
|
|
|
|
break;
|
|
|
|
|
|
|
|
charcode++;
|
|
|
|
goto Again;
|
2002-05-01 10:40:32 +02:00
|
|
|
}
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
break;
|
2015-09-30 14:44:29 +02:00
|
|
|
}
|
2005-11-29 12:32:53 +01:00
|
|
|
}
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2015-09-30 14:44:29 +02:00
|
|
|
if ( next )
|
2005-11-29 12:32:53 +01:00
|
|
|
*pcharcode = charcode;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
return gindex;
|
|
|
|
}
|
2002-06-11 01:03:35 +02:00
|
|
|
|
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
static FT_UInt
|
2008-10-09 07:44:23 +02:00
|
|
|
tt_cmap4_char_map_binary( TT_CMap cmap,
|
|
|
|
FT_UInt32* pcharcode,
|
|
|
|
FT_Bool next )
|
2005-11-29 12:32:53 +01:00
|
|
|
{
|
2016-08-25 17:12:46 +02:00
|
|
|
TT_Face face = (TT_Face)cmap->cmap.charmap.face;
|
|
|
|
FT_Byte* limit = face->cmap_table + face->cmap_size;
|
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
FT_UInt num_segs2, start, end, offset;
|
|
|
|
FT_Int delta;
|
|
|
|
FT_UInt max, min, mid, num_segs;
|
2009-07-31 17:32:09 +02:00
|
|
|
FT_UInt charcode = (FT_UInt)*pcharcode;
|
2005-11-30 19:47:49 +01:00
|
|
|
FT_UInt gindex = 0;
|
2005-11-29 12:32:53 +01:00
|
|
|
FT_Byte* p;
|
2007-01-16 07:11:27 +01:00
|
|
|
|
2002-06-11 01:03:35 +02:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
p = cmap->data + 6;
|
|
|
|
num_segs2 = FT_PAD_FLOOR( TT_PEEK_USHORT( p ), 2 );
|
2002-06-11 01:03:35 +02:00
|
|
|
|
2005-11-30 03:39:10 +01:00
|
|
|
if ( !num_segs2 )
|
|
|
|
return 0;
|
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
num_segs = num_segs2 >> 1;
|
2002-06-11 01:03:35 +02:00
|
|
|
|
2005-11-30 03:39:10 +01:00
|
|
|
/* make compiler happy */
|
|
|
|
mid = num_segs;
|
|
|
|
end = 0xFFFFU;
|
2002-06-11 01:03:35 +02:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
if ( next )
|
|
|
|
charcode++;
|
2002-09-25 01:39:58 +02:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
min = 0;
|
|
|
|
max = num_segs;
|
2002-06-11 01:03:35 +02:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
/* binary search */
|
|
|
|
while ( min < max )
|
|
|
|
{
|
|
|
|
mid = ( min + max ) >> 1;
|
|
|
|
p = cmap->data + 14 + mid * 2;
|
|
|
|
end = TT_PEEK_USHORT( p );
|
|
|
|
p += 2 + num_segs2;
|
|
|
|
start = TT_PEEK_USHORT( p );
|
2002-06-11 01:03:35 +02:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
if ( charcode < start )
|
|
|
|
max = mid;
|
|
|
|
else if ( charcode > end )
|
|
|
|
min = mid + 1;
|
|
|
|
else
|
|
|
|
{
|
2005-11-30 19:47:49 +01:00
|
|
|
p += num_segs2;
|
|
|
|
delta = TT_PEEK_SHORT( p );
|
|
|
|
p += num_segs2;
|
|
|
|
offset = TT_PEEK_USHORT( p );
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2009-03-11 07:47:49 +01:00
|
|
|
/* some fonts have an incorrect last segment; */
|
|
|
|
/* we have to catch it */
|
|
|
|
if ( mid >= num_segs - 1 &&
|
|
|
|
start == 0xFFFFU && end == 0xFFFFU )
|
|
|
|
{
|
|
|
|
if ( offset && p + offset + 2 > limit )
|
|
|
|
{
|
|
|
|
delta = 1;
|
|
|
|
offset = 0;
|
|
|
|
}
|
|
|
|
}
|
2008-07-22 22:59:59 +02:00
|
|
|
|
2005-11-30 19:47:49 +01:00
|
|
|
/* search the first segment containing `charcode' */
|
|
|
|
if ( cmap->flags & TT_CMAP_FLAG_OVERLAPPING )
|
2005-11-29 12:32:53 +01:00
|
|
|
{
|
|
|
|
FT_UInt i;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
/* call the current segment `max' */
|
|
|
|
max = mid;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
if ( offset == 0xFFFFU )
|
|
|
|
mid = max + 1;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2005-11-30 19:47:49 +01:00
|
|
|
/* search in segments before the current segment */
|
2016-02-15 12:54:40 +01:00
|
|
|
for ( i = max; i > 0; i-- )
|
2005-11-29 12:32:53 +01:00
|
|
|
{
|
2006-09-29 20:22:11 +02:00
|
|
|
FT_UInt prev_end;
|
|
|
|
FT_Byte* old_p;
|
2005-02-28 18:17:47 +01:00
|
|
|
|
2005-03-01 03:13:50 +01:00
|
|
|
|
2006-09-29 20:22:11 +02:00
|
|
|
old_p = p;
|
|
|
|
p = cmap->data + 14 + ( i - 1 ) * 2;
|
2005-11-29 12:32:53 +01:00
|
|
|
prev_end = TT_PEEK_USHORT( p );
|
2005-02-28 18:17:47 +01:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
if ( charcode > prev_end )
|
2006-09-29 20:22:11 +02:00
|
|
|
{
|
|
|
|
p = old_p;
|
2005-11-29 12:32:53 +01:00
|
|
|
break;
|
2006-09-29 20:22:11 +02:00
|
|
|
}
|
2003-05-07 12:21:13 +02:00
|
|
|
|
2005-11-30 19:47:49 +01:00
|
|
|
end = prev_end;
|
|
|
|
p += 2 + num_segs2;
|
|
|
|
start = TT_PEEK_USHORT( p );
|
|
|
|
p += num_segs2;
|
|
|
|
delta = TT_PEEK_SHORT( p );
|
|
|
|
p += num_segs2;
|
|
|
|
offset = TT_PEEK_USHORT( p );
|
2005-05-10 00:11:36 +02:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
if ( offset != 0xFFFFU )
|
|
|
|
mid = i - 1;
|
2005-05-10 00:11:36 +02:00
|
|
|
}
|
2003-05-07 12:21:13 +02:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
/* no luck */
|
|
|
|
if ( mid == max + 1 )
|
|
|
|
{
|
|
|
|
if ( i != max )
|
|
|
|
{
|
2005-11-30 19:47:49 +01:00
|
|
|
p = cmap->data + 14 + max * 2;
|
|
|
|
end = TT_PEEK_USHORT( p );
|
|
|
|
p += 2 + num_segs2;
|
|
|
|
start = TT_PEEK_USHORT( p );
|
|
|
|
p += num_segs2;
|
|
|
|
delta = TT_PEEK_SHORT( p );
|
|
|
|
p += num_segs2;
|
|
|
|
offset = TT_PEEK_USHORT( p );
|
2005-11-29 12:32:53 +01:00
|
|
|
}
|
2003-05-07 12:21:13 +02:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
mid = max;
|
2003-05-07 12:21:13 +02:00
|
|
|
|
2005-11-30 19:47:49 +01:00
|
|
|
/* search in segments after the current segment */
|
2005-11-29 12:32:53 +01:00
|
|
|
for ( i = max + 1; i < num_segs; i++ )
|
|
|
|
{
|
|
|
|
FT_UInt next_end, next_start;
|
2003-05-07 12:21:13 +02:00
|
|
|
|
|
|
|
|
2005-11-30 19:47:49 +01:00
|
|
|
p = cmap->data + 14 + i * 2;
|
|
|
|
next_end = TT_PEEK_USHORT( p );
|
|
|
|
p += 2 + num_segs2;
|
|
|
|
next_start = TT_PEEK_USHORT( p );
|
2003-05-07 12:21:13 +02:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
if ( charcode < next_start )
|
|
|
|
break;
|
2003-05-07 12:21:13 +02:00
|
|
|
|
2005-11-30 19:47:49 +01:00
|
|
|
end = next_end;
|
|
|
|
start = next_start;
|
|
|
|
p += num_segs2;
|
|
|
|
delta = TT_PEEK_SHORT( p );
|
|
|
|
p += num_segs2;
|
|
|
|
offset = TT_PEEK_USHORT( p );
|
2005-11-29 12:32:53 +01:00
|
|
|
|
|
|
|
if ( offset != 0xFFFFU )
|
|
|
|
mid = i;
|
|
|
|
}
|
|
|
|
i--;
|
|
|
|
|
|
|
|
/* still no luck */
|
|
|
|
if ( mid == max )
|
2003-05-07 12:21:13 +02:00
|
|
|
{
|
2005-11-29 12:32:53 +01:00
|
|
|
mid = i;
|
|
|
|
|
|
|
|
break;
|
2003-05-07 12:21:13 +02:00
|
|
|
}
|
2005-11-29 12:32:53 +01:00
|
|
|
}
|
|
|
|
|
2005-11-30 19:47:49 +01:00
|
|
|
/* end, start, delta, and offset are for the i'th segment */
|
2005-11-29 12:32:53 +01:00
|
|
|
if ( mid != i )
|
|
|
|
{
|
2005-11-30 19:47:49 +01:00
|
|
|
p = cmap->data + 14 + mid * 2;
|
|
|
|
end = TT_PEEK_USHORT( p );
|
|
|
|
p += 2 + num_segs2;
|
|
|
|
start = TT_PEEK_USHORT( p );
|
|
|
|
p += num_segs2;
|
|
|
|
delta = TT_PEEK_SHORT( p );
|
|
|
|
p += num_segs2;
|
|
|
|
offset = TT_PEEK_USHORT( p );
|
2003-05-07 12:21:13 +02:00
|
|
|
}
|
|
|
|
}
|
2005-11-29 12:32:53 +01:00
|
|
|
else
|
2005-05-10 00:11:36 +02:00
|
|
|
{
|
2005-11-29 12:32:53 +01:00
|
|
|
if ( offset == 0xFFFFU )
|
|
|
|
break;
|
2005-05-10 00:11:36 +02:00
|
|
|
}
|
2005-11-29 12:32:53 +01:00
|
|
|
|
|
|
|
if ( offset )
|
2003-05-07 12:21:13 +02:00
|
|
|
{
|
2005-11-29 12:32:53 +01:00
|
|
|
p += offset + ( charcode - start ) * 2;
|
2016-08-25 17:12:46 +02:00
|
|
|
|
|
|
|
/* if p > limit, the whole segment is invalid */
|
|
|
|
if ( next && p > limit )
|
2016-08-25 19:49:52 +02:00
|
|
|
break;
|
2016-08-25 17:12:46 +02:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
gindex = TT_PEEK_USHORT( p );
|
2016-08-25 17:12:46 +02:00
|
|
|
if ( gindex )
|
|
|
|
{
|
2015-02-22 12:03:28 +01:00
|
|
|
gindex = (FT_UInt)( (FT_Int)gindex + delta ) & 0xFFFFU;
|
2016-08-25 17:12:46 +02:00
|
|
|
if ( gindex >= (FT_UInt)face->root.num_glyphs )
|
|
|
|
gindex = 0;
|
|
|
|
}
|
2003-05-07 12:21:13 +02:00
|
|
|
}
|
2005-11-29 12:32:53 +01:00
|
|
|
else
|
2016-08-25 17:12:46 +02:00
|
|
|
{
|
2015-02-22 12:03:28 +01:00
|
|
|
gindex = (FT_UInt)( (FT_Int)charcode + delta ) & 0xFFFFU;
|
2005-11-29 12:32:53 +01:00
|
|
|
|
2016-08-25 17:12:46 +02:00
|
|
|
if ( next && gindex >= (FT_UInt)face->root.num_glyphs )
|
|
|
|
{
|
|
|
|
/* we have an invalid glyph index; if there is an overflow, */
|
|
|
|
/* we can adjust `charcode', otherwise the whole segment is */
|
|
|
|
/* invalid */
|
|
|
|
gindex = 0;
|
|
|
|
|
|
|
|
if ( (FT_Int)charcode + delta < 0 &&
|
|
|
|
(FT_Int)end + delta >= 0 )
|
|
|
|
charcode = (FT_UInt)( -delta );
|
|
|
|
|
|
|
|
else if ( (FT_Int)charcode + delta < 0x10000L &&
|
|
|
|
(FT_Int)end + delta >= 0x10000L )
|
|
|
|
charcode = (FT_UInt)( 0x10000L - delta );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
break;
|
2003-05-07 12:21:13 +02:00
|
|
|
}
|
|
|
|
}
|
2005-11-29 12:32:53 +01:00
|
|
|
|
|
|
|
if ( next )
|
2003-05-07 12:21:13 +02:00
|
|
|
{
|
2005-11-29 12:32:53 +01:00
|
|
|
TT_CMap4 cmap4 = (TT_CMap4)cmap;
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
/* if `charcode' is not in any segment, then `mid' is */
|
|
|
|
/* the segment nearest to `charcode' */
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
if ( charcode > end )
|
|
|
|
{
|
|
|
|
mid++;
|
|
|
|
if ( mid == num_segs )
|
|
|
|
return 0;
|
|
|
|
}
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
if ( tt_cmap4_set_range( cmap4, mid ) )
|
|
|
|
{
|
|
|
|
if ( gindex )
|
|
|
|
*pcharcode = charcode;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cmap4->cur_charcode = charcode;
|
|
|
|
|
|
|
|
if ( gindex )
|
|
|
|
cmap4->cur_gindex = gindex;
|
|
|
|
else
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2005-11-29 12:32:53 +01:00
|
|
|
cmap4->cur_charcode = charcode;
|
|
|
|
tt_cmap4_next( cmap4 );
|
|
|
|
gindex = cmap4->cur_gindex;
|
|
|
|
}
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
if ( gindex )
|
|
|
|
*pcharcode = cmap4->cur_charcode;
|
|
|
|
}
|
|
|
|
}
|
2005-05-10 00:11:36 +02:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
return gindex;
|
|
|
|
}
|
2005-05-10 00:11:36 +02:00
|
|
|
|
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
FT_CALLBACK_DEF( FT_UInt )
|
|
|
|
tt_cmap4_char_index( TT_CMap cmap,
|
|
|
|
FT_UInt32 char_code )
|
|
|
|
{
|
2005-11-30 19:47:49 +01:00
|
|
|
if ( char_code >= 0x10000UL )
|
2005-11-29 12:32:53 +01:00
|
|
|
return 0;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
if ( cmap->flags & TT_CMAP_FLAG_UNSORTED )
|
|
|
|
return tt_cmap4_char_map_linear( cmap, &char_code, 0 );
|
|
|
|
else
|
|
|
|
return tt_cmap4_char_map_binary( cmap, &char_code, 0 );
|
|
|
|
}
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
|
2009-07-31 17:32:09 +02:00
|
|
|
FT_CALLBACK_DEF( FT_UInt32 )
|
2005-11-29 12:32:53 +01:00
|
|
|
tt_cmap4_char_next( TT_CMap cmap,
|
|
|
|
FT_UInt32 *pchar_code )
|
|
|
|
{
|
|
|
|
FT_UInt gindex;
|
|
|
|
|
|
|
|
|
|
|
|
if ( *pchar_code >= 0xFFFFU )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if ( cmap->flags & TT_CMAP_FLAG_UNSORTED )
|
|
|
|
gindex = tt_cmap4_char_map_linear( cmap, pchar_code, 1 );
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TT_CMap4 cmap4 = (TT_CMap4)cmap;
|
|
|
|
|
|
|
|
|
|
|
|
/* no need to search */
|
|
|
|
if ( *pchar_code == cmap4->cur_charcode )
|
|
|
|
{
|
|
|
|
tt_cmap4_next( cmap4 );
|
|
|
|
gindex = cmap4->cur_gindex;
|
|
|
|
if ( gindex )
|
|
|
|
*pchar_code = cmap4->cur_charcode;
|
2005-05-10 00:11:36 +02:00
|
|
|
}
|
2005-11-29 12:32:53 +01:00
|
|
|
else
|
|
|
|
gindex = tt_cmap4_char_map_binary( cmap, pchar_code, 1 );
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
2003-05-07 12:21:13 +02:00
|
|
|
|
2002-03-22 16:02:38 +01:00
|
|
|
return gindex;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2003-12-17 15:28:22 +01:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
|
|
tt_cmap4_get_info( TT_CMap cmap,
|
|
|
|
TT_CMapInfo *cmap_info )
|
|
|
|
{
|
|
|
|
FT_Byte* p = cmap->data + 4;
|
|
|
|
|
|
|
|
|
2009-04-04 07:42:38 +02:00
|
|
|
cmap_info->format = 4;
|
2003-12-17 15:28:22 +01:00
|
|
|
cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
|
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2003-12-17 15:28:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_DEFINE_TT_CMAP(
|
|
|
|
tt_cmap4_class_rec,
|
2016-09-17 17:12:50 +02:00
|
|
|
|
|
|
|
sizeof ( TT_CMap4Rec ),
|
|
|
|
|
|
|
|
(FT_CMap_InitFunc) tt_cmap4_init, /* init */
|
|
|
|
(FT_CMap_DoneFunc) NULL, /* done */
|
|
|
|
(FT_CMap_CharIndexFunc)tt_cmap4_char_index, /* char_index */
|
|
|
|
(FT_CMap_CharNextFunc) tt_cmap4_char_next, /* char_next */
|
|
|
|
|
|
|
|
(FT_CMap_CharVarIndexFunc) NULL, /* char_var_index */
|
|
|
|
(FT_CMap_CharVarIsDefaultFunc)NULL, /* char_var_default */
|
|
|
|
(FT_CMap_VariantListFunc) NULL, /* variant_list */
|
|
|
|
(FT_CMap_CharVariantListFunc) NULL, /* charvariant_list */
|
|
|
|
(FT_CMap_VariantCharListFunc) NULL, /* variantchar_list */
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
4,
|
2016-09-17 17:12:50 +02:00
|
|
|
(TT_CMap_ValidateFunc)tt_cmap4_validate, /* validate */
|
|
|
|
(TT_CMap_Info_GetFunc)tt_cmap4_get_info /* get_cmap_info */
|
|
|
|
)
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
#endif /* TT_CONFIG_CMAP_FORMAT_4 */
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** FORMAT 6 *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2018-06-03 09:01:17 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* TABLE OVERVIEW
|
|
|
|
* --------------
|
|
|
|
*
|
|
|
|
* NAME OFFSET TYPE DESCRIPTION
|
|
|
|
*
|
|
|
|
* format 0 USHORT must be 6
|
|
|
|
* length 2 USHORT table length in bytes
|
|
|
|
* language 4 USHORT Mac language code
|
|
|
|
*
|
|
|
|
* first 6 USHORT first segment code
|
|
|
|
* count 8 USHORT segment size in chars
|
|
|
|
* glyphIds 10 USHORT[count] glyph IDs
|
|
|
|
*
|
|
|
|
* A very simplified segment mapping.
|
|
|
|
*/
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
#ifdef TT_CONFIG_CMAP_FORMAT_6
|
|
|
|
|
2005-05-10 00:11:36 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2002-02-22 19:28:11 +01:00
|
|
|
tt_cmap6_validate( FT_Byte* table,
|
|
|
|
FT_Validator valid )
|
|
|
|
{
|
2002-02-27 22:25:47 +01:00
|
|
|
FT_Byte* p;
|
2003-04-23 21:48:24 +02:00
|
|
|
FT_UInt length, count;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
if ( table + 10 > valid->limit )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_TOO_SHORT;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-02-27 22:25:47 +01:00
|
|
|
p = table + 2;
|
2002-03-31 20:48:24 +02:00
|
|
|
length = TT_NEXT_USHORT( p );
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2003-04-23 21:48:24 +02:00
|
|
|
p = table + 8; /* skip language and start index */
|
2002-03-31 20:48:24 +02:00
|
|
|
count = TT_NEXT_USHORT( p );
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
if ( table + length > valid->limit || length < 10 + count * 2 )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_TOO_SHORT;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
/* check glyph indices */
|
|
|
|
if ( valid->level >= FT_VALIDATE_TIGHT )
|
|
|
|
{
|
|
|
|
FT_UInt gindex;
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
for ( ; count > 0; count-- )
|
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
gindex = TT_NEXT_USHORT( p );
|
|
|
|
if ( gindex >= TT_VALID_GLYPH_COUNT( valid ) )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_GLYPH_ID;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
}
|
2005-05-10 00:11:36 +02:00
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_CALLBACK_DEF( FT_UInt )
|
2002-03-01 03:26:22 +01:00
|
|
|
tt_cmap6_char_index( TT_CMap cmap,
|
|
|
|
FT_UInt32 char_code )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_Byte* table = cmap->data;
|
2002-02-22 19:28:11 +01:00
|
|
|
FT_UInt result = 0;
|
|
|
|
FT_Byte* p = table + 6;
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_UInt start = TT_NEXT_USHORT( p );
|
|
|
|
FT_UInt count = TT_NEXT_USHORT( p );
|
|
|
|
FT_UInt idx = (FT_UInt)( char_code - start );
|
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
if ( idx < count )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
p += 2 * idx;
|
|
|
|
result = TT_PEEK_USHORT( p );
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
2015-09-24 12:14:38 +02:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-31 17:32:09 +02:00
|
|
|
FT_CALLBACK_DEF( FT_UInt32 )
|
2002-03-31 20:48:24 +02:00
|
|
|
tt_cmap6_char_next( TT_CMap cmap,
|
|
|
|
FT_UInt32 *pchar_code )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_Byte* table = cmap->data;
|
|
|
|
FT_UInt32 result = 0;
|
|
|
|
FT_UInt32 char_code = *pchar_code + 1;
|
|
|
|
FT_UInt gindex = 0;
|
2002-06-11 01:03:35 +02:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_Byte* p = table + 6;
|
|
|
|
FT_UInt start = TT_NEXT_USHORT( p );
|
|
|
|
FT_UInt count = TT_NEXT_USHORT( p );
|
|
|
|
FT_UInt idx;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
|
|
|
if ( char_code >= 0x10000UL )
|
2015-09-24 12:39:38 +02:00
|
|
|
return 0;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
if ( char_code < start )
|
|
|
|
char_code = start;
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
idx = (FT_UInt)( char_code - start );
|
|
|
|
p += 2 * idx;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
for ( ; idx < count; idx++ )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
gindex = TT_NEXT_USHORT( p );
|
2002-02-22 19:28:11 +01:00
|
|
|
if ( gindex != 0 )
|
|
|
|
{
|
|
|
|
result = char_code;
|
|
|
|
break;
|
|
|
|
}
|
2015-09-24 12:39:38 +02:00
|
|
|
|
|
|
|
if ( char_code >= 0xFFFFU )
|
|
|
|
return 0;
|
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
char_code++;
|
|
|
|
}
|
|
|
|
|
2002-03-22 16:02:38 +01:00
|
|
|
*pchar_code = result;
|
|
|
|
return gindex;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
|
2002-02-28 17:10:29 +01:00
|
|
|
|
2003-12-17 15:28:22 +01:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
|
|
tt_cmap6_get_info( TT_CMap cmap,
|
|
|
|
TT_CMapInfo *cmap_info )
|
|
|
|
{
|
|
|
|
FT_Byte* p = cmap->data + 4;
|
|
|
|
|
|
|
|
|
2009-04-04 07:42:38 +02:00
|
|
|
cmap_info->format = 6;
|
2003-12-17 15:28:22 +01:00
|
|
|
cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
|
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2003-12-17 15:28:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_DEFINE_TT_CMAP(
|
|
|
|
tt_cmap6_class_rec,
|
2002-03-01 03:26:22 +01:00
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
sizeof ( TT_CMapRec ),
|
|
|
|
|
|
|
|
(FT_CMap_InitFunc) tt_cmap_init, /* init */
|
|
|
|
(FT_CMap_DoneFunc) NULL, /* done */
|
|
|
|
(FT_CMap_CharIndexFunc)tt_cmap6_char_index, /* char_index */
|
|
|
|
(FT_CMap_CharNextFunc) tt_cmap6_char_next, /* char_next */
|
2012-08-24 13:41:24 +02:00
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
(FT_CMap_CharVarIndexFunc) NULL, /* char_var_index */
|
|
|
|
(FT_CMap_CharVarIsDefaultFunc)NULL, /* char_var_default */
|
|
|
|
(FT_CMap_VariantListFunc) NULL, /* variant_list */
|
|
|
|
(FT_CMap_CharVariantListFunc) NULL, /* charvariant_list */
|
|
|
|
(FT_CMap_VariantCharListFunc) NULL, /* variantchar_list */
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
6,
|
2016-09-17 17:12:50 +02:00
|
|
|
(TT_CMap_ValidateFunc)tt_cmap6_validate, /* validate */
|
|
|
|
(TT_CMap_Info_GetFunc)tt_cmap6_get_info /* get_cmap_info */
|
|
|
|
)
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
#endif /* TT_CONFIG_CMAP_FORMAT_6 */
|
|
|
|
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** FORMAT 8 *****/
|
|
|
|
/***** *****/
|
2008-07-22 22:59:59 +02:00
|
|
|
/***** It is hard to completely understand what the OpenType spec *****/
|
2002-03-31 20:48:24 +02:00
|
|
|
/***** says about this format, but here is my conclusion. *****/
|
|
|
|
/***** *****/
|
|
|
|
/***** The purpose of this format is to easily map UTF-16 text to *****/
|
|
|
|
/***** glyph indices. Basically, the `char_code' must be in one of *****/
|
2015-09-24 12:14:38 +02:00
|
|
|
/***** the following formats. *****/
|
2002-03-31 20:48:24 +02:00
|
|
|
/***** *****/
|
|
|
|
/***** - A 16-bit value that isn't part of the Unicode Surrogates *****/
|
|
|
|
/***** Area (i.e. U+D800-U+DFFF). *****/
|
|
|
|
/***** *****/
|
|
|
|
/***** - A 32-bit value, made of two surrogate values, i.e.. if *****/
|
|
|
|
/***** `char_code = (char_hi << 16) | char_lo', then both *****/
|
|
|
|
/***** `char_hi' and `char_lo' must be in the Surrogates Area. *****/
|
|
|
|
/***** Area. *****/
|
|
|
|
/***** *****/
|
2008-07-22 22:59:59 +02:00
|
|
|
/***** The `is32' table embedded in the charmap indicates whether a *****/
|
2002-03-31 20:48:24 +02:00
|
|
|
/***** given 16-bit value is in the surrogates area or not. *****/
|
|
|
|
/***** *****/
|
2015-09-24 12:14:38 +02:00
|
|
|
/***** So, for any given `char_code', we can assert the following. *****/
|
2002-03-31 20:48:24 +02:00
|
|
|
/***** *****/
|
|
|
|
/***** If `char_hi == 0' then we must have `is32[char_lo] == 0'. *****/
|
|
|
|
/***** *****/
|
|
|
|
/***** If `char_hi != 0' then we must have both *****/
|
|
|
|
/***** `is32[char_hi] != 0' and `is32[char_lo] != 0'. *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2018-06-03 09:01:17 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* TABLE OVERVIEW
|
|
|
|
* --------------
|
|
|
|
*
|
|
|
|
* NAME OFFSET TYPE DESCRIPTION
|
|
|
|
*
|
|
|
|
* format 0 USHORT must be 8
|
|
|
|
* reserved 2 USHORT reserved
|
|
|
|
* length 4 ULONG length in bytes
|
|
|
|
* language 8 ULONG Mac language code
|
|
|
|
* is32 12 BYTE[8192] 32-bitness bitmap
|
|
|
|
* count 8204 ULONG number of groups
|
|
|
|
*
|
|
|
|
* This header is followed by `count' groups of the following format:
|
|
|
|
*
|
|
|
|
* start 0 ULONG first charcode
|
|
|
|
* end 4 ULONG last charcode
|
|
|
|
* startId 8 ULONG start glyph ID for the group
|
|
|
|
*/
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
#ifdef TT_CONFIG_CMAP_FORMAT_8
|
|
|
|
|
2005-05-10 00:11:36 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2002-02-22 19:28:11 +01:00
|
|
|
tt_cmap8_validate( FT_Byte* table,
|
|
|
|
FT_Validator valid )
|
|
|
|
{
|
|
|
|
FT_Byte* p = table + 4;
|
|
|
|
FT_Byte* is32;
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_UInt32 length;
|
|
|
|
FT_UInt32 num_groups;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
if ( table + 16 + 8192 > valid->limit )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_TOO_SHORT;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
length = TT_NEXT_ULONG( p );
|
2009-03-20 08:03:58 +01:00
|
|
|
if ( length > (FT_UInt32)( valid->limit - table ) || length < 8192 + 16 )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_TOO_SHORT;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-02-27 22:25:47 +01:00
|
|
|
is32 = table + 12;
|
2002-03-31 20:48:24 +02:00
|
|
|
p = is32 + 8192; /* skip `is32' array */
|
|
|
|
num_groups = TT_NEXT_ULONG( p );
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2014-11-12 20:51:20 +01:00
|
|
|
/* p + num_groups * 12 > valid->limit ? */
|
|
|
|
if ( num_groups > (FT_UInt32)( valid->limit - p ) / 12 )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_TOO_SHORT;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
/* check groups, they must be in increasing order */
|
|
|
|
{
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_UInt32 n, start, end, start_id, count, last = 0;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
for ( n = 0; n < num_groups; n++ )
|
|
|
|
{
|
|
|
|
FT_UInt hi, lo;
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
|
|
|
start = TT_NEXT_ULONG( p );
|
|
|
|
end = TT_NEXT_ULONG( p );
|
|
|
|
start_id = TT_NEXT_ULONG( p );
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
if ( start > end )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_DATA;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
if ( n > 0 && start <= last )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_DATA;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
if ( valid->level >= FT_VALIDATE_TIGHT )
|
|
|
|
{
|
2014-11-12 20:51:20 +01:00
|
|
|
FT_UInt32 d = end - start;
|
|
|
|
|
|
|
|
|
|
|
|
/* start_id + end - start >= TT_VALID_GLYPH_COUNT( valid ) ? */
|
|
|
|
if ( d > TT_VALID_GLYPH_COUNT( valid ) ||
|
|
|
|
start_id >= TT_VALID_GLYPH_COUNT( valid ) - d )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_GLYPH_ID;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
count = (FT_UInt32)( end - start + 1 );
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
if ( start & ~0xFFFFU )
|
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
/* start_hi != 0; check that is32[i] is 1 for each i in */
|
|
|
|
/* the `hi' and `lo' of the range [start..end] */
|
2002-02-22 19:28:11 +01:00
|
|
|
for ( ; count > 0; count--, start++ )
|
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
hi = (FT_UInt)( start >> 16 );
|
|
|
|
lo = (FT_UInt)( start & 0xFFFFU );
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
if ( (is32[hi >> 3] & ( 0x80 >> ( hi & 7 ) ) ) == 0 )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_DATA;
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
if ( (is32[lo >> 3] & ( 0x80 >> ( lo & 7 ) ) ) == 0 )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_DATA;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
/* start_hi == 0; check that is32[i] is 0 for each i in */
|
2002-02-22 19:28:11 +01:00
|
|
|
/* the range [start..end] */
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
/* end_hi cannot be != 0! */
|
2002-02-22 19:28:11 +01:00
|
|
|
if ( end & ~0xFFFFU )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_DATA;
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
for ( ; count > 0; count--, start++ )
|
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
lo = (FT_UInt)( start & 0xFFFFU );
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
if ( (is32[lo >> 3] & ( 0x80 >> ( lo & 7 ) ) ) != 0 )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_DATA;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-02-27 22:25:47 +01:00
|
|
|
|
|
|
|
last = end;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
}
|
2005-05-10 00:11:36 +02:00
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_CALLBACK_DEF( FT_UInt )
|
2002-03-31 20:48:24 +02:00
|
|
|
tt_cmap8_char_index( TT_CMap cmap,
|
|
|
|
FT_UInt32 char_code )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_Byte* table = cmap->data;
|
|
|
|
FT_UInt result = 0;
|
|
|
|
FT_Byte* p = table + 8204;
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_UInt32 num_groups = TT_NEXT_ULONG( p );
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_UInt32 start, end, start_id;
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
for ( ; num_groups > 0; num_groups-- )
|
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
start = TT_NEXT_ULONG( p );
|
|
|
|
end = TT_NEXT_ULONG( p );
|
|
|
|
start_id = TT_NEXT_ULONG( p );
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
if ( char_code < start )
|
|
|
|
break;
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
if ( char_code <= end )
|
|
|
|
{
|
2015-09-24 12:39:38 +02:00
|
|
|
if ( start_id > 0xFFFFFFFFUL - ( char_code - start ) )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
result = (FT_UInt)( start_id + ( char_code - start ) );
|
2002-02-22 19:28:11 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-31 17:32:09 +02:00
|
|
|
FT_CALLBACK_DEF( FT_UInt32 )
|
2002-03-31 20:48:24 +02:00
|
|
|
tt_cmap8_char_next( TT_CMap cmap,
|
|
|
|
FT_UInt32 *pchar_code )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2015-09-24 13:39:44 +02:00
|
|
|
FT_Face face = cmap->cmap.charmap.face;
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_UInt32 result = 0;
|
2015-09-24 12:39:38 +02:00
|
|
|
FT_UInt32 char_code;
|
2002-02-22 19:28:11 +01:00
|
|
|
FT_UInt gindex = 0;
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_Byte* table = cmap->data;
|
2002-02-27 22:25:47 +01:00
|
|
|
FT_Byte* p = table + 8204;
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_UInt32 num_groups = TT_NEXT_ULONG( p );
|
2002-07-01 23:50:12 +02:00
|
|
|
FT_UInt32 start, end, start_id;
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2015-09-24 12:39:38 +02:00
|
|
|
if ( *pchar_code >= 0xFFFFFFFFUL )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
char_code = *pchar_code + 1;
|
|
|
|
|
2002-02-27 22:25:47 +01:00
|
|
|
p = table + 8208;
|
|
|
|
|
2002-07-01 23:50:12 +02:00
|
|
|
for ( ; num_groups > 0; num_groups-- )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
start = TT_NEXT_ULONG( p );
|
|
|
|
end = TT_NEXT_ULONG( p );
|
|
|
|
start_id = TT_NEXT_ULONG( p );
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
if ( char_code < start )
|
|
|
|
char_code = start;
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2015-09-24 12:39:38 +02:00
|
|
|
Again:
|
2002-02-22 19:28:11 +01:00
|
|
|
if ( char_code <= end )
|
|
|
|
{
|
2015-09-24 12:39:38 +02:00
|
|
|
/* ignore invalid group */
|
|
|
|
if ( start_id > 0xFFFFFFFFUL - ( char_code - start ) )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
gindex = (FT_UInt)( start_id + ( char_code - start ) );
|
|
|
|
|
|
|
|
/* does first element of group point to `.notdef' glyph? */
|
|
|
|
if ( gindex == 0 )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2015-09-24 12:39:38 +02:00
|
|
|
if ( char_code >= 0xFFFFFFFFUL )
|
|
|
|
break;
|
|
|
|
|
|
|
|
char_code++;
|
|
|
|
goto Again;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
2015-09-24 12:39:38 +02:00
|
|
|
|
2015-09-24 13:39:44 +02:00
|
|
|
/* if `gindex' is invalid, the remaining values */
|
|
|
|
/* in this group are invalid, too */
|
|
|
|
if ( gindex >= (FT_UInt)face->num_glyphs )
|
2015-10-10 13:34:11 +02:00
|
|
|
{
|
|
|
|
gindex = 0;
|
2015-09-24 13:39:44 +02:00
|
|
|
continue;
|
2015-10-10 13:34:11 +02:00
|
|
|
}
|
2015-09-24 13:39:44 +02:00
|
|
|
|
2015-09-24 12:39:38 +02:00
|
|
|
result = char_code;
|
|
|
|
break;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
}
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2002-03-22 16:02:38 +01:00
|
|
|
*pchar_code = result;
|
|
|
|
return gindex;
|
2002-02-27 22:25:47 +01:00
|
|
|
}
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
|
2003-12-17 15:28:22 +01:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
|
|
tt_cmap8_get_info( TT_CMap cmap,
|
|
|
|
TT_CMapInfo *cmap_info )
|
|
|
|
{
|
|
|
|
FT_Byte* p = cmap->data + 8;
|
|
|
|
|
|
|
|
|
2009-04-04 07:42:38 +02:00
|
|
|
cmap_info->format = 8;
|
2003-12-17 15:28:22 +01:00
|
|
|
cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
|
* include/freetype/internal/ftobjs.h: Don't include
FT_CONFIG_STANDARD_LIBRARY_H.
(FT_Validator, FT_VAlidationLevel, FT_ValidatorRec, FT_VALIDATOR,
ft_validator_init, ft_validator_run, ft_validator_error, FT_INVALID,
FT_INVALID_TOO_SHORT, FT_INVALID_OFFSET, FT_INVALID_FORMAT,
FT_INVALID_GLYPH_ID, FT_INVALID_DATA): Move to...
* include/freetype/internal/ftvalid.h: New file.
Make FT_INVALID return module-specific error codes.
* include/freetype/internal/internal.h (FT_INTERNAL_VALIDATE_H): New
macro.
* include/freetype/fterrors.h: Undefine FT_ERR_PREFIX only if
FT_KEEP_ERR_PREFIX isn't defined.
* src/base/ftobjs.c: Include FT_INTERNAL_VALIDATE_H.
* src/sfnt/ttcmap.h: Don't include FT_INTERNAL_OBJECTS_H but
FT_INTERNAL_VALIDATE_H.
* src/sfnt/ttcmap.c: Don't include FT_INTERNAL_OBJECTS_H but
FT_INTERNAL_VALIDATE_H.
Include sferrors.h before FT_INTERNAL_VALIDATE_H.
s/FT_Err_Ok/SFNT_Err_Ok/.
* src/sfnt/sferrors.h: Define FT_KEEP_ERR_PREFIX.
* src/type1/t1afm.c: Include t1errors.h.
2004-09-06 09:06:56 +02:00
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2003-12-17 15:28:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_DEFINE_TT_CMAP(
|
|
|
|
tt_cmap8_class_rec,
|
2002-03-01 03:26:22 +01:00
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
sizeof ( TT_CMapRec ),
|
2012-08-24 13:41:24 +02:00
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
(FT_CMap_InitFunc) tt_cmap_init, /* init */
|
|
|
|
(FT_CMap_DoneFunc) NULL, /* done */
|
|
|
|
(FT_CMap_CharIndexFunc)tt_cmap8_char_index, /* char_index */
|
|
|
|
(FT_CMap_CharNextFunc) tt_cmap8_char_next, /* char_next */
|
|
|
|
|
|
|
|
(FT_CMap_CharVarIndexFunc) NULL, /* char_var_index */
|
|
|
|
(FT_CMap_CharVarIsDefaultFunc)NULL, /* char_var_default */
|
|
|
|
(FT_CMap_VariantListFunc) NULL, /* variant_list */
|
|
|
|
(FT_CMap_CharVariantListFunc) NULL, /* charvariant_list */
|
|
|
|
(FT_CMap_VariantCharListFunc) NULL, /* variantchar_list */
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
8,
|
2016-09-17 17:12:50 +02:00
|
|
|
(TT_CMap_ValidateFunc)tt_cmap8_validate, /* validate */
|
|
|
|
(TT_CMap_Info_GetFunc)tt_cmap8_get_info /* get_cmap_info */
|
|
|
|
)
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
#endif /* TT_CONFIG_CMAP_FORMAT_8 */
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** FORMAT 10 *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2018-06-03 09:01:17 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* TABLE OVERVIEW
|
|
|
|
* --------------
|
|
|
|
*
|
|
|
|
* NAME OFFSET TYPE DESCRIPTION
|
|
|
|
*
|
|
|
|
* format 0 USHORT must be 10
|
|
|
|
* reserved 2 USHORT reserved
|
|
|
|
* length 4 ULONG length in bytes
|
|
|
|
* language 8 ULONG Mac language code
|
|
|
|
*
|
|
|
|
* start 12 ULONG first char in range
|
|
|
|
* count 16 ULONG number of chars in range
|
|
|
|
* glyphIds 20 USHORT[count] glyph indices covered
|
|
|
|
*/
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
#ifdef TT_CONFIG_CMAP_FORMAT_10
|
|
|
|
|
2005-05-10 00:11:36 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2002-02-22 19:28:11 +01:00
|
|
|
tt_cmap10_validate( FT_Byte* table,
|
|
|
|
FT_Validator valid )
|
|
|
|
{
|
2002-02-27 22:25:47 +01:00
|
|
|
FT_Byte* p = table + 4;
|
2003-04-23 21:48:24 +02:00
|
|
|
FT_ULong length, count;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
if ( table + 20 > valid->limit )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_TOO_SHORT;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
length = TT_NEXT_ULONG( p );
|
2003-04-23 21:48:24 +02:00
|
|
|
p = table + 16;
|
2002-03-31 20:48:24 +02:00
|
|
|
count = TT_NEXT_ULONG( p );
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2009-03-20 08:03:58 +01:00
|
|
|
if ( length > (FT_ULong)( valid->limit - table ) ||
|
2014-11-12 20:51:20 +01:00
|
|
|
/* length < 20 + count * 2 ? */
|
|
|
|
length < 20 ||
|
|
|
|
( length - 20 ) / 2 < count )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_TOO_SHORT;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
/* check glyph indices */
|
|
|
|
if ( valid->level >= FT_VALIDATE_TIGHT )
|
|
|
|
{
|
|
|
|
FT_UInt gindex;
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
for ( ; count > 0; count-- )
|
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
gindex = TT_NEXT_USHORT( p );
|
|
|
|
if ( gindex >= TT_VALID_GLYPH_COUNT( valid ) )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_GLYPH_ID;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
}
|
2005-05-10 00:11:36 +02:00
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_CALLBACK_DEF( FT_UInt )
|
2002-03-01 03:26:22 +01:00
|
|
|
tt_cmap10_char_index( TT_CMap cmap,
|
|
|
|
FT_UInt32 char_code )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_Byte* table = cmap->data;
|
|
|
|
FT_UInt result = 0;
|
|
|
|
FT_Byte* p = table + 12;
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_UInt32 start = TT_NEXT_ULONG( p );
|
|
|
|
FT_UInt32 count = TT_NEXT_ULONG( p );
|
2015-09-24 12:39:38 +02:00
|
|
|
FT_UInt32 idx;
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2015-09-24 12:39:38 +02:00
|
|
|
if ( char_code < start )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
idx = char_code - start;
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
if ( idx < count )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
p += 2 * idx;
|
|
|
|
result = TT_PEEK_USHORT( p );
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
2015-09-24 12:39:38 +02:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-31 17:32:09 +02:00
|
|
|
FT_CALLBACK_DEF( FT_UInt32 )
|
2002-03-01 03:26:22 +01:00
|
|
|
tt_cmap10_char_next( TT_CMap cmap,
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_UInt32 *pchar_code )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_Byte* table = cmap->data;
|
2015-09-24 12:39:38 +02:00
|
|
|
FT_UInt32 char_code;
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_UInt gindex = 0;
|
|
|
|
FT_Byte* p = table + 12;
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_UInt32 start = TT_NEXT_ULONG( p );
|
|
|
|
FT_UInt32 count = TT_NEXT_ULONG( p );
|
|
|
|
FT_UInt32 idx;
|
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2015-09-24 12:39:38 +02:00
|
|
|
if ( *pchar_code >= 0xFFFFFFFFUL )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
char_code = *pchar_code + 1;
|
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
if ( char_code < start )
|
|
|
|
char_code = start;
|
|
|
|
|
2015-09-24 12:39:38 +02:00
|
|
|
idx = char_code - start;
|
2002-03-31 20:48:24 +02:00
|
|
|
p += 2 * idx;
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
for ( ; idx < count; idx++ )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
gindex = TT_NEXT_USHORT( p );
|
2002-02-22 19:28:11 +01:00
|
|
|
if ( gindex != 0 )
|
|
|
|
break;
|
2015-09-24 12:39:38 +02:00
|
|
|
|
|
|
|
if ( char_code >= 0xFFFFFFFFUL )
|
|
|
|
return 0;
|
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
char_code++;
|
|
|
|
}
|
|
|
|
|
2002-03-22 16:02:38 +01:00
|
|
|
*pchar_code = char_code;
|
|
|
|
return gindex;
|
2002-02-22 19:28:11 +01:00
|
|
|
}
|
|
|
|
|
2002-02-28 17:10:29 +01:00
|
|
|
|
2003-12-17 15:28:22 +01:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
|
|
tt_cmap10_get_info( TT_CMap cmap,
|
|
|
|
TT_CMapInfo *cmap_info )
|
|
|
|
{
|
|
|
|
FT_Byte* p = cmap->data + 8;
|
|
|
|
|
|
|
|
|
2009-04-04 07:42:38 +02:00
|
|
|
cmap_info->format = 10;
|
2003-12-17 15:28:22 +01:00
|
|
|
cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
|
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2003-12-17 15:28:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_DEFINE_TT_CMAP(
|
|
|
|
tt_cmap10_class_rec,
|
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
sizeof ( TT_CMapRec ),
|
|
|
|
|
|
|
|
(FT_CMap_InitFunc) tt_cmap_init, /* init */
|
|
|
|
(FT_CMap_DoneFunc) NULL, /* done */
|
|
|
|
(FT_CMap_CharIndexFunc)tt_cmap10_char_index, /* char_index */
|
|
|
|
(FT_CMap_CharNextFunc) tt_cmap10_char_next, /* char_next */
|
2002-03-01 03:26:22 +01:00
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
(FT_CMap_CharVarIndexFunc) NULL, /* char_var_index */
|
|
|
|
(FT_CMap_CharVarIsDefaultFunc)NULL, /* char_var_default */
|
|
|
|
(FT_CMap_VariantListFunc) NULL, /* variant_list */
|
|
|
|
(FT_CMap_CharVariantListFunc) NULL, /* charvariant_list */
|
|
|
|
(FT_CMap_VariantCharListFunc) NULL, /* variantchar_list */
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
10,
|
2016-09-17 17:12:50 +02:00
|
|
|
(TT_CMap_ValidateFunc)tt_cmap10_validate, /* validate */
|
|
|
|
(TT_CMap_Info_GetFunc)tt_cmap10_get_info /* get_cmap_info */
|
|
|
|
)
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
#endif /* TT_CONFIG_CMAP_FORMAT_10 */
|
|
|
|
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** FORMAT 12 *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2018-06-03 09:01:17 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* TABLE OVERVIEW
|
|
|
|
* --------------
|
|
|
|
*
|
|
|
|
* NAME OFFSET TYPE DESCRIPTION
|
|
|
|
*
|
|
|
|
* format 0 USHORT must be 12
|
|
|
|
* reserved 2 USHORT reserved
|
|
|
|
* length 4 ULONG length in bytes
|
|
|
|
* language 8 ULONG Mac language code
|
|
|
|
* count 12 ULONG number of groups
|
|
|
|
* 16
|
|
|
|
*
|
|
|
|
* This header is followed by `count' groups of the following format:
|
|
|
|
*
|
|
|
|
* start 0 ULONG first charcode
|
|
|
|
* end 4 ULONG last charcode
|
|
|
|
* startId 8 ULONG start glyph ID for the group
|
|
|
|
*/
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
#ifdef TT_CONFIG_CMAP_FORMAT_12
|
|
|
|
|
2005-11-29 12:27:51 +01:00
|
|
|
typedef struct TT_CMap12Rec_
|
|
|
|
{
|
|
|
|
TT_CMapRec cmap;
|
|
|
|
FT_Bool valid;
|
|
|
|
FT_ULong cur_charcode;
|
|
|
|
FT_UInt cur_gindex;
|
|
|
|
FT_ULong cur_group;
|
|
|
|
FT_ULong num_groups;
|
|
|
|
|
|
|
|
} TT_CMap12Rec, *TT_CMap12;
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
|
|
tt_cmap12_init( TT_CMap12 cmap,
|
2005-11-30 19:47:49 +01:00
|
|
|
FT_Byte* table )
|
2005-11-29 12:27:51 +01:00
|
|
|
{
|
2005-11-30 19:47:49 +01:00
|
|
|
cmap->cmap.data = table;
|
2005-11-29 12:27:51 +01:00
|
|
|
|
2005-11-30 19:47:49 +01:00
|
|
|
table += 12;
|
|
|
|
cmap->num_groups = FT_PEEK_ULONG( table );
|
2005-11-29 12:27:51 +01:00
|
|
|
|
2005-11-30 19:47:49 +01:00
|
|
|
cmap->valid = 0;
|
2005-11-29 12:27:51 +01:00
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2005-11-29 12:27:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-05-10 00:11:36 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2002-02-22 19:28:11 +01:00
|
|
|
tt_cmap12_validate( FT_Byte* table,
|
|
|
|
FT_Validator valid )
|
|
|
|
{
|
2014-02-26 19:50:18 +01:00
|
|
|
FT_Byte* p;
|
|
|
|
FT_ULong length;
|
|
|
|
FT_ULong num_groups;
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-02-27 22:25:47 +01:00
|
|
|
if ( table + 16 > valid->limit )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_TOO_SHORT;
|
2002-02-27 22:25:47 +01:00
|
|
|
|
|
|
|
p = table + 4;
|
2002-03-31 20:48:24 +02:00
|
|
|
length = TT_NEXT_ULONG( p );
|
2002-02-27 22:25:47 +01:00
|
|
|
|
|
|
|
p = table + 12;
|
2002-03-31 20:48:24 +02:00
|
|
|
num_groups = TT_NEXT_ULONG( p );
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2009-03-20 08:03:58 +01:00
|
|
|
if ( length > (FT_ULong)( valid->limit - table ) ||
|
2014-11-12 20:51:20 +01:00
|
|
|
/* length < 16 + 12 * num_groups ? */
|
|
|
|
length < 16 ||
|
|
|
|
( length - 16 ) / 12 < num_groups )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_TOO_SHORT;
|
2002-02-27 22:25:47 +01:00
|
|
|
|
|
|
|
/* check groups, they must be in increasing order */
|
|
|
|
{
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_ULong n, start, end, start_id, last = 0;
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-02-27 22:25:47 +01:00
|
|
|
for ( n = 0; n < num_groups; n++ )
|
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
start = TT_NEXT_ULONG( p );
|
|
|
|
end = TT_NEXT_ULONG( p );
|
|
|
|
start_id = TT_NEXT_ULONG( p );
|
2002-02-27 22:25:47 +01:00
|
|
|
|
|
|
|
if ( start > end )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_DATA;
|
2002-02-27 22:25:47 +01:00
|
|
|
|
|
|
|
if ( n > 0 && start <= last )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_DATA;
|
2002-02-27 22:25:47 +01:00
|
|
|
|
|
|
|
if ( valid->level >= FT_VALIDATE_TIGHT )
|
|
|
|
{
|
2014-11-12 20:51:20 +01:00
|
|
|
FT_UInt32 d = end - start;
|
|
|
|
|
|
|
|
|
|
|
|
/* start_id + end - start >= TT_VALID_GLYPH_COUNT( valid ) ? */
|
|
|
|
if ( d > TT_VALID_GLYPH_COUNT( valid ) ||
|
|
|
|
start_id >= TT_VALID_GLYPH_COUNT( valid ) - d )
|
2002-03-22 16:02:38 +01:00
|
|
|
FT_INVALID_GLYPH_ID;
|
2002-02-27 22:25:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
last = end;
|
|
|
|
}
|
|
|
|
}
|
2005-05-10 00:11:36 +02:00
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2002-02-27 22:25:47 +01:00
|
|
|
}
|
|
|
|
|
2002-02-22 19:28:11 +01:00
|
|
|
|
2005-11-30 19:47:49 +01:00
|
|
|
/* search the index of the charcode next to cmap->cur_charcode */
|
|
|
|
/* cmap->cur_group should be set up properly by caller */
|
|
|
|
/* */
|
2005-11-29 12:27:51 +01:00
|
|
|
static void
|
|
|
|
tt_cmap12_next( TT_CMap12 cmap )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2015-09-24 13:39:44 +02:00
|
|
|
FT_Face face = cmap->cmap.cmap.charmap.face;
|
2005-11-29 12:27:51 +01:00
|
|
|
FT_Byte* p;
|
|
|
|
FT_ULong start, end, start_id, char_code;
|
|
|
|
FT_ULong n;
|
|
|
|
FT_UInt gindex;
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2005-11-29 12:27:51 +01:00
|
|
|
if ( cmap->cur_charcode >= 0xFFFFFFFFUL )
|
|
|
|
goto Fail;
|
|
|
|
|
|
|
|
char_code = cmap->cur_charcode + 1;
|
|
|
|
|
|
|
|
for ( n = cmap->cur_group; n < cmap->num_groups; n++ )
|
2002-02-27 22:25:47 +01:00
|
|
|
{
|
2005-11-29 12:27:51 +01:00
|
|
|
p = cmap->cmap.data + 16 + 12 * n;
|
2002-03-31 20:48:24 +02:00
|
|
|
start = TT_NEXT_ULONG( p );
|
|
|
|
end = TT_NEXT_ULONG( p );
|
2005-11-29 12:27:51 +01:00
|
|
|
start_id = TT_PEEK_ULONG( p );
|
2002-02-27 22:25:47 +01:00
|
|
|
|
|
|
|
if ( char_code < start )
|
2005-11-29 12:27:51 +01:00
|
|
|
char_code = start;
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2015-09-24 12:39:38 +02:00
|
|
|
Again:
|
|
|
|
if ( char_code <= end )
|
2002-02-27 22:25:47 +01:00
|
|
|
{
|
2015-09-24 12:39:38 +02:00
|
|
|
/* ignore invalid group */
|
|
|
|
if ( start_id > 0xFFFFFFFFUL - ( char_code - start ) )
|
|
|
|
continue;
|
2005-11-29 12:27:51 +01:00
|
|
|
|
2015-09-24 12:39:38 +02:00
|
|
|
gindex = (FT_UInt)( start_id + ( char_code - start ) );
|
|
|
|
|
|
|
|
/* does first element of group point to `.notdef' glyph? */
|
|
|
|
if ( gindex == 0 )
|
2005-11-29 12:27:51 +01:00
|
|
|
{
|
2015-09-24 12:39:38 +02:00
|
|
|
if ( char_code >= 0xFFFFFFFFUL )
|
|
|
|
goto Fail;
|
2005-11-29 12:27:51 +01:00
|
|
|
|
2015-09-24 12:39:38 +02:00
|
|
|
char_code++;
|
|
|
|
goto Again;
|
2005-11-29 12:27:51 +01:00
|
|
|
}
|
2015-09-24 12:39:38 +02:00
|
|
|
|
2015-09-24 13:39:44 +02:00
|
|
|
/* if `gindex' is invalid, the remaining values */
|
|
|
|
/* in this group are invalid, too */
|
|
|
|
if ( gindex >= (FT_UInt)face->num_glyphs )
|
|
|
|
continue;
|
|
|
|
|
2015-09-24 12:39:38 +02:00
|
|
|
cmap->cur_charcode = char_code;
|
|
|
|
cmap->cur_gindex = gindex;
|
|
|
|
cmap->cur_group = n;
|
|
|
|
|
|
|
|
return;
|
2002-02-27 22:25:47 +01:00
|
|
|
}
|
|
|
|
}
|
2005-11-29 12:27:51 +01:00
|
|
|
|
|
|
|
Fail:
|
|
|
|
cmap->valid = 0;
|
2002-02-27 22:25:47 +01:00
|
|
|
}
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
|
2005-11-29 12:27:51 +01:00
|
|
|
static FT_UInt
|
|
|
|
tt_cmap12_char_map_binary( TT_CMap cmap,
|
|
|
|
FT_UInt32* pchar_code,
|
|
|
|
FT_Bool next )
|
2002-02-22 19:28:11 +01:00
|
|
|
{
|
2002-02-27 22:25:47 +01:00
|
|
|
FT_UInt gindex = 0;
|
2005-11-29 12:27:51 +01:00
|
|
|
FT_Byte* p = cmap->data + 12;
|
|
|
|
FT_UInt32 num_groups = TT_PEEK_ULONG( p );
|
|
|
|
FT_UInt32 char_code = *pchar_code;
|
2002-07-01 23:50:12 +02:00
|
|
|
FT_UInt32 start, end, start_id;
|
2005-11-29 12:27:51 +01:00
|
|
|
FT_UInt32 max, min, mid;
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2005-11-29 12:27:51 +01:00
|
|
|
if ( !num_groups )
|
|
|
|
return 0;
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2005-11-30 03:39:10 +01:00
|
|
|
/* make compiler happy */
|
|
|
|
mid = num_groups;
|
|
|
|
end = 0xFFFFFFFFUL;
|
|
|
|
|
2005-11-29 12:27:51 +01:00
|
|
|
if ( next )
|
2015-09-24 12:39:38 +02:00
|
|
|
{
|
|
|
|
if ( char_code >= 0xFFFFFFFFUL )
|
|
|
|
return 0;
|
|
|
|
|
2005-11-29 12:27:51 +01:00
|
|
|
char_code++;
|
2015-09-24 12:39:38 +02:00
|
|
|
}
|
2005-11-29 12:27:51 +01:00
|
|
|
|
|
|
|
min = 0;
|
|
|
|
max = num_groups;
|
|
|
|
|
|
|
|
/* binary search */
|
|
|
|
while ( min < max )
|
2002-02-27 22:25:47 +01:00
|
|
|
{
|
2005-11-29 12:27:51 +01:00
|
|
|
mid = ( min + max ) >> 1;
|
2005-11-30 19:47:49 +01:00
|
|
|
p = cmap->data + 16 + 12 * mid;
|
2005-11-29 12:27:51 +01:00
|
|
|
|
2005-11-30 19:47:49 +01:00
|
|
|
start = TT_NEXT_ULONG( p );
|
|
|
|
end = TT_NEXT_ULONG( p );
|
2002-02-27 22:25:47 +01:00
|
|
|
|
|
|
|
if ( char_code < start )
|
2005-11-29 12:27:51 +01:00
|
|
|
max = mid;
|
|
|
|
else if ( char_code > end )
|
|
|
|
min = mid + 1;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
start_id = TT_PEEK_ULONG( p );
|
2002-02-27 22:25:47 +01:00
|
|
|
|
2015-09-24 12:39:38 +02:00
|
|
|
/* reject invalid glyph index */
|
|
|
|
if ( start_id > 0xFFFFFFFFUL - ( char_code - start ) )
|
|
|
|
gindex = 0;
|
|
|
|
else
|
|
|
|
gindex = (FT_UInt)( start_id + ( char_code - start ) );
|
2005-11-29 12:27:51 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( next )
|
|
|
|
{
|
2015-09-24 13:39:44 +02:00
|
|
|
FT_Face face = cmap->cmap.charmap.face;
|
2005-11-29 12:27:51 +01:00
|
|
|
TT_CMap12 cmap12 = (TT_CMap12)cmap;
|
|
|
|
|
|
|
|
|
|
|
|
/* if `char_code' is not in any group, then `mid' is */
|
|
|
|
/* the group nearest to `char_code' */
|
|
|
|
|
|
|
|
if ( char_code > end )
|
2002-02-27 22:25:47 +01:00
|
|
|
{
|
2005-11-29 12:27:51 +01:00
|
|
|
mid++;
|
|
|
|
if ( mid == num_groups )
|
|
|
|
return 0;
|
2002-02-27 22:25:47 +01:00
|
|
|
}
|
2005-11-29 12:27:51 +01:00
|
|
|
|
2005-11-30 19:47:49 +01:00
|
|
|
cmap12->valid = 1;
|
2005-11-29 12:27:51 +01:00
|
|
|
cmap12->cur_charcode = char_code;
|
2005-11-30 19:47:49 +01:00
|
|
|
cmap12->cur_group = mid;
|
2005-11-29 12:27:51 +01:00
|
|
|
|
2015-09-24 13:39:44 +02:00
|
|
|
if ( gindex >= (FT_UInt)face->num_glyphs )
|
|
|
|
gindex = 0;
|
|
|
|
|
2005-11-29 12:27:51 +01:00
|
|
|
if ( !gindex )
|
|
|
|
{
|
|
|
|
tt_cmap12_next( cmap12 );
|
|
|
|
|
|
|
|
if ( cmap12->valid )
|
|
|
|
gindex = cmap12->cur_gindex;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
cmap12->cur_gindex = gindex;
|
|
|
|
|
2015-09-24 12:39:38 +02:00
|
|
|
*pchar_code = cmap12->cur_charcode;
|
2002-02-27 22:25:47 +01:00
|
|
|
}
|
|
|
|
|
2005-11-29 12:27:51 +01:00
|
|
|
return gindex;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_UInt )
|
|
|
|
tt_cmap12_char_index( TT_CMap cmap,
|
|
|
|
FT_UInt32 char_code )
|
|
|
|
{
|
|
|
|
return tt_cmap12_char_map_binary( cmap, &char_code, 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-31 17:32:09 +02:00
|
|
|
FT_CALLBACK_DEF( FT_UInt32 )
|
2005-11-29 12:27:51 +01:00
|
|
|
tt_cmap12_char_next( TT_CMap cmap,
|
|
|
|
FT_UInt32 *pchar_code )
|
|
|
|
{
|
|
|
|
TT_CMap12 cmap12 = (TT_CMap12)cmap;
|
2015-09-24 12:39:38 +02:00
|
|
|
FT_UInt gindex;
|
2005-11-29 12:27:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* no need to search */
|
|
|
|
if ( cmap12->valid && cmap12->cur_charcode == *pchar_code )
|
|
|
|
{
|
|
|
|
tt_cmap12_next( cmap12 );
|
|
|
|
if ( cmap12->valid )
|
|
|
|
{
|
2015-09-24 12:39:38 +02:00
|
|
|
gindex = cmap12->cur_gindex;
|
|
|
|
*pchar_code = (FT_UInt32)cmap12->cur_charcode;
|
2005-11-29 12:27:51 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
gindex = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
gindex = tt_cmap12_char_map_binary( cmap, pchar_code, 1 );
|
|
|
|
|
2015-09-24 12:39:38 +02:00
|
|
|
return gindex;
|
2002-02-27 22:25:47 +01:00
|
|
|
}
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
|
2003-12-17 15:28:22 +01:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
|
|
tt_cmap12_get_info( TT_CMap cmap,
|
|
|
|
TT_CMapInfo *cmap_info )
|
|
|
|
{
|
|
|
|
FT_Byte* p = cmap->data + 8;
|
|
|
|
|
|
|
|
|
2009-04-04 07:42:38 +02:00
|
|
|
cmap_info->format = 12;
|
2003-12-17 15:28:22 +01:00
|
|
|
cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
|
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2003-12-17 15:28:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_DEFINE_TT_CMAP(
|
|
|
|
tt_cmap12_class_rec,
|
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
sizeof ( TT_CMap12Rec ),
|
|
|
|
|
|
|
|
(FT_CMap_InitFunc) tt_cmap12_init, /* init */
|
|
|
|
(FT_CMap_DoneFunc) NULL, /* done */
|
|
|
|
(FT_CMap_CharIndexFunc)tt_cmap12_char_index, /* char_index */
|
|
|
|
(FT_CMap_CharNextFunc) tt_cmap12_char_next, /* char_next */
|
2002-03-01 03:26:22 +01:00
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
(FT_CMap_CharVarIndexFunc) NULL, /* char_var_index */
|
|
|
|
(FT_CMap_CharVarIsDefaultFunc)NULL, /* char_var_default */
|
|
|
|
(FT_CMap_VariantListFunc) NULL, /* variant_list */
|
|
|
|
(FT_CMap_CharVariantListFunc) NULL, /* charvariant_list */
|
|
|
|
(FT_CMap_VariantCharListFunc) NULL, /* variantchar_list */
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
12,
|
2016-09-17 17:12:50 +02:00
|
|
|
(TT_CMap_ValidateFunc)tt_cmap12_validate, /* validate */
|
|
|
|
(TT_CMap_Info_GetFunc)tt_cmap12_get_info /* get_cmap_info */
|
|
|
|
)
|
2002-02-22 19:28:11 +01:00
|
|
|
|
|
|
|
#endif /* TT_CONFIG_CMAP_FORMAT_12 */
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
|
2009-04-04 07:42:38 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** FORMAT 13 *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2018-06-03 09:01:17 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* TABLE OVERVIEW
|
|
|
|
* --------------
|
|
|
|
*
|
|
|
|
* NAME OFFSET TYPE DESCRIPTION
|
|
|
|
*
|
|
|
|
* format 0 USHORT must be 13
|
|
|
|
* reserved 2 USHORT reserved
|
|
|
|
* length 4 ULONG length in bytes
|
|
|
|
* language 8 ULONG Mac language code
|
|
|
|
* count 12 ULONG number of groups
|
|
|
|
* 16
|
|
|
|
*
|
|
|
|
* This header is followed by `count' groups of the following format:
|
|
|
|
*
|
|
|
|
* start 0 ULONG first charcode
|
|
|
|
* end 4 ULONG last charcode
|
|
|
|
* glyphId 8 ULONG glyph ID for the whole group
|
|
|
|
*/
|
2009-04-04 07:42:38 +02:00
|
|
|
|
|
|
|
#ifdef TT_CONFIG_CMAP_FORMAT_13
|
|
|
|
|
|
|
|
typedef struct TT_CMap13Rec_
|
|
|
|
{
|
|
|
|
TT_CMapRec cmap;
|
|
|
|
FT_Bool valid;
|
|
|
|
FT_ULong cur_charcode;
|
|
|
|
FT_UInt cur_gindex;
|
|
|
|
FT_ULong cur_group;
|
|
|
|
FT_ULong num_groups;
|
|
|
|
|
|
|
|
} TT_CMap13Rec, *TT_CMap13;
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
|
|
tt_cmap13_init( TT_CMap13 cmap,
|
|
|
|
FT_Byte* table )
|
|
|
|
{
|
|
|
|
cmap->cmap.data = table;
|
|
|
|
|
|
|
|
table += 12;
|
|
|
|
cmap->num_groups = FT_PEEK_ULONG( table );
|
|
|
|
|
|
|
|
cmap->valid = 0;
|
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2009-04-04 07:42:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
|
|
tt_cmap13_validate( FT_Byte* table,
|
|
|
|
FT_Validator valid )
|
|
|
|
{
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_Byte* p;
|
|
|
|
FT_ULong length;
|
|
|
|
FT_ULong num_groups;
|
2009-04-04 07:42:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
if ( table + 16 > valid->limit )
|
|
|
|
FT_INVALID_TOO_SHORT;
|
|
|
|
|
|
|
|
p = table + 4;
|
|
|
|
length = TT_NEXT_ULONG( p );
|
|
|
|
|
|
|
|
p = table + 12;
|
|
|
|
num_groups = TT_NEXT_ULONG( p );
|
|
|
|
|
|
|
|
if ( length > (FT_ULong)( valid->limit - table ) ||
|
2014-11-12 20:51:20 +01:00
|
|
|
/* length < 16 + 12 * num_groups ? */
|
|
|
|
length < 16 ||
|
|
|
|
( length - 16 ) / 12 < num_groups )
|
2009-04-04 07:42:38 +02:00
|
|
|
FT_INVALID_TOO_SHORT;
|
|
|
|
|
|
|
|
/* check groups, they must be in increasing order */
|
|
|
|
{
|
|
|
|
FT_ULong n, start, end, glyph_id, last = 0;
|
|
|
|
|
|
|
|
|
|
|
|
for ( n = 0; n < num_groups; n++ )
|
|
|
|
{
|
|
|
|
start = TT_NEXT_ULONG( p );
|
|
|
|
end = TT_NEXT_ULONG( p );
|
|
|
|
glyph_id = TT_NEXT_ULONG( p );
|
|
|
|
|
|
|
|
if ( start > end )
|
|
|
|
FT_INVALID_DATA;
|
|
|
|
|
|
|
|
if ( n > 0 && start <= last )
|
|
|
|
FT_INVALID_DATA;
|
|
|
|
|
|
|
|
if ( valid->level >= FT_VALIDATE_TIGHT )
|
|
|
|
{
|
|
|
|
if ( glyph_id >= TT_VALID_GLYPH_COUNT( valid ) )
|
|
|
|
FT_INVALID_GLYPH_ID;
|
|
|
|
}
|
|
|
|
|
|
|
|
last = end;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2009-04-04 07:42:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* search the index of the charcode next to cmap->cur_charcode */
|
|
|
|
/* cmap->cur_group should be set up properly by caller */
|
|
|
|
/* */
|
|
|
|
static void
|
|
|
|
tt_cmap13_next( TT_CMap13 cmap )
|
|
|
|
{
|
2015-09-24 13:39:44 +02:00
|
|
|
FT_Face face = cmap->cmap.cmap.charmap.face;
|
2009-04-04 07:42:38 +02:00
|
|
|
FT_Byte* p;
|
|
|
|
FT_ULong start, end, glyph_id, char_code;
|
|
|
|
FT_ULong n;
|
|
|
|
FT_UInt gindex;
|
|
|
|
|
|
|
|
|
|
|
|
if ( cmap->cur_charcode >= 0xFFFFFFFFUL )
|
|
|
|
goto Fail;
|
|
|
|
|
|
|
|
char_code = cmap->cur_charcode + 1;
|
|
|
|
|
|
|
|
for ( n = cmap->cur_group; n < cmap->num_groups; n++ )
|
|
|
|
{
|
|
|
|
p = cmap->cmap.data + 16 + 12 * n;
|
|
|
|
start = TT_NEXT_ULONG( p );
|
|
|
|
end = TT_NEXT_ULONG( p );
|
|
|
|
glyph_id = TT_PEEK_ULONG( p );
|
|
|
|
|
|
|
|
if ( char_code < start )
|
|
|
|
char_code = start;
|
|
|
|
|
|
|
|
if ( char_code <= end )
|
|
|
|
{
|
|
|
|
gindex = (FT_UInt)glyph_id;
|
|
|
|
|
2015-09-24 13:39:44 +02:00
|
|
|
if ( gindex && gindex < (FT_UInt)face->num_glyphs )
|
2009-04-04 07:42:38 +02:00
|
|
|
{
|
2015-09-24 12:14:38 +02:00
|
|
|
cmap->cur_charcode = char_code;
|
2009-04-04 07:42:38 +02:00
|
|
|
cmap->cur_gindex = gindex;
|
|
|
|
cmap->cur_group = n;
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Fail:
|
|
|
|
cmap->valid = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static FT_UInt
|
|
|
|
tt_cmap13_char_map_binary( TT_CMap cmap,
|
|
|
|
FT_UInt32* pchar_code,
|
|
|
|
FT_Bool next )
|
|
|
|
{
|
|
|
|
FT_UInt gindex = 0;
|
|
|
|
FT_Byte* p = cmap->data + 12;
|
|
|
|
FT_UInt32 num_groups = TT_PEEK_ULONG( p );
|
|
|
|
FT_UInt32 char_code = *pchar_code;
|
|
|
|
FT_UInt32 start, end;
|
|
|
|
FT_UInt32 max, min, mid;
|
|
|
|
|
|
|
|
|
|
|
|
if ( !num_groups )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* make compiler happy */
|
|
|
|
mid = num_groups;
|
|
|
|
end = 0xFFFFFFFFUL;
|
|
|
|
|
|
|
|
if ( next )
|
2015-09-24 12:39:38 +02:00
|
|
|
{
|
|
|
|
if ( char_code >= 0xFFFFFFFFUL )
|
|
|
|
return 0;
|
|
|
|
|
2009-04-04 07:42:38 +02:00
|
|
|
char_code++;
|
2015-09-24 12:39:38 +02:00
|
|
|
}
|
2009-04-04 07:42:38 +02:00
|
|
|
|
|
|
|
min = 0;
|
|
|
|
max = num_groups;
|
|
|
|
|
|
|
|
/* binary search */
|
|
|
|
while ( min < max )
|
|
|
|
{
|
|
|
|
mid = ( min + max ) >> 1;
|
|
|
|
p = cmap->data + 16 + 12 * mid;
|
|
|
|
|
|
|
|
start = TT_NEXT_ULONG( p );
|
|
|
|
end = TT_NEXT_ULONG( p );
|
|
|
|
|
|
|
|
if ( char_code < start )
|
|
|
|
max = mid;
|
|
|
|
else if ( char_code > end )
|
|
|
|
min = mid + 1;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gindex = (FT_UInt)TT_PEEK_ULONG( p );
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( next )
|
|
|
|
{
|
2015-09-24 13:39:44 +02:00
|
|
|
FT_Face face = cmap->cmap.charmap.face;
|
2009-04-04 07:42:38 +02:00
|
|
|
TT_CMap13 cmap13 = (TT_CMap13)cmap;
|
|
|
|
|
|
|
|
|
|
|
|
/* if `char_code' is not in any group, then `mid' is */
|
|
|
|
/* the group nearest to `char_code' */
|
|
|
|
|
|
|
|
if ( char_code > end )
|
|
|
|
{
|
|
|
|
mid++;
|
|
|
|
if ( mid == num_groups )
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
cmap13->valid = 1;
|
|
|
|
cmap13->cur_charcode = char_code;
|
|
|
|
cmap13->cur_group = mid;
|
|
|
|
|
2015-09-24 13:39:44 +02:00
|
|
|
if ( gindex >= (FT_UInt)face->num_glyphs )
|
|
|
|
gindex = 0;
|
|
|
|
|
2009-04-04 07:42:38 +02:00
|
|
|
if ( !gindex )
|
|
|
|
{
|
|
|
|
tt_cmap13_next( cmap13 );
|
|
|
|
|
|
|
|
if ( cmap13->valid )
|
|
|
|
gindex = cmap13->cur_gindex;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
cmap13->cur_gindex = gindex;
|
|
|
|
|
2015-09-24 12:39:38 +02:00
|
|
|
*pchar_code = cmap13->cur_charcode;
|
2009-04-04 07:42:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return gindex;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_UInt )
|
|
|
|
tt_cmap13_char_index( TT_CMap cmap,
|
|
|
|
FT_UInt32 char_code )
|
|
|
|
{
|
|
|
|
return tt_cmap13_char_map_binary( cmap, &char_code, 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-31 17:32:09 +02:00
|
|
|
FT_CALLBACK_DEF( FT_UInt32 )
|
2009-04-04 07:42:38 +02:00
|
|
|
tt_cmap13_char_next( TT_CMap cmap,
|
|
|
|
FT_UInt32 *pchar_code )
|
|
|
|
{
|
|
|
|
TT_CMap13 cmap13 = (TT_CMap13)cmap;
|
2009-07-31 17:37:57 +02:00
|
|
|
FT_UInt gindex;
|
2009-04-04 07:42:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* no need to search */
|
|
|
|
if ( cmap13->valid && cmap13->cur_charcode == *pchar_code )
|
|
|
|
{
|
|
|
|
tt_cmap13_next( cmap13 );
|
|
|
|
if ( cmap13->valid )
|
|
|
|
{
|
2015-09-24 12:39:38 +02:00
|
|
|
gindex = cmap13->cur_gindex;
|
|
|
|
*pchar_code = cmap13->cur_charcode;
|
2009-04-04 07:42:38 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
gindex = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
gindex = tt_cmap13_char_map_binary( cmap, pchar_code, 1 );
|
|
|
|
|
|
|
|
return gindex;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
|
|
tt_cmap13_get_info( TT_CMap cmap,
|
|
|
|
TT_CMapInfo *cmap_info )
|
|
|
|
{
|
|
|
|
FT_Byte* p = cmap->data + 8;
|
|
|
|
|
|
|
|
|
|
|
|
cmap_info->format = 13;
|
|
|
|
cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
|
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2009-04-04 07:42:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_DEFINE_TT_CMAP(
|
|
|
|
tt_cmap13_class_rec,
|
2009-04-04 07:42:38 +02:00
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
sizeof ( TT_CMap13Rec ),
|
2012-08-24 13:41:24 +02:00
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
(FT_CMap_InitFunc) tt_cmap13_init, /* init */
|
|
|
|
(FT_CMap_DoneFunc) NULL, /* done */
|
|
|
|
(FT_CMap_CharIndexFunc)tt_cmap13_char_index, /* char_index */
|
|
|
|
(FT_CMap_CharNextFunc) tt_cmap13_char_next, /* char_next */
|
|
|
|
|
|
|
|
(FT_CMap_CharVarIndexFunc) NULL, /* char_var_index */
|
|
|
|
(FT_CMap_CharVarIsDefaultFunc)NULL, /* char_var_default */
|
|
|
|
(FT_CMap_VariantListFunc) NULL, /* variant_list */
|
|
|
|
(FT_CMap_CharVariantListFunc) NULL, /* charvariant_list */
|
|
|
|
(FT_CMap_VariantCharListFunc) NULL, /* variantchar_list */
|
2009-04-04 07:42:38 +02:00
|
|
|
|
|
|
|
13,
|
2016-09-17 17:12:50 +02:00
|
|
|
(TT_CMap_ValidateFunc)tt_cmap13_validate, /* validate */
|
|
|
|
(TT_CMap_Info_GetFunc)tt_cmap13_get_info /* get_cmap_info */
|
|
|
|
)
|
2009-04-04 07:42:38 +02:00
|
|
|
|
|
|
|
#endif /* TT_CONFIG_CMAP_FORMAT_13 */
|
|
|
|
|
|
|
|
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** FORMAT 14 *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2018-06-03 09:01:17 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* TABLE OVERVIEW
|
|
|
|
* --------------
|
|
|
|
*
|
|
|
|
* NAME OFFSET TYPE DESCRIPTION
|
|
|
|
*
|
|
|
|
* format 0 USHORT must be 14
|
|
|
|
* length 2 ULONG table length in bytes
|
|
|
|
* numSelector 6 ULONG number of variation sel. records
|
|
|
|
*
|
|
|
|
* Followed by numSelector records, each of which looks like
|
|
|
|
*
|
|
|
|
* varSelector 0 UINT24 Unicode codepoint of sel.
|
|
|
|
* defaultOff 3 ULONG offset to a default UVS table
|
|
|
|
* describing any variants to be found in
|
|
|
|
* the normal Unicode subtable.
|
|
|
|
* nonDefOff 7 ULONG offset to a non-default UVS table
|
|
|
|
* describing any variants not in the
|
|
|
|
* standard cmap, with GIDs here
|
|
|
|
* (either offset may be 0 NULL)
|
|
|
|
*
|
|
|
|
* Selectors are sorted by code point.
|
|
|
|
*
|
|
|
|
* A default Unicode Variation Selector (UVS) subtable is just a list of
|
|
|
|
* ranges of code points which are to be found in the standard cmap. No
|
|
|
|
* glyph IDs (GIDs) here.
|
|
|
|
*
|
|
|
|
* numRanges 0 ULONG number of ranges following
|
|
|
|
*
|
|
|
|
* A range looks like
|
|
|
|
*
|
|
|
|
* uniStart 0 UINT24 code point of the first character in
|
|
|
|
* this range
|
|
|
|
* additionalCnt 3 UBYTE count of additional characters in this
|
|
|
|
* range (zero means a range of a single
|
|
|
|
* character)
|
|
|
|
*
|
|
|
|
* Ranges are sorted by `uniStart'.
|
|
|
|
*
|
|
|
|
* A non-default Unicode Variation Selector (UVS) subtable is a list of
|
|
|
|
* mappings from codepoint to GID.
|
|
|
|
*
|
|
|
|
* numMappings 0 ULONG number of mappings
|
|
|
|
*
|
|
|
|
* A range looks like
|
|
|
|
*
|
|
|
|
* uniStart 0 UINT24 code point of the first character in
|
|
|
|
* this range
|
|
|
|
* GID 3 USHORT and its GID
|
|
|
|
*
|
2018-06-04 15:12:29 +02:00
|
|
|
* Ranges are sorted by `uniStart'.
|
2018-06-03 09:01:17 +02:00
|
|
|
*/
|
2007-10-19 14:36:40 +02:00
|
|
|
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
#ifdef TT_CONFIG_CMAP_FORMAT_14
|
|
|
|
|
|
|
|
typedef struct TT_CMap14Rec_
|
|
|
|
{
|
|
|
|
TT_CMapRec cmap;
|
|
|
|
FT_ULong num_selectors;
|
|
|
|
|
2007-10-20 18:15:07 +02:00
|
|
|
/* This array is used to store the results of various
|
|
|
|
* cmap 14 query functions. The data is overwritten
|
|
|
|
* on each call to these functions.
|
|
|
|
*/
|
2009-07-31 17:32:09 +02:00
|
|
|
FT_UInt32 max_results;
|
2007-10-19 14:36:40 +02:00
|
|
|
FT_UInt32* results;
|
|
|
|
FT_Memory memory;
|
|
|
|
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
} TT_CMap14Rec, *TT_CMap14;
|
|
|
|
|
|
|
|
|
2007-10-19 14:36:40 +02:00
|
|
|
FT_CALLBACK_DEF( void )
|
|
|
|
tt_cmap14_done( TT_CMap14 cmap )
|
|
|
|
{
|
|
|
|
FT_Memory memory = cmap->memory;
|
|
|
|
|
2007-10-20 18:15:07 +02:00
|
|
|
|
2007-10-19 14:36:40 +02:00
|
|
|
cmap->max_results = 0;
|
2016-12-26 17:08:17 +01:00
|
|
|
if ( memory && cmap->results )
|
2007-10-19 14:36:40 +02:00
|
|
|
FT_FREE( cmap->results );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static FT_Error
|
|
|
|
tt_cmap14_ensure( TT_CMap14 cmap,
|
2009-07-31 17:32:09 +02:00
|
|
|
FT_UInt32 num_results,
|
2007-10-19 14:36:40 +02:00
|
|
|
FT_Memory memory )
|
|
|
|
{
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_UInt32 old_max = cmap->max_results;
|
2013-03-14 11:21:17 +01:00
|
|
|
FT_Error error = FT_Err_Ok;
|
2007-10-19 14:36:40 +02:00
|
|
|
|
|
|
|
|
2007-10-20 18:15:07 +02:00
|
|
|
if ( num_results > cmap->max_results )
|
2007-10-19 14:36:40 +02:00
|
|
|
{
|
|
|
|
cmap->memory = memory;
|
|
|
|
|
|
|
|
if ( FT_QRENEW_ARRAY( cmap->results, old_max, num_results ) )
|
|
|
|
return error;
|
|
|
|
|
|
|
|
cmap->max_results = num_results;
|
|
|
|
}
|
2007-10-20 18:15:07 +02:00
|
|
|
|
2007-10-19 14:36:40 +02:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
|
|
tt_cmap14_init( TT_CMap14 cmap,
|
|
|
|
FT_Byte* table )
|
|
|
|
{
|
|
|
|
cmap->cmap.data = table;
|
|
|
|
|
|
|
|
table += 6;
|
2012-08-24 13:41:24 +02:00
|
|
|
cmap->num_selectors = FT_PEEK_ULONG( table );
|
|
|
|
cmap->max_results = 0;
|
|
|
|
cmap->results = NULL;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
|
|
tt_cmap14_validate( FT_Byte* table,
|
|
|
|
FT_Validator valid )
|
|
|
|
{
|
2014-02-26 19:50:18 +01:00
|
|
|
FT_Byte* p;
|
|
|
|
FT_ULong length;
|
|
|
|
FT_ULong num_selectors;
|
|
|
|
|
|
|
|
|
|
|
|
if ( table + 2 + 4 + 4 > valid->limit )
|
|
|
|
FT_INVALID_TOO_SHORT;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2014-02-26 19:50:18 +01:00
|
|
|
p = table + 2;
|
|
|
|
length = TT_NEXT_ULONG( p );
|
|
|
|
num_selectors = TT_NEXT_ULONG( p );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2009-03-20 08:03:58 +01:00
|
|
|
if ( length > (FT_ULong)( valid->limit - table ) ||
|
2014-11-12 20:51:20 +01:00
|
|
|
/* length < 10 + 11 * num_selectors ? */
|
|
|
|
length < 10 ||
|
|
|
|
( length - 10 ) / 11 < num_selectors )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
FT_INVALID_TOO_SHORT;
|
|
|
|
|
|
|
|
/* check selectors, they must be in increasing order */
|
|
|
|
{
|
2007-10-20 18:15:07 +02:00
|
|
|
/* we start lastVarSel at 1 because a variant selector value of 0
|
|
|
|
* isn't valid.
|
|
|
|
*/
|
2007-10-19 14:36:40 +02:00
|
|
|
FT_ULong n, lastVarSel = 1;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
for ( n = 0; n < num_selectors; n++ )
|
|
|
|
{
|
2007-10-19 14:36:40 +02:00
|
|
|
FT_ULong varSel = TT_NEXT_UINT24( p );
|
|
|
|
FT_ULong defOff = TT_NEXT_ULONG( p );
|
|
|
|
FT_ULong nondefOff = TT_NEXT_ULONG( p );
|
|
|
|
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
|
|
|
if ( defOff >= length || nondefOff >= length )
|
|
|
|
FT_INVALID_TOO_SHORT;
|
|
|
|
|
2007-10-19 14:36:40 +02:00
|
|
|
if ( varSel < lastVarSel )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
FT_INVALID_DATA;
|
2007-10-19 14:36:40 +02:00
|
|
|
|
|
|
|
lastVarSel = varSel + 1;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
|
|
|
/* check the default table (these glyphs should be reached */
|
|
|
|
/* through the normal Unicode cmap, no GIDs, just check order) */
|
|
|
|
if ( defOff != 0 )
|
|
|
|
{
|
2015-10-31 18:47:26 +01:00
|
|
|
FT_Byte* defp = table + defOff;
|
|
|
|
FT_ULong numRanges;
|
2007-10-19 14:36:40 +02:00
|
|
|
FT_ULong i;
|
2015-10-31 18:47:26 +01:00
|
|
|
FT_ULong lastBase = 0;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2007-10-20 18:15:07 +02:00
|
|
|
|
2015-10-31 18:47:26 +01:00
|
|
|
if ( defp + 4 > valid->limit )
|
|
|
|
FT_INVALID_TOO_SHORT;
|
|
|
|
|
|
|
|
numRanges = TT_NEXT_ULONG( defp );
|
|
|
|
|
2014-11-12 20:51:20 +01:00
|
|
|
/* defp + numRanges * 4 > valid->limit ? */
|
|
|
|
if ( numRanges > (FT_ULong)( valid->limit - defp ) / 4 )
|
2007-10-19 14:36:40 +02:00
|
|
|
FT_INVALID_TOO_SHORT;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2016-12-26 23:57:45 +01:00
|
|
|
for ( i = 0; i < numRanges; i++ )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
{
|
2007-10-19 14:36:40 +02:00
|
|
|
FT_ULong base = TT_NEXT_UINT24( defp );
|
|
|
|
FT_ULong cnt = FT_NEXT_BYTE( defp );
|
|
|
|
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
|
|
|
if ( base + cnt >= 0x110000UL ) /* end of Unicode */
|
|
|
|
FT_INVALID_DATA;
|
|
|
|
|
2007-10-19 14:36:40 +02:00
|
|
|
if ( base < lastBase )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
FT_INVALID_DATA;
|
2007-10-19 14:36:40 +02:00
|
|
|
|
|
|
|
lastBase = base + cnt + 1U;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* and the non-default table (these glyphs are specified here) */
|
2010-06-08 08:37:11 +02:00
|
|
|
if ( nondefOff != 0 )
|
|
|
|
{
|
2015-10-31 18:47:26 +01:00
|
|
|
FT_Byte* ndp = table + nondefOff;
|
|
|
|
FT_ULong numMappings;
|
|
|
|
FT_ULong i, lastUni = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if ( ndp + 4 > valid->limit )
|
|
|
|
FT_INVALID_TOO_SHORT;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2015-10-31 18:47:26 +01:00
|
|
|
numMappings = TT_NEXT_ULONG( ndp );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2015-10-31 18:47:26 +01:00
|
|
|
/* numMappings * 5 > (FT_ULong)( valid->limit - ndp ) ? */
|
|
|
|
if ( numMappings > ( (FT_ULong)( valid->limit - ndp ) ) / 5 )
|
2007-10-19 14:36:40 +02:00
|
|
|
FT_INVALID_TOO_SHORT;
|
|
|
|
|
2016-12-26 23:57:45 +01:00
|
|
|
for ( i = 0; i < numMappings; i++ )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
{
|
2007-10-19 14:36:40 +02:00
|
|
|
FT_ULong uni = TT_NEXT_UINT24( ndp );
|
|
|
|
FT_ULong gid = TT_NEXT_USHORT( ndp );
|
|
|
|
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
|
|
|
if ( uni >= 0x110000UL ) /* end of Unicode */
|
|
|
|
FT_INVALID_DATA;
|
|
|
|
|
2007-10-19 14:36:40 +02:00
|
|
|
if ( uni < lastUni )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
FT_INVALID_DATA;
|
2007-10-19 14:36:40 +02:00
|
|
|
|
|
|
|
lastUni = uni + 1U;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
|
|
|
if ( valid->level >= FT_VALIDATE_TIGHT &&
|
|
|
|
gid >= TT_VALID_GLYPH_COUNT( valid ) )
|
|
|
|
FT_INVALID_GLYPH_ID;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_UInt )
|
|
|
|
tt_cmap14_char_index( TT_CMap cmap,
|
|
|
|
FT_UInt32 char_code )
|
|
|
|
{
|
|
|
|
FT_UNUSED( cmap );
|
|
|
|
FT_UNUSED( char_code );
|
|
|
|
|
|
|
|
/* This can't happen */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-31 17:32:09 +02:00
|
|
|
FT_CALLBACK_DEF( FT_UInt32 )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
tt_cmap14_char_next( TT_CMap cmap,
|
|
|
|
FT_UInt32 *pchar_code )
|
|
|
|
{
|
|
|
|
FT_UNUSED( cmap );
|
|
|
|
|
|
|
|
/* This can't happen */
|
|
|
|
*pchar_code = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
|
|
tt_cmap14_get_info( TT_CMap cmap,
|
|
|
|
TT_CMapInfo *cmap_info )
|
|
|
|
{
|
|
|
|
FT_UNUSED( cmap );
|
|
|
|
|
2009-04-04 07:42:38 +02:00
|
|
|
cmap_info->format = 14;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
/* subtable 14 does not define a language field */
|
|
|
|
cmap_info->language = 0xFFFFFFFFUL;
|
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static FT_UInt
|
|
|
|
tt_cmap14_char_map_def_binary( FT_Byte *base,
|
|
|
|
FT_UInt32 char_code )
|
|
|
|
{
|
|
|
|
FT_UInt32 numRanges = TT_PEEK_ULONG( base );
|
2007-10-19 14:36:40 +02:00
|
|
|
FT_UInt32 max, min;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
min = 0;
|
|
|
|
max = numRanges;
|
|
|
|
|
2007-10-19 14:36:40 +02:00
|
|
|
base += 4;
|
|
|
|
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
/* binary search */
|
|
|
|
while ( min < max )
|
|
|
|
{
|
2007-10-19 14:36:40 +02:00
|
|
|
FT_UInt32 mid = ( min + max ) >> 1;
|
|
|
|
FT_Byte* p = base + 4 * mid;
|
|
|
|
FT_ULong start = TT_NEXT_UINT24( p );
|
|
|
|
FT_UInt cnt = FT_NEXT_BYTE( p );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
if ( char_code < start )
|
|
|
|
max = mid;
|
2016-03-29 09:13:13 +02:00
|
|
|
else if ( char_code > start + cnt )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
min = mid + 1;
|
|
|
|
else
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static FT_UInt
|
|
|
|
tt_cmap14_char_map_nondef_binary( FT_Byte *base,
|
|
|
|
FT_UInt32 char_code )
|
|
|
|
{
|
|
|
|
FT_UInt32 numMappings = TT_PEEK_ULONG( base );
|
2007-10-19 14:36:40 +02:00
|
|
|
FT_UInt32 max, min;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
min = 0;
|
|
|
|
max = numMappings;
|
|
|
|
|
2007-10-19 14:36:40 +02:00
|
|
|
base += 4;
|
|
|
|
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
/* binary search */
|
|
|
|
while ( min < max )
|
|
|
|
{
|
2007-10-19 14:36:40 +02:00
|
|
|
FT_UInt32 mid = ( min + max ) >> 1;
|
|
|
|
FT_Byte* p = base + 5 * mid;
|
2009-07-31 17:32:14 +02:00
|
|
|
FT_UInt32 uni = (FT_UInt32)TT_NEXT_UINT24( p );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
if ( char_code < uni )
|
|
|
|
max = mid;
|
|
|
|
else if ( char_code > uni )
|
|
|
|
min = mid + 1;
|
|
|
|
else
|
2007-10-19 14:36:40 +02:00
|
|
|
return TT_PEEK_USHORT( p );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
}
|
2007-10-20 18:15:07 +02:00
|
|
|
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static FT_Byte*
|
|
|
|
tt_cmap14_find_variant( FT_Byte *base,
|
|
|
|
FT_UInt32 variantCode )
|
|
|
|
{
|
|
|
|
FT_UInt32 numVar = TT_PEEK_ULONG( base );
|
2007-10-19 14:36:40 +02:00
|
|
|
FT_UInt32 max, min;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
min = 0;
|
|
|
|
max = numVar;
|
|
|
|
|
2007-10-19 14:36:40 +02:00
|
|
|
base += 4;
|
|
|
|
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
/* binary search */
|
|
|
|
while ( min < max )
|
|
|
|
{
|
2007-10-19 14:36:40 +02:00
|
|
|
FT_UInt32 mid = ( min + max ) >> 1;
|
|
|
|
FT_Byte* p = base + 11 * mid;
|
2008-03-03 09:08:12 +01:00
|
|
|
FT_ULong varSel = TT_NEXT_UINT24( p );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
if ( variantCode < varSel )
|
|
|
|
max = mid;
|
|
|
|
else if ( variantCode > varSel )
|
|
|
|
min = mid + 1;
|
|
|
|
else
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_UInt )
|
2009-07-31 17:37:59 +02:00
|
|
|
tt_cmap14_char_var_index( TT_CMap cmap,
|
|
|
|
TT_CMap ucmap,
|
|
|
|
FT_UInt32 charcode,
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_UInt32 variantSelector )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
{
|
2007-10-20 18:15:07 +02:00
|
|
|
FT_Byte* p = tt_cmap14_find_variant( cmap->data + 6, variantSelector );
|
|
|
|
FT_ULong defOff;
|
|
|
|
FT_ULong nondefOff;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
if ( !p )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
defOff = TT_NEXT_ULONG( p );
|
2007-10-19 14:36:40 +02:00
|
|
|
nondefOff = TT_PEEK_ULONG( p );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
|
|
|
if ( defOff != 0 &&
|
|
|
|
tt_cmap14_char_map_def_binary( cmap->data + defOff, charcode ) )
|
|
|
|
{
|
|
|
|
/* This is the default variant of this charcode. GID not stored */
|
|
|
|
/* here; stored in the normal Unicode charmap instead. */
|
|
|
|
return ucmap->cmap.clazz->char_index( &ucmap->cmap, charcode );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( nondefOff != 0 )
|
|
|
|
return tt_cmap14_char_map_nondef_binary( cmap->data + nondefOff,
|
|
|
|
charcode );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_Int )
|
2009-07-31 17:37:59 +02:00
|
|
|
tt_cmap14_char_var_isdefault( TT_CMap cmap,
|
|
|
|
FT_UInt32 charcode,
|
|
|
|
FT_UInt32 variantSelector )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
{
|
2007-10-20 18:15:07 +02:00
|
|
|
FT_Byte* p = tt_cmap14_find_variant( cmap->data + 6, variantSelector );
|
|
|
|
FT_ULong defOff;
|
|
|
|
FT_ULong nondefOff;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
if ( !p )
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
defOff = TT_NEXT_ULONG( p );
|
|
|
|
nondefOff = TT_NEXT_ULONG( p );
|
|
|
|
|
|
|
|
if ( defOff != 0 &&
|
|
|
|
tt_cmap14_char_map_def_binary( cmap->data + defOff, charcode ) )
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if ( nondefOff != 0 &&
|
|
|
|
tt_cmap14_char_map_nondef_binary( cmap->data + nondefOff,
|
|
|
|
charcode ) != 0 )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-20 18:15:07 +02:00
|
|
|
FT_CALLBACK_DEF( FT_UInt32* )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
tt_cmap14_variants( TT_CMap cmap,
|
|
|
|
FT_Memory memory )
|
|
|
|
{
|
|
|
|
TT_CMap14 cmap14 = (TT_CMap14)cmap;
|
2009-07-31 17:32:09 +02:00
|
|
|
FT_UInt32 count = cmap14->num_selectors;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
FT_Byte* p = cmap->data + 10;
|
2007-10-19 14:36:40 +02:00
|
|
|
FT_UInt32* result;
|
2009-07-31 17:32:09 +02:00
|
|
|
FT_UInt32 i;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2007-10-20 18:15:07 +02:00
|
|
|
|
|
|
|
if ( tt_cmap14_ensure( cmap14, ( count + 1 ), memory ) )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
return NULL;
|
|
|
|
|
2007-10-19 14:36:40 +02:00
|
|
|
result = cmap14->results;
|
2016-12-26 23:57:45 +01:00
|
|
|
for ( i = 0; i < count; i++ )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
{
|
2009-07-31 17:32:14 +02:00
|
|
|
result[i] = (FT_UInt32)TT_NEXT_UINT24( p );
|
2007-10-19 14:36:40 +02:00
|
|
|
p += 8;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
}
|
2007-10-19 14:36:40 +02:00
|
|
|
result[i] = 0;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2007-10-19 14:36:40 +02:00
|
|
|
return result;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_UInt32 * )
|
|
|
|
tt_cmap14_char_variants( TT_CMap cmap,
|
|
|
|
FT_Memory memory,
|
2009-07-31 17:37:59 +02:00
|
|
|
FT_UInt32 charCode )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
{
|
|
|
|
TT_CMap14 cmap14 = (TT_CMap14) cmap;
|
2009-07-31 17:32:09 +02:00
|
|
|
FT_UInt32 count = cmap14->num_selectors;
|
2007-10-19 14:36:40 +02:00
|
|
|
FT_Byte* p = cmap->data + 10;
|
|
|
|
FT_UInt32* q;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
|
|
|
|
2007-10-20 18:15:07 +02:00
|
|
|
if ( tt_cmap14_ensure( cmap14, ( count + 1 ), memory ) )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
return NULL;
|
|
|
|
|
2016-12-26 23:57:45 +01:00
|
|
|
for ( q = cmap14->results; count > 0; count-- )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
{
|
2007-10-19 14:36:40 +02:00
|
|
|
FT_UInt32 varSel = TT_NEXT_UINT24( p );
|
|
|
|
FT_ULong defOff = TT_NEXT_ULONG( p );
|
|
|
|
FT_ULong nondefOff = TT_NEXT_ULONG( p );
|
|
|
|
|
|
|
|
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
if ( ( defOff != 0 &&
|
|
|
|
tt_cmap14_char_map_def_binary( cmap->data + defOff,
|
|
|
|
charCode ) ) ||
|
|
|
|
( nondefOff != 0 &&
|
|
|
|
tt_cmap14_char_map_nondef_binary( cmap->data + nondefOff,
|
|
|
|
charCode ) != 0 ) )
|
2007-10-19 14:36:40 +02:00
|
|
|
{
|
|
|
|
q[0] = varSel;
|
|
|
|
q++;
|
|
|
|
}
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
}
|
2007-10-19 14:36:40 +02:00
|
|
|
q[0] = 0;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2007-10-19 14:36:40 +02:00
|
|
|
return cmap14->results;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static FT_UInt
|
|
|
|
tt_cmap14_def_char_count( FT_Byte *p )
|
|
|
|
{
|
2009-07-31 17:32:14 +02:00
|
|
|
FT_UInt32 numRanges = (FT_UInt32)TT_NEXT_ULONG( p );
|
2007-10-19 14:36:40 +02:00
|
|
|
FT_UInt tot = 0;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
|
|
|
|
2008-07-22 22:59:59 +02:00
|
|
|
p += 3; /* point to the first `cnt' field */
|
2007-10-19 14:36:40 +02:00
|
|
|
for ( ; numRanges > 0; numRanges-- )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
{
|
2007-10-19 14:36:40 +02:00
|
|
|
tot += 1 + p[0];
|
|
|
|
p += 4;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return tot;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-19 14:36:40 +02:00
|
|
|
static FT_UInt32*
|
2012-08-24 13:41:24 +02:00
|
|
|
tt_cmap14_get_def_chars( TT_CMap cmap,
|
|
|
|
FT_Byte* p,
|
|
|
|
FT_Memory memory )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
{
|
2007-10-19 14:36:40 +02:00
|
|
|
TT_CMap14 cmap14 = (TT_CMap14) cmap;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
FT_UInt32 numRanges;
|
|
|
|
FT_UInt cnt;
|
2007-10-19 14:36:40 +02:00
|
|
|
FT_UInt32* q;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
cnt = tt_cmap14_def_char_count( p );
|
2009-07-31 17:32:14 +02:00
|
|
|
numRanges = (FT_UInt32)TT_NEXT_ULONG( p );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2007-10-20 18:15:07 +02:00
|
|
|
if ( tt_cmap14_ensure( cmap14, ( cnt + 1 ), memory ) )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
return NULL;
|
|
|
|
|
2016-12-26 23:57:45 +01:00
|
|
|
for ( q = cmap14->results; numRanges > 0; numRanges-- )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
{
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_UInt32 uni = (FT_UInt32)TT_NEXT_UINT24( p );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2007-10-20 18:15:07 +02:00
|
|
|
|
|
|
|
cnt = FT_NEXT_BYTE( p ) + 1;
|
2007-10-19 14:36:40 +02:00
|
|
|
do
|
|
|
|
{
|
|
|
|
q[0] = uni;
|
|
|
|
uni += 1;
|
|
|
|
q += 1;
|
2012-08-24 13:41:24 +02:00
|
|
|
|
2007-10-20 18:15:07 +02:00
|
|
|
} while ( --cnt != 0 );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
}
|
2007-10-19 14:36:40 +02:00
|
|
|
q[0] = 0;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2007-10-19 14:36:40 +02:00
|
|
|
return cmap14->results;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
}
|
2007-10-19 14:36:40 +02:00
|
|
|
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2008-10-09 07:44:23 +02:00
|
|
|
static FT_UInt32*
|
2007-10-19 14:36:40 +02:00
|
|
|
tt_cmap14_get_nondef_chars( TT_CMap cmap,
|
|
|
|
FT_Byte *p,
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
FT_Memory memory )
|
|
|
|
{
|
2007-10-19 14:36:40 +02:00
|
|
|
TT_CMap14 cmap14 = (TT_CMap14) cmap;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
FT_UInt32 numMappings;
|
|
|
|
FT_UInt i;
|
|
|
|
FT_UInt32 *ret;
|
|
|
|
|
|
|
|
|
2009-07-31 17:32:14 +02:00
|
|
|
numMappings = (FT_UInt32)TT_NEXT_ULONG( p );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2007-10-20 18:15:07 +02:00
|
|
|
if ( tt_cmap14_ensure( cmap14, ( numMappings + 1 ), memory ) )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
return NULL;
|
|
|
|
|
2007-10-19 14:36:40 +02:00
|
|
|
ret = cmap14->results;
|
2016-12-26 23:57:45 +01:00
|
|
|
for ( i = 0; i < numMappings; i++ )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
{
|
2009-07-31 17:32:14 +02:00
|
|
|
ret[i] = (FT_UInt32)TT_NEXT_UINT24( p );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
p += 2;
|
|
|
|
}
|
|
|
|
ret[i] = 0;
|
|
|
|
|
2007-10-19 14:36:40 +02:00
|
|
|
return ret;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
}
|
2007-10-19 14:36:40 +02:00
|
|
|
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_UInt32 * )
|
|
|
|
tt_cmap14_variant_chars( TT_CMap cmap,
|
|
|
|
FT_Memory memory,
|
2009-07-31 17:37:59 +02:00
|
|
|
FT_UInt32 variantSelector )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
{
|
|
|
|
FT_Byte *p = tt_cmap14_find_variant( cmap->data + 6,
|
|
|
|
variantSelector );
|
|
|
|
FT_Int i;
|
|
|
|
FT_ULong defOff;
|
|
|
|
FT_ULong nondefOff;
|
|
|
|
|
|
|
|
|
|
|
|
if ( !p )
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
defOff = TT_NEXT_ULONG( p );
|
|
|
|
nondefOff = TT_NEXT_ULONG( p );
|
|
|
|
|
|
|
|
if ( defOff == 0 && nondefOff == 0 )
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if ( defOff == 0 )
|
2007-10-20 18:15:07 +02:00
|
|
|
return tt_cmap14_get_nondef_chars( cmap, cmap->data + nondefOff,
|
|
|
|
memory );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
else if ( nondefOff == 0 )
|
2007-10-20 18:15:07 +02:00
|
|
|
return tt_cmap14_get_def_chars( cmap, cmap->data + defOff,
|
|
|
|
memory );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Both a default and a non-default glyph set? That's probably not */
|
|
|
|
/* good font design, but the spec allows for it... */
|
2007-10-19 14:36:40 +02:00
|
|
|
TT_CMap14 cmap14 = (TT_CMap14) cmap;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
FT_UInt32 numRanges;
|
|
|
|
FT_UInt32 numMappings;
|
|
|
|
FT_UInt32 duni;
|
|
|
|
FT_UInt32 dcnt;
|
|
|
|
FT_UInt32 nuni;
|
|
|
|
FT_Byte* dp;
|
|
|
|
FT_UInt di, ni, k;
|
|
|
|
|
2013-08-01 12:20:20 +02:00
|
|
|
FT_UInt32 *ret;
|
|
|
|
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
|
|
|
p = cmap->data + nondefOff;
|
|
|
|
dp = cmap->data + defOff;
|
|
|
|
|
2009-07-31 17:32:14 +02:00
|
|
|
numMappings = (FT_UInt32)TT_NEXT_ULONG( p );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
dcnt = tt_cmap14_def_char_count( dp );
|
2009-07-31 17:32:14 +02:00
|
|
|
numRanges = (FT_UInt32)TT_NEXT_ULONG( dp );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
|
|
|
if ( numMappings == 0 )
|
2007-10-20 18:15:07 +02:00
|
|
|
return tt_cmap14_get_def_chars( cmap, cmap->data + defOff,
|
|
|
|
memory );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
if ( dcnt == 0 )
|
2007-10-20 18:15:07 +02:00
|
|
|
return tt_cmap14_get_nondef_chars( cmap, cmap->data + nondefOff,
|
|
|
|
memory );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2007-10-20 18:15:07 +02:00
|
|
|
if ( tt_cmap14_ensure( cmap14, ( dcnt + numMappings + 1 ), memory ) )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
return NULL;
|
|
|
|
|
2007-10-19 14:36:40 +02:00
|
|
|
ret = cmap14->results;
|
2009-07-31 17:32:14 +02:00
|
|
|
duni = (FT_UInt32)TT_NEXT_UINT24( dp );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
dcnt = FT_NEXT_BYTE( dp );
|
|
|
|
di = 1;
|
2009-07-31 17:32:14 +02:00
|
|
|
nuni = (FT_UInt32)TT_NEXT_UINT24( p );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
p += 2;
|
|
|
|
ni = 1;
|
|
|
|
i = 0;
|
|
|
|
|
2015-10-31 19:08:27 +01:00
|
|
|
for (;;)
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
{
|
|
|
|
if ( nuni > duni + dcnt )
|
|
|
|
{
|
2016-12-26 23:57:45 +01:00
|
|
|
for ( k = 0; k <= dcnt; k++ )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
ret[i++] = duni + k;
|
|
|
|
|
2016-12-26 23:57:45 +01:00
|
|
|
di++;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2007-10-19 14:36:40 +02:00
|
|
|
if ( di > numRanges )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
break;
|
2007-10-19 14:36:40 +02:00
|
|
|
|
2009-07-31 17:32:14 +02:00
|
|
|
duni = (FT_UInt32)TT_NEXT_UINT24( dp );
|
2007-10-19 14:36:40 +02:00
|
|
|
dcnt = FT_NEXT_BYTE( dp );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( nuni < duni )
|
|
|
|
ret[i++] = nuni;
|
|
|
|
/* If it is within the default range then ignore it -- */
|
|
|
|
/* that should not have happened */
|
2016-12-26 23:57:45 +01:00
|
|
|
ni++;
|
2007-10-19 14:36:40 +02:00
|
|
|
if ( ni > numMappings )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
break;
|
2007-10-19 14:36:40 +02:00
|
|
|
|
2009-07-31 17:32:14 +02:00
|
|
|
nuni = (FT_UInt32)TT_NEXT_UINT24( p );
|
2007-10-19 14:36:40 +02:00
|
|
|
p += 2;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ni <= numMappings )
|
|
|
|
{
|
|
|
|
/* If we get here then we have run out of all default ranges. */
|
|
|
|
/* We have read one non-default mapping which we haven't stored */
|
|
|
|
/* and there may be others that need to be read. */
|
|
|
|
ret[i++] = nuni;
|
|
|
|
while ( ni < numMappings )
|
|
|
|
{
|
2009-07-31 17:32:14 +02:00
|
|
|
ret[i++] = (FT_UInt32)TT_NEXT_UINT24( p );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
p += 2;
|
2016-12-26 23:57:45 +01:00
|
|
|
ni++;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
}
|
|
|
|
}
|
2008-03-03 09:08:12 +01:00
|
|
|
else if ( di <= numRanges )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
{
|
|
|
|
/* If we get here then we have run out of all non-default */
|
|
|
|
/* mappings. We have read one default range which we haven't */
|
|
|
|
/* stored and there may be others that need to be read. */
|
2016-12-26 23:57:45 +01:00
|
|
|
for ( k = 0; k <= dcnt; k++ )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
ret[i++] = duni + k;
|
|
|
|
|
|
|
|
while ( di < numRanges )
|
|
|
|
{
|
2009-07-31 17:32:14 +02:00
|
|
|
duni = (FT_UInt32)TT_NEXT_UINT24( dp );
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
dcnt = FT_NEXT_BYTE( dp );
|
|
|
|
|
2016-12-26 23:57:45 +01:00
|
|
|
for ( k = 0; k <= dcnt; k++ )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
ret[i++] = duni + k;
|
2016-12-26 23:57:45 +01:00
|
|
|
di++;
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ret[i] = 0;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-24 13:41:24 +02:00
|
|
|
FT_DEFINE_TT_CMAP(
|
|
|
|
tt_cmap14_class_rec,
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
sizeof ( TT_CMap14Rec ),
|
|
|
|
|
|
|
|
(FT_CMap_InitFunc) tt_cmap14_init, /* init */
|
|
|
|
(FT_CMap_DoneFunc) tt_cmap14_done, /* done */
|
|
|
|
(FT_CMap_CharIndexFunc)tt_cmap14_char_index, /* char_index */
|
|
|
|
(FT_CMap_CharNextFunc) tt_cmap14_char_next, /* char_next */
|
2012-08-24 13:41:24 +02:00
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
/* Format 14 extension functions */
|
|
|
|
(FT_CMap_CharVarIndexFunc) tt_cmap14_char_var_index,
|
|
|
|
(FT_CMap_CharVarIsDefaultFunc)tt_cmap14_char_var_isdefault,
|
|
|
|
(FT_CMap_VariantListFunc) tt_cmap14_variants,
|
|
|
|
(FT_CMap_CharVariantListFunc) tt_cmap14_char_variants,
|
|
|
|
(FT_CMap_VariantCharListFunc) tt_cmap14_variant_chars,
|
2007-10-20 18:15:07 +02:00
|
|
|
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
14,
|
2016-09-17 17:12:50 +02:00
|
|
|
(TT_CMap_ValidateFunc)tt_cmap14_validate, /* validate */
|
|
|
|
(TT_CMap_Info_GetFunc)tt_cmap14_get_info /* get_cmap_info */
|
|
|
|
)
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2008-10-09 09:14:08 +02:00
|
|
|
#endif /* TT_CONFIG_CMAP_FORMAT_14 */
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
|
|
|
|
2017-06-22 04:52:37 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** SYNTHETIC UNICODE *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
/* This charmap is generated using postscript glyph names. */
|
|
|
|
|
|
|
|
#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( const char * )
|
|
|
|
tt_get_glyph_name( TT_Face face,
|
|
|
|
FT_UInt idx )
|
|
|
|
{
|
2019-04-06 07:07:37 +02:00
|
|
|
FT_String* PSname = NULL;
|
2017-06-22 04:52:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
tt_face_get_ps_name( face, idx, &PSname );
|
|
|
|
|
|
|
|
return PSname;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
|
|
|
tt_cmap_unicode_init( PS_Unicodes unicodes,
|
|
|
|
FT_Pointer pointer )
|
|
|
|
{
|
|
|
|
TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes );
|
|
|
|
FT_Memory memory = FT_FACE_MEMORY( face );
|
|
|
|
FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
|
|
|
|
|
|
|
|
FT_UNUSED( pointer );
|
|
|
|
|
|
|
|
|
2018-10-07 09:03:05 +02:00
|
|
|
if ( !psnames->unicodes_init )
|
|
|
|
return FT_THROW( Unimplemented_Feature );
|
|
|
|
|
2017-06-22 04:52:37 +02:00
|
|
|
return psnames->unicodes_init( memory,
|
|
|
|
unicodes,
|
|
|
|
face->root.num_glyphs,
|
|
|
|
(PS_GetGlyphNameFunc)&tt_get_glyph_name,
|
|
|
|
(PS_FreeGlyphNameFunc)NULL,
|
|
|
|
(FT_Pointer)face );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( void )
|
|
|
|
tt_cmap_unicode_done( PS_Unicodes unicodes )
|
|
|
|
{
|
|
|
|
FT_Face face = FT_CMAP_FACE( unicodes );
|
|
|
|
FT_Memory memory = FT_FACE_MEMORY( face );
|
|
|
|
|
|
|
|
|
|
|
|
FT_FREE( unicodes->maps );
|
|
|
|
unicodes->num_maps = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_UInt )
|
|
|
|
tt_cmap_unicode_char_index( PS_Unicodes unicodes,
|
|
|
|
FT_UInt32 char_code )
|
|
|
|
{
|
|
|
|
TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes );
|
|
|
|
FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
|
|
|
|
|
|
|
|
|
|
|
|
return psnames->unicodes_char_index( unicodes, char_code );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_UInt32 )
|
|
|
|
tt_cmap_unicode_char_next( PS_Unicodes unicodes,
|
|
|
|
FT_UInt32 *pchar_code )
|
|
|
|
{
|
|
|
|
TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes );
|
|
|
|
FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
|
|
|
|
|
|
|
|
|
|
|
|
return psnames->unicodes_char_next( unicodes, pchar_code );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_DEFINE_TT_CMAP(
|
|
|
|
tt_cmap_unicode_class_rec,
|
|
|
|
|
|
|
|
sizeof ( PS_UnicodesRec ),
|
|
|
|
|
|
|
|
(FT_CMap_InitFunc) tt_cmap_unicode_init, /* init */
|
|
|
|
(FT_CMap_DoneFunc) tt_cmap_unicode_done, /* done */
|
|
|
|
(FT_CMap_CharIndexFunc)tt_cmap_unicode_char_index, /* char_index */
|
|
|
|
(FT_CMap_CharNextFunc) tt_cmap_unicode_char_next, /* char_next */
|
|
|
|
|
|
|
|
(FT_CMap_CharVarIndexFunc) NULL, /* char_var_index */
|
|
|
|
(FT_CMap_CharVarIsDefaultFunc)NULL, /* char_var_default */
|
|
|
|
(FT_CMap_VariantListFunc) NULL, /* variant_list */
|
|
|
|
(FT_CMap_CharVariantListFunc) NULL, /* charvariant_list */
|
|
|
|
(FT_CMap_VariantCharListFunc) NULL, /* variantchar_list */
|
|
|
|
|
2017-07-05 23:07:01 +02:00
|
|
|
~0U,
|
2017-06-22 04:52:37 +02:00
|
|
|
(TT_CMap_ValidateFunc)NULL, /* validate */
|
|
|
|
(TT_CMap_Info_GetFunc)NULL /* get_cmap_info */
|
|
|
|
)
|
|
|
|
|
|
|
|
#endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */
|
|
|
|
|
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
|
|
|
|
2002-03-22 16:02:38 +01:00
|
|
|
static const TT_CMap_Class tt_cmap_classes[] =
|
2002-03-01 03:26:22 +01:00
|
|
|
{
|
2020-07-07 16:58:14 +02:00
|
|
|
#undef TTCMAPCITEM
|
2012-08-24 13:41:24 +02:00
|
|
|
#define TTCMAPCITEM( 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
|
|
|
#include "ttcmapc.h"
|
|
|
|
NULL,
|
|
|
|
};
|
2002-03-01 03:26:22 +01:00
|
|
|
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
/* parse the `cmap' table and build the corresponding TT_CMap objects */
|
|
|
|
/* in the current face */
|
|
|
|
/* */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* 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
|
|
|
tt_face_build_cmaps( TT_Face face )
|
2002-03-01 03:26:22 +01:00
|
|
|
{
|
2019-11-23 10:54:51 +01:00
|
|
|
FT_Byte* const table = face->cmap_table;
|
|
|
|
FT_Byte* limit;
|
2002-11-06 23:32:54 +01:00
|
|
|
FT_UInt volatile num_cmaps;
|
2019-11-23 10:54:51 +01:00
|
|
|
FT_Byte* volatile p = table;
|
2010-06-24 08:48:10 +02:00
|
|
|
FT_Library library = FT_FACE_LIBRARY( face );
|
2002-03-01 03:26:22 +01:00
|
|
|
|
2010-06-24 08:48:10 +02:00
|
|
|
FT_UNUSED( library );
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2010-06-24 08:48:10 +02:00
|
|
|
|
2019-11-23 10:54:51 +01:00
|
|
|
if ( !p || face->cmap_size < 4 )
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Invalid_Table );
|
2002-03-01 03:26:22 +01:00
|
|
|
|
2020-02-12 18:25:03 +01:00
|
|
|
/* Version 1.8.3 of the OpenType specification contains the following */
|
|
|
|
/* (https://docs.microsoft.com/en-us/typography/opentype/spec/cmap): */
|
|
|
|
/* */
|
|
|
|
/* The 'cmap' table version number remains at 0x0000 for fonts that */
|
|
|
|
/* make use of the newer subtable formats. */
|
|
|
|
/* */
|
|
|
|
/* This essentially means that a version format test is useless. */
|
|
|
|
|
|
|
|
/* ignore format */
|
|
|
|
p += 2;
|
2002-03-01 03:26:22 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
num_cmaps = TT_NEXT_USHORT( p );
|
2020-06-02 17:14:54 +02:00
|
|
|
FT_TRACE4(( "tt_face_build_cmaps: %d cmaps\n", num_cmaps ));
|
2012-08-24 13:41:24 +02:00
|
|
|
|
2020-06-02 17:14:54 +02:00
|
|
|
limit = table + face->cmap_size;
|
2002-03-01 03:26:22 +01:00
|
|
|
for ( ; num_cmaps > 0 && p + 8 <= limit; num_cmaps-- )
|
|
|
|
{
|
|
|
|
FT_CharMapRec charmap;
|
|
|
|
FT_UInt32 offset;
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
|
|
|
charmap.platform_id = TT_NEXT_USHORT( p );
|
|
|
|
charmap.encoding_id = TT_NEXT_USHORT( p );
|
|
|
|
charmap.face = FT_FACE( face );
|
* 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
|
|
|
charmap.encoding = FT_ENCODING_NONE; /* will be filled later */
|
2002-03-31 20:48:24 +02:00
|
|
|
offset = TT_NEXT_ULONG( p );
|
2002-03-01 03:26:22 +01:00
|
|
|
|
2006-03-21 21:47:28 +01:00
|
|
|
if ( offset && offset <= face->cmap_size - 2 )
|
2002-03-01 03:26:22 +01:00
|
|
|
{
|
2006-08-18 19:20:37 +02:00
|
|
|
FT_Byte* volatile cmap = table + offset;
|
2003-06-07 07:13:22 +02:00
|
|
|
volatile FT_UInt format = TT_PEEK_USHORT( cmap );
|
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 TT_CMap_Class* volatile pclazz = tt_cmap_classes;
|
2006-04-21 10:38:35 +02:00
|
|
|
TT_CMap_Class volatile clazz;
|
2002-03-01 03:26:22 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
for ( ; *pclazz; pclazz++ )
|
|
|
|
{
|
|
|
|
clazz = *pclazz;
|
|
|
|
if ( clazz->format == format )
|
|
|
|
{
|
2002-03-22 18:09:52 +01:00
|
|
|
volatile TT_ValidatorRec valid;
|
2013-03-14 11:21:17 +01:00
|
|
|
volatile FT_Error error = FT_Err_Ok;
|
2002-06-11 01:03:35 +02:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
|
|
|
ft_validator_init( FT_VALIDATOR( &valid ), cmap, limit,
|
2002-03-22 18:09:52 +01:00
|
|
|
FT_VALIDATE_DEFAULT );
|
2002-06-11 01:03:35 +02:00
|
|
|
|
* include/freetype/internal/ftobjs.h (FT_Face_InternalRec): Remove
unused `max_points' and `max_contours'.
* src/cid/cidobjs.c (cid_face_init), src/type1/t1objs.c
(T1_Face_Init), src/type42/t42objs.c (T42_Face_Init): Update.
* include/freetype/internal/tttypes.h (TT_FaceRec): Remove unused
`max_components'.
* src/truetype/ttinterp.h (TT_ExecContextRec): Remove unused
`loadSize' and `loadStack'.
* src/truetype/ttinterp.c (TT_Done_Context, TT_Load_Context),
src/sfnt/ttload.c (tt_face_load_maxp): Update.
* src/cff/cffobjs.h (cff_size_select), src/sfnt/sfdriver.c
(sfnt_interface), src/truetype/ttdriver.c (tt_size_request): Fix
compiler errors/warnings when TT_CONFIG_OPTION_EMBEDDED_BITMAPS is not
defined.
* src/sfnt/ttmtx.c (tt_face_load_hmtx, tt_face_get_metrics): Fix
possible segment faults for the non-FT_OPTIMIZE_MEMORY'ed versions.
(finally!)
For most OpenType tables, `tt_face_load_xxxx' simply loads the table
and `face->root' is set later in `sfnt_load_face'. Here, we try to
make this work for _all_ tables.
* src/sfnt/ttsbit.c, src/sfnt/ttsbit0.c, src/sfnt/ttload.c,
src/sfnt/ttmtx.c: all `tt_face_load_xxxx' should load the table and
then exit. Error handling or setting face->root is done later in
`sfnt_load_face'.
Pretty trace messages.
* src/sfnt/sfobjs.c (sfnt_load_face): Work harder.
Mac bitmap-only fonts are not scalable.
Check that `face->header.Units_Per_EM' is not zero.
(LOAD_, LOADM_): Pretty trace messages.
* src/sfnt/ttsbit0.c (tt_face_load_strike_metrics): Read metrics from
`eblc'.
* src/sfnt/ttcmap.c (tt_face_build_cmaps), src/sfnt/ttpost.c
(load_format_20, load_format_25, tt_face_get_ps_name): Use
face->max_profile.numGlyphs, instead of face->root.num_glyphs.
2006-02-15 08:44:31 +01:00
|
|
|
valid.num_glyphs = (FT_UInt)face->max_profile.numGlyphs;
|
2002-03-01 03:26:22 +01:00
|
|
|
|
2012-07-09 09:55:50 +02:00
|
|
|
if ( ft_setjmp( FT_VALIDATOR( &valid )->jump_buffer) == 0 )
|
2002-03-22 16:02:38 +01:00
|
|
|
{
|
|
|
|
/* validate this cmap sub-table */
|
2005-05-10 00:11:36 +02:00
|
|
|
error = clazz->validate( cmap, FT_VALIDATOR( &valid ) );
|
2002-03-22 16:02:38 +01:00
|
|
|
}
|
2002-03-01 03:26:22 +01:00
|
|
|
|
2016-12-17 20:47:42 +01:00
|
|
|
if ( !valid.validator.error )
|
2005-05-10 00:11:36 +02:00
|
|
|
{
|
2005-11-29 12:32:53 +01:00
|
|
|
FT_CMap ttcmap;
|
2005-05-10 00:11:36 +02:00
|
|
|
|
2005-11-29 12:32:53 +01:00
|
|
|
|
2012-08-24 13:41:24 +02:00
|
|
|
/* It might make sense to store the single variation */
|
|
|
|
/* selector cmap somewhere special. But it would have to be */
|
|
|
|
/* in the public FT_FaceRec, and we can't change that. */
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2005-11-30 19:47:49 +01:00
|
|
|
if ( !FT_CMap_New( (FT_CMap_Class)clazz,
|
|
|
|
cmap, &charmap, &ttcmap ) )
|
2005-11-29 12:32:53 +01:00
|
|
|
{
|
|
|
|
/* it is simpler to directly set `flags' than adding */
|
|
|
|
/* a parameter to FT_CMap_New */
|
|
|
|
((TT_CMap)ttcmap)->flags = (FT_Int)error;
|
|
|
|
}
|
2005-05-10 00:11:36 +02:00
|
|
|
}
|
2002-03-01 03:26:22 +01:00
|
|
|
else
|
2002-03-31 20:48:24 +02:00
|
|
|
{
|
2009-06-26 06:15:41 +02:00
|
|
|
FT_TRACE0(( "tt_face_build_cmaps:"
|
|
|
|
" broken cmap sub-table ignored\n" ));
|
2002-03-31 20:48:24 +02:00
|
|
|
}
|
2004-01-11 11:01:08 +01:00
|
|
|
break;
|
2002-03-01 03:26:22 +01:00
|
|
|
}
|
|
|
|
}
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
|
2016-12-26 17:08:17 +01:00
|
|
|
if ( !*pclazz )
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
{
|
2009-06-26 06:15:41 +02:00
|
|
|
FT_TRACE0(( "tt_face_build_cmaps:"
|
|
|
|
" unsupported cmap sub-table ignored\n" ));
|
Add support for cmap type 14.
* devel/ftoption.h, include/freetype/config/ftoption.h
(TT_CONFIG_CMAP_FORMAT_14): New macro.
* include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc,
FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc,
FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New
support function prototypes.
(FT_CMap_ClassRec): Add them.
Update all users.
* include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New
macro.
* include/freetype/freetype.h (FT_Get_Char_Variant_Index,
FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors,
FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API
functions.
* src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary
function.
(FT_Set_Charmap): Disallow cmaps of type 14.
(FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault,
FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char,
FT_Get_Chars_Of_Variant): New API functions.
* src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros.
(TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate,
tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info,
tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary,
tt_cmap14_find_variant, tt_cmap14_char_var_index,
tt_cmap14_char_var_isdefault, tt_cmap14_variants,
tt_cmap14_char_variants, tt_cmap14_def_char_count,
tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars,
tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and
structures for cmap 14 support.
(tt_cmap_classes): Register tt_cmap14_class_rec.
(tt_face_build_cmaps): One more error message.
* docs/CHANGES: Mention cmap 14 support.
2007-10-15 19:21:32 +02:00
|
|
|
}
|
2002-03-01 03:26:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2002-03-01 03:26:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-12-17 15:28:22 +01:00
|
|
|
FT_LOCAL( FT_Error )
|
|
|
|
tt_get_cmap_info( FT_CharMap charmap,
|
|
|
|
TT_CMapInfo *cmap_info )
|
|
|
|
{
|
|
|
|
FT_CMap cmap = (FT_CMap)charmap;
|
|
|
|
TT_CMap_Class clazz = (TT_CMap_Class)cmap->clazz;
|
|
|
|
|
2017-06-22 04:52:37 +02:00
|
|
|
if ( clazz->get_cmap_info )
|
|
|
|
return clazz->get_cmap_info( charmap, cmap_info );
|
|
|
|
else
|
|
|
|
return FT_THROW( Invalid_CharMap_Format );
|
2003-12-17 15:28:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-27 22:25:47 +01:00
|
|
|
/* END */
|