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
Closed

Feature request: line height and kern #418

haydenzone opened this issue Jul 7, 2019 · 3 comments
Labels
Milestone

Comments

@haydenzone
Copy link

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
Copy link
Owner

emcconville 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
Copy link
Owner

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
Copy link
Author

haydenzone commented Jul 12, 2019 via email

@emcconville emcconville added this to the Wand 0.5.6 milestone Jul 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants