How can I display the mirror image of text in a textbox?

How can I display the mirror image of text in a textbox?
(preferably an annotation textbox object but a simple text object would work too. using an image of text is less than ideal)
Seems like this should be easy, but I can't find anything on how to do it.

 Accepted Answer

Have you tried downloading and installing one of the "backwards" fonts available on many font sites and setting the 'FontName' property of your text object to that font name? I just tested it out and it seemed to work.
plot(0:pi/6:2*pi,sin(0:pi/6:2*pi));
t = text(.5,.25,fliplr('test'));
set(t,'FontName','backwards')
I used the backwards font found here: http://www.fontspace.com/category/backwards

2 Comments

Good idea, it never occurred to me that there are backwards fonts.
Yep. You can find most any font you can think of. The only drawback is that the user will have to have the font installed on their system for it to work properly.

Sign in to comment.

More Answers (2)

doc fliplr

5 Comments

Sam
Sam on 6 Aug 2013
Edited: Sam on 6 Aug 2013
i should add in case it is confusing: a mirror image is not the same as changing the order of the characters...
fliplr would work if i merely wanted "hello" to read as "olleh"--but that is not a reflection of hello
Which is just a character string...which is just an array of char()
figure, plot(1:10);
h=annotation('textbox', [.2 .4 .1 .1], 'String', 'Straight Line Plot 1 to 10');
set(h,'string',fliplr(get(h,'string')))
If multi-line cell, then char() it and back to cell...
I think you are confusing the reversal of order--which of course is easy enough with fliplr--with mirror reflection. Imagine how a word looks in a mirror--or check it out yourself--the characters are not only reversed in right-to-left order, they are also reflected across their own vertical axes: http://en.wikipedia.org/wiki/Mirror_writing.
Well, that is imaging, then, not texting as IA points out.
yes, well, there are numerous bug reports in which axis label text displays mirrored (in the sense of reflection)--e.g. http://www.mathworks.com/matlabcentral/answers/30925-mirrored-axes-labels-with-imagesc
these seem to be solved by changing the graphics renderer...
so, one would think that there might be some undocumented parameter that could be tweaked to replicate this effect.

Sign in to comment.

I think you need to create an image with the text on it, then you can use flipud() or fliplr() to create the mirror image. If you have the Computer Vision System Toolbox, you can use insertText. http://www.mathworks.com/help/vision/ref/inserttext.html to stamp your text onto an image ("burn it in").

1 Comment

Yeah, this would work, thanks. Although I was hoping there was a way to do it without using images.

Sign in to comment.

Categories

Find more on Convert Image Type in Help Center and File Exchange

Tags

Asked:

Sam
on 6 Aug 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!