cmap.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef MUPDF_PDF_CMAP_H
  2. #define MUPDF_PDF_CMAP_H
  3. /*
  4. * CMap
  5. */
  6. typedef struct pdf_cmap_s pdf_cmap;
  7. typedef struct pdf_range_s pdf_range;
  8. typedef struct pdf_xrange_s pdf_xrange;
  9. typedef struct pdf_mrange_s pdf_mrange;
  10. #define PDF_MRANGE_CAP 8
  11. struct pdf_range_s
  12. {
  13. unsigned short low, high, out;
  14. };
  15. struct pdf_xrange_s
  16. {
  17. unsigned int low, high, out;
  18. };
  19. struct pdf_mrange_s
  20. {
  21. unsigned int low, len, out[PDF_MRANGE_CAP];
  22. };
  23. struct pdf_cmap_s
  24. {
  25. fz_storable storable;
  26. char cmap_name[32];
  27. char usecmap_name[32];
  28. pdf_cmap *usecmap;
  29. int wmode;
  30. int codespace_len;
  31. struct
  32. {
  33. int n;
  34. unsigned int low;
  35. unsigned int high;
  36. } codespace[40];
  37. int rlen, rcap;
  38. pdf_range *ranges;
  39. int xlen, xcap;
  40. pdf_xrange *xranges;
  41. int mlen, mcap;
  42. pdf_mrange *mranges;
  43. };
  44. pdf_cmap *pdf_new_cmap(fz_context *ctx);
  45. pdf_cmap *pdf_keep_cmap(fz_context *ctx, pdf_cmap *cmap);
  46. void pdf_drop_cmap(fz_context *ctx, pdf_cmap *cmap);
  47. void pdf_drop_cmap_imp(fz_context *ctx, fz_storable *cmap);
  48. size_t pdf_cmap_size(fz_context *ctx, pdf_cmap *cmap);
  49. int pdf_cmap_wmode(fz_context *ctx, pdf_cmap *cmap);
  50. void pdf_set_cmap_wmode(fz_context *ctx, pdf_cmap *cmap, int wmode);
  51. void pdf_set_usecmap(fz_context *ctx, pdf_cmap *cmap, pdf_cmap *usecmap);
  52. void pdf_add_codespace(fz_context *ctx, pdf_cmap *cmap, unsigned int low, unsigned int high, int n);
  53. void pdf_map_range_to_range(fz_context *ctx, pdf_cmap *cmap, unsigned int srclo, unsigned int srchi, int dstlo);
  54. void pdf_map_one_to_many(fz_context *ctx, pdf_cmap *cmap, unsigned int one, int *many, int len);
  55. void pdf_sort_cmap(fz_context *ctx, pdf_cmap *cmap);
  56. int pdf_lookup_cmap(pdf_cmap *cmap, unsigned int cpt);
  57. int pdf_lookup_cmap_full(pdf_cmap *cmap, unsigned int cpt, int *out);
  58. int pdf_decode_cmap(pdf_cmap *cmap, unsigned char *s, unsigned char *e, unsigned int *cpt);
  59. pdf_cmap *pdf_new_identity_cmap(fz_context *ctx, int wmode, int bytes);
  60. pdf_cmap *pdf_load_cmap(fz_context *ctx, fz_stream *file);
  61. pdf_cmap *pdf_load_system_cmap(fz_context *ctx, const char *name);
  62. pdf_cmap *pdf_load_builtin_cmap(fz_context *ctx, const char *name);
  63. pdf_cmap *pdf_load_embedded_cmap(fz_context *ctx, pdf_document *doc, pdf_obj *ref);
  64. void pdf_print_cmap(fz_context *ctx, fz_output *out, pdf_cmap *cmap);
  65. #endif