Index: image_captcha/image_captcha-rtl.css
===================================================================
RCS file: image_captcha/image_captcha-rtl.css
diff -N image_captcha/image_captcha-rtl.css
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ image_captcha/image_captcha-rtl.css	29 Nov 2010 01:12:54 -0000
@@ -0,0 +1,14 @@
+/* $Id$ */
+
+/**
+ * Styling of the font selection list (with previews)
+ * on the Image CAPTCHA settings page.
+ */
+
+/**
+ * Float the fonts with preview (with a fixed width)
+ * to create a multi-column layout.
+ */
+.image_captcha_admin_font_preview {
+  float: right;
+}
Index: image_captcha/image_captcha.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/captcha/image_captcha/image_captcha.admin.inc,v
retrieving revision 1.30.2.1
diff -u -b -u -p -r1.30.2.1 image_captcha.admin.inc
--- image_captcha/image_captcha.admin.inc	16 Mar 2010 21:09:17 -0000	1.30.2.1
+++ image_captcha/image_captcha.admin.inc	29 Nov 2010 01:12:55 -0000
@@ -59,6 +59,17 @@ function image_captcha_settings_form() {
     '#default_value' => (int) variable_get('image_captcha_code_length', 5),
     '#description' => t('The code length influences the size of the image. Note that larger values make the image generation more CPU intensive.'),
   );
+  // RTL support option (only show this option when there are RTL languages).
+  $languages = language_list('direction');
+  if ($languages[1]) {
+    $form['image_captcha_code_settings']['image_captcha_rtl_support'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('RTL support'),
+      '#default_value' => variable_get('image_captcha_rtl_support', 0),
+      '#description' => t('Enable this option to render the code from right to left for right to left languages.'),
+    );
+  }
+
 
   // Font related stuff.
   $form['image_captcha_font_settings'] = _image_captcha_settings_form_font_section();
Index: image_captcha/image_captcha.user.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/captcha/image_captcha/image_captcha.user.inc,v
retrieving revision 1.25
diff -u -b -u -p -r1.25 image_captcha.user.inc
--- image_captcha/image_captcha.user.inc	30 Jan 2010 21:53:13 -0000	1.25
+++ image_captcha/image_captcha.user.inc	29 Nov 2010 01:12:55 -0000
@@ -93,8 +93,12 @@ function _image_captcha_generate_image($
   }
   imagefilledrectangle($image, 0, 0, $width, $height, $background_color);
 
+  // Do we need to draw in RTL mode?
+  global $language;
+  $rtl = $language->direction && ((bool) variable_get('image_captcha_rtl_support', 0));
+
   // draw text
-  $result = _image_captcha_image_generator_print_string($image, $width, $height, $fonts, $font_size, $code);
+  $result = _image_captcha_image_generator_print_string($image, $width, $height, $fonts, $font_size, $code, $rtl);
   if (!$result) {
     return FALSE;
   }
@@ -227,7 +231,7 @@ function _image_captcha_image_generator_
 /**
  * Helper function for drawing text on the image.
  */
-function _image_captcha_image_generator_print_string(&$image, $width, $height, $fonts, $font_size, $text) {
+function _image_captcha_image_generator_print_string(&$image, $width, $height, $fonts, $font_size, $text, $rtl=FALSE) {
   // get characters
   $characters = _image_captcha_utf8_split($text);
   $character_quantity = count($characters);
@@ -257,6 +261,9 @@ function _image_captcha_image_generator_
   foreach ($characters as $c => $character) {
     // initial position of character: in the center of its cage
     $center_x = ($c + 0.5) * $ccage_width;
+    if ($rtl) {
+      $center_x = $width - $center_x;
+    }
     $center_y = 0.5 * $height;
 
     // Pick a random font from the list.
