* Respect the -density option when rendering a Postscript or PDF image.
* Distort barrel no longer complains when 3 arguments are given (reference
http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=15883).
+ * Support -direction left-to-right option.
2010-03-24 6.6.0-9 Glenn Randers-Pehrson <glennrp@image...>
* coders/png.c: Eliminated support of libpng versions older than 1.0.12.
<message name="UnrecognizedCompressType">
unrecognized compress type
</message>
+ <message name="UnrecognizedDirectionType">
+ unrecognized direction type
+ </message>
<message name="UnrecognizedDisposeMethod">
unrecognized dispose method
</message>
const char
*value;
+ double
+ direction;
+
DrawInfo
*annotate_info;
if (image->matte == MagickFalse)
(void) SetImageAlphaChannel(image,OpaqueAlphaChannel);
}
+ direction=1.0;
+ if (draw_info->direction == LeftToRightDirection)
+ direction=(-1.0);
point.x=0.0;
point.y=0.0;
for (p=draw_info->text; GetUTFCode(p) != 0; p+=GetUTFOctets(p))
{
utf8=ConvertLatin1ToUTF8((unsigned char *) draw_info->text);
if (utf8 != (unsigned char *) NULL)
- p=utf8;
+ p=(char *) utf8;
}
for (code=0; GetUTFCode(p) != 0; p+=GetUTFOctets(p))
{
if ((glyph.id != 0) && (last_glyph.id != 0))
{
if (draw_info->kerning != 0.0)
- origin.x+=64.0*draw_info->kerning;
+ origin.x+=64.0*direction*draw_info->kerning;
else
if (FT_HAS_KERNING(face))
{
status=FT_Get_Kerning(face,last_glyph.id,glyph.id,
ft_kerning_default,&kerning);
if (status == 0)
- origin.x+=kerning.x;
+ origin.x+=direction*kerning.x;
}
}
glyph.origin=origin;
if ((draw_info->interword_spacing != 0.0) &&
(IsUTFSpace(GetUTFCode(p)) != MagickFalse) &&
(IsUTFSpace(code) == MagickFalse))
- origin.x+=64.0*draw_info->interword_spacing;
+ origin.x+=64.0*direction*draw_info->interword_spacing;
else
- origin.x+=face->glyph->advance.x;
+ origin.x+=direction*face->glyph->advance.x;
metrics->origin.x=origin.x;
metrics->origin.y=origin.y;
if (last_glyph.id != 0)
clone_info->kerning=draw_info->kerning;
clone_info->interline_spacing=draw_info->interline_spacing;
clone_info->interword_spacing=draw_info->interword_spacing;
+ clone_info->direction=draw_info->direction;
if (draw_info->density != (char *) NULL)
(void) CloneString(&clone_info->density,draw_info->density);
clone_info->align=draw_info->align;
option=GetImageOption(clone_info,"interline-spacing");
if (option != (const char *) NULL)
draw_info->interline_spacing=StringToDouble(option);
+ draw_info->direction=1.0;
option=GetImageOption(clone_info,"interword-spacing");
if (option != (const char *) NULL)
draw_info->interword_spacing=StringToDouble(option);
+ option=GetImageOption(clone_info,"direction");
+ if (option != (const char *) NULL)
+ draw_info->direction=(DirectionType) ParseMagickOption(
+ MagickDirectionOptions,MagickFalse,option);
option=GetImageOption(clone_info,"fill");
if (option != (const char *) NULL)
(void) QueryColorDatabase(option,&draw_info->fill,exception);
LineThroughDecoration
} DecorationType;
+typedef enum
+{
+ UndefinedDirection,
+ RightToLeftDirection,
+ LeftToRightDirection
+} DirectionType;
+
typedef enum
{
UndefinedRule,
double
kerning,
interword_spacing,
- interline_spacing;
+ interline_spacing,
+ direction;
} DrawInfo;
typedef struct _PrimitiveInfo
{ "Underline", (long) UnderlineDecoration, MagickFalse },
{ (char *) NULL, (long) UndefinedDecoration, MagickFalse }
},
+ DirectionOptions[] =
+ {
+ { "right-to-left", (long) RightToLeftDirection, MagickFalse },
+ { "left-to-right", (long) LeftToRightDirection, MagickFalse },
+ { (char *) NULL, (long) UndefinedDirection, MagickFalse }
+ },
DisposeOptions[] =
{
{ "Background", (long) BackgroundDispose, MagickFalse },
case MagickDataTypeOptions: return(DataTypeOptions);
case MagickDebugOptions: return(LogEventOptions);
case MagickDecorateOptions: return(DecorateOptions);
+ case MagickDirectionOptions: return(DirectionOptions);
case MagickDisposeOptions: return(DisposeOptions);
case MagickDistortOptions: return(DistortOptions);
case MagickDitherOptions: return(DitherOptions);
MagickDebugOptions,
MagickDecorateOptions,
MagickDelegateOptions,
+ MagickDirectionOptions,
MagickDisposeOptions,
MagickDistortOptions,
MagickDitherOptions,
\-delay value display the next image after pausing
\-density geometry horizontal and vertical density of the image
\-depth value image depth
+ \-direction type render text right-to-left or left-to-right
\-display server get image or font from this X server
\-dispose method layer disposal method
\-dither method apply error diffusion to image
\-delay value display the next image after pausing
\-density geometry horizontal and vertical density of the image
\-depth value image depth
+ \-direction type render text right-to-left or left-to-right
\-display server get image or font from this X server
\-dispose method layer disposal method
\-dither method apply error diffusion to image
"-delay value display the next image after pausing",
"-density geometry horizontal and vertical density of the image",
"-depth value image depth",
+ "-direction type render text right-to-left or left-to-right",
"-display server get image or font from this X server",
"-dispose method layer disposal method",
"-dither method apply error diffusion to image",
}
if (LocaleCompare("despeckle",option+1) == 0)
break;
+ if (LocaleCompare("direction",option+1) == 0)
+ {
+ long
+ direction;
+
+ if (*option == '+')
+ break;
+ i++;
+ if (i == (long) argc)
+ ThrowConvertException(OptionError,"MissingArgument",option);
+ direction=ParseMagickOption(MagickDirectionOptions,MagickFalse,
+ argv[i]);
+ if (direction < 0)
+ ThrowConvertException(OptionError,"UnrecognizedDirectionType",
+ argv[i]);
+ break;
+ }
if (LocaleCompare("display",option+1) == 0)
{
if (*option == '+')
"-delay value display the next image after pausing",
"-density geometry horizontal and vertical density of the image",
"-depth value image depth",
+ "-direction type render text right-to-left or left-to-right",
"-display server get image or font from this X server",
"-dispose method layer disposal method",
"-dither method apply error diffusion to image",
break;
if (LocaleCompare("dft",option+1) == 0)
break;
+ if (LocaleCompare("direction",option+1) == 0)
+ {
+ long
+ direction;
+
+ if (*option == '+')
+ break;
+ i++;
+ if (i == (long) argc)
+ ThrowMogrifyException(OptionError,"MissingArgument",option);
+ direction=ParseMagickOption(MagickDirectionOptions,MagickFalse,
+ argv[i]);
+ if (direction < 0)
+ ThrowMogrifyException(OptionError,"UnrecognizedDirectionType",
+ argv[i]);
+ break;
+ }
if (LocaleCompare("display",option+1) == 0)
{
if (*option == '+')
image_info->depth=StringToUnsignedLong(argv[i+1]);
break;
}
+ if (LocaleCompare("direction",option+1) == 0)
+ {
+ if (*option == '+')
+ {
+ (void) SetImageOption(image_info,option+1,"undefined");
+ break;
+ }
+ (void) SetImageOption(image_info,option+1,argv[i+1]);
+ break;
+ }
if (LocaleCompare("display",option+1) == 0)
{
if (*option == '+')