PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust
M5: doc comments for the functions this change touches
Eric Kaden465bd0a71737
diff --git a/crates/forms/src/author.rs b/crates/forms/src/author.rsindex 40c94bec0..3f05aec3e 100644--- a/crates/forms/src/author.rs+++ b/crates/forms/src/author.rs@@ -683,6 +683,9 @@ pub fn redraw_field(doc: &mut Document, name: &str) -> Result<(), FormError> {redraw_widgets(doc, name, None)}+/// `redraw_field` for the widget at index `only` alone (so a caption-only edit leaves the field's+/// other widgets' appearances as they are), or for every widget when `only` is `None`. Fails with+/// `FormError::NoSuchField` when no field is named `name`.fn redraw_widgets(doc: &mut Document, name: &str, only: Option<usize>) -> Result<(), FormError> {let f = fields(doc).into_iter().find(|f| f.name == name).ok_or_else(|| FormError::NoSuchField(name.into()))?;let mut undrawn = false;diff --git a/crates/forms/src/tests.rs b/crates/forms/src/tests.rsindex 8bc81851a..40d44677f 100644--- a/crates/forms/src/tests.rs+++ b/crates/forms/src/tests.rs@@ -87,6 +87,8 @@ fn ap(doc: &Document, w: &Widget) -> String {String::from_utf8_lossy(&s.decoded().unwrap()).into_owned()}+/// A push button's caption is drawn in the font, size and color its `/DA` asks for; with an+/// automatic size (0) it is sized to fit the button, in the form's default font and color.#[test]fn a_button_caption_is_drawn_in_its_fields_font_size_and_color() {let objs: Vec<String> = vec![@@ -111,6 +113,9 @@ fn a_button_caption_is_drawn_in_its_fields_font_size_and_color() {assert!(auto.contains("/Helv 14.00 Tf") && auto.contains(" 0 g"), "{auto}");}+/// A button caption in a font whose UCS-2 CMap holds 签 is not reported; once `set_props` adds a+/// character beyond U+FFFF, the caption is still drawn in that font and `undrawn_fields` reports+/// the character.#[test]fn a_button_caption_its_fonts_encoding_cant_hold_is_reported() {let objs: Vec<String> = vec![