drawshield / Drawshield-Code

PHP code to create SVG shield images from Blazons, as used on drawshield.net
https://drawshield.net
GNU General Public License v3.0
49 stars 17 forks source link

!todo `compass rose` centering #582

Closed karlwilcox closed 1 year ago

karlwilcox commented 1 year ago

!todo compass rose centering The visual centre of the compass rose charge should not be the geometric centre of the charge bounding box.

ericscheid commented 1 year ago
per bend per fess
ericscheid commented 1 year ago

..or is the problem the charge placement itself isn't exactly centered?

Nope — the charge top edge is 40px from the square top, as is the bottom edge.

drawn in a square shape
karlwilcox commented 1 year ago

Good point - there may well be other charges with this characteristic. The issue arises because the charge is centered on its "bounding box" (i.e. its maximum extents) rather than its "natural" centre (which of course may be different for each charge).

Proper fix: add some charge metadata to apply an appropriate adjustment

Quick fix: adjust the bounding box so it's centre is in the right place (so the pointy bit at the top is outside the box but still visible.

I'll do the quick fix for now but think about the proper one!

ericscheid commented 1 year ago

Apart from obvious geometric shapes with bits sticking out to unbalance the bounding box, there are likely also a few animal charges that don't have the best match with visual centres (particularly regarding to dexter/sinister).

karlwilcox commented 1 year ago

The quick fix works well, so we should go with that for now. It might break "conjoined" charges but that is less of a problem than incorrect placement. If any other charges are like this just raise an issue for it.

ericscheid commented 1 year ago

There's still a slight offset if you look closely. My suggestion of "40px" might not have been precise.

image image image
karlwilcox commented 1 year ago

Yes, it is quite hard to get the centre point right by adjusting the boundary - I'm going to look at a different technique and have a bit of metadata that specifies the exact centre by coordinates.