kb_text_shape.h - "Single-header C/C++ text segmentation and shaping in ~22kloc" https://github.com/JimmyLefevre/kb (FYI @MikkoMononen)
GitHub - JimmyLefevre/kb: kb single-header C/C++ libraries

kb single-header C/C++ libraries. Contribute to JimmyLefevre/kb development by creating an account on GitHub.

GitHub
@aras Really cool, thanks for sharing!
@aras this is exactly what i've been looking for, thank you!!
@aras @MikkoMononen text-shaping newbie question: what benefit would i gain from using this instead of harbuzz?
@JamesWidman @aras It is smaller (if that matters), and also code for figuring out the bidi runs and word/line breaks.
@MikkoMononen @aras ah, i see: harfbuzz does shaping, but not segmentation
@MikkoMononen @JamesWidman @aras maybe also the opposite question (besides the noted caveat about no rasterization): what does Hardbuzz do that this doesn't / can't?
@PythagoRascal @JamesWidman @aras probably a lot of backwards compatibility stuff, and it has also API to get font metrics, glyph outlines. Metrics needed for font selection and layout, glyph stuff for rendering.

@MikkoMononen @PythagoRascal @aras also, i would imagine that, because HarfBuzz is so widely used & tested, it may handle some corner cases that kb does not...?

In which case, i might not want to depend on kb in the feature-complete version of a shipping product...

*However*, if i'm in a rapid-prototyping phase, or just doing some quick one-off experiments, then i might gladly sacrifice HarfBuzz's completeness in exchange for the relative ease of dropping kb's one small header into my src dir.

@JamesWidman @aras @MikkoMononen
Slower at read-time, much faster at runtime.
Better API. No implicit memory allocation, no callbacks.
Easy to compile without LIBC, if that's your thing :)
@aras
"Hmm, that coding style reminds me of Casey's"
> looks at the author's profile
> Handmade Hero logo
Checks out. This increases the likelihood that it's a well made library.

@aras @MikkoMononen

Hi!

I'm currently testing it out, and I'm doing comparisons between KB and libRaqm/Harfbuzz. Currently, my performance numbers are a bit off I think.

Do any of you happen to have some benchmark codeand/or results one could have a look at? I'd like to know I've set it up correctly 🤔

@jcash @aras I dont know an existing benchmark, curious to see what you find out.

Do you have a specific metric you want to measure?

libgraphme as bidi/break related benchmarks: https://libs.suckless.org/libgrapheme/

and harfbuzz has shaping related benchmarks: https://github.com/harfbuzz/harfbuzz/blob/main/perf/README.md

Cosmic text also has a benches: https://github.com/pop-os/cosmic-text/tree/main/benches
The cosmic benches will need font fallback setup, which neither of your tested systems support, though. Maybe it could be adapted.

libraries | suckless.org software that sucks less

@MikkoMononen

Thanks!
I think I'll look into running the Harfbuzz tests!

My current test om macOS M1 seems it's doing good, but not seeing the same numbers as the author.
https://github.com/JimmyLefevre/kb/issues/21

Q: performance benchmarks · Issue #21 · JimmyLefevre/kb

Hi! I was wondering if you had any available benchmark numbers comparing with libraqm/harfbuzz? In my current due diligence, for libraqm I'm using this example (by modifying their unit test to do t...

GitHub