parent
ef915c36f4
commit
5bfe0d0465
3 changed files with 206 additions and 0 deletions
@ -0,0 +1,94 @@ |
||||
/***************************************************************************/ |
||||
/* */ |
||||
/* ftcid.h */ |
||||
/* */ |
||||
/* FreeType API for accessing CID font information (specification). */ |
||||
/* */ |
||||
/* Copyright 2007 by Dereg Clegg. */ |
||||
/* */ |
||||
/* 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. */ |
||||
/* */ |
||||
/***************************************************************************/ |
||||
|
||||
|
||||
#ifndef __FTCID_H__ |
||||
#define __FTCID_H__ |
||||
|
||||
#include <ft2build.h> |
||||
#include FT_FREETYPE_H |
||||
|
||||
#ifdef FREETYPE_H |
||||
#error "freetype.h of FreeType 1 has been loaded!" |
||||
#error "Please fix the directory search order for header files" |
||||
#error "so that freetype.h of FreeType 2 is found first." |
||||
#endif |
||||
|
||||
|
||||
FT_BEGIN_HEADER |
||||
|
||||
|
||||
/*************************************************************************/ |
||||
/* */ |
||||
/* <Section> */ |
||||
/* cid_fonts */ |
||||
/* */ |
||||
/* <Title> */ |
||||
/* CID Fonts */ |
||||
/* */ |
||||
/* <Abstract> */ |
||||
/* CID-keyed font specific API. */ |
||||
/* */ |
||||
/* <Description> */ |
||||
/* This section contains the declaration of CID-keyed font specific */ |
||||
/* functions. */ |
||||
/* */ |
||||
/*************************************************************************/ |
||||
|
||||
|
||||
/**********************************************************************
|
||||
* |
||||
* @function: |
||||
* FT_Get_CID_Registry_Ordering_Supplement |
||||
* |
||||
* @description: |
||||
* Retrieve the Registry/Ordering/Supplement triple (also known as the |
||||
* "R/O/S") from a CID-keyed font. |
||||
* |
||||
* @input: |
||||
* face :: |
||||
* A handle to the input face. |
||||
* |
||||
* @output: |
||||
* registry :: |
||||
* The registry, as a C string, owned by the face. |
||||
* |
||||
* ordering :: |
||||
* The ordering, as a C string, owned by the face. |
||||
* |
||||
* supplement :: |
||||
* The supplement. |
||||
* |
||||
* @return: |
||||
* FreeType error code. 0 means success. |
||||
* |
||||
* @note: |
||||
* This function only works with CID faces, returning an error otherwise. |
||||
*/ |
||||
FT_EXPORT( FT_Error ) |
||||
FT_Get_CID_Registry_Ordering_Supplement( FT_Face face, |
||||
const char* *registry, |
||||
const char* *ordering, |
||||
FT_Int *supplement); |
||||
|
||||
/* */ |
||||
|
||||
FT_END_HEADER |
||||
|
||||
#endif /* __FTCID_H__ */ |
||||
|
||||
|
||||
/* END */ |
@ -0,0 +1,49 @@ |
||||
/***************************************************************************/ |
||||
/* */ |
||||
/* svcid.h */ |
||||
/* */ |
||||
/* The FreeType CID font services (specification). */ |
||||
/* */ |
||||
/* Copyright 2007 by Derek Clegg. */ |
||||
/* */ |
||||
/* 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. */ |
||||
/* */ |
||||
/***************************************************************************/ |
||||
|
||||
|
||||
#ifndef __SVCID_H__ |
||||
#define __SVCID_H__ |
||||
|
||||
#include FT_INTERNAL_SERVICE_H |
||||
|
||||
|
||||
FT_BEGIN_HEADER |
||||
|
||||
|
||||
#define FT_SERVICE_ID_CID "CID" |
||||
|
||||
typedef FT_Error |
||||
(*FT_CID_GetRegistryOrderingSupplementFunc)( FT_Face face, |
||||
const char* *registry, |
||||
const char* *ordering, |
||||
FT_Int *supplement ); |
||||
|
||||
FT_DEFINE_SERVICE( CID ) |
||||
{ |
||||
FT_CID_GetRegistryOrderingSupplementFunc get_ros; |
||||
}; |
||||
|
||||
/* */ |
||||
|
||||
|
||||
FT_END_HEADER |
||||
|
||||
|
||||
#endif /* __SVCID_H__ */ |
||||
|
||||
|
||||
/* END */ |
@ -0,0 +1,63 @@ |
||||
/***************************************************************************/ |
||||
/* */ |
||||
/* ftcid.c */ |
||||
/* */ |
||||
/* FreeType API for accessing CID font information. */ |
||||
/* */ |
||||
/* Copyright 2007 by Derek Clegg. */ |
||||
/* */ |
||||
/* 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 <ft2build.h> |
||||
#include FT_INTERNAL_OBJECTS_H |
||||
#include FT_SERVICE_CID_H |
||||
|
||||
|
||||
/* documentation is in ftcid.h */ |
||||
|
||||
FT_EXPORT_DEF( FT_Error ) |
||||
FT_Get_CID_Registry_Ordering_Supplement( FT_Face face, |
||||
const char* *registry, |
||||
const char* *ordering, |
||||
FT_Int *supplement) |
||||
{ |
||||
FT_Error error; |
||||
const char* r = NULL; |
||||
const char* o = NULL; |
||||
FT_Int s = 0; |
||||
|
||||
|
||||
error = FT_Err_Invalid_Argument; |
||||
|
||||
if ( face ) |
||||
{ |
||||
FT_Service_CID service; |
||||
|
||||
|
||||
FT_FACE_FIND_SERVICE( face, service, CID ); |
||||
|
||||
if ( service && service->get_ros ) |
||||
error = service->get_ros( face, &r, &o, &s ); |
||||
} |
||||
|
||||
if ( registry ) |
||||
*registry = r; |
||||
|
||||
if ( ordering ) |
||||
*ordering = o; |
||||
|
||||
if ( supplement ) |
||||
*supplement = s; |
||||
|
||||
return error; |
||||
} |
||||
|
||||
|
||||
/* END */ |
Loading…
Reference in new issue