Skip to content

Feature: Form Field types (PDF 1.7 Section 12.7.4)#23

Merged
reknih merged 7 commits intotypst:mainfrom
tingerrr:field-types
Oct 22, 2023
Merged

Feature: Form Field types (PDF 1.7 Section 12.7.4)#23
reknih merged 7 commits intotypst:mainfrom
tingerrr:field-types

Conversation

@tingerrr
Copy link
Contributor

@tingerrr tingerrr commented Oct 21, 2023

This PR adds the writers and types for writing various types form fields.

  • Text Fields
  • Choice Fields
  • Button Fields
  • Signature Fields (Left out to reduce review surface to in turn ensure correct implementation)

@tingerrr
Copy link
Contributor Author

I once again went with a prefix based approach to make the specific functions for /V and /DV exist in tandem. I don't like this solution all that much, we can probably clean this up in the future by providing specialized writers for cases where dictionaries have specific fields for a specific subtype.

Comment on lines +82 to +90
// TODO: the spec likely means the equivalent of unicode graphemes here
// for characters

/// Write the `/MaxLen` attribute to set the maximum length of the fields
/// text in characters. Only permissible on text fields.
pub fn text_max_len(&mut self, len: i32) -> &mut Self {
self.dict.pair(Name(b"MaxLen"), len);
self
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted here, I was looking for mentions of character in the spec and couldn't really find what they define to be a character, but I assume this is about what the user sees.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@reknih this is still relevant, unfortunately moving the code around has marked this as outdated.

@tingerrr tingerrr marked this pull request as ready for review October 21, 2023 13:12
@tingerrr
Copy link
Contributor Author

While this is marked as ready for review, there is still some work to do, like exporting the types and such.

Copy link
Member

@reknih reknih left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a huge section of the spec so there are bound to be some comments. You are making good progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants