#if defined(MAGICKCORE_RAQM_DELEGATE)
#include <raqm.h>
#endif
-typedef enum
-{
- GRAPHEME_DIRECTION_DEFAULT,
- GRAPHEME_DIRECTION_RTL,
- GRAPHEME_DIRECTION_LTR,
- GRAPHEME_DIRECTION_TTB
-} GraphemeDirection;
-
typedef struct _GraphemeInfo
{
- int
+ size_t
index,
x_offset,
x_advance,
y_offset;
- unsigned int
+ size_t
cluster;
} GraphemeInfo;
\f
#if defined(MAGICKCORE_FREETYPE_DELEGATE)
-static size_t ComplexTextLayout(const Image *image,const char *text,
- const size_t length,const FT_Face face,const GraphemeDirection direction,
- const FT_Int32 flags,GraphemeInfo **grapheme,ExceptionInfo *exception)
+static size_t ComplexTextLayout(const Image *image,const DrawInfo *draw_info,
+ const char *text,const size_t length,const FT_Face face,const FT_Int32 flags,
+ GraphemeInfo **grapheme,ExceptionInfo *exception)
{
#if defined(MAGICKCORE_RAQM_DELEGATE)
const char
*features;
- int
- i;
-
- size_t
- count;
-
raqm_t
*rq;
raqm_glyph_t
*glyphs;
+ register size_t
+ i;
+
+ ssize_t
+ count;
+
count=0;
rq=raqm_create();
if (rq == (raqm_t *) NULL)
goto cleanup;
if (raqm_set_text_utf8(rq,text,length) == 0)
goto cleanup;
- if (raqm_set_par_direction(rq,(raqm_direction_t) direction) == 0)
+ if (raqm_set_par_direction(rq,(raqm_direction_t) draw_info->direction) == 0)
goto cleanup;
if (raqm_set_freetype_face(rq,face) == 0)
goto cleanup;
quote,
*token;
- TokenInfo
- *token_info;
-
int
next,
status_token;
+ TokenInfo
+ *token_info;
+
next=0;
token_info=AcquireTokenInfo();
- token=(char *) AcquireQuantumMemory(50,sizeof(*token));
+ token=AcquireString("");
status_token=Tokenizer(token_info,0,token,50,features,"",",","",'\0',
&breaker,&next,"e);
while (status_token == 0)
count=0;
goto cleanup;
}
- for (i = 0; i < count; i++)
+ for (i=0; i < (ssize_t) count; i++)
{
(*grapheme)[i].index=glyphs[i].index;
(*grapheme)[i].x_offset=glyphs[i].x_offset;
raqm_destroy(rq);
return(count);
#else
+ const char
+ *p;
+
FT_Error
ft_status;
ssize_t
last_glyph;
- const char
- *p;
-
/*
Simple layout for bi-directional text (right-to-left or left-to-right).
*/
p=text;
for (i=0; GetUTFCode(p) != 0; p+=GetUTFOctets(p), i++)
{
- (*grapheme)[i].index=FT_Get_Char_Index(face,GetUTFCode(p));
+ (*grapheme)[i].index=(ssize_t) FT_Get_Char_Index(face,GetUTFCode(p));
(*grapheme)[i].x_offset=0;
(*grapheme)[i].y_offset=0;
if (((*grapheme)[i].index != 0) && (last_glyph != 0))
ft_status=FT_Get_Kerning(face,last_glyph,(*grapheme)[i].index,
ft_kerning_default,&kerning);
if (ft_status == 0)
- (*grapheme)[i-1].x_advance+=(FT_Pos) ((direction ==
- GRAPHEME_DIRECTION_RTL ? -1.0 : 1.0)*kerning.x);
+ (*grapheme)[i-1].x_advance+=(FT_Pos) ((draw_info->direction ==
+ RightToLeftDirection ? -1.0 : 1.0)*kerning.x);
}
}
ft_status=FT_Load_Glyph(face,(*grapheme)[i].index,flags);
glyph,
last_glyph;
- GraphemeDirection
- direction;
-
GraphemeInfo
*grapheme;
p=(char *) utf8;
}
status=MagickTrue;
- direction=GRAPHEME_DIRECTION_DEFAULT;
- if (draw_info->direction == RightToLeftDirection)
- direction=GRAPHEME_DIRECTION_RTL;
- else
- if (draw_info->direction == LeftToRightDirection)
- direction=GRAPHEME_DIRECTION_LTR;
grapheme=(GraphemeInfo *) NULL;
- length=ComplexTextLayout(image,p,strlen(p),face,direction,flags,&grapheme,
+ length=ComplexTextLayout(image,draw_info,p,strlen(p),face,flags,&grapheme,
exception);
code=0;
for (i=0; i < (ssize_t) length; i++)
r=bitmap->bitmap.buffer;
for (y=0; y < (ssize_t) bitmap->bitmap.rows; y++)
{
+ double
+ fill_opacity;
+
MagickBooleanType
active,
sync;
- double
- fill_opacity;
-
PixelInfo
fill_color;