#2813 Improve preview, svg/pdf export of node's label's box #2846
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
#2813 Improve preview, svg/pdf export of node's label's box
Untouched side issues
I stopped at good enough, but hoping this comes in handy for others:
dominant-baseline:central
works fine without theextra displacement (done in code). However the bbox
ignores it (https://xmlgraphics.apache.org/batik/status.html).
We could probably use a kludge with dummy text to
calculate the correct box positioning, but may face
issues with different fonts and non-latin characters.
this can't be replicated in svg without font metrics.
This can probably be fixed by kludge or finding the metrics.
Side effect: the Preview box has fixed-height,
which looks better in the general case.
be the stroke of existing text (with
paint-order
changed).The outline group is part of an API so I've left it.
Box not using alpha (pdf)I've edited a few public functions (renderG2D, etc.) to add the boxWidth.
Not sure if there are implications to that, the functions appear
not be called elsewhere and it isn't in API code.
I haven't fully fixed #2813, they also mention the unfixed issues re: box size
They requested
dominant-baseline: text-top
, but I just removed it because batikdoesn't support it and I don't know what happens with non-latin characters and because
with the labels I did test, there was no different in Inkscape and firefox.
Test cases
Following cases tested in labels_outline.zip:
Checklist
Added tests?
(or I find time to do it). I've spent too long failing to figure out how to run the existing tests (eventually foundmvn -P enableTests
, I've been searching in modules instead of the root pom.xml 馃う). huh, I can't think of a test that isn't fragile to minor changes and doesn't involve parsing the output or doing a comparison to a reference bitmap.Added to documentation?