Skip to content

[advisory] libXft vs. harfbuzz #2

@y-ack

Description

@y-ack

emacs 28.1 has this to say about libXft:

** 'configure' now warns about building with libXft support.
libXft is unmaintained, and causes a number of problems with modern
fonts including but not limited to crashes; support for it may be
removed in a future version of Emacs. Please consider using
Cairo + HarfBuzz instead.

on june 11, 2021, 12 had these observations about harfbuzz (for ligature support):

st code inspection

looking at maybe ligatures, and
#include <hb.h>
"what the heck is hb?"
oh my gosh harfbuzz is REAL?
230 + ATTR_LIGA = 1 << 11,

wow fuck they really just used a cast to bypass const
declare function as
hbtransform(XftGlyphFontSpec *specs, const Glyph *glyphs, size_t len, int x, int y)
then ,
((Glyph *)glyphs)[i].mode |= ATTR_LIGA;
why the fuck did they declare it as const if they're just going to modify it

mm it's starting to get pretty slow now

slow slow slow

ok so the speed issues uh
at least the new ones, seem to be entirely caused by harfbuzz,
ok I'll deal with this later i think,
not worth wasting time on a gimmick right now

library capability

also the need for both harfbuzz and freetype seems like
ugh so like
I don't think any of these libraries handle fallback at ALL
so if you can't find the glyph in your main font then you have to do like 15 billion different things and it's just stupidly inefficient
I might just umm
use one specific font for fallback just to keep this reasonable
rather than dynamically searching and
god this is so stupid
I thought libraries were supposed to actually DO things
so like,
freetype does font rasterization, but also does glyph lookup, so like
converting unicode codepoints into glyph indexes
but harfbuzz also does that,
except, harfbuzz can handle ligatures while freetype can't
but i still need freetype because harfbuzz doesn't do rasterization
and neither of these handle LOADING fonts, that's the job of fontconfig
but even fontconfig can't do fallback, or at least
not very well, anyway

leaving a ?TODO: look at harfbuzz again later re: performance?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions