freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ft] Freetype cross-compilation issue - Inconsistent results


From: Rasmus Kjeldsen
Subject: [ft] Freetype cross-compilation issue - Inconsistent results
Date: Sat, 19 Apr 2008 14:06:03 +0200

Hi All

I have a program which uses Freetype (through libgd). When I run the program on my host computer (i386 Ubuntu) I get the desired result, but when cross-compiling it to ARM (an Gumstix Verdex) I get a slightly different result.

The program is listed below, attached is two png images, one from the i386 and one from the arm machine.

Note how the text is slightly distorted on the arm image.

I'm using libfreetype 2.3.5 on both machines, libgd 2.0.35 on the arm, libgd 2.0.34 on the i386 host.

Any suggestions?

Cheers
Rasmus Friis Kjeldsen

Program listing:

      #include "gd.h"
      #include <stdio.h>

//    Font: /usr/share/fonts/truetype/pf_tempesta_seven.ttf

//    gcc -o gdtest gdtest.c -lgd -lpng -lz -lfreetype -lm  && ./gdtest

//     make -f Makefile.arm clean; make -f Makefile.arm


      int main() {
      gdImagePtr im;
      FILE *pngout, *jpegout;
      int black;
      int white;
      // Allocate the image:
      im = gdImageCreate(256, 64);

      /* Allocate the color white
      Since this is the first color in a new image, it will
      be the background color. */
      white = gdImageColorAllocate(im, 255, 255, 255);
      black = gdImageColorAllocate(im, 0, 0, 0);

    char *err;
    double sz = 6.0;
    char *f = "/usr/share/fonts/truetype/pf_tempesta_seven.ttf";
    int brect[8];
    int x=0, y=7;

    gdFTStringExtra strex;

    err = gdImageStringFTEx(im, &brect[0], -black, f, sz, 0.0, x, y, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", &strex);
    if (err) {fprintf(stderr,err); return 1;}

    err = gdImageStringFTEx(im, &brect[0], -black, f, sz, 0.0, x, y+8, "abcdefghijklmnopqrstuvwxyz", &strex);
    if (err) {fprintf(stderr,err); return 1;}

      /* Open a file for writing. "wb" means "write binary", important
      under MSDOS, harmless under Unix. */
      pngout = fopen("test.png", "wb");
      /* Output the image to the disk file in PNG format. */
      gdImagePng(im, pngout);
      /* Close the files. */
      fclose(pngout);
      /* Destroy the image in memory. */
      gdImageDestroy(im);
      }

Attachment: test_on_arm.png
Description: PNG image

Attachment: test_on_i386.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]