pyropdf 0.2.2__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. {pyropdf-0.2.2 → pyropdf-0.3.0}/Cargo.lock +4 -4
  2. {pyropdf-0.2.2 → pyropdf-0.3.0}/Cargo.toml +1 -1
  3. {pyropdf-0.2.2 → pyropdf-0.3.0}/PKG-INFO +6 -6
  4. {pyropdf-0.2.2 → pyropdf-0.3.0}/README.md +5 -5
  5. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/annotations/icons.rs +12 -0
  6. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/annotations/missing.rs +20 -2
  7. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/annotations/mod.rs +23 -4
  8. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/annotations/text.rs +4 -0
  9. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/bridge/mod.rs +4 -0
  10. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/content/shading.rs +194 -18
  11. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/extract/images.rs +6 -2
  12. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/extract/model.rs +312 -32
  13. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/extract/reads.rs +4 -0
  14. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/extract/text/tables.rs +134 -3
  15. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/extract/text.rs +94 -0
  16. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/cff.rs +144 -28
  17. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/colr.rs +41 -10
  18. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/compact/tests.rs +74 -12
  19. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/compact.rs +107 -31
  20. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/embed.rs +20 -0
  21. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/instance.rs +69 -3
  22. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/mod.rs +7 -1
  23. pyropdf-0.3.0/crates/pyropdf-engine/src/fonts/settle/tests.rs +114 -0
  24. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/settle.rs +86 -7
  25. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/sfnt.rs +124 -3
  26. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/shape.rs +4 -0
  27. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/tests.rs +116 -0
  28. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/type3.rs +184 -13
  29. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/forms/defaults.rs +77 -10
  30. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/forms/flatten.rs +117 -44
  31. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/forms/mod.rs +63 -7
  32. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/forms/tests.rs +60 -0
  33. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/forms/text.rs +4 -0
  34. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/lib.rs +9 -0
  35. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/ocr/layer.rs +8 -0
  36. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/ocr/mod.rs +55 -7
  37. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/pages/copy.rs +131 -5
  38. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/pages/import/graft.rs +70 -19
  39. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/pages/import.rs +8 -0
  40. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/render/batch.rs +27 -2
  41. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/render/mod.rs +23 -9
  42. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/render/tests.rs +104 -49
  43. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/sign/key.rs +4 -0
  44. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/sign/mod.rs +8 -0
  45. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/sign/pkcs12.rs +47 -1
  46. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/sign/verify.rs +30 -1
  47. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/standard/layout.rs +12 -0
  48. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/standard/scan.rs +16 -2
  49. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/annotations/links.rs +180 -122
  50. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/annotations.rs +838 -453
  51. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/buffers.rs +255 -134
  52. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/cancel.rs +17 -13
  53. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/changes.rs +72 -20
  54. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/check.rs +38 -29
  55. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/codecs.rs +96 -39
  56. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/content.rs +43 -23
  57. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/document.rs +241 -194
  58. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/errors.rs +37 -1
  59. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/fax.rs +27 -13
  60. pyropdf-0.3.0/crates/pyropdf-python/src/fonts.rs +1356 -0
  61. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/forms.rs +969 -576
  62. pyropdf-0.3.0/crates/pyropdf-python/src/history/testing.rs +112 -0
  63. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/history.rs +263 -177
  64. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/images.rs +164 -137
  65. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/items.rs +51 -37
  66. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/lib.rs +12 -2
  67. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/objects.rs +258 -172
  68. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/ocr.rs +139 -112
  69. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/outline.rs +295 -173
  70. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/pages.rs +786 -648
  71. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/pixel_ops.rs +98 -4
  72. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/pixmap.rs +749 -576
  73. pyropdf-0.3.0/crates/pyropdf-python/src/render.rs +51 -0
  74. pyropdf-0.3.0/crates/pyropdf-python/src/schema.rs +61 -0
  75. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/security.rs +33 -29
  76. pyropdf-0.3.0/crates/pyropdf-python/src/shadings.rs +176 -0
  77. pyropdf-0.3.0/crates/pyropdf-python/src/sign.rs +389 -0
  78. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/text.rs +160 -145
  79. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/unrotate.rs +230 -155
  80. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/windows_permissions.rs +8 -2
  81. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-schema/src/check/expr.rs +20 -0
  82. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-schema/src/check/mod.rs +96 -7
  83. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-schema/src/lib.rs +7 -0
  84. {pyropdf-0.2.2 → pyropdf-0.3.0}/pyproject.toml +1 -1
  85. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/__init__.py +2 -0
  86. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_canvas.py +170 -52
  87. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_content.py +119 -38
  88. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_core.pyi +28 -3
  89. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_document.py +21 -5
  90. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_errors.py +3 -0
  91. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_images.py +10 -8
  92. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_page.py +18 -1
  93. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_text.py +9 -5
  94. pyropdf-0.2.2/crates/pyropdf-python/src/fonts.rs +0 -1288
  95. pyropdf-0.2.2/crates/pyropdf-python/src/render.rs +0 -49
  96. pyropdf-0.2.2/crates/pyropdf-python/src/schema.rs +0 -51
  97. pyropdf-0.2.2/crates/pyropdf-python/src/shadings.rs +0 -151
  98. pyropdf-0.2.2/crates/pyropdf-python/src/sign.rs +0 -352
  99. pyropdf-0.2.2/crates/pyropdf-store/clippy.toml +0 -101
  100. {pyropdf-0.2.2 → pyropdf-0.3.0}/LICENSE +0 -0
  101. {pyropdf-0.2.2 → pyropdf-0.3.0}/NOTICE +0 -0
  102. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/Cargo.toml +0 -0
  103. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/proptest-regressions/content/shading/tests.txt +0 -0
  104. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/proptest-regressions/fonts/tests.txt +0 -0
  105. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/proptest-regressions/standard/tests.txt +0 -0
  106. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/annotations/shapes.rs +0 -0
  107. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/annotations/tests.rs +0 -0
  108. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/bridge/tests.rs +0 -0
  109. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/content/mod.rs +0 -0
  110. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/content/page.rs +0 -0
  111. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/content/shading/tests.rs +0 -0
  112. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/content/tests.rs +0 -0
  113. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/extract/font_guard.rs +0 -0
  114. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/extract/glyphs.rs +0 -0
  115. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/extract/mod.rs +0 -0
  116. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/extract/provenance.rs +0 -0
  117. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/extract/stretch.rs +0 -0
  118. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/extract/tests.rs +0 -0
  119. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/extract/text/layout.rs +0 -0
  120. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/extract/text/search.rs +0 -0
  121. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/extract/text/selection.rs +0 -0
  122. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/bitmap/tests.rs +0 -0
  123. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/bitmap.rs +0 -0
  124. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/colour/tests.rs +0 -0
  125. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/colour.rs +0 -0
  126. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/colr/tests.rs +0 -0
  127. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/embed/tests.rs +0 -0
  128. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/instance/tests.rs +0 -0
  129. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/shape/tests.rs +0 -0
  130. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/NotoSansArabic-Variable-subset-instances.txt +0 -0
  131. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/NotoSansArabic-Variable-subset.ttf +0 -0
  132. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/NotoSansHebrew-subset.ttf +0 -0
  133. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/NotoSansJP-subset.otf +0 -0
  134. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/OFL.txt +0 -0
  135. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/README.md +0 -0
  136. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/colour-bitmaps-cbdt-only.ttf +0 -0
  137. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/colour-bitmaps-cbdt.ttf +0 -0
  138. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/colour-bitmaps-sbix-2048.ttf +0 -0
  139. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/colour-bitmaps-sbix-only.ttf +0 -0
  140. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/colour-bitmaps-sbix.ttf +0 -0
  141. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/colour-cbdt-raw.ttf +0 -0
  142. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/colour-cbdt.ttf +0 -0
  143. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/colour-colr-paints.ttf +0 -0
  144. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/colour-colr-sweep.ttf +0 -0
  145. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/colour-colr0.ttf +0 -0
  146. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/colour-colr1.ttf +0 -0
  147. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/colour-eblc-only.ttf +0 -0
  148. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/colour-eblc.ttf +0 -0
  149. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/colour-sbix-damaged.ttf +0 -0
  150. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/colour-sbix-jpeg.ttf +0 -0
  151. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/colour-sbix.ttf +0 -0
  152. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/colour-svg-cff.otf +0 -0
  153. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/colour-svg.ttf +0 -0
  154. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/colour_faces.py +0 -0
  155. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/variable-bitmaps-cbdt.ttf +0 -0
  156. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/variable-bitmaps-sbix.ttf +0 -0
  157. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/variable-colour.ttf +0 -0
  158. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/variable-colr.ttf +0 -0
  159. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/variable-composites.ttf +0 -0
  160. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/variable-latin.ttf +0 -0
  161. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/variable-overflow.ttf +0 -0
  162. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/testdata/variable_faces.py +0 -0
  163. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/fonts/type3/tests.rs +0 -0
  164. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/forms/face.rs +0 -0
  165. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/pages/mod.rs +0 -0
  166. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/pages/sources.rs +0 -0
  167. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/render/fallback.rs +0 -0
  168. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/render/svg.rs +0 -0
  169. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/sign/signer_info.rs +0 -0
  170. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/sign/tests.rs +0 -0
  171. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/standard/appearance.rs +0 -0
  172. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/standard/font.rs +0 -0
  173. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/standard/mod.rs +0 -0
  174. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/standard/ops.rs +0 -0
  175. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-engine/src/standard/tests.rs +0 -0
  176. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/Cargo.toml +0 -0
  177. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/annotations/input.rs +0 -0
  178. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-python/src/source.rs +0 -0
  179. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-schema/Cargo.toml +0 -0
  180. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-schema/src/check/tests.rs +0 -0
  181. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-schema/src/generated.rs +0 -0
  182. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-schema/src/tests.rs +0 -0
  183. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/Cargo.toml +0 -0
  184. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/examples/parser_budget_probe.rs +0 -0
  185. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/proptest-regressions/refs/tests.txt +0 -0
  186. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/budget/cancel.rs +0 -0
  187. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/budget/code.rs +0 -0
  188. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/budget/decode.rs +0 -0
  189. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/budget/limits.rs +0 -0
  190. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/budget/mod.rs +0 -0
  191. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/budget/shared.rs +0 -0
  192. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/budget/tests.rs +0 -0
  193. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/budget/vec.rs +0 -0
  194. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/error.rs +0 -0
  195. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/index/lex.rs +0 -0
  196. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/index/mod.rs +0 -0
  197. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/index/objstm.rs +0 -0
  198. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/index/read.rs +0 -0
  199. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/index/scan.rs +0 -0
  200. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/index/tests.rs +0 -0
  201. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/lib.rs +0 -0
  202. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/memo/dependencies.rs +0 -0
  203. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/memo/mod.rs +0 -0
  204. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/memo/tests.rs +0 -0
  205. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/pages/mod.rs +0 -0
  206. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/pages/tests.rs +0 -0
  207. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/refs/copy.rs +0 -0
  208. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/refs/derived.rs +0 -0
  209. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/refs/form_impact.rs +0 -0
  210. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/refs/forms.rs +0 -0
  211. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/refs/labels.rs +0 -0
  212. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/refs/mod.rs +0 -0
  213. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/refs/navigation.rs +0 -0
  214. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/refs/roles.rs +0 -0
  215. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/refs/rules.rs +0 -0
  216. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/refs/structure.rs +0 -0
  217. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/refs/tests.rs +0 -0
  218. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/save/base.rs +0 -0
  219. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/save/linear.rs +0 -0
  220. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/save/merge.rs +0 -0
  221. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/save/mod.rs +0 -0
  222. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/save/pack.rs +0 -0
  223. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/save/prune.rs +0 -0
  224. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/save/raw.rs +0 -0
  225. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/save/recode.rs +0 -0
  226. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/save/renumber.rs +0 -0
  227. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/save/tests.rs +0 -0
  228. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/security/crypto.rs +0 -0
  229. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/security/mod.rs +0 -0
  230. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/security/tests.rs +0 -0
  231. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/security/value.rs +0 -0
  232. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/settle/tests.rs +0 -0
  233. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/settle.rs +0 -0
  234. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/value/bytes.rs +0 -0
  235. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/value/copy.rs +0 -0
  236. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/value/mod.rs +0 -0
  237. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/value/read.rs +0 -0
  238. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/value/tests.rs +0 -0
  239. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/version/base.rs +0 -0
  240. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/version/document.rs +0 -0
  241. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/version/journal.rs +0 -0
  242. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/version/mod.rs +0 -0
  243. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/version/stale.rs +0 -0
  244. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/version/stamps.rs +0 -0
  245. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/version/table.rs +0 -0
  246. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/version/tests.rs +0 -0
  247. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/version/transaction.rs +0 -0
  248. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/write/mod.rs +0 -0
  249. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/src/write/tests.rs +0 -0
  250. {pyropdf-0.2.2 → pyropdf-0.3.0}/crates/pyropdf-store/tests/corpus.rs +0 -0
  251. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_annotations.py +0 -0
  252. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_attachments.py +0 -0
  253. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_changes.py +0 -0
  254. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_check.py +0 -0
  255. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_chunks.py +0 -0
  256. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_clean.py +0 -0
  257. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_encryption.py +0 -0
  258. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_fonts.py +0 -0
  259. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_form.py +0 -0
  260. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_geometry.py +0 -0
  261. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_history.py +0 -0
  262. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_layers.py +0 -0
  263. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_limit_codes.py +0 -0
  264. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_limits.py +0 -0
  265. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_links.py +0 -0
  266. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_markdown.py +0 -0
  267. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_metadata.py +0 -0
  268. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_objects.py +0 -0
  269. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_ocr.py +0 -0
  270. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_operations.py +0 -0
  271. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_outline.py +0 -0
  272. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_page_labels.py +0 -0
  273. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_pages.py +0 -0
  274. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_pixmap.py +0 -0
  275. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_profiles.py +0 -0
  276. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_recolor.py +0 -0
  277. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_sanitize.py +0 -0
  278. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_signing.py +0 -0
  279. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_tables.py +0 -0
  280. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_targets.py +0 -0
  281. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_text_edit.py +0 -0
  282. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/_widgets.py +0 -0
  283. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/py.typed +0 -0
  284. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/typed.py +0 -0
  285. {pyropdf-0.2.2 → pyropdf-0.3.0}/python/pyropdf/typed.pyi +0 -0
  286. {pyropdf-0.2.2 → pyropdf-0.3.0}/tools/arlington/model/LICENSE +0 -0
