Richard Pospesel pushed to branch base-browser-102.8.0esr-12.5-1 at The Tor Project / Applications / Tor Browser

Commits:

1 changed file:

Changes:

  • layout/base/nsLayoutUtils.cpp
    ... ... @@ -9565,10 +9565,44 @@ void nsLayoutUtils::ComputeSystemFont(nsFont* aSystemFont,
    9565 9565
       gfxFontStyle fontStyle;
    
    9566 9566
       nsAutoString systemFontName;
    
    9567 9567
       if (aDocument->ShouldResistFingerprinting()) {
    
    9568
    -#ifdef XP_MACOSX
    
    9568
    +#if defined(XP_MACOSX)
    
    9569 9569
         systemFontName = u"-apple-system"_ns;
    
    9570
    +    // Values taken from a macOS 10.15 system.
    
    9571
    +    switch (aFontID) {
    
    9572
    +      case LookAndFeel::FontID::Caption:
    
    9573
    +      case LookAndFeel::FontID::Menu:
    
    9574
    +        fontStyle.size = 13;
    
    9575
    +        break;
    
    9576
    +      case LookAndFeel::FontID::SmallCaption:
    
    9577
    +        fontStyle.weight = gfxFontStyle::FontWeight(700);
    
    9578
    +        // fall-through
    
    9579
    +      case LookAndFeel::FontID::MessageBox:
    
    9580
    +      case LookAndFeel::FontID::StatusBar:
    
    9581
    +        fontStyle.size = 11;
    
    9582
    +        break;
    
    9583
    +      default:
    
    9584
    +        fontStyle.size = 12;
    
    9585
    +        break;
    
    9586
    +    }
    
    9587
    +#elif defined(XP_WIN) || defined(MOZ_WIDGET_ANDROID)
    
    9588
    +    // Windows uses Segoe UI for Latin alphabets, but other fonts for some RTL
    
    9589
    +    // languages, so we fallback to sans-serif to fall back to the user's
    
    9590
    +    // default sans-serif. Size is 12px for all system fonts (tried in an en-US
    
    9591
    +    // system).
    
    9592
    +    // Several Android systems reported Roboto 12px, so similar to what Windows
    
    9593
    +    // does.
    
    9594
    +    systemFontName = u"sans-serif"_ns;
    
    9595
    +    fontStyle.size = 12;
    
    9570 9596
     #else
    
    9597
    +    // On Linux, there is not a default. For example, GNOME on Debian uses
    
    9598
    +    // Cantarell, 14.667px. Ubuntu Mate uses the Ubuntu font, but also 14.667px.
    
    9599
    +    // Fedora with KDE uses Noto Sans, 13.3333px, but it uses Noto Sans on
    
    9600
    +    // GNOME, too.
    
    9601
    +    // In general, Linux uses some sans-serif, but its size can vary between
    
    9602
    +    // 12px and 16px. We chose 15px because it is what Firefox is doing for the
    
    9603
    +    // UI font-size.
    
    9571 9604
         systemFontName = u"sans-serif"_ns;
    
    9605
    +    fontStyle.size = 15;
    
    9572 9606
     #endif
    
    9573 9607
       } else if (!LookAndFeel::GetFont(aFontID, systemFontName, fontStyle)) {
    
    9574 9608
         return;