gxop1.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* Copyright (C) 1991, 1992, 1998 Aladdin Enterprises. All rights reserved.
  2. This file is part of AFPL Ghostscript.
  3. AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author or
  4. distributor accepts any responsibility for the consequences of using it, or
  5. for whether it serves any particular purpose or works at all, unless he or
  6. she says so in writing. Refer to the Aladdin Free Public License (the
  7. "License") for full details.
  8. Every copy of AFPL Ghostscript must include a copy of the License, normally
  9. in a plain ASCII text file named PUBLIC. The License grants you the right
  10. to copy, modify and redistribute AFPL Ghostscript, but only under certain
  11. conditions described in the License. Among other things, the License
  12. requires that the copyright notice and this notice be preserved on all
  13. copies.
  14. */
  15. /*$Id: gxop1.h,v 1.2 2000/09/19 19:00:39 lpd Exp $ */
  16. /* Type 1 state shared between interpreter and compiled fonts. */
  17. #ifndef gxop1_INCLUDED
  18. # define gxop1_INCLUDED
  19. /*
  20. * The current point (px,py) in the Type 1 interpreter state is not
  21. * necessarily the same as the current position in the path being built up.
  22. * Specifically, (px,py) may not reflect adjustments for hinting,
  23. * whereas the current path position does reflect those adjustments.
  24. */
  25. /* Define the shared Type 1 interpreter state. */
  26. #define max_coeff_bits 11 /* max coefficient in char space */
  27. typedef struct gs_op1_state_s {
  28. struct gx_path_s *ppath;
  29. struct gs_type1_state_s *pcis;
  30. fixed_coeff fc;
  31. gs_fixed_point co; /* character origin (device space) */
  32. gs_fixed_point p; /* current point (device space) */
  33. } gs_op1_state;
  34. typedef gs_op1_state *is_ptr;
  35. /* Define the state used by operator procedures. */
  36. /* These macros refer to a current instance (s) of gs_op1_state. */
  37. #define sppath s.ppath
  38. #define sfc s.fc
  39. #define spt s.p
  40. #define ptx s.p.x
  41. #define pty s.p.y
  42. /* Accumulate relative coordinates */
  43. /****** THESE ARE NOT ACCURATE FOR NON-INTEGER DELTAS. ******/
  44. /* This probably doesn't make any difference in practice. */
  45. #define c_fixed(d, c) m_fixed(d, c, sfc, max_coeff_bits)
  46. #define accum_x(dx)\
  47. BEGIN\
  48. ptx += c_fixed(dx, xx);\
  49. if ( sfc.skewed ) pty += c_fixed(dx, xy);\
  50. END
  51. #define accum_y(dy)\
  52. BEGIN\
  53. pty += c_fixed(dy, yy);\
  54. if ( sfc.skewed ) ptx += c_fixed(dy, yx);\
  55. END
  56. void accum_xy_proc(P3(is_ptr ps, fixed dx, fixed dy));
  57. #define accum_xy(dx,dy)\
  58. accum_xy_proc(&s, dx, dy)
  59. /* Define operator procedures. */
  60. int gs_op1_closepath(P1(is_ptr ps));
  61. int gs_op1_rrcurveto(P7(is_ptr ps, fixed dx1, fixed dy1,
  62. fixed dx2, fixed dy2, fixed dx3, fixed dy3));
  63. #endif /* gxop1_INCLUDED */