phax / ph-pdf-layout

Java library for creating fluid page layouts with Apache PDFBox. Supporting multi-page tables, different page layouts etc.
Apache License 2.0
64 stars 11 forks source link

fontspec setter for PLText #38

Closed martin19 closed 1 month ago

martin19 commented 1 month ago

Hi,

I'm working on applying styles to elements in a generic way using a very simple CSS inspired style language. As "stylable" to my knowledge do not share a common interface I'm using reflection to determine style setters ("margin", "padding", "border", etc). Unfortunately PLText does not offer a setter for FontSpec which somehow breaks my concept - it's not a bug and I'm not implying that it was ever meant to be used that way - however for consistency sake (?) I'd be really glad to see this setter added if it is possible.

Have you ever thought about making ph-pdf-layout CSS stylable? I see you have a CSS parser in your repos, in my opinion it would be a really neat addition to this great library.

phax commented 1 month ago

Hi @martin19, Thanks for reaching out to me. Regarding the initial comment:

I don't like the concept of the FontSpec setter, but I can see it makes sense. Bear in mind, that you can only change the font spec, BEFORE it is used (before the "prepare" phase).

Will be included in 7.3.5 release

martin19 commented 1 month ago

Hi @phax Thanks for the quick reply and the comment on interfaces, that went past me - I didn't look close enough.

I see now the final on the fontspec property is there for a reason and might cause trouble if used "too late". I've quickly patched the library and added it, it works for my use case. I don't understand the library internals good enough to say when this causes a problem.

Thanks again