Pier Angelo Vendrame pushed to branch tor-browser-128.4.0esr-14.5-1 at The Tor Project / Applications / Tor Browser
Commits:
-
7fdefc8e
by Pier Angelo Vendrame at 2024-10-25T01:13:30+00:00
-
70283a2f
by Pier Angelo Vendrame at 2024-10-28T09:11:14+01:00
6 changed files:
- + browser/fonts/fonts.conf
- browser/fonts/moz.build
- gfx/thebes/gfxFcPlatformFontList.cpp
- tools/update-packaging/common.sh
- tools/update-packaging/make_full_update.sh
- tools/update-packaging/make_incremental_update.sh
Changes:
| 1 | +<?xml version="1.0"?>
|
|
| 2 | +<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
|
|
| 3 | +<!--
|
|
| 4 | +**DO NOT EDIT THIS FILE!**
|
|
| 5 | +This file sets Tor Browser's bundled fonts as the only available system fonts
|
|
| 6 | +and standardizes rendering settings.
|
|
| 7 | +Any changes might deanonymize you, or expose you to fingerprinting vectors.
|
|
| 8 | +-->
|
|
| 9 | +<!--
|
|
| 10 | +Derived from fonts.conf.in of Fontconfig.
|
|
| 11 | + |
|
| 12 | +Copyright © 2000,2001,2002,2003,2004,2006,2007 Keith Packard
|
|
| 13 | +Copyright © 2005 Patrick Lam
|
|
| 14 | +Copyright © 2009 Roozbeh Pournader
|
|
| 15 | +Copyright © 2008,2009 Red Hat, Inc.
|
|
| 16 | +Copyright © 2008 Danilo Šegan
|
|
| 17 | +Copyright © 2012 Google, Inc.
|
|
| 18 | + |
|
| 19 | + |
|
| 20 | +Permission to use, copy, modify, distribute, and sell this software and its
|
|
| 21 | +documentation for any purpose is hereby granted without fee, provided that
|
|
| 22 | +the above copyright notice appear in all copies and that both that
|
|
| 23 | +copyright notice and this permission notice appear in supporting
|
|
| 24 | +documentation, and that the name of the author(s) not be used in
|
|
| 25 | +advertising or publicity pertaining to distribution of the software without
|
|
| 26 | +specific, written prior permission. The authors make no
|
|
| 27 | +representations about the suitability of this software for any purpose. It
|
|
| 28 | +is provided "as is" without express or implied warranty.
|
|
| 29 | + |
|
| 30 | +THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
| 31 | +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
| 32 | +EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
| 33 | +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
| 34 | +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
| 35 | +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
| 36 | +PERFORMANCE OF THIS SOFTWARE.
|
|
| 37 | +-->
|
|
| 38 | +<fontconfig>
|
|
| 39 | + |
|
| 40 | +<!-- Font directory list -->
|
|
| 41 | + |
|
| 42 | + <dir prefix="cwd">fonts</dir>
|
|
| 43 | + |
|
| 44 | +<!--
|
|
| 45 | + Accept deprecated 'mono' alias, replacing it with 'monospace'
|
|
| 46 | +-->
|
|
| 47 | + <match target="pattern">
|
|
| 48 | + <test qual="any" name="family">
|
|
| 49 | + <string>mono</string>
|
|
| 50 | + </test>
|
|
| 51 | + <edit name="family" mode="assign" binding="same">
|
|
| 52 | + <string>monospace</string>
|
|
| 53 | + </edit>
|
|
| 54 | + </match>
|
|
| 55 | + |
|
| 56 | +<!--
|
|
| 57 | + Accept alternate 'sans serif' spelling, replacing it with 'sans-serif'
|
|
| 58 | +-->
|
|
| 59 | + <match target="pattern">
|
|
| 60 | + <test qual="any" name="family">
|
|
| 61 | + <string>sans serif</string>
|
|
| 62 | + </test>
|
|
| 63 | + <edit name="family" mode="assign" binding="same">
|
|
| 64 | + <string>sans-serif</string>
|
|
| 65 | + </edit>
|
|
| 66 | + </match>
|
|
| 67 | + |
|
| 68 | +<!--
|
|
| 69 | + Accept deprecated 'sans' alias, replacing it with 'sans-serif'
|
|
| 70 | +-->
|
|
| 71 | + <match target="pattern">
|
|
| 72 | + <test qual="any" name="family">
|
|
| 73 | + <string>sans</string>
|
|
| 74 | + </test>
|
|
| 75 | + <edit name="family" mode="assign" binding="same">
|
|
| 76 | + <string>sans-serif</string>
|
|
| 77 | + </edit>
|
|
| 78 | + </match>
|
|
| 79 | + |
|
| 80 | +<!--
|
|
| 81 | + Set our default generic families.
|
|
| 82 | +-->
|
|
| 83 | + <match target="pattern">
|
|
| 84 | + <test qual="any" name="family">
|
|
| 85 | + <string>sans-serif</string>
|
|
| 86 | + </test>
|
|
| 87 | + <edit name="family" mode="assign" binding="same">
|
|
| 88 | + <string>Arimo</string>
|
|
| 89 | + </edit>
|
|
| 90 | + </match>
|
|
| 91 | + <match target="pattern">
|
|
| 92 | + <test qual="any" name="family">
|
|
| 93 | + <string>serif</string>
|
|
| 94 | + </test>
|
|
| 95 | + <edit name="family" mode="assign" binding="same">
|
|
| 96 | + <string>Tinos</string>
|
|
| 97 | + </edit>
|
|
| 98 | + </match>
|
|
| 99 | + <match target="pattern">
|
|
| 100 | + <test qual="any" name="family">
|
|
| 101 | + <string>monospace</string>
|
|
| 102 | + </test>
|
|
| 103 | + <edit name="family" mode="assign" binding="same">
|
|
| 104 | + <string>Cousine</string>
|
|
| 105 | + </edit>
|
|
| 106 | + </match>
|
|
| 107 | + |
|
| 108 | +<!--
|
|
| 109 | + tor-browser#41799, tor-browser-build#41237: Add some aliases for
|
|
| 110 | + compatibility.
|
|
| 111 | +-->
|
|
| 112 | + <match target="pattern">
|
|
| 113 | + <test qual="any" name="family">
|
|
| 114 | + <string>Arial</string>
|
|
| 115 | + </test>
|
|
| 116 | + <edit name="family" mode="assign" binding="same">
|
|
| 117 | + <string>Arimo</string>
|
|
| 118 | + </edit>
|
|
| 119 | + </match>
|
|
| 120 | + <match target="pattern">
|
|
| 121 | + <test qual="any" name="family">
|
|
| 122 | + <string>Times New Roman</string>
|
|
| 123 | + </test>
|
|
| 124 | + <edit name="family" mode="assign" binding="same">
|
|
| 125 | + <string>Tinos</string>
|
|
| 126 | + </edit>
|
|
| 127 | + </match>
|
|
| 128 | + <match target="pattern">
|
|
| 129 | + <test qual="any" name="family">
|
|
| 130 | + <string>Courier New</string>
|
|
| 131 | + </test>
|
|
| 132 | + <edit name="family" mode="assign" binding="same">
|
|
| 133 | + <string>Cousine</string>
|
|
| 134 | + </edit>
|
|
| 135 | + </match>
|
|
| 136 | + <match target="pattern">
|
|
| 137 | + <test qual="any" name="family">
|
|
| 138 | + <string>Helvetica</string>
|
|
| 139 | + </test>
|
|
| 140 | + <edit name="family" mode="assign" binding="same">
|
|
| 141 | + <string>Arimo</string>
|
|
| 142 | + </edit>
|
|
| 143 | + </match>
|
|
| 144 | + <match target="pattern">
|
|
| 145 | + <test qual="any" name="family">
|
|
| 146 | + <string>Times</string>
|
|
| 147 | + </test>
|
|
| 148 | + <edit name="family" mode="assign" binding="same">
|
|
| 149 | + <string>Tinos</string>
|
|
| 150 | + </edit>
|
|
| 151 | + </match>
|
|
| 152 | + <match target="pattern">
|
|
| 153 | + <test qual="any" name="family">
|
|
| 154 | + <string>Courier</string>
|
|
| 155 | + </test>
|
|
| 156 | + <edit name="family" mode="assign" binding="same">
|
|
| 157 | + <string>Cousine</string>
|
|
| 158 | + </edit>
|
|
| 159 | + </match>
|
|
| 160 | + |
|
| 161 | +<!-- Font cache directory list -->
|
|
| 162 | + |
|
| 163 | + <cachedir prefix="xdg">fontconfig</cachedir>
|
|
| 164 | + |
|
| 165 | + <config>
|
|
| 166 | +<!--
|
|
| 167 | + Rescan configuration every 30 seconds when FcFontSetList is called
|
|
| 168 | + -->
|
|
| 169 | + <rescan>
|
|
| 170 | + <int>30</int>
|
|
| 171 | + </rescan>
|
|
| 172 | + </config>
|
|
| 173 | + |
|
| 174 | + <!-- Standardize rendering settings. -->
|
|
| 175 | + <match target="pattern">
|
|
| 176 | + <edit name="antialias" mode="assign"><bool>true</bool></edit>
|
|
| 177 | + <edit name="autohint" mode="assign"><bool>false</bool></edit>
|
|
| 178 | + <edit name="hinting" mode="assign"><bool>true</bool></edit>
|
|
| 179 | + <edit name="hintstyle" mode="assign"><const>hintfull</const></edit>
|
|
| 180 | + <edit name="lcdfilter" mode="assign"><const>lcddefault</const></edit>
|
|
| 181 | + <edit name="rgba" mode="assign"><const>none</const></edit>
|
|
| 182 | + </match>
|
|
| 183 | +</fontconfig> |
| ... | ... | @@ -7,3 +7,6 @@ |
| 7 | 7 | if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("windows", "gtk"):
|
| 8 | 8 | DIST_SUBDIR = ""
|
| 9 | 9 | FINAL_TARGET_FILES.fonts += ["TwemojiMozilla.ttf"]
|
| 10 | + |
|
| 11 | +if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
|
|
| 12 | + FINAL_TARGET_FILES.fonts += ["fonts.conf"] |
| ... | ... | @@ -1352,12 +1352,39 @@ bool gfxFontconfigFont::ShouldHintMetrics() const { |
| 1352 | 1352 | return !GetStyle()->printerFont;
|
| 1353 | 1353 | }
|
| 1354 | 1354 | |
| 1355 | +static nsresult SetFontconfigConfigFile() {
|
|
| 1356 | + nsCOMPtr<nsIProperties> dirSvc(
|
|
| 1357 | + do_GetService("@mozilla.org/file/directory_service;1"));
|
|
| 1358 | + NS_ENSURE_TRUE(dirSvc, NS_ERROR_NOT_AVAILABLE);
|
|
| 1359 | + nsCOMPtr<nsIFile> appFile, confFile;
|
|
| 1360 | + nsresult rv = dirSvc->Get(XRE_EXECUTABLE_FILE, NS_GET_IID(nsIFile),
|
|
| 1361 | + getter_AddRefs(appFile));
|
|
| 1362 | + NS_ENSURE_SUCCESS(rv, rv);
|
|
| 1363 | + rv = appFile->GetParent(getter_AddRefs(confFile));
|
|
| 1364 | + NS_ENSURE_SUCCESS(rv, rv);
|
|
| 1365 | + rv = confFile->AppendNative("fonts"_ns);
|
|
| 1366 | + NS_ENSURE_SUCCESS(rv, rv);
|
|
| 1367 | + rv = confFile->AppendNative("fonts.conf"_ns);
|
|
| 1368 | + NS_ENSURE_SUCCESS(rv, rv);
|
|
| 1369 | + |
|
| 1370 | + nsAutoCString confPath;
|
|
| 1371 | + rv = confFile->GetNativePath(confPath);
|
|
| 1372 | + if (NS_WARN_IF(setenv("FONTCONFIG_FILE", confPath.BeginReading(), 1) != 0)) {
|
|
| 1373 | + return NS_ERROR_FAILURE;
|
|
| 1374 | + }
|
|
| 1375 | + return NS_OK;
|
|
| 1376 | +}
|
|
| 1377 | + |
|
| 1355 | 1378 | gfxFcPlatformFontList::gfxFcPlatformFontList()
|
| 1356 | 1379 | : mLocalNames(64),
|
| 1357 | 1380 | mGenericMappings(32),
|
| 1358 | 1381 | mFcSubstituteCache(64),
|
| 1359 | 1382 | mLastConfig(nullptr),
|
| 1360 | 1383 | mAlwaysUseFontconfigGenerics(true) {
|
| 1384 | + if (NS_FAILED(SetFontconfigConfigFile())) {
|
|
| 1385 | + NS_WARNING("Failed to set the fontconfig config file!");
|
|
| 1386 | + }
|
|
| 1387 | + |
|
| 1361 | 1388 | CheckFamilyList(kBaseFonts_Ubuntu_22_04);
|
| 1362 | 1389 | CheckFamilyList(kLangFonts_Ubuntu_22_04);
|
| 1363 | 1390 | CheckFamilyList(kBaseFonts_Ubuntu_20_04);
|
| ... | ... | @@ -115,28 +115,6 @@ make_add_if_not_instruction() { |
| 115 | 115 | echo "add-if-not \"$f\" \"$f\"" >> "$filev3"
|
| 116 | 116 | }
|
| 117 | 117 | |
| 118 | -check_for_add_if_update() {
|
|
| 119 | - add_if_file_chk="$1"
|
|
| 120 | - |
|
| 121 | - # tor-browser#41776: We will remove with the old fontconfig file manually
|
|
| 122 | - # outside the update process. So, let the updater add the file if there.
|
|
| 123 | - # TODO: Remove once we do a watershed release.
|
|
| 124 | - if [ "$add_if_file_chk" = "TorBrowser/Data/fontconfig/fonts.conf" ]; then
|
|
| 125 | - ## "true" *giggle*
|
|
| 126 | - return 0;
|
|
| 127 | - fi
|
|
| 128 | - ## 'false'... because this is bash. Oh yay!
|
|
| 129 | - return 1;
|
|
| 130 | -}
|
|
| 131 | - |
|
| 132 | -make_add_if_instruction() {
|
|
| 133 | - f="$1"
|
|
| 134 | - filev3="$2"
|
|
| 135 | - |
|
| 136 | - verbose_notice " add-if \"$f\" \"$f\""
|
|
| 137 | - echo "add-if \"$f\" \"$f\"" >> "$filev3"
|
|
| 138 | -}
|
|
| 139 | - |
|
| 140 | 118 | make_addsymlink_instruction() {
|
| 141 | 119 | link="$1"
|
| 142 | 120 | target="$2"
|
| ... | ... | @@ -106,9 +106,6 @@ for ((i=0; $i<$num_files; i=$i+1)); do |
| 106 | 106 | |
| 107 | 107 | if check_for_add_if_not_update "$f"; then
|
| 108 | 108 | make_add_if_not_instruction "$f" "$updatemanifestv3"
|
| 109 | - elif check_for_add_if_update "$f"; then
|
|
| 110 | - # TODO: Remove once we do a watershed release
|
|
| 111 | - make_add_if_instruction "$f" "$updatemanifestv3"
|
|
| 112 | 109 | else
|
| 113 | 110 | make_add_instruction "$f" "$updatemanifestv3"
|
| 114 | 111 | fi
|
| ... | ... | @@ -216,17 +216,6 @@ for ((i=0; $i<$num_oldfiles; i=$i+1)); do |
| 216 | 216 | continue 1
|
| 217 | 217 | fi
|
| 218 | 218 | |
| 219 | - if check_for_add_if_update "$f"; then
|
|
| 220 | - # TODO: Remove once we do a watershed release
|
|
| 221 | - # The full workdir may not exist yet, so create it if necessary.
|
|
| 222 | - mkdir -p `dirname "$workdir/$f"`
|
|
| 223 | - $XZ $XZ_OPT --compress $BCJ_OPTIONS --lzma2 --format=xz --check=crc64 --force --stdout "$newdir/$f" > "$workdir/$f"
|
|
| 224 | - copy_perm "$newdir/$f" "$workdir/$f"
|
|
| 225 | - make_add_if_instruction "$f" "$updatemanifestv3"
|
|
| 226 | - archivefiles="$archivefiles \"$f\""
|
|
| 227 | - continue 1
|
|
| 228 | - fi
|
|
| 229 | - |
|
| 230 | 219 | if check_for_forced_update "$requested_forced_updates" "$f"; then
|
| 231 | 220 | # The full workdir may not exist yet, so create it if necessary.
|
| 232 | 221 | mkdir -p "$(dirname "$workdir/$f")"
|
| ... | ... | @@ -335,9 +324,6 @@ for ((i=0; $i<$num_newfiles; i=$i+1)); do |
| 335 | 324 | |
| 336 | 325 | if check_for_add_if_not_update "$f"; then
|
| 337 | 326 | make_add_if_not_instruction "$f" "$updatemanifestv3"
|
| 338 | - elif check_for_add_if_update "$f"; then
|
|
| 339 | - # TODO: Remove once we do a watershed release
|
|
| 340 | - make_add_if_instruction "$f" "$updatemanifestv3"
|
|
| 341 | 327 | else
|
| 342 | 328 | make_add_instruction "$f" "$updatemanifestv3"
|
| 343 | 329 | fi
|