#23 add support for drawing text with bitmap font to annotate.c

closed-fixed
None
5
2011-11-27
2011-03-21
lhelper
No

When I try to draw a text string onto image with bitmap font, I got a mess result!

command:
/usr/local/GraphicsMagick/bin/gm convert -debug all -quality 90 -antialias -font "@/usr/share/fonts/bitmap-fonts/console8x8.pcf" -encoding UTF-8 -pointsize 8 -draw "text 20,40 '9876543210'" blank.jpg annotate_mess.jpg

By learning the code of annotate.c, gd library(gdft.c) and freetype2, I learned:
1) the fixed-size bitmap font dose not support transform(see FT_Glyph_Transform), so the bitmap->left is always 0;
2) the data structure of 1-bit monochrome bitmap's bitmap.buffer differ from 8-bit gray-level pixmap, so the buffer should not be iterated with the same method.

And here is the patch of annotate.c, 'annotate.c.patch', some code was copied from gd library(gdft.c),

Now, with the same command, I got the right result.

Discussion

  • lhelper

    lhelper - 2011-03-21

    add process for 1-bit monochrome bitmap

     
  • lhelper

    lhelper - 2011-03-21

    mess result with bitmap font

     
  • lhelper

    lhelper - 2011-03-21

    right result

     
  • Bob Friesenhahn

    Bob Friesenhahn - 2011-11-27
    • assigned_to: nobody --> bfriesen
    • status: open --> closed-fixed
     
  • Bob Friesenhahn

    Bob Friesenhahn - 2011-11-27

    Applied as Mercurial changeset bf948f37d0f4.

    Thanks for the patch!

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks