freetype.h: Adding ft_encoding_xxx values for some CJK encodings.
Fixing copyright notice on many files. Changed some tracing levels. A lot of formatting, fixing documentation etc. as usual.
This commit is contained in:
parent
5617726108
commit
4e6dd8587e
@ -310,7 +310,10 @@
|
||||
ft_encoding_unicode = FT_MAKE_TAG('u','n','i','c'),
|
||||
ft_encoding_latin_2 = FT_MAKE_TAG('l','a','t','2'),
|
||||
ft_encoding_sjis = FT_MAKE_TAG('s','j','i','s'),
|
||||
ft_encoding_gb2312 = FT_MAKE_TAG('g','b',' ',' '),
|
||||
ft_encoding_big5 = FT_MAKE_TAG('b','i','g','5'),
|
||||
ft_encoding_wansung = FT_MAKE_TAG('w','a','n','s'),
|
||||
ft_encoding_johab = FT_MAKE_TAG('j','o','h','a'),
|
||||
|
||||
ft_encoding_adobe_standard = FT_MAKE_TAG('a','d','o','b'),
|
||||
ft_encoding_adobe_expert = FT_MAKE_TAG('a','d','b','e'),
|
||||
|
@ -7,8 +7,8 @@
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used */
|
||||
/* modified and distributed under the terms of the FreeType project */
|
||||
/* 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. */
|
||||
|
@ -7,8 +7,8 @@
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used */
|
||||
/* modified and distributed under the terms of the FreeType project */
|
||||
/* 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. */
|
||||
|
@ -7,8 +7,8 @@
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used */
|
||||
/* modified and distributed under the terms of the FreeType project */
|
||||
/* 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. */
|
||||
|
@ -7,8 +7,8 @@
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used */
|
||||
/* modified and distributed under the terms of the FreeType project */
|
||||
/* 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. */
|
||||
|
@ -7,8 +7,8 @@
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used */
|
||||
/* modified and distributed under the terms of the FreeType project */
|
||||
/* 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. */
|
||||
|
@ -7,8 +7,8 @@
|
||||
/* Copyright 2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used */
|
||||
/* modified and distributed under the terms of the FreeType project */
|
||||
/* 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. */
|
||||
|
@ -7,8 +7,8 @@
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used */
|
||||
/* modified and distributed under the terms of the FreeType project */
|
||||
/* 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. */
|
||||
|
@ -7,8 +7,8 @@
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used */
|
||||
/* modified and distributed under the terms of the FreeType project */
|
||||
/* 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. */
|
||||
|
@ -7,8 +7,8 @@
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used */
|
||||
/* modified and distributed under the terms of the FreeType project */
|
||||
/* 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. */
|
||||
|
@ -5,10 +5,10 @@
|
||||
/* The FreeType private base classes (base). */
|
||||
/* */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used */
|
||||
/* modified and distributed under the terms of the FreeType project */
|
||||
/* 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. */
|
||||
|
@ -7,8 +7,8 @@
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used */
|
||||
/* modified and distributed under the terms of the FreeType project */
|
||||
/* 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. */
|
||||
|
@ -7,8 +7,8 @@
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used */
|
||||
/* modified and distributed under the terms of the FreeType project */
|
||||
/* 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. */
|
||||
|
@ -7,8 +7,8 @@
|
||||
/* Copyright 2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used */
|
||||
/* modified and distributed under the terms of the FreeType project */
|
||||
/* 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. */
|
||||
|
@ -7,8 +7,8 @@
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used */
|
||||
/* modified and distributed under the terms of the FreeType project */
|
||||
/* 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. */
|
||||
|
@ -6,7 +6,7 @@
|
||||
# Copyright 1996-2000 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used modified
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
# 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
|
||||
|
@ -14,8 +14,6 @@
|
||||
|
||||
|
||||
ifndef PSNAMES_INCLUDE
|
||||
PSNAMES_INCLUDED := 1
|
||||
|
||||
# PSNAMES driver directory
|
||||
#
|
||||
PSNAMES_DIR := $(SRC_)psnames
|
||||
|
@ -14,18 +14,16 @@
|
||||
|
||||
|
||||
ifndef SFNT_INCLUDE
|
||||
SFNT_INCLUDED := 1
|
||||
|
||||
# SFNT driver directory
|
||||
#
|
||||
SFNT_DIR := $(SRC_)sfnt
|
||||
SFNT_DIR_ := $(SFNT_DIR)$(SEP)
|
||||
|
||||
|
||||
# additional include flags used when compiling the driver
|
||||
#
|
||||
SFNT_INCLUDE := $(SHARED) $(SFNT_DIR)
|
||||
|
||||
|
||||
# compilation flags for the driver
|
||||
#
|
||||
SFNT_CFLAGS := $(SFNT_INCLUDE:%=$I%)
|
||||
@ -41,7 +39,6 @@ ifndef SFNT_INCLUDE
|
||||
$(SFNT_DIR_)sfobjs.c \
|
||||
$(SFNT_DIR_)sfdriver.c
|
||||
|
||||
|
||||
# driver headers
|
||||
#
|
||||
SFNT_DRV_H := $(BASE_H) \
|
||||
|
@ -1,3 +1,21 @@
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* sfdriver.c */
|
||||
/* */
|
||||
/* High-level SFNT driver interface (body). */
|
||||
/* */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#include <freetype/internal/sfnt.h>
|
||||
#include <freetype/internal/ftobjs.h>
|
||||
#include <sfdriver.h>
|
||||
@ -7,24 +25,48 @@
|
||||
#include <ttcmap.h>
|
||||
#include <sfobjs.h>
|
||||
|
||||
|
||||
static
|
||||
void* get_sfnt_table( TT_Face face, FT_Sfnt_Tag tag )
|
||||
void* get_sfnt_table( TT_Face face,
|
||||
FT_Sfnt_Tag tag )
|
||||
{
|
||||
void* table;
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case ft_sfnt_head: table = &face->header; break;
|
||||
case ft_sfnt_hhea: table = &face->horizontal; break;
|
||||
case ft_sfnt_vhea: table = (face->vertical_info ? &face->vertical : 0 ); break;
|
||||
case ft_sfnt_os2: table = (face->os2.version == 0xFFFF ? 0 : &face->os2 ); break;
|
||||
case ft_sfnt_post: table = &face->postscript; break;
|
||||
case ft_sfnt_maxp: table = &face->max_profile; break;
|
||||
case ft_sfnt_pclt: table = face->pclt.Version ? &face->pclt : 0 ; break;
|
||||
|
||||
default:
|
||||
table = 0;
|
||||
switch ( tag )
|
||||
{
|
||||
case ft_sfnt_head:
|
||||
table = &face->header;
|
||||
break;
|
||||
|
||||
case ft_sfnt_hhea:
|
||||
table = &face->horizontal;
|
||||
break;
|
||||
|
||||
case ft_sfnt_vhea:
|
||||
table = face->vertical_info ? &face->vertical : 0;
|
||||
break;
|
||||
|
||||
case ft_sfnt_os2:
|
||||
table = face->os2.version == 0xFFFF ? 0 : &face->os2;
|
||||
break;
|
||||
|
||||
case ft_sfnt_post:
|
||||
table = &face->postscript;
|
||||
break;
|
||||
|
||||
case ft_sfnt_maxp:
|
||||
table = &face->max_profile;
|
||||
break;
|
||||
|
||||
case ft_sfnt_pclt:
|
||||
table = face->pclt.Version ? &face->pclt : 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
table = 0;
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
@ -33,9 +75,9 @@
|
||||
FTDriver_Interface SFNT_Get_Interface( FT_Driver driver,
|
||||
const char* interface )
|
||||
{
|
||||
UNUSED(driver);
|
||||
UNUSED( driver );
|
||||
|
||||
if (strcmp(interface,"get_sfnt")==0)
|
||||
if ( strcmp( interface, "get_sfnt" ) == 0 )
|
||||
return (FTDriver_Interface)get_sfnt_table;
|
||||
|
||||
return 0;
|
||||
@ -70,27 +112,27 @@
|
||||
|
||||
TT_Load_Kern,
|
||||
TT_Load_Gasp,
|
||||
TT_Load_PCLT,
|
||||
TT_Load_PCLT,
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
||||
/* see `ttsbit.h' */
|
||||
TT_Load_SBit_Strikes,
|
||||
TT_Load_SBit_Image,
|
||||
TT_Free_SBit_Strikes,
|
||||
#else
|
||||
#else /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
#endif
|
||||
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
||||
|
||||
/* see `ttpost.h' */
|
||||
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
/* see `ttpost.h' */
|
||||
TT_Get_PS_Name,
|
||||
TT_Free_Post_Names,
|
||||
#else
|
||||
#else /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
|
||||
0,
|
||||
0,
|
||||
#endif
|
||||
#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
|
||||
|
||||
/* see `ttcmap.h' */
|
||||
TT_CharMap_Load,
|
||||
@ -100,19 +142,20 @@
|
||||
|
||||
const FT_DriverInterface sfnt_driver_interface =
|
||||
{
|
||||
sizeof(FT_DriverRec),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
sizeof ( FT_DriverRec ), 0, 0, 0,
|
||||
|
||||
"sfnt", /* driver name */
|
||||
1, /* driver version */
|
||||
2, /* driver requires FreeType 2 or above */
|
||||
"sfnt", /* driver name */
|
||||
1, /* driver version */
|
||||
2, /* driver requires FreeType 2 or higher */
|
||||
|
||||
(void*)&sfnt_interface,
|
||||
|
||||
0, 0, 0,
|
||||
0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, 0,
|
||||
0, 0, 0,
|
||||
0,
|
||||
};
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -4,7 +4,7 @@
|
||||
/* */
|
||||
/* High-level SFNT driver interface (specification). */
|
||||
/* */
|
||||
/* Copyright 1996-1999 by */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
|
@ -1,3 +1,21 @@
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* sfnt.c */
|
||||
/* */
|
||||
/* Single object library component. */
|
||||
/* */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#define FT_MAKE_OPTION_SINGLE_OBJECT
|
||||
|
||||
#include <ttload.c>
|
||||
@ -15,3 +33,4 @@
|
||||
#include <sfdriver.c>
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -1,7 +1,26 @@
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* sfobjs.c */
|
||||
/* */
|
||||
/* SFNT object management (base). */
|
||||
/* */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#include <freetype/internal/sfnt.h>
|
||||
#include <freetype/internal/psnames.h>
|
||||
#include <freetype/ttnameid.h>
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
@ -16,7 +35,7 @@
|
||||
/* nameid :: The name id of the name record to return. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Char string. NULL if no name is present. */
|
||||
/* Character string. NULL if no name is present. */
|
||||
/* */
|
||||
static
|
||||
FT_String* Get_Name( TT_Face face,
|
||||
@ -27,7 +46,7 @@
|
||||
TT_NameRec* rec;
|
||||
FT_Bool wide_chars = 1;
|
||||
|
||||
/* first pass, look for a given name record */
|
||||
|
||||
rec = face->name_table.names;
|
||||
for ( n = 0; n < face->name_table.numNameRecords; n++, rec++ )
|
||||
{
|
||||
@ -36,17 +55,18 @@
|
||||
/* found the name - now create an ASCII string from it */
|
||||
FT_Bool found = 0;
|
||||
|
||||
/* Test for Microsoft English language */
|
||||
|
||||
/* test for Microsoft English language */
|
||||
if ( rec->platformID == TT_PLATFORM_MICROSOFT &&
|
||||
rec->encodingID <= TT_MS_ID_UNICODE_CS &&
|
||||
(rec->languageID & 0x3FF) == 0x009 )
|
||||
( rec->languageID & 0x3FF ) == 0x009 )
|
||||
found = 1;
|
||||
|
||||
/* Test for Apple Unicode encoding */
|
||||
/* test for Apple Unicode encoding */
|
||||
else if ( rec->platformID == TT_PLATFORM_APPLE_UNICODE )
|
||||
found = 1;
|
||||
|
||||
/* Test for Apple Roman */
|
||||
/* test for Apple Roman */
|
||||
else if ( rec->platformID == TT_PLATFORM_MACINTOSH &&
|
||||
rec->languageID == TT_MAC_ID_ROMAN )
|
||||
{
|
||||
@ -54,22 +74,24 @@
|
||||
wide_chars = 0;
|
||||
}
|
||||
|
||||
/* Found a Unicode Name */
|
||||
/* found a Unicode name */
|
||||
if ( found )
|
||||
{
|
||||
FT_String* string;
|
||||
FT_UInt len;
|
||||
|
||||
|
||||
if ( wide_chars )
|
||||
{
|
||||
TT_UInt m;
|
||||
|
||||
|
||||
len = (TT_UInt)rec->stringLength / 2;
|
||||
if ( MEM_Alloc( string, len + 1 ) )
|
||||
return NULL;
|
||||
|
||||
for ( m = 0; m < len; m ++ )
|
||||
string[m] = rec->string[2*m + 1];
|
||||
string[m] = rec->string[2 * m + 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -85,13 +107,14 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
FT_Encoding find_encoding( int platform_id,
|
||||
int encoding_id )
|
||||
FT_Encoding find_encoding( int platform_id,
|
||||
int encoding_id )
|
||||
{
|
||||
typedef struct TEncoding
|
||||
{
|
||||
@ -101,40 +124,42 @@
|
||||
|
||||
} TEncoding;
|
||||
|
||||
static
|
||||
const TEncoding tt_encodings[] =
|
||||
static const TEncoding tt_encodings[] =
|
||||
{
|
||||
{ TT_PLATFORM_ISO, -1, ft_encoding_unicode },
|
||||
{ TT_PLATFORM_ISO, -1, ft_encoding_unicode },
|
||||
|
||||
{ TT_PLATFORM_APPLE_UNICODE, -1, ft_encoding_unicode },
|
||||
{ TT_PLATFORM_APPLE_UNICODE, -1, ft_encoding_unicode },
|
||||
|
||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_ID_ROMAN, ft_encoding_apple_roman },
|
||||
{ TT_PLATFORM_MACINTOSH, TT_MAC_ID_ROMAN, ft_encoding_apple_roman },
|
||||
|
||||
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_UNICODE_CS, ft_encoding_unicode },
|
||||
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_SJIS, ft_encoding_sjis },
|
||||
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_BIG_5, ft_encoding_big5 }
|
||||
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_UNICODE_CS, ft_encoding_unicode },
|
||||
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_SJIS, ft_encoding_sjis },
|
||||
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_GB2312, ft_encoding_gb2312 },
|
||||
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_BIG_5, ft_encoding_big5 },
|
||||
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_WANSUNG, ft_encoding_wansung },
|
||||
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_JOHAB, ft_encoding_johab }
|
||||
};
|
||||
|
||||
const TEncoding *cur, *limit;
|
||||
|
||||
|
||||
cur = tt_encodings;
|
||||
limit = cur + sizeof(tt_encodings)/sizeof(tt_encodings[0]);
|
||||
limit = cur + sizeof ( tt_encodings ) / sizeof ( tt_encodings[0] );
|
||||
|
||||
for ( ; cur < limit; cur++ )
|
||||
{
|
||||
if (cur->platform_id == platform_id)
|
||||
if ( cur->platform_id == platform_id )
|
||||
{
|
||||
if (cur->encoding_id == encoding_id ||
|
||||
cur->encoding_id == -1 )
|
||||
if ( cur->encoding_id == encoding_id ||
|
||||
cur->encoding_id == -1 )
|
||||
return cur->encoding;
|
||||
}
|
||||
}
|
||||
|
||||
return ft_encoding_none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
LOCAL_FUNC
|
||||
FT_Error SFNT_Init_Face( FT_Stream stream,
|
||||
TT_Face face,
|
||||
@ -142,30 +167,32 @@
|
||||
TT_Int num_params,
|
||||
FT_Parameter* params )
|
||||
{
|
||||
FT_Error error;
|
||||
SFNT_Interface* sfnt;
|
||||
PSNames_Interface* psnames;
|
||||
SFNT_Header sfnt_header;
|
||||
FT_Error error;
|
||||
SFNT_Interface* sfnt;
|
||||
PSNames_Interface* psnames;
|
||||
SFNT_Header sfnt_header;
|
||||
|
||||
/* for now, parameters are unused */
|
||||
UNUSED(num_params);
|
||||
UNUSED(params);
|
||||
UNUSED( num_params );
|
||||
UNUSED( params );
|
||||
|
||||
|
||||
sfnt = (SFNT_Interface*)face->sfnt;
|
||||
if (!sfnt)
|
||||
if ( !sfnt )
|
||||
{
|
||||
/* look-up the SFNT driver */
|
||||
FT_Driver sfnt_driver;
|
||||
|
||||
|
||||
sfnt_driver = FT_Get_Driver( face->root.driver->library, "sfnt" );
|
||||
if (!sfnt_driver)
|
||||
if ( !sfnt_driver )
|
||||
{
|
||||
error = FT_Err_Invalid_File_Format;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
sfnt = (SFNT_Interface*)(sfnt_driver->interface.format_interface);
|
||||
if (!sfnt)
|
||||
sfnt = (SFNT_Interface*)( sfnt_driver->interface.format_interface );
|
||||
if ( !sfnt )
|
||||
{
|
||||
error = FT_Err_Invalid_File_Format;
|
||||
goto Exit;
|
||||
@ -176,27 +203,30 @@
|
||||
}
|
||||
|
||||
psnames = (PSNames_Interface*)face->psnames;
|
||||
if (!psnames)
|
||||
if ( !psnames )
|
||||
{
|
||||
/* look-up the PSNames driver */
|
||||
FT_Driver psnames_driver;
|
||||
|
||||
|
||||
psnames_driver = FT_Get_Driver( face->root.driver->library, "psnames" );
|
||||
if (psnames_driver)
|
||||
if ( psnames_driver )
|
||||
face->psnames = (PSNames_Interface*)
|
||||
(psnames_driver->interface.format_interface);
|
||||
( psnames_driver->interface.format_interface );
|
||||
}
|
||||
|
||||
/* check that we have a valid TrueType file */
|
||||
error = sfnt->load_sfnt_header( face, stream, face_index, &sfnt_header );
|
||||
if (error) goto Exit;
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
face->format_tag = sfnt_header.format_tag;
|
||||
face->num_tables = sfnt_header.num_tables;
|
||||
|
||||
/* Load font directory */
|
||||
error = sfnt->load_directory( face, stream, &sfnt_header );
|
||||
if ( error ) goto Exit;
|
||||
if ( error )
|
||||
goto Exit;
|
||||
|
||||
face->root.num_faces = face->ttc_header.DirCount;
|
||||
if ( face->root.num_faces < 1 )
|
||||
@ -207,9 +237,8 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
#undef LOAD_
|
||||
#define LOAD_(x) ( (error = sfnt->load_##x( face, stream )) != FT_Err_Ok )
|
||||
#define LOAD_( x ) ( (error = sfnt->load_##x( face, stream )) != FT_Err_Ok )
|
||||
|
||||
|
||||
LOCAL_FUNC
|
||||
@ -219,18 +248,19 @@
|
||||
TT_Int num_params,
|
||||
FT_Parameter* params )
|
||||
{
|
||||
FT_Error error;
|
||||
SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt;
|
||||
FT_Error error;
|
||||
SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt;
|
||||
|
||||
|
||||
/* Load tables */
|
||||
if ( LOAD_( header ) ||
|
||||
LOAD_( max_profile ) ||
|
||||
|
||||
(error = sfnt->load_metrics( face, stream, 0 )) != FT_Err_Ok ||
|
||||
/* load the `hhea' & `hmtx' tables at once */
|
||||
( error = sfnt->load_metrics( face, stream, 0 ) ) != FT_Err_Ok ||
|
||||
|
||||
(error = sfnt->load_metrics( face, stream, 1 )) != FT_Err_Ok ||
|
||||
/* try to load the `vhea' & `vmtx' at once if present */
|
||||
( error = sfnt->load_metrics( face, stream, 1 ) ) != FT_Err_Ok ||
|
||||
|
||||
LOAD_( charmaps ) ||
|
||||
LOAD_( names ) ||
|
||||
@ -240,10 +270,11 @@
|
||||
|
||||
/* the optional tables */
|
||||
|
||||
/* embedded bitmap support. */
|
||||
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
||||
if (sfnt->load_sbits && LOAD_(sbits)) goto Exit;
|
||||
#endif
|
||||
/* embedded bitmap support. */
|
||||
if ( sfnt->load_sbits && LOAD_( sbits ) )
|
||||
goto Exit;
|
||||
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
||||
|
||||
if ( LOAD_( hdmx ) ||
|
||||
LOAD_( gasp ) ||
|
||||
@ -267,21 +298,22 @@
|
||||
TT_Int n;
|
||||
FT_Memory memory;
|
||||
|
||||
|
||||
memory = root->memory;
|
||||
|
||||
/*****************************************************************/
|
||||
/* */
|
||||
/* Compute face flags. */
|
||||
/* */
|
||||
/*********************************************************************/
|
||||
/* */
|
||||
/* Compute face flags. */
|
||||
/* */
|
||||
flags = FT_FACE_FLAG_SCALABLE | /* scalable outlines */
|
||||
FT_FACE_FLAG_SFNT | /* SFNT file format */
|
||||
FT_FACE_FLAG_HORIZONTAL; /* horizontal data */
|
||||
|
||||
/* fixed width font ? */
|
||||
/* fixed width font? */
|
||||
if ( face->postscript.isFixedPitch )
|
||||
flags |= FT_FACE_FLAG_FIXED_WIDTH;
|
||||
|
||||
/* vertical information ? */
|
||||
/* vertical information? */
|
||||
if ( face->vertical_info )
|
||||
flags |= FT_FACE_FLAG_VERTICAL;
|
||||
|
||||
@ -291,15 +323,15 @@
|
||||
|
||||
root->face_flags = flags;
|
||||
|
||||
/*****************************************************************/
|
||||
/* */
|
||||
/* Compute style flags. */
|
||||
/* */
|
||||
/*********************************************************************/
|
||||
/* */
|
||||
/* Compute style flags. */
|
||||
/* */
|
||||
flags = 0;
|
||||
|
||||
if ( face->os2.version != 0xFFFF )
|
||||
{
|
||||
/* We have an OS/2 table, use the `fsSelection' field */
|
||||
/* we have an OS/2 table; use the `fsSelection' field */
|
||||
if ( face->os2.fsSelection & 1 )
|
||||
flags |= FT_STYLE_FLAG_ITALIC;
|
||||
|
||||
@ -308,7 +340,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This is an old Mac font, use the header field */
|
||||
/* this is an old Mac font, use the header field */
|
||||
if ( face->header.Mac_Style & 1 )
|
||||
flags |= FT_STYLE_FLAG_BOLD;
|
||||
|
||||
@ -318,13 +350,13 @@
|
||||
|
||||
face->root.style_flags = flags;
|
||||
|
||||
/*****************************************************************/
|
||||
/* */
|
||||
/* Polish the charmaps. */
|
||||
/* */
|
||||
/* Try to set the charmap encoding according to the platform & */
|
||||
/* encoding ID of each charmap. */
|
||||
/* */
|
||||
/*********************************************************************/
|
||||
/* */
|
||||
/* Polish the charmaps. */
|
||||
/* */
|
||||
/* Try to set the charmap encoding according to the platform & */
|
||||
/* encoding ID of each charmap. */
|
||||
/* */
|
||||
charmap = face->charmaps;
|
||||
root->num_charmaps = face->num_charmaps;
|
||||
|
||||
@ -337,13 +369,16 @@
|
||||
FT_Int platform = charmap->cmap.platformID;
|
||||
FT_Int encoding = charmap->cmap.platformEncodingID;
|
||||
|
||||
|
||||
charmap->root.face = (FT_Face)face;
|
||||
charmap->root.platform_id = platform;
|
||||
charmap->root.encoding_id = encoding;
|
||||
charmap->root.encoding = find_encoding(platform,encoding);
|
||||
charmap->root.encoding = find_encoding( platform, encoding );
|
||||
|
||||
/* now, set root->charmap with a unicode charmap wherever available */
|
||||
if (!root->charmap && charmap->root.encoding == ft_encoding_unicode)
|
||||
/* now, set root->charmap with a unicode charmap */
|
||||
/* wherever available */
|
||||
if ( !root->charmap &&
|
||||
charmap->root.encoding == ft_encoding_unicode )
|
||||
root->charmap = (FT_CharMap)charmap;
|
||||
|
||||
root->charmaps[n] = (FT_CharMap)charmap;
|
||||
@ -358,34 +393,34 @@
|
||||
FT_Bitmap_Size ) )
|
||||
return error;
|
||||
|
||||
for ( n = 0 ; n < face->num_sbit_strikes ; n++ )
|
||||
{
|
||||
face->root.available_sizes[n].width =
|
||||
face->sbit_strikes[n].x_ppem;
|
||||
face->root.available_sizes[n].height =
|
||||
face->sbit_strikes[n].y_ppem;
|
||||
}
|
||||
for ( n = 0 ; n < face->num_sbit_strikes ; n++ )
|
||||
{
|
||||
face->root.available_sizes[n].width =
|
||||
face->sbit_strikes[n].x_ppem;
|
||||
face->root.available_sizes[n].height =
|
||||
face->sbit_strikes[n].y_ppem;
|
||||
}
|
||||
}
|
||||
else
|
||||
#else
|
||||
#else /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
||||
{
|
||||
root->num_fixed_sizes = 0;
|
||||
root->available_sizes = 0;
|
||||
}
|
||||
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
||||
|
||||
/*****************************************************************/
|
||||
/* */
|
||||
/* Set up metrics. */
|
||||
/* */
|
||||
/*********************************************************************/
|
||||
/* */
|
||||
/* Set up metrics. */
|
||||
/* */
|
||||
root->bbox.xMin = face->header.xMin;
|
||||
root->bbox.yMin = face->header.yMin;
|
||||
root->bbox.xMax = face->header.xMax;
|
||||
root->bbox.yMax = face->header.yMax;
|
||||
root->units_per_EM = face->header.Units_Per_EM;
|
||||
|
||||
/* The ascender/descender/height are computed from the OS/2 table */
|
||||
/* when found. Otherwise, they're taken from the horizontal header */
|
||||
/* The ascender/descender/height are computed from the OS/2 table */
|
||||
/* when found. Otherwise, they're taken from the horizontal header. */
|
||||
if ( face->os2.version != 0xFFFF )
|
||||
{
|
||||
root->ascender = face->os2.sTypoAscender;
|
||||
@ -401,11 +436,11 @@
|
||||
face->horizontal.Line_Gap;
|
||||
}
|
||||
|
||||
root->max_advance_width = face->horizontal.advance_Width_Max;
|
||||
root->max_advance_width = face->horizontal.advance_Width_Max;
|
||||
|
||||
root->max_advance_height = root->height;
|
||||
if ( face->vertical_info )
|
||||
root->max_advance_height = face->vertical.advance_Height_Max;
|
||||
root->max_advance_height = face->vertical_info
|
||||
? face->vertical.advance_Height_Max
|
||||
: root->height;
|
||||
|
||||
root->underline_position = face->postscript.underlinePosition;
|
||||
root->underline_thickness = face->postscript.underlineThickness;
|
||||
@ -428,14 +463,15 @@
|
||||
FT_Memory memory = face->root.memory;
|
||||
SFNT_Interface* sfnt = face->sfnt;
|
||||
|
||||
if (sfnt)
|
||||
|
||||
if ( sfnt )
|
||||
{
|
||||
/* destroy the postscript names table if it is supported */
|
||||
if (sfnt->free_psnames)
|
||||
/* destroy the postscript names table if it is loaded */
|
||||
if ( sfnt->free_psnames )
|
||||
sfnt->free_psnames( face );
|
||||
|
||||
/* destroy the embedded bitmaps table if it is supported */
|
||||
if (sfnt->free_sbits)
|
||||
/* destroy the embedded bitmaps table if it is loaded */
|
||||
if ( sfnt->free_sbits )
|
||||
sfnt->free_sbits( face );
|
||||
}
|
||||
|
||||
@ -455,6 +491,8 @@
|
||||
if (sfnt && sfnt->load_charmaps )
|
||||
{
|
||||
FT_UShort n;
|
||||
|
||||
|
||||
for ( n = 0; n < face->num_charmaps; n++ )
|
||||
sfnt->free_charmap( face, &face->charmaps[n].cmap );
|
||||
}
|
||||
@ -500,3 +538,5 @@
|
||||
face->sfnt = 0;
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -2,9 +2,9 @@
|
||||
/* */
|
||||
/* sfobjs.h */
|
||||
/* */
|
||||
/* SFNT object management */
|
||||
/* SFNT object management (specification). */
|
||||
/* */
|
||||
/* Copyright 1996-1999 by */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
@ -15,12 +15,14 @@
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef SFOBJS_H
|
||||
#define SFOBJS_H
|
||||
|
||||
#include <freetype/internal/sfnt.h>
|
||||
#include <freetype/internal/ftobjs.h>
|
||||
|
||||
|
||||
LOCAL_DEF
|
||||
FT_Error SFNT_Init_Face( FT_Stream stream,
|
||||
TT_Face face,
|
||||
|
@ -4,11 +4,11 @@
|
||||
/* */
|
||||
/* TrueType character mapping table (cmap) support (body). */
|
||||
/* */
|
||||
/* Copyright 1996-1999 by */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used */
|
||||
/* modified and distributed under the terms of the FreeType project */
|
||||
/* 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. */
|
||||
@ -22,15 +22,26 @@
|
||||
#include <ttload.h>
|
||||
#include <ttcmap.h>
|
||||
|
||||
/* required by the tracing mode */
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* 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. */
|
||||
/* */
|
||||
#undef FT_COMPONENT
|
||||
#define FT_COMPONENT trace_ttcmap
|
||||
#define FT_COMPONENT trace_ttcmap
|
||||
|
||||
|
||||
static TT_UInt code_to_index0( TT_CMapTable* charmap, TT_ULong char_code );
|
||||
static TT_UInt code_to_index2( TT_CMapTable* charmap, TT_ULong char_code );
|
||||
static TT_UInt code_to_index4( TT_CMapTable* charmap, TT_ULong char_code );
|
||||
static TT_UInt code_to_index6( TT_CMapTable* charmap, TT_ULong char_code );
|
||||
static TT_UInt code_to_index0( TT_CMapTable* charmap,
|
||||
TT_ULong char_code );
|
||||
static TT_UInt code_to_index2( TT_CMapTable* charmap,
|
||||
TT_ULong char_code );
|
||||
static TT_UInt code_to_index4( TT_CMapTable* charmap,
|
||||
TT_ULong char_code );
|
||||
static TT_UInt code_to_index6( TT_CMapTable* charmap,
|
||||
TT_ULong char_code );
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
@ -48,7 +59,7 @@
|
||||
/* table :: A pointer to a cmap object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Error code. 0 means success. */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* The function assumes that the stream is already in use (i.e., */
|
||||
@ -119,7 +130,7 @@
|
||||
/* load subheaders */
|
||||
|
||||
cmap2->numGlyphId = l =
|
||||
( ( cmap->length - 2L*(256+3) - num_SH*8L ) & 0xffff ) / 2;
|
||||
( ( cmap->length - 2L * ( 256 + 3 ) - num_SH * 8L ) & 0xffff ) / 2;
|
||||
|
||||
if ( ALLOC_ARRAY( cmap2->subHeaders,
|
||||
num_SH + 1,
|
||||
@ -177,8 +188,8 @@
|
||||
|
||||
if ( ALLOC_ARRAY( cmap4->segments,
|
||||
num_Seg,
|
||||
TT_CMap4Segment ) ||
|
||||
ACCESS_Frame( (num_Seg * 4 + 1) * 2L ) )
|
||||
TT_CMap4Segment ) ||
|
||||
ACCESS_Frame( ( num_Seg * 4 + 1 ) * 2L ) )
|
||||
goto Fail;
|
||||
|
||||
segments = cmap4->segments;
|
||||
@ -200,12 +211,12 @@
|
||||
FORGET_Frame();
|
||||
|
||||
cmap4->numGlyphId = l =
|
||||
( ( cmap->length - ( 16L + 8L * num_Seg ) ) & 0xFFFF ) /2;
|
||||
( ( cmap->length - ( 16L + 8L * num_Seg ) ) & 0xFFFF ) / 2;
|
||||
|
||||
/* load IDs */
|
||||
|
||||
if ( ALLOC_ARRAY( cmap4->glyphIdArray, l, TT_UShort ) ||
|
||||
ACCESS_Frame( l*2L ) )
|
||||
ACCESS_Frame( l * 2L ) )
|
||||
goto Fail;
|
||||
|
||||
for ( i = 0; i < l; i++ )
|
||||
@ -248,6 +259,7 @@
|
||||
return TT_Err_Invalid_CharMap_Format;
|
||||
|
||||
}
|
||||
|
||||
return TT_Err_Ok;
|
||||
|
||||
Fail:
|
||||
@ -269,7 +281,7 @@
|
||||
/* cmap :: A handle to a cmap object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Error code. 0 means success. */
|
||||
/* TrueType error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_FUNC
|
||||
TT_Error TT_CharMap_Free( TT_Face face,
|
||||
@ -316,7 +328,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
@ -332,8 +343,7 @@
|
||||
/* cmap0 :: A pointer to a cmap table in format 0. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Glyph index into the glyphs array. 0 if the glyph does not */
|
||||
/* exist. */
|
||||
/* Glyph index into the glyphs array. 0 if the glyph does not exist. */
|
||||
/* */
|
||||
static
|
||||
TT_UInt code_to_index0( TT_CMapTable* cmap,
|
||||
@ -341,6 +351,7 @@
|
||||
{
|
||||
TT_CMap0* cmap0 = &cmap->c.cmap0;
|
||||
|
||||
|
||||
return ( charCode <= 0xFF ? cmap0->glyphIdArray[charCode] : 0 );
|
||||
}
|
||||
|
||||
@ -358,54 +369,53 @@
|
||||
/* cmap2 :: A pointer to a cmap table in format 2. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Glyph index into the glyphs array. 0 if the glyph does not */
|
||||
/* exist. */
|
||||
/* Glyph index into the glyphs array. 0 if the glyph does not exist. */
|
||||
/* */
|
||||
static
|
||||
TT_UInt code_to_index2( TT_CMapTable* cmap,
|
||||
TT_ULong charCode )
|
||||
{
|
||||
TT_UInt result, index1, offset;
|
||||
TT_UInt char_lo;
|
||||
TT_ULong char_hi;
|
||||
TT_CMap2SubHeader* sh2;
|
||||
TT_CMap2* cmap2;
|
||||
TT_UInt result, index1, offset;
|
||||
TT_UInt char_lo;
|
||||
TT_ULong char_hi;
|
||||
TT_CMap2SubHeader* sh2;
|
||||
TT_CMap2* cmap2;
|
||||
|
||||
|
||||
cmap2 = &cmap->c.cmap2;
|
||||
result = 0;
|
||||
char_lo = (TT_UInt)(charCode & 0xFF);
|
||||
char_lo = (TT_UInt)( charCode & 0xFF );
|
||||
char_hi = charCode >> 8;
|
||||
|
||||
if ( char_hi == 0 )
|
||||
{
|
||||
/* an 8-bit character code - we use the subHeader 0 in this case */
|
||||
/* to test wether the character code is in the charmap */
|
||||
/* to test whether the character code is in the charmap */
|
||||
if ( cmap2->subHeaderKeys[char_lo] == 0 )
|
||||
{
|
||||
result = cmap2->glyphIdArray[char_lo];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* a 16-bit character code */
|
||||
index1 = cmap2->subHeaderKeys[ char_hi & 0xFF ];
|
||||
if (index1)
|
||||
index1 = cmap2->subHeaderKeys[char_hi & 0xFF];
|
||||
if ( index1 )
|
||||
{
|
||||
sh2 = cmap2->subHeaders + index1;
|
||||
char_lo -= sh2->firstCode;
|
||||
|
||||
if (char_lo < sh2->entryCount)
|
||||
if ( char_lo < sh2->entryCount )
|
||||
{
|
||||
offset = sh2->idRangeOffset/2 + char_lo;
|
||||
if (offset < cmap2->numGlyphId)
|
||||
offset = sh2->idRangeOffset / 2 + char_lo;
|
||||
if ( offset < cmap2->numGlyphId )
|
||||
{
|
||||
result = cmap2->glyphIdArray[offset];
|
||||
if (result)
|
||||
result = (result + sh2->idDelta) & 0xFFFF;
|
||||
if ( result )
|
||||
result = ( result + sh2->idDelta ) & 0xFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -423,8 +433,7 @@
|
||||
/* cmap4 :: A pointer to a cmap table in format 4. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Glyph index into the glyphs array. 0 if the glyph does not */
|
||||
/* exist. */
|
||||
/* Glyph index into the glyphs array. 0 if the glyph does not exist. */
|
||||
/* */
|
||||
static
|
||||
TT_UInt code_to_index4( TT_CMapTable* cmap,
|
||||
@ -434,6 +443,7 @@
|
||||
TT_CMap4* cmap4;
|
||||
TT_CMap4Segment *seg4, *limit;
|
||||
|
||||
|
||||
cmap4 = &cmap->c.cmap4;
|
||||
result = 0;
|
||||
segCount = cmap4->segCountX2 / 2;
|
||||
@ -448,8 +458,8 @@
|
||||
|
||||
for ( seg4 = cmap4->segments; seg4 < limit; seg4++, segCount-- )
|
||||
{
|
||||
/* the ranges are sorted in increasing order, if we're out of */
|
||||
/* the range here, the char code isn't in the charmap, so exit */
|
||||
/* the ranges are sorted in increasing order. If we are out of */
|
||||
/* the range here, the char code isn't in the charmap, so exit. */
|
||||
if ( charCode > seg4->endCount )
|
||||
continue;
|
||||
|
||||
@ -461,24 +471,23 @@
|
||||
Found:
|
||||
cmap4->last_segment = seg4;
|
||||
|
||||
/* when the idRangeOffset is 0, we can compute the glyph index */
|
||||
/* directly.. */
|
||||
/* if the idRangeOffset is 0, we can compute the glyph index */
|
||||
/* directly */
|
||||
|
||||
if ( seg4->idRangeOffset == 0 )
|
||||
result = (charCode + seg4->idDelta) & 0xFFFF;
|
||||
|
||||
result = ( charCode + seg4->idDelta ) & 0xFFFF;
|
||||
else
|
||||
/* otherwise, we must use the glyphIdArray to do it */
|
||||
{
|
||||
index1 = seg4->idRangeOffset/2 + (charCode - seg4->startCount)
|
||||
/* otherwise, we must use the glyphIdArray to do it */
|
||||
index1 = seg4->idRangeOffset / 2
|
||||
+ ( charCode - seg4->startCount )
|
||||
- segCount;
|
||||
|
||||
if ( index1 < cmap4->numGlyphId &&
|
||||
cmap4->glyphIdArray[index1] != 0 )
|
||||
{
|
||||
result = (cmap4->glyphIdArray[index1] + seg4->idDelta) & 0xFFFF;
|
||||
}
|
||||
result = ( cmap4->glyphIdArray[index1] + seg4->idDelta ) & 0xFFFF;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -496,16 +505,16 @@
|
||||
/* cmap6 :: A pointer to a cmap table in format 6. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Glyph index into the glyphs array. 0 if the glyph does not */
|
||||
/* exist. */
|
||||
/* Glyph index into the glyphs array. 0 if the glyph does not exist. */
|
||||
/* */
|
||||
static
|
||||
TT_UInt code_to_index6( TT_CMapTable* cmap,
|
||||
TT_ULong charCode )
|
||||
TT_ULong charCode )
|
||||
{
|
||||
TT_CMap6* cmap6;
|
||||
TT_UInt result = 0;
|
||||
|
||||
|
||||
cmap6 = &cmap->c.cmap6;
|
||||
result = 0;
|
||||
charCode -= cmap6->firstCode;
|
||||
|
@ -4,11 +4,11 @@
|
||||
/* */
|
||||
/* TrueType character mapping table (cmap) support (specification). */
|
||||
/* */
|
||||
/* Copyright 1996-1999 by */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used */
|
||||
/* modified and distributed under the terms of the FreeType project */
|
||||
/* 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. */
|
||||
@ -26,50 +26,11 @@
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* TT_CharMap_Load */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Loads a given TrueType character map into memory. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A handle to the parent face object. */
|
||||
/* stream :: A handle to the current stream object. */
|
||||
/* */
|
||||
/* <InOut> */
|
||||
/* cmap :: A pointer to a cmap object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Error code. 0 means success. */
|
||||
/* */
|
||||
/* <Note> */
|
||||
/* The function assumes that the stream is already in use (i.e., */
|
||||
/* opened). In case of error, all partially allocated tables are */
|
||||
/* released. */
|
||||
/* */
|
||||
LOCAL_DEF
|
||||
TT_Error TT_CharMap_Load( TT_Face face,
|
||||
TT_CMapTable* cmap,
|
||||
FT_Stream input );
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* TT_CharMap_Free */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Destroys a character mapping table. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* face :: A handle to the parent face object. */
|
||||
/* cmap :: A handle to a cmap object. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* Error code. 0 means success. */
|
||||
/* */
|
||||
LOCAL_DEF
|
||||
TT_Error TT_CharMap_Free( TT_Face face,
|
||||
TT_CMapTable* cmap );
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,11 +5,11 @@
|
||||
/* Load the basic TrueType tables, i.e., tables that can be either in */
|
||||
/* TTF or OTF font (specification). */
|
||||
/* */
|
||||
/* Copyright 1996-1999 by */
|
||||
/* Copyright 1996-2000 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used */
|
||||
/* modified and distributed under the terms of the FreeType project */
|
||||
/* 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. */
|
||||
@ -23,9 +23,10 @@
|
||||
|
||||
#include <freetype/internal/ftstream.h>
|
||||
#include <freetype/internal/tttypes.h>
|
||||
/*
|
||||
|
||||
#if 0
|
||||
#include <ttobjs.h>
|
||||
*/
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -37,17 +38,17 @@
|
||||
TT_ULong tag );
|
||||
|
||||
LOCAL_DEF
|
||||
TT_Error TT_Goto_Table( TT_Face face,
|
||||
TT_ULong tag,
|
||||
FT_Stream stream,
|
||||
TT_ULong *length );
|
||||
TT_Error TT_Goto_Table( TT_Face face,
|
||||
TT_ULong tag,
|
||||
FT_Stream stream,
|
||||
TT_ULong* length );
|
||||
|
||||
|
||||
LOCAL_DEF
|
||||
TT_Error TT_Load_SFNT_Header( TT_Face face,
|
||||
FT_Stream stream,
|
||||
TT_Long face_index,
|
||||
SFNT_Header* sfnt );
|
||||
TT_Error TT_Load_SFNT_Header( TT_Face face,
|
||||
FT_Stream stream,
|
||||
TT_Long face_index,
|
||||
SFNT_Header* sfnt );
|
||||
LOCAL_DEF
|
||||
TT_Error TT_Load_Directory( TT_Face face,
|
||||
FT_Stream stream,
|
||||
|
Loading…
Reference in New Issue
Block a user