Index: image_captcha.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/captcha/image_captcha/image_captcha.admin.inc,v
retrieving revision 1.21
diff -u -r1.21 image_captcha.admin.inc
--- image_captcha.admin.inc	27 Aug 2009 21:52:27 -0000	1.21
+++ image_captcha.admin.inc	10 Sep 2009 16:34:07 -0000
@@ -12,7 +12,7 @@
 function _image_captcha_available_fonts() {
   $available_fonts = array('BUILTIN' => t('Built-in font'));
   $fontsdirectories = array(
-    drupal_get_path('module', 'image_captcha') .'/fonts',
+    variable_get('image_captcha_font_path', drupal_get_path('module', 'image_captcha') .'/fonts'),
     file_directory_path(),
   );
   foreach ($fontsdirectories as $fontsdirectory) {
@@ -78,6 +78,12 @@
     '#type' => 'fieldset',
     '#title' => t('Font settings'),
   );
+  $form['image_captcha_font_settings']['image_captcha_font_path'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Fonts directory path'),
+    '#default_value' => variable_get('image_captcha_font_path', drupal_get_path('module', 'image_captcha') .'/fonts'),
+    '#description' => t('The path to TrueType fonts on your system.  The default is !path', array('path' => drupal_get_path('module', 'image_captcha') .'/fonts')),
+  );
   $available_fonts = _image_captcha_available_fonts();
   list($default_font, $errno) = _image_captcha_get_font();
   $form['image_captcha_font_settings']['image_captcha_font'] = array(
@@ -280,4 +286,10 @@
   if (!preg_match('/^#([0-9a-fA-F]{3}){1,2}$/', $form_state['values']['image_captcha_foreground_color'])) {
     form_set_error('image_captcha_foreground_color', t('Text color is not a valid hexadecimal color value.'));
   }
+  if (!is_dir($form_state['values']['image_captcha_font_path'])) {
+    form_set_error('image_captcha_font_path', t('You must choose a valid path.  The default is !path', array('!path' => drupal_get_path('module', 'image_captcha') .'/fonts')));
+  }
+  elseif (!file_scan_directory($form_state['values']['image_captcha_font_path'], '\.[tT][tT][fF]$')) {
+    drupal_set_message(t('No fonts were found in the specified directory.  Please ensure that you have chosen a directory containing TrueType (TTF) fonts.'), 'warning');
+  }
 }

