Articles Archive
Articles Search
Director Wiki

Superscript in Text members

April 23, 2000
by Pat McClellan

Dear Multimedia Handyman,

Do you know of any font that contains the Service Mark character? I can get the trademark and copyright symbols, but I can't find anything with the service mark. If not, do you have any creative ideas for my dilemma?


Dear Will,

The service mark (for those who don't know) is typically a small "SM" done in superscript, like this SM. As you point out, many of the more common "special" characters like a copyright and the trademark symbols are available in many fonts by simply using the Alt or Option key in combination. I guess service marks aren't as common because I couldn't find one in any of the typical fonts that would be found on a user's computer.

One possibility would be to use Fontographer to create your own font -- actually, you'd probably just import a font into Fontographer and then create the single SM character. Then, you could embed that new font into your Director cast and you'd be set. Still, that's a real pain, especially if you've never used Fontographer.

Fortunately, there's an easier way. You'll note above that I had no trouble creating the superscript service mark here in the html of this article. That's accomplished using a tag that looks like this:


You may have read Gary Rosenzweig's article about creating HTML tables in your Director cast members. That makes use of the html property of any Director text member. That's also the approach I'd suggest here -- only it's much easier than building tables. I'll show you and example.

Create a text member in your Director cast and type something into it. I called my text member "example". Now, in the message window, put the html of the member:

put member("example").html
-- "<html>
<body bgcolor="#FFFFFF">
<font face="Times, Times New Roman">I need 
  to insert the servicemark here SM.</font></body>

As you can see, the html of the text member includes the typical html tags. So, even though there's no control in the text window for creating superscript (like for exponents), we can accomplish it with html. Insert the superscript tag around the SM and set the html of the member to the new html.

member("example").html = "<html><head><title>Untitled</title></head><body bgcolor=#FFFFFF><font face='Times, Times New Roman'>I need to insert the servicemark here<font size = -2><sup>SM</sup></font>.</font></body></html>"

Note two important things: the value that we set the html of that member to is a string (contained in quotes). That means that the actual string can't have quotes inside of it. If you look at the code which was output above, there are quotes around the bgcolor value ("#FFFFFF") as well as around the name of the font. The quotes aren't needed in either case. The second thing is that you'll probably want the superscript to be a smaller font size. That's why I inserted the font size tag.

That should solve your problem. You'll probably want to make a utility handler to parse through the text fields, inserting the tags where you need them. This is especially the case if you'll be building text fields dynamically at runtime.

While we're on the topic of text members, I'd like to point out a seldomly mentioned new feature in Director 8. There's a new movie property called "editShortCutsEnabled". The default value is TRUE (1), and this allows users to copy, cut, and paste text in editable text members -- just like in a word processor. Again, the default is TRUE for D8 movies, but false for previous versions of Director.

Good luck with your program.

Patrick McClellan is Director Online's co-founder. Pat is Vice President, Managing Director for Jack Morton Worldwide, a global experiential marketing company. He is responsible for the San Francisco office, which helps major technology clients to develop marketing communications programs to reach enterprise and consumer audiences.

Copyright 1997-2019, Director Online. Article content copyright by respective authors.