Prepare use of pscmap service within CFF module.

* include/freetype/internal/services/svpscmap.h: Include
FT_INTERNAL_OBJECTS_H.
(PS_Unicode_Index_Func): Removed.  Unused.
(PS_Macintosh_Name_Func): Renamed to...
(PS_Macintosh_NameFunc): This.
Update all callers.
(PS_Adobe_Std_Strings_Func): Renamed to...
(PS_Adobe_Std_StringsFunc): This.
Update all callers.
(PS_UnicodesRec): This is the former `PS_Unicodes' structure.
Add `cmap' member.
Update all callers.
(PS_Unicodes): This is now a typedef'd pointer to PS_UnicodesRec.
Update all callers.
(PS_Glyph_NameFunc): New typedef.
(PS_Unicodes_InitFunc): Change arguments to expect a function
and generic data pointer which returns a glyph name from a given
index.

* src/psnames/psmodule.c (ps_unicodes_init, ps_unicodes_char_index,
ps_unicodes_char_next, pscmaps_interface): Updated.

* include/freetype/internal/t1types.h (T1_FaceRec): Updated.

* src/psaux/t1cmap.h (T1_CmapStdRec): Updated.
(T1_CmapUnicode, T1_CmapUnicodeRec): Removed.

* src/psaux/t1cmap.c (t1_get_glyph_name): New callback function.
(t1_cmap_unicode_init, t1_cmap_unicode_done,
t1_cmap_unicode_char_index, t1_cmap_unicode_char_next,
t1_cmap_unicode_class_rec): Updated.

* src/type42/t42types.h (T42_FaceRec): Updated.
This commit is contained in:
Werner Lemberg 2006-01-12 08:12:27 +00:00
parent 356a4d894c
commit 8ab0979d6e
7 changed files with 136 additions and 90 deletions

View File

@ -1,10 +1,48 @@
2006-01-12 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
2006-01-12 Werner Lemberg <wl@gnu.org>
Prepare use of pscmap service within CFF module.
* include/freetype/internal/services/svpscmap.h: Include
FT_INTERNAL_OBJECTS_H.
(PS_Unicode_Index_Func): Removed. Unused.
(PS_Macintosh_Name_Func): Renamed to...
(PS_Macintosh_NameFunc): This.
Update all callers.
(PS_Adobe_Std_Strings_Func): Renamed to...
(PS_Adobe_Std_StringsFunc): This.
Update all callers.
(PS_UnicodesRec): This is the former `PS_Unicodes' structure.
Add `cmap' member.
Update all callers.
(PS_Unicodes): This is now a typedef'd pointer to PS_UnicodesRec.
Update all callers.
(PS_Glyph_NameFunc): New typedef.
(PS_Unicodes_InitFunc): Change arguments to expect a function
and generic data pointer which returns a glyph name from a given
index.
* src/psnames/psmodule.c (ps_unicodes_init, ps_unicodes_char_index,
ps_unicodes_char_next, pscmaps_interface): Updated.
* include/freetype/internal/t1types.h (T1_FaceRec): Updated.
* src/psaux/t1cmap.h (T1_CmapStdRec): Updated.
(T1_CmapUnicode, T1_CmapUnicodeRec): Removed.
* src/psaux/t1cmap.c (t1_get_glyph_name): New callback function.
(t1_cmap_unicode_init, t1_cmap_unicode_done,
t1_cmap_unicode_char_index, t1_cmap_unicode_char_next,
t1_cmap_unicode_class_rec): Updated.
* src/type42/t42types.h (T42_FaceRec): Updated.
2006-01-11 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
* include/freetype/ftmac.h: Add declaration of new functions
FT_New_Face_From_FSRef and FT_GetFile_From_Mac_ATS_Name that
were introduced by the jumbo patch on 2006-01-11.
2006-01-10 Werner Lemberg <wl@gnu.org>
2006-01-11 Werner Lemberg <wl@gnu.org>
Fix Savannah bug #15056 and use pscmap service in psaux module.

View File

