MagickWand 한글이 깨어짐..
이래와 같이 MagickWand를 사용해서 이미지를 만들면
한글이 깨어집니다. 어떻게 해결할 방법이 없는지..
void test_wand1()
{
MagickWand *mw = NULL;
DrawingWand *dw = NULL;
unsigned char *str = "홍길동";
double *fm = NULL;
MagickWandGenesis();
mw = NewMagickWand();
dw = NewDrawingWand();
// Start with an empty image
MagickReadImage(mw,"xc:");
// Set the font information in the drawing wand
DrawSetFontSize(dw,72);
DrawSetFont(dw,"Times-New-Roman");
// DrawSetTextEncoding(mw, "UTF-8");
// DrawSetTextEncoding(dw, "utf-8");
fm = MagickQueryFontMetrics(mw, dw, str);
// extend the size of the image - I think this is the right one to use
// but works for me in this case
MagickExtentImage(mw,(unsigned long)fm[4],(unsigned long)fm[5],0,0);
// Annotate the image - Note the calculation of the y value which is
// because the font metrics use an origin in the lower left whereas IM has
// its origin at top left
// The fontmetrics origin is the *bottom* left of the text and the Y axis
// is the baseline. Therefore, the bounding box can have a negative Y value
// if the text contains any descenders which go below the baseline
MagickAnnotateImage(mw,dw, 0 ,(unsigned int)(fm[8]+ fm[5]), 0.0 ,str);
// Now write the magickwand image
MagickWriteImage(mw,"metric01.gif");
if(mw)mw = DestroyMagickWand(mw);
if(dw)dw = DestroyDrawingWand(dw);
if(fm)RelinquishMagickMemory(fm);
MagickWandTerminus();
}
댓글 달기