I want to make a dynamic text engine, where every letter is a separate clone. I have a script to render every individual character and put it into a list, but I don’t know how to have the text kern properly. I have no problems with monospace, of course, but monospacing on some fonts looks weird.
How would I get kerning information from the font files? (if that is a thing I can do…) I can of course manually set the kerning for each letter pair but there are several thousand pairs which is, to say the least, a headache. I do not want to have to sit for hours manually setting the kerning for each pair. (i have done a little bit of that, even made an entire system for doing it quicker but it still takes quite a bit of time)
If you need any elaboration, please ask. I will try my best, but I am not the greatest at translating my ideas into words… so please be patient.
[ive been on and off trying to figure this out for at least 6 months i am so tired i even started trying to have copilot help me, and to my absolute lack of surprise copilot didn’t help very much]
What I would do is, record the width of each character in a list, then use that list to determine where letters should be. I also would not worry about kerning, because it's not something most people would notice.
because it's not something most people would notice.
Unless you type something like L² which just looks hideous without kerning. :~)
You have the characters as costumes, right? So you have them as bitmaps. So you can examine the pixels to see which are inked.
When I was doing computer typesetting for a living, I divided the font height into sixths, and in each slice I looked at the pixels at the right edge of the left character and at the left edge of the right character, worked out how much overlap of empty pixels there was in each slice, and kerned by the minimum of those overlaps (minus 2 pixels so the characters don't actually touch). That was pretty aggressive kerning, more than most human typesetters would do, but looked good imho.