Improvement to Kern Node

john's Avatar

john

10 Aug, 2025 09:26 AM

I have made a small improvement to my kern node.

In the 3.6 release of my library I altered kern so that it would work with my line_break node. I also allowed you to control the leading (the space between lines) if you feed it a string with line breaks.

The method I used to implement leading for multi-line text was crude. It worked well enough for casual work, but did not produce true leading with text aligned to baselines.

This release fixes that. If you use kern with line breaks, you can now control the leading accurately. See demo.

The kern node normally produces left aligned text. If you want to change the alignment to center or right, just use an align node, as shown in the demo. Set the Vertical Align to "No Change" to preserve the leading. If you are positioning your text anywhere other than the center line of the canvas, you will need to add an additional translate node.

This improved node will be included in the upcoming 3.7 release of the Cartan Node Library.

  1. 1 Posted by abdu on 10 Aug, 2025 08:50 PM

    abdu's Avatar

    Having leading, after kerning and word spacing in your kern node is a huge thing John, dunno how to thank really.

    Just got curious again after the first time I bumped into your kern node, so I've been always meaning to ask:

    Fonts are mostly kerned internally, each of them has their own metric system —since that part of the job is a pain in the ass— my question; is this node uses font file's kerning metrics or is it just adjust kerning with your magic? (Please say it's solely your magic, please, please:)

    I could figure this with an un-kerned font file from my dump but I am out of reach and it is always nice to holler at you!

    Cheers,
    Abdu

  2. Support Staff 2 Posted by john on 10 Aug, 2025 10:10 PM

    john's Avatar

    Abdu,

    Thanks once again for your kind words.

    The character kerning in my kern node is indeed solely my "magic". As far as I can tell I have no access to a font's internal character metrics (other than how each character lands on the baseline). So instead I use my stack_tight node. This allows me to scoot letters together into as cozy an embrace as you want.

    It's not perfect, but it works pretty well.

    I am still looking at other ways to allow leading control. I may add it to charpath and wordpath. That way you could still use the width control to quickly experiment with different line breaks, then adjust leading separately.

    Over the years I've built up a half dozen different text nodes that have overlapping but slightly different capabilities. I sometimes wonder if I could replace them all with a super node, but that node would need far more than 7 parameters. I know Nodebox allows that, but it feels untidy to me. I'm always looking for that sweet spot between simplicity and flexibility.

    Thanks again,

    John

  3. 3 Posted by abdu on 10 Aug, 2025 11:06 PM

    abdu's Avatar

    !!... tidy or untidy, I'll be waiting for your super node for sure!

    I am just gonna drop some sample text that covers most of the naughty kerning pairs here, juust in case:

    Aaron Abraham Adam Aeneas Agfa Ahoy Aileen \
    Akbar Alanon Americanism Anglican Aorta April Fool’s Day \
    Aqua Lung (Tm.) Arabic Ash Wednesday Authorized Version \
    Ave Maria Away Axel Ay Aztec Bhutan Bill \
    Bjorn Bk Btu. Bvart Bzonga California Cb Cd Cervantes \
    Chicago Clute City, Tx. Cmdr. Cnossus Coco Cracker State, Georgia \
    Cs Ct. Cwacker Cyrano David Debra Dharma Diane Djakarta \
    Dm Dnepr Doris Dudley Dwayne Dylan Dzerzhinsk Eames Ectomorph \
    Eden Eerie Effingham, Il. Egypt Eiffel Tower Eject Ekland \
    Elmore Entreaty Eolian Epstein Equine Erasmus Eskimo Ethiopia Europe \
    Eva Ewan Exodus Jan van Eyck Ezra Fabian February \
    Fhara Fifi Fjord Florida Fm France Fs Ft. Fury \
    Fyn Gabriel Gc Gdynia Gehrig Ghana Gilligan Karl Gjellerup \
    Gk. Glen Gm Gnosis Gp.E. Gregory Gs Gt. Br. Guinevere \
    Gwathmey Gypsy Gzags Hebrew Hf Hg Hileah Horace Hrdlicka \
    Hsia Hts. Hubert Hwang Hai Hyacinth Hz. Iaccoca Ibsen Iceland \
    Idaho If Iggy Ihre Ijit Ike Iliad Immediate Innocent Ione \
    Ipswitch Iquarus Ireland Island It Iud Ivert Iwerks Ixnay \
    Iy Jasper Jenks Jherry Jill Jm Jn Jorge Jr. Julie \
    Kerry Kharma Kiki Klear Koko Kruse Kusack Kylie Laboe Lb. \
    Leslie Lhihane Llama Lorrie Lt. Lucy Lyle Madeira Mechanic Mg. \
    Minnie Morrie Mr. Ms. Mt. Music My Nanny Nellie Nillie \
    Novocane Null Nyack Oak Oblique Occarina Odd Oedipus Off Ogmane \
    Ohio Oil Oj Oklahoma Olio Omni Only Oops Opera Oqu \
    Order Ostra Ottmar Out Ovum Ow Ox Oyster Oz Parade Pd. \
    Pepe Pfister Pg. Phil Pippi Pj Please Pneumonia Porridge Price \
    Psalm Pt. Purple Pv Pw Pyre Qt. Quincy Radio Rd. Red \
    Rhea Right Rj Roche Rr Rs Rt. Rural Rwanda Ryder Sacrifice \
    Series Sgraffito Shirt Sister Skeet Slow Smore Snoop Soon Special \
    Squire Sr St. Suzy Svelte Swiss Sy Szach Td Teach There \
    Title Total Trust Tsena Tulip Twice Tyler Tzean Ua Udder \
    Ue Uf Ugh Uh Ui Uk Ul Um Unkempt Uo Up Uq Ursula \
    Use Utmost Uvula Uw Uxurious Uzßai Valerie Velour Vh Vicky Volvo \
    Vs Water Were Where With World Wt. Wulk Wyler Xavier Xerox \
    Xi Xylophone Yaboe Year Yipes Yo Ypsilant Ys Yu Zabar’s Zero \
    Zhane Zizi Zorro Zu Zy Don’t I’ll I’m I’se

    lynx tuft frogs, dolphins abduct by proxy \
    the ever awkward klutz, dud, dummkopf, jinx \
    snubnose filmgoer, orphan sgt. renfruw grudgek \
    reyfus, md. sikh psych if halt tympany jewelry \
    sri heh! twyer vs jojo pneu fylfot alcaaba \
    son of nonplussed halfbreed bubbly playboy guggenheim \
    daddy coccyx sgraffito effect, vacuum dirndle \
    impossible attempt to disvalue, muzzle the afghan \
    czech czar and exninja, bob bixby dvorak wood \
    dhurrie savvy, dizzy eye aeon circumcision uvula \
    scrungy picnic luxurious special type carbohydrate \
    ovoid adzuki kumquat bomb? afterglows gold girl \
    pygmy gnome lb. ankhs acme aggroupment akmed \
    brouhha tv wt. ujjain ms. oz abacus mnemonics \
    bhikku khaki bwana aorta embolism vivid owls often \
    kvetch otherwise, wysiwyg densfort wright you’ve \
    absorbed rhythm, put obstacle kyaks krieg kern \
    wurst subject enmity equity coquet quorum pique \
    tzetse hepzibah sulfhydryl briefcase ajax ehler kafka \
    fjord elfship halfdressed jugful eggcup hummingbirds \
    swingdevil bagpipe legwork reproachful hunchback \
    archknave baghdad wejh rijswijk rajbansi rajput ajdir \
    okay weekday obfuscate subpoena liebknecht marcgravia \
    ecbolic arcticward dickcissel pincpinc boldface maidkin \
    adjective adcraft adman dwarfness applejack darkbrown \
    kiln palzy always farmland flimflam unbossy nonlineal \
    stepbrother lapdog stopgap sx countdown basketball \
    beaujolais vb. flowchart aztec lazy bozo syrup \
    tarzan annoying dyke yucky hawg gagzhukz cuzco \
    squire when hiho mayhem nietzsche szasz gumdrop milk \
    emplotment ambidextrously lacquer byway ecclesiastes \
    stubchen hobgoblins crabmill aqua hawaii blvd. \
    subquality byzantine empire debt obvious cervantes \
    jekabzeel anecdote flicflac mechanicville bedbug \
    couldn’t i’ve it’s they’ll they’d dpt. headquarter \
    burkhardt xerxes atkins govt. ebenezer lg. lhama \
    amtrak amway fixity axmen quumbabda upjohn hrumpf

    LYNX TUFT FROGS, DOLPHINS ABDUCT BY PROXY \
    THE EVER AWKWARD KLUTZ, DUD, DUMMKOPF, JINX \
    SNUBNOSE FILMGOER, ORPHAN SGT. RENFRUW GRUDGEK \
    REYFUS, MD. SIKH PSYCH IF HALT TYMPANY JEWELRY \
    SRI HEH! TWYER VS JOJO PNEU FYLFOT ALCAABA \
    SON OF NONPLUSED HALFBREED BUBBLY PLAYBOY GUGGENHEIM \
    DADDY COCCYX SGRAFFITO EFFECT, VACUUM DIRNDLE \
    IMPOSSIBLE ATTEMPT TO DISVALUE, MUZZLE THE AFGHAN \
    CZECH CZAR AND EXNINJA, BOB BIXBY DVORAK WOOD \
    DHURRIE SAVVY, DIZZY EYE AEON CIRCUMCISION UVULA \
    SCRUNGY PICNIC LUXURIOUS SPECIAL TYPE CARBOHYDRATE \
    OVOID ADZUKI KUMQUAT BOMB? AFTERGLOWS GOLD GIRL \
    PYGMY GNOME LB. ANKHS ACME AGGROUPMENT AKMED \
    BROUHHA TV WT. UJJAIN MS. OZ ABACUS MNEMONICS \
    BHIKKU KHAKI BWANA AORTA EMBOLISM VIVID OWLS OFTEN \
    KVETCH OTHERWISE, WYSIWYG DENSFORT WRIGHT YOU’VE \
    ABSORBED RHYTHM, PUT OBSTACLE KYAKS KRIEG KERN \
    WURST SUBJECT ENMITY EQUITY COQUET QUORUM PIQUE \
    TZETSE HEPZIBAH SULFHYDRYL BRIEFCASE AJAX EHLER KAFKA \
    FJORD ELFSHIP HALFDRESSED JUGFUL EGGCUP HUMMINGBIRDS \
    SWINGDEVIL BAGPIPE LEGWORK REPROACHFUL HUNCHBACK \
    ARCHKNAVE BAGHDAD WEJH RIJSWIJK RAJBANSI RAJPUT AJDIR \
    OKAY WEEKDAY OBFUSCATE SUBPOENA LIEBKNECHT MARCGRAVIA \
    ECBOLIC ARCTICWARD DICKCISSEL PINCPINC BOLDFACE MAIDKIN \
    ADJECTIVE ADCRAFT ADMAN DWARFNESS APPLEJACK DARKBROWN \
    KILN PALZY ALWAYS FARMLAND FLIMFLAM UNBOSSY NONLINEAL \
    STEPBROTHER LAPDOG STOPGAP SX COUNTDOWN BASKETBALL \
    BEAUJOLAIS VB. FLOWCHART AZTEC LAZY BOZO SYRUP \
    TARZAN ANNOYING DYKE YUCKY HAWG GAGZHUKZ CUZCO \
    SQUIRE WHEN HIHO MAYHEM NIETZSCHE SZASZ GUMDROP MILK \
    EMPLOTMENT AMBIDEXTROUSLY LACQUER BYWAY ECCLESIASTES \
    STUBCHEN HOBGOBLINS CRABMILL AQUA HAWAII BLVD. \
    SUBQUALITY BYZANTINE EMPIRE DEBT OBVIOUS CERVANTES \
    JEKABZEEL ANECDOTE FLICFLAC MECHANICVILLE BEDBUG \
    COULDN’T I’VE IT’S THEY’LL THEY’D DPT. HEADQUARTER \
    BURKHARDT XERXES ATKINS GOVT. EBENEZER LG. LHAMA \
    AMTRAK AMWAY FIXITY AXMEN QUUMBABDA UPJOHN HRUMPF

  4. Support Staff 4 Posted by john on 10 Aug, 2025 11:29 PM

    john's Avatar

    That's quite a naughty text file! I will enjoy trying it with different fonts, though it's a bit overwhelming. Where did you get it?

    Can you tell me a little more about how you use (or want to use) text inside Nodebox?

    • Why do you need kerning, word spacing, and leading controls?
    • Are you mostly just making titles or labels for diagrams orr are you using Nodebox to produce text-heavy output?
    • Do you use grid-based placement systems that would benefit from my place_text node? If so, what kind of things are you making?
    • Do you really need to do text styling, kerning, leading, color highlighting, and grid placement all at the same time? In Nodebox? Why?

    I'm trying to better understand the needs of a power user like you. If you can share some specific use cases it would help me improve my nodes to fit your needs better.

    Thanks for anything you want to share.

    John

  5. 5 Posted by abdu on 11 Aug, 2025 11:35 AM

    abdu's Avatar

    There are several sources that I use as sample texts for kerning pairs:
    http://web.archive.org/web/20180621013020/http://www.logofontandlet...
    http://www.as8.it/type/basic_kerning_text.html
    http://www.ninastoessinger.com/stringmaker/index.php
    (There is always more.)

    Sorry, I couldn't get my head around your well structured questionnaire, John :)
    But my general answer to all of your Q's is just an enthusiastic:

    YES!

    I stopped using Adobe products a while back just because I was bored. ...and following the same boredom vein, I started to do everything in Nodebox! I even prepared animated editorial page here just for the sake of it. Wish I could have it now! ...so since I do mostly graphic and type design, nb is not only a playground, it's the place to thrive and to get lost in most cases.

    Current text related nodes that we have in nodebox (+the ones that you made) are more than enough for using text in projects.

    My intention for kerning specifically is to make a tool and good use for kerning pairs and sidebearings of the letter forms during the production of type design, maybe one day. When you are dealing with a font project that has 1200+ glyphs, sometimes you are ought to make 2000+ kerning pairs manually. This depends on the letterforms that you are drawing but usually kerning process takes most of the time and energy. I was wondering if it would be possible to get metric values out of nodebox as a csv file for the purpose of this specific need.

    I am gonna give an example from Work Sans:

    SEGMENT SPACING

    #Name;Width;LeftSideBearing;RightSideBearing;

    G;724;68;79;

    SEGMENT KERNING (for the 'AT' and 'TA' pairs)

    #First;Second;Value

    @MMK_L_A;@MMK_R_T;-90

    @MMK_L_T;@MMK_R_A;-90

    (@MMK stands for manual kerning class)

    Possibility of making tools for this sorta painful things just started to get exciting after we start to get the help of AI here in the forum.

    Thank you for taking your time to ask and considering me as power user but I was and still am here to witness what we will experiment and experience here as a collective with this "thing" that we have here —even though I am not around and sharing as I should be— I am quite happy how it goes really.

    I am so eager to share the things I've done— actually, recently started to gather around all the stuff that I did over the years to make some sort of a cemetery-like webpage. I re-made some of them in NodeBox Live so they can feel a bit more alive and interactive. SO, one day you'll see —hopefully good— use of bits of pieces from some of your nodes . (fingers=crossed)

    I'm so away from my computer at the moment but I'll try to find an example to make my point when I get to the zone.

    Adieu,
    Abdu

  6. Support Staff 6 Posted by john on 12 Aug, 2025 08:17 PM

    john's Avatar

    Abdu,

    Thank you very much for those detailed and helpful comments. I appreciate learning about the three kerning pair sites you provided; I will find them quite useful for future experiments.

    I also have just carried out on my threat and have added leading controls to my charpath and wordpath nodes. This will make it even easier to try dynamic width-based line breaks and leading layouts:

    http://support.nodebox.net/discussions/show-your-work/1000-leading-...

    I spent a little time refreshing my memory about the internal metrics in True Type fonts. I still see no obvious way of sucking these metrics directly into Nodebox, but even if you could (for a particular font and text string), I think they are just too complicated.

    You could conceivably access some of Nodebox's much more limited internal metrics with AI-assisted Python code using an approach similar to my canvas node, although I'm not sure this would work. But I don't think that would buy you much even if it did.

    Fortunately, you can do a LOT with my existing text nodes to develop a tool to help you adjust kerning pairs and other such things. In particular, my kern node would allow you to adjust kerning (based solely on character paths), word spacing, and leading for a block of text with manual line breaks.

    Kern outputs one path per line, but you can ungroup it into individual characters. You could then use my change_item node to adjust particular kerning pairs by nudging a single character a little to the left or right (or up and down for superscripts and subscripts). To do this, set Option to Nudge. You can chain together multiple change_item nodes to make multiple fine tuning adjustments for the ultimate control over any block of text in any font.

    Once you were satisfied, it should be fairly simple to calculate the internal True Type metrics you need for any kerning pair based on the settings you made to kern and change_item (taking font size into account). You could probably come up with a system to streamline this process.

    If you do develop such a system, I would love to see a demo of it in action. If there's some other particular text adjustment you need to make in Nodebox that my current nodes can't quite do, please let me know.

    I am still thinking about the half dozen different text nodes I now have in my library and how they could work together better or maybe even be consolidated in some way.

    I think I now have the tools to simulate a responsive webpage layout with finely-controlled markup text entirely within Nodebox. Such a stunt would be crazy even for me, and fairly useless to boot, but I think it would be possible.

    John

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • kern_3.7_screenshot.png 531 KB
  • kern_3.7_demo.ndbx.zip 11.8 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

12 Jan, 2026 04:08 PM
26 Dec, 2025 10:25 AM
19 Dec, 2025 07:35 AM
26 Nov, 2025 06:16 AM
24 Nov, 2025 03:36 PM

 

16 Nov, 2025 11:08 PM
25 Oct, 2025 02:52 AM
26 Sep, 2025 10:03 PM
19 Sep, 2025 03:34 PM
09 Sep, 2025 08:12 AM
09 Sep, 2025 12:45 AM