Log in

View Full Version : Live preview of fonts



ellinor
04-10-2007, 09:31 PM
Hi,
I have a font shop, and I must admit I'm very jealous of the font sites that has this "type in your text and preview the font" script. I have come as far as realizing the font must be installed on the server along with the freetype library, but then what? Is there a ready made script? I am definately missing out on something :) I will be grateful for any help to solving this matter....

Ellinor

ellinor
04-10-2007, 10:35 PM
http://www.kevinroth.com/rte/demo.htm

This rich text editor would be fine to begin with, but how do I call the fonts installed on a server? If I put the ttf's in a folder named fonts how can I add them to this script?

The code where the font selection is looks like this:
document.writeln(' <select id="fontname_' + rte + '" onchange="selectFont(\'' + rte + '\', this.id)">');
document.writeln(' <option value="Font" selected>[Font]</option>');
document.writeln(' <option value="Arial, Helvetica, sans-serif">Arial</option>');
document.writeln(' <option value="Courier New, Courier, mono">Courier New</option>');
document.writeln(' <option value="Times New Roman, Times, serif">Times New Roman</option>');
document.writeln(' <option value="Verdana, Arial, Helvetica, sans-serif">Verdana</option>');
document.writeln(' </select>');



document.writeln(' <option value="Font" selected>[Font]</option>');
document.writeln(' <option value="Arial, Helvetica, sans-serif">Arial</option>');
document.writeln(' <option value="Courier New, Courier, mono">Courier New</option>');
document.writeln(' <option value="Times New Roman, Times, serif">Times New Roman</option>');
document.writeln(' <option value="Verdana, Arial, Helvetica, sans-serif">Verdana</option>');
document.writeln(' </select>');



document.writeln(' <select id="fontname_' + rte + '" onchange="selectFont(\'' + rte + '\', this.id)">');
document.writeln(' <option value="Font" selected>[Font]</option>');
document.writeln(' <option value="Arial, Helvetica, sans-serif">Arial</option>');
document.writeln(' <option value="Courier New, Courier, mono">Courier New</option>');
document.writeln(' <option value="Times New Roman, Times, serif">Times New Roman</option>');
document.writeln(' <option value="Verdana, Arial, Helvetica, sans-serif">Verdana</option>');

Twey
04-10-2007, 11:06 PM
You're barking up the wrong tree, I'm afraid. You need a server-side script to generate an image with the text using the specified font. See this tutorial (http://www.phpfreaks.com/tutorials/105/0.php) for one way (using PHP and GD) to do this.