Proportional sprites?

0 votes
asked Dec 27, 2022 in Wanted features by Todd Musheno (2,680 points)

I would like to include a sprite as a symbol to be used in text.

Is there a way to scale the sprite such that it fits?

Is there a way to do this now, if so let me know, if not...

We might use syntax something like:

@startuml
sprite foo ...
Alice->Bob : <$foo{1.0em}>
Bob->Cheryl : <$foo{2.0em}>
@enduml

In this case allices would be the same size as the text, and cheryls would be bigger.

Open to alternative syntax.

1 Answer

+1 vote
answered May 14, 2023 by kirchsth (4,800 points)

Maybe too late (it works with sprites, openIconic and images)

commented May 14, 2023 by Todd Musheno (2,680 points)
Great start... Could you add support for sizes proportional to the default font?
In css terms em or rem.
1.5em maybe... I would expect 1em to be the same size as the default font.
commented May 14, 2023 by Todd Musheno (2,680 points)
<&folder,em=1.0,color=green>
Would give me the same size as the default font.
commented May 14, 2023 by Todd Musheno (2,680 points)
<&folder, relative=1.0,color=green>
Another syntax that might make sense?
commented May 14, 2023 by kirchsth (4,800 points)
Sorry, I'm not a PlantUML developer; but in C4-Stdlib I used typically 0.25 and it has the size of the default font; and in reality it depends on the base image size too.
But if you would define the default size via a variable e.g. !$DEFAULT_FONT_SIZE=20 and then use the variable directly in the a) style definition and b) in the calculated scale size !$scale=$DEFAULT_FONT_SIZE/"IMAGE SIZE" then you has the correct size based on your requirements
commented May 14, 2023 by Todd Musheno (2,680 points)
I think that approach should work if there was some kind of size of default font someone creating a diagram could use... Yes I think that would suffice!
...