Inkscape.org
Beginners' Questions How to dynamically kern text to fit a box?
  1. #1
    stanrandom stanrandom @stanrandom

    Hey there! I'm new to Inkscape, and despite most things being really intuitive, there's one thing I'm struggling with. I'm trying to resize a text box without resizing the text inside. It's hard to describe, but I'm trying to make the text box be a certain width (to line up with other elements) but without resizing the font size. I guess what I'm trying to do is kind of "auto dynamic kerning", if that's a thing.

    I'm trying to make it not like this, but more like this. I did that by manually eyeballing the kerning and increasing until the text didn't fit in the box, then winding it back a bit. I feel there's probably a nicer way to do it automatically.

    Sorry if this isn't particularly clear - happy to clarify anything! Thanks in advance.

  2. #2
    Polygon Polygon @Polygon🌶

    Have you tried "Flow into Frame"?

  3. #3
    stanrandom stanrandom @stanrandom
    Polygon

    Have you tried "Flow into Frame"?

    This doesn't seem to be doing any trickery with the kerning, unless I'm doing something wrong (or misunderstanding - both of these are highly likely, if I'm honest). Do you have a link to a tutorial to show what you're describing here, please?

     

  4. #4
    Polygon Polygon @Polygon🌶
    stanrandom

    I'm trying to resize a text box without resizing the text inside.

    ?

  5. #5
    stanrandom stanrandom @stanrandom

    Right, I see what I've done here. When I said "without resizing the text", I meant to say "without resizing the individual characters within the font".

    I absolutely do want the text to resize to fit the box, but I want the individual characters to remain the same size, and the space between the characters (kerning?) to vary and flow. See the "more like this" image in my original post. 

  6. #6
    Polygon Polygon @Polygon🌶

    This is all about Texthttp://tavmjong.free.fr/INKSCAPE/MANUAL/html/Text-Formatting.html

    Seems what you want is not available - at least I can´t find it.

  7. #7
    stanrandom stanrandom @stanrandom

    Yeah, I had a look and I couldn't see it - thanks for the link, though.

    I just thought of another way to describe, and maybe it'll help if someone else stumbles across the thread and can't unpick what I'm saying: I want the text to be fully-justified, i.e., flush with both the left- and right-hand edges, and I want to achieve this by instead of adjusting the spacing between words (as is traditional with full justification), by adjusting the spacing between individual letters, spacing them regularly within the left and right hand edges. Maybe this'll help! I really botched the description at first.

  8. #8
    Hum Hum @Hum
    *

    Hi. Here is a method. It is not kerning, but seems to accomplish your goal of getting certain characters spaced apart.

    See the graphic.

    (If you want, you can create a rectangle of any size, and make the "wombat" characters line up with it, instead of using "international".)

     

    Wombat
  9. #9
    Paddy_CAD Paddy_CAD @Paddy_CAD
    🆒*

    Is this what you want?

     

    Insert a space between each character.  Set the text alignment to justified (the last option in the drop-down list).  White space is stretched so that text spans the entire width of the box.  Lines are separated with carriage return.  Note that there's a third line of text with a single space.  Without this the second line won't be justified.

  10. #10
    stanrandom stanrandom @stanrandom

    Thanks, @ken10001000 - this is pretty much what I'm trying to do, I think. Thank you for the detailed instructions, too! However, I'm trying to work through it and I wonder if I'm skipping a step. When I click "align left edges" (or "align right edges"), it's not snapping into position like I'd expect. If you get a spare moment, could you review the steps please? Thank you so much.

    Also thanks to @Paddy_CAD - I love how simple and straightforward this is. However, when I tried it, I resize the text box and the characters are stretching too - they're not a fixed size, like I yours. Do I need to do something to lock the point size or something, maybe? I'm not sure how to make a gif to demonstrate what I mean, though!

     

  11. #11
    Hum Hum @Hum
    🙌*

    Hi. I reviewed my steps in the graphic and they seem correct, with no missing steps. The letters in wombat must be ungrouped, so that they can be moved indepentently. "international" must be unioned together. Both must be made into paths. The aligning and distributjng should work.

    If you are using other texts or fonts sizes or kerning, they may bot align as you expect, because each font has within it kerning aspects.

    Try this ... make a filled rectangle and below that make a much wider rectangle. Make sure they are both paths. Then align the shorter one to the longer one (left or right).

    That - in essence - is what you are doing withe the 2 texts. You are aligning one edge of a path to another edge of a different path. As far as distribution, if the individual letters widths are NOT the same, then the spacing between those paths may visually appear off.

    For example, in a font, the width of a capital S probably will not be the same as a capital H or Q. Likewise, for lower case letters. This depends on how the font creators set up their font.

    Can you provide screeen shots and a specific list of the steps you are doing? Thank you.

  12. #12
    stanrandom stanrandom @stanrandom

    Ahh, thank you @ken10001000 - I worked out exactly what I was doing wrong! Your instructions are fine, of course!

    When you wrote "select all individual letters" in the first step, I was selecting all the letters of both "wombat" and "international", which seems was not what's intended! It's all working fine now, especially when I realised the order of selecting the objects is important in the later steps too, hence "relative to last selected".

    This all makes perfect sense now, and is aligning exactly as I wanted. Thank you so, so much for your help and patience.

  13. #13
    Hum Hum @Hum

    You are welcome. Have a fun and profitable week ahead, in all aspects.

  14. #14
    Paddy_CAD Paddy_CAD @Paddy_CAD

    Re: #10

    stanrandom

    I resize the text box and the characters are stretching too

    Use the text tool (capital A) to adjust the frame and the text should re-align automatically.  You probably used the select tool (arrow) to transform both the text and the frame.  Also, I think I found a minor bug.  Sometimes my text objects reverted to left-aligned for no apparent reason. 

    This time I attached the svg file for you to explore.  I must admit, I enjoyed playing with this.  It's always nice when something starts the creative juices flowing.

    Text Box Trickery
  15. #15
    stanrandom stanrandom @stanrandom

    Thanks for the svg file @Paddy_CAD, and I'm glad you got a kick out of the exercise!

    However I'm failing to understand something fairly fundamental. You're absolutely right that I'd used the select tool to resize things, but I can't see how to use the text tool to select (and resize) the frame. Am I missing a trick, or should it "just work"?

    Thanks again!

  16. #16
    Paddy_CAD Paddy_CAD @Paddy_CAD
    *

    Start with a blank page and grab the text tool.  Click+drag to create a text frame.  You'll see a blue frame and a blinking cursor, waiting for you to type something.  Your text will be confined inside this frame and positioned according to the text alignment.  At the lower right corner of the text frame there's a diamond-shaped selection handle which is only available with the text tool or the node tool.  Click+drag to stretch the frame and the text will re-align to the new frame dimensions.  

    Using the select tool will transform the text itself, not just the enclosing frame.  I used this to my advantage in the lower paragraph, switching between the two tools, using the select tool to stretch the font and then using using the text tool (and grid snapping) to adjust the spacing.  Note that the lower paragraph is three text objects grouped together.  Ungroup these to edit them independently.

    This works a little differently with flowed text, where you can use the select tool to transform the enclosing shape.  Just be sure that you haven't selected the text too or you'll mess up the font size and alignment.

     

     

  17. #17
    stanrandom stanrandom @stanrandom

    Thanks so much for your patience in explaining this, @Paddy_CAD. This is really super clear now.

    What a great community!

Inkscape Inkscape.org Inkscape Forum Beginners' Questions How to dynamically kern text to fit a box?