Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bounding box of zero for MagickQueryMultilineFontMetrics #222

Closed
Danack opened this issue Jun 18, 2016 · 2 comments
Closed

Bounding box of zero for MagickQueryMultilineFontMetrics #222

Danack opened this issue Jun 18, 2016 · 2 comments
Labels

Comments

@Danack
Copy link
Contributor

Danack commented Jun 18, 2016

Hi,

it looks like the function MagickQueryMultilineFontMetrics is not setting the bounding box in the results. Testing against 7.0.1-0 with the code below gives this output:

Single line
bounding box: x1 : 0.437500 
bounding box: y1 : 0.000000 
bounding box: x2 : 6.125000 
bounding box: y2 : 7.000000

Multi-line
bounding box: x1 : 0.000000 
bounding box: y1 : 0.000000 
bounding box: x2 : 0.000000 
bounding box: y2 : 0.000000 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wand/MagickWand.h>


int main(int argc,char **argv) {
    MagickWand *canvas_wand;
    double *metrics;
    DrawingWand *drawing_wand;
    int i = 0;
    char *text = "Hello \nHello";

    char *metricText[] = {
        "character width",//                            0 character width
        "character height",//                          1 character height
        "ascender",//                                  2 ascender
        "descender",//                                 3 descender
        "text width",//                                4 text width
        "text height",//                               5 text height
        "maximum horizontal advance",//                6 maximum horizontal advance
        "bounding box: x1",//                          7 bounding box: x1
        "bounding box: y1",//                          8 bounding box: y1
        "bounding box: x2",//                          9 bounding box: x2
        "bounding box: y2",//                         10 bounding box: y2
        "origin: x",//                                11 origin: x
        "origin: y",//                                12 origin: y
    };

    MagickWandGenesis();
    drawing_wand = NewDrawingWand();
    canvas_wand = NewMagickWand();
    MagickReadImage(canvas_wand, "magick:logo");

    metrics = MagickQueryFontMetrics(canvas_wand, drawing_wand, text);
    printf("Single line\n");
    for (i=7; i<=10; i++) {
        printf("%s : %f \n", metricText[i], metrics[i]);
    }

    metrics = MagickQueryMultilineFontMetrics(canvas_wand, drawing_wand, text);
    printf("Multi-line\n");
    for (i=7; i<=10; i++) {
        printf("%s : %f \n", metricText[i], metrics[i]);
    }

    MagickWandTerminus();
    return (0);
}

@mikayla-grace
Copy link

Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.

@dlemstra
Copy link
Member

@Danack Can you confirm this is resolved in the latest release?

jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Jun 30, 2016
2016-06-21  7.0.2-1 Cristy  <quetzlzacatenango@image...>
  * Release ImageMagick version 7.0.2-1, GIT revision 18479:931319b:20160622.

2016-06-17  7.0.2-1 Dirk Lemstra <dirk@lem.....org>
  * Added support for GROUP4 compression to the FAX coder.

2016-06-12  7.0.2-1 Cristy  <quetzlzacatenango@image...>
  * Distort no longer converts grayscale image to sRGB (reference
    https://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=29895).
  * Don't return a zero bounding box for QueryMultilineFontMetrics() (reference
    ImageMagick/ImageMagick#222).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants