Mirror or reverse writing?

Is it possible to have reverse/mirror writing/text in Inform?

You can use a phrase like this to reverse a bit of text:

To decide what text is (T - text) reversed:
	let N be the number of characters in T;
	let R be "";
	repeat with I running from 1 to N:
		let X be character number I in T;
		now R is "[X][R]";
	decide on R.

It doesn’t do anything about the case of the characters or punctuation. (There’s also a noticeable delay for sentence-length text.)

It’s called like this:

Instead of examining the mirror:
      say the description of the mirror reversed.

Thanks! Is it possible to reverse just one letter? I have a place called the Error Bar Cafe and I want the second r in error to be reversed.

That would be a function of the font. You could use a Unicode character from the Cyrillic alphabet (I forget what the character’s called).

You can use Unicode characters like ɿ or Я, but that won’t play nicely with screenreaders, and not all fonts will necessarily show them. You can also use CSS transforms, which gets around both of these issues but requires you to mess around with the interpreter (or use Vorple).

Is it possible to detect whether a screenreader is being used, and change the name to “ERROЯ” or “ERROR” depending?

I don’t know of any reliable way; I just have an option on the main menu that can be toggled on and off, to increase screenreader support.

If you’re just trying to have the word “error” be erroneous in the Error Cafe, it’s much simpler to call it “Erorr Cafe” or “Erore Cafe” or “Orrer Cafe” or “Rorre Cafe” or something like that.

1 Like