ReactOS 0.4.16-dev-2380-gf63df20
cidriver.c
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * cidriver.c
4 *
5 * CID driver interface (body).
6 *
7 * Copyright (C) 1996-2020 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 "cidriver.h"
20#include "cidgload.h"
23
24#include "ciderrs.h"
25
31#include <freetype/ftdriver.h>
32
34
35
36 /**************************************************************************
37 *
38 * The macro FT_COMPONENT is used in trace mode. It is an implicit
39 * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log
40 * messages during execution.
41 */
42#undef FT_COMPONENT
43#define FT_COMPONENT ciddriver
44
45
46 /*
47 * POSTSCRIPT NAME SERVICE
48 *
49 */
50
51 static const char*
53 {
54 const char* result = face->cid.cid_font_name;
55
56
57 if ( result && result[0] == '/' )
58 result++;
59
60 return result;
61 }
62
63
64 static const FT_Service_PsFontNameRec cid_service_ps_name =
65 {
66 (FT_PsName_GetFunc)cid_get_postscript_name /* get_ps_font_name */
67 };
68
69
70 /*
71 * POSTSCRIPT INFO SERVICE
72 *
73 */
74
75 static FT_Error
77 PS_FontInfoRec* afont_info )
78 {
79 *afont_info = ((CID_Face)face)->cid.font_info;
80
81 return FT_Err_Ok;
82 }
83
84 static FT_Error
86 PS_FontExtraRec* afont_extra )
87 {
88 *afont_extra = ((CID_Face)face)->font_extra;
89
90 return FT_Err_Ok;
91 }
92
93 static const FT_Service_PsInfoRec cid_service_ps_info =
94 {
95 (PS_GetFontInfoFunc) cid_ps_get_font_info, /* ps_get_font_info */
96 (PS_GetFontExtraFunc) cid_ps_get_font_extra, /* ps_get_font_extra */
97 /* unsupported with CID fonts */
98 (PS_HasGlyphNamesFunc) NULL, /* ps_has_glyph_names */
99 /* unsupported */
100 (PS_GetFontPrivateFunc)NULL, /* ps_get_font_private */
101 /* not implemented */
102 (PS_GetFontValueFunc) NULL /* ps_get_font_value */
103 };
104
105
106 /*
107 * CID INFO SERVICE
108 *
109 */
110 static FT_Error
112 const char* *registry,
113 const char* *ordering,
115 {
116 CID_FaceInfo cid = &face->cid;
117
118
119 if ( registry )
120 *registry = cid->registry;
121
122 if ( ordering )
123 *ordering = cid->ordering;
124
125 if ( supplement )
126 *supplement = cid->supplement;
127
128 return FT_Err_Ok;
129 }
130
131
132 static FT_Error
134 FT_Bool *is_cid )
135 {
137 FT_UNUSED( face );
138
139
140 if ( is_cid )
141 *is_cid = 1; /* cid driver is only used for CID keyed fonts */
142
143 return error;
144 }
145
146
147 static FT_Error
149 FT_UInt glyph_index,
150 FT_UInt *cid )
151 {
153 FT_UNUSED( face );
154
155
156 if ( cid )
157 *cid = glyph_index; /* identity mapping */
158
159 return error;
160 }
161
162
163 static const FT_Service_CIDRec cid_service_cid_info =
164 {
166 cid_get_ros, /* get_ros */
168 cid_get_is_cid, /* get_is_cid */
170 cid_get_cid_from_glyph_index /* get_cid_from_glyph_index */
171 };
172
173
174 /*
175 * PROPERTY SERVICE
176 *
177 */
178
180 cid_service_properties,
181
182 (FT_Properties_SetFunc)ps_property_set, /* set_property */
183 (FT_Properties_GetFunc)ps_property_get ) /* get_property */
184
185
186 /*
187 * SERVICE LIST
188 *
189 */
190
191 static const FT_ServiceDescRec cid_services[] =
192 {
197 { FT_SERVICE_ID_PROPERTIES, &cid_service_properties },
198 { NULL, NULL }
199 };
200
201
204 const char* cid_interface )
205 {
206 FT_UNUSED( module );
207
208 return ft_service_list_lookup( cid_services, cid_interface );
209 }
210
211
212
215 {
216 {
220 sizeof ( PS_DriverRec ),
221
222 "t1cid", /* module name */
223 0x10000L, /* version 1.0 of driver */
224 0x20000L, /* requires FreeType 2.0 */
225
226 NULL, /* module-specific interface */
227
228 cid_driver_init, /* FT_Module_Constructor module_init */
229 cid_driver_done, /* FT_Module_Destructor module_done */
230 cid_get_interface /* FT_Module_Requester get_interface */
231 },
232
233 sizeof ( CID_FaceRec ),
234 sizeof ( CID_SizeRec ),
235 sizeof ( CID_GlyphSlotRec ),
236
237 cid_face_init, /* FT_Face_InitFunc init_face */
238 cid_face_done, /* FT_Face_DoneFunc done_face */
239 cid_size_init, /* FT_Size_InitFunc init_size */
240 cid_size_done, /* FT_Size_DoneFunc done_size */
241 cid_slot_init, /* FT_Slot_InitFunc init_slot */
242 cid_slot_done, /* FT_Slot_DoneFunc done_slot */
243
244 cid_slot_load_glyph, /* FT_Slot_LoadFunc load_glyph */
245
246 NULL, /* FT_Face_GetKerningFunc get_kerning */
247 NULL, /* FT_Face_AttachFunc attach_file */
248 NULL, /* FT_Face_GetAdvancesFunc get_advances */
249
250 cid_size_request, /* FT_Size_RequestFunc request_size */
251 NULL /* FT_Size_SelectFunc select_size */
252 };
253
254
255/* END */
const char const char FT_Int * supplement
Definition: cffdrivr.c:699
FT_Properties_SetFunc ps_property_set
Definition: cffdrivr.c:834
const char ** registry
Definition: cffdrivr.c:696
cid_slot_load_glyph(FT_GlyphSlot cidglyph, FT_Size cidsize, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: cidgload.c:357
cid_face_init(FT_Stream stream, FT_Face cidface, FT_Int face_index, FT_Int num_params, FT_Parameter *params)
Definition: cidobjs.c:285
cid_driver_init(FT_Module module)
Definition: cidobjs.c:474
cid_slot_init(FT_GlyphSlot slot)
Definition: cidobjs.c:58
cid_size_init(FT_Size cidsize)
Definition: cidobjs.c:132
cid_size_done(FT_Size cidsize)
Definition: cidobjs.c:112
cid_slot_done(FT_GlyphSlot slot)
Definition: cidobjs.c:50
cid_face_done(FT_Face cidface)
Definition: cidobjs.c:196
cid_driver_done(FT_Module driver)
Definition: cidobjs.c:528
cid_size_request(FT_Size size, FT_Size_Request req)
Definition: cidobjs.c:157
struct CID_GlyphSlotRec_ CID_GlyphSlotRec
static const FT_Service_CIDRec cid_service_cid_info
Definition: cidriver.c:163
static const FT_Service_PsFontNameRec cid_service_ps_name
Definition: cidriver.c:64
static const FT_Service_PsInfoRec cid_service_ps_info
Definition: cidriver.c:93
cid_get_interface(FT_Module module, const char *cid_interface)
Definition: cidriver.c:203
static const char * cid_get_postscript_name(CID_Face face)
Definition: cidriver.c:52
static FT_Error cid_ps_get_font_extra(FT_Face face, PS_FontExtraRec *afont_extra)
Definition: cidriver.c:85
static FT_Error cid_ps_get_font_info(FT_Face face, PS_FontInfoRec *afont_info)
Definition: cidriver.c:76
static FT_Error cid_get_cid_from_glyph_index(CID_Face face, FT_UInt glyph_index, FT_UInt *cid)
Definition: cidriver.c:148
static FT_Error cid_get_ros(CID_Face face, const char **registry, const char **ordering, FT_Int *supplement)
Definition: cidriver.c:111
FT_CALLBACK_TABLE_DEF const FT_Driver_ClassRec t1cid_driver_class
Definition: cidriver.c:214
static FT_Error cid_get_is_cid(CID_Face face, FT_Bool *is_cid)
Definition: cidriver.c:133
#define FT_CALLBACK_DEF(x)
#define FT_CALLBACK_TABLE_DEF
#define NULL
Definition: types.h:112
return FT_Err_Ok
Definition: ftbbox.c:526
#define FT_MODULE_FONT_DRIVER
Definition: ftmodapi.h:109
#define FT_MODULE_DRIVER_HAS_HINTER
Definition: ftmodapi.h:118
#define FT_MODULE_DRIVER_SCALABLE
Definition: ftmodapi.h:114
ps_property_get(FT_Module module, const char *property_name, void *value)
Definition: ftpsprop.c:230
ft_service_list_lookup(FT_ServiceDesc service_descriptors, const char *service_id)
Definition: ftobjs.c:109
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
int FT_Error
Definition: fttypes.h:299
unsigned int FT_UInt
Definition: fttypes.h:231
signed int FT_Int
Definition: fttypes.h:220
static enum @1042 ordering
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
GLuint64EXT * result
Definition: glext.h:11304
static TfClientId cid
#define error(str)
Definition: mkdosfs.c:1605
FT_BEGIN_HEADER struct PS_DriverRec_ PS_DriverRec
#define FT_UNUSED(arg)
FT_Error(* FT_CID_GetCIDFromGlyphIndexFunc)(FT_Face face, FT_UInt glyph_index, FT_UInt *cid)
Definition: svcid.h:39
#define FT_SERVICE_ID_CID
Definition: svcid.h:28
FT_Error(* FT_CID_GetIsInternallyCIDKeyedFunc)(FT_Face face, FT_Bool *is_cid)
Definition: svcid.h:36
FT_Error(* FT_CID_GetRegistryOrderingSupplementFunc)(FT_Face face, const char **registry, const char **ordering, FT_Int *supplement)
Definition: svcid.h:31
#define FT_FONT_FORMAT_CID
Definition: svfntfmt.h:41
#define FT_SERVICE_ID_FONT_FORMAT
Definition: svfntfmt.h:34
#define FT_SERVICE_ID_POSTSCRIPT_FONT_NAME
Definition: svpostnm.h:37
const char *(* FT_PsName_GetFunc)(FT_Face face)
Definition: svpostnm.h:41
#define FT_DEFINE_SERVICE_PROPERTIESREC(class_, set_property_, get_property_)
Definition: svprop.h:48
FT_Error(* FT_Properties_GetFunc)(FT_Module module, const char *property_name, void *value)
Definition: svprop.h:36
FT_Error(* FT_Properties_SetFunc)(FT_Module module, const char *property_name, const void *value, FT_Bool value_is_string)
Definition: svprop.h:30
#define FT_SERVICE_ID_PROPERTIES
Definition: svprop.h:26
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(* PS_GetFontInfoFunc)(FT_Face face, PS_FontInfoRec *afont_info)
Definition: svpsinfo.h:33
FT_Int(* PS_HasGlyphNamesFunc)(FT_Face face)
Definition: svpsinfo.h:41
FT_Error(* PS_GetFontExtraFunc)(FT_Face face, PS_FontExtraRec *afont_extra)
Definition: svpsinfo.h:37
FT_Error(* PS_GetFontPrivateFunc)(FT_Face face, PS_PrivateRec *afont_private)
Definition: svpsinfo.h:44
#define FT_SERVICE_ID_POSTSCRIPT_INFO
Definition: svpsinfo.h:29
FT_BEGIN_HEADER struct PS_FontInfoRec_ PS_FontInfoRec
struct CID_FaceRec_ * CID_Face
Definition: t1types.h:199
struct CID_FaceRec_ CID_FaceRec
#define const
Definition: zconf.h:233