Closed (fixed)
Project:
CAPTCHA
Version:
6.x-1.0-rc2
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
24 Sep 2008 at 19:51 UTC
Updated:
25 Sep 2008 at 12:55 UTC
Image captcha works with built in font but the characters are not readable. Reducing distortion does not make them readable. I added Dejaview fonts and get an image file of zero bytes. I tested the default settings, several Dejaview fonts and the dev version of Image captcha. They all fail to produce an image. There are no error messages in Drupal.
Can you set the default font to a larger size?
Is there another font library that works?
Comments
Comment #1
peterx commentedOne of the other issues mentioned problems with a specific font. I tried the Gentium fonts and they did not work.
Comment #2
soxofaan commentedYou probably don't have support for TTF fonts
please check #183608: Add requirement check for GD Library when using Image CAPTCHA to debug your problem, especially this code
About the built in font: it's already used at the larged size
it's a very simple font that is included in PHP, but it prvides only like five sizes
you can make the characters more readable by reducing the distortion
Comment #3
peterx commentedGD has 'FreeType Support' => false despite setting it on in WHM. I will investigate.
What sort of license is needed to include a font with Image captcha?
What sort of font file and licence needed to include in PHP?
Comment #4
soxofaan commentedI'm not sure why you are asking this.
As a webmaster who uses the Image CAPTCHA module, you generally don't have to worry about the licence of the font, because the image you send to your visitors is just a bitmap representation, you are not distributing the font file itself.
The problem is different for us, the developers of the Image CAPTCHA: we can not just provide a font included with the module, because that sort of (re)distribution violates most licenses used for fonts.
Or do you raise the question because you want to contribute a redistributable font for use with the Image CAPTCHA?
I don't understand what you mean with "include in PHP"
Comment #5
peterx commentedThere are a lot of people making free fonts under various licences. The Bitstream Vera true type font, http://www.gnome.org/fonts/, has a BSD style licence allowing both inclusion and redistribution. You could include the font by renaming the text files to Vera.*, for example readme.txt to Vera.readme.txt, or you could include the whole Vera directory as a subdirectory and include fonts from subdirectories.
I think the built in PHP fonts you mention are probably the fonts built into GD. You could generate the text as an image then double the text size using imagecopyresized then apply the distortion.
GD provides a bit mapped font load system but they chose to use a weird file definition that stops the file working on all computers. Supplying an external bitmap for a larger font is not an option unless you create the font in at least two formats.
The ISP WHM settings problem is passed to our ISP. Cpanel will not let me report the problem direct so I have to tell the ISP then wait. I will result the result here for anyone with the same WHM/Cpanel settings problem. A short explanation so VPS and Cpanel users will understand the problem.
When you rent a VPS and choose Cpanel, the first part is WHM to control all the sites. You compile PHP in WHM, not Cpanel, and the settings apply to every site in the VPS. Cpanel is the control software you see when you enter an individual site and gives you control over some settings for the site but not over the options compiled into PHP. WHM has an Apache update option that also compiles PHP. You choose PHP settings then PHP advanced settings then switch on GD and switch on TTF (FreeType). Many people switch on GD but not TTF because TTF is labelled FreeType instead of True Type.
In my case TTF is switched on but the setting is not working with GD to switch on the GD True Type option. If I manually compile PHP, I lose the automated WHM compilation. I also had the same setup on a VPS at a different ISP and on their server, the True Type fonts used to work. Perhaps it is an error in the latest Cpanel code.
Comment #6
peterx commentedMy mistake or a browser/javascript/mouse error. I changed the setting in WHM then compiled Apache/PHP and the change did not occur. I was also changing some other settings and somehow the TTF setting did not stick. I went back and changed just that one setting, compiled, and everything worked.
On the font side, I used DejaVuSerif with the default settings and 5 characters appeared crisp and clean. 6 characters just fit. I had to remove a couple of characters because they were too easy to confuse with numbers. The Bitstream Vera font works beautifully with the default setting and should be considered for the default inclusion.
Comment #7
soxofaan commentedconcerning the inclusion of a TrueType font with the CAPTCHA module distribution:
see #259219: provide a better default font for image CAPTCHA