Hi All.
I want to allow users to select a font using a dropdown box. As every body has different fonts installed, how do I read the available fonts. I know this will be a very long list, but will not be used very often. I will store the selected font and size on a database for later use.

6 Years
Discussion Span
Last Post by ArtistScope

I think that you need to stick to common fonts because you can't find out what fonts they may have installed, and if you could then you might have a list of too many fonts, some of which may not display on a web page. For example, on my computer I have hundreds of fonts installed, so you can imagine the trouble that you can get into.

As for loading a font to be used in a web page, that's no problem, but initially you don't need to use a database at all if you can write the font name to a cookie, which may be better because the user gets the same font loaded when they return.

So all you need to do is create a dropdown in a form with some font names listed. Use a submit button or an onchange statement to submit the new info to the same page for the page to load the font.

<script type="text/JavaScript">
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  if (restore) selObj.selectedIndex=0;
strFont = request("Font")
if strFont <> "" then
    response.cookies (Font)("Style") = strFont
end if

if Request.Cookies(Font) <> "" then
   strFontSet = Request.Cookies(Font)("Style")
   strFontSet = "Tahoma"    'set a default font
end if

<form action="">
<select name="Font" size="1" onchange="MM_jumpMenu('parent',this,0)">
<option value="Arial">Arial</option>
<option value="Verdana">Verdana</option>
<font face="<%= strFontSet %>">This is my text</font>

I didn't test this code, but it should give the idea.

Edited by ArtistScope: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.