Skip to content

Commit bec7957

Browse files
committed
linux
1 parent 9a00c42 commit bec7957

14 files changed

Lines changed: 676 additions & 21 deletions

‎build.zig‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub fn build(b: *std.Build) void {
1010
.use_png = true,
1111
.use_glib = false,
1212
.use_dwrite = false,
13-
.use_fontconfig = false,
13+
.use_fontconfig = true,
1414
.use_freetype = true,
1515
.use_quartz = false,
1616
.target = target,
@@ -89,7 +89,11 @@ pub fn build(b: *std.Build) void {
8989
"src/init.cc",
9090
"src/itemize.cc",
9191
"src/FontManager.cc",
92-
if (target.result.os.tag == .windows) "src/FontManagerWindows.cc" else "src/FontManagerMacos.cc",
92+
switch (target.result.os.tag) {
93+
.windows => "src/FontManagerWindows.cc",
94+
.macos => "src/FontManagerMacos.cc",
95+
else => "src/FontManagerLinux.cc",
96+
},
9397
"src/FontFace.cc",
9498
"src/FontFaceSet.cc",
9599
"src/FontParser.cc",

‎pkg/freetype/build.zig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub fn build(b: *std.Build) !void {
1212
.target = target,
1313
.optimize = optimize,
1414
.link_libc = true,
15+
.pic = true,
1516
}),
1617
});
1718

‎pkg/harfbuzz/build.zig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub fn build(b: *std.Build) !void {
1111
.root_module = b.createModule(.{
1212
.target = target,
1313
.optimize = optimize,
14+
.pic = true,
1415
})
1516
});
1617

‎pkg/sheenbidi/build.zig‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub fn build(b: *std.Build) !void {
1111
.root_module = b.createModule(.{
1212
.target = target,
1313
.optimize = optimize,
14+
.pic = true,
1415
})
1516
});
1617

@@ -24,4 +25,4 @@ pub fn build(b: *std.Build) !void {
2425
sheenbidi.linkLibC();
2526

2627
b.installArtifact(sheenbidi);
27-
}
28+
}

‎src/FontManager.cc‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,6 @@ FontManager::query(
206206
) {
207207
std::vector<FontDescriptor*> allFamilyResults;
208208
std::vector<FontDescriptor*> familyResults;
209-
210-
if (!system_fonts_loaded) {
211-
readSystemFonts(system_fonts);
212-
system_fonts_loaded = true;
213-
}
214209

215210
auto maybeAdd = [&](const std::string& family, FontDescriptor* desc) {
216211
if (

‎src/FontManager.h‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ class FontManager {
1010
public:
1111
virtual ~FontManager() = default;
1212

13-
virtual void readSystemFonts(
14-
std::vector<FontDescriptor>& results
15-
) = 0;
13+
virtual void readSystemFonts() = 0;
1614

1715
virtual void populateFallbackFonts(
1816
std::vector<std::string>& families,
@@ -45,6 +43,6 @@ class FontManager {
4543
FontProperties& properties
4644
);
4745

48-
bool system_fonts_loaded = false;
46+
protected:
4947
std::vector<FontDescriptor> system_fonts;
5048
};

0 commit comments

Comments
 (0)