[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/mullvad-browser][mullvad-browser-115.10.0esr-13.5-1] fixup! Bug 41116: Normalize system fonts.



Title: GitLab

richard pushed to branch mullvad-browser-115.10.0esr-13.5-1 at The Tor Project / Applications / Mullvad Browser

Commits:

  • 308ea305
    by Pier Angelo Vendrame at 2024-04-17T20:03:35+00:00
    fixup! Bug 41116: Normalize system fonts.
    
    Bug 42529: Fix the breakage of this patch on Android.
    
    Also, improve the patch hoping I can finally uplift it.
    

2 changed files:

Changes:

  • gfx/thebes/gfxPlatformFontList.cpp
    ... ... @@ -38,6 +38,7 @@
    38 38
     #include "mozilla/dom/ContentChild.h"
    
    39 39
     #include "mozilla/dom/ContentParent.h"
    
    40 40
     #include "mozilla/dom/ContentProcessMessageManager.h"
    
    41
    +#include "mozilla/dom/Document.h"
    
    41 42
     #include "mozilla/gfx/2D.h"
    
    42 43
     #include "mozilla/ipc/FileDescriptorUtils.h"
    
    43 44
     #include "mozilla/ResultExtensions.h"
    
    ... ... @@ -1964,20 +1965,27 @@ void gfxPlatformFontList::MaybeRemoveCmap(gfxCharacterMap* aCharMap) {
    1964 1965
       }
    
    1965 1966
     }
    
    1966 1967
     
    
    1967
    -static void GetSystemUIFontFamilies([[maybe_unused]] nsAtom* aLangGroup,
    
    1968
    +static void GetSystemUIFontFamilies(const nsPresContext* aPresContext,
    
    1969
    +                                    [[maybe_unused]] nsAtom* aLangGroup,
    
    1968 1970
                                         nsTArray<nsCString>& aFamilies) {
    
    1969 1971
       // TODO: On macOS, use CTCreateUIFontForLanguage or such thing (though the
    
    1970 1972
       // code below ends up using [NSFont systemFontOfSize: 0.0].
    
    1971 1973
       nsFont systemFont;
    
    1972 1974
       gfxFontStyle fontStyle;
    
    1973 1975
       nsAutoString systemFontName;
    
    1974
    -  if (nsContentUtils::ShouldResistFingerprinting()) {
    
    1976
    +  if (aPresContext && aPresContext->Document()
    
    1977
    +                 ? aPresContext->Document()->ShouldResistFingerprinting(
    
    1978
    +                       RFPTarget::Unknown)
    
    1979
    +                 : nsContentUtils::ShouldResistFingerprinting(
    
    1980
    +                       "aPresContext not available", RFPTarget::Unknown)) {
    
    1975 1981
     #ifdef XP_MACOSX
    
    1976 1982
         *aFamilies.AppendElement() = "-apple-system"_ns;
    
    1977
    -#else
    
    1983
    +    return;
    
    1984
    +#elif !defined(MOZ_WIDGET_ANDROID)
    
    1978 1985
         *aFamilies.AppendElement() = "sans-serif"_ns;
    
    1979
    -#endif
    
    1980 1986
         return;
    
    1987
    +#endif
    
    1988
    +    // Android uses already fixed fonts.
    
    1981 1989
       }
    
    1982 1990
       if (!LookAndFeel::GetFont(StyleSystemFont::Menu, systemFontName, fontStyle)) {
    
    1983 1991
         return;
    
    ... ... @@ -2014,7 +2022,7 @@ void gfxPlatformFontList::ResolveGenericFontNames(
    2014 2022
       MOZ_ASSERT(langGroup, "null lang group for pref lang");
    
    2015 2023
     
    
    2016 2024
       if (aGenericType == StyleGenericFontFamily::SystemUi) {
    
    2017
    -    GetSystemUIFontFamilies(langGroup, genericFamilies);
    
    2025
    +    GetSystemUIFontFamilies(aPresContext, langGroup, genericFamilies);
    
    2018 2026
       }
    
    2019 2027
     
    
    2020 2028
       GetFontFamiliesFromGenericFamilies(
    

  • layout/base/nsLayoutUtils.cpp
    ... ... @@ -9708,7 +9708,10 @@ static void GetSpoofedSystemFontForRFP(LookAndFeel::FontID aFontID,
    9708 9708
       // does.
    
    9709 9709
       aName = u"sans-serif"_ns;
    
    9710 9710
       aStyle.size = 12;
    
    9711
    -#elif !defined(MOZ_WIDGET_ANDROID)
    
    9711
    +#elif defined(MOZ_WIDGET_ANDROID)
    
    9712
    +  aName = u"Roboto"_ns;
    
    9713
    +  aStyle.size = 12;
    
    9714
    +#else
    
    9712 9715
       // On Linux, there is not a default. For example, GNOME on Debian uses
    
    9713 9716
       // Cantarell, 14.667px. Ubuntu Mate uses the Ubuntu font, but also 14.667px.
    
    9714 9717
       // Fedora with KDE uses Noto Sans, 13.3333px, but it uses Noto Sans on
    
    ... ... @@ -9719,7 +9722,6 @@ static void GetSpoofedSystemFontForRFP(LookAndFeel::FontID aFontID,
    9719 9722
       aName = u"sans-serif"_ns;
    
    9720 9723
       aStyle.size = 15;
    
    9721 9724
     #endif
    
    9722
    -  // No need to do anything on Android, as font and sizes are already fixed.
    
    9723 9725
     }
    
    9724 9726
     
    
    9725 9727
     /* static */
    

  • _______________________________________________
    tor-commits mailing list
    tor-commits@xxxxxxxxxxxxxxxxxxxx
    https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits