Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Rich Anderson on November 08, 2019, 12:00:39 pm

Title: Simple Italic on Shape Script
Post by: Rich Anderson on November 08, 2019, 12:00:39 pm
I have a rather simple shape script where I print three properties inside the shape with this...

Code: [Select]
shape name
{
h_align="center";
println("#packagename#");
println("#name#");
print("(#TAG:Code#)");
}

I would like the first line (#packagename#) to be in italics, but I don't see any way to do this by turning italics=true for just that line. I can make the whole thing italics, but not just one line.  I tried putting that part in braces, but no luck.  I tried turning italics to true, then false, but no luck.   I tried adding other subshapes, but that was pretty complex and I couldn't get the veritical spacing to work right.

Is there any way to do this without adding more subshapes?
Title: Re: Simple Italic on Shape Script
Post by: KP on November 08, 2019, 01:47:23 pm
The bad news is you have to use subshapes. The good news is it's not that hard. Try starting with something like this:

Code: [Select]
shape main
{
layouttype="border";
rectangle(0,0,100,100);
addsubshape("row1","N");
addsubshape("row2","center");

shape row1
{
italic=true;
h_align="center";
preferredheight=20;
println("#packagename#");
}

shape row2
{
h_align="center";
println("#name#");
print("(#TAG:Code#)");
}
}