UI: Allow Float Kerning for Text Objects #105181

Merged
Harley Acheson merged 1 commits from pioverfour/blender:dp_kerning_float into main 2023-04-12 19:12:07 +02:00
Member

Change Text Object character kern member to float from int, and allow
fractional changes to kerning with Shift-Alt-arrows.


Currently, the kerning used to change spacing between characters in a
text object is defined as int values. This is enough for most cases,
but for very demanding typesetting, say a logo or calligram, one may
need more precision.

Say you want to combine "u" and "n" for your DunE logo:

nnnnnn    nnnnnn       nnnn  nnnnnnnn
n::::n    n::::n       n:::nn::::::::nn
n::::n    n::::n       n::::::::::::::nn
n::::n    n::::n       nn:::::::::::::::n
n::::n    n::::n         n:::::nnnn:::::n
n::::n    n::::n         n::::n    n::::n
n::::n    n::::n         n::::n    n::::n
n:::::nnnn:::::n         n::::n    n::::n
n:::::::::::::::nn       n::::n    n::::n
 n:::::::::::::::n       n::::n    n::::n
  nn::::::::nn:::n       n::::n    n::::n
    nnnnnnnn  nnnn       nnnnnn    nnnnnn

You might want to combine the right stem of the u, with the left stem
of the n:

nnnnnn  nnnn  nnnnnnnn
n::::n  n:::nn::::::::nn
n::::n  n::::::::::::::nn
n::::n  nn:::::::::::::::n
n::::n    n:::::nnnn:::::n
n::::n    n::::n    n::::n
n::::n    n::::n    n::::n
n:::::nnnnn::::n    n::::n
n::::::::::::::::n  n::::n
 n:::::::::::::::n  n::::n
  nn:::::::::::::n  n::::n
    nnnnnnnn  nnnn  nnnnnn

To achieve this you need fine precision to align the letters together.

Another limitation this change removes is that the kerning is
currently limited to the [-20,20] range. If you’re trying to fill a
shape with words, you may need very large kerning to take the letter
far enough apart from each other. You could also use spaces, but they
have the drawback that they have to be inserted manually between each
pair of letters, instead of just kerning the entire line at once.

In addition, this change adds shortcuts to increase or decrease
kerning by increments of 1/10.


The real-life use case I had was doing this sticker:
image

This type of thing is surprisingly hard to do because you need to control the position of each letter to get a good outline and a somewhat consistent type color. I started doing it in Scribus because it offers precise kerning, but ended up patching Blender to add float kerning.

Change Text Object character `kern` member to float from int, and allow fractional changes to kerning with Shift-Alt-arrows. --- Currently, the kerning used to change spacing between characters in a text object is defined as int values. This is enough for most cases, but for very demanding typesetting, say a logo or calligram, one may need more precision. Say you want to combine "u" and "n" for your DunE logo: ``` nnnnnn nnnnnn nnnn nnnnnnnn n::::n n::::n n:::nn::::::::nn n::::n n::::n n::::::::::::::nn n::::n n::::n nn:::::::::::::::n n::::n n::::n n:::::nnnn:::::n n::::n n::::n n::::n n::::n n::::n n::::n n::::n n::::n n:::::nnnn:::::n n::::n n::::n n:::::::::::::::nn n::::n n::::n n:::::::::::::::n n::::n n::::n nn::::::::nn:::n n::::n n::::n nnnnnnnn nnnn nnnnnn nnnnnn ``` You might want to combine the right stem of the u, with the left stem of the n: ``` nnnnnn nnnn nnnnnnnn n::::n n:::nn::::::::nn n::::n n::::::::::::::nn n::::n nn:::::::::::::::n n::::n n:::::nnnn:::::n n::::n n::::n n::::n n::::n n::::n n::::n n:::::nnnnn::::n n::::n n::::::::::::::::n n::::n n:::::::::::::::n n::::n nn:::::::::::::n n::::n nnnnnnnn nnnn nnnnnn ``` To achieve this you need fine precision to align the letters together. Another limitation this change removes is that the kerning is currently limited to the [-20,20] range. If you’re trying to fill a shape with words, you may need very large kerning to take the letter far enough apart from each other. You could also use spaces, but they have the drawback that they have to be inserted manually between each pair of letters, instead of just kerning the entire line at once. In addition, this change adds shortcuts to increase or decrease kerning by increments of 1/10. ----- The real-life use case I had was doing this sticker: ![image](/attachments/ecd84584-d507-489e-9ccf-91d66d534340) This type of thing is surprisingly hard to do because you need to control the position of each letter to get a good outline and a somewhat consistent type color. I started doing it in Scribus because it offers precise kerning, but ended up patching Blender to add float kerning.
101 KiB
Jeroen Bakker added a new dependency 2023-02-24 16:26:06 +01:00
Jeroen Bakker removed a dependency 2023-02-24 16:26:11 +01:00
Member

@pioverfour

Can you include more detail? Maybe illustrate a situation where the current precision is too small, and the current limits are too narrow? Including captures can really help. You want to make it as easy as possible to understand and review without having to dig, explore, and test ourselves. The following explains what is requested:

https://wiki.blender.org/wiki/Process/Contributing_Code#Ingredients_of_a_Pull_Request

@pioverfour Can you include more detail? Maybe illustrate a situation where the current precision is too small, and the current limits are too narrow? Including captures can really help. You want to make it as easy as possible to understand and review without having to dig, explore, and test ourselves. The following explains what is requested: https://wiki.blender.org/wiki/Process/Contributing_Code#Ingredients_of_a_Pull_Request
Damien Picard force-pushed dp_kerning_float from 2ca79b9632 to 8b230c598e 2023-02-25 18:45:22 +01:00 Compare
Brecht Van Lommel requested review from Harley Acheson 2023-03-17 12:41:11 +01:00
Brecht Van Lommel added this to the User Interface project 2023-03-17 12:41:16 +01:00
Brecht Van Lommel removed this from the User Interface project 2023-03-17 12:41:23 +01:00
Brecht Van Lommel added this to the Modeling project 2023-03-17 12:41:27 +01:00
Brecht Van Lommel requested review from Campbell Barton 2023-03-17 12:41:59 +01:00
Harley Acheson changed title from Font kerning: allow float values to UI: Allow Float Kerning for Text Objects 2023-03-17 17:46:40 +01:00
Member

@pioverfour - sorry for not responding earlier. I missed that you had updated this so nicely and provided good example usage.

Yes, I can completely agree with you on the need for float kerning. Without this it is indeed far too coarse. I love the amount of adjustment here with the 0.1f change with Shift-Alt-arrow being about perfect.

Also agree that the -20,20 clamping should go. I don't like to second-guess a user's intention and would rather let them do as they wish.

Off-topic, but long-term we should consider adding a member to CharInfo to hold the default kerning (now assumed zero) or use kern to hold that and add a delta for the change from that. This would allow us to start users off with better default kerning values, from the font's kern table now or from its gpos table later.

But I love this patch, and can't find anything wrong with it. Although I am approving please consider Campbell's approval as blocking.

@pioverfour - sorry for not responding earlier. I missed that you had updated this so nicely and provided good example usage. Yes, I can completely agree with you on the need for float kerning. Without this it is indeed far too coarse. I love the amount of adjustment here with the 0.1f change with Shift-Alt-arrow being about perfect. Also agree that the -20,20 clamping should go. I don't like to second-guess a user's intention and would rather let them do as they wish. Off-topic, but long-term we should consider adding a member to `CharInfo` to hold the default kerning (now assumed zero) or use `kern` to hold that and add a delta for the change from that. This would allow us to start users off with better default kerning values, from the font's `kern` table now or from its `gpos` table later. But I love this patch, and can't find anything wrong with it. Although I am approving please consider Campbell's approval as blocking.
Harley Acheson approved these changes 2023-03-17 18:05:02 +01:00
Author
Member

Thanks for the kind words :)

No worry about the delay—I thought editing the original message would notify you, but I guess I needed to re-request review for that.

Thanks for the kind words :) No worry about the delay—I thought editing the original message would notify you, but I guess I needed to re-request review for that.
Campbell Barton approved these changes 2023-03-21 09:32:21 +01:00
Author
Member

Hi, do you think this can be merged?

Hi, do you think this can be merged?
Member

Hi, do you think this can be merged?

Yes, sorry. I didn't realize that you couldn't do so yourself. I just tested it again and will get on it. Thanks!

> Hi, do you think this can be merged? Yes, sorry. I didn't realize that you couldn't do so yourself. I just tested it again and will get on it. Thanks!
Harley Acheson merged commit 2b6c1600cf into main 2023-04-12 19:12:07 +02:00
Damien Picard deleted branch dp_kerning_float 2023-04-12 19:16:35 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#105181
No description provided.