Commit 7684ec07 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃 Committed by Richard Pospesel
Browse files

fixup! Bug 41116: Normalize system fonts.

Revert "fixup! Bug 41116: Normalize system fonts."

This reverts commit 2c1a8f52.
parent f34bff1e
Loading
Loading
Loading
Loading
+5 −13
Original line number Original line Diff line number Diff line
@@ -38,7 +38,6 @@
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/ContentProcessMessageManager.h"
#include "mozilla/dom/ContentProcessMessageManager.h"
#include "mozilla/dom/Document.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/ipc/FileDescriptorUtils.h"
#include "mozilla/ipc/FileDescriptorUtils.h"
#include "mozilla/ResultExtensions.h"
#include "mozilla/ResultExtensions.h"
@@ -1965,27 +1964,20 @@ void gfxPlatformFontList::MaybeRemoveCmap(gfxCharacterMap* aCharMap) {
  }
  }
}
}


static void GetSystemUIFontFamilies(const nsPresContext* aPresContext,
static void GetSystemUIFontFamilies([[maybe_unused]] nsAtom* aLangGroup,
                                    [[maybe_unused]] nsAtom* aLangGroup,
                                    nsTArray<nsCString>& aFamilies) {
                                    nsTArray<nsCString>& aFamilies) {
  // TODO: On macOS, use CTCreateUIFontForLanguage or such thing (though the
  // TODO: On macOS, use CTCreateUIFontForLanguage or such thing (though the
  // code below ends up using [NSFont systemFontOfSize: 0.0].
  // code below ends up using [NSFont systemFontOfSize: 0.0].
  nsFont systemFont;
  nsFont systemFont;
  gfxFontStyle fontStyle;
  gfxFontStyle fontStyle;
  nsAutoString systemFontName;
  nsAutoString systemFontName;
  if (aPresContext && aPresContext->Document()
  if (nsContentUtils::ShouldResistFingerprinting()) {
                 ? aPresContext->Document()->ShouldResistFingerprinting(
                       RFPTarget::Unknown)
                 : nsContentUtils::ShouldResistFingerprinting(
                       "aPresContext not available", RFPTarget::Unknown)) {
#ifdef XP_MACOSX
#ifdef XP_MACOSX
    *aFamilies.AppendElement() = "-apple-system"_ns;
    *aFamilies.AppendElement() = "-apple-system"_ns;
    return;
#else
#elif !defined(MOZ_WIDGET_ANDROID)
    *aFamilies.AppendElement() = "sans-serif"_ns;
    *aFamilies.AppendElement() = "sans-serif"_ns;
    return;
#endif
#endif
    // Android uses already fixed fonts.
    return;
  }
  }
  if (!LookAndFeel::GetFont(StyleSystemFont::Menu, systemFontName, fontStyle)) {
  if (!LookAndFeel::GetFont(StyleSystemFont::Menu, systemFontName, fontStyle)) {
    return;
    return;
@@ -2022,7 +2014,7 @@ void gfxPlatformFontList::ResolveGenericFontNames(
  MOZ_ASSERT(langGroup, "null lang group for pref lang");
  MOZ_ASSERT(langGroup, "null lang group for pref lang");


  if (aGenericType == StyleGenericFontFamily::SystemUi) {
  if (aGenericType == StyleGenericFontFamily::SystemUi) {
    GetSystemUIFontFamilies(aPresContext, langGroup, genericFamilies);
    GetSystemUIFontFamilies(langGroup, genericFamilies);
  }
  }


  GetFontFamiliesFromGenericFamilies(
  GetFontFamiliesFromGenericFamilies(
+2 −4
Original line number Original line Diff line number Diff line
@@ -9708,10 +9708,7 @@ static void GetSpoofedSystemFontForRFP(LookAndFeel::FontID aFontID,
  // does.
  // does.
  aName = u"sans-serif"_ns;
  aName = u"sans-serif"_ns;
  aStyle.size = 12;
  aStyle.size = 12;
#elif defined(MOZ_WIDGET_ANDROID)
#elif !defined(MOZ_WIDGET_ANDROID)
  aName = u"Roboto"_ns;
  aStyle.size = 12;
#else
  // On Linux, there is not a default. For example, GNOME on Debian uses
  // On Linux, there is not a default. For example, GNOME on Debian uses
  // Cantarell, 14.667px. Ubuntu Mate uses the Ubuntu font, but also 14.667px.
  // Cantarell, 14.667px. Ubuntu Mate uses the Ubuntu font, but also 14.667px.
  // Fedora with KDE uses Noto Sans, 13.3333px, but it uses Noto Sans on
  // Fedora with KDE uses Noto Sans, 13.3333px, but it uses Noto Sans on
@@ -9722,6 +9719,7 @@ static void GetSpoofedSystemFontForRFP(LookAndFeel::FontID aFontID,
  aName = u"sans-serif"_ns;
  aName = u"sans-serif"_ns;
  aStyle.size = 15;
  aStyle.size = 15;
#endif
#endif
  // No need to do anything on Android, as font and sizes are already fixed.
}
}


/* static */
/* static */