gd library with ttf
I am trying to use gd-1.8.4 libraries in C++ with FreeType2 on a Linux system. I did a make after editing Makefile to include the -DHAVE_LIBFREETYPE and -lfreetype along with the other libraries (I left out -DHAVE_LIBTTF and -lttf; will that be a problem?). The following is a portion of the program with interdispersed printf statements and following that is the output:
int ShowCurve(int intSize) { gdImagePtr gdChart; char *ptrResult; int intTxtHght=0, intTxtWdth=0; int intFntRect[8]; char *ptrDummy = "000000"; double dblFntSz = 0; char *ptrCurrFnt = NULL; // several nonrelated statements here printf("ptrCurrFnt: %s, dblFntSz: %f\n", ptrCurrFnt, dblFntSz); printf("ptrDummy: %s\n", ptrDummy); ptrResult = gdImageStringFT(NULL, &intFntRect[0], 0, ptrCurrFnt, dblFntSz, 0., 0, 0, ptrDummy); intTxtWdth = intFntRect[2]-intFntRect[6] + 6; intTxtHght = intFntRect[3]-intFntRect[7] + 6; printf("intTxtHght: %d intTxtWdth: %d\n", intTxtHght, intTxtWdth); printf("intFntRect[2]: %d intFntRect[6]: %d\n", intFntRect[2], intFntRect[6]); // remainder of this function follows Below is the output from the program ptrCurrFnt: /home/crvoss/Projects/AdvChart-0.1/fonts/bus.ttf, dblFntSz: 20.000000 ptrDummy: 000000 intTxtHght: 831162 intTxtWdth: 1208285958 intFntRect[2]: 134542760 intFntRect[6]: -1073743192 As can be seen from the output the font height and width are very large compared to the font size. What have I done wrong? |
All times are GMT -5. The time now is 04:57 PM. |