86 #if defined(MAGICKCORE_FREETYPE_DELEGATE) 87 #if defined(__MINGW32__) 91 #if defined(FT_FREETYPE_H) 92 # include FT_FREETYPE_H 94 # include <freetype/freetype.h> 96 #if defined(FT_GLYPH_H) 99 # include <freetype/ftglyph.h> 101 #if defined(FT_OUTLINE_H) 102 # include FT_OUTLINE_H 104 # include <freetype/ftoutln.h> 106 #if defined(FT_BBOX_H) 109 # include <freetype/ftbbox.h> 112 #if defined(MAGICKCORE_RAQM_DELEGATE) 262 assert(image != (
Image *) NULL);
266 assert(draw_info != (
DrawInfo *) NULL);
268 if (draw_info->
text == (
char *) NULL)
270 if (*draw_info->
text ==
'\0')
274 annotate->
text=(
char *) NULL;
277 for (p=text; *p !=
'\0'; p++)
281 if (textlist == (
char **) NULL)
289 for (i=0; i < (ssize_t) number_lines; i++)
295 for (q=p; *q !=
'\0'; q++)
296 if ((*q ==
'\r') || (*q ==
'\n'))
306 textlist[i]=(
char *) NULL;
309 if (annotate_info->
geometry != (
char *) NULL)
326 (void) memset(&metrics,0,
sizeof(metrics));
327 for (i=0; textlist[i] != (
char *) NULL; i++)
329 if (*textlist[i] ==
'\0')
354 offset.
x=(geometry.
width == 0 ? -1.0 : 1.0)*annotate_info->
affine.
tx+i*
357 offset.
y=(geometry.
height == 0 ? -1.0 : 1.0)*annotate_info->
affine.
ty+i*
364 offset.
x=(geometry.
width == 0 ? -1.0 : 1.0)*annotate_info->
affine.
tx+
368 offset.
y=(geometry.
height == 0 ? -1.0 : 1.0)*annotate_info->
affine.
ty+i*
375 offset.
x=(geometry.
width == 0 ? 1.0 : -1.0)*annotate_info->
affine.
tx+
379 offset.
y=(geometry.
height == 0 ? -1.0 : 1.0)*annotate_info->
affine.
ty+i*
386 offset.
x=(geometry.
width == 0 ? -1.0 : 1.0)*annotate_info->
affine.
tx+i*
388 (metrics.
ascent+metrics.
descent-(number_lines-1.0)*height)/2.0;
392 (number_lines-1.0)*height)/2.0;
397 offset.
x=(geometry.
width == 0 ? -1.0 : 1.0)*annotate_info->
affine.
tx+
400 (metrics.
ascent+metrics.
descent-(number_lines-1.0)*height)/2.0;
404 (metrics.
ascent+metrics.
descent-(number_lines-1.0)*height)/2.0;
409 offset.
x=(geometry.
width == 0 ? 1.0 : -1.0)*annotate_info->
affine.
tx+
413 (number_lines-1.0)*height)/2.0-1.0;
418 (number_lines-1.0)*height)/2.0;
423 offset.
x=(geometry.
width == 0 ? -1.0 : 1.0)*annotate_info->
affine.
tx+i*
425 (number_lines-1.0)*height;
433 offset.
x=(geometry.
width == 0 ? -1.0 : 1.0)*annotate_info->
affine.
tx+
436 annotate_info->
affine.
ry*(number_lines-1.0)*height/2.0;
445 offset.
x=(geometry.
width == 0 ? 1.0 : -1.0)*annotate_info->
affine.
tx+
448 annotate_info->
affine.
ry*(number_lines-1.0)*height-1.0;
456 switch (annotate->
align)
497 "rectangle 0.0,0.0 %g,%g",metrics.
origin.
x,(
double) height);
499 (void)
DrawImage(image,undercolor_info,exception);
504 pixel=annotate_info->
fill;
506 pixel=annotate_info->
stroke;
509 "stroke-width %g line 0,0 %g,0",color,(
double)
521 (void)
DrawImage(image,annotate_info,exception);
529 (void)
DrawImage(image,annotate_info,exception);
535 status=
RenderType(image,annotate,&offset,&metrics,exception);
543 (void)
DrawImage(image,annotate_info,exception);
609 length=strlen(*caption);
611 offset=space-(*caption);
617 space=(*caption)+offset;
669 if (width <= image->columns)
671 if (s != (
char *) NULL)
680 if ((n > 0) && ((*caption)[n-1] !=
'\n'))
780 assert(image != (
Image *) NULL);
784 assert(draw_info != (
DrawInfo *) NULL);
785 assert(draw_info->
text != (
char *) NULL);
787 if (*draw_info->
text ==
'\0')
795 if (textlist == (
char **) NULL)
799 (void) memset(metrics,0,
sizeof(*metrics));
800 (void) memset(&extent,0,
sizeof(extent));
804 annotate_info->
text=textlist[0];
813 "WidthOrHeightExceedsLimit",
"`%s'",image->
filename);
818 for (i=1; i < (ssize_t) count; i++)
820 annotate_info->
text=textlist[i];
830 "WidthOrHeightExceedsLimit",
"`%s'",image->
filename);
835 metrics->
height=(double) height;
840 annotate_info->
text=(
char *) NULL;
842 for (i=0; i < (ssize_t) count; i++)
906 assert(image != (
Image *) NULL);
910 assert(draw_info != (
DrawInfo *) NULL);
911 assert(draw_info->
text != (
char *) NULL);
916 (void) memset(metrics,0,
sizeof(*metrics));
919 status=
RenderType(image,annotate_info,&offset,metrics,exception);
922 "width: %g; height: %g; ascent: %g; descent: %g; max advance: %g; " 923 "bounds: %g,%g %g,%g; origin: %g,%g; pixels per em: %g,%g; " 924 "underline position: %g; underline thickness: %g",annotate_info->
text,
985 if (draw_info->
font != (
char *) NULL)
987 if (*draw_info->
font ==
'@')
993 if (*draw_info->
font ==
'-')
994 return(
RenderX11(image,draw_info,offset,metrics,exception));
995 if (*draw_info->
font ==
'^')
1004 if (type_info == (
const TypeInfo *) NULL)
1006 "UnableToReadFont",
"`%s'",draw_info->
font);
1008 if ((type_info == (
const TypeInfo *) NULL) &&
1009 (draw_info->
family != (
const char *) NULL))
1011 if (strstr(draw_info->
family,
",'\"") == (
char *) NULL)
1014 if (type_info == (
const TypeInfo *) NULL)
1029 for (i=1; i < (ssize_t) number_families; i++)
1034 if ((type_info != (
const TypeInfo *) NULL) &&
1038 for (i=0; i < (ssize_t) number_families; i++)
1041 if (type_info == (
const TypeInfo *) NULL)
1043 "UnableToReadFont",
"`%s'",draw_info->
family);
1047 if (font != (
char *) NULL)
1055 annotate_info->
font=font;
1057 offset,metrics,exception);
1064 if (type_info == (
const TypeInfo *) NULL)
1067 if (type_info == (
const TypeInfo *) NULL)
1070 if (type_info == (
const TypeInfo *) NULL)
1073 if (type_info == (
const TypeInfo *) NULL)
1076 if (type_info == (
const TypeInfo *) NULL)
1083 annotate_info->
face=type_info->
face;
1084 if (type_info->
metrics != (
char *) NULL)
1086 if (type_info->
glyphs != (
char *) NULL)
1130 #if defined(MAGICKCORE_FREETYPE_DELEGATE) 1132 static size_t ComplexTextLayout(
const Image *image,
const DrawInfo *draw_info,
1133 const char *text,
const size_t length,
const FT_Face face,
const FT_Int32 flags,
1136 #if defined(MAGICKCORE_RAQM_DELEGATE) 1155 if (rq == (raqm_t *) NULL)
1157 if (raqm_set_text_utf8(rq,text,length) == 0)
1159 if (raqm_set_par_direction(rq,(raqm_direction_t) draw_info->
direction) == 0)
1161 if (raqm_set_freetype_face(rq,face) == 0)
1164 if (features != (
const char *) NULL)
1181 status_token=
Tokenizer(token_info,0,token,50,features,
"",
",",
"",
'\0',
1182 &breaker,&next,"e);
1183 while (status_token == 0)
1185 raqm_add_font_feature(rq,token,(
int) strlen(token));
1186 status_token=
Tokenizer(token_info,0,token,50,features,
"",
",",
"",
'\0',
1187 &breaker,&next,"e);
1192 if (raqm_layout(rq) == 0)
1194 glyphs=raqm_get_glyphs(rq,&extent);
1195 if (glyphs == (raqm_glyph_t *) NULL)
1206 for (i=0; i < (ssize_t) extent; i++)
1208 (*grapheme)[i].index=glyphs[i].index;
1209 (*grapheme)[i].x_offset=glyphs[i].x_offset;
1210 (*grapheme)[i].x_advance=glyphs[i].x_advance;
1211 (*grapheme)[i].y_offset=glyphs[i].y_offset;
1212 (*grapheme)[i].cluster=glyphs[i].cluster;
1240 (*grapheme)[i].index=(ssize_t) FT_Get_Char_Index(face,
GetUTFCode(p));
1241 (*grapheme)[i].x_offset=0;
1242 (*grapheme)[i].y_offset=0;
1243 if (((*grapheme)[i].index != 0) && (last_glyph != 0))
1245 if (FT_HAS_KERNING(face))
1253 ft_status=FT_Get_Kerning(face,(FT_UInt) last_glyph,(FT_UInt)
1254 (*grapheme)[i].index,ft_kerning_default,&kerning);
1256 (*grapheme)[i-1].x_advance+=(FT_Pos) ((draw_info->
direction ==
1260 (void) FT_Load_Glyph(face,(FT_UInt) (*grapheme)[i].index,flags);
1261 (*grapheme)[i].x_advance=face->glyph->advance.x;
1262 (*grapheme)[i].cluster=p-text;
1263 last_glyph=(*grapheme)[i].index;
1269 static void FTCloseStream(FT_Stream stream)
1271 FILE *file = (FILE *) stream->descriptor.pointer;
1272 if (file != (FILE *) NULL)
1273 (
void) fclose(file);
1274 stream->descriptor.pointer=NULL;
1277 static unsigned long FTReadStream(FT_Stream stream,
unsigned long offset,
1278 unsigned char *buffer,
unsigned long count)
1280 FILE *file = (FILE *) stream->descriptor.pointer;
1281 if (file == (FILE *) NULL)
1285 if (fseek(file,(off_t) offset,SEEK_SET) != 0)
1287 return((
unsigned long) fread(buffer,1,count,file));
1292 return((outline.n_points == 0) || (outline.n_contours <= 0) ?
MagickTrue :
1296 static int TraceCubicBezier(FT_Vector *p,FT_Vector *q,FT_Vector *to,
1305 affine=draw_info->
affine;
1307 affine.
tx+p->x/64.0,affine.
ty-p->y/64.0,affine.
tx+q->x/64.0,affine.
ty-
1308 q->y/64.0,affine.
tx+to->x/64.0,affine.
ty-to->y/64.0);
1313 static int TraceLineTo(FT_Vector *to,
DrawInfo *draw_info)
1321 affine=draw_info->
affine;
1323 affine.
ty-to->y/64.0);
1328 static int TraceMoveTo(FT_Vector *to,
DrawInfo *draw_info)
1336 affine=draw_info->
affine;
1338 affine.
ty-to->y/64.0);
1343 static int TraceQuadraticBezier(FT_Vector *control,FT_Vector *to,
1352 affine=draw_info->
affine;
1354 control->x/64.0,affine.
ty-control->y/64.0,affine.
tx+to->x/64.0,affine.
ty-
1360 static inline const char *FreetypeErrorMessage(FT_Error ft_status)
1362 #if FREETYPE_MAJOR == 2 && FREETYPE_MINOR >= 10 1363 return(FT_Error_String(ft_status));
1366 return((
const char *) NULL);
1374 #if !defined(FT_OPEN_PATHNAME) 1375 #define FT_OPEN_PATHNAME ft_open_pathname 1378 #define ThrowFreetypeErrorException(tag,ft_status,value) \ 1381 *error_string=FreetypeErrorMessage(ft_status); \ 1382 if (error_string != (const char *) NULL) \ 1383 (void) ThrowMagickException(exception,GetMagickModule(),TypeError, \ 1384 tag,"`%s (%s)'",value, error_string); \ 1386 (void) ThrowMagickException(exception,GetMagickModule(),TypeError, \ 1387 tag,"`%s'",value); \ 1390 typedef struct _GlyphInfo
1476 static FT_Outline_Funcs
1479 (FT_Outline_MoveTo_Func) TraceMoveTo,
1480 (FT_Outline_LineTo_Func) TraceLineTo,
1481 (FT_Outline_ConicTo_Func) TraceQuadraticBezier,
1482 (FT_Outline_CubicTo_Func) TraceCubicBezier,
1495 ft_status=FT_Init_FreeType(&library);
1497 ThrowFreetypeErrorException(
"UnableToInitializeFreetypeLibrary",ft_status,
1502 face_index=(FT_Long) draw_info->
face;
1503 (
void) memset(&args,0,
sizeof(args));
1504 if (draw_info->
font == (
char *) NULL)
1507 if (*draw_info->
font !=
'@')
1517 face_index=(FT_Long) image_info->
scene;
1525 (void) memset(stream,0,
sizeof(*stream));
1526 (void) stat(args.pathname,&attributes);
1527 stream->size=attributes.st_size;
1528 stream->descriptor.pointer=
fopen_utf8(args.pathname,
"rb");
1529 stream->read=(&FTReadStream);
1530 stream->close=(&FTCloseStream);
1531 args.flags=FT_OPEN_STREAM;
1533 face=(FT_Face) NULL;
1534 ft_status=FT_Open_Face(library,&args,face_index,&face);
1537 (void) FT_Done_FreeType(library);
1538 ThrowFreetypeErrorException(
"UnableToReadFont",ft_status,args.pathname);
1543 if ((draw_info->
metrics != (
char *) NULL) &&
1545 (void) FT_Attach_File(face,draw_info->
metrics);
1546 encoding_type=FT_ENCODING_UNICODE;
1547 ft_status=FT_Select_Charmap(face,encoding_type);
1548 if ((ft_status != 0) && (face->num_charmaps != 0))
1549 ft_status=FT_Set_Charmap(face,face->charmaps[0]);
1550 if (encoding != (
const char *) NULL)
1553 encoding_type=FT_ENCODING_ADOBE_CUSTOM;
1555 encoding_type=FT_ENCODING_ADOBE_EXPERT;
1557 encoding_type=FT_ENCODING_ADOBE_STANDARD;
1559 encoding_type=FT_ENCODING_APPLE_ROMAN;
1561 encoding_type=FT_ENCODING_BIG5;
1562 #if defined(FT_ENCODING_PRC) 1564 encoding_type=FT_ENCODING_PRC;
1566 #if defined(FT_ENCODING_JOHAB) 1568 encoding_type=FT_ENCODING_JOHAB;
1570 #if defined(FT_ENCODING_ADOBE_LATIN_1) 1572 encoding_type=FT_ENCODING_ADOBE_LATIN_1;
1574 #if defined(FT_ENCODING_ADOBE_LATIN_2) 1576 encoding_type=FT_ENCODING_OLD_LATIN_2;
1579 encoding_type=FT_ENCODING_NONE;
1581 encoding_type=FT_ENCODING_SJIS;
1583 encoding_type=FT_ENCODING_MS_SYMBOL;
1585 encoding_type=FT_ENCODING_UNICODE;
1587 encoding_type=FT_ENCODING_WANSUNG;
1588 ft_status=FT_Select_Charmap(face,encoding_type);
1591 (void) FT_Done_Face(face);
1592 (void) FT_Done_FreeType(library);
1593 ThrowFreetypeErrorException(
"UnrecognizedFontEncoding",ft_status,
1603 if (draw_info->
density != (
char *) NULL)
1612 if ((geometry_flags &
RhoValue) != 0)
1613 resolution.
x=geometry_info.
rho;
1614 resolution.
y=resolution.
x;
1616 resolution.
y=geometry_info.
sigma;
1618 ft_status=FT_Set_Char_Size(face,(FT_F26Dot6) (64.0*draw_info->
pointsize),
1619 (FT_F26Dot6) (64.0*draw_info->
pointsize),(FT_UInt) resolution.
x,
1620 (FT_UInt) resolution.
y);
1623 (void) FT_Done_Face(face);
1624 (void) FT_Done_FreeType(library);
1625 ThrowFreetypeErrorException(
"UnableToReadFont",ft_status,
1631 metrics->
ascent=(double) face->size->metrics.ascender/64.0;
1632 metrics->
descent=(
double) face->size->metrics.descender/64.0;
1633 if (face->size->metrics.ascender == 0)
1638 metrics->
ascent=face->size->metrics.y_ppem;
1639 if (face->size->metrics.descender == 0)
1640 metrics->
descent=face->size->metrics.y_ppem/-3.5;
1645 metrics->
height=(double) face->size->metrics.height/64.0;
1648 metrics->
max_advance=(double) face->size->metrics.max_advance/64.0;
1658 FT_Get_First_Char(face,&first_glyph_id);
1659 if ((draw_info->
text == (
char *) NULL) || (*draw_info->
text ==
'\0') ||
1660 (first_glyph_id == 0))
1662 (void) FT_Done_Face(face);
1663 (void) FT_Done_FreeType(library);
1671 "font-encoding %s; text-encoding %s; pointsize %g",
1672 draw_info->
font != (
char *) NULL ? draw_info->
font :
"none",
1673 encoding != (
char *) NULL ? encoding :
"none",
1676 flags=FT_LOAD_DEFAULT;
1678 flags=FT_LOAD_NO_BITMAP;
1680 flags|=FT_LOAD_TARGET_MONO;
1683 #if defined(FT_LOAD_TARGET_LIGHT) 1684 flags|=FT_LOAD_TARGET_LIGHT;
1685 #elif defined(FT_LOAD_TARGET_LCD) 1686 flags|=FT_LOAD_TARGET_LCD;
1690 if ((value != (
const char *) NULL) && (
LocaleCompare(value,
"off") == 0))
1691 flags|=FT_LOAD_NO_HINTING;
1693 glyph.image=(FT_Glyph) NULL;
1703 affine.xx=(FT_Fixed) (65536L*draw_info->
affine.
sx+0.5);
1704 affine.yx=(FT_Fixed) (-65536L*draw_info->
affine.
rx+0.5);
1705 affine.xy=(FT_Fixed) (-65536L*draw_info->
affine.
ry+0.5);
1706 affine.yy=(FT_Fixed) (65536L*draw_info->
affine.
sy+0.5);
1723 utf8=(
unsigned char *) NULL;
1729 if (utf8 != (
unsigned char *) NULL)
1733 length=ComplexTextLayout(image,draw_info,p,strlen(p),face,flags,&grapheme,
1735 missing_glyph_id=FT_Get_Char_Index(face,
' ');
1737 last_character=(ssize_t) length-1;
1738 for (i=0; i < (ssize_t) length; i++)
1746 glyph.id=(FT_UInt) grapheme[i].index;
1748 glyph.id=missing_glyph_id;
1749 if ((glyph.id != 0) && (last_glyph_id != 0))
1750 origin.x+=(FT_Pos) (64.0*draw_info->
kerning);
1751 glyph.origin=origin;
1752 glyph.origin.x+=(FT_Pos) grapheme[i].x_offset;
1753 glyph.origin.y+=(FT_Pos) grapheme[i].y_offset;
1754 if (glyph.image != (FT_Glyph) NULL)
1756 FT_Done_Glyph(glyph.image);
1757 glyph.image=(FT_Glyph) NULL;
1759 ft_status=FT_Load_Glyph(face,glyph.id,flags);
1762 ft_status=FT_Get_Glyph(face->glyph,&glyph.image);
1765 outline=((FT_OutlineGlyph) glyph.image)->outline;
1766 if ((glyph.image->format != FT_GLYPH_FORMAT_OUTLINE) &&
1769 ft_status=FT_Outline_Get_BBox(&outline,&bounds);
1772 if ((bounds.xMin < metrics->
bounds.
x1) && (bounds.xMin != 0))
1773 metrics->
bounds.
x1=(double) bounds.xMin;
1774 if ((bounds.yMin < metrics->
bounds.
y1) && (bounds.yMin != 0))
1775 metrics->
bounds.
y1=(double) bounds.yMin;
1776 if ((bounds.xMax > metrics->
bounds.
x2) && (bounds.xMax != 0))
1777 metrics->
bounds.
x2=(double) bounds.xMax;
1778 if ((bounds.yMax > metrics->
bounds.
y2) && (bounds.yMax != 0))
1779 metrics->
bounds.
y2=(double) bounds.yMax;
1787 annotate_info->
affine.
tx=glyph.origin.x/64.0;
1788 annotate_info->
affine.
ty=(-glyph.origin.y/64.0);
1790 ft_status=FT_Outline_Decompose(&outline,&OutlineMethods,
1793 FT_Vector_Transform(&glyph.origin,&affine);
1794 (void) FT_Glyph_Transform(glyph.image,&affine,&glyph.origin);
1795 ft_status=FT_Glyph_To_Bitmap(&glyph.image,FT_RENDER_MODE_NORMAL,
1799 bitmap=(FT_BitmapGlyph) glyph.image;
1800 point.
x=offset->
x+bitmap->left;
1801 if (bitmap->bitmap.pixel_mode == ft_pixel_mode_mono)
1802 point.
x+=(origin.x/64.0);
1803 point.
y=offset->
y-bitmap->top;
1824 r=bitmap->bitmap.buffer;
1825 for (y=0; y < (ssize_t) bitmap->bitmap.rows; y++)
1852 if ((y_offset < 0) || (y_offset >= (ssize_t) image->
rows))
1855 if ((x_offset < 0) || (x_offset >= (ssize_t) image->
columns))
1860 bitmap->bitmap.width,1,exception);
1863 n=y*bitmap->bitmap.pitch;
1864 for (x=0; x < (ssize_t) bitmap->bitmap.width; x++, n++)
1867 if ((x_offset < 0) || (x_offset >= (ssize_t) image->
columns))
1874 if (bitmap->bitmap.buffer != (
unsigned char *) NULL)
1876 if (bitmap->bitmap.pixel_mode == ft_pixel_mode_grays)
1877 fill_opacity=(double) (r[n])/(bitmap->bitmap.num_grays-1);
1879 if (bitmap->bitmap.pixel_mode == ft_pixel_mode_mono)
1880 fill_opacity=((r[(x >> 3)+y*bitmap->bitmap.pitch] &
1881 (1 << (~x & 0x07)))) == 0 ? 0.0 : 1.0;
1884 fill_opacity=fill_opacity >= 0.5 ? 1.0 : 0.0;
1893 GetFillColor(draw_info,x_offset,y_offset,&fill_color,exception);
1894 fill_opacity=fill_opacity*fill_color.
alpha;
1933 if (strlen(annotate_info->
primitive) > 7)
1934 (
void)
DrawImage(image,annotate_info,exception);
1943 if (i == last_character)
1944 origin.x+=
MagickMax((FT_Pos) grapheme[i].x_advance,bounds.xMax);
1946 origin.x+=(FT_Pos) grapheme[i].x_advance;
1947 metrics->
origin.
x=(double) origin.x;
1948 metrics->
origin.
y=(
double) origin.y;
1951 last_glyph_id=glyph.id;
1956 if (utf8 != (
unsigned char *) NULL)
1958 if (glyph.image != (FT_Glyph) NULL)
1960 FT_Done_Glyph(glyph.image);
1961 glyph.image=(FT_Glyph) NULL;
1977 (void) FT_Done_Face(face);
1978 (void) FT_Done_FreeType(library);
1988 draw_info->
font != (
char *) NULL ? draw_info->
font :
"none");
2040 assert(source != (
const char *) NULL);
2042 for (p=source; *p !=
'\0'; p++)
2044 if ((*p ==
'\\') || (*p ==
'(') || (*p ==
')'))
2052 destination=(
char *) NULL;
2055 sizeof(*destination));
2056 if (destination == (
char *) NULL)
2060 for (p=source; *p !=
'\0'; p++)
2062 if ((*p ==
'\\') || (*p ==
'(') || (*p ==
')'))
2067 return(destination);
2113 "Font %s; pointsize %g",draw_info->
font != (
char *) NULL ?
2117 if (unique_file != -1)
2118 file=fdopen(unique_file,
"wb");
2119 if ((unique_file == -1) || (file == (FILE *) NULL))
2129 " dict begin { 1 index /FID ne {def} {pop pop} ifelse } forall\n");
2131 " /Encoding ISOLatin1Encoding def currentdict end definefont pop\n");
2141 length=strlen(draw_info->
text);
2142 for (i=0; i <= (ssize_t) (length+2); i++)
2148 if (point.
x > extent.
x)
2150 if (point.
y > extent.
y)
2154 extent.
x/2.0,extent.
y/2.0);
2157 if ((draw_info->
font == (
char *) NULL) || (*draw_info->
font ==
'\0') ||
2158 (strchr(draw_info->
font,
'/') != (
char *) NULL))
2160 "/Times-Roman-ISO dup /Times-Roman ReencodeType findfont setfont\n");
2163 "/%s-ISO dup /%s ReencodeType findfont setfont\n",draw_info->
font,
2170 (void)
FormatLocaleFile(file,
"(%s) stringwidth pop -0.5 mul -0.5 rmoveto\n",
2175 (void) fclose(file);
2177 floor(extent.
x+0.5),floor(extent.
y+0.5));
2182 if (draw_info->
density != (
char *) NULL)
2185 annotate_image=
ReadImage(annotate_info,exception);
2189 if (annotate_image == (
Image *) NULL)
2194 if (draw_info->
density != (
char *) NULL)
2204 resolution.
x=geometry_info.
rho;
2205 resolution.
y=resolution.
x;
2207 resolution.
y=geometry_info.
sigma;
2210 (void)
TransformImage(&annotate_image,
"0x0",(
char *) NULL,exception);
2222 "%.20gx%.20g%+.20g%+.20g",(
double) crop_info.
width,(double)
2223 crop_info.
height,(
double) crop_info.
x,(double) crop_info.
y);
2224 (void)
TransformImage(&annotate_image,geometry,(
char *) NULL,exception);
2265 fill_color=draw_info->
fill;
2267 for (y=0; y < (ssize_t) annotate_image->
rows; y++)
2279 for (x=0; x < (ssize_t) annotate_image->
columns; x++)
2295 (ssize_t) ceil(offset->
x-0.5),(ssize_t) ceil(offset->
y-(metrics->
ascent+
2296 metrics->
descent)-0.5),exception);
2343 status=
XRenderImage(image,draw_info,offset,metrics,exception);
MagickExport MagickBooleanType NegateImage(Image *image, const MagickBooleanType grayscale, ExceptionInfo *exception)
MagickExport CacheView * DestroyCacheView(CacheView *cache_view)
MagickExport TokenInfo * DestroyTokenInfo(TokenInfo *token_info)
MagickExport MagickBooleanType QueryColorname(const Image *magick_unused(image), const PixelInfo *color, const ComplianceType compliance, char *name, ExceptionInfo *exception)
MagickExport ImageInfo * AcquireImageInfo(void)
MagickPrivate void AnnotateComponentTerminus(void)
MagickExport size_t ConcatenateMagickString(char *magick_restrict destination, const char *magick_restrict source, const size_t length)
static Quantum GetPixelAlpha(const Image *magick_restrict image, const Quantum *magick_restrict pixel)
MagickExport void UnlockSemaphoreInfo(SemaphoreInfo *semaphore_info)
MagickExport const TypeInfo * GetTypeInfo(const char *name, ExceptionInfo *exception)
static int GetUTFCode(const char *magick_restrict text)
static MagickBooleanType IsNonBreakingUTFSpace(const int code)
#define ThrowFatalException(severity, tag)
static void GetFillColor(const DrawInfo *draw_info, const ssize_t x, const ssize_t y, PixelInfo *fill, ExceptionInfo *exception)
MagickExport void SetGeometryInfo(GeometryInfo *geometry_info)
MagickExport SemaphoreInfo * AcquireSemaphoreInfo(void)
MagickBooleanType antialias
MagickExport ExceptionInfo * AcquireExceptionInfo(void)
MagickExport ssize_t FormatLocaleString(char *magick_restrict string, const size_t length, const char *magick_restrict format,...)
static MagickBooleanType IsGrayColorspace(const ColorspaceType colorspace)
MagickExport size_t CopyMagickString(char *magick_restrict destination, const char *magick_restrict source, const size_t length)
#define DefaultResolution
static MagickBooleanType RenderPostscript(Image *, const DrawInfo *, const PointInfo *, TypeMetric *, ExceptionInfo *)
MagickExport MagickBooleanType CompositeImage(Image *image, const Image *composite, const CompositeOperator compose, const MagickBooleanType clip_to_self, const ssize_t x_offset, const ssize_t y_offset, ExceptionInfo *exception)
MagickExport MagickBooleanType AcquireMagickResource(const ResourceType type, const MagickSizeType size)
static Quantum ClampToQuantum(const MagickRealType quantum)
MagickExport void GetPixelInfo(const Image *image, PixelInfo *pixel)
MagickExport TokenInfo * AcquireTokenInfo(void)
#define MagickCoreSignature
MagickExport void LockSemaphoreInfo(SemaphoreInfo *semaphore_info)
MagickExport Quantum * GetCacheViewAuthenticPixels(CacheView *cache_view, const ssize_t x, const ssize_t y, const size_t columns, const size_t rows, ExceptionInfo *exception)
static MagickBooleanType RenderType(Image *, const DrawInfo *, const PointInfo *, TypeMetric *, ExceptionInfo *)
MagickExport double ExpandAffine(const AffineMatrix *affine)
MagickExport ssize_t FormatMagickCaption(Image *image, DrawInfo *draw_info, const MagickBooleanType split, TypeMetric *metrics, char **caption, ExceptionInfo *exception)
MagickExport ssize_t FormatLocaleFile(FILE *file, const char *magick_restrict format,...)
MagickExport MagickBooleanType SetImageAlphaChannel(Image *image, const AlphaChannelOption alpha_type, ExceptionInfo *exception)
unsigned int MagickStatusType
MagickExport char * AcquireString(const char *source)
MagickExport MagickStatusType ParsePageGeometry(const Image *image, const char *geometry, RectangleInfo *region_info, ExceptionInfo *exception)
static double PerceptibleReciprocal(const double x)
MagickExport int AcquireUniqueFileResource(char *path)
MagickExport MagickBooleanType AnnotateImage(Image *image, const DrawInfo *draw_info, ExceptionInfo *exception)
static ssize_t CastDoubleToLong(const double x)
static MagickBooleanType IsUTFSpace(const int code)
MagickExport void * AcquireCriticalMemory(const size_t size)
MagickExport void * AcquireQuantumMemory(const size_t count, const size_t quantum)
char filename[MagickPathExtent]
static FILE * fopen_utf8(const char *path, const char *mode)
MagickExport MagickBooleanType RelinquishUniqueFileResource(const char *path)
MagickPrivate MagickBooleanType XRenderImage(Image *, const DrawInfo *, const PointInfo *, TypeMetric *, ExceptionInfo *)
MagickExport MagickBooleanType IsEventLogging(void)
MagickExport MagickBooleanType DrawImage(Image *image, const DrawInfo *draw_info, ExceptionInfo *exception)
static SemaphoreInfo * annotate_semaphore
#define ThrowFileException(exception, severity, tag, context)
MagickExport Image * ReadImage(const ImageInfo *image_info, ExceptionInfo *exception)
MagickExport MagickBooleanType SetImageInfo(ImageInfo *image_info, const unsigned int frames, ExceptionInfo *exception)
static MagickBooleanType RenderX11(Image *, const DrawInfo *, const PointInfo *, TypeMetric *, ExceptionInfo *)
MagickExport MagickBooleanType ThrowMagickException(ExceptionInfo *exception, const char *module, const char *function, const size_t line, const ExceptionType severity, const char *tag, const char *format,...)
MagickExport MagickBooleanType LogMagickEvent(const LogEventType type, const char *module, const char *function, const size_t line, const char *format,...)
MagickExport MagickBooleanType IsPathAccessible(const char *path)
MagickExport const TypeInfo * GetTypeInfoByFamily(const char *family, const StyleType style, const StretchType stretch, const size_t weight, ExceptionInfo *exception)
MagickExport MagickBooleanType SubstituteString(char **string, const char *search, const char *replace)
MagickExport DrawInfo * CloneDrawInfo(const ImageInfo *image_info, const DrawInfo *draw_info)
static void SetPixelBlue(const Image *magick_restrict image, const Quantum blue, Quantum *magick_restrict pixel)
MagickPrivate MagickBooleanType AnnotateComponentGenesis(void)
MagickExport MagickBooleanType SetImageStorageClass(Image *image, const ClassType storage_class, ExceptionInfo *exception)
MagickExport void CatchException(ExceptionInfo *exception)
static double RoundToUnity(const double value)
static size_t GetPixelChannels(const Image *magick_restrict image)
MagickExport int LocaleCompare(const char *p, const char *q)
char filename[MagickPathExtent]
#define GetMagickModule()
double underline_thickness
MagickExport MagickBooleanType GetMultilineTypeMetrics(Image *image, const DrawInfo *draw_info, TypeMetric *metrics, ExceptionInfo *exception)
MagickExport ImageInfo * DestroyImageInfo(ImageInfo *image_info)
MagickExport MagickBooleanType GetTypeMetrics(Image *image, const DrawInfo *draw_info, TypeMetric *metrics, ExceptionInfo *exception)
MagickExport RectangleInfo GetImageBoundingBox(const Image *image, ExceptionInfo *exception)
MagickExport MagickBooleanType SetImageColorspace(Image *image, const ColorspaceType colorspace, ExceptionInfo *exception)
MagickExport DrawInfo * DestroyDrawInfo(DrawInfo *draw_info)
MagickExport char * DestroyString(char *string)
MagickExport void ActivateSemaphoreInfo(SemaphoreInfo **semaphore_info)
MagickExport const char * GetImageProperty(const Image *image, const char *property, ExceptionInfo *exception)
double underline_position
static char * EscapeParenthesis(const char *source)
MagickBooleanType text_antialias
MagickExport MagickStatusType ParseGeometry(const char *geometry, GeometryInfo *geometry_info)
MagickExport char * GetPolicyValue(const char *name)
static void SetPixelAlpha(const Image *magick_restrict image, const Quantum alpha, Quantum *magick_restrict pixel)
MagickExport void SetGeometry(const Image *image, RectangleInfo *geometry)
MagickExport MagickBooleanType ConcatenateString(char **magick_restrict destination, const char *magick_restrict source)
static MagickBooleanType RenderFreetype(Image *, const DrawInfo *, const char *, const PointInfo *, TypeMetric *, ExceptionInfo *)
MagickExport void * RelinquishMagickMemory(void *memory)
#define magick_unreferenced(x)
static unsigned int GetUTFOctets(const char *magick_restrict text)
MagickExport char * CloneString(char **destination, const char *source)
MagickExport char ** StringToStrings(const char *text, size_t *count)
static void SetPixelRed(const Image *magick_restrict image, const Quantum red, Quantum *magick_restrict pixel)
static unsigned char * ConvertLatin1ToUTF8(const unsigned char *magick_restrict content)
MagickExport MagickBooleanType SyncCacheViewAuthenticPixels(CacheView *magick_restrict cache_view, ExceptionInfo *exception)
MagickExport CacheView * AcquireAuthenticCacheView(const Image *image, ExceptionInfo *exception)
MagickExport char ** StringToArgv(const char *text, int *argc)
static char * ReplaceSpaceWithNewline(char **caption, char *space)
MagickExport MagickRealType GetPixelIntensity(const Image *magick_restrict image, const Quantum *magick_restrict pixel)
MagickExport void RelinquishSemaphoreInfo(SemaphoreInfo **semaphore_info)
MagickExport Image * DestroyImage(Image *image)
MagickExport char * ConstantString(const char *source)
ColorspaceType colorspace
MagickExport int Tokenizer(TokenInfo *token_info, const unsigned flag, char *token, const size_t max_token_length, const char *line, const char *white, const char *break_set, const char *quote, const char escape, char *breaker, int *next, char *quoted)
static void CompositePixelOver(const Image *image, const PixelInfo *p, const double alpha, const Quantum *q, const double beta, Quantum *composite)
MagickExport ExceptionInfo * DestroyExceptionInfo(ExceptionInfo *exception)
static void SetPixelGreen(const Image *magick_restrict image, const Quantum green, Quantum *magick_restrict pixel)
struct _GraphemeInfo GraphemeInfo