Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Viewing TTF fonts using JavaScript

Status
Not open for further replies.

SgtBadass

MIS
Jul 16, 2002
19
GB
I'm looking for a way of having the user input some text, then choose a TTF font and size from a drop down and click a button to show the text in another part of the page rendered in the font and size.

Anyone know how this is done or got a pointer to a tutorial or example?
 
Yes - you would access the style property of the element that contains their text. Something like (pseudo-code):
Code:
var yourEl = <get a pointer to your element>
...
yourEl.style.fontSize = <set the font size>
yourEl.style.fontFamily = <set the font family here>
...

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top