@ -19,6 +19,8 @@
#ifndef __SVPSCMAP_H__
#define __SVPSCMAP_H__
#include FT_INTERNAL_OBJECTS_H
FT_BEGIN_HEADER
@ -32,25 +34,18 @@ FT_BEGIN_HEADER
typedef FT_UInt32
(*PS_Unicode_ValueFunc)( const char* glyph_name );
/*
* Unicode value to Adobe glyph name index. 0xFFFF if not found.
*/
typedef FT_UInt
(*PS_Unicode_Index_Func)( FT_UInt num_glyphs,
const char** glyph_names,
FT_ULong unicode );
/*
* Macintosh name id to glyph name. NULL if invalid index.
*/
typedef const char*
(*PS_Macintosh_Name_Func)( FT_UInt name_index );
(*PS_Macintosh_NameFunc)( FT_UInt name_index );
/*
* Adobe standard string ID to glyph name. NULL if invalid index.
*/
typedef const char*
(*PS_Adobe_Std_Strings_Func)( FT_UInt string_index );
(*PS_Adobe_Std_StringsFunc)( FT_UInt string_index );
/*
* Simple unicode -> glyph index charmap built from font glyph names
@ -64,27 +59,39 @@ FT_BEGIN_HEADER
} PS_UniMap;
typedef struct PS_Unicodes_
typedef struct PS_UnicodesRec_* PS_Unicodes;
typedef struct PS_UnicodesRec_
{
FT_CMapRec cmap;
FT_UInt num_maps;
PS_UniMap* maps;
} PS_Unicodes;
} PS_UnicodesRec;
/*
* A function which returns a glyph name for a given index. Returns
* NULL if invalid index.
*/
typedef const char*
(*PS_Glyph_NameFunc)( FT_Pointer data,
FT_UInt string_index );
typedef FT_Error
(*PS_Unicodes_InitFunc)( FT_Memory memory,
FT_UInt num_glyphs,
FT_String** glyph_names,
PS_Unicodes* unicodes );
(*PS_Unicodes_InitFunc)( FT_Memory memory,
PS_Unicodes unicodes,
FT_UInt num_glyphs,
PS_Glyph_NameFunc get_glyph_name,
FT_Pointer glyph_data );
typedef FT_UInt
(*PS_Unicodes_CharIndexFunc)( PS_Unicodes* unicodes,
FT_UInt32 unicode );
(*PS_Unicodes_CharIndexFunc)( PS_Unicodes unicodes,
FT_UInt32 unicode );
typedef FT_ULong
(*PS_Unicodes_CharNextFunc)( PS_Unicodes* unicodes,
FT_UInt32 *unicode );
(*PS_Unicodes_CharNextFunc)( PS_Unicodes unicodes,
FT_UInt32 *unicode );
FT_DEFINE_SERVICE( PsCMaps )
@ -95,8 +102,8 @@ FT_BEGIN_HEADER
PS_Unicodes_CharIndexFunc unicodes_char_index;
PS_Unicodes_CharNextFunc unicodes_char_next;
PS_Macintosh_Name_Func macintosh_name;
PS_Adobe_Std_Strings_Func adobe_std_strings;
PS_Macintosh_NameFunc macintosh_name;
PS_Adobe_Std_StringsFunc adobe_std_strings;
const unsigned short* adobe_std_encoding;
const unsigned short* adobe_expert_encoding;
};

View File

@ -5,7 +5,7 @@
/* Basic Type1/Type2 type definitions and interface (specification */
/* only). */
/* */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* Copyright 1996-2001, 2002, 2003, 2004, 2006 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -148,20 +148,20 @@ FT_BEGIN_HEADER
typedef struct T1_FaceRec_
{
FT_FaceRec root;
T1_FontRec type1;
const void* psnames;
const void* psaux;
const void* afm_data;
FT_CharMapRec charmaprecs[2];
FT_CharMap charmaps[2];
PS_Unicodes unicode_map;
FT_FaceRec root;
T1_FontRec type1;
const void* psnames;
const void* psaux;
const void* afm_data;
FT_CharMapRec charmaprecs[2];
FT_CharMap charmaps[2];
PS_UnicodesRec unicode_map;
/* support for Multiple Masters fonts */
PS_Blend blend;
PS_Blend blend;
/* since FT 2.1 - interface to PostScript hinter */
const void* pshinter;
const void* pshinter;
} T1_FaceRec;

View File

