Add new function FT_Get_CMap_Language_ID to extract the language ID
for TrueType/sfnt fonts. * include/freetype/internal/services/svttcmap.h: New file. * include/freetype/internal/ftserv.h (FT_SERVICE_TT_CMAP_H): Add svttcmap.h. * src/sfnt/sfdriver.c: Include ttcmap0.h. (tt_service_get_cmap_info): New service. (sfnt_services): Updated. * src/sfnt/ttcmap0.c (tt_cmap*_get_info): New functions. (tt_cmap*_class_rec): Add tt_cmap*_get_info members. (tt_get_cmap_info): New function. * src/sfnt/ttcmap0.h: Include FT_SERVICE_TT_CMAP_H. (TT_CMap_ClassRec): New field `get_cmap_info'. (tt_get_cmap_info): New declaration. * src/base/ftobjs.c: Include FT_SERVICE_TT_CMAP_H. (FT_Get_CMap_Language_ID): New function implementation. * include/freetype/tttables.h (FT_Get_CMap_Language_ID): New function declaration.
This commit is contained in:
parent
efe527520a
commit
91a67478ec
29
ChangeLog
29
ChangeLog
|
@ -1,3 +1,28 @@
|
|||
2003-12-17 Masatake YAMATO <jet@gyve.org>
|
||||
|
||||
Add new function FT_Get_CMap_Language_ID to extract the language ID
|
||||
for TrueType/sfnt fonts.
|
||||
|
||||
* include/freetype/internal/services/svttcmap.h: New file.
|
||||
* include/freetype/internal/ftserv.h (FT_SERVICE_TT_CMAP_H): Add
|
||||
svttcmap.h.
|
||||
|
||||
* src/sfnt/sfdriver.c: Include ttcmap0.h.
|
||||
(tt_service_get_cmap_info): New service.
|
||||
(sfnt_services): Updated.
|
||||
|
||||
* src/sfnt/ttcmap0.c (tt_cmap*_get_info): New functions.
|
||||
(tt_cmap*_class_rec): Add tt_cmap*_get_info members.
|
||||
(tt_get_cmap_info): New function.
|
||||
* src/sfnt/ttcmap0.h: Include FT_SERVICE_TT_CMAP_H.
|
||||
(TT_CMap_ClassRec): New field `get_cmap_info'.
|
||||
(tt_get_cmap_info): New declaration.
|
||||
|
||||
* src/base/ftobjs.c: Include FT_SERVICE_TT_CMAP_H.
|
||||
(FT_Get_CMap_Language_ID): New function implementation.
|
||||
* include/freetype/tttables.h (FT_Get_CMap_Language_ID): New
|
||||
function declaration.
|
||||
|
||||
2003-12-16 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* src/sfnt/ttcmap.c, src/sfnt/ttcmap.h: Removed. Obsolete.
|
||||
|
@ -15,7 +40,7 @@
|
|||
TT_CMapDirRec, TT_CMapDirEntryRec, TT_CMap0, TT_CMap2SubHeaderRec,
|
||||
TT_CMap2Rec, TT_CMap4Segment, TT_CMap4Rec, TT_CMap6,
|
||||
TT_CMapGroupRec, TT_CMap8_12Rec, TT_CMap10Rec, TT_CharMap_Func,
|
||||
TT_CharNext_Func, TT_CMapTableRec, TT_CharMapRec): Removed.
|
||||
TT_CharNext_Func, TT_CMapTableRec, TT_CharMapRec): Removed.
|
||||
Obsolete.
|
||||
* src/cff/cffobjs.h (CFF_CharMapRec): Removed. Obsolete.
|
||||
|
||||
|
@ -6038,7 +6063,7 @@
|
|||
(html_format): Replaced with ...
|
||||
(html_quote): New function.
|
||||
(html_quote0): New function.
|
||||
(DocCode::dump_html: Small improvement.
|
||||
(DocCode::dump_html): Small improvement.
|
||||
(DocParagraph::dump, DocBlock::html): Use html_quote0 and html_quote.
|
||||
|
||||
* include/freetype/config/ftoption.h: Setting default options for
|
||||
|
|
|
@ -248,6 +248,7 @@ FT_BEGIN_HEADER
|
|||
#define FT_SERVICE_SFNT_H <freetype/internal/services/svsfnt.h>
|
||||
#define FT_SERVICE_PFR_H <freetype/internal/services/svpfr.h>
|
||||
#define FT_SERVICE_WINFNT_H <freetype/internal/services/svwinfnt.h>
|
||||
#define FT_SERVICE_TT_CMAP_H <freetype/internal/services/svttcmap.h>
|
||||
|
||||
/* */
|
||||
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
/***************************************************************************/
|
||||
/* */
|
||||
/* svsttcmap.h */
|
||||
/* */
|
||||
/* The FreeType TrueType/sfnt cmap extra information service. */
|
||||
/* */
|
||||
/* Copyright 2003 by */
|
||||
/* Masatake YAMATO, Redhat K.K. */
|
||||
/* */
|
||||
/* Copyright 2003 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. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
/* Development of this service is support of
|
||||
Information-technology Promotion Agency, Japan. */
|
||||
|
||||
#ifndef __SVTTCMAP_H__
|
||||
#define __SVTTCMAP_H__
|
||||
|
||||
#include FT_INTERNAL_SERVICE_H
|
||||
#include FT_TRUETYPE_TABLES_H
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
#define FT_SERVICE_ID_TT_CMAP "tt-cmaps"
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Struct> */
|
||||
/* TT_CMapInfo */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* A structure used to store TrueType/sfnt specific cmap information */
|
||||
/* which is not covered by the generic @FT_CharMap structure. This */
|
||||
/* structure can be accessed with the @FT_Get_TT_CMap_Info function. */
|
||||
/* */
|
||||
/* <Fields> */
|
||||
/* language :: */
|
||||
/* The language ID used in Mac fonts. Definitions of values are in */
|
||||
/* freetype/ttnameid.h. */
|
||||
/* */
|
||||
typedef struct TT_CMapInfo_
|
||||
{
|
||||
FT_ULong language;
|
||||
|
||||
} TT_CMapInfo;
|
||||
|
||||
|
||||
typedef FT_Error
|
||||
(*TT_CMap_Info_GetFunc)( FT_CharMap charmap,
|
||||
TT_CMapInfo *cmap_info );
|
||||
|
||||
|
||||
FT_DEFINE_SERVICE( TTCMaps )
|
||||
{
|
||||
TT_CMap_Info_GetFunc get_cmap_info;
|
||||
};
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* __SVTTCMAP_H__ */
|
||||
|
||||
|
||||
/* END */
|
|
@ -663,6 +663,27 @@ FT_BEGIN_HEADER
|
|||
FT_Byte* buffer,
|
||||
FT_ULong* length );
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Function> */
|
||||
/* FT_Get_CMap_Language_ID */
|
||||
/* */
|
||||
/* <Description> */
|
||||
/* Return TrueType/sfnt specific cmap language ID. Definitions of */
|
||||
/* language ID values are in freetype/ttnameid.h. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* charmap :: */
|
||||
/* The target charmap. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* The language ID of `charmap'. If `charmap' doesn't belong to a */
|
||||
/* TrueType/sfnt face, just return 0 as the default value. */
|
||||
/* */
|
||||
FT_EXPORT( FT_ULong )
|
||||
FT_Get_CMap_Language_ID( FT_CharMap charmap );
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include FT_SERVICE_SFNT_H
|
||||
#include FT_SERVICE_POSTSCRIPT_NAME_H
|
||||
#include FT_SERVICE_GLYPH_DICT_H
|
||||
#include FT_SERVICE_TT_CMAP_H
|
||||
|
||||
|
||||
FT_BASE_DEF( FT_Pointer )
|
||||
|
@ -2508,6 +2509,28 @@
|
|||
}
|
||||
|
||||
|
||||
FT_EXPORT_DEF( FT_ULong )
|
||||
FT_Get_CMap_Language_ID( FT_CharMap charmap )
|
||||
{
|
||||
FT_Service_TTCMaps service;
|
||||
FT_Face face;
|
||||
TT_CMapInfo cmap_info;
|
||||
|
||||
|
||||
if ( !charmap || !charmap->face )
|
||||
return 0;
|
||||
|
||||
face = charmap->face;
|
||||
FT_FACE_FIND_SERVICE( face, service, TT_CMAP );
|
||||
if ( service == NULL )
|
||||
return 0;
|
||||
if ( service->get_cmap_info( charmap, &cmap_info ))
|
||||
return 0;
|
||||
|
||||
return cmap_info.language;
|
||||
}
|
||||
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Activate_Size( FT_Size size )
|
||||
{
|
||||
|
|
|
@ -34,9 +34,12 @@
|
|||
#include "ttpost.h"
|
||||
#endif
|
||||
|
||||
#include "ttcmap0.h"
|
||||
|
||||
#include FT_SERVICE_GLYPH_DICT_H
|
||||
#include FT_SERVICE_POSTSCRIPT_NAME_H
|
||||
#include FT_SERVICE_SFNT_H
|
||||
#include FT_SERVICE_TT_CMAP_H
|
||||
|
||||
|
||||
/*
|
||||
|
@ -260,6 +263,15 @@
|
|||
};
|
||||
|
||||
|
||||
/*
|
||||
* TT CMAP INFO
|
||||
*
|
||||
*/
|
||||
static const FT_Service_TTCMapsRec tt_service_get_cmap_info =
|
||||
{
|
||||
(TT_CMap_Info_GetFunc)tt_get_cmap_info
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* SERVICE LIST
|
||||
|
@ -273,6 +285,7 @@
|
|||
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
||||
{ FT_SERVICE_ID_GLYPH_DICT, &sfnt_service_glyph_dict },
|
||||
#endif
|
||||
{ FT_SERVICE_ID_TT_CMAP, &tt_service_get_cmap_info },
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
|
|
@ -144,6 +144,19 @@
|
|||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
tt_cmap0_get_info( TT_CMap cmap,
|
||||
TT_CMapInfo *cmap_info )
|
||||
{
|
||||
FT_Byte* p = cmap->data + 4;
|
||||
|
||||
|
||||
cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const TT_CMap_ClassRec tt_cmap0_class_rec =
|
||||
{
|
||||
|
@ -156,7 +169,8 @@
|
|||
(FT_CMap_CharNextFunc) tt_cmap0_char_next
|
||||
},
|
||||
0,
|
||||
(TT_CMap_ValidateFunc) tt_cmap0_validate
|
||||
(TT_CMap_ValidateFunc) tt_cmap0_validate,
|
||||
(TT_CMap_Info_GetFunc) tt_cmap0_get_info
|
||||
};
|
||||
|
||||
#endif /* TT_CONFIG_CMAP_FORMAT_0 */
|
||||
|
@ -497,6 +511,19 @@
|
|||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
tt_cmap2_get_info( TT_CMap cmap,
|
||||
TT_CMapInfo *cmap_info )
|
||||
{
|
||||
FT_Byte* p = cmap->data + 4;
|
||||
|
||||
|
||||
cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const TT_CMap_ClassRec tt_cmap2_class_rec =
|
||||
{
|
||||
|
@ -509,7 +536,8 @@
|
|||
(FT_CMap_CharNextFunc) tt_cmap2_char_next
|
||||
},
|
||||
2,
|
||||
(TT_CMap_ValidateFunc) tt_cmap2_validate
|
||||
(TT_CMap_ValidateFunc) tt_cmap2_validate,
|
||||
(TT_CMap_Info_GetFunc) tt_cmap2_get_info
|
||||
};
|
||||
|
||||
#endif /* TT_CONFIG_CMAP_FORMAT_2 */
|
||||
|
@ -1058,6 +1086,19 @@
|
|||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
tt_cmap4_get_info( TT_CMap cmap,
|
||||
TT_CMapInfo *cmap_info )
|
||||
{
|
||||
FT_Byte* p = cmap->data + 4;
|
||||
|
||||
|
||||
cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const TT_CMap_ClassRec tt_cmap4_class_rec =
|
||||
{
|
||||
|
@ -1070,7 +1111,8 @@
|
|||
(FT_CMap_CharNextFunc) tt_cmap4_char_next
|
||||
},
|
||||
4,
|
||||
(TT_CMap_ValidateFunc) tt_cmap4_validate
|
||||
(TT_CMap_ValidateFunc) tt_cmap4_validate,
|
||||
(TT_CMap_Info_GetFunc) tt_cmap4_get_info
|
||||
};
|
||||
|
||||
#endif /* TT_CONFIG_CMAP_FORMAT_4 */
|
||||
|
@ -1202,6 +1244,19 @@
|
|||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
tt_cmap6_get_info( TT_CMap cmap,
|
||||
TT_CMapInfo *cmap_info )
|
||||
{
|
||||
FT_Byte* p = cmap->data + 4;
|
||||
|
||||
|
||||
cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p );
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const TT_CMap_ClassRec tt_cmap6_class_rec =
|
||||
{
|
||||
|
@ -1214,7 +1269,8 @@
|
|||
(FT_CMap_CharNextFunc) tt_cmap6_char_next
|
||||
},
|
||||
6,
|
||||
(TT_CMap_ValidateFunc) tt_cmap6_validate
|
||||
(TT_CMap_ValidateFunc) tt_cmap6_validate,
|
||||
(TT_CMap_Info_GetFunc) tt_cmap6_get_info
|
||||
};
|
||||
|
||||
#endif /* TT_CONFIG_CMAP_FORMAT_6 */
|
||||
|
@ -1439,6 +1495,18 @@
|
|||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
tt_cmap8_get_info( TT_CMap cmap,
|
||||
TT_CMapInfo *cmap_info )
|
||||
{
|
||||
FT_Byte* p = cmap->data + 8;
|
||||
|
||||
|
||||
cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const TT_CMap_ClassRec tt_cmap8_class_rec =
|
||||
{
|
||||
|
@ -1451,7 +1519,8 @@
|
|||
(FT_CMap_CharNextFunc) tt_cmap8_char_next
|
||||
},
|
||||
8,
|
||||
(TT_CMap_ValidateFunc) tt_cmap8_validate
|
||||
(TT_CMap_ValidateFunc) tt_cmap8_validate,
|
||||
(TT_CMap_Info_GetFunc) tt_cmap8_get_info
|
||||
};
|
||||
|
||||
#endif /* TT_CONFIG_CMAP_FORMAT_8 */
|
||||
|
@ -1571,6 +1640,19 @@
|
|||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
tt_cmap10_get_info( TT_CMap cmap,
|
||||
TT_CMapInfo *cmap_info )
|
||||
{
|
||||
FT_Byte* p = cmap->data + 8;
|
||||
|
||||
|
||||
cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const TT_CMap_ClassRec tt_cmap10_class_rec =
|
||||
{
|
||||
|
@ -1583,7 +1665,8 @@
|
|||
(FT_CMap_CharNextFunc) tt_cmap10_char_next
|
||||
},
|
||||
10,
|
||||
(TT_CMap_ValidateFunc) tt_cmap10_validate
|
||||
(TT_CMap_ValidateFunc) tt_cmap10_validate,
|
||||
(TT_CMap_Info_GetFunc) tt_cmap10_get_info
|
||||
};
|
||||
|
||||
#endif /* TT_CONFIG_CMAP_FORMAT_10 */
|
||||
|
@ -1741,6 +1824,19 @@
|
|||
}
|
||||
|
||||
|
||||
FT_CALLBACK_DEF( FT_Error )
|
||||
tt_cmap12_get_info( TT_CMap cmap,
|
||||
TT_CMapInfo *cmap_info )
|
||||
{
|
||||
FT_Byte* p = cmap->data + 8;
|
||||
|
||||
|
||||
cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p );
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
FT_CALLBACK_TABLE_DEF
|
||||
const TT_CMap_ClassRec tt_cmap12_class_rec =
|
||||
{
|
||||
|
@ -1753,7 +1849,8 @@
|
|||
(FT_CMap_CharNextFunc) tt_cmap12_char_next
|
||||
},
|
||||
12,
|
||||
(TT_CMap_ValidateFunc) tt_cmap12_validate
|
||||
(TT_CMap_ValidateFunc) tt_cmap12_validate,
|
||||
(TT_CMap_Info_GetFunc) tt_cmap12_get_info
|
||||
};
|
||||
|
||||
|
||||
|
@ -1875,4 +1972,16 @@
|
|||
}
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
return clazz->get_cmap_info( charmap, cmap_info );
|
||||
}
|
||||
|
||||
|
||||
/* END */
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <ft2build.h>
|
||||
#include FT_INTERNAL_TRUETYPE_TYPES_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
|
||||
#include FT_SERVICE_TT_CMAP_H
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
|
@ -46,6 +46,7 @@ FT_BEGIN_HEADER
|
|||
FT_CMap_ClassRec clazz;
|
||||
FT_UInt format;
|
||||
TT_CMap_ValidateFunc validate;
|
||||
TT_CMap_Info_GetFunc get_cmap_info;
|
||||
|
||||
} TT_CMap_ClassRec;
|
||||
|
||||
|
@ -65,6 +66,11 @@ FT_BEGIN_HEADER
|
|||
FT_LOCAL( FT_Error )
|
||||
tt_face_build_cmaps( TT_Face face );
|
||||
|
||||
/* used in tt-cmaps service */
|
||||
FT_LOCAL( FT_Error )
|
||||
tt_get_cmap_info( FT_CharMap charmap,
|
||||
TT_CMapInfo *cmap_info );
|
||||
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
|
|
Loading…
Reference in New Issue