gsfont.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* Copyright (C) 1989, 1993, 1996, 1997 Aladdin Enterprises. All rights reserved.
  2. This software is provided AS-IS with no warranty, either express or
  3. implied.
  4. This software is distributed under license and may not be copied,
  5. modified or distributed except as expressly authorized under the terms
  6. of the license contained in the file LICENSE in this distribution.
  7. For more information about licensing, please refer to
  8. http://www.ghostscript.com/licensing/. For information on
  9. commercial licensing, go to http://www.artifex.com/licensing/ or
  10. contact Artifex Software, Inc., 101 Lucas Valley Road #110,
  11. San Rafael, CA 94903, U.S.A., +1(415)492-9861.
  12. */
  13. /* $Id: gsfont.h,v 1.12 2005/07/27 11:24:38 igor Exp $ */
  14. /* Generic font and font cache interface */
  15. #ifndef gsfont_INCLUDED
  16. # define gsfont_INCLUDED
  17. #ifndef gs_matrix_DEFINED
  18. # define gs_matrix_DEFINED
  19. typedef struct gs_matrix_s gs_matrix;
  20. #endif
  21. /* A 'font directory' object (to avoid making fonts global). */
  22. /* 'directory' is something of a misnomer: this structure */
  23. /* just keeps track of the defined fonts, and the scaled font and */
  24. /* rendered character caches. */
  25. #ifndef gs_font_dir_DEFINED
  26. # define gs_font_dir_DEFINED
  27. typedef struct gs_font_dir_s gs_font_dir;
  28. #endif
  29. /* Font objects */
  30. #ifndef gs_font_DEFINED
  31. # define gs_font_DEFINED
  32. typedef struct gs_font_s gs_font;
  33. #endif
  34. /* Initialization */
  35. /* These procedures return 0 if they fail. */
  36. gs_font_dir *gs_font_dir_alloc2(gs_memory_t * struct_mem,
  37. gs_memory_t * bits_mem);
  38. gs_font_dir *gs_font_dir_alloc2_limits(gs_memory_t * struct_mem,
  39. gs_memory_t * bits_mem,
  40. uint smax, uint bmax, uint mmax,
  41. uint cmax, uint upper);
  42. /* Backward compatibility */
  43. #define gs_font_dir_alloc(mem) gs_font_dir_alloc2(mem, mem)
  44. #define gs_font_dir_alloc_limits(mem, smax, bmax, mmax, cmax, upper)\
  45. gs_font_dir_alloc2_limits(mem, mem, smax, bmax, mmax, cmax, upper)
  46. /* Font manipulations */
  47. /* Use gs_definefont only with original (unscaled) fonts! */
  48. int gs_definefont(gs_font_dir *, gs_font *);
  49. /* Find a sililar registered font of same type. */
  50. int gs_font_find_similar(const gs_font_dir * pdir, const gs_font **ppfont,
  51. int (*similar)(const gs_font *, const gs_font *));
  52. /* gs_scalefont and gs_makefont return 0 if the scaled font */
  53. /* was already in the cache, 1 if a new font was created. */
  54. int gs_scalefont(gs_font_dir *, const gs_font *, floatp, gs_font **);
  55. int gs_makefont(gs_font_dir *, const gs_font *, const gs_matrix *, gs_font **);
  56. int gs_setfont(gs_state *, gs_font *);
  57. gs_font *gs_currentfont(const gs_state *);
  58. gs_font *gs_rootfont(const gs_state *);
  59. void gs_set_currentfont(gs_state *, gs_font *);
  60. void gs_purge_font(gs_font *);
  61. /* Locate a gs_font by gs_id. */
  62. gs_font *gs_find_font_by_id(gs_font_dir *pdir, gs_id id, gs_matrix *FontMatrix);
  63. /* Font cache parameter operations */
  64. void gs_cachestatus(const gs_font_dir *, uint[7]);
  65. #define gs_setcachelimit(pdir,limit) gs_setcacheupper(pdir,limit)
  66. uint gs_currentcachesize(const gs_font_dir *);
  67. int gs_setcachesize(gs_font_dir *, uint);
  68. uint gs_currentcachelower(const gs_font_dir *);
  69. int gs_setcachelower(gs_font_dir *, uint);
  70. uint gs_currentcacheupper(const gs_font_dir *);
  71. int gs_setcacheupper(gs_font_dir *, uint);
  72. uint gs_currentaligntopixels(const gs_font_dir *);
  73. int gs_setaligntopixels(gs_font_dir *, uint);
  74. uint gs_currentgridfittt(const gs_font_dir *);
  75. int gs_setgridfittt(gs_font_dir *, uint);
  76. #endif /* gsfont_INCLUDED */