Skip to content

Commit

Permalink
Don't override the user's fonts
Browse files Browse the repository at this point in the history
This patch is similar in spirit to rust-lang/blog.rust-lang.org#263 and
onur/docs.rs#240; it removes the specific font overrides in rustdoc.css
so that the browser will use the user's configured fonts. This reduces
the weight of all rustdoc pages (yay for mobile!) while also letting
users use whatever fonts they prefer.

The net result of the change is that the page will look less "uniform"
across different browsers, OSes, and devices, but the overall aesthetic
should be preserved. It also means that user preferences are respected,
and that legibility is improved for users with particular font needs, or
on platforms that sometimes gets confused about how to render fonts
nicely (ehrm, Linux).
  • Loading branch information
jonhoo committed Oct 3, 2018
1 parent 2bd5993 commit b77f439
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 99 deletions.
43 changes: 0 additions & 43 deletions src/librustdoc/html/static/COPYRIGHT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,6 @@ These documentation pages include resources by third parties. This copyright
file applies only to those resources. The following third party resources are
included, and carry their own copyright notices and license terms:

* Fira Sans (FiraSans-Regular.woff, FiraSans-Medium.woff):

Copyright (c) 2014, Mozilla Foundation https://mozilla.org/
with Reserved Font Name Fira Sans.

Copyright (c) 2014, Telefonica S.A.

Licensed under the SIL Open Font License, Version 1.1.
See FiraSans-LICENSE.txt.

* Heuristica (Heuristica-Italic.woff):

Copyright 1989, 1991 Adobe Systems Incorporated. All rights reserved.
Utopia is either a registered trademark or trademark of Adobe Systems
Incorporated in the United States and/or other countries. Used under
license.

Copyright 2006 Han The Thanh, Vntopia font family, http://vntex.sf.net

Copyright (c) 2008-2012, Andrey V. Panov (panov@canopus.iacp.dvo.ru),
with Reserved Font Name Heuristica.

Licensed under the SIL Open Font License, Version 1.1.
See Heuristica-LICENSE.txt.

* rustdoc.css, main.js, and playpen.js:

Copyright 2015 The Rust Developers.
Expand All @@ -38,22 +13,4 @@ included, and carry their own copyright notices and license terms:
Copyright (c) Nicolas Gallagher and Jonathan Neal.
Licensed under the MIT license (see LICENSE-MIT.txt).

* Source Code Pro (SourceCodePro-Regular.woff, SourceCodePro-Semibold.woff):

Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/),
with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark
of Adobe Systems Incorporated in the United States and/or other countries.

Licensed under the SIL Open Font License, Version 1.1.
See SourceCodePro-LICENSE.txt.

* Source Serif Pro (SourceSerifPro-Regular.woff, SourceSerifPro-Bold.woff):

Copyright 2014 Adobe Systems Incorporated (http://www.adobe.com/), with
Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of
Adobe Systems Incorporated in the United States and/or other countries.

Licensed under the SIL Open Font License, Version 1.1.
See SourceSerifPro-LICENSE.txt.

This copyright file is intended to be distributed with rustdoc output.
Binary file removed src/librustdoc/html/static/FiraSans-Medium.woff
Binary file not shown.
Binary file removed src/librustdoc/html/static/FiraSans-Regular.woff
Binary file not shown.
Binary file removed src/librustdoc/html/static/Heuristica-Italic.woff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed src/librustdoc/html/static/SourceSerifPro-Bold.woff
Binary file not shown.
Binary file not shown.
61 changes: 5 additions & 56 deletions src/librustdoc/html/static/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,57 +10,6 @@
* except according to those terms.
*/

/* See FiraSans-LICENSE.txt for the Fira Sans license. */
@font-face {
font-family: 'Fira Sans';
font-style: normal;
font-weight: 400;
src: local('Fira Sans'), url("FiraSans-Regular.woff") format('woff');
}
@font-face {
font-family: 'Fira Sans';
font-style: normal;
font-weight: 500;
src: local('Fira Sans Medium'), url("FiraSans-Medium.woff") format('woff');
}

/* See SourceSerifPro-LICENSE.txt for the Source Serif Pro license and
* Heuristica-LICENSE.txt for the Heuristica license. */
@font-face {
font-family: 'Source Serif Pro';
font-style: normal;
font-weight: 400;
src: local('Source Serif Pro'), url("SourceSerifPro-Regular.woff") format('woff');
}
@font-face {
font-family: 'Source Serif Pro';
font-style: italic;
font-weight: 400;
src: url("Heuristica-Italic.woff") format('woff');
}
@font-face {
font-family: 'Source Serif Pro';
font-style: normal;
font-weight: 700;
src: local('Source Serif Pro Bold'), url("SourceSerifPro-Bold.woff") format('woff');
}

/* See SourceCodePro-LICENSE.txt for the Source Code Pro license. */
@font-face {
font-family: 'Source Code Pro';
font-style: normal;
font-weight: 400;
/* Avoid using locally installed font because bad versions are in circulation:
* see https://github.com/rust-lang/rust/issues/24355 */
src: url("SourceCodePro-Regular.woff") format('woff');
}
@font-face {
font-family: 'Source Code Pro';
font-style: normal;
font-weight: 600;
src: url("SourceCodePro-Semibold.woff") format('woff');
}

* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
Expand All @@ -70,7 +19,7 @@
/* General structure and fonts */

body {
font: 16px/1.4 "Source Serif Pro", Georgia, Times, "Times New Roman", serif;
font-size: 1em;
margin: 0;
position: relative;
padding: 10px 15px 20px 15px;
Expand Down Expand Up @@ -115,7 +64,7 @@ h3.impl, h3.method, h3.type {
h1, h2, h3, h4,
.sidebar, a.source, .search-input, .content table :not(code)>a,
.collapse-toggle, div.item-list .out-of-band {
font-family: "Fira Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-family: sans-serif;
}

ol, ul {
Expand All @@ -134,7 +83,7 @@ summary {
}

code, pre {
font-family: "Source Code Pro", Menlo, Monaco, Consolas, "DejaVu Sans Mono", Inconsolata, monospace;
font-family: monospace;
white-space: pre-wrap;
}
.docblock code, .docblock-short code {
Expand Down Expand Up @@ -395,7 +344,7 @@ h4 > code, h3 > code, .invisible > code {
}
#main > .since {
top: inherit;
font-family: "Fira Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-family: sans-serif;
}

.content table:not(.table-display) {
Expand Down Expand Up @@ -1272,7 +1221,7 @@ h3.important {
kbd {
display: inline-block;
padding: 3px 5px;
font: 15px "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
font: 0.9rem monospace;
line-height: 10px;
vertical-align: middle;
border: solid 1px;
Expand Down

0 comments on commit b77f439

Please sign in to comment.