PDA

View Full Version : Mixed fonts in one textField


figgs
04-08-2003, 05:52 PM
This may be a ridiculous question, but....

Is there any way of setting the text of one part of a string to one font and another part to a different one and display them both in the same textField? Alternatively, is it possible to set an image in line in a dynamic textField.

I am working on a project for iTV, and I need to tell the user to "Press the 'i' button..." on their remote, and the representation of a lowercase 'i' in webdings font would look better as it looks more like the actual remote control button. However I don't want all the text in webdings, and the text needs to be replaced dynamically.

Any ideas greatly appreciated - even if it is to tell me that this is simply impossible.

Cheers,
figgs

mad_A
04-08-2003, 06:33 PM
Just make the text field html and use font tags.

mad_A
04-08-2003, 06:34 PM
To align an image you would need to write code to calculate the current position of the text and set the x and y of the image to change when the text is scrolled.
It can be done, but it is a nightmare!:(

figgs
04-10-2003, 03:59 PM
Thanks Andy,

didn't think of that....

still learnin' :)

mad_A
04-10-2003, 04:19 PM
:D Glad to be of help!

lbower
04-10-2003, 04:55 PM
To change a portion of the font inside a text field, use the following code:

textField.text = "Today is April 10, 2003.";
changeFormat = new TextFormat();
changeFormat.font = "webdings";
textField.setTextFormat(9, 15, changeFormat);
where 9 represents the location in the string where you want the webdings font to start, and 15 respresents the location where you want the webdings font to stop. In this example, all text will be in Arial, except the word April, which will display as webdings.

figgs
04-10-2003, 05:32 PM
Thanks lbower for your solution.

this works a treat for what seems to be every font except, curiously, Webdings. I can use webdings in a static text field and I have tried referring to it as "Webdings", "webdings" and "webding" etc.... all other fonts work, just not this one :confused:

think i'll go back to my workaround
thanks anyhoo...
figgs