@ -257,61 +257,70 @@
/*************************************************************************/
/*************************************************************************/
FT_CALLBACK_DEF( FT_Error )
t1_cmap_unicode_init( T1_CMapUnicode cmap )
const char *
t1_get_glyph_name( T1_Face face,
FT_UInt idx )
{
T1_Face face = (T1_Face)FT_CMAP_FACE( cmap );
return face->type1.glyph_names[idx];
}
FT_CALLBACK_DEF( FT_Error )
t1_cmap_unicode_init( PS_Unicodes unicodes )
{
T1_Face face = (T1_Face)FT_CMAP_FACE( unicodes );
FT_Memory memory = FT_FACE_MEMORY( face );
FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
return psnames->unicodes_init( memory,
unicodes,
face->type1.num_glyphs,
face->type1.glyph_names,
&cmap->unicodes );
(PS_Glyph_NameFunc)&t1_get_glyph_name,
(FT_Pointer)face );
}
FT_CALLBACK_DEF( void )
t1_cmap_unicode_done( T1_CMapUnicode cmap )
t1_cmap_unicode_done( PS_Unicodes unicodes )
{
FT_Face face = FT_CMAP_FACE( cmap );
FT_Face face = FT_CMAP_FACE( unicodes );
FT_Memory memory = FT_FACE_MEMORY( face );
FT_FREE( cmap->unicodes.maps );
cmap->unicodes.num_maps = 0;
FT_FREE( unicodes->maps );
unicodes->num_maps = 0;
}
FT_CALLBACK_DEF( FT_UInt )
t1_cmap_unicode_char_index( T1_CMapUnicode cmap,
FT_UInt32 char_code )
t1_cmap_unicode_char_index( PS_Unicodes unicodes,
FT_UInt32 char_code )
{
T1_Face face = (T1_Face)FT_CMAP_FACE( cmap );
T1_Face face = (T1_Face)FT_CMAP_FACE( unicodes );
FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
return psnames->unicodes_char_index( &cmap->unicodes, char_code );
return psnames->unicodes_char_index( unicodes, char_code );
}
FT_CALLBACK_DEF( FT_UInt )
t1_cmap_unicode_char_next( T1_CMapUnicode cmap,
FT_UInt32 *pchar_code )
t1_cmap_unicode_char_next( PS_Unicodes unicodes,
FT_UInt32 *pchar_code )
{
T1_Face face = (T1_Face)FT_CMAP_FACE( cmap );
T1_Face face = (T1_Face)FT_CMAP_FACE( unicodes );
FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
return psnames->unicodes_char_next( &cmap->unicodes, pchar_code );
return psnames->unicodes_char_next( unicodes, pchar_code );
}
FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec
t1_cmap_unicode_class_rec =
{
sizeof ( T1_CMapUnicodeRec ),
sizeof ( PS_UnicodesRec ),
(FT_CMap_InitFunc) t1_cmap_unicode_init,
(FT_CMap_DoneFunc) t1_cmap_unicode_done,

View File

@ -39,13 +39,13 @@ FT_BEGIN_HEADER
typedef struct T1_CMapStdRec_
{
FT_CMapRec cmap;
FT_CMapRec cmap;
const FT_UShort* code_to_sid;
PS_Adobe_Std_Strings_Func sid_to_string;
const FT_UShort* code_to_sid;
PS_Adobe_Std_StringsFunc sid_to_string;
FT_UInt num_glyphs;
const char* const* glyph_names;
FT_UInt num_glyphs;
const char* const* glyph_names;
} T1_CMapStdRec;
@ -90,15 +90,6 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* unicode (synthetic) cmaps */
typedef struct T1_CMapUnicodeRec_* T1_CMapUnicode;
typedef struct T1_CMapUnicodeRec_
{
FT_CMapRec cmap;
PS_Unicodes unicodes;
} T1_CMapUnicodeRec;
FT_CALLBACK_TABLE const FT_CMap_ClassRec
t1_cmap_unicode_class_rec;

View File

@ -182,10 +182,11 @@
/* Build a table that maps Unicode values to glyph indices. */
static FT_Error
ps_unicodes_init( FT_Memory memory,
FT_UInt num_glyphs,
FT_String** glyph_names,
PS_Unicodes* table )
ps_unicodes_init( FT_Memory memory,
PS_Unicodes table,
FT_UInt num_glyphs,
PS_Glyph_NameFunc get_glyph_name,
FT_Pointer glyph_data )
{
FT_Error error;
@ -206,7 +207,7 @@
for ( n = 0; n < num_glyphs; n++ )
{
const char* gname = glyph_names[n];
const char* gname = get_glyph_name( glyph_data, n );
if ( gname )
@ -253,8 +254,8 @@
static FT_UInt
ps_unicodes_char_index( PS_Unicodes* table,
FT_UInt32 unicode )
ps_unicodes_char_index( PS_Unicodes table,
FT_UInt32 unicode )
{
PS_UniMap *min, *max, *mid, *result = NULL;
@ -299,8 +300,8 @@
static FT_ULong
ps_unicodes_char_next( PS_Unicodes* table,
FT_UInt32 *unicode )
ps_unicodes_char_next( PS_Unicodes table,
FT_UInt32 *unicode )
{
FT_UInt result = 0;
FT_UInt32 char_code = *unicode + 1;
@ -398,8 +399,8 @@
#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */
(PS_Macintosh_Name_Func) ps_get_macintosh_name,
(PS_Adobe_Std_Strings_Func)ps_get_standard_strings,
(PS_Macintosh_NameFunc) ps_get_macintosh_name,
(PS_Adobe_Std_StringsFunc) ps_get_standard_strings,
t1_standard_encoding,
t1_expert_encoding

View File

@ -4,7 +4,7 @@
/* */
/* Type 42 font data types (specification only). */
/* */
/* Copyright 2002, 2003 by Roberto Alameda. */
/* Copyright 2002, 2003, 2006 by Roberto Alameda. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
@ -31,17 +31,17 @@ FT_BEGIN_HEADER
typedef struct T42_FaceRec_
{
FT_FaceRec root;
T1_FontRec type1;
const void* psnames;
const void* psaux;
const void* afm_data;
FT_Byte* ttf_data;
FT_ULong ttf_size;
FT_Face ttf_face;
FT_CharMapRec charmaprecs[2];
FT_CharMap charmaps[2];
PS_Unicodes unicode_map;
FT_FaceRec root;
T1_FontRec type1;
const void* psnames;
const void* psaux;
const void* afm_data;
FT_Byte* ttf_data;
FT_ULong ttf_size;
FT_Face ttf_face;
FT_CharMapRec charmaprecs[2];
FT_CharMap charmaps[2];
PS_UnicodesRec unicode_map;
} T42_FaceRec, *T42_Face;