Copy link to clipboard
Copied
When passed in a rectangle for an annotation, I want to create an appearance stream that has a point size that will mostly fill the rectangle. I calculate a smaller one that I want to fill. I have it working fine of I just use an arbitrary point size, but my first few attempts at computing it are failing.
Copy link to clipboard
Copied
There is a big challenge he because there is not a fixed connection between point size and filling a space with text. Most (not all) fonts are designed so they can be set with 0 leading (no space between lines) without overlap. This means there is room above the characters for descenders from g, j etc. filling a space will depend on the characters and font used, and is more an exercise in geometry. You could try examining the font metrics in detail but bear in mind the scaling has to change if the characters used change.