mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-21 19:26:09 +03:00
refactor: define FreetypeLoadFlags
struct and default in font.face
This commit is contained in:
@ -11,18 +11,6 @@ pub const url = @import("config/url.zig");
|
||||
pub const FileFormatter = formatter.FileFormatter;
|
||||
pub const entryFormatter = formatter.entryFormatter;
|
||||
pub const formatEntry = formatter.formatEntry;
|
||||
pub const FreetypeLoadFlags = switch (options.backend) {
|
||||
.freetype,
|
||||
.fontconfig_freetype,
|
||||
.coretext_freetype,
|
||||
=> Config.FreetypeLoadFlags,
|
||||
|
||||
.coretext,
|
||||
.coretext_harfbuzz,
|
||||
.coretext_noshape,
|
||||
.web_canvas,
|
||||
=> void,
|
||||
};
|
||||
|
||||
// Field types
|
||||
pub const ClipboardAccess = Config.ClipboardAccess;
|
||||
|
@ -452,18 +452,7 @@ pub const LoadOptions = struct {
|
||||
/// for this is owned by the user and is not freed by the collection.
|
||||
metric_modifiers: Metrics.ModifierSet = .{},
|
||||
|
||||
freetype_load_flags: config.FreetypeLoadFlags = switch (font.options.backend) {
|
||||
.freetype,
|
||||
.fontconfig_freetype,
|
||||
.coretext_freetype,
|
||||
=> .{},
|
||||
|
||||
.coretext,
|
||||
.coretext_harfbuzz,
|
||||
.coretext_noshape,
|
||||
.web_canvas,
|
||||
=> {},
|
||||
},
|
||||
freetype_load_flags: font.face.FreetypeLoadFlags = font.face.freetype_load_flags_default,
|
||||
|
||||
pub fn deinit(self: *LoadOptions, alloc: Allocator) void {
|
||||
_ = self;
|
||||
|
@ -428,7 +428,7 @@ pub const DerivedConfig = struct {
|
||||
@"adjust-strikethrough-position": ?Metrics.Modifier,
|
||||
@"adjust-strikethrough-thickness": ?Metrics.Modifier,
|
||||
@"adjust-cursor-thickness": ?Metrics.Modifier,
|
||||
@"freetype-load-flags": configpkg.FreetypeLoadFlags,
|
||||
@"freetype-load-flags": font.face.FreetypeLoadFlags,
|
||||
|
||||
/// Initialize a DerivedConfig. The config should be either a
|
||||
/// config.Config or another DerivedConfig to clone from.
|
||||
@ -514,18 +514,7 @@ pub const Key = struct {
|
||||
/// font grid.
|
||||
font_size: DesiredSize = .{ .points = 12 },
|
||||
|
||||
load_flags: configpkg.FreetypeLoadFlags = switch (font.options.backend) {
|
||||
.freetype,
|
||||
.fontconfig_freetype,
|
||||
.coretext_freetype,
|
||||
=> .{},
|
||||
|
||||
.coretext,
|
||||
.coretext_harfbuzz,
|
||||
.coretext_noshape,
|
||||
.web_canvas,
|
||||
=> {},
|
||||
},
|
||||
load_flags: configpkg.FreetypeLoadFlags = font.face.freetype_load_flags_default,
|
||||
|
||||
const style_offsets_len = std.enums.directEnumArrayLen(Style, 0);
|
||||
const StyleOffsets = [style_offsets_len]usize;
|
||||
|
@ -27,11 +27,25 @@ pub const Face = switch (options.backend) {
|
||||
/// using whatever platform method you can.
|
||||
pub const default_dpi = if (builtin.os.tag == .macos) 72 else 96;
|
||||
|
||||
pub const FreetypeLoadFlags = switch (options.backend) {
|
||||
.freetype,
|
||||
.fontconfig_freetype,
|
||||
.coretext_freetype,
|
||||
=> config.Config.FreetypeLoadFlags,
|
||||
|
||||
.coretext,
|
||||
.coretext_harfbuzz,
|
||||
.coretext_noshape,
|
||||
.web_canvas,
|
||||
=> void,
|
||||
};
|
||||
pub const freetype_load_flags_default = if (options.backend.hasFreetype()) .{} else {};
|
||||
|
||||
/// Options for initializing a font face.
|
||||
pub const Options = struct {
|
||||
size: DesiredSize,
|
||||
metric_modifiers: ?*const Metrics.ModifierSet = null,
|
||||
freetype_load_flags: config.FreetypeLoadFlags,
|
||||
freetype_load_flags: FreetypeLoadFlags,
|
||||
};
|
||||
|
||||
/// The desired size for loading a font.
|
||||
|
@ -36,7 +36,7 @@ pub const Face = struct {
|
||||
metrics: font.face.Metrics,
|
||||
|
||||
/// Freetype load flags for this font face.
|
||||
load_flags: config.FreetypeLoadFlags,
|
||||
load_flags: font.face.FreetypeLoadFlags,
|
||||
|
||||
/// Set quirks.disableDefaultFontFeatures
|
||||
quirks_disable_default_font_features: bool = false,
|
||||
|
Reference in New Issue
Block a user