Using a shape as part of another shape's text

Started by Hey Ken, August 15, 2016, 05:04:23 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Hey Ken


Hey, Gurus!

    Okay, here's another odd one: I want to use a shape as a text character inside another shape. 

    For example, let's say I created a smiley face shape and want to embed it in the middle of another shape's text, such as between characters 13 and 14.  How would I do that?  The obvious place to look is the Text Fields section, but it only accommodates values related to a shape, such as height, shape data, etc., not the shape itself.  I suspect it can't be done, but I'm hoping it can.

    What I'm doing now is grouping the embedded shape with the main shape, but it's very unwieldy.  Initially I need to add spaces and/or carriage returns to properly position the letters around the embedded shape, but whenever the letters change or the topology of the shape changes, the location of the embedded shape must also change.  A pain, for sure.  Even a VBA solution would prove formidable. There's got to be an easier way!

    Suggestions?  Thanks in advance,

    - Ken

Ken V. Krawchuk
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com

wapperdude

The only thing that comes to mind would be to put a blank space and make it bold.  That ought to create a new text field.  Then you can identify the text position.  But, that's just relative to the text string.  Don't think you can get a literal coordinate.  In fact, that's why I don't think you can do it.  Visio isn't a full fledged word processor.  It handles text, uh, uniquely.

I'd think you'd be more successful doing your  in, say, Word, import your graphic smiley face, then import lot to Visio.

Just some thoughts.

Wapperdude
Visio 2019 Pro

Yacine

#2
I absolutely agree with Wapperdude.
I've done awhile ago some calculations to determine the exact position of a line in a text field and do know for sure that there are PLENTY of parameters to consider.
So whilst being feasable, I don't think it is reasonable to go into such a project - UNLESS you build a reusable library, but this is even more complicated.
I did a quick try of drawing a small shape in Visio, inserting it as metafile in a line of a Word document, then copied the whole text from Word to Visio as Word object. It's not elegant, but it works.

my 2 cents, Y.

PS: You might also think about creating your own font: http://www.webdesignerdepot.com/2012/01/how-to-make-your-own-icon-webfont/
Yacine

Hey Ken

   Here's yet another reason I love this forum...

   As I've mentioned before, part of my morning routine each work day is to peruse the latest posts.  Never know what you might learn.  And today I hit gold.

   A few months ago, I posted this question about how to intersperse shapes as part of the text of a shape.  As I've come to expect here, I received a few good suggestions.  The key suggestion was to create a shape in some tool outside Visio and import it as a picture.  That would work if I wasn't so hierarchical in my thinking, because what if the embedded shape itself contained text with embedded shapes?  And those embedded shapes contained text with embedded shapes, ad infinitum, ad nauseam?  Although good, the suggestion fell short of what I needed.  I was out of luck.

   Until today.  The solution came in an entirely unrelated post innocently titled Line tool minimum BeginArrowSize too large.  The inspiration was rather than interspersing characters and shapes, turn the characters themselves into full-blown Visio shapes, including all the bells and whistles that comes with them, and intersperse them with my shapes.  Shapes mixed with shapes, and no text at all.

   That gives me full control of the positioning, sequencing, and topology of the text shapes interspersed with shapes containing text shapes interspersed with shapes containing text shapes interspersed with shapes, etc., etc., etc.  Bottom line is that by using VBA, I can recursively build and size each sub-shape into the final whole—and just be careful that one of the sub-shapes does not include one of its own sub-shapes! 

   So thanks for the unexpected jewel.  This forum rocks!

   - Ken
Ken V. Krawchuk
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com

wapperdude

May we see an example application of this?  I think a visual will inspire creativity.

Wapperdude
Visio 2019 Pro

Hey Ken

Wapperdude:

   Ask and ye shall receive.

   The primary reason I need to mix text and shapes is to draw the data and process models defined in my patents.  Without getting into too much detail, here's a quick overview:

   All data is described hierarchically using boxes and lines, looking much like an org chart.  Any given box is the container for the boxes immediately below it, essentially a record with multiple fields.  Similarly, those boxes are the containers for the boxes immediately below them, etc., all the way down to the bottom.  The bottom level is the actual data value. 

   All processes are described hierarchically using (you guessed it) boxes and lines, which are traversed (you guessed it again) hierarchically, that is, top to bottom, left to right.  So any given box is a process composed of the boxes immediately below it, essentially subroutines of the box above.  Similarly, those boxes are processes composed of the boxes immediately below them.  The bottom level holds the process primitives, whatever that may be.  Those primitives could be other processes, subroutines, or even native language primitives (such as a COBOL Move statement, a VBA Set statement, a mathematical formula, or whatever).

   It's the process bottom level where Snuuba's suggestion comes into play.  Let's say the bottom level box contains a formula, such as "Add X to Y giving Z".  X, Y, and Z are data boxes described somewhere in the data model.  But since they're boxes, they're also drawn as boxes within the process box.  Attached below is a process model showing the actual appearance of boxes within a box at the bottom level (and at the top level, but I digress).

   My problem would surface if I wanted to change that bottom level process.  For example, let's say I wanted to get rid of the English words and change it to "X + Y = Z", i.e., eliminate the word "Add", change "to" to "+", and "giving" to "=".  I do that and the process box is now smaller, and I need to manually straighten things out.  Similarly, if I changed X, Y, and Z to "Vacation Days", "Sick Days", and "Total Paid Time Off", respectively, I'd have to again manually straighten things out.  A pain.

   Still with me?  Because now it gets complicated.  Let's say I want to take that process box and pass it as an argument to some other process.  So now I have a boxes in a box in a box.  Pass that as an argument, and you have boxes in a box in a box in a box.  Not only is that a pain to draw manually, it's a bigger pain to re-draw it when the text changes somewhere along the line.

   Now here comes Snuuba's suggestion.  If the text characters were shapes, I could easily write VBA to size the outermost box to fit all the inner boxes and text according to the default widths/heights/aspect ratios/etc. that my models require.

   The reason I'm so thrilled with this solution is because I'm using Visio as an operating system to actually execute the process models I draw.  Right now it's pretty ugly, because I just stack up all the words and boxes into a tall skinny box whose width is driven solely by the widest word.  That takes up a lot of vertical real estate, which is an important consideration when drawing hierarchical models—I now need to scroll down to see the lower level process boxes, and we all know how I like to avoid keystrokes/mouse clicks/mouse wheels/etc.

   Taking it a step further, I've already started playing around with it, and there is one possible downside: performance.  My models already have many shapes—48, to be exact in the attached example—and turning all the text into shapes expands that number well into the hundreds.  I've already had that discussion with you about how too many shapes can dramatically slow down rendering a drawing.  But I'll deal with that when it starts to become troublesome.  My top-of-the-head guess for a solution would be to only use text shapes when I have a box-in-box situation.

   That's probably more info than you wanted to hear.  I guess all you wanted was a picture of the box in a box in a box in a box, but I know you forum folks—you like to take a step back and try to solve the problem in a different fashion by questioning some of the premises.  My hope was to bypass all that and give you the rationale (plus the entire data and process model example, if you're interested).  I'd be surprised (and happy!) if you could come up with a rendition where I wouldn't need to rely on text-as-shapes.


   - Ken





Ken V. Krawchuk
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com

wapperdude

Not "use" I had anticipated.  If I followed your explanation I think it boils down to:  you format your text string as desired, in, for example, Inkscape.  Convert to vector and then stuff it into Visio.  That allows you to keep constant the relative shape to text format, regardless of shape size...the text tracks with shape size.

At first, seemed like a lot of extra-curricular work, and my reaction was, why not use font scaling (FS)?  Thought about that, and I don't think FS preserves the strict format structure you desire.  But, it is possible to make the font scale so that it is always inside the shape width.  I have a shape that does this without rolling over to a new line.  Not sure which is ultimately more work.  FS would save on shape count.

Anyway, glad you have a solution that meets your needs.  Thanks for sharing.  There is a certain "cleaness" to the solution you have.

Wapperdude

Visio 2019 Pro

Hey Ken

Wapperdude:

   Interesting approach, but now you have me thinking further outside the box to a simpler solution.  Rather than Inkscape or other tools, why not keep this 100% Visio?

   So what I'm thinking is creating my own font, one letter per shape, using the Geometry section alone.  (See feeble attempt below.)  I'm thinking it'd be much easier for Visio to draw lines using simple geometry than to draw imported pictures from Inkscape or other sources.  The final file would also be much smaller, too.

   Scaling could be handled by slaving together the individual letter shapes, including any boxes interspersed with the "text" and the "text" within them.  Further, if I implement my own word wrapping routine, I could adjust the width or height of the outermost box and have its contents automatically wrap in an orderly manner.  Just what I need!

   Having said all that, I went looking on the web to see if someone had already made a stencil with a shape alphabet.  I found it—and guess where?  Right here on the forum in an 8-year-old post from none other than our own June The Second!  Much more sophisticated than what I need, but much more than enough to serve as a template for making my own characters.

   Great stuff!  I'm on my way!

   - Ken
Ken V. Krawchuk
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com

wapperdude

Doh!  My bad!!!  Completely for got about JuneTheSecond's post.  Yes!  That is a great tool he provided.

Apology to you and Junichi for the oversight.

Wapperdude
Visio 2019 Pro