@@ -1212,7 +1212,7 @@ dependencies = [
1212
1212
 
1213
1213
  [[package]]
1214
1214
  name = "pyropdf-engine"
1215
- version = "0.2.2"
1215
+ version = "0.3.0"
1216
1216
  dependencies = [
1217
1217
  "cms",
1218
1218
  "der",
@@ -1240,7 +1240,7 @@ dependencies = [
1240
1240
 
1241
1241
  [[package]]
1242
1242
  name = "pyropdf-python"
1243
- version = "0.2.2"
1243
+ version = "0.3.0"
1244
1244
  dependencies = [
1245
1245
  "flate2",
1246
1246
  "gif",
@@ -1258,11 +1258,11 @@ dependencies = [
1258
1258
 
1259
1259
  [[package]]
1260
1260
  name = "pyropdf-schema"
1261
- version = "0.2.2"
1261
+ version = "0.3.0"
1262
1262
 
1263
1263
  [[package]]
1264
1264
  name = "pyropdf-store"
1265
- version = "0.2.2"
1265
+ version = "0.3.0"
1266
1266
  dependencies = [
1267
1267
  "aes",
1268
1268
  "flate2",
@@ -3,7 +3,7 @@ members = ["crates/*"]
3
3
  resolver = "3"
4
4
 
5
5
  [workspace.package]
6
- version = "0.2.2"
6
+ version = "0.3.0"
7
7
  authors = ["Yusuke Hayashi <yusuke8h@gmail.com>"]
8
8
  edition = "2024"
9
9
  license = "MIT"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyropdf
3
- Version: 0.2.2
3
+ Version: 0.3.0
4
4
  Classifier: Development Status :: 3 - Alpha
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: Programming Language :: Python :: 3
@@ -45,7 +45,7 @@ store that every engine reads, so an edit costs what it touches, every
45
45
  change can be undone, and a failed transaction leaves the document as it
46
46
  was.
47
47
 
48
- **Status:** alpha, 0.2. The API may change between minor versions. Documentation:
48
+ **Status:** 0.3. The API may change between minor versions. Documentation:
49
49
  <https://pyropdf.haya.works/>. [DESIGN.md](DESIGN.md) describes the
50
50
  foundation, and [CHANGELOG.md](CHANGELOG.md) what each release holds.
51
51
 
@@ -65,12 +65,12 @@ with pyropdf.open("input.pdf") as doc:
65
65
  doc.save("output.pdf", incremental=True)
66
66
  ```
67
67
 
68
- 0.2.2 reads text, words, layout, tables, images, fonts, and Markdown,
68
+ 0.3.0 reads text, words, layout, tables, images, fonts, and Markdown,
69
69
  exports them as JSON or retrieval chunks, runs offline OCR, and renders
70
70
  pages to pixmaps and SVG, drawing the CJK fonts that a document does not
71
- embed in fallback faces. It draws paths in colors or gradients, images,
72
- pages, and text in Standard 14 or OpenType fonts, in color glyphs and any
73
- weight of a variable face, with `page.draw`; edits pages and their boxes,
71
+ embed in fallback faces. It draws paths and text in colors or gradients,
72
+ images, and pages, the text in Standard 14 or OpenType fonts, in color
73
+ glyphs and any weight of a variable face, with `page.draw`; edits pages and their boxes,
74
74
  text, images, colors, annotations, links, form fields, outlines,
75
75
  attachments, metadata, page labels, and layers; signs documents and verifies
76
76
  signatures; removes hidden or active content and subsets fonts; and saves
@@ -6,7 +6,7 @@ store that every engine reads, so an edit costs what it touches, every
6
6
  change can be undone, and a failed transaction leaves the document as it
7
7
  was.
8
8
 
9
- **Status:** alpha, 0.2. The API may change between minor versions. Documentation:
9
+ **Status:** 0.3. The API may change between minor versions. Documentation:
10
10
  <https://pyropdf.haya.works/>. [DESIGN.md](DESIGN.md) describes the
11
11
  foundation, and [CHANGELOG.md](CHANGELOG.md) what each release holds.
12
12
 
@@ -26,12 +26,12 @@ with pyropdf.open("input.pdf") as doc:
26
26
  doc.save("output.pdf", incremental=True)
27
27
  ```
28
28
 
29
- 0.2.2 reads text, words, layout, tables, images, fonts, and Markdown,
29
+ 0.3.0 reads text, words, layout, tables, images, fonts, and Markdown,
30
30
  exports them as JSON or retrieval chunks, runs offline OCR, and renders
31
31
  pages to pixmaps and SVG, drawing the CJK fonts that a document does not
32
- embed in fallback faces. It draws paths in colors or gradients, images,
33
- pages, and text in Standard 14 or OpenType fonts, in color glyphs and any
34
- weight of a variable face, with `page.draw`; edits pages and their boxes,
32
+ embed in fallback faces. It draws paths and text in colors or gradients,
33
+ images, and pages, the text in Standard 14 or OpenType fonts, in color
34
+ glyphs and any weight of a variable face, with `page.draw`; edits pages and their boxes,
35
35
  text, images, colors, annotations, links, form fields, outlines,
36
36
  attachments, metadata, page labels, and layers; signs documents and verifies
37
37
  signatures; removes hidden or active content and subsets fonts; and saves
@@ -11,6 +11,10 @@ const BLACK: (f64, f64, f64) = (0.0, 0.0, 0.0);
11
11
  pub(super) fn draw(canvas: &mut Canvas, paint: &Paint, icon: &[u8], size: (f64, f64)) {
12
12
  let (sx, sy) = (size.0 / 20.0, size.1 / 20.0);
13
13
  let mut shape = |operators: &str, coordinates: &[f64], filled: bool, outline: Option<f64>| {
14
+ #[expect(
15
+ clippy::disallowed_methods,
16
+ reason = "the coordinates of one of the constant shapes of an icon"
17
+ )]
14
18
  let scaled: Vec<f64> = coordinates
15
19
  .iter()
16
20
  .enumerate()
@@ -56,6 +60,10 @@ pub(super) fn draw(canvas: &mut Canvas, paint: &Paint, icon: &[u8], size: (f64,
56
60
  Some(1.5),
57
61
  );
58
62
  // The dot is black, not the annotation's color.
63
+ #[expect(
64
+ clippy::disallowed_methods,
65
+ reason = "the coordinates of one constant ellipse"
66
+ )]
59
67
  let dot: Vec<f64> = ellipse(9.0, 14.5, 11.0, 16.5)
60
68
  .iter()
61
69
  .enumerate()
@@ -163,6 +171,10 @@ pub(super) fn file(canvas: &mut Canvas, paint: &Paint, icon: &[u8], size: (f64,
163
171
  coordinates: &[f64],
164
172
  fill: Option<(f64, f64, f64)>,
165
173
  outline: Option<f64>| {
174
+ #[expect(
175
+ clippy::disallowed_methods,
176
+ reason = "the coordinates of one of the constant shapes of an icon"
177
+ )]
166
178
  let scaled: Vec<f64> = coordinates
167
179
  .as_chunks::<2>()
168
180
  .0
@@ -54,9 +54,17 @@ pub fn synthesized(
54
54
  }
55
55
  // Hash slots, load-factor slack, and temporary rehash storage.
56
56
  budget.charge(LimitCode::MemorySize, 64)?;
57
+ #[expect(
58
+ clippy::disallowed_methods,
59
+ reason = "the entry is charged to the budget above"
60
+ )]
57
61
  visited
58
62
  .try_reserve(1)
59
63
  .map_err(|_| LimitExceeded::new(LimitCode::MemorySize))?;
64
+ #[expect(
65
+ clippy::disallowed_methods,
66
+ reason = "the entry is charged to the budget above, and room is made for it"
67
+ )]
60
68
  visited.insert(reference);
61
69
  let Some((dict, form)) = plan(&reader, reference)? else {
62
70
  continue;
@@ -100,8 +108,14 @@ fn substitute(
100
108
  .filter(|number| *number < u32::MAX)
101
109
  .ok_or_else(|| Error::malformed("no object number remains for a synthesized appearance"))?;
102
110
  let mut normal = Dict::new();
103
- normal.insert(Name::from("N"), Value::Reference(Reference::new(number, 0)));
104
- dict.insert(Name::from("AP"), Value::Dict(normal));
111
+ #[expect(
112
+ clippy::disallowed_methods,
113
+ reason = "each key is a constant: the appearances hold one entry, and the annotation gains one"
114
+ )]
115
+ {
116
+ normal.insert(Name::from("N"), Value::Reference(Reference::new(number, 0)));
117
+ dict.insert(Name::from("AP"), Value::Dict(normal));
118
+ }
105
119
  Ok([
106
120
  (reference, Value::Dict(dict)),
107
121
  (Reference::new(number, 0), Value::from(form)),
@@ -137,6 +151,10 @@ fn plan(reader: &Reader<'_>, reference: Reference) -> Result<Option<(Dict, Strea
137
151
  .charge(LimitCode::AnnotationSynthesisCount, 1)?;
138
152
  charge_copy(CopyPart::Dict(dict), reader.budget)?;
139
153
  let mut dict = dict.clone();
154
+ #[expect(
155
+ clippy::disallowed_methods,
156
+ reason = "the annotation grows by one entry at most"
157
+ )]
140
158
  dict.insert(Name::from("Rect"), numbers_array(&drawn.rect));
141
159
  Ok(Some((dict, drawn.form())))
142
160
  }
@@ -166,10 +166,20 @@ impl Settler for AppearanceSettler {
166
166
  let reference = transaction.allocate()?;
167
167
  transaction.write(reference.number(), &Value::from(form), budget)?;
168
168
  let mut appearances = Dict::new();
169
- appearances.insert(Name::from("N"), Value::Reference(reference));
170
- dict.insert(Name::from("AP"), Value::Dict(appearances));
169
+ #[expect(
170
+ clippy::disallowed_methods,
171
+ reason = "each key is a constant: the appearances hold one entry, and the annotation gains one"
172
+ )]
173
+ {
174
+ appearances.insert(Name::from("N"), Value::Reference(reference));
175
+ dict.insert(Name::from("AP"), Value::Dict(appearances));
176
+ }
171
177
  }
172
178
  if let Some(rect) = rect {
179
+ #[expect(
180
+ clippy::disallowed_methods,
181
+ reason = "the annotation grows by one entry at most"
182
+ )]
173
183
  dict.insert(Name::from("Rect"), numbers_array(&rect));
174
184
  }
175
185
  transaction.write(number, &Value::Dict(dict), budget)?;
@@ -700,6 +710,10 @@ impl Appearance {
700
710
  /// Returns the form XObject of the appearance, whose `/Matrix` maps its
701
711
  /// box onto the rectangle.
702
712
  #[must_use]
713
+ #[expect(
714
+ clippy::disallowed_methods,
715
+ reason = "each key is a constant, so each dictionary of the form holds five entries at most"
716
+ )]
703
717
  pub fn form(&self) -> Stream {
704
718
  let (width, height) = self.size;
705
719
  let mut dict = Dict::new();
@@ -1413,8 +1427,13 @@ pub(crate) fn real(value: f64) -> Value {
1413
1427
  }
1414
1428
  }
1415
1429
 
1416
- pub(crate) fn numbers_array(values: &[f64]) -> Value {
1417
- Value::Array(values.iter().map(|value| real(*value)).collect::<Array>())
1430
+ pub(crate) fn numbers_array<const N: usize>(values: &[f64; N]) -> Value {
1431
+ #[expect(
1432
+ clippy::disallowed_methods,
1433
+ reason = "the N numbers of a fixed-size array, such as a rectangle or a matrix"
1434
+ )]
1435
+ let array = values.iter().map(|value| real(*value)).collect::<Array>();
1436
+ Value::Array(array)
1418
1437
  }
1419
1438
 
1420
1439
  #[cfg(test)]
@@ -339,6 +339,10 @@ fn callout(
339
339
  if !matches!(values.len(), 4 | 6) {
340
340
  return Ok(());
341
341
  }
342
+ #[expect(
343
+ clippy::disallowed_methods,
344
+ reason = "the callout line has 4 or 6 numbers, checked above"
345
+ )]
342
346
  let points: Vec<(f64, f64)> = values
343
347
  .as_chunks::<2>()
344
348
  .0
@@ -543,5 +543,9 @@ fn row(kind: u8, second: u64, third: u32) -> [u8; 13] {
543
543
  }
544
544
 
545
545
  fn insert(dict: &mut Dict, key: Name, value: Value) {
546
+ #[expect(
547
+ clippy::disallowed_methods,
548
+ reason = "the trailer copies the entries of the version's trailer, which the store holds, and five constant keys"
549
+ )]
546
550
  dict.insert(key, value);
547
551
  }
@@ -92,6 +92,10 @@ pub enum Extend {
92
92
  None,
93
93
  /// The colour at each end continues.
94
94
  Pad,
95
+ /// Only the colour at the start continues.
96
+ PadStart,
97
+ /// Only the colour at the end continues.
98
+ PadEnd,
95
99
  /// The line starts again.
96
100
  Repeat,
97
101
  /// The line runs back and forth.
@@ -110,6 +114,17 @@ pub struct Gradient<'a> {
110
114
  pub extend: Extend,
111
115
  }
112
116
 
117
+ /// Optional bounds and background retained when repainting an existing shading.
118
+ #[derive(Clone, Copy, Debug, Default)]
119
+ pub struct ShadingMetadata {
120
+ /// The shading-space clip box.
121
+ pub bbox: Option<[f64; 4]>,
122
+ /// Background RGBA, already converted to sRGB by the reader.
123
+ pub background: Option<[f64; 4]>,
124
+ /// Preserve the reader's bounded approximation with a sampled function.
125
+ pub sampled: bool,
126
+ }
127
+
113
128
  /// What a caller names to paint a gradient.
114
129
  #[derive(Clone, Copy, Debug, PartialEq)]
115
130
  pub struct Painted {
@@ -216,22 +231,68 @@ impl Shadings {
216
231
  gradient: &Gradient<'_>,
217
232
  area: [f64; 4],
218
233
  budget: &Budget,
234
+ ) -> Result<Painted, ShadingError> {
235
+ self.paint_with_metadata(
236
+ transaction,
237
+ gradient,
238
+ area,
239
+ ShadingMetadata::default(),
240
+ budget,
241
+ )
242
+ }
243
+
244
+ /// Repaints a gradient with the optional clip box and background of a
245
+ /// read shading. Metadata participates in sharing, just like its colours.
246
+ pub fn paint_with_metadata(
247
+ &mut self,
248
+ transaction: &mut Transaction,
249
+ gradient: &Gradient<'_>,
250
+ area: [f64; 4],
251
+ metadata: ShadingMetadata,
252
+ budget: &Budget,
219
253
  ) -> Result<Painted, ShadingError> {
220
254
  check_gradient(gradient, area)?;
255
+ if metadata
256
+ .bbox
257
+ .is_some_and(|bbox| bbox.iter().any(|x| !x.is_finite() || x.abs() > REAL_MAX))
258
+ || metadata
259
+ .background
260
+ .is_some_and(|rgba| rgba.iter().any(|x| !(0.0..=1.0).contains(x)))
261
+ {
262
+ return Err(ShadingError::Invalid(
263
+ "invalid shading bounds or background",
264
+ ));
265
+ }
221
266
  let span = Span::of(gradient, area)?;
222
267
  let geometry = span.map_or(gradient.geometry, |span| span.geometry(gradient.geometry));
223
268
  check_geometry(&geometry)?;
224
- let extended = gradient.extend != Extend::None;
269
+ let extended = match gradient.extend {
270
+ Extend::None => [false, false],
271
+ Extend::PadStart => [true, false],
272
+ Extend::PadEnd => [false, true],
273
+ _ => [true, true],
274
+ };
225
275
  let color = self.line(
226
276
  transaction,
227
277
  gradient.stops,
228
278
  |stop| &stop.color,
229
279
  span.as_ref(),
280
+ metadata.sampled,
281
+ budget,
282
+ )?;
283
+ let shading = self.shading(
284
+ transaction,
285
+ &geometry,
286
+ "DeviceRGB",
287
+ color,
288
+ extended,
289
+ metadata,
230
290
  budget,
231
291
  )?;
232
- let shading = self.shading(transaction, &geometry, "DeviceRGB", color, extended, budget)?;
233
292
  let alpha = gradient.stops[0].alpha;
234
- if gradient.stops.iter().all(|stop| stop.alpha == alpha) {
293
+ if gradient.stops.iter().all(|stop| stop.alpha == alpha)
294
+ && metadata.background.is_none_or(|rgba| rgba[3] == alpha)
295
+ {
235
296
  return Ok(Painted {
236
297
  shading,
237
298
  mask: None,
@@ -243,9 +304,18 @@ impl Shadings {
243
304
  gradient.stops,
244
305
  |stop| slice::from_ref(&stop.alpha),
245
306
  span.as_ref(),
307
+ metadata.sampled,
308
+ budget,
309
+ )?;
310
+ let gray = self.shading(
311
+ transaction,
312
+ &geometry,
313
+ "DeviceGray",
314
+ line,
315
+ extended,
316
+ metadata,
246
317
  budget,
247
318
  )?;
248
- let gray = self.shading(transaction, &geometry, "DeviceGray", line, extended, budget)?;
249
319
  let shadings = dict([("S0", Value::Reference(gray))]);
250
320
  let resources = dict([("Shading", Value::Dict(shadings))]);
251
321
  let group = self.transparency_group(
@@ -314,7 +384,9 @@ impl Shadings {
314
384
  ("Group", Value::Dict(group)),
315
385
  ("Resources", Value::Dict(resources)),
316
386
  ]);
317
- let data = Bytes::new(content.to_vec());
387
+ let mut data = BudgetVec::new(budget);
388
+ data.try_extend_from_slice(content)?;
389
+ let data = Bytes::new(data.into_vec());
318
390
  let stream = Value::from(Stream::new(form, data));
319
391
  Ok(self.shared(transaction, &stream, budget)?)
320
392
  }
@@ -344,17 +416,74 @@ impl Shadings {
344
416
  stops: &'s [Stop],
345
417
  values: impl Fn(&'s Stop) -> &'s [f64],
346
418
  span: Option<&Span>,
419
+ sampled: bool,
347
420
  budget: &Budget,
348
421
  ) -> Result<Reference, Error> {
349
- let function = self.function(transaction, stops, values, budget)?;
422
+ let function = if sampled {
423
+ self.sampled_function(transaction, stops, values, budget)?
424
+ } else {
425
+ self.function(transaction, stops, values, budget)?
426
+ };
350
427
  match span {
351
428
  Some(span) => self.cycles(transaction, function, span, budget),
352
429
  None => Ok(function),
353
430
  }
354
431
  }
355
432
 
433
+ /// Keep read shadings on the reader's dyadic grid (maximum depth 10).
434
+ /// Stitching every sampled interval duplicates its boundary stops when
435
+ /// hayro renders it, which changes vello's LUT resolution at sharp edges.
436
+ /// A Type 0 function avoids introducing those new stitching boundaries.
437
+ fn sampled_function<'s>(
438
+ &mut self,
439
+ transaction: &mut Transaction,
440
+ stops: &'s [Stop],
441
+ values: impl Fn(&'s Stop) -> &'s [f64],
442
+ budget: &Budget,
443
+ ) -> Result<Reference, Error> {
444
+ const INTERVALS: u32 = 1 << 10;
445
+ let channels = values(&stops[0]).len();
446
+ let mut samples = BudgetVec::new(budget);
447
+ let mut index = 0;
448
+ for sample in 0..=INTERVALS {
449
+ let offset = f64::from(sample) / f64::from(INTERVALS);
450
+ while index + 2 < stops.len() && stops[index + 1].offset < offset {
451
+ index += 1;
452
+ }
453
+ let left = &stops[index];
454
+ let right = &stops[index + 1];
455
+ let width = right.offset - left.offset;
456
+ let mix = if width > 0.0 {
457
+ ((offset - left.offset) / width).clamp(0.0, 1.0)
458
+ } else {
459
+ 1.0
460
+ };
461
+ for (&a, &b) in values(left).iter().zip(values(right)) {
462
+ let value = ((a + (b - a) * mix) * f64::from(u16::MAX)).round() as u16;
463
+ samples.try_extend_from_slice(&value.to_be_bytes())?;
464
+ }
465
+ }
466
+ let ranges = [0.0, 1.0, 0.0, 1.0, 0.0, 1.0];
467
+ let size = Value::Array(vec![Value::Integer(i64::from(INTERVALS + 1))].into());
468
+ let dictionary = dict([
469
+ ("FunctionType", Value::Integer(0)),
470
+ ("Domain", reals(&[0.0, 1.0])),
471
+ ("Range", reals(&ranges[..channels * 2])),
472
+ ("Size", size),
473
+ ("BitsPerSample", Value::Integer(16)),
474
+ ("Encode", reals(&[0.0, f64::from(INTERVALS)])),
475
+ ("Decode", reals(&ranges[..channels * 2])),
476
+ ]);
477
+ let function = Value::from(Stream::new(dictionary, Bytes::new(samples.into_vec())));
478
+ self.shared(transaction, &function, budget)
479
+ }
480
+
356
481
  /// Returns the function from 0 to 1 that interpolates `values` of the
357
482
  /// stops: exponential between two of them, and otherwise stitched.
483
+ #[expect(
484
+ clippy::disallowed_methods,
485
+ reason = "one function and one bound per stop, and one more, which the scratch charges"
486
+ )]
358
487
  fn function<'s>(
359
488
  &mut self,
360
489
  transaction: &mut Transaction,
@@ -410,19 +539,28 @@ impl Shadings {
410
539
  if bounds.is_empty() && encode == [0.0, 1.0] {
411
540
  return Ok(one);
412
541
  }
542
+ #[expect(
543
+ clippy::disallowed_methods,
544
+ reason = "one function per cycle, which the scratch charges, and MAX_CYCLES at most"
545
+ )]
413
546
  let functions = (0..span.count()).map(|_| Value::Reference(one)).collect();
414
547
  let function = Value::Dict(stitching(functions, &bounds, &encode));
415
548
  self.shared(transaction, &function, budget)
416
549
  }
417
550
 
418
551
  /// Returns the shading of `function` along `geometry`.
552
+ #[expect(
553
+ clippy::too_many_arguments,
554
+ reason = "the fields of the emitted shading dictionary"
555
+ )]
419
556
  fn shading(
420
557
  &mut self,
421
558
  transaction: &mut Transaction,
422
559
  geometry: &Geometry,
423
560
  color_space: &str,
424
561
  function: Reference,
425
- extended: bool,
562
+ extended: [bool; 2],
563
+ metadata: ShadingMetadata,
426
564
  budget: &Budget,
427
565
  ) -> Result<Reference, Error> {
428
566
  let (kind, coords) = match *geometry {
@@ -437,14 +575,32 @@ impl Shadings {
437
575
  reals(&[start[0], start[1], start_radius, end[0], end[1], end_radius]),
438
576
  ),
439
577
  };
440
- let extend = Value::Array(vec![Value::Boolean(extended); 2].into());
441
- let shading = dict([
578
+ let extend =
579
+ Value::Array(vec![Value::Boolean(extended[0]), Value::Boolean(extended[1])].into());
580
+ let mut shading = dict([
442
581
  ("ShadingType", Value::Integer(kind)),
443
582
  ("ColorSpace", name(color_space)),
444
583
  ("Coords", coords),
445
584
  ("Function", Value::Reference(function)),
446
585
  ("Extend", extend),
447
586
  ]);
587
+ #[expect(
588
+ clippy::disallowed_methods,
589
+ reason = "at most two optional entries in this fixed shading dictionary"
590
+ )]
591
+ {
592
+ if let Some(bbox) = metadata.bbox {
593
+ shading.insert(Name::from("BBox"), reals(&bbox));
594
+ }
595
+ if let Some(background) = metadata.background {
596
+ let values = if color_space == "DeviceGray" {
597
+ &background[3..]
598
+ } else {
599
+ &background[..3]
600
+ };
601
+ shading.insert(Name::from("Background"), reals(values));
602
+ }
603
+ }
448
604
  self.shared(transaction, &Value::Dict(shading), budget)
449
605
  }
450
606
 
@@ -470,10 +626,18 @@ impl Shadings {
470
626
  LimitCode::MemorySize,
471
627
  (64 + 2 * size_of::<(Box<[u8]>, Reference)>()) as u64,
472
628
  )?;
629
+ #[expect(
630
+ clippy::disallowed_methods,
631
+ reason = "the entry is charged to the budget above"
632
+ )]
473
633
  self.objects
474
634
  .try_reserve(1)
475
635
  .map_err(|_| LimitExceeded::new(LimitCode::MemorySize))?;
476
636
  // The key's own charge stays with the operation, as the table keeps it.
637
+ #[expect(
638
+ clippy::disallowed_methods,
639
+ reason = "the entry is charged to the budget above, and room is made for it"
640
+ )]
477
641
  self.objects
478
642
  .insert(key.into_vec().into_boxed_slice(), reference);
479
643
  Ok(reference)
@@ -500,7 +664,7 @@ impl Span {
500
664
  /// gradient that does not repeat.
501
665
  fn of(gradient: &Gradient<'_>, area: [f64; 4]) -> Result<Option<Self>, ShadingError> {
502
666
  let reflect = match gradient.extend {
503
- Extend::None | Extend::Pad => return Ok(None),
667
+ Extend::None | Extend::Pad | Extend::PadStart | Extend::PadEnd => return Ok(None),
504
668
  Extend::Repeat => false,
505
669
  Extend::Reflect => true,
506
670
  };
@@ -564,6 +728,10 @@ impl Span {
564
728
 
565
729
  /// Returns the bounds and the encoding of a stitching function from 0 to
566
730
  /// 1 over the span, of one function from 0 to 1.
731
+ #[expect(
732
+ clippy::disallowed_methods,
733
+ reason = "three numbers per cycle, and `Span::of` keeps MAX_CYCLES cycles at most"
734
+ )]
567
735
  fn stitches(&self) -> (Vec<f64>, Vec<f64>) {
568
736
  let count = self.count();
569
737
  let length = self.high - self.low;
@@ -756,10 +924,15 @@ fn in_real_range(value: f64) -> bool {
756
924
 
757
925
  /// Returns the dictionary of `entries`, in their order.
758
926
  fn dict<const N: usize>(entries: [(&str, Value); N]) -> Dict {
759
- entries
927
+ #[expect(
928
+ clippy::disallowed_methods,
929
+ reason = "the N entries of a fixed-size array"
930
+ )]
931
+ let dict = entries
760
932
  .into_iter()
761
933
  .map(|(key, value)| (Name::from(key), value))
762
- .collect()
934
+ .collect();
935
+ dict
763
936
  }
764
937
 
765
938
  /// Returns a name.
@@ -769,12 +942,15 @@ fn name(text: &str) -> Value {
769
942
 
770
943
  /// Returns an array of reals, in which negative zero is zero.
771
944
  fn reals(values: &[f64]) -> Value {
772
- Value::Array(
773
- values
774
- .iter()
775
- .map(|&value| Value::from(value + 0.0))
776
- .collect(),
777
- )
945
+ #[expect(
946
+ clippy::disallowed_methods,
947
+ reason = "a fixed array, a stop's colour, or a stitching's bounds and encoding, which a scratch charges"
948
+ )]
949
+ let array = values
950
+ .iter()
951
+ .map(|&value| Value::from(value + 0.0))
952
+ .collect();
953
+ Value::Array(array)
778
954
  }
779
955
 
780
956
  /// Returns the function that runs from `from` to `to` over 0 to 1.
@@ -72,12 +72,16 @@ impl ContentSink for Grab<'_> {
72
72
  ),
73
73
  Image::Stencil(stencil) => stencil.with_stencil(
74
74
  |mask, _| {
75
- let size = mask.data.len();
75
+ #[expect(
76
+ clippy::disallowed_methods,
77
+ reason = "as many bytes as the decoded mask that hayro holds"
78
+ )]
79
+ let color = vec![0; mask.data.len()];
76
80
  self.image = Some(DecodedImage {
77
81
  width: mask.width,
78
82
  height: mask.height,
79
83
  gray: true,
80
- color: vec![0; size],
84
+ color,
81
85
  alpha: Some(mask.data),
82
86
  });
83
87
  },