Pier Angelo Vendrame pushed to branch base-browser-128.5.0esr-14.5-1 at The Tor Project / Applications / Tor Browser

Commits:

10 changed files:

Changes:

  • gfx/thebes/StandardFonts-linux.incgfx/thebes/StandardFonts-linux-upstream.inc

  • gfx/thebes/StandardFonts-macos-bb.inc
    1
    +/* This Source Code Form is subject to the terms of the Mozilla Public
    
    2
    + * License, v. 2.0. If a copy of the MPL was not distributed with this
    
    3
    + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    
    4
    +
    
    5
    +static const char* kBaseFonts[] = {
    
    6
    +    "Apple Color Emoji",
    
    7
    +    "AppleGothic",
    
    8
    +    "Arial",
    
    9
    +    "Arial Black",
    
    10
    +    "Arial Narrow",
    
    11
    +    "Courier",
    
    12
    +    "Courier New",
    
    13
    +    "Geneva",
    
    14
    +    "Georgia",
    
    15
    +    "Heiti TC",
    
    16
    +    "Helvetica",
    
    17
    +    "Helvetica Neue",
    
    18
    +    "Hiragino Kaku Gothic ProN",
    
    19
    +    "Kailasa",
    
    20
    +    "Lucida Grande",
    
    21
    +    "Menlo",
    
    22
    +    "Monaco",
    
    23
    +    "PingFang HK",
    
    24
    +    "PingFang SC",
    
    25
    +    "PingFang TC",
    
    26
    +    "Songti SC",
    
    27
    +    "Songti TC",
    
    28
    +    "Tahoma",
    
    29
    +    "Thonburi",
    
    30
    +    "Times",
    
    31
    +    "Times New Roman",
    
    32
    +    "Verdana",
    
    33
    +};

  • gfx/thebes/StandardFonts-macos.incgfx/thebes/StandardFonts-macos-upstream.inc

  • gfx/thebes/StandardFonts-win10-bb.inc
    1
    +/* This Source Code Form is subject to the terms of the Mozilla Public
    
    2
    + * License, v. 2.0. If a copy of the MPL was not distributed with this
    
    3
    + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    
    4
    +
    
    5
    +static const char* kBaseFonts[] = {
    
    6
    +    "Arial",
    
    7
    +    "Cambria Math",
    
    8
    +    "Consolas",
    
    9
    +    "Courier New",
    
    10
    +    "Georgia",
    
    11
    +    "Lucida Console",
    
    12
    +    "Malgun Gothic",
    
    13
    +    "Microsoft Himalaya",
    
    14
    +    "Microsoft JhengHei",
    
    15
    +    "Microsoft YaHei",
    
    16
    +    "MS Gothic",
    
    17
    +    "MS PGothic",
    
    18
    +    "MV Boli",
    
    19
    +    "Segoe UI",
    
    20
    +    "SimSun",
    
    21
    +    "Sylfaen",
    
    22
    +    "Tahoma",
    
    23
    +    "Times New Roman",
    
    24
    +    "Verdana",
    
    25
    +};
    
    26
    +
    
    27
    +struct FontSubstitute {
    
    28
    +  const char* substituteName;
    
    29
    +  const char* actualFontName;
    
    30
    +};
    
    31
    +
    
    32
    +static const FontSubstitute kFontSubstitutes[] = {
    
    33
    +    // Common substitutions
    
    34
    +    {"Arabic Transparent", "Arial"},
    
    35
    +    {"Arabic Transparent Bold", "Arial Bold"},
    
    36
    +    {"Arial Baltic", "Arial"},
    
    37
    +    {"Arial CE", "Arial"},
    
    38
    +    {"Arial CYR", "Arial"},
    
    39
    +    {"Arial Greek", "Arial"},
    
    40
    +    {"Arial TUR", "Arial"},
    
    41
    +    {"Courier New Baltic", "Courier New"},
    
    42
    +    {"Courier New CE", "Courier New"},
    
    43
    +    {"Courier New CYR", "Courier New"},
    
    44
    +    {"Courier New Greek", "Courier New"},
    
    45
    +    {"Courier New TUR", "Courier New"},
    
    46
    +    {"Helv", "MS Sans Serif"},
    
    47
    +    {"Helvetica", "Arial"},
    
    48
    +    {"MS Shell Dlg 2", "Tahoma"},
    
    49
    +    {"Tahoma Armenian", "Tahoma"},
    
    50
    +    {"Times", "Times New Roman"},
    
    51
    +    {"Times New Roman Baltic", "Times New Roman"},
    
    52
    +    {"Times New Roman CE", "Times New Roman"},
    
    53
    +    {"Times New Roman CYR", "Times New Roman"},
    
    54
    +    {"Times New Roman Greek", "Times New Roman"},
    
    55
    +    {"Times New Roman TUR", "Times New Roman"},
    
    56
    +    {"Tms Rmn", "MS Serif"},
    
    57
    +    // Common, except Japanese (which uses MS UI Gothic, instead)
    
    58
    +    {"MS Shell Dlg", "Microsoft Sans Serif"},
    
    59
    +    // Arabic
    
    60
    +    {"Arial (Arabic)", "Arial"},
    
    61
    +    {"Courier New (Arabic)", "Courier New"},
    
    62
    +    {"Times New Roman (Arabic)", "Times New Roman"},
    
    63
    +    // Cyrillic + Greek
    
    64
    +    {"Courier", "Courier New"},
    
    65
    +    // Greek
    
    66
    +    {"Fixedsys Greek", "Fixedsys"},
    
    67
    +    {"MS Serif Greek", "MS Serif"},
    
    68
    +    {"MS Sans Serif Greek", "MS Sans Serif"},
    
    69
    +    {"Small Fonts Greek", "Small Fonts"},
    
    70
    +    {"System Greek", "System"},
    
    71
    +    // Hebrew
    
    72
    +    {"Arial (Hebrew)", "Arial"},
    
    73
    +    {"Courier New (Hebrew)", "Courier New"},
    
    74
    +    {"David Transparent", "David"},
    
    75
    +    {"Fixed Miriam Transparent", "Miriam Fixed"},
    
    76
    +    {"Miriam Transparent", "Miriam"},
    
    77
    +    {"Rod Transparent", "Rod"},
    
    78
    +    {"Times New Roman (Hebrew)", "Times New Roman"},
    
    79
    +    // Japanese
    
    80
    +    {"標準明朝", "MS 明朝"},
    
    81
    +    {"標準ゴシック", "MS ゴシック"},
    
    82
    +    {"ゴシック", "MS ゴシック"},
    
    83
    +    {"ゴシック", "MS ゴシック"},
    
    84
    +    {"クーリエ", "Courier"},
    
    85
    +    {"タイムズロマン", "Times New Roman"},
    
    86
    +    {"ヘルベチカ", "Arial"},
    
    87
    +    // Simplified Chinese
    
    88
    +    {"FangSong_GB2312", "FangSong"},
    
    89
    +    {"KaiTi_GB2312", "KaiTi"},
    
    90
    +};

  • gfx/thebes/StandardFonts-win10.incgfx/thebes/StandardFonts-win10-upstream.inc
    ... ... @@ -200,68 +200,3 @@ static const char* kLangPackFonts[] = {
    200 200
     //  "Rockwell Nova",  // Pan-European Supplemental Fonts - EXCLUDED
    
    201 201
     //  "Verdana Pro",  // Pan-European Supplemental Fonts - EXCLUDED
    
    202 202
     };
    203
    -
    
    204
    -struct FontSubstitute {
    
    205
    -  const char *substituteName;
    
    206
    -  const char *actualFontName;
    
    207
    -};
    
    208
    -
    
    209
    -static const FontSubstitute kFontSubstitutes[] = {
    
    210
    -  // Common substitutions
    
    211
    -  {"Arabic Transparent", "Arial"},
    
    212
    -  {"Arabic Transparent Bold", "Arial Bold"},
    
    213
    -  {"Arial Baltic", "Arial"},
    
    214
    -  {"Arial CE", "Arial"},
    
    215
    -  {"Arial CYR", "Arial"},
    
    216
    -  {"Arial Greek", "Arial"},
    
    217
    -  {"Arial TUR", "Arial"},
    
    218
    -  {"Courier New Baltic", "Courier New"},
    
    219
    -  {"Courier New CE", "Courier New"},
    
    220
    -  {"Courier New CYR", "Courier New"},
    
    221
    -  {"Courier New Greek", "Courier New"},
    
    222
    -  {"Courier New TUR", "Courier New"},
    
    223
    -  {"Helv", "MS Sans Serif"},
    
    224
    -  {"Helvetica", "Arial"},
    
    225
    -  {"MS Shell Dlg 2", "Tahoma"},
    
    226
    -  {"Tahoma Armenian", "Tahoma"},
    
    227
    -  {"Times", "Times New Roman"},
    
    228
    -  {"Times New Roman Baltic", "Times New Roman"},
    
    229
    -  {"Times New Roman CE", "Times New Roman"},
    
    230
    -  {"Times New Roman CYR", "Times New Roman"},
    
    231
    -  {"Times New Roman Greek", "Times New Roman"},
    
    232
    -  {"Times New Roman TUR", "Times New Roman"},
    
    233
    -  {"Tms Rmn", "MS Serif"},
    
    234
    -  // Common, except Japanese (which uses MS UI Gothic, instead)
    
    235
    -  {"MS Shell Dlg", "Microsoft Sans Serif"},
    
    236
    -  // Arabic
    
    237
    -  {"Arial (Arabic)", "Arial"},
    
    238
    -  {"Courier New (Arabic)", "Courier New"},
    
    239
    -  {"Times New Roman (Arabic)", "Times New Roman"},
    
    240
    -  // Cyrillic + Greek
    
    241
    -  {"Courier", "Courier New"},
    
    242
    -  // Greek
    
    243
    -  {"Fixedsys Greek", "Fixedsys"},
    
    244
    -  {"MS Serif Greek", "MS Serif"},
    
    245
    -  {"MS Sans Serif Greek", "MS Sans Serif"},
    
    246
    -  {"Small Fonts Greek", "Small Fonts"},
    
    247
    -  {"System Greek", "System"},
    
    248
    -  // Hebrew
    
    249
    -  {"Arial (Hebrew)", "Arial"},
    
    250
    -  {"Courier New (Hebrew)", "Courier New"},
    
    251
    -  {"David Transparent", "David"},
    
    252
    -  {"Fixed Miriam Transparent", "Miriam Fixed"},
    
    253
    -  {"Miriam Transparent", "Miriam"},
    
    254
    -  {"Rod Transparent", "Rod"},
    
    255
    -  {"Times New Roman (Hebrew)", "Times New Roman"},
    
    256
    -  // Japanese
    
    257
    -  {"標準明朝", "MS 明朝"},
    
    258
    -  {"標準ゴシック", "MS ゴシック"},
    
    259
    -  {"ゴシック", "MS ゴシック"},
    
    260
    -  {"ゴシック", "MS ゴシック"},
    
    261
    -  {"クーリエ", "Courier"},
    
    262
    -  {"タイムズロマン", "Times New Roman"},
    
    263
    -  {"ヘルベチカ", "Arial"},
    
    264
    -  // Simplified Chinese
    
    265
    -  {"FangSong_GB2312", "FangSong"},
    
    266
    -  {"KaiTi_GB2312", "KaiTi"},
    
    267
    -};

  • gfx/thebes/gfxDWriteFontList.cpp
    ... ... @@ -32,7 +32,7 @@
    32 32
     
    
    33 33
     #include "harfbuzz/hb.h"
    
    34 34
     
    
    35
    -#include "StandardFonts-win10.inc"
    
    35
    +#include "StandardFonts-win10-bb.inc"
    
    36 36
     
    
    37 37
     using namespace mozilla;
    
    38 38
     using namespace mozilla::gfx;
    
    ... ... @@ -910,7 +910,9 @@ void gfxDWriteFontEntry::AddSizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
    910 910
     
    
    911 911
     gfxDWriteFontList::gfxDWriteFontList() : mForceGDIClassicMaxFontSize(0.0) {
    
    912 912
       CheckFamilyList(kBaseFonts);
    
    913
    +#ifndef BASE_BROWSER_VERSION
    
    913 914
       CheckFamilyList(kLangPackFonts);
    
    915
    +#endif
    
    914 916
     }
    
    915 917
     
    
    916 918
     // bug 602792 - CJK systems default to large CJK fonts which cause excessive
    
    ... ... @@ -1153,9 +1155,11 @@ FontVisibility gfxDWriteFontList::GetVisibilityForFamily(
    1153 1155
       if (FamilyInList(aName, kBaseFonts)) {
    
    1154 1156
         return FontVisibility::Base;
    
    1155 1157
       }
    
    1158
    +#ifndef BASE_BROWSER_VERSION
    
    1156 1159
       if (FamilyInList(aName, kLangPackFonts)) {
    
    1157 1160
         return FontVisibility::LangPack;
    
    1158 1161
       }
    
    1162
    +#endif
    
    1159 1163
       return FontVisibility::User;
    
    1160 1164
     }
    
    1161 1165
     
    
    ... ... @@ -1164,8 +1168,10 @@ gfxDWriteFontList::GetFilteredPlatformFontLists() {
    1164 1168
       nsTArray<std::pair<const char**, uint32_t>> fontLists;
    
    1165 1169
     
    
    1166 1170
       fontLists.AppendElement(std::make_pair(kBaseFonts, ArrayLength(kBaseFonts)));
    
    1171
    +#ifndef BASE_BROWSER_VERSION
    
    1167 1172
       fontLists.AppendElement(
    
    1168 1173
           std::make_pair(kLangPackFonts, ArrayLength(kLangPackFonts)));
    
    1174
    +#endif
    
    1169 1175
     
    
    1170 1176
       return fontLists;
    
    1171 1177
     }
    

  • gfx/thebes/gfxFcPlatformFontList.cpp
    ... ... @@ -32,7 +32,9 @@
    32 32
     #include "nsCharSeparatedTokenizer.h"
    
    33 33
     #include "nsXULAppAPI.h"
    
    34 34
     #include "SharedFontList-impl.h"
    
    35
    -#include "StandardFonts-linux.inc"
    
    35
    +#ifndef BASE_BROWSER_VERSION
    
    36
    +#  include "StandardFonts-linux.inc"
    
    37
    +#endif
    
    36 38
     #include "mozilla/intl/Locale.h"
    
    37 39
     
    
    38 40
     #include "mozilla/gfx/HelpersCairo.h"
    
    ... ... @@ -1352,45 +1354,20 @@ bool gfxFontconfigFont::ShouldHintMetrics() const {
    1352 1354
       return !GetStyle()->printerFont;
    
    1353 1355
     }
    
    1354 1356
     
    
    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, confDir;
    
    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(confDir));
    
    1364
    -  NS_ENSURE_SUCCESS(rv, rv);
    
    1365
    -  rv = confDir->AppendNative("fonts"_ns);
    
    1366
    -  NS_ENSURE_SUCCESS(rv, rv);
    
    1367
    -
    
    1368
    -  nsAutoCString confPath;
    
    1369
    -  rv = confDir->GetNativePath(confPath);
    
    1370
    -  NS_ENSURE_SUCCESS(rv, rv);
    
    1371
    -  if (NS_WARN_IF(setenv("FONTCONFIG_PATH", confPath.BeginReading(), 1) != 0 ||
    
    1372
    -                 setenv("FONTCONFIG_FILE", "fonts.conf", 1) != 0)) {
    
    1373
    -    return NS_ERROR_FAILURE;
    
    1374
    -  }
    
    1375
    -  return NS_OK;
    
    1376
    -}
    
    1377
    -
    
    1378 1357
     gfxFcPlatformFontList::gfxFcPlatformFontList()
    
    1379 1358
         : mLocalNames(64),
    
    1380 1359
           mGenericMappings(32),
    
    1381 1360
           mFcSubstituteCache(64),
    
    1382 1361
           mLastConfig(nullptr),
    
    1383 1362
           mAlwaysUseFontconfigGenerics(true) {
    
    1384
    -  if (NS_FAILED(SetFontconfigConfigFile())) {
    
    1385
    -    NS_WARNING("Failed to set the fontconfig config file!");
    
    1386
    -  }
    
    1387
    -
    
    1363
    +#ifndef BASE_BROWSER_VERSION
    
    1388 1364
       CheckFamilyList(kBaseFonts_Ubuntu_22_04);
    
    1389 1365
       CheckFamilyList(kLangFonts_Ubuntu_22_04);
    
    1390 1366
       CheckFamilyList(kBaseFonts_Ubuntu_20_04);
    
    1391 1367
       CheckFamilyList(kLangFonts_Ubuntu_20_04);
    
    1392 1368
       CheckFamilyList(kBaseFonts_Fedora_39);
    
    1393 1369
       CheckFamilyList(kBaseFonts_Fedora_38);
    
    1370
    +#endif
    
    1394 1371
       mLastConfig = FcConfigGetCurrent();
    
    1395 1372
       if (XRE_IsParentProcess()) {
    
    1396 1373
         // if the rescan interval is set, start the timer
    
    ... ... @@ -1704,11 +1681,14 @@ using Device = nsIGfxInfo::FontVisibilityDeviceDetermination;
    1704 1681
     static Device sFontVisibilityDevice = Device::Unassigned;
    
    1705 1682
     
    
    1706 1683
     void AssignFontVisibilityDevice() {
    
    1684
    +  sFontVisibilityDevice = Device::Linux_Unknown;
    
    1685
    +#ifndef BASE_BROWSER_VERSION
    
    1707 1686
       if (sFontVisibilityDevice == Device::Unassigned) {
    
    1708 1687
         nsCOMPtr<nsIGfxInfo> gfxInfo = components::GfxInfo::Service();
    
    1709 1688
         NS_ENSURE_SUCCESS_VOID(
    
    1710 1689
             gfxInfo->GetFontVisibilityDetermination(&sFontVisibilityDevice));
    
    1711 1690
       }
    
    1691
    +#endif
    
    1712 1692
     }
    
    1713 1693
     
    
    1714 1694
     // Per family array of faces.
    
    ... ... @@ -2029,6 +2009,7 @@ FontVisibility gfxFcPlatformFontList::GetVisibilityForFamily(
    2029 2009
       AssignFontVisibilityDevice();
    
    2030 2010
     
    
    2031 2011
       switch (sFontVisibilityDevice) {
    
    2012
    +#ifndef BASE_BROWSER_VERSION
    
    2032 2013
         case Device::Linux_Ubuntu_any:
    
    2033 2014
         case Device::Linux_Ubuntu_22:
    
    2034 2015
           if (FamilyInList(aName, kBaseFonts_Ubuntu_22_04)) {
    
    ... ... @@ -2068,7 +2049,7 @@ FontVisibility gfxFcPlatformFontList::GetVisibilityForFamily(
    2068 2049
             return FontVisibility::Base;
    
    2069 2050
           }
    
    2070 2051
           return FontVisibility::User;
    
    2071
    -
    
    2052
    +#endif
    
    2072 2053
         default:
    
    2073 2054
           // We don't know how to categorize fonts on this system
    
    2074 2055
           return FontVisibility::Unknown;
    
    ... ... @@ -2081,6 +2062,7 @@ gfxFcPlatformFontList::GetFilteredPlatformFontLists() {
    2081 2062
     
    
    2082 2063
       nsTArray<std::pair<const char**, uint32_t>> fontLists;
    
    2083 2064
     
    
    2065
    +#ifndef BASE_BROWSER_VERSION
    
    2084 2066
       switch (sFontVisibilityDevice) {
    
    2085 2067
         case Device::Linux_Ubuntu_any:
    
    2086 2068
         case Device::Linux_Ubuntu_22:
    
    ... ... @@ -2114,6 +2096,7 @@ gfxFcPlatformFontList::GetFilteredPlatformFontLists() {
    2114 2096
           // We don't know how to categorize fonts on this system
    
    2115 2097
           break;
    
    2116 2098
       }
    
    2099
    +#endif
    
    2117 2100
     
    
    2118 2101
       return fontLists;
    
    2119 2102
     }
    

  • gfx/thebes/gfxGDIFontList.cpp
    ... ... @@ -33,7 +33,7 @@
    33 33
     
    
    34 34
     #include "nsContentUtils.h"
    
    35 35
     
    
    36
    -#include "StandardFonts-win10.inc"
    
    36
    +#include "StandardFonts-win10-bb.inc"
    
    37 37
     
    
    38 38
     #include <usp10.h>
    
    39 39
     
    

  • gfx/thebes/gfxMacPlatformFontList.mm
    ... ... @@ -46,7 +46,7 @@
    46 46
     #include <time.h>
    
    47 47
     #include <dlfcn.h>
    
    48 48
     
    
    49
    -#include "StandardFonts-macos.inc"
    
    49
    +#include "StandardFonts-macos-bb.inc"
    
    50 50
     
    
    51 51
     using namespace mozilla;
    
    52 52
     using namespace mozilla::gfx;
    
    ... ... @@ -153,7 +153,9 @@ void gfxSingleFaceMacFontFamily::ReadOtherFamilyNames(
    153 153
     
    
    154 154
     gfxMacPlatformFontList::gfxMacPlatformFontList() : CoreTextFontList() {
    
    155 155
       CheckFamilyList(kBaseFonts);
    
    156
    +#ifndef BASE_BROWSER_VERSION
    
    156 157
       CheckFamilyList(kBaseFonts_13_Higher);
    
    158
    +#endif
    
    157 159
     
    
    158 160
       // cache this in a static variable so that gfxMacFontFamily objects
    
    159 161
       // don't have to repeatedly look it up
    
    ... ... @@ -188,10 +190,12 @@ FontVisibility gfxMacPlatformFontList::GetVisibilityForFamily(
    188 190
       if (FamilyInList(aName, kBaseFonts)) {
    
    189 191
         return FontVisibility::Base;
    
    190 192
       }
    
    193
    +#ifndef BASE_BROWSER_VERSION
    
    191 194
       if (GetFontVisibilityDevice() == Device::MacOS_13_plus &&
    
    192 195
           FamilyInList(aName, kBaseFonts_13_Higher)) {
    
    193 196
         return FontVisibility::Base;
    
    194 197
       }
    
    198
    +#endif
    
    195 199
     #ifdef MOZ_BUNDLED_FONTS
    
    196 200
       if (mBundledFamilies.Contains(aName)) {
    
    197 201
         return FontVisibility::Base;
    
    ... ... @@ -206,10 +210,12 @@ gfxMacPlatformFontList::GetFilteredPlatformFontLists() {
    206 210
     
    
    207 211
       fontLists.AppendElement(std::make_pair(kBaseFonts, std::size(kBaseFonts)));
    
    208 212
     
    
    213
    +#ifndef BASE_BROWSER_VERSION
    
    209 214
       if (GetFontVisibilityDevice() == Device::MacOS_13_plus) {
    
    210 215
         fontLists.AppendElement(
    
    211 216
             std::make_pair(kBaseFonts_13_Higher, std::size(kBaseFonts_13_Higher)));
    
    212 217
       }
    
    218
    +#endif
    
    213 219
     
    
    214 220
       return fontLists;
    
    215 221
     }
    

  • toolkit/xre/nsXREDirProvider.cpp
    ... ... @@ -742,6 +742,25 @@ void nsXREDirProvider::FinishInitializingUserPrefs() {
    742 742
       }
    
    743 743
     }
    
    744 744
     
    
    745
    +#ifdef MOZ_WIDGET_GTK
    
    746
    +static nsresult SetFontconfigConfigFile(nsCOMPtr<nsIFile> appDir) {
    
    747
    +  NS_ENSURE_TRUE(appDir, NS_ERROR_NULL_POINTER);
    
    748
    +  nsCOMPtr<nsIFile> confDir;
    
    749
    +  nsresult rv = appDir->Clone(getter_AddRefs(confDir));
    
    750
    +  NS_ENSURE_SUCCESS(rv, rv);
    
    751
    +  rv = confDir->AppendNative("fonts"_ns);
    
    752
    +  NS_ENSURE_SUCCESS(rv, rv);
    
    753
    +  nsAutoCString confPath;
    
    754
    +  rv = confDir->GetNativePath(confPath);
    
    755
    +  NS_ENSURE_SUCCESS(rv, rv);
    
    756
    +  if (NS_WARN_IF(setenv("FONTCONFIG_PATH", confPath.BeginReading(), 1) != 0 ||
    
    757
    +                 setenv("FONTCONFIG_FILE", "fonts.conf", 1) != 0)) {
    
    758
    +    return NS_ERROR_FAILURE;
    
    759
    +  }
    
    760
    +  return NS_OK;
    
    761
    +}
    
    762
    +#endif
    
    763
    +
    
    745 764
     NS_IMETHODIMP
    
    746 765
     nsXREDirProvider::DoStartup() {
    
    747 766
       nsresult rv;
    
    ... ... @@ -760,6 +779,13 @@ nsXREDirProvider::DoStartup() {
    760 779
         */
    
    761 780
         MOZ_ASSERT(mPrefsInitialized);
    
    762 781
     
    
    782
    +#ifdef MOZ_WIDGET_GTK
    
    783
    +    // FontConfig might be initialized by GTK/Pango, so we need to define its
    
    784
    +    // config variables before doing anything.
    
    785
    +    rv = SetFontconfigConfigFile(mGREDir);
    
    786
    +    NS_ENSURE_SUCCESS(rv, rv);
    
    787
    +#endif
    
    788
    +
    
    763 789
         bool safeModeNecessary = false;
    
    764 790
         nsCOMPtr<nsIAppStartup> appStartup(
    
    765 791
             mozilla::components::AppStartup::Service());