ReactOS  0.4.13-dev-687-g023794c
cidriver.c
Go to the documentation of this file.
1 /***************************************************************************/
2 /* */
3 /* cidriver.c */
4 /* */
5 /* CID driver interface (body). */
6 /* */
7 /* Copyright 1996-2018 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
9 /* */
10 /* This file is part of the FreeType project, and may only be used, */
11 /* modified, and distributed under the terms of the FreeType project */
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 /* this file you indicate that you have read the license and */
14 /* understand and accept it fully. */
15 /* */
16 /***************************************************************************/
17 
18 
19 #include <ft2build.h>
20 #include "cidriver.h"
21 #include "cidgload.h"
22 #include FT_INTERNAL_DEBUG_H
23 #include FT_INTERNAL_POSTSCRIPT_PROPS_H
24 
25 #include "ciderrs.h"
26 
27 #include FT_SERVICE_POSTSCRIPT_NAME_H
28 #include FT_SERVICE_FONT_FORMAT_H
29 #include FT_SERVICE_POSTSCRIPT_INFO_H
30 #include FT_SERVICE_CID_H
31 #include FT_SERVICE_PROPERTIES_H
32 #include FT_DRIVER_H
33 
34 #include FT_INTERNAL_POSTSCRIPT_AUX_H
35 
36 
37  /*************************************************************************/
38  /* */
39  /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
40  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
41  /* messages during execution. */
42  /* */
43 #undef FT_COMPONENT
44 #define FT_COMPONENT trace_ciddriver
45 
46 
47  /*
48  * POSTSCRIPT NAME SERVICE
49  *
50  */
51 
52  static const char*
54  {
55  const char* result = face->cid.cid_font_name;
56 
57 
58  if ( result && result[0] == '/' )
59  result++;
60 
61  return result;
62  }
63 
64 
65  static const FT_Service_PsFontNameRec cid_service_ps_name =
66  {
67  (FT_PsName_GetFunc)cid_get_postscript_name /* get_ps_font_name */
68  };
69 
70 
71  /*
72  * POSTSCRIPT INFO SERVICE
73  *
74  */
75 
76  static FT_Error
78  PS_FontInfoRec* afont_info )
79  {
80  *afont_info = ((CID_Face)face)->cid.font_info;
81 
82  return FT_Err_Ok;
83  }
84 
85  static FT_Error
87  PS_FontExtraRec* afont_extra )
88  {
89  *afont_extra = ((CID_Face)face)->font_extra;
90 
91  return FT_Err_Ok;
92  }
93 
94  static const FT_Service_PsInfoRec cid_service_ps_info =
95  {
96  (PS_GetFontInfoFunc) cid_ps_get_font_info, /* ps_get_font_info */
97  (PS_GetFontExtraFunc) cid_ps_get_font_extra, /* ps_get_font_extra */
98  /* unsupported with CID fonts */
99  (PS_HasGlyphNamesFunc) NULL, /* ps_has_glyph_names */
100  /* unsupported */
101  (PS_GetFontPrivateFunc)NULL, /* ps_get_font_private */
102  /* not implemented */
103  (PS_GetFontValueFunc) NULL /* ps_get_font_value */
104  };
105 
106 
107  /*
108  * CID INFO SERVICE
109  *
110  */
111  static FT_Error
113  const char* *registry,
114  const char* *ordering,
115  FT_Int *supplement )
116  {
117  CID_FaceInfo cid = &face->cid;
118 
119 
120  if ( registry )
121  *registry = cid->registry;
122 
123  if ( ordering )
124  *ordering = cid->ordering;
125 
126  if ( supplement )
127  *supplement = cid->supplement;
128 
129  return FT_Err_Ok;
130  }
131 
132 
133  static FT_Error
135  FT_Bool *is_cid )
136  {
138  FT_UNUSED( face );
139 
140 
141  if ( is_cid )
142  *is_cid = 1; /* cid driver is only used for CID keyed fonts */
143 
144  return error;
145  }
146 
147 
148  static FT_Error
150  FT_UInt glyph_index,
151  FT_UInt *cid )
152  {
154  FT_UNUSED( face );
155 
156 
157  if ( cid )
158  *cid = glyph_index; /* identity mapping */
159 
160  return error;
161  }
162 
163 
164  static const FT_Service_CIDRec cid_service_cid_info =
165  {
167  cid_get_ros, /* get_ros */
169  cid_get_is_cid, /* get_is_cid */
171  cid_get_cid_from_glyph_index /* get_cid_from_glyph_index */
172  };
173 
174 
175  /*
176  * PROPERTY SERVICE
177  *
178  */
179 
181  cid_service_properties,
182 
183  (FT_Properties_SetFunc)ps_property_set, /* set_property */
184  (FT_Properties_GetFunc)ps_property_get ) /* get_property */
185 
186 
187  /*
188  * SERVICE LIST
189  *
190  */
191 
192  static const FT_ServiceDescRec cid_services[] =
193  {
198  { FT_SERVICE_ID_PROPERTIES, &cid_service_properties },
199  { NULL, NULL }
200  };
201 
202 
205  const char* cid_interface )
206  {
207  FT_UNUSED( module );
208 
209  return ft_service_list_lookup( cid_services, cid_interface );
210  }
211 
212 
213 
216  {
217  {
221  sizeof ( PS_DriverRec ),
222 
223  "t1cid", /* module name */
224  0x10000L, /* version 1.0 of driver */
225  0x20000L, /* requires FreeType 2.0 */
226 
227  NULL, /* module-specific interface */
228 
229  cid_driver_init, /* FT_Module_Constructor module_init */
230  cid_driver_done, /* FT_Module_Destructor module_done */
231  cid_get_interface /* FT_Module_Requester get_interface */
232  },
233 
234  sizeof ( CID_FaceRec ),
235  sizeof ( CID_SizeRec ),
236  sizeof ( CID_GlyphSlotRec ),
237 
238  cid_face_init, /* FT_Face_InitFunc init_face */
239  cid_face_done, /* FT_Face_DoneFunc done_face */
240  cid_size_init, /* FT_Size_InitFunc init_size */
241  cid_size_done, /* FT_Size_DoneFunc done_size */
242  cid_slot_init, /* FT_Slot_InitFunc init_slot */
243  cid_slot_done, /* FT_Slot_DoneFunc done_slot */
244 
245  cid_slot_load_glyph, /* FT_Slot_LoadFunc load_glyph */
246 
247  NULL, /* FT_Face_GetKerningFunc get_kerning */
248  NULL, /* FT_Face_AttachFunc attach_file */
249  NULL, /* FT_Face_GetAdvancesFunc get_advances */
250 
251  cid_size_request, /* FT_Size_RequestFunc request_size */
252  NULL /* FT_Size_SelectFunc select_size */
253  };
254 
255 
256 /* END */
ft_service_list_lookup(FT_ServiceDesc service_descriptors, const char *service_id)
Definition: ftobjs.c:98
int FT_Error
Definition: fttypes.h:300
struct CID_FaceRec_ * CID_Face
Definition: t1types.h:197
FT_Error(* FT_CID_GetIsInternallyCIDKeyedFunc)(FT_Face face, FT_Bool *is_cid)
Definition: svcid.h:36
#define error(str)
Definition: mkdosfs.c:1605
static FT_Error cid_get_cid_from_glyph_index(CID_Face face, FT_UInt glyph_index, FT_UInt *cid)
Definition: cidriver.c:149
FT_Properties_SetFunc ps_property_set
Definition: cffdrivr.c:828
signed int FT_Int
Definition: fttypes.h:220
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_SERVICE_ID_POSTSCRIPT_FONT_NAME
Definition: cffdrivr.c:1018
#define FT_SERVICE_ID_FONT_FORMAT
Definition: svfntfmt.h:34
cid_size_done(FT_Size cidsize)
Definition: cidobjs.c:112
#define FT_MODULE_DRIVER_SCALABLE
Definition: ftmodapi.h:115
return FT_Err_Ok
Definition: ftbbox.c:511
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
FT_Error(* FT_Properties_SetFunc)(FT_Module module, const char *property_name, const void *value, FT_Bool value_is_string)
Definition: svprop.h:30
static TfClientId cid
cid_driver_done(FT_Module driver)
Definition: cidobjs.c:520
FT_DEFINE_SERVICE_PROPERTIESREC(cid_service_properties,(FT_Properties_SetFunc) ps_property_set,(FT_Properties_GetFunc) ps_property_get) static const FT_ServiceDescRec cid_services[]
smooth NULL
Definition: ftsmooth.c:416
#define FT_MODULE_DRIVER_HAS_HINTER
Definition: ftmodapi.h:119
#define FT_FONT_FORMAT_CID
Definition: svfntfmt.h:41
const char ** registry
Definition: cffdrivr.c:690
cid_slot_load_glyph(FT_GlyphSlot cidglyph, FT_Size cidsize, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: cidgload.c:337
cid_face_done(FT_Face cidface)
Definition: cidobjs.c:195
FT_Long(* PS_GetFontValueFunc)(FT_Face face, PS_Dict_Keys key, FT_UInt idx, void *value, FT_Long value_len)
Definition: svpsinfo.h:48
FT_Error(* FT_CID_GetRegistryOrderingSupplementFunc)(FT_Face face, const char **registry, const char **ordering, FT_Int *supplement)
Definition: svcid.h:31
static const FT_Service_CIDRec cid_service_cid_info
Definition: cidriver.c:164
struct CID_FaceRec_ CID_FaceRec
static FT_Error cid_ps_get_font_info(FT_Face face, PS_FontInfoRec *afont_info)
Definition: cidriver.c:77
static const char * cid_get_postscript_name(CID_Face face)
Definition: cidriver.c:53
cid_face_init(FT_Stream stream, FT_Face cidface, FT_Int face_index, FT_Int num_params, FT_Parameter *params)
Definition: cidobjs.c:279
FT_BEGIN_HEADER struct PS_DriverRec_ PS_DriverRec
static const FT_Service_PsInfoRec cid_service_ps_info
Definition: cidriver.c:94
#define FT_CALLBACK_DEF(x)
Definition: ftconfig.h:533
#define FT_MODULE_FONT_DRIVER
Definition: ftmodapi.h:110
cid_driver_init(FT_Module module)
Definition: cidobjs.c:467
FT_Error(* PS_GetFontExtraFunc)(FT_Face face, PS_FontExtraRec *afont_extra)
Definition: svpsinfo.h:37
static FT_Error cid_ps_get_font_extra(FT_Face face, PS_FontExtraRec *afont_extra)
Definition: cidriver.c:86
static const FT_Service_PsFontNameRec cid_service_ps_name
Definition: cidriver.c:65
cid_get_interface(FT_Module module, const char *cid_interface)
Definition: cidriver.c:204
const char *(* FT_PsName_GetFunc)(FT_Face face)
Definition: svpostnm.h:41
static FT_Error cid_get_is_cid(CID_Face face, FT_Bool *is_cid)
Definition: cidriver.c:134
struct CID_GlyphSlotRec_ CID_GlyphSlotRec
unsigned int FT_UInt
Definition: fttypes.h:231
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_SERVICE_ID_CID
Definition: cffdrivr.c:1018
cid_slot_done(FT_GlyphSlot slot)
Definition: cidobjs.c:51
cid_size_request(FT_Size size, FT_Size_Request req)
Definition: cidobjs.c:157
cid_size_init(FT_Size cidsize)
Definition: cidobjs.c:132
FT_BEGIN_HEADER struct PS_FontInfoRec_ PS_FontInfoRec
#define const
Definition: zconf.h:230
cid_slot_init(FT_GlyphSlot slot)
Definition: cidobjs.c:58
FT_Error(* FT_Properties_GetFunc)(FT_Module module, const char *property_name, void *value)
Definition: svprop.h:36
FT_Int(* PS_HasGlyphNamesFunc)(FT_Face face)
Definition: svpsinfo.h:41
FT_Error(* PS_GetFontPrivateFunc)(FT_Face face, PS_PrivateRec *afont_private)
Definition: svpsinfo.h:44
const char const char FT_Int * supplement
Definition: cffdrivr.c:693
static FT_Error cid_get_ros(CID_Face face, const char **registry, const char **ordering, FT_Int *supplement)
Definition: cidriver.c:112
GLuint64EXT * result
Definition: glext.h:11304
FT_Error(* PS_GetFontInfoFunc)(FT_Face face, PS_FontInfoRec *afont_info)
Definition: svpsinfo.h:33
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
#define FT_SERVICE_ID_PROPERTIES
Definition: svprop.h:26
FT_CALLBACK_TABLE_DEF const FT_Driver_ClassRec t1cid_driver_class
Definition: cidriver.c:215
FT_Error(* FT_CID_GetCIDFromGlyphIndexFunc)(FT_Face face, FT_UInt glyph_index, FT_UInt *cid)
Definition: svcid.h:39
FT_Properties_SetFunc FT_Properties_GetFunc ps_property_get FT_SERVICE_ID_POSTSCRIPT_INFO
Definition: cffdrivr.c:1018
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
const char const char ** ordering
Definition: cffdrivr.c:690
#define FT_CALLBACK_TABLE_DEF
Definition: ftconfig.h:553
ps_property_get(FT_Module module, const char *property_name, void *value)
Definition: ftpsprop.c:231