Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

647 lines
31 KiB

  1. /* @(#)CM_VerSion xcf_pub.h atm09 1.3 16499.eco sum= 57734 atm09.002 */
  2. /* @(#)CM_VerSion xcf_pub.h atm08 1.6 16343.eco sum= 46145 atm08.005 */
  3. /***********************************************************************/
  4. /* */
  5. /* Copyright 1990-1996 Adobe Systems Incorporated. */
  6. /* All rights reserved. */
  7. /* */
  8. /* Patents Pending */
  9. /* */
  10. /* NOTICE: All information contained herein is the property of Adobe */
  11. /* Systems Incorporated. Many of the intellectual and technical */
  12. /* concepts contained herein are proprietary to Adobe, are protected */
  13. /* as trade secrets, and are made available only to Adobe licensees */
  14. /* for their internal use. Any reproduction or dissemination of this */
  15. /* software is strictly forbidden unless prior written permission is */
  16. /* obtained from Adobe. */
  17. /* */
  18. /* PostScript and Display PostScript are trademarks of Adobe Systems */
  19. /* Incorporated or its subsidiaries and may be registered in certain */
  20. /* jurisdictions. */
  21. /* */
  22. /***********************************************************************/
  23. #ifndef XCF_PUB_H
  24. #define XCF_PUB_H
  25. #include "xcf_base.h"
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. /***************************
  30. Type definitions
  31. ***************************/
  32. enum XCF_Result {
  33. XCF_Ok,
  34. XCF_EarlyEndOfData,
  35. XCF_StackOverflow,
  36. XCF_StackUnderflow,
  37. XCF_UnterminatedDictionary,
  38. XCF_InvalidDictionaryOrder,
  39. XCF_IndexOutOfRange,
  40. XCF_MemoryAllocationError,
  41. XCF_FontNotFound,
  42. XCF_UnsupportedVersion,
  43. XCF_InvalidOffsetSize,
  44. XCF_InvalidString,
  45. XCF_InvalidOffset,
  46. XCF_CharStringDictNotFound,
  47. XCF_InvalidCharString,
  48. XCF_SubrDepthOverflow,
  49. XCF_FontNameTooLong,
  50. XCF_InvalidNumber,
  51. XCF_HintOverflow,
  52. XCF_UnsupportedCharstringTypeRequested,
  53. XCF_InternalError,
  54. XCF_InvalidNumberType,
  55. XCF_GetBytesCallbackFailure,
  56. XCF_InvalidFontIndex,
  57. XCF_InvalidDictArgumentCount,
  58. XCF_InvalidCIDFont,
  59. XCF_NoCharstringsFound,
  60. XCF_InvalidBlendArgumentCount,
  61. XCF_InvalidBlendDesignMap,
  62. XCF_InvalidDownloadArgument,
  63. XCF_InvalidDownloadOptions,
  64. XCF_InvalidFontSetHandle,
  65. XCF_InvalidState,
  66. XCF_InvalidGID,
  67. XCF_InvalidCallbackFunction,
  68. XCF_Unimplemented
  69. };
  70. typedef void PTR_PREFIX *XFhandle;
  71. typedef long XCFGlyphID;
  72. /******************************************
  73. xcf Specific Callback Functions
  74. *******************************************/
  75. typedef int (*XCF_PutBytesAtPosFunc) ( unsigned char PTR_PREFIX *pData, long int position, unsigned short int length, void PTR_PREFIX *clientHook );
  76. typedef long int (*XCF_OutputPosFunc) ( void PTR_PREFIX *clientHook );
  77. typedef int (*XCF_GetBytesFromPosFunc) ( unsigned char PTR_PREFIX * PTR_PREFIX *ppData, long int position, unsigned short int length, void PTR_PREFIX *clientHook );
  78. typedef unsigned long int (*XCF_AllocateFunc) ( void PTR_PREFIX * PTR_PREFIX
  79. *ppBlock, unsigned long int
  80. size, void PTR_PREFIX
  81. *clientHook );
  82. /* The following is only used by the XCF_GlyphIDsToCharNames function.
  83. Note that charName is not guaranteed to be null terminated. */
  84. typedef int (*XCF_GIDToCharName) (XFhandle handle, void PTR_PREFIX *client,
  85. XCFGlyphID glyphID, char PTR_PREFIX
  86. *charName, unsigned short int length);
  87. /* The following is only used by the XCF_GlyphIDsToCIDs function. */
  88. typedef int (*XCF_GIDToCID) (XFhandle handle, void PTR_PREFIX *client,
  89. XCFGlyphID glyphID, Card16 cid);
  90. /* the following is only used by the XCF_CharNamesToGIDs function */
  91. typedef int (*XCF_CharNameToGID)(XFhandle handle, void PTR_PREFIX *client,
  92. Card16 count, char PTR_PREFIX *charName,
  93. XCFGlyphID glyphID);
  94. /* The following is used when writing the glyphs in a GlyphDirectory
  95. and should only be used when writing a VMCIDFont. This is
  96. called by WriteOneGlyphDictEntry. In this case the id is equal to
  97. the cid. This code assumes that the client is parsing the font and
  98. filling in xcf's internal data structures appropriately. */
  99. typedef unsigned short (*XCF_GetCharString)(
  100. XFhandle h,
  101. long id,
  102. Card8 PTR_PREFIX *PTR_PREFIX *ppCharStr,
  103. Card16 PTR_PREFIX *charStrLength,
  104. Card8 PTR_PREFIX *fdIndex,
  105. void PTR_PREFIX *clientHook);
  106. /* The following is used to get the FSType value for a CIDFont. This value's
  107. * definition is the same as the fsType value in the OS/2 table of an
  108. * OpenType font. This value needs to be included in the CIDFont that xcf
  109. * generates, but is not defined in the CFF spec.
  110. */
  111. typedef void (*XCF_GetFSType)(XFhandle h, long PTR_PREFIX *fsType,
  112. void PTR_PREFIX *clientHook);
  113. //GOODNAME
  114. typedef void (*XCF_IsKnownROS)(XFhandle h, long PTR_PREFIX *knownROS,
  115. char PTR_PREFIX *R, Card16 lenR,
  116. char PTR_PREFIX *O, Card16 lenO,
  117. long S,
  118. void PTR_PREFIX *clientHook);
  119. #if HAS_COOLTYPE_UFL == 1
  120. /* The following two definitons are used to get the BlendDesignPositions and
  121. * BlendDesignMap values for a multiple master font. In CoolType, Type 1 fonts
  122. * are always converted to CFF before xcf is called and the values for these
  123. * two keywords are lost because they are not in the CFF spec. However, these
  124. * keywords are needed by Distiller and possibly other apps. So this info is
  125. * saved before the CFF conversion executes and these callbacks retrieve the
  126. * info when writing out the Type 1 font. The format of the string is
  127. * equivalent to the format expected for the keyword value in the font.
  128. */
  129. typedef void (*XCF_GetDesignPositions)(XFhandle h, char PTR_PREFIX *PTR_PREFIX *designPositions, void PTR_PREFIX *clientHook);
  130. typedef void (*XCF_GetDesignMap)(XFhandle h, char PTR_PREFIX *PTR_PREFIX *designMap, void PTR_PREFIX *clientHook);
  131. #endif
  132. /*****************************************
  133. Standard Library Callback Functions
  134. ******************************************/
  135. typedef unsigned short int (*XCF_strlen) ( const char PTR_PREFIX *string );
  136. typedef void PTR_PREFIX *(*XCF_memcpy) ( void PTR_PREFIX *dest, const void PTR_PREFIX *src, unsigned short int count );
  137. typedef void PTR_PREFIX *(*XCF_memset) ( void PTR_PREFIX *dest, int c, unsigned short int count );
  138. typedef int (*XCF_sprintf) ( char PTR_PREFIX *buffer, size_t cchDest, const char PTR_PREFIX *format, ... );
  139. /* Optional - used in DEVELOP mode to report error descriptions. */
  140. typedef int (*XCF_printfError) ( const char PTR_PREFIX *format, ... );
  141. typedef int (*XCF_atoi) ( const char *string );
  142. typedef long (*XCF_strtol)( const char *nptr, char **endptr, int base );
  143. typedef double (*XCF_atof) ( const char *string );
  144. /* String comparison */
  145. typedef int (*XCF_strcmp)( const char PTR_PREFIX *string1, const char
  146. PTR_PREFIX *string2 );
  147. typedef int (*XCF_strncmp)(const char PTR_PREFIX *string1, const char
  148. PTR_PREFIX *string2, int len);
  149. /******************************************
  150. Structure To Hold Callback Functions
  151. *******************************************/
  152. typedef struct
  153. {
  154. XCF_PutBytesAtPosFunc putBytes;
  155. void PTR_PREFIX *putBytesHook;
  156. XCF_OutputPosFunc outputPos;
  157. void PTR_PREFIX *outputPosHook;
  158. XCF_GetBytesFromPosFunc getBytes; /* Used if font does NOT reside in memory, otherwise NULL */
  159. void PTR_PREFIX *getBytesHook;
  160. XCF_AllocateFunc allocate;
  161. void PTR_PREFIX *allocateHook;
  162. void PTR_PREFIX *pFont; /* Used if font resides in a single contiguous block of memory, otherwise NULL */
  163. unsigned long int fontLength;
  164. XCF_strlen strlen;
  165. XCF_memcpy memcpy;
  166. XCF_memset memset;
  167. XCF_sprintf xcfSprintf;
  168. XCF_printfError printfError; /* Optional - used in DEVELOP mode to report
  169. error descriptions. */
  170. /* The following 3 functions, atoi, strtol, and atof are used as follows:
  171. * if USE_FXL is defined, then both atoi and strtol need to be provided.
  172. * Otherwise, atof needs to be provided.
  173. */
  174. XCF_atoi atoi;
  175. XCF_strtol strtol;
  176. XCF_atof atof;
  177. XCF_strcmp strcmp;
  178. /* gidToCharName only needs to be defined if the client calls the
  179. function XCF_GlyphIDsToCharNames. */
  180. XCF_GIDToCharName gidToCharName;
  181. /* gidToCID only needs to be defined if the client calls the
  182. function XCF_GlyphIDsToCIDs. */
  183. XCF_GIDToCID gidToCID;
  184. /* This only needs to be defined if the client is providing the
  185. charstring data. */
  186. XCF_GetCharString getCharStr;
  187. void PTR_PREFIX *getCharStrHook;
  188. XCF_GetFSType getFSType;
  189. void PTR_PREFIX *getFSTypeHook;
  190. // GOODNAME
  191. XCF_IsKnownROS isKnownROS;
  192. void PTR_PREFIX *isKnownROSHook;
  193. #if HAS_COOLTYPE_UFL == 1
  194. XCF_GetDesignPositions getDesignPositions;
  195. void PTR_PREFIX *getDesignPositionsHook;
  196. XCF_GetDesignMap getDesignMap;
  197. void PTR_PREFIX *getDesignMapHook;
  198. #endif
  199. XCF_CharNameToGID gnameToGid;
  200. XCF_strncmp strncmp;
  201. } XCF_CallbackStruct;
  202. /***************************
  203. Client Options
  204. ***************************/
  205. /* UniqueID Options */
  206. #define XCF_KEEP_UID 0x00 /* Define UID with the one in the font. */
  207. #define XCF_UNDEFINE_UID 0x01 /* Don't define a UniqueID in the font. */
  208. #define XCF_USER_UID 0x02 /* Replace UniqueID with one specified. */
  209. /* Subroutine flattening options */
  210. #define XCF_KEEP_SUBRS 0x00 /* Keep all subroutines intact */
  211. #define XCF_FLATTEN_SUBRS 0x01 /* Flatten all the subroutines */
  212. typedef struct {
  213. boolean useSpecialEncoding; /* Use special encoding that is not derived
  214. * from Adobe Standard Encoding
  215. */
  216. boolean notdefEncoding; /* Generate an encoding array w/.notdef names */
  217. unsigned char PTR_PREFIX *encodeName; /* If this field is not NULL, the
  218. * generated font will use the
  219. * specified encodeName for the
  220. * font encoding definition.
  221. */
  222. unsigned char PTR_PREFIX *fontName; /* If this field is not NULL, the
  223. * generated font will use the
  224. * specified fontName for the
  225. * font name definition.
  226. */
  227. unsigned char PTR_PREFIX * PTR_PREFIX *otherSubrNames;
  228. /* If this field is not NULL,
  229. * the generated font uses the names
  230. * in this array as the Flex and
  231. * Hint Substitution names to call
  232. * in the OtherSubrs array of the
  233. * font private dict. This is
  234. * required if the client needs to
  235. * support pre 51 version printers.
  236. */
  237. } XCF_DownloadOptions;
  238. typedef struct
  239. {
  240. unsigned int fontIndex; /* font index w/i a CFF font set */
  241. unsigned int uniqueIDMethod;
  242. unsigned long uniqueID; /* use this id if XCF_USER_UID is the method */
  243. boolean subrFlatten; /* flatten/unwind subroutines; local and
  244. global subrs are always flattened, this
  245. field just indicates whether hint substitution
  246. subrs are created - 1 = yes, 0 = no.
  247. */
  248. Int16 lenIV; /* This field is the value for charstring
  249. * encryption. Typically -1 (no encryption),
  250. * 0 (encryption with no extra bytes), or
  251. * 4 (encryption with 4 extra bytes).
  252. */
  253. boolean hexEncoding; /* 0 = binary, or 1 = hex encoding */
  254. boolean eexecEncryption;
  255. Card8 outputCharstrType; /* 1 = Type1, 2 = Type2 charstrings */
  256. Card16 maxBlockSize;
  257. XCF_DownloadOptions dlOptions;
  258. } XCF_ClientOptions;
  259. /****************************
  260. Font Identifer Definitions
  261. ****************************/
  262. #define XCF_SingleMaster 0x00
  263. #define XCF_MultipleMaster 0x01
  264. #define XCF_CID 0x02
  265. #define XCF_SyntheticBase 0x03
  266. #define XCF_Chameleon 0x04
  267. /***************************
  268. API Functions
  269. ***************************/
  270. extern enum XCF_Result XCF_Init(
  271. XFhandle PTR_PREFIX *pHandle, /* Out */
  272. XCF_CallbackStruct PTR_PREFIX *pCallbacks, /* In */
  273. XCF_ClientOptions PTR_PREFIX *options); /* In */
  274. extern enum XCF_Result XCF_CleanUp(
  275. XFhandle PTR_PREFIX *pHandle); /* In/Out */
  276. extern enum XCF_Result XCF_FontCount(
  277. XFhandle handle, /* In */
  278. unsigned int PTR_PREFIX *count); /* Out */
  279. extern enum XCF_Result XCF_FontName(XFhandle handle, /* In */
  280. unsigned short int fontIndex, /* In */
  281. char PTR_PREFIX *fontName, /* Out */
  282. unsigned short int maxFontNameLength); /* In */
  283. extern enum XCF_Result XCF_ConvertToPostScript(
  284. XFhandle handle); /* In */
  285. extern enum XCF_Result XCF_DumpCff(
  286. XFhandle handle, /* In */
  287. unsigned int fontIndex, /* In */
  288. int dumpCompleteFontSet, /* In */
  289. char PTR_PREFIX *fileName, /* In */
  290. char PTR_PREFIX *commandLine); /* In */
  291. /* Given a handle to a font returns in identifer whether it is a synthetic,
  292. multiple master, single master, cid, or chameleon font. */
  293. extern enum XCF_Result XCF_FontIdentification(
  294. XFhandle handle,
  295. unsigned short int PTR_PREFIX *identifier);
  296. #if HAS_COOLTYPE_UFL == 1
  297. /* Initializes, creates, and returns an XFhandle in pHandle.
  298. This is essentially the same function as XCF_Init except
  299. that it does not read a fontset to initialize certain
  300. fields in its internal fontSet data structure. charStrCt
  301. is the number of glyphs in this font. This is used to
  302. allocate the structure that keeps track of which glyphs
  303. have been downloaded.
  304. */
  305. extern enum XCF_Result XCF_InitHandle(
  306. XFhandle PTR_PREFIX *pHandle, /* Out */
  307. XCF_CallbackStruct PTR_PREFIX *pCallbacks, /* In */
  308. XCF_ClientOptions PTR_PREFIX *options, /* In */
  309. unsigned long charStrCt); /* In */
  310. #endif
  311. /*************************************************************************
  312. XCF Overview
  313. **************************************************************************
  314. XCF is used to convert fonts from the CFF (Compact Font Format) format
  315. to the standard PostScript Type 1 font format. The CFF format records
  316. font data more compactly than the original Type 1 format. The CFF format
  317. also allows multiple fonts to be stored in a single file called a font
  318. set. XCF_ConvertToPostScript can be used to examine the contents of a
  319. font set and expand selected fonts within it.
  320. Calls into the xcf API always begin with a call to XCF_Init(). This
  321. function initializes, creates, and returns a XFHandle
  322. which will be passed to all subsequent calls. XCF_Init()
  323. takes as arguments a pointer to a structure containing callbacks and
  324. a pointer to XCF_ClientOptions. The client options passed in are
  325. copied by XCF_Init so the client does not have to maintain this data
  326. structure. The fontIndex argument should be set to 0 for CFF files
  327. that contain a single font. Passing the options to XCF_Init implies
  328. that the same options are used for each font in a fontset. If this
  329. isn't true for all clients then XCF_ConvertToPostScript and
  330. XCF_DownloadFontIncr will need to be modified to accept the client options.
  331. A pointer and length can be passed if the font resides completely in
  332. memory. In this case the GetBytes callback should be set to NULL.
  333. Otherwise the GetBytes() callback is used to read the CFF font. Callback
  334. procedures are used in place of library calls to maintain portability.
  335. The expanded font is returned using the PutBytes callback function. The
  336. only library dependency xcf has is <setjmp.h>.
  337. Calls into xcf should always end with a call to CleanUp()
  338. except when the call to XCF_Init() fails. All xcf functions return
  339. an enumerated status value of type XCF_Result. Any value other than XCF_Ok
  340. indicates that an error has occurred.
  341. A font set is expanded with a call to XCF_ConvertToPostScript().
  342. This procedure will expand the font specified in the fontIndex
  343. field of the XCF_ClientOptions struct.
  344. FontCount() is used to obtain the number of fonts stored in a CFF font
  345. file.
  346. FontName() is used to read the name of any font in a CFF font file.
  347. *************************************************************************/
  348. /*************************************************************************
  349. XCF Downloading Overview
  350. **************************************************************************
  351. The following functions are used to incrementally download or subset
  352. CFF fonts with Type 1 or Type 2 charstrings. They monitor:
  353. 1) the state of the downloading process, and
  354. 2) the characters that have been downloaded.
  355. The latter is necessary so that seac characters are handled effectively.
  356. These functions accept a glyph id (GID) which can be used to index into
  357. the CFF's charset table. It assumes that clients can convert a character
  358. code or unicode into a GID. It also assumes that the font will be used
  359. in a Level 2 or above PostScript printer.
  360. In order to download a font subset from a CFF font set a client needs
  361. to perform the following steps:
  362. 1. Initialize the font set by calling XCF_Init().
  363. 2. Call XCF_ProcessCFF to read the cff data.
  364. 3. Download a font subset by calling XCF_DownloadFontIncr().
  365. 4. Repeat #3 as often as necessary for this font.
  366. 5. Terminate XCF by calling XCF_CleanUp().
  367. To get various information about the downloaded font step 3 can be
  368. replaced by calls to: XCF_CountDownloadGlyphs, XCF_GlyphIDsToCharNames,
  369. or XCF_GlyphIDsToCIDs.
  370. *************************************************************************/
  371. /**************************************************************************
  372. Function name: XCF_DownloadFontIncr()
  373. Summary: Download a font from a CFF fontset.
  374. Description: Generate a font that is specified by the pCharStrID.
  375. Parameters:
  376. hfontset - XCF fontset handle obtained from XCF_Init().
  377. cGlyphs - number of charstrings to download.
  378. If cGlyphs = 0, the function downloads a base font with only
  379. a ".notdef" charstring. If cGlyphs = -1, the function downloads
  380. the entire font in which case the rest of the arguments are
  381. ignored, i.e., pGlyphID, etc.
  382. pGlyphID - pointer to a list of glyphIDs
  383. pGlyphName - pointer to a list of character names to use. This
  384. list must be in the same order as the pGlyphID list.
  385. If this list is NULL, then the name defined in the
  386. charset will be used.
  387. pCharStrLength - pointer to the total length of charstrings
  388. downloaded.
  389. Return Values: standard XCF_Result values
  390. Notes: This function keeps track of the downloaded characters, therefore,
  391. it won't download characters that have already been downloaded.
  392. Characters that are needed for seac characters are downloaded
  393. automatically.
  394. *************************************************************************/
  395. extern enum XCF_Result XCF_DownloadFontIncr(
  396. XFhandle hfontset, /* In */
  397. short cGlyphs, /* In */
  398. XCFGlyphID PTR_PREFIX *pGlyphID, /* In */
  399. unsigned char PTR_PREFIX **pGlyphName, /* In */
  400. unsigned long PTR_PREFIX *pCharStrLength /* Out */
  401. );
  402. /*************************************************************************
  403. Function name: XCF_CountDownloadGlyphs()
  404. Summary: Get the number of glyphs necessary to download.
  405. Description: This function returns in pcNewGlyphs the number of glyphs
  406. in the pGlyphID list that have not been downloaded.
  407. Parameters:
  408. hfontset - XCF fontset handle obtained from XCF_Init().
  409. cGlyphs - number of glyphs in the pGlyphID list.
  410. pGlyphID - pointer to a list of glyphIDs
  411. pcNewGlyphs - Number of new glyphs that have not been downloaded.
  412. This number does not include seac characters.
  413. Return values: standard XCF_Result value
  414. *************************************************************************/
  415. extern enum XCF_Result XCF_CountDownloadGlyphs(
  416. XFhandle hfontset, /* In */
  417. short cGlyphs, /* In */
  418. XCFGlyphID PTR_PREFIX *pGlyphID, /* In */
  419. unsigned short PTR_PREFIX *pcNewGlyphs /* Out */
  420. );
  421. /*************************************************************************
  422. Function name: XCF_ClearIncrGlyphList()
  423. Summary: Clears (reset to 0) the list of glyphs that have been dlded.
  424. Description: Updates the DownloadRecordStruct.
  425. Parameters:
  426. hfontset - XCF fontset handle obtained from XCF_Init().
  427. Return values: standard XCF_Result value
  428. *************************************************************************/
  429. extern enum XCF_Result XCF_ClearIncrGlyphList(XFhandle hfontset);
  430. /*************************************************************************
  431. Function name: XCF_SubsetRestrictions()
  432. Summary: Checks for usage and subsetting restrictions.
  433. Description: Checks the last string in the string index table for a font
  434. authentication string. If it is there then usageRestricted
  435. is true and the subsetting restrictions are returned in
  436. subset. If this is not a usageRestricted font then subset
  437. is set to 100. subset contains a positive number between
  438. 0 and 100. It is the maximum percentage of glyphs that can
  439. be included in a subsetted font. So 0 means subsetting is
  440. not allowed and 100 means subsetting is unrestricted.
  441. Parameters:
  442. handle - XCF fontset handle obtained from XCF_Init().
  443. usageRestricted - returns 1 if font is usage restricted, otherwise 0.
  444. subset - returns a number between 0 and 100 inclusive.
  445. Return values: standard XCF_Result value
  446. *************************************************************************/
  447. extern enum XCF_Result XCF_SubsetRestrictions(XFhandle handle, /* In */
  448. unsigned char PTR_PREFIX *usageRestricted, /* Out */
  449. unsigned short PTR_PREFIX *subset /* Out */
  450. );
  451. /* Reads the CFF data. */
  452. extern enum XCF_Result XCF_ProcessCFF(XFhandle handle);
  453. /* For each glyphID in pGlyphIDs gidToCharName is called with the associated
  454. character name and string length. The character name is not guaranteed
  455. to be null terminated.*/
  456. extern enum XCF_Result XCF_GlyphIDsToCharNames(
  457. XFhandle handle,
  458. short cGlyphs, /* number of glyphs in glyphID list */
  459. XCFGlyphID PTR_PREFIX *pGlyphIDs, /* list of glyphIDs */
  460. void PTR_PREFIX *client, /* client data passed to callback, can be NULL */
  461. unsigned short clientSize /* size of client data buffer */
  462. );
  463. /* For each glyphID in pGlyphIDs gidToCID is called with the associated cid. */
  464. extern enum XCF_Result XCF_GlyphIDsToCIDs(
  465. XFhandle handle,
  466. short cGlyphs, /* number of glyphs in glyphID list */
  467. XCFGlyphID PTR_PREFIX *pGlyphIDs, /* list of glyphIDs */
  468. void PTR_PREFIX *client /* client data passed to callback, can be NULL */
  469. );
  470. /* For each glyphName in pGlyphNames, gnameToGid is called with the associated
  471. glyph id. */
  472. extern enum XCF_Result XCF_CharNamesToGIDs(
  473. XFhandle handle,
  474. short cGlyphs, /* number of glyph names */
  475. char PTR_PREFIX **ppGlyphNames, /* list of glyphNames */
  476. void PTR_PREFIX *client /* client data passed to callback, can be NULL */
  477. );
  478. /*************************************************************************
  479. Callback Functions
  480. **************************************************************************
  481. The callback functions are passed to xcf in a callback structure.
  482. Callbacks are used by xcf instead of library calls for portability.
  483. -- PutBytes --
  484. typedef int (*XCF_PutBytesAtPosFunc) ( char PTR_PREFIX *pData, long int position, unsigned short int length, void PTR_PREFIX *clientHook );
  485. This function takes a pointer to the data, a position, a length and a
  486. client hook as arguments. XCF uses the XCF_PutBytesAtPosFunc() to
  487. return the expanded font to it's client. If position is less than zero
  488. then the data should immediately follow the data sent in the last call
  489. to XCF_PutBytesAtPosFunc. (No repositioning occurs.) If position is
  490. greater than or equal to zero then the output should be repositioned
  491. to that point. (Position bytes from the begining of the output file.)
  492. XCF buffers it's output to avoid overly frequent calls to this
  493. function. clientHook contains the same pointer which was passed in
  494. via the putBytesHook field in the callback structure.
  495. -- OutputPos --
  496. typedef long int (*XCF_OutputPosFunc) ( void PTR_PREFIX *clientHook )
  497. This function reports the current position of the output stream. The
  498. result of this function can be used as the 'position' argument to
  499. XCF_PutBytesAtPosFunc. clientHook contains the same pointer which was
  500. passed in via the outputPosHook field in the callback structure.
  501. -- Allocate --
  502. typedef unsigned int (*XCF_AllocateFunc) ( void PTR_PREFIX * PTR_PREFIX * handle, unsigned int size );
  503. This function allocates, deallocates or reallocates memory.
  504. Required functionality:
  505. When size == 0 and handle != NULL
  506. free the handle
  507. When size == 0 and handle == NULL
  508. don't do anything
  509. When size > 0 and handle != NULL
  510. reallocate memory, preserving the data.
  511. When size > 0 and handle == NULL
  512. allocate the memory (it does not have to be cleared).
  513. Return true on success, false on failure.
  514. In the case of failure handle should be set to NULL. If a failure
  515. occurs during memory reallocation then the original memory pointed
  516. to by handle should be deallocated.
  517. -- GetBytesFromPosFunc --
  518. typedef int (*XCF_GetBytesFromPosFunc) ( char PTR_PREFIX * PTR_PREFIX *ppData, long int position, unsigned short int length, void PTR_PREFIX *clientHook );
  519. This function is only needed if the font does not reside in RAM.
  520. XCF_GetBytesFromPosFunc() requests a block of data from the cff font set.
  521. The block size will never exceed 64K. 'position' contains an offset to the
  522. begining of the data (0 = first byte) and 'length' contains the number
  523. of bytes requested. A pointer to the requested data is returned in
  524. 'ppData'. 'clientHook' can be used to by the client if needed. It returns
  525. the hook passed in via the getBytesHook field in the callback structure.
  526. Each call to GetFontBlock() indicates that the previous block is no longer
  527. needed. This allows a single block of memory to be reused (growing if needed)
  528. for each call to XCF_GetBytesFromPosFunc(). Memory allocated to hold the
  529. data requested by XCF_GetBytesFromPosFunc() may be freed after the current
  530. typedef unsigned short int (*XCF_strlen) ( const char PTR_PREFIX *string );
  531. typedef void PTR_PREFIX *(*XCF_memcpy) ( void PTR_PREFIX *dest, const void PTR_PREFIX *src, unsigned short int count );
  532. typedef void PTR_PREFIX *(*XCF_memset) ( void PTR_PREFIX *dest, int c, unsigned short int count );
  533. typedef int (*XCF_sprintf) ( char PTR_PREFIX *buffer, size_t cchDest, const char PTR_PREFIX *format, ... );
  534. typedef double (*XCF_atof) ( const char *string );
  535. -- Optional --
  536. typedef int (*XCF_printfError) ( const char PTR_PREFIX *format, ... ); Optional - used in DEVELOP mode to report error descriptions.
  537. *************************************************************************/
  538. /*************************************************************************
  539. Preprocessor Definitions
  540. **************************************************************************/
  541. /*************************************************************************
  542. XCF_DEVELOP - If defined then additional error message information
  543. is returned via the printf callback. Also, additional
  544. error checking is performed. XCF_DUMP should only be
  545. defined during debugging.
  546. XCF_DUMP - Causes charstring debug information to be printed
  547. during processing. XCF_DUMP should only be defined
  548. during debugging.
  549. XCF_DUMP_CFF - allows reading and writing of CFF data to a file
  550. (not as a Type 1 font).
  551. **************************************************************************/
  552. #ifdef __cplusplus
  553. }
  554. #endif
  555. #endif /* XCF_PUB_H */