Jump to content

Archived

This topic is now archived and is closed to further replies.

simcoweb

How to display font samples?

Recommended Posts

I'm in the process of creating a font display and download system but haven't any idea what is used for creating the realtime font examples where people type in some text in a form field and the text is displayed in the font they've chosen to sample. Here's a link to an example:

[url=http://fontso.com/font-preview.php?f=99666]http://fontso.com/font-preview.php?f=99666[/url]

Anyone have any idea what programming language this is done in?

Share this post


Link to post
Share on other sites
Wouldn't it be a case of having to install all of the fonts onto the server, and then using a dropdown in php or something to choose the font type, as the user selects it?

Share this post


Link to post
Share on other sites
The language is php using the GD library to generate images on demand.

http://ca.php.net/manual/en/function.imagefttext.php - how to create text

http://www.phpfreaks.com/tutorials/105/0.php - the phpfreaks tutorial

Share this post


Link to post
Share on other sites
AndyB, but in that example url I posted it doesn't appear to be using an image. It appears to be a textarea type display. In the font listings where it has 'Sample Text' next to each one I would assume that's using the GD library method. But the dynamic display of a string of text typed by the visitor is something else i'm assuming?

Share this post


Link to post
Share on other sites
Page 2 of the tutorial shows an image - http://www.phpfreaks.com/tutorials/105/1.php

The 'trick' is to have a simple form where the user selects a font and enters some short text and then pass the form entries to a script that retrieves the passed data, puts the font selected and the text string into the correct variable names and calls the image output.  It's simple stuff once you get the hang of it.

Share this post


Link to post
Share on other sites
Ok, cool. Just another note on that.. the sample url I pointed out...there's no submit button in the text field. The sample text being typed in just automatically displays in the large text area box. I can see it's an image now by right clicking on it (the displayed sample text). There must be some code that detects if the text field has anything present then goes ahead and displays it after a specific time delay. Any thoughts on that?

Share this post


Link to post
Share on other sites
view-source ... it's done with javascript and passes data to an image generator scriptlet

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.