Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



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

Posts: 30
Trades: 0
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
 
 
Register now for full access!
Old 06-03-2006, 11:58 PM Re: Javascript font validation
funkdaddu's Avatar
Web Design Snob

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

Posts: 30
Trades: 0
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, 09:16 AM Re: Javascript font validation
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
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!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 06-04-2006, 06:16 PM Re: Javascript font validation
shane.carr's Avatar
Experienced Talker

Posts: 30
Trades: 0
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 04:46 AM..
shane.carr is offline
Reply With Quote
View Public Profile
 
Old 08-02-2006, 08:31 PM Re: Javascript font validation
shane.carr's Avatar
Experienced Talker

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

Posts: 635
Trades: 0
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, 09:32 PM Re: Javascript font validation
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
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, 11:32 PM Re: Javascript font validation
shane.carr's Avatar
Experienced Talker

Posts: 30
Trades: 0
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 Search this Thread
Search this Thread:

Advanced Search

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

BB 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.31258 seconds with 12 queries