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

Feature request: line height and kern #418

Closed
haydenzone opened this issue Jul 7, 2019 · 3 comments

Comments

@haydenzone
Copy link

commented Jul 7, 2019

Howdy!

First off, I've been using this library for a couple hours and it's great. I appreciate all the work that has been put into it!

I was hoping to request API exposure for line height and kern features that ImageMagick provides for captions(see docs).

Thanks so much!
Hayden

@emcconville

This comment has been minimized.

Copy link
Owner

commented Jul 8, 2019

API features should be available on the wand.drawing.Drawing class. Drawing.interline_spacing & Drawing.text_kerning property exists. The caption function is just a light-weight wrapper for the caption: protocol. Customizing & extended the text behavior would require you to roll your own drawing context. See Word Wrapping doc as an example.

emcconville added a commit that referenced this issue Jul 12, 2019
@emcconville

This comment has been minimized.

Copy link
Owner

commented Jul 12, 2019

Hey!

Added an annotation method. This method differs from caption as it requires a wand.drawing.Drawing context to dictate type-face styles. So for kerning, and line height, you would do something like...

message = '   Quick\nbrown\n   fox'
with Image(width=250, height=150, pseudo='xc:lightgreen') as img:
    with Drawing() as ctx:
        ctx.fill_color = 'orange'
        ctx.font_family = 'Times New Roman'
        ctx.font_size = 40
        ctx.text_kerning = -4
        ctx.text_interline_spacing = -20
        img.annotate(message, ctx, left=30, baseline=40)
    img.trim()
    img.save(filename='output.png')

output

@haydenzone

This comment has been minimized.

Copy link
Author

commented Jul 12, 2019

@emcconville emcconville added this to the Wand 0.5.6 milestone Jul 12, 2019

@emcconville emcconville added the enhance label Jul 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.