Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor Browser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Applications
Tor Browser
Commits
43cb46cb
Verified
Commit
43cb46cb
authored
May 23, 2023
by
Pier Angelo Vendrame
Browse files
Options
Downloads
Patches
Plain Diff
fixup! Bug 41116: Normalize system fonts.
Update to the latest proposal to upstream. It fixes build issues on macOS.
parent
01637eae
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!694
Bug 41796: Rebased on top of FIREFOX_ESR_115_BASE
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
layout/base/nsLayoutUtils.cpp
+45
-39
45 additions, 39 deletions
layout/base/nsLayoutUtils.cpp
with
45 additions
and
39 deletions
layout/base/nsLayoutUtils.cpp
+
45
−
39
View file @
43cb46cb
...
...
@@ -9676,43 +9676,37 @@ already_AddRefed<nsFontMetrics> nsLayoutUtils::GetMetricsFor(
return
aPresContext
->
GetMetricsFor
(
font
,
params
);
}
/* static */
void
nsLayoutUtils
::
ComputeSystemFont
(
nsFont
*
aSystemFont
,
LookAndFeel
::
FontID
aFontID
,
const
nsFont
&
aDefaultVariableFont
,
const
Document
*
aDocument
)
{
gfxFontStyle
fontStyle
;
nsAutoString
systemFontName
;
if
(
aDocument
->
ShouldResistFingerprinting
())
{
static
void
GetSpoofedSystemFontForRFP
(
LookAndFeel
::
FontID
aFontID
,
gfxFontStyle
&
aStyle
,
nsAString
&
aName
)
{
#if defined(XP_MACOSX)
systemFont
Name
=
u"-apple-system"
_ns
;
a
Name
=
u"-apple-system"
_ns
;
// Values taken from a macOS 10.15 system.
switch
(
aFontID
)
{
case
LookAndFeel
::
FontID
::
Caption
:
case
LookAndFeel
::
FontID
::
Menu
:
font
Style
.
size
=
13
;
a
Style
.
size
=
13
;
break
;
case
LookAndFeel
::
FontID
::
SmallCaption
:
font
Style
.
weight
=
gfxFontStyle
::
FontWeight
(
700
)
;
a
Style
.
weight
=
gfxFontStyle
::
FontWeight
::
BOLD
;
// fall-through
case
LookAndFeel
::
FontID
::
MessageBox
:
case
LookAndFeel
::
FontID
::
StatusBar
:
font
Style
.
size
=
11
;
a
Style
.
size
=
11
;
break
;
default:
font
Style
.
size
=
12
;
a
Style
.
size
=
12
;
break
;
}
#elif defined(XP_WIN)
|| defined(MOZ_WIDGET_ANDROID)
#elif defined(XP_WIN)
// Windows uses Segoe UI for Latin alphabets, but other fonts for some RTL
// languages, so we fallback to sans-serif to fall back to the user's
// default sans-serif. Size is 12px for all system fonts (tried in an en-US
// system).
// Several Android systems reported Roboto 12px, so similar to what Windows
// does.
systemFont
Name
=
u"sans-serif"
_ns
;
font
Style
.
size
=
12
;
#el
se
a
Name
=
u"sans-serif"
_ns
;
a
Style
.
size
=
12
;
#el
if !defined(MOZ_WIDGET_ANDROID)
// 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.
// Fedora with KDE uses Noto Sans, 13.3333px, but it uses Noto Sans on
...
...
@@ -9720,9 +9714,21 @@ void nsLayoutUtils::ComputeSystemFont(nsFont* aSystemFont,
// In general, Linux uses some sans-serif, but its size can vary between
// 12px and 16px. We chose 15px because it is what Firefox is doing for the
// UI font-size.
systemFont
Name
=
u"sans-serif"
_ns
;
font
Style
.
size
=
15
;
a
Name
=
u"sans-serif"
_ns
;
a
Style
.
size
=
15
;
#endif
// No need to do anything on Android, as font and sizes are already fixed.
}
/* static */
void
nsLayoutUtils
::
ComputeSystemFont
(
nsFont
*
aSystemFont
,
LookAndFeel
::
FontID
aFontID
,
const
nsFont
&
aDefaultVariableFont
,
const
Document
*
aDocument
)
{
gfxFontStyle
fontStyle
;
nsAutoString
systemFontName
;
if
(
aDocument
->
ShouldResistFingerprinting
())
{
GetSpoofedSystemFontForRFP
(
aFontID
,
fontStyle
,
systemFontName
);
}
else
if
(
!
LookAndFeel
::
GetFont
(
aFontID
,
systemFontName
,
fontStyle
))
{
return
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment