mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 07:46:12 +03:00

Fixes #2081 Many fonts have a bad ligature for "fl", "fi", or "st". We previously maintained a list of such fonts in quirks.zig. However, these are so common that it was suggested we do something more systematic and this commit is that. This commit changes our text run splitting algorithm to always split on `fl`, `fi`, and `st`. This will cause some more runs for well behaved fonts but the combination of those characters is rare enough and our caching algorithm is good enough that it should be minimal overhead. This commit renders our existing quirks fonts obsolete but I kept that logic around so we can add to it if/when we find other quirky font behaviors.
30 lines
1.2 KiB
Zig
30 lines
1.2 KiB
Zig
//! Inspired by WebKit's quirks.cpp[1], this file centralizes all our
|
|
//! sad environment-specific hacks that we have to do to make things work.
|
|
//! This is a last resort; if we can find a general solution to a problem,
|
|
//! we of course prefer that, but sometimes other software, fonts, etc. are
|
|
//! just broken or weird and we have to work around it.
|
|
//!
|
|
//! [1]: https://github.com/WebKit/WebKit/blob/main/Source/WebCore/page/Quirks.cpp
|
|
|
|
const std = @import("std");
|
|
|
|
const font = @import("font/main.zig");
|
|
|
|
/// If true, the default font features should be disabled for the given face.
|
|
pub fn disableDefaultFontFeatures(face: *const font.Face) bool {
|
|
_ = face;
|
|
|
|
// This function used to do something, but we integrated the logic
|
|
// we checked for directly into our shaping algorithm. It's likely
|
|
// there are other broken fonts for other reasons so I'm keeping this
|
|
// around so its easy to add more checks in the future.
|
|
return false;
|
|
|
|
// var buf: [64]u8 = undefined;
|
|
// const name = face.name(&buf) catch |err| switch (err) {
|
|
// // If the name doesn't fit in buf we know this will be false
|
|
// // because we have no quirks fonts that are longer than buf!
|
|
// error.OutOfMemory => return false,
|
|
// };
|
|
}
|