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.23 diff -u -b -u -p -r1.23 image_captcha.user.inc --- image_captcha/image_captcha.user.inc 15 Dec 2009 23:53:37 -0000 1.23 +++ image_captcha/image_captcha.user.inc 16 Dec 2009 00:02:07 -0000 @@ -94,7 +94,9 @@ function _image_captcha_generate_image($ imagefilledrectangle($image, 0, 0, $width, $height, $background_color); // draw text - $result = _image_captcha_image_generator_print_string($image, $width, $height, $fonts, $font_size, $code); + global $language; + $rtl = (defined('LANGUAGE_RTL') && $language->direction == LANGUAGE_RTL); // @todo: the check if LANGUAGE_RTL is defined can be dropped for Drupal 7. + $result = _image_captcha_image_generator_print_string($image, $width, $height, $fonts, $font_size, $code, $rtl); if (!$result) { return FALSE; } @@ -227,7 +229,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 +259,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.