Jump to content


Photo

How to display font samples?


  • Please log in to reply
6 replies to this topic

#1 simcoweb

simcoweb
  • Members
  • PipPipPip
  • Advanced Member
  • 1,102 posts
  • LocationCA

Posted 04 September 2006 - 08:01 PM

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:

http://fontso.com/fo...iew.php?f=99666

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



#2 Stevis2002

Stevis2002
  • Members
  • PipPipPip
  • Advanced Member
  • 98 posts

Posted 04 September 2006 - 08:04 PM

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?

#3 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 04 September 2006 - 08:11 PM

The language is php using the GD library to generate images on demand.

http://ca.php.net/ma...imagefttext.php - how to create text

http://www.phpfreaks...rials/105/0.php - the phpfreaks tutorial
Legend has it that reading the manual never killed anyone.
My site

#4 simcoweb

simcoweb
  • Members
  • PipPipPip
  • Advanced Member
  • 1,102 posts
  • LocationCA

Posted 04 September 2006 - 08:14 PM

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?

#5 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 04 September 2006 - 08:22 PM

Page 2 of the tutorial shows an image - http://www.phpfreaks...rials/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.
Legend has it that reading the manual never killed anyone.
My site

#6 simcoweb

simcoweb
  • Members
  • PipPipPip
  • Advanced Member
  • 1,102 posts
  • LocationCA

Posted 04 September 2006 - 08:25 PM

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?

#7 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 04 September 2006 - 08:42 PM

view-source ... it's done with javascript and passes data to an image generator scriptlet
Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users