Reply
Javascript font validation
Old 06-03-2006, 09:06 PM Javascript font validation
shane.carr's Avatar
Experienced Talker

Posts: 30
How do I check if the string contained in a variable is a valid font on the user's system?
shane.carr is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 06-03-2006, 10:58 PM Re: Javascript font validation
funkdaddu's Avatar
Web Design Snob

Posts: 636
JS strings don't contain font information.
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 06-04-2006, 02:01 AM Re: Javascript font validation
shane.carr's Avatar
Experienced Talker

Posts: 30
Can I turn the JS string into something that would contain font information?
shane.carr is offline
Reply With Quote
View Public Profile
 
Old 06-04-2006, 08:16 AM Re: Javascript font validation
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Or do you mean for example that a variable would contain "Trebuchet MS" and you want to check if "Trebuchet MS" is available on the client system?
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"
Inoxia Pyrotechnics Supplies | Surrey Angels Cheerleading Squad
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 06-04-2006, 05:16 PM Re: Javascript font validation
shane.carr's Avatar
Experienced Talker

Posts: 30
Quote:
Originally Posted by Minaki
Or do you mean for example that a variable would contain "Trebuchet MS" and you want to check if "Trebuchet MS" is available on the client system?
Yes, that's it!

Last edited by shane.carr : 06-08-2006 at 03:46 AM.
shane.carr is offline
Reply With Quote
View Public Profile
 
Old 08-02-2006, 07:31 PM Re: Javascript font validation
shane.carr's Avatar
Experienced Talker

Posts: 30
... ...
shane.carr is offline
Reply With Quote
View Public Profile
 
Old 08-02-2006, 08:01 PM Re: Javascript font validation
funkdaddu's Avatar
Web Design Snob

Posts: 636
Not as far as I can tell. If you want to use a certain font, use CSS and you can have fall-back:
Code:
.myClass {
font-family: Futura, Helvetica, serif
}
Put your preferred fonts first, then end with serif, san-serif, monospace, depending on the font variant you were hoping for. so that there will always be a preferred font.
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 08-02-2006, 08:32 PM Re: Javascript font validation
funkdaddu's Avatar
Web Design Snob

Posts: 636
Though I did find this: Fonts Collection (Dialog Helper)

But it's IE only.
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 08-02-2006, 10:32 PM Re: Javascript font validation
shane.carr's Avatar
Experienced Talker

Posts: 30
Thanks! My code (btw) is

Code:
function font(whatopenf, whatmiddlef, whatclosef) {
	var whatfontf = prompt("Font:", "Enter the font's EXACT name (like 'Courier New' rather than 'cuorier-nwe')")
	if(whatfontf != null){
		var whattextf = prompt("Text to format to the font \""+whatfontf+"\":", "")
		if(whattextf != null){
			if(whatfontf != null){
				insertAtCursor(whatopenf + '"' + whatfontf + '"' + whatmiddlef + whattextf + whatclosef)
			}
		}
	}
}
So I wanted to make sure the entered font was valid. At least I'll be able to check it in IE now.


Also, is there a way to display a combo box in something that works like prompt()?
shane.carr is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Javascript font validation
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.22384 seconds with 12 queries