vrshoot

annotate libs/ft2static/freetype/internal/pshints.h @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
rev   line source
nuclear@0 1 /***************************************************************************/
nuclear@0 2 /* */
nuclear@0 3 /* pshints.h */
nuclear@0 4 /* */
nuclear@0 5 /* Interface to Postscript-specific (Type 1 and Type 2) hints */
nuclear@0 6 /* recorders (specification only). These are used to support native */
nuclear@0 7 /* T1/T2 hints in the `type1', `cid', and `cff' font drivers. */
nuclear@0 8 /* */
nuclear@0 9 /* Copyright 2001, 2002, 2003, 2005, 2006, 2007, 2009 by */
nuclear@0 10 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
nuclear@0 11 /* */
nuclear@0 12 /* This file is part of the FreeType project, and may only be used, */
nuclear@0 13 /* modified, and distributed under the terms of the FreeType project */
nuclear@0 14 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
nuclear@0 15 /* this file you indicate that you have read the license and */
nuclear@0 16 /* understand and accept it fully. */
nuclear@0 17 /* */
nuclear@0 18 /***************************************************************************/
nuclear@0 19
nuclear@0 20
nuclear@0 21 #ifndef __PSHINTS_H__
nuclear@0 22 #define __PSHINTS_H__
nuclear@0 23
nuclear@0 24
nuclear@0 25 #include <ft2build.h>
nuclear@0 26 #include FT_FREETYPE_H
nuclear@0 27 #include FT_TYPE1_TABLES_H
nuclear@0 28
nuclear@0 29
nuclear@0 30 FT_BEGIN_HEADER
nuclear@0 31
nuclear@0 32
nuclear@0 33 /*************************************************************************/
nuclear@0 34 /*************************************************************************/
nuclear@0 35 /***** *****/
nuclear@0 36 /***** INTERNAL REPRESENTATION OF GLOBALS *****/
nuclear@0 37 /***** *****/
nuclear@0 38 /*************************************************************************/
nuclear@0 39 /*************************************************************************/
nuclear@0 40
nuclear@0 41 typedef struct PSH_GlobalsRec_* PSH_Globals;
nuclear@0 42
nuclear@0 43 typedef FT_Error
nuclear@0 44 (*PSH_Globals_NewFunc)( FT_Memory memory,
nuclear@0 45 T1_Private* private_dict,
nuclear@0 46 PSH_Globals* aglobals );
nuclear@0 47
nuclear@0 48 typedef FT_Error
nuclear@0 49 (*PSH_Globals_SetScaleFunc)( PSH_Globals globals,
nuclear@0 50 FT_Fixed x_scale,
nuclear@0 51 FT_Fixed y_scale,
nuclear@0 52 FT_Fixed x_delta,
nuclear@0 53 FT_Fixed y_delta );
nuclear@0 54
nuclear@0 55 typedef void
nuclear@0 56 (*PSH_Globals_DestroyFunc)( PSH_Globals globals );
nuclear@0 57
nuclear@0 58
nuclear@0 59 typedef struct PSH_Globals_FuncsRec_
nuclear@0 60 {
nuclear@0 61 PSH_Globals_NewFunc create;
nuclear@0 62 PSH_Globals_SetScaleFunc set_scale;
nuclear@0 63 PSH_Globals_DestroyFunc destroy;
nuclear@0 64
nuclear@0 65 } PSH_Globals_FuncsRec, *PSH_Globals_Funcs;
nuclear@0 66
nuclear@0 67
nuclear@0 68 /*************************************************************************/
nuclear@0 69 /*************************************************************************/
nuclear@0 70 /***** *****/
nuclear@0 71 /***** PUBLIC TYPE 1 HINTS RECORDER *****/
nuclear@0 72 /***** *****/
nuclear@0 73 /*************************************************************************/
nuclear@0 74 /*************************************************************************/
nuclear@0 75
nuclear@0 76 /*************************************************************************
nuclear@0 77 *
nuclear@0 78 * @type:
nuclear@0 79 * T1_Hints
nuclear@0 80 *
nuclear@0 81 * @description:
nuclear@0 82 * This is a handle to an opaque structure used to record glyph hints
nuclear@0 83 * from a Type 1 character glyph character string.
nuclear@0 84 *
nuclear@0 85 * The methods used to operate on this object are defined by the
nuclear@0 86 * @T1_Hints_FuncsRec structure. Recording glyph hints is normally
nuclear@0 87 * achieved through the following scheme:
nuclear@0 88 *
nuclear@0 89 * - Open a new hint recording session by calling the `open' method.
nuclear@0 90 * This rewinds the recorder and prepare it for new input.
nuclear@0 91 *
nuclear@0 92 * - For each hint found in the glyph charstring, call the corresponding
nuclear@0 93 * method (`stem', `stem3', or `reset'). Note that these functions do
nuclear@0 94 * not return an error code.
nuclear@0 95 *
nuclear@0 96 * - Close the recording session by calling the `close' method. It
nuclear@0 97 * returns an error code if the hints were invalid or something
nuclear@0 98 * strange happened (e.g., memory shortage).
nuclear@0 99 *
nuclear@0 100 * The hints accumulated in the object can later be used by the
nuclear@0 101 * PostScript hinter.
nuclear@0 102 *
nuclear@0 103 */
nuclear@0 104 typedef struct T1_HintsRec_* T1_Hints;
nuclear@0 105
nuclear@0 106
nuclear@0 107 /*************************************************************************
nuclear@0 108 *
nuclear@0 109 * @type:
nuclear@0 110 * T1_Hints_Funcs
nuclear@0 111 *
nuclear@0 112 * @description:
nuclear@0 113 * A pointer to the @T1_Hints_FuncsRec structure that defines the API of
nuclear@0 114 * a given @T1_Hints object.
nuclear@0 115 *
nuclear@0 116 */
nuclear@0 117 typedef const struct T1_Hints_FuncsRec_* T1_Hints_Funcs;
nuclear@0 118
nuclear@0 119
nuclear@0 120 /*************************************************************************
nuclear@0 121 *
nuclear@0 122 * @functype:
nuclear@0 123 * T1_Hints_OpenFunc
nuclear@0 124 *
nuclear@0 125 * @description:
nuclear@0 126 * A method of the @T1_Hints class used to prepare it for a new Type 1
nuclear@0 127 * hints recording session.
nuclear@0 128 *
nuclear@0 129 * @input:
nuclear@0 130 * hints ::
nuclear@0 131 * A handle to the Type 1 hints recorder.
nuclear@0 132 *
nuclear@0 133 * @note:
nuclear@0 134 * You should always call the @T1_Hints_CloseFunc method in order to
nuclear@0 135 * close an opened recording session.
nuclear@0 136 *
nuclear@0 137 */
nuclear@0 138 typedef void
nuclear@0 139 (*T1_Hints_OpenFunc)( T1_Hints hints );
nuclear@0 140
nuclear@0 141
nuclear@0 142 /*************************************************************************
nuclear@0 143 *
nuclear@0 144 * @functype:
nuclear@0 145 * T1_Hints_SetStemFunc
nuclear@0 146 *
nuclear@0 147 * @description:
nuclear@0 148 * A method of the @T1_Hints class used to record a new horizontal or
nuclear@0 149 * vertical stem. This corresponds to the Type 1 `hstem' and `vstem'
nuclear@0 150 * operators.
nuclear@0 151 *
nuclear@0 152 * @input:
nuclear@0 153 * hints ::
nuclear@0 154 * A handle to the Type 1 hints recorder.
nuclear@0 155 *
nuclear@0 156 * dimension ::
nuclear@0 157 * 0 for horizontal stems (hstem), 1 for vertical ones (vstem).
nuclear@0 158 *
nuclear@0 159 * coords ::
nuclear@0 160 * Array of 2 coordinates in 16.16 format, used as (position,length)
nuclear@0 161 * stem descriptor.
nuclear@0 162 *
nuclear@0 163 * @note:
nuclear@0 164 * Use vertical coordinates (y) for horizontal stems (dim=0). Use
nuclear@0 165 * horizontal coordinates (x) for vertical stems (dim=1).
nuclear@0 166 *
nuclear@0 167 * `coords[0]' is the absolute stem position (lowest coordinate);
nuclear@0 168 * `coords[1]' is the length.
nuclear@0 169 *
nuclear@0 170 * The length can be negative, in which case it must be either -20 or
nuclear@0 171 * -21. It is interpreted as a `ghost' stem, according to the Type 1
nuclear@0 172 * specification.
nuclear@0 173 *
nuclear@0 174 * If the length is -21 (corresponding to a bottom ghost stem), then
nuclear@0 175 * the real stem position is `coords[0]+coords[1]'.
nuclear@0 176 *
nuclear@0 177 */
nuclear@0 178 typedef void
nuclear@0 179 (*T1_Hints_SetStemFunc)( T1_Hints hints,
nuclear@0 180 FT_UInt dimension,
nuclear@0 181 FT_Fixed* coords );
nuclear@0 182
nuclear@0 183
nuclear@0 184 /*************************************************************************
nuclear@0 185 *
nuclear@0 186 * @functype:
nuclear@0 187 * T1_Hints_SetStem3Func
nuclear@0 188 *
nuclear@0 189 * @description:
nuclear@0 190 * A method of the @T1_Hints class used to record three
nuclear@0 191 * counter-controlled horizontal or vertical stems at once.
nuclear@0 192 *
nuclear@0 193 * @input:
nuclear@0 194 * hints ::
nuclear@0 195 * A handle to the Type 1 hints recorder.
nuclear@0 196 *
nuclear@0 197 * dimension ::
nuclear@0 198 * 0 for horizontal stems, 1 for vertical ones.
nuclear@0 199 *
nuclear@0 200 * coords ::
nuclear@0 201 * An array of 6 values in 16.16 format, holding 3 (position,length)
nuclear@0 202 * pairs for the counter-controlled stems.
nuclear@0 203 *
nuclear@0 204 * @note:
nuclear@0 205 * Use vertical coordinates (y) for horizontal stems (dim=0). Use
nuclear@0 206 * horizontal coordinates (x) for vertical stems (dim=1).
nuclear@0 207 *
nuclear@0 208 * The lengths cannot be negative (ghost stems are never
nuclear@0 209 * counter-controlled).
nuclear@0 210 *
nuclear@0 211 */
nuclear@0 212 typedef void
nuclear@0 213 (*T1_Hints_SetStem3Func)( T1_Hints hints,
nuclear@0 214 FT_UInt dimension,
nuclear@0 215 FT_Fixed* coords );
nuclear@0 216
nuclear@0 217
nuclear@0 218 /*************************************************************************
nuclear@0 219 *
nuclear@0 220 * @functype:
nuclear@0 221 * T1_Hints_ResetFunc
nuclear@0 222 *
nuclear@0 223 * @description:
nuclear@0 224 * A method of the @T1_Hints class used to reset the stems hints in a
nuclear@0 225 * recording session.
nuclear@0 226 *
nuclear@0 227 * @input:
nuclear@0 228 * hints ::
nuclear@0 229 * A handle to the Type 1 hints recorder.
nuclear@0 230 *
nuclear@0 231 * end_point ::
nuclear@0 232 * The index of the last point in the input glyph in which the
nuclear@0 233 * previously defined hints apply.
nuclear@0 234 *
nuclear@0 235 */
nuclear@0 236 typedef void
nuclear@0 237 (*T1_Hints_ResetFunc)( T1_Hints hints,
nuclear@0 238 FT_UInt end_point );
nuclear@0 239
nuclear@0 240
nuclear@0 241 /*************************************************************************
nuclear@0 242 *
nuclear@0 243 * @functype:
nuclear@0 244 * T1_Hints_CloseFunc
nuclear@0 245 *
nuclear@0 246 * @description:
nuclear@0 247 * A method of the @T1_Hints class used to close a hint recording
nuclear@0 248 * session.
nuclear@0 249 *
nuclear@0 250 * @input:
nuclear@0 251 * hints ::
nuclear@0 252 * A handle to the Type 1 hints recorder.
nuclear@0 253 *
nuclear@0 254 * end_point ::
nuclear@0 255 * The index of the last point in the input glyph.
nuclear@0 256 *
nuclear@0 257 * @return:
nuclear@0 258 * FreeType error code. 0 means success.
nuclear@0 259 *
nuclear@0 260 * @note:
nuclear@0 261 * The error code is set to indicate that an error occurred during the
nuclear@0 262 * recording session.
nuclear@0 263 *
nuclear@0 264 */
nuclear@0 265 typedef FT_Error
nuclear@0 266 (*T1_Hints_CloseFunc)( T1_Hints hints,
nuclear@0 267 FT_UInt end_point );
nuclear@0 268
nuclear@0 269
nuclear@0 270 /*************************************************************************
nuclear@0 271 *
nuclear@0 272 * @functype:
nuclear@0 273 * T1_Hints_ApplyFunc
nuclear@0 274 *
nuclear@0 275 * @description:
nuclear@0 276 * A method of the @T1_Hints class used to apply hints to the
nuclear@0 277 * corresponding glyph outline. Must be called once all hints have been
nuclear@0 278 * recorded.
nuclear@0 279 *
nuclear@0 280 * @input:
nuclear@0 281 * hints ::
nuclear@0 282 * A handle to the Type 1 hints recorder.
nuclear@0 283 *
nuclear@0 284 * outline ::
nuclear@0 285 * A pointer to the target outline descriptor.
nuclear@0 286 *
nuclear@0 287 * globals ::
nuclear@0 288 * The hinter globals for this font.
nuclear@0 289 *
nuclear@0 290 * hint_mode ::
nuclear@0 291 * Hinting information.
nuclear@0 292 *
nuclear@0 293 * @return:
nuclear@0 294 * FreeType error code. 0 means success.
nuclear@0 295 *
nuclear@0 296 * @note:
nuclear@0 297 * On input, all points within the outline are in font coordinates. On
nuclear@0 298 * output, they are in 1/64th of pixels.
nuclear@0 299 *
nuclear@0 300 * The scaling transformation is taken from the `globals' object which
nuclear@0 301 * must correspond to the same font as the glyph.
nuclear@0 302 *
nuclear@0 303 */
nuclear@0 304 typedef FT_Error
nuclear@0 305 (*T1_Hints_ApplyFunc)( T1_Hints hints,
nuclear@0 306 FT_Outline* outline,
nuclear@0 307 PSH_Globals globals,
nuclear@0 308 FT_Render_Mode hint_mode );
nuclear@0 309
nuclear@0 310
nuclear@0 311 /*************************************************************************
nuclear@0 312 *
nuclear@0 313 * @struct:
nuclear@0 314 * T1_Hints_FuncsRec
nuclear@0 315 *
nuclear@0 316 * @description:
nuclear@0 317 * The structure used to provide the API to @T1_Hints objects.
nuclear@0 318 *
nuclear@0 319 * @fields:
nuclear@0 320 * hints ::
nuclear@0 321 * A handle to the T1 Hints recorder.
nuclear@0 322 *
nuclear@0 323 * open ::
nuclear@0 324 * The function to open a recording session.
nuclear@0 325 *
nuclear@0 326 * close ::
nuclear@0 327 * The function to close a recording session.
nuclear@0 328 *
nuclear@0 329 * stem ::
nuclear@0 330 * The function to set a simple stem.
nuclear@0 331 *
nuclear@0 332 * stem3 ::
nuclear@0 333 * The function to set counter-controlled stems.
nuclear@0 334 *
nuclear@0 335 * reset ::
nuclear@0 336 * The function to reset stem hints.
nuclear@0 337 *
nuclear@0 338 * apply ::
nuclear@0 339 * The function to apply the hints to the corresponding glyph outline.
nuclear@0 340 *
nuclear@0 341 */
nuclear@0 342 typedef struct T1_Hints_FuncsRec_
nuclear@0 343 {
nuclear@0 344 T1_Hints hints;
nuclear@0 345 T1_Hints_OpenFunc open;
nuclear@0 346 T1_Hints_CloseFunc close;
nuclear@0 347 T1_Hints_SetStemFunc stem;
nuclear@0 348 T1_Hints_SetStem3Func stem3;
nuclear@0 349 T1_Hints_ResetFunc reset;
nuclear@0 350 T1_Hints_ApplyFunc apply;
nuclear@0 351
nuclear@0 352 } T1_Hints_FuncsRec;
nuclear@0 353
nuclear@0 354
nuclear@0 355 /*************************************************************************/
nuclear@0 356 /*************************************************************************/
nuclear@0 357 /***** *****/
nuclear@0 358 /***** PUBLIC TYPE 2 HINTS RECORDER *****/
nuclear@0 359 /***** *****/
nuclear@0 360 /*************************************************************************/
nuclear@0 361 /*************************************************************************/
nuclear@0 362
nuclear@0 363 /*************************************************************************
nuclear@0 364 *
nuclear@0 365 * @type:
nuclear@0 366 * T2_Hints
nuclear@0 367 *
nuclear@0 368 * @description:
nuclear@0 369 * This is a handle to an opaque structure used to record glyph hints
nuclear@0 370 * from a Type 2 character glyph character string.
nuclear@0 371 *
nuclear@0 372 * The methods used to operate on this object are defined by the
nuclear@0 373 * @T2_Hints_FuncsRec structure. Recording glyph hints is normally
nuclear@0 374 * achieved through the following scheme:
nuclear@0 375 *
nuclear@0 376 * - Open a new hint recording session by calling the `open' method.
nuclear@0 377 * This rewinds the recorder and prepare it for new input.
nuclear@0 378 *
nuclear@0 379 * - For each hint found in the glyph charstring, call the corresponding
nuclear@0 380 * method (`stems', `hintmask', `counters'). Note that these
nuclear@0 381 * functions do not return an error code.
nuclear@0 382 *
nuclear@0 383 * - Close the recording session by calling the `close' method. It
nuclear@0 384 * returns an error code if the hints were invalid or something
nuclear@0 385 * strange happened (e.g., memory shortage).
nuclear@0 386 *
nuclear@0 387 * The hints accumulated in the object can later be used by the
nuclear@0 388 * Postscript hinter.
nuclear@0 389 *
nuclear@0 390 */
nuclear@0 391 typedef struct T2_HintsRec_* T2_Hints;
nuclear@0 392
nuclear@0 393
nuclear@0 394 /*************************************************************************
nuclear@0 395 *
nuclear@0 396 * @type:
nuclear@0 397 * T2_Hints_Funcs
nuclear@0 398 *
nuclear@0 399 * @description:
nuclear@0 400 * A pointer to the @T2_Hints_FuncsRec structure that defines the API of
nuclear@0 401 * a given @T2_Hints object.
nuclear@0 402 *
nuclear@0 403 */
nuclear@0 404 typedef const struct T2_Hints_FuncsRec_* T2_Hints_Funcs;
nuclear@0 405
nuclear@0 406
nuclear@0 407 /*************************************************************************
nuclear@0 408 *
nuclear@0 409 * @functype:
nuclear@0 410 * T2_Hints_OpenFunc
nuclear@0 411 *
nuclear@0 412 * @description:
nuclear@0 413 * A method of the @T2_Hints class used to prepare it for a new Type 2
nuclear@0 414 * hints recording session.
nuclear@0 415 *
nuclear@0 416 * @input:
nuclear@0 417 * hints ::
nuclear@0 418 * A handle to the Type 2 hints recorder.
nuclear@0 419 *
nuclear@0 420 * @note:
nuclear@0 421 * You should always call the @T2_Hints_CloseFunc method in order to
nuclear@0 422 * close an opened recording session.
nuclear@0 423 *
nuclear@0 424 */
nuclear@0 425 typedef void
nuclear@0 426 (*T2_Hints_OpenFunc)( T2_Hints hints );
nuclear@0 427
nuclear@0 428
nuclear@0 429 /*************************************************************************
nuclear@0 430 *
nuclear@0 431 * @functype:
nuclear@0 432 * T2_Hints_StemsFunc
nuclear@0 433 *
nuclear@0 434 * @description:
nuclear@0 435 * A method of the @T2_Hints class used to set the table of stems in
nuclear@0 436 * either the vertical or horizontal dimension. Equivalent to the
nuclear@0 437 * `hstem', `vstem', `hstemhm', and `vstemhm' Type 2 operators.
nuclear@0 438 *
nuclear@0 439 * @input:
nuclear@0 440 * hints ::
nuclear@0 441 * A handle to the Type 2 hints recorder.
nuclear@0 442 *
nuclear@0 443 * dimension ::
nuclear@0 444 * 0 for horizontal stems (hstem), 1 for vertical ones (vstem).
nuclear@0 445 *
nuclear@0 446 * count ::
nuclear@0 447 * The number of stems.
nuclear@0 448 *
nuclear@0 449 * coords ::
nuclear@0 450 * An array of `count' (position,length) pairs in 16.16 format.
nuclear@0 451 *
nuclear@0 452 * @note:
nuclear@0 453 * Use vertical coordinates (y) for horizontal stems (dim=0). Use
nuclear@0 454 * horizontal coordinates (x) for vertical stems (dim=1).
nuclear@0 455 *
nuclear@0 456 * There are `2*count' elements in the `coords' array. Each even
nuclear@0 457 * element is an absolute position in font units, each odd element is a
nuclear@0 458 * length in font units.
nuclear@0 459 *
nuclear@0 460 * A length can be negative, in which case it must be either -20 or
nuclear@0 461 * -21. It is interpreted as a `ghost' stem, according to the Type 1
nuclear@0 462 * specification.
nuclear@0 463 *
nuclear@0 464 */
nuclear@0 465 typedef void
nuclear@0 466 (*T2_Hints_StemsFunc)( T2_Hints hints,
nuclear@0 467 FT_UInt dimension,
nuclear@0 468 FT_UInt count,
nuclear@0 469 FT_Fixed* coordinates );
nuclear@0 470
nuclear@0 471
nuclear@0 472 /*************************************************************************
nuclear@0 473 *
nuclear@0 474 * @functype:
nuclear@0 475 * T2_Hints_MaskFunc
nuclear@0 476 *
nuclear@0 477 * @description:
nuclear@0 478 * A method of the @T2_Hints class used to set a given hintmask (this
nuclear@0 479 * corresponds to the `hintmask' Type 2 operator).
nuclear@0 480 *
nuclear@0 481 * @input:
nuclear@0 482 * hints ::
nuclear@0 483 * A handle to the Type 2 hints recorder.
nuclear@0 484 *
nuclear@0 485 * end_point ::
nuclear@0 486 * The glyph index of the last point to which the previously defined
nuclear@0 487 * or activated hints apply.
nuclear@0 488 *
nuclear@0 489 * bit_count ::
nuclear@0 490 * The number of bits in the hint mask.
nuclear@0 491 *
nuclear@0 492 * bytes ::
nuclear@0 493 * An array of bytes modelling the hint mask.
nuclear@0 494 *
nuclear@0 495 * @note:
nuclear@0 496 * If the hintmask starts the charstring (before any glyph point
nuclear@0 497 * definition), the value of `end_point' should be 0.
nuclear@0 498 *
nuclear@0 499 * `bit_count' is the number of meaningful bits in the `bytes' array; it
nuclear@0 500 * must be equal to the total number of hints defined so far (i.e.,
nuclear@0 501 * horizontal+verticals).
nuclear@0 502 *
nuclear@0 503 * The `bytes' array can come directly from the Type 2 charstring and
nuclear@0 504 * respects the same format.
nuclear@0 505 *
nuclear@0 506 */
nuclear@0 507 typedef void
nuclear@0 508 (*T2_Hints_MaskFunc)( T2_Hints hints,
nuclear@0 509 FT_UInt end_point,
nuclear@0 510 FT_UInt bit_count,
nuclear@0 511 const FT_Byte* bytes );
nuclear@0 512
nuclear@0 513
nuclear@0 514 /*************************************************************************
nuclear@0 515 *
nuclear@0 516 * @functype:
nuclear@0 517 * T2_Hints_CounterFunc
nuclear@0 518 *
nuclear@0 519 * @description:
nuclear@0 520 * A method of the @T2_Hints class used to set a given counter mask
nuclear@0 521 * (this corresponds to the `hintmask' Type 2 operator).
nuclear@0 522 *
nuclear@0 523 * @input:
nuclear@0 524 * hints ::
nuclear@0 525 * A handle to the Type 2 hints recorder.
nuclear@0 526 *
nuclear@0 527 * end_point ::
nuclear@0 528 * A glyph index of the last point to which the previously defined or
nuclear@0 529 * active hints apply.
nuclear@0 530 *
nuclear@0 531 * bit_count ::
nuclear@0 532 * The number of bits in the hint mask.
nuclear@0 533 *
nuclear@0 534 * bytes ::
nuclear@0 535 * An array of bytes modelling the hint mask.
nuclear@0 536 *
nuclear@0 537 * @note:
nuclear@0 538 * If the hintmask starts the charstring (before any glyph point
nuclear@0 539 * definition), the value of `end_point' should be 0.
nuclear@0 540 *
nuclear@0 541 * `bit_count' is the number of meaningful bits in the `bytes' array; it
nuclear@0 542 * must be equal to the total number of hints defined so far (i.e.,
nuclear@0 543 * horizontal+verticals).
nuclear@0 544 *
nuclear@0 545 * The `bytes' array can come directly from the Type 2 charstring and
nuclear@0 546 * respects the same format.
nuclear@0 547 *
nuclear@0 548 */
nuclear@0 549 typedef void
nuclear@0 550 (*T2_Hints_CounterFunc)( T2_Hints hints,
nuclear@0 551 FT_UInt bit_count,
nuclear@0 552 const FT_Byte* bytes );
nuclear@0 553
nuclear@0 554
nuclear@0 555 /*************************************************************************
nuclear@0 556 *
nuclear@0 557 * @functype:
nuclear@0 558 * T2_Hints_CloseFunc
nuclear@0 559 *
nuclear@0 560 * @description:
nuclear@0 561 * A method of the @T2_Hints class used to close a hint recording
nuclear@0 562 * session.
nuclear@0 563 *
nuclear@0 564 * @input:
nuclear@0 565 * hints ::
nuclear@0 566 * A handle to the Type 2 hints recorder.
nuclear@0 567 *
nuclear@0 568 * end_point ::
nuclear@0 569 * The index of the last point in the input glyph.
nuclear@0 570 *
nuclear@0 571 * @return:
nuclear@0 572 * FreeType error code. 0 means success.
nuclear@0 573 *
nuclear@0 574 * @note:
nuclear@0 575 * The error code is set to indicate that an error occurred during the
nuclear@0 576 * recording session.
nuclear@0 577 *
nuclear@0 578 */
nuclear@0 579 typedef FT_Error
nuclear@0 580 (*T2_Hints_CloseFunc)( T2_Hints hints,
nuclear@0 581 FT_UInt end_point );
nuclear@0 582
nuclear@0 583
nuclear@0 584 /*************************************************************************
nuclear@0 585 *
nuclear@0 586 * @functype:
nuclear@0 587 * T2_Hints_ApplyFunc
nuclear@0 588 *
nuclear@0 589 * @description:
nuclear@0 590 * A method of the @T2_Hints class used to apply hints to the
nuclear@0 591 * corresponding glyph outline. Must be called after the `close'
nuclear@0 592 * method.
nuclear@0 593 *
nuclear@0 594 * @input:
nuclear@0 595 * hints ::
nuclear@0 596 * A handle to the Type 2 hints recorder.
nuclear@0 597 *
nuclear@0 598 * outline ::
nuclear@0 599 * A pointer to the target outline descriptor.
nuclear@0 600 *
nuclear@0 601 * globals ::
nuclear@0 602 * The hinter globals for this font.
nuclear@0 603 *
nuclear@0 604 * hint_mode ::
nuclear@0 605 * Hinting information.
nuclear@0 606 *
nuclear@0 607 * @return:
nuclear@0 608 * FreeType error code. 0 means success.
nuclear@0 609 *
nuclear@0 610 * @note:
nuclear@0 611 * On input, all points within the outline are in font coordinates. On
nuclear@0 612 * output, they are in 1/64th of pixels.
nuclear@0 613 *
nuclear@0 614 * The scaling transformation is taken from the `globals' object which
nuclear@0 615 * must correspond to the same font than the glyph.
nuclear@0 616 *
nuclear@0 617 */
nuclear@0 618 typedef FT_Error
nuclear@0 619 (*T2_Hints_ApplyFunc)( T2_Hints hints,
nuclear@0 620 FT_Outline* outline,
nuclear@0 621 PSH_Globals globals,
nuclear@0 622 FT_Render_Mode hint_mode );
nuclear@0 623
nuclear@0 624
nuclear@0 625 /*************************************************************************
nuclear@0 626 *
nuclear@0 627 * @struct:
nuclear@0 628 * T2_Hints_FuncsRec
nuclear@0 629 *
nuclear@0 630 * @description:
nuclear@0 631 * The structure used to provide the API to @T2_Hints objects.
nuclear@0 632 *
nuclear@0 633 * @fields:
nuclear@0 634 * hints ::
nuclear@0 635 * A handle to the T2 hints recorder object.
nuclear@0 636 *
nuclear@0 637 * open ::
nuclear@0 638 * The function to open a recording session.
nuclear@0 639 *
nuclear@0 640 * close ::
nuclear@0 641 * The function to close a recording session.
nuclear@0 642 *
nuclear@0 643 * stems ::
nuclear@0 644 * The function to set the dimension's stems table.
nuclear@0 645 *
nuclear@0 646 * hintmask ::
nuclear@0 647 * The function to set hint masks.
nuclear@0 648 *
nuclear@0 649 * counter ::
nuclear@0 650 * The function to set counter masks.
nuclear@0 651 *
nuclear@0 652 * apply ::
nuclear@0 653 * The function to apply the hints on the corresponding glyph outline.
nuclear@0 654 *
nuclear@0 655 */
nuclear@0 656 typedef struct T2_Hints_FuncsRec_
nuclear@0 657 {
nuclear@0 658 T2_Hints hints;
nuclear@0 659 T2_Hints_OpenFunc open;
nuclear@0 660 T2_Hints_CloseFunc close;
nuclear@0 661 T2_Hints_StemsFunc stems;
nuclear@0 662 T2_Hints_MaskFunc hintmask;
nuclear@0 663 T2_Hints_CounterFunc counter;
nuclear@0 664 T2_Hints_ApplyFunc apply;
nuclear@0 665
nuclear@0 666 } T2_Hints_FuncsRec;
nuclear@0 667
nuclear@0 668
nuclear@0 669 /* */
nuclear@0 670
nuclear@0 671
nuclear@0 672 typedef struct PSHinter_Interface_
nuclear@0 673 {
nuclear@0 674 PSH_Globals_Funcs (*get_globals_funcs)( FT_Module module );
nuclear@0 675 T1_Hints_Funcs (*get_t1_funcs) ( FT_Module module );
nuclear@0 676 T2_Hints_Funcs (*get_t2_funcs) ( FT_Module module );
nuclear@0 677
nuclear@0 678 } PSHinter_Interface;
nuclear@0 679
nuclear@0 680 typedef PSHinter_Interface* PSHinter_Service;
nuclear@0 681
nuclear@0 682 #ifndef FT_CONFIG_OPTION_PIC
nuclear@0 683
nuclear@0 684 #define FT_DEFINE_PSHINTER_INTERFACE(class_, get_globals_funcs_, \
nuclear@0 685 get_t1_funcs_, get_t2_funcs_) \
nuclear@0 686 static const PSHinter_Interface class_ = \
nuclear@0 687 { \
nuclear@0 688 get_globals_funcs_, get_t1_funcs_, get_t2_funcs_ \
nuclear@0 689 };
nuclear@0 690
nuclear@0 691 #else /* FT_CONFIG_OPTION_PIC */
nuclear@0 692
nuclear@0 693 #define FT_DEFINE_PSHINTER_INTERFACE(class_, get_globals_funcs_, \
nuclear@0 694 get_t1_funcs_, get_t2_funcs_) \
nuclear@0 695 void \
nuclear@0 696 FT_Init_Class_##class_( FT_Library library, \
nuclear@0 697 PSHinter_Interface* clazz) \
nuclear@0 698 { \
nuclear@0 699 FT_UNUSED(library); \
nuclear@0 700 clazz->get_globals_funcs = get_globals_funcs_; \
nuclear@0 701 clazz->get_t1_funcs = get_t1_funcs_; \
nuclear@0 702 clazz->get_t2_funcs = get_t2_funcs_; \
nuclear@0 703 }
nuclear@0 704
nuclear@0 705 #endif /* FT_CONFIG_OPTION_PIC */
nuclear@0 706
nuclear@0 707 FT_END_HEADER
nuclear@0 708
nuclear@0 709 #endif /* __PSHINTS_H__ */
nuclear@0 710
nuclear@0 711
nuclear@0 712 /* END */