Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gdImageStringFT() fails for empty strings as of libgd 2.3.0 #615

@cmb69

Description

@cmb69

When trying to render an empty string via gdImageStringFT(), the function fails as of libgd 2.3.0, while formerly it was just a no-op.

Test script

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

int main()
{
    gdImagePtr im;
    int fg;
    int rect[8];
    char *res;

    im = gdImageCreate(100, 100);
    fg = gdImageColorAllocate(im, 255, 255, 255);
    res = gdImageStringFT(im, rect, fg, "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", 12, 0, 10, 10, "");
    if (res) printf("%s\n", res);
    return 0;
}

Expected output

okay

Actual output

Problem doing text layout

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions