This repository has been archived by the owner on Jul 4, 2023. It is now read-only.
/
fontconfig.rb
253 lines (233 loc) 路 6.74 KB
/
fontconfig.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
require 'formula'
class Fontconfig < Formula
homepage 'http://fontconfig.org/'
url 'http://fontconfig.org/release/fontconfig-2.11.1.tar.bz2'
sha1 '08565feea5a4e6375f9d8a7435dac04e52620ff2'
# The bottle tooling is too lenient and thinks fontconfig
# is relocatable, but it has hardcoded paths in the executables.
bottle do
revision 2
sha1 "7f481637395b324e3f84ca098f9cf85d1ac9f5cb" => :mavericks
sha1 "1a5cea57cdd15d077e829fe93a2d794655249ba5" => :mountain_lion
sha1 "5bbe702fb724ea913579f0b22cc36da93f3c7687" => :lion
end
keg_only :provided_pre_mountain_lion
option :universal
depends_on :freetype
depends_on 'pkg-config' => :build
# Reverts commit http://cgit.freedesktop.org/fontconfig/commit/?id=7a6622f25cdfab5ab775324bef1833b67109801b,
# which breaks caching font directories containing subdirectories
# See: https://github.com/Homebrew/homebrew/issues/28111
# Reported upstream, message to mailing list is waiting moderation.
patch :DATA
def install
ENV.universal_binary if build.universal?
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--with-add-fonts=/System/Library/Fonts,/Library/Fonts,~/Library/Fonts",
"--prefix=#{prefix}",
"--localstatedir=#{var}",
"--sysconfdir=#{etc}"
system "make", "install", "RUN_FC_CACHE_TEST=false"
end
def post_install
system "#{bin}/fc-cache", "-frv"
end
end
__END__
diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c
index 99e0e9f..bf3b6b4 100644
--- a/fc-cache/fc-cache.c
+++ b/fc-cache/fc-cache.c
@@ -187,13 +187,8 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
if (!cache)
{
- if (!recursive)
- cache = FcDirCacheRescan (dir, config);
- else
- {
- (*changed)++;
- cache = FcDirCacheRead (dir, FcTrue, config);
- }
+ (*changed)++;
+ cache = FcDirCacheRead (dir, FcTrue, config);
if (!cache)
{
fprintf (stderr, "%s: error scanning\n", dir);
@@ -391,7 +386,6 @@ main (int argc, char **argv)
ret += scanDirs (list, config, FcTrue, really_force, verbose, FcFalse, &changed, NULL);
FcStrListDone (list);
}
- FcStrSetDestroy (updateDirs);
/*
* Try to create CACHEDIR.TAG anyway.
diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h
index 2258251..d0b4e9e 100644
--- a/fontconfig/fontconfig.h
+++ b/fontconfig/fontconfig.h
@@ -541,9 +541,6 @@ FcDirSave (FcFontSet *set, FcStrSet *dirs, const FcChar8 *dir);
FcPublic FcCache *
FcDirCacheLoad (const FcChar8 *dir, FcConfig *config, FcChar8 **cache_file);
-
-FcPublic FcCache *
-FcDirCacheRescan (const FcChar8 *dir, FcConfig *config);
FcPublic FcCache *
FcDirCacheRead (const FcChar8 *dir, FcBool force, FcConfig *config);
diff --git a/src/fccache.c b/src/fccache.c
index 5173e0b..10eacff 100644
--- a/src/fccache.c
+++ b/src/fccache.c
@@ -828,19 +828,6 @@ bail1:
return NULL;
}
-FcCache *
-FcDirCacheRebuild (FcCache *cache, struct stat *dir_stat, FcStrSet *dirs)
-{
- FcCache *new;
- FcFontSet *set = FcFontSetDeserialize (FcCacheSet (cache));
- const FcChar8 *dir = FcCacheDir (cache);
-
- new = FcDirCacheBuild (set, dir, dir_stat, dirs);
- FcFontSetDestroy (set);
-
- return new;
-}
-
/* write serialized state to the cache file */
FcBool
FcDirCacheWrite (FcCache *cache, FcConfig *config)
diff --git a/src/fcdir.c b/src/fcdir.c
index 3bcd0b8..b040a28 100644
--- a/src/fcdir.c
+++ b/src/fcdir.c
@@ -130,12 +130,7 @@ FcFileScanConfig (FcFontSet *set,
if (FcFileIsDir (file))
return FcStrSetAdd (dirs, file);
else
- {
- if (set)
- return FcFileScanFontConfig (set, blanks, file, config);
- else
- return FcTrue;
- }
+ return FcFileScanFontConfig (set, blanks, file, config);
}
FcBool
@@ -311,45 +306,6 @@ FcDirCacheScan (const FcChar8 *dir, FcConfig *config)
return cache;
}
-FcCache *
-FcDirCacheRescan (const FcChar8 *dir, FcConfig *config)
-{
- FcCache *cache = FcDirCacheLoad (dir, config, NULL);
- FcCache *new = NULL;
- struct stat dir_stat;
- FcStrSet *dirs;
-
- if (!cache)
- return NULL;
- if (FcStatChecksum (dir, &dir_stat) < 0)
- goto bail;
- dirs = FcStrSetCreate ();
- if (!dirs)
- goto bail;
-
- /*
- * Scan the dir
- */
- if (!FcDirScanConfig (NULL, dirs, NULL, dir, FcTrue, config))
- goto bail1;
- /*
- * Rebuild the cache object
- */
- new = FcDirCacheRebuild (cache, &dir_stat, dirs);
- if (!new)
- goto bail1;
- FcDirCacheUnload (cache);
- /*
- * Write out the cache file, ignoring any troubles
- */
- FcDirCacheWrite (new, config);
-
-bail1:
- FcStrSetDestroy (dirs);
-bail:
- return new;
-}
-
/*
* Read (or construct) the cache for a directory
*/
diff --git a/src/fcfs.c b/src/fcfs.c
index 21c6c7c..941abba 100644
--- a/src/fcfs.c
+++ b/src/fcfs.c
@@ -122,28 +122,6 @@ FcFontSetSerialize (FcSerialize *serialize, const FcFontSet * s)
return s_serialize;
}
-
-FcFontSet *
-FcFontSetDeserialize (const FcFontSet *set)
-{
- int i;
- FcFontSet *new = FcFontSetCreate ();
-
- if (!new)
- return NULL;
- for (i = 0; i < set->nfont; i++)
- {
- if (!FcFontSetAdd (new, FcPatternDuplicate (FcFontSetFont (set, i))))
- goto bail;
- }
-
- return new;
-bail:
- FcFontSetDestroy (new);
-
- return NULL;
-}
-
#define __fcfs__
#include "fcaliastail.h"
#undef __fcfs__
diff --git a/src/fcint.h b/src/fcint.h
index cdf2dab..362ea6f 100644
--- a/src/fcint.h
+++ b/src/fcint.h
@@ -567,9 +567,6 @@ FcDirCacheScan (const FcChar8 *dir, FcConfig *config);
FcPrivate FcCache *
FcDirCacheBuild (FcFontSet *set, const FcChar8 *dir, struct stat *dir_stat, FcStrSet *dirs);
-FcPrivate FcCache *
-FcDirCacheRebuild (FcCache *cache, struct stat *dir_stat, FcStrSet *dirs);
-
FcPrivate FcBool
FcDirCacheWrite (FcCache *cache, FcConfig *config);
@@ -841,9 +838,6 @@ FcFontSetSerializeAlloc (FcSerialize *serialize, const FcFontSet *s);
FcPrivate FcFontSet *
FcFontSetSerialize (FcSerialize *serialize, const FcFontSet * s);
-FcPrivate FcFontSet *
-FcFontSetDeserialize (const FcFontSet *set);
-
/* fchash.c */
FcPrivate FcChar8 *
FcHashGetSHA256Digest (const FcChar8 *input_strings,
diff --git a/src/fcpat.c b/src/fcpat.c
index 986cca3..0614ac2 100644
--- a/src/fcpat.c
+++ b/src/fcpat.c
@@ -33,7 +33,6 @@ FcPatternCreate (void)
p = (FcPattern *) malloc (sizeof (FcPattern));
if (!p)
return 0;
- memset (p, 0, sizeof (FcPattern));
p->num = 0;
p->size = 0;
p->elts_offset = FcPtrToOffset (p, NULL);
@@ -1311,7 +1310,6 @@ FcValueListSerialize (FcSerialize *serialize, const FcValueList *vl)
}
return head_serialized;
}
-
#define __fcpat__
#include "fcaliastail.h"
#include "fcftaliastail.h"