Source code of Windows XP (NT5)
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.

765 lines
25 KiB

  1. /***************************************************************************
  2. * ELSEPAN.H - Base definitions for ElseWare PANOSE(tm) 1.0 Font Mapper.
  3. *
  4. * $keywords: elsepan.h 1.10 19-Jul-93 11:11:34 AM$
  5. *
  6. * Copyright (C) 1991-93 ElseWare Corporation. All rights reserved.
  7. ***************************************************************************/
  8. #ifndef __ELSEPAN_H__
  9. #define __ELSEPAN_H__
  10. /***************************************************************************
  11. * ELSEUSER
  12. *
  13. * Rather than modify elsepan.h, put flags and additions in elseuser.h, or
  14. * disable inclusion of elseuser.h by placing "#define NOELSEUSER" ahead of
  15. * the #include for elsepan.h.
  16. ***************************************************************************/
  17. #ifdef NOELSEUSER
  18. #define __ELSEUSER_H__
  19. #endif
  20. #ifndef __ELSEUSER_H__
  21. #include "elseuser.h"
  22. #endif
  23. /***************************************************************************
  24. * ELSETYPE
  25. *
  26. * Basic ElseWare types.
  27. ***************************************************************************/
  28. #ifndef __ELSETYPE_H__
  29. #include "elsetype.h"
  30. #endif
  31. /***************************************************************************
  32. * C++ SUPPORT
  33. *
  34. * If we are compiling with a C++ compiler, make these C-callable functions.
  35. ***************************************************************************/
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39. /***************************************************************************
  40. * COMPILER FLAG OVERRIDES
  41. *
  42. * If we are compiling one of the core ElseWare Font Mapper source files,
  43. * then override some flags.
  44. ***************************************************************************/
  45. #ifdef ELSE_MAPPER_CORE
  46. #undef NOELSEPANCONST
  47. #define ELSEPENALTYDB
  48. #endif
  49. /***************************************************************************
  50. * PANOSE 1.0 PENALTIES DATABASE
  51. *
  52. * By default, this is declared as a static data object that stores
  53. * all the penalty tables in a variable called 's_panDB.' This is in
  54. * PAN1PTBL.H, which is generated by a stand-alone program in PAN1PTBL.C.
  55. *
  56. * Two sets of macros 'allocate' and 'lock' the database, which really
  57. * just return the pointer to the statically defined 's_panDB.'
  58. *
  59. * To override, the user should '#define NOELSEPANDATA' in ELSEUSER.H
  60. * and provide replacements for the allocate and lock routines. The file
  61. * PAN1PTBL.H should be used to generate the user-provided penalty database.
  62. ***************************************************************************/
  63. #ifdef ELSE_MAPPER_CORE
  64. #ifdef NOELSEPANDATA
  65. #define __PAN1PTBL_H__
  66. #endif
  67. #ifndef __PAN1PTBL_H__
  68. #include "pan1ptbl.h"
  69. #define M_lAllocPAN1DATA() (1L) /* returns data handle */
  70. #define M_bFreePAN1DATA(hData) (TRUE) /* returns TRUE/FALSE */
  71. #define M_lLockPAN1DATA(hData) ((EW_LPPDICT_MEM)s_panDB) /* returns ptr */
  72. #define M_bUnlockPAN1DATA(hData) (TRUE) /* returns TRUE/FALSE */
  73. #endif
  74. #endif
  75. /***************************************************************************
  76. * COMPILATION FLAGS
  77. *
  78. * These flags control various aspects of compiling the font mapper. You
  79. * turn these flags on by #defining them in elseuser.h.
  80. ***************************************************************************/
  81. /* ELSEARGS macro
  82. *
  83. * Disable argument lists on prototypes by #defining NOELSEARGS.
  84. */
  85. #ifdef ELSEARGS
  86. #undef ELSEARGS
  87. #endif
  88. #ifndef NOELSEARGS
  89. #define ELSEARGS(args) args
  90. #else
  91. #define ELSEARGS(args) ()
  92. #endif
  93. /* PAN_MATCH_ERROR
  94. *
  95. * This constant marks an error.
  96. */
  97. #ifndef PAN_MATCH_ERROR
  98. #define PAN_MATCH_ERROR 0xFFFF
  99. #endif
  100. /* ELSEMAXSHORT
  101. *
  102. * Maximum legal value for a SHORT.
  103. */
  104. #ifndef ELSEMAXSHORT
  105. #define ELSEMAXSHORT 0x7FFF
  106. #endif
  107. /* ELSEDEFTHRESHOLD
  108. *
  109. * Default value for the mapper threshold.
  110. */
  111. #ifndef ELSEDEFTHRESHOLD
  112. #define ELSEDEFTHRESHOLD 30
  113. #endif
  114. /* M_ELSELMUL
  115. *
  116. * a * b long math operation.
  117. */
  118. #ifndef M_ELSELMUL
  119. #define M_ELSELMUL(a, b) ((long)((long)(a) * (long)(b)))
  120. #endif
  121. /* M_ELSELDIV
  122. *
  123. * a / b long math operation.
  124. */
  125. #ifndef M_ELSELDIV
  126. #define M_ELSELDIV(a, b) ((long)((long)(a) / (long)(b)))
  127. #endif
  128. /* M_ELSEMULDIV
  129. *
  130. * (a * b) / c math operation.
  131. */
  132. #ifndef M_ELSEMULDIV
  133. #define M_ELSEMULDIV(a, b, c) \
  134. ((int)(M_ELSELDIV((M_ELSELMUL((a), (b)) + M_ELSELDIV((c), 2)), (c))))
  135. #endif
  136. /* M_ELSEMEMCPY
  137. *
  138. * memcpy(dst, src, len) operation.
  139. *
  140. * Defined in elsepan.c. Override it by defining a macro
  141. * for M_ELSEMEMCPY(dst, src, len).
  142. */
  143. /***************************************************************************
  144. * PANOSE CONSTANTS
  145. *
  146. * These constants represent the individual values of the PANOSE digits.
  147. ***************************************************************************/
  148. #define PANOSE_ANY 0
  149. #define PANOSE_NOFIT 1
  150. #define NUM_PAN_DIGITS 10
  151. #define MAX_PAN1_FAMILY 127
  152. #define MAX_PAN1_DIGIT 31
  153. #define MAX_CUSTOM_WEIGHTS 8
  154. #define SIZE_PAN1_NUM (sizeof(EW_BYTE) * NUM_PAN_DIGITS)
  155. #ifndef NOELSEPANCONST
  156. /* Latin Text PANOSE values.
  157. */
  158. #define FAMILY_LATTEXT 2
  159. #define FAMILY_LATSCRIPT 3
  160. #define FAMILY_LATDECORATIVE 4
  161. #define FAMILY_LATPICTORIAL 5
  162. #define FAMILY_KANJI3TEXTANDSCRIPT 6
  163. #define FAMILY_KANJI3DECORATIVE 7
  164. #define FAMILY_KANJI3SYMBOLS 8
  165. #define FAMILY__LAST 8
  166. #define SERIF_COVE 2
  167. #define SERIF_OBTUSECOVE 3
  168. #define SERIF_SQUARECOVE 4
  169. #define SERIF_OBTSQUARECOVE 5
  170. #define SERIF_SQUARE 6
  171. #define SERIF_THIN 7
  172. #define SERIF_BONE 8
  173. #define SERIF_EXAGGERATED 9
  174. #define SERIF_TRIANGLE 10
  175. #define SERIF_NORMALSANS 11
  176. #define SERIF_OBTUSESANS 12
  177. #define SERIF_PERPSANS 13
  178. #define SERIF_FLARED 14
  179. #define SERIF_ROUNDED 15
  180. #define SERIF__LAST 15
  181. #define WEIGHT_VERYLIGHT 2
  182. #define WEIGHT_LIGHT 3
  183. #define WEIGHT_THIN 4
  184. #define WEIGHT_BOOK 5
  185. #define WEIGHT_MEDIUM 6
  186. #define WEIGHT_DEMI 7
  187. #define WEIGHT_BOLD 8
  188. #define WEIGHT_HEAVY 9
  189. #define WEIGHT_BLACK 10
  190. #define WEIGHT_NORD 11
  191. #define WEIGHT__LAST 11
  192. #define PROPORTION_OLDSTYLE 2
  193. #define PROPORTION_MODERN 3
  194. #define PROPORTION_EVENWIDTH 4
  195. #define PROPORTION_EXPANDED 5
  196. #define PROPORTION_CONDENSED 6
  197. #define PROPORTION_VERYEXP 7
  198. #define PROPORTION_VERYCOND 8
  199. #define PROPORTION_MONOSPACE 9
  200. #define PROPORTION__LAST 9
  201. #define CONTRAST_NONE 2
  202. #define CONTRAST_VERYLOW 3
  203. #define CONTRAST_LOW 4
  204. #define CONTRAST_MEDIUMLOW 5
  205. #define CONTRAST_MEDIUM 6
  206. #define CONTRAST_MEDIUMHIGH 7
  207. #define CONTRAST_HIGH 8
  208. #define CONTRAST_VERYHIGH 9
  209. #define CONTRAST__LAST 9
  210. #define STROKE_NOVARIATION 2
  211. #define STROKE_GRADDIAG 3
  212. #define STROKE_GRADTRANS 4
  213. #define STROKE_GRADVERT 5
  214. #define STROKE_GRADHORZ 6
  215. #define STROKE_RAPIDVERT 7
  216. #define STROKE_RAPIDHORZ 8
  217. #define STROKE_INSTANTVERT 9
  218. #define STROKE__LAST 9
  219. #define ARM_STRAIGHTHORZ 2
  220. #define ARM_STRAIGHTWEDGE 3
  221. #define ARM_STRAIGHTVERT 4
  222. #define ARM_STRAIGHTSGLSERIF 5
  223. #define ARM_STRAIGHTDBLSERIF 6
  224. #define ARM_NONSTRTHORZ 7
  225. #define ARM_NONSTRTWEDGE 8
  226. #define ARM_NONSTRTVERT 9
  227. #define ARM_NONSTRTSGLSERIF 10
  228. #define ARM_NONSTRTDBLSERIF 11
  229. #define ARM__LAST 11
  230. #define LTRFORM_NORMCONTACT 2
  231. #define LTRFORM_NORMWEIGHTED 3
  232. #define LTRFORM_NORMBOXED 4
  233. #define LTRFORM_NORMFLATTENED 5
  234. #define LTRFORM_NORMROUNDED 6
  235. #define LTRFORM_NORMOFFCENTER 7
  236. #define LTRFORM_NORMSQUARE 8
  237. #define LTRFORM_OBLQCONTACT 9
  238. #define LTRFORM_OBLQWEIGHTED 10
  239. #define LTRFORM_OBLQBOXED 11
  240. #define LTRFORM_OBLQFLATTENED 12
  241. #define LTRFORM_OBLQROUNDED 13
  242. #define LTRFORM_OBLQOFFCENTER 14
  243. #define LTRFORM_OBLQSQUARE 15
  244. #define LTRFORM__LAST 15
  245. #define MIDLINE_STDTRIMMED 2
  246. #define MIDLINE_STDPOINTED 3
  247. #define MIDLINE_STDSERIFED 4
  248. #define MIDLINE_HIGHTRIMMED 5
  249. #define MIDLINE_HIGHPOINTED 6
  250. #define MIDLINE_HIGHSERIFED 7
  251. #define MIDLINE_CONSTTRIMMED 8
  252. #define MIDLINE_CONSTPOINTED 9
  253. #define MIDLINE_CONSTSERIFED 10
  254. #define MIDLINE_LOWTRIMMED 11
  255. #define MIDLINE_LOWPOINTED 12
  256. #define MIDLINE_LOWSERIFED 13
  257. #define MIDLINE__LAST 13
  258. #define XHEIGHT_CONSTSMALL 2
  259. #define XHEIGHT_CONSTSTD 3
  260. #define XHEIGHT_CONSTLARGE 4
  261. #define XHEIGHT_DUCKSMALL 5
  262. #define XHEIGHT_DUCKSTD 6
  263. #define XHEIGHT_DUCKLARGE 7
  264. #define XHEIGHT__LAST 7
  265. /* Latin Script PANOSE values.
  266. */
  267. #ifndef NOELSEPANSCRIPT
  268. #define STOOL_FLATNIB 2
  269. #define STOOL_PRESSUREPT 3
  270. #define STOOL_ENGRAVED 4
  271. #define STOOL_BALL 5
  272. #define STOOL_BRUSH 6
  273. #define STOOL_ROUGH 7
  274. #define STOOL_FELTPEN 8
  275. #define STOOL_WILDBRUSH 9
  276. #define STOOL__LAST 9
  277. #define STOP_ROMDISCONNECT 2
  278. #define STOP_ROMTRAIL 3
  279. #define STOP_ROMCONNNECT 4
  280. #define STOP_CURDISCONNECT 5
  281. #define STOP_CURTRAIL 6
  282. #define STOP_CURCONNECT 7
  283. #define STOP_BLACKDISCONNECT 8
  284. #define STOP_BLACKTRAIL 9
  285. #define STOP_BLACKCONNECT 10
  286. #define STOP__LAST 10
  287. #define SFORM_UPNOWRAP 2
  288. #define SFORM_UPSOMEWRAP 3
  289. #define SFORM_UPMOREWRAP 4
  290. #define SFORM_UPEXCESSWRAP 5
  291. #define SFORM_OBNOWRAP 6
  292. #define SFORM_OBSOMEWRAP 7
  293. #define SFORM_OBMOREWRAP 8
  294. #define SFORM_OBEXCESSWRAP 9
  295. #define SFORM_EXNOWRAP 10
  296. #define SFORM_EXSOMEWRAP 11
  297. #define SFORM_EXMOREWRAP 12
  298. #define SFORM_EXEXCESSWRAP 13
  299. #define SFORM__LAST 13
  300. #define SFINIAL_NONENOLOOP 2
  301. #define SFINIAL_NONECLOSELOOP 3
  302. #define SFINIAL_NONEOPENLOOP 4
  303. #define SFINIAL_SHARPNOLOOP 5
  304. #define SFINIAL_SHARPCLOSELOOP 6
  305. #define SFINIAL_SHARPOPENLOOP 7
  306. #define SFINIAL_TAPERNOLOOP 8
  307. #define SFINIAL_TAPERCLOSELOOP 9
  308. #define SFINIAL_TAPEROPENLOOP 10
  309. #define SFINIAL_ROUNDNOLOOP 11
  310. #define SFINIAL_ROUNDCLOSELOOP 12
  311. #define SFINIAL_ROUNDOPENLOOP 13
  312. #define SFINIAL__LAST 13
  313. #define SXASCENT_VERYLOWDIF 2
  314. #define SXASCENT_LOWDIF 3
  315. #define SXASCENT_MEDIUMDIF 4
  316. #define SXASCENT_HIGHDIF 5
  317. #define SXASCENT_VERYHIGHDIF 6
  318. #define SXASCENT__LAST 6
  319. #endif /* ifndef NOELSEPANSCRIPT */
  320. /* Kanji PANOSE values.
  321. */
  322. #ifndef NOELSEPANKANJI
  323. #define KSTROKE_TRADBRUSH 2
  324. #define KSTROKE_VIGBRUSH 3
  325. #define KSTROKE_DRYBRUSH 4
  326. #define KSTROKE_FLATNIBPEN 5
  327. #define KSTROKE_SQUARE 6
  328. #define KSTROKE_OBTSQUARE 7
  329. #define KSTROKE_ROUND 8
  330. #define KSTROKE_TAPERED 9
  331. #define KSTROKE_MECHBRUSH 10
  332. #define KSTROKE_STACCATO 11
  333. #define KSTROKE_VOLATE 12
  334. #define KSTROKE__LAST 12
  335. #define KCELL_NORMNOSLANT 2
  336. #define KCELL_NORMSLANTED 3
  337. #define KCELL_WIDENOSLANT 4
  338. #define KCELL_WIDESLANTED 5
  339. #define KCELL_TALLNOSLANT 6
  340. #define KCELL_TALLSLANTED 7
  341. #define KCELL_XTRAWIDENOSLANT 8
  342. #define KCELL_XTRAWIDESLANTED 9
  343. #define KCELL_XTRATALLNOSLANT 10
  344. #define KCELL_XTRATALLSLANTED 11
  345. #define KCELL__LAST 11
  346. #define KSSTROKE_ZOT 2
  347. #define KSSTROKE_LONGZOT 3
  348. #define KSSTROKE_FATZOT 4
  349. #define KSSTROKE_HOOKEDZOT 5
  350. #define KSSTROKE_SHORTRECT 6
  351. #define KSSTROKE_LONGRECT 7
  352. #define KSSTROKE_TAPEREDRECT 8
  353. #define KSSTROKE_SPIKE 9
  354. #define KSSTROKE_ROUNDED 10
  355. #define KSSTROKE_EXAGGERATED 11
  356. #define KSSTROKE_ROUGH 12
  357. #define KSSTROKE__LAST 12
  358. #define KTOP_STDNOSQUARE 2
  359. #define KTOP_MODNOSQUARE 3
  360. #define KTOP_STRONGNOSQUARE 4
  361. #define KTOP_WILDNOSQUARE 5
  362. #define KTOP_STDSQUARE 6
  363. #define KTOP_MODSQUARE 7
  364. #define KTOP_STRONGSQUARE 8
  365. #define KTOP_WILDSQUARE 9
  366. #define KTOP__LAST 9
  367. #define KSTYLESIM_FULL 2
  368. #define KSTYLESIM_COMPLEMENT 3
  369. #define KSTYLESIM_SIMILAR 4
  370. #define KSTYLESIM_DIFFERENT 5
  371. #define KSTYLESIM_DISPARATE 6
  372. #define KSTYLESIM__LAST 6
  373. #define KSTROKEVAR_FULL 2
  374. #define KSTROKEVAR_MODERATE 3
  375. #define KSTROKEVAR_LOW 4
  376. #define KSTROKEVAR_NONE 5
  377. #define KSTROKEVAR__LAST 5
  378. #endif /* ifndef NOELSEPANKANJI */
  379. #endif /* ifndef NOELSEPANCONST */
  380. /***************************************************************************
  381. * LATIN TEXT PANOSE INDICES
  382. *
  383. * Indices into an array containing the standard 10-digit PANOSE number.
  384. ***************************************************************************/
  385. #define PAN_IND_FAMILY 0
  386. #define PAN_IND_SERIF 1
  387. #define PAN_IND_WEIGHT 2
  388. #define PAN_IND_PROPORTION 3
  389. #define PAN_IND_CONTRAST 4
  390. #define PAN_IND_STROKE 5
  391. #define PAN_IND_ARMSTYLE 6
  392. #define PAN_IND_LTRFORM 7
  393. #define PAN_IND_MIDLINE 8
  394. #define PAN_IND_XHEIGHT 9
  395. #define PAN_IND__LAST 9
  396. /***************************************************************************
  397. * LATIN SCRIPT PANOSE INDICES
  398. *
  399. * Indices into an array containing the Latin Script 10-digit PANOSE number.
  400. ***************************************************************************/
  401. #ifndef NOELSEPANSCRIPT
  402. /* define PAN_IND_FAMILY 0 */
  403. #define SPAN_IND_STOOL 1
  404. #define SPAN_IND_WEIGHT 2
  405. #define SPAN_IND_MONOSPC 3
  406. #define SPAN_IND_ASPECT 4
  407. #define SPAN_IND_CONTRAST 5
  408. #define SPAN_IND_STOP 6
  409. #define SPAN_IND_SFORM 7
  410. #define SPAN_IND_SFINIAL 8
  411. #define SPAN_IND_SXASCENT 9
  412. #define SPAN_IND__LAST 9
  413. #endif /* ifndef NOELSEPANSCRIPT */
  414. /***************************************************************************
  415. * KANJI PANOSE INDICES
  416. *
  417. * Indices into an array containing the Kanji 10-digit PANOSE number.
  418. ***************************************************************************/
  419. #ifndef NOELSEPANKANJI
  420. /* define PAN_IND_FAMILY 0 */
  421. #define KPAN_IND_KSTROKE 1
  422. #define KPAN_IND_WEIGHT 2
  423. #define KPAN_IND_KCELL 3
  424. #define KPAN_IND_MONOSPC 4
  425. #define KPAN_IND_CONTRAST 5
  426. #define KPAN_IND_KSSTROKE 6
  427. #define KPAN_IND_KTOP 7
  428. #define KPAN_IND_KSTYLESIM 8
  429. #define KPAN_IND_KSTROKEVAR 9
  430. #define KPAN_IND__LAST 9
  431. #endif /* ifndef NOELSEPANKANJI */
  432. /***************************************************************************
  433. * KANJI-TO-LATIN WEIGHT INDICES
  434. *
  435. * Indices into the weights array for the Kanji-to-Latin cross-class
  436. * penalty database.
  437. ***************************************************************************/
  438. #ifndef NOELSEPANKANJI
  439. /* define PAN_IND_FAMILY 0 */
  440. #define PAN_IND_WT_KLSTROKETOSERIF 1
  441. #define PAN_IND_WT_KLWEIGHT 2
  442. #define PAN_IND_WT_KLCELLTOPROP 3
  443. #define PAN_IND_WT_KLCELLTOLTRFORM 4
  444. #define PAN_IND_WT_KLMONOTOPROP 5
  445. #define PAN_IND_WT_KLCONTRAST 6
  446. #define PAN_IND_WT_KLTOPTOLTRFORM 7
  447. #endif /* ifndef NOELSEPANKANJI */
  448. /***************************************************************************
  449. * PANOSE_PENALTY_VERS
  450. *
  451. * Database format version number.
  452. *
  453. * 0x0100 - Original implementation.
  454. * 0x0101 - Modified the compression formats in which the tables are stored,
  455. * and added a flat table format (zero compression).
  456. * 0x0110 - PANOSE version 1.0 penalties, previous versions were
  457. * "Expanded PANOSE" penalties. Added C3 compression.
  458. * 0x0111 - Added byte ordering check, and C4 compression. Also the penalty
  459. * table builder will make identical ptbls point to the same data
  460. * to further compress the database.
  461. ***************************************************************************/
  462. #define PANOSE_PENALTY_VERS 0x0111
  463. /***************************************************************************
  464. * PANOSE PENALTY TABLE data structures
  465. *
  466. * The following structures are fused together into one big block. See
  467. * the sample code in PAN1PTBL.C (provided with the ElseWare Font Mapper
  468. * source code) for an example of how to build this structure.
  469. ***************************************************************************/
  470. #ifdef ELSEPENALTYDB
  471. #define PAN_COMPRESS_C0 0
  472. #define PAN_COMPRESS_C1 1
  473. #define PAN_COMPRESS_C2 2
  474. #define PAN_COMPRESS_C3 3
  475. #define PAN_COMPRESS_C4 4
  476. #define PAN_COMPRESS__LAST 4
  477. /* Byte ordering test: the unByteOrder field of the header is
  478. * tested to make sure it matches this value -- if the bytes
  479. * are swapped, the test will fail.
  480. */
  481. #define PTBL_BYTE_ORDER 0x1234
  482. /* C0 compression == full table provided. The first two bytes
  483. * of the table contain its dimensions. When the need exists
  484. * to specify the whole table it is usually because it is a
  485. * non-square, non-symmetrical table.
  486. */
  487. typedef struct _tagEW_PTBL_C0_MEM {
  488. EW_BYTE jARangeLast; /* highest possible A value (table width) */
  489. EW_BYTE jBRangeLast; /* highest possible B value (table depth) */
  490. EW_BYTE jReserved; /* reserved, should be zero */
  491. EW_BYTE jPenalties[1]; /* penalty table */
  492. } EW_PTBL_C0_MEM, EW_FAR *EW_LPPTBL_C0_MEM;
  493. /* C1 compression == smooth penalty range symetrical about the
  494. * diagonal where closest to diagonal == 1 and each increment
  495. * away from the diagonal == increment penalty by one. NO table
  496. * is provided, and the any, no-fit, and match penalties take
  497. * on the defaults listed in the index entry for the dictionary.
  498. * The variables ulOffsTbl and unTblSize in the range record
  499. * should be zero.
  500. */
  501. /* C2 penalties symmetrical around the diagonal but without
  502. * a smooth range, lower left half specified. There is no special
  503. * record needed: it is an array of bytes where any, no-fit, and
  504. * match penalties are taken from the header.
  505. */
  506. /* C3 penalties are identical to C2 except the very first byte
  507. * is the no-fit penalty value: any and match penalties are taken
  508. * from the header.
  509. */
  510. /* C4 penalties are similar to C1: symmetric around the diagonal,
  511. * increasing in uniform increments the further from the diagonal.
  512. * The difference is it doesn't start at 1 and/or doesn't increment
  513. * by 1. The start and increment values are provided.
  514. */
  515. typedef struct _tagEW_PTBL_C4_MEM {
  516. EW_BYTE jStart; /* lowest value in table */
  517. EW_BYTE jIncrement; /* increment away from the diagonal */
  518. } EW_PTBL_C4_MEM, EW_FAR *EW_LPPTBL_C4_MEM;
  519. /* Penalty table record, which describes the format of the penalty
  520. * table and contains its offset and size. There is an array of
  521. * 9 of these at the offset unOffsPTbl stored in the index record
  522. * (there is no penalty table for the family digit). In the case of
  523. * cross-family mapping, there are unNumAtoB records (instead of 9).
  524. */
  525. typedef struct _tagEW_PTBL_MEM {
  526. EW_BYTE jRangeLast; /* highest possible PANOSE digit value */
  527. EW_BYTE jCompress; /* type of compression */
  528. EW_USHORT unOffsTbl; /* byte offset to penalty table */
  529. EW_USHORT unTblSize; /* # bytes in penalty table */
  530. } EW_PTBL_MEM, EW_FAR *EW_LPPTBL_MEM;
  531. /* The A to B array maps PANOSE digits from one classification to
  532. * those in another (this happens when the two Family digits are
  533. * not equal).
  534. */
  535. typedef struct _tagEW_ATOB_ITEM_MEM {
  536. EW_BYTE jAttrA; /* PANOSE number index from family A */
  537. EW_BYTE jAttrB; /* related PANOSE number ind from family B */
  538. } EW_ATOB_ITEM_MEM, EW_FAR *EW_LPATOB_ITEM_MEM;
  539. typedef struct _tagEW_ATOB_MEM {
  540. EW_USHORT unNumAtoB; /* count of array items */
  541. EW_ATOB_ITEM_MEM AtoBItem[1]; /* remapping array (variable length) */
  542. } EW_ATOB_MEM, EW_FAR *EW_LPATOB_MEM;
  543. /* Mapper weights are stored in an array of 10 1-byte values.
  544. * We include a weight for the family digit even though it is
  545. * ignored by the mapper (it is included so the weights array
  546. * is parrallel to the PANOSE digits array, allowing the same
  547. * constants to be used to access both arrays). In cross-family
  548. * mappings there are still 10 weights, and the unused ones are
  549. * set to zero.
  550. */
  551. /* Penalty index record. Each record contains information for a
  552. * penalty database, which contains all the penalty tables for one
  553. * given family pair.
  554. */
  555. typedef struct _tagEW_PIND_MEM {
  556. EW_BYTE jFamilyA; /* family pair for which penalties apply */
  557. EW_BYTE jFamilyB; /* ditto */
  558. EW_BYTE jDefAnyPenalty; /* default penalty value for 'any' match */
  559. EW_BYTE jDefNoFitPenalty; /* default penalty value for 'no fit' match */
  560. EW_BYTE jDefMatchPenalty; /* default penalty value for exact match */
  561. EW_BYTE jReserved; /* to keep the record word-aligned */
  562. EW_USHORT unOffsWts; /* byte offs to mapper weights */
  563. EW_USHORT unOffsAtoB; /* byte offs to array relates family A to B */
  564. EW_USHORT unOffsPTbl; /* byte offs to penalty tables */
  565. } EW_PIND_MEM, EW_FAR *EW_LPPIND_MEM;
  566. /* Penalty dictionary header. This is the header to the entire
  567. * structure. Its last item is a variable length array of index
  568. * records. Each index record points to a penalty database.
  569. */
  570. typedef struct _tagEW_PDICT_MEM {
  571. EW_USHORT unVersion; /* version # of this structure */
  572. EW_USHORT unByteOrder; /* byte ordering flag */
  573. EW_USHORT unNumDicts; /* number of entries in PANOSE_PINDEX array */
  574. EW_USHORT unSizeDB; /* count in bytes of the whole database */
  575. EW_PIND_MEM pind[1]; /* array of EW_PIND recs (variable len) */
  576. } EW_PDICT_MEM, EW_FAR *EW_LPPDICT_MEM;
  577. #endif /* ifdef ELSEPENALTYDB */
  578. /***************************************************************************
  579. * MAP STATE structure
  580. *
  581. * This data structure stores the state variables used by the mapper.
  582. * It is passed into almost all the mapper routines.
  583. ***************************************************************************/
  584. typedef struct _tagEW_MAPSTATE {
  585. EW_ULONG ulSanity;
  586. EW_USHORT unThreshold;
  587. EW_USHORT unRelaxThresholdCount;
  588. EW_ULONG ulhPan1Data;
  589. EW_BOOL bUseDef;
  590. EW_BYTE ajPanDef[NUM_PAN_DIGITS];
  591. #ifndef NOELSEWEIGHTS
  592. EW_BYTE ajWtRefA[MAX_CUSTOM_WEIGHTS];
  593. EW_BYTE ajWtRefB[MAX_CUSTOM_WEIGHTS];
  594. EW_BYTE ajCustomWt[SIZE_PAN1_NUM * MAX_CUSTOM_WEIGHTS];
  595. #endif
  596. } EW_MAPSTATE, EW_FAR *EW_LPMAPSTATE;
  597. /***************************************************************************
  598. * ELSEPAN.C: Core PANOSE 1.0 font mapping routines.
  599. ***************************************************************************/
  600. GLOBAL EW_SHORT EW_FAR EW_PASCAL nPANMapInit
  601. ELSEARGS (( EW_LPMAPSTATE lpMapState, EW_USHORT unSizeMapState ));
  602. GLOBAL EW_BOOL EW_FAR EW_PASCAL bPANMapClose
  603. ELSEARGS (( EW_LPMAPSTATE lpMapState ));
  604. GLOBAL EW_USHORT EW_FAR EW_PASCAL unPANMatchFonts
  605. ELSEARGS (( EW_LPMAPSTATE lpMapState, EW_LPBYTE lpPanWant,
  606. EW_ULONG ulSizeWant, EW_LPBYTE lpPanThis, EW_ULONG ulSizeThis,
  607. EW_BYTE jMapToFamily ));
  608. GLOBAL EW_VOID EW_FAR EW_PASCAL vPANMakeDummy
  609. ELSEARGS (( EW_LPBYTE lpPanThis, EW_USHORT unSize ));
  610. #ifndef NOELSEPICKFONTS
  611. GLOBAL EW_SHORT EW_FAR EW_PASCAL nPANGetMapDefault
  612. ELSEARGS (( EW_LPMAPSTATE lpMapState, EW_LPBYTE lpPanDef,
  613. EW_USHORT unSizePanDef ));
  614. GLOBAL EW_SHORT EW_FAR EW_PASCAL nPANSetMapDefault
  615. ELSEARGS (( EW_LPMAPSTATE lpMapState, EW_LPBYTE lpPanDef,
  616. EW_USHORT unSizePanDef ));
  617. GLOBAL EW_BOOL EW_FAR EW_PASCAL bPANEnableMapDefault
  618. ELSEARGS (( EW_LPMAPSTATE lpMapState, EW_BOOL bEnable ));
  619. GLOBAL EW_BOOL EW_FAR EW_PASCAL bPANIsDefaultEnabled
  620. ELSEARGS (( EW_LPMAPSTATE lpMapState ));
  621. GLOBAL EW_USHORT EW_FAR EW_PASCAL unPANPickFonts
  622. ELSEARGS (( EW_LPMAPSTATE lpMapState, EW_LPUSHORT lpIndsBest,
  623. EW_LPUSHORT lpMatchValues, EW_LPBYTE lpPanWant,
  624. EW_USHORT unNumInds, EW_LPBYTE lpPanFirst, EW_USHORT unNumAvail,
  625. EW_SHORT nRecSize, EW_BYTE jMapToFamily ));
  626. #endif /* ifndef NOELSEPICKFONTS */
  627. #ifndef NOELSETHRESHOLD
  628. GLOBAL EW_USHORT EW_FAR EW_PASCAL unPANGetMapThreshold
  629. ELSEARGS (( EW_LPMAPSTATE lpMapState ));
  630. GLOBAL EW_BOOL EW_FAR EW_PASCAL bPANSetMapThreshold
  631. ELSEARGS (( EW_LPMAPSTATE lpMapState, EW_USHORT unThreshold ));
  632. GLOBAL EW_BOOL EW_FAR EW_PASCAL bPANIsThresholdRelaxed
  633. ELSEARGS (( EW_LPMAPSTATE lpMapState ));
  634. GLOBAL EW_VOID EW_FAR EW_PASCAL vPANRelaxThreshold
  635. ELSEARGS (( EW_LPMAPSTATE lpMapState ));
  636. GLOBAL EW_BOOL EW_FAR EW_PASCAL bPANRestoreThreshold
  637. ELSEARGS (( EW_LPMAPSTATE lpMapState ));
  638. #endif /* ifndef NOELSETHRESHOLD */
  639. #ifndef NOELSEWEIGHTS
  640. GLOBAL EW_BOOL EW_FAR EW_PASCAL bPANGetMapWeights
  641. ELSEARGS (( EW_LPMAPSTATE lpMapState, EW_BYTE jFamilyA,
  642. EW_BYTE jFamilyB, EW_LPBYTE lpjWts, EW_LPBOOL lpbIsCustom ));
  643. GLOBAL EW_BOOL EW_FAR EW_PASCAL bPANSetMapWeights
  644. ELSEARGS (( EW_LPMAPSTATE lpMapState, EW_BYTE jFamilyA,
  645. EW_BYTE jFamilyB, EW_LPBYTE lpjWts ));
  646. GLOBAL EW_BOOL EW_FAR EW_PASCAL bPANClearMapWeights
  647. ELSEARGS (( EW_LPMAPSTATE lpMapState, EW_BYTE jFamilyA,
  648. EW_BYTE jFamilyB ));
  649. #endif /* ifndef NOELSEWEIGHTS */
  650. #ifdef __cplusplus
  651. }
  652. #endif
  653. #endif /* ifndef __ELSEPAN_H__ */
  654. /***************************************************************************
  655. * Revision log:
  656. ***************************************************************************/
  657. /*
  658. * $lgb$
  659. * 1.0 31-Jan-93 msd PANOSE 1.0 mapper: 10-digit PANOSE.
  660. * 1.1 2-Feb-93 msd Removed huge pointer stuff.
  661. * 1.2 2-Feb-93 msd
  662. * 1.3 3-Feb-93 msd Removed ctrl-Z at EOF.
  663. * 1.4 3-Feb-93 msd Fixed bug caused by vcs check-in.
  664. * 1.5 6-Feb-93 msd Word-aligned C0 penalty header.
  665. * 1.6 15-Feb-93 msd For extra security, bumped the sanity value from word to a long.
  666. * 1.7 18-Feb-93 msd Added support for C++ compilers.
  667. * 1.8 18-Feb-93 msd Added penalty table byte-ordering check, and C4 ptbl compression (new version of ptbl). Use EW_FAR.
  668. * 1.9 27-Apr-93 msd Added MAX_PAN1_DIGIT.
  669. * 1.10 19-Jul-93 msd Added compilation flags to selectively disable mapper routines.
  670. * $lge$
  671. */