-
Notifications
You must be signed in to change notification settings - Fork 339
Use native font stack / remove vendored open-sans + lato fonts #285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jorisvandenbossche
merged 13 commits into
pydata:master
from
jorisvandenbossche:native-font-stack
Mar 11, 2021
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
bb1f084
Use native font stack
jorisvandenbossche 8324057
remove vendored opensans / lato fonts
jorisvandenbossche 476f153
update contributing.rst
jorisvandenbossche dc9b75c
Merge remote-tracking branch 'upstream/master' into native-font-stack
jorisvandenbossche e3dc9e8
use Helvetica Neue
jorisvandenbossche 69badd6
base system variable + update FontAwesome note
jorisvandenbossche 52cd67a
fix monospace variable
jorisvandenbossche d37f88d
propose updated contributing documentation (#1)
bollwyvl 2aece60
update customization section on how to change the font
jorisvandenbossche 1ccda07
rst formatting
jorisvandenbossche b133dbb
fixup rst take 2
jorisvandenbossche 1c6f62b
fix include css
jorisvandenbossche 73d0efb
add suggestion of Nicholas
jorisvandenbossche File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,8 @@ To add a custom stylesheet, follow these steps: | |
|
||
When you build your documentation, this stylesheet should now be activated. | ||
|
||
.. _css-variables: | ||
|
||
CSS Theme variables | ||
=================== | ||
|
||
|
@@ -49,7 +51,7 @@ In order to change a variable, follow these steps: | |
.. code-block:: none | ||
|
||
:root { | ||
--font-size-base: 17px; | ||
--pst-font-size-base: 17px; | ||
} | ||
|
||
For a complete list of the theme variables that you may override, see the | ||
|
@@ -65,37 +67,60 @@ For a complete list of the theme variables that you may override, see the | |
Replacing/Removing Fonts | ||
======================== | ||
|
||
The theme contains custom web fonts, in several formats, for different purposes: | ||
The theme includes the `FontAwesome 5 Free <https://fontawesome.com/icons?m=free>`__ | ||
icon font (the ``.fa, .far, .fas`` styles, which are used for | ||
:ref:`icon links <icon-links>` and admonitions). | ||
This is the only `vendored` font, and otherwise the theme by default relies on | ||
available system fonts for normal body text and headers. | ||
|
||
.. Attention:: | ||
|
||
Previously-included fonts like `Lato` have been removed, preferring | ||
the most common default system fonts of the reader's computer. This provides | ||
both better performance, and better script/glyph coverage than custom fonts, | ||
and is recommended in most cases. | ||
|
||
The default body and header fonts can be changed as follows: | ||
|
||
- Using :ref:`custom-css`, you can specify which fonts to use for body, header | ||
and monospace text. For example, the following can be added to a custom | ||
css file: | ||
|
||
- "normal" body text, on ``body`` | ||
- page and section headers, on ``.header-style`` | ||
- icons, on ``.fa, .far, .fas`` | ||
.. code-block:: none | ||
|
||
While altering the icon font is presently somewhat involved, the body and header fonts, | ||
often paired together, can be replaced (or removed altogether) by: | ||
:root { | ||
--pst-font-family-base: Verdana, var(--pst-font-family-base-system); | ||
--pst-font-family-heading: Cambria, Georgia, Times, var(--pst-font-family-base-system); | ||
--pst-font-family-monospace: Courier, var(--pst-font-family-monospace-system); | ||
} | ||
|
||
- configuring `template_path <https://www.sphinx-doc.org/en/master/theming.html#templating>`__ | ||
in your ``conf.py`` | ||
- creating a custom ``layout.html`` Jinja2 template which overloads the ``fonts`` block | ||
The ``-system`` variables are available to use as fallback to the default fonts. | ||
|
||
.. code-block:: html+jinja | ||
- If the font you want to specify in the section above is not generally available | ||
by default, you will additionally need to ensure the font is loaded. | ||
For example, you could download and vendor the font in the ``_static`` directory | ||
of your Sphinx site, and then update the base template to load the font resources: | ||
|
||
{% extends "pydata_sphinx_theme/layout.html" %} | ||
- Configure the `template_path <https://www.sphinx-doc.org/en/master/theming.html#templating>`__ | ||
in your ``conf.py`` | ||
- Create a custom ``layout.html`` Jinja2 template which overloads the ``fonts`` block | ||
(example for loading the Lato font that is included in the ``_static/vendor`` directory): | ||
|
||
{% block fonts %} | ||
.. code-block:: html+jinja | ||
|
||
{% extends "pydata_sphinx_theme/layout.html" %} | ||
|
||
{% block fonts %} | ||
<!-- add `style` or `link` tags with your CSS `@font-face` declarations here --> | ||
<!-- ... and a `style` tag with setting `font-family` in `body` and `.header-style` --> | ||
<!-- ... and optionally preload the `woff2` for snappier page loads --> | ||
<!-- or add a `style` tag with a font fallback chain with good cross-platform coverage --> | ||
<style> | ||
body { | ||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; | ||
} | ||
.header-style { | ||
font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; | ||
} | ||
</style> | ||
{% endblock %} | ||
<link rel="stylesheet" href="{{ pathto('_static/vendor/lato_latin-ext/1.44.1/index.css', 1) }}"> | ||
|
||
{% endblock %} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps concretely add:
and then in the code block
|
||
|
||
To reduce the `Flash of Unstyled Content`, you may wish to explore various options for | ||
`preloading content <https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content>`__, | ||
specifically the binary font files. This ensure the files will be loaded | ||
before waiting for the CSS to be parsed, but should be used with care. | ||
|
||
.. _pydata-css-variables: https://github.com/pandas-dev/pydata-sphinx-theme/blob/master/pydata_sphinx_theme/static/css/theme.css | ||
.. _css-variable-help: https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ndex.57d3cd9fdfd1e83932aa4eb4774f9fb9.css → ...ndex.101715efdecc9b59cb6e1ddfa685c31f.css
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
20 changes: 0 additions & 20 deletions
20
pydata_sphinx_theme/static/vendor/lato_latin-ext/1.44.1/LICENSE.md
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-22.9 KB
pydata_sphinx_theme/static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-100-italic.woff
Binary file not shown.
Binary file removed
BIN
-17.8 KB
...ta_sphinx_theme/static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-100-italic.woff2
Binary file not shown.
Binary file removed
BIN
-28.6 KB
pydata_sphinx_theme/static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-100.woff
Binary file not shown.
Binary file removed
BIN
-22.8 KB
pydata_sphinx_theme/static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-100.woff2
Binary file not shown.
Binary file removed
BIN
-23.5 KB
pydata_sphinx_theme/static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-300-italic.woff
Binary file not shown.
Binary file removed
BIN
-18.4 KB
...ta_sphinx_theme/static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-300-italic.woff2
Binary file not shown.
Binary file removed
BIN
-31.4 KB
pydata_sphinx_theme/static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-300.woff
Binary file not shown.
Binary file removed
BIN
-24.3 KB
pydata_sphinx_theme/static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-300.woff2
Binary file not shown.
Binary file removed
BIN
-31.5 KB
pydata_sphinx_theme/static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-400-italic.woff
Binary file not shown.
Binary file removed
BIN
-25.7 KB
...ta_sphinx_theme/static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-400-italic.woff2
Binary file not shown.
Binary file removed
BIN
-30.2 KB
pydata_sphinx_theme/static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-400.woff
Binary file not shown.
Binary file removed
BIN
-24.7 KB
pydata_sphinx_theme/static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-400.woff2
Binary file not shown.
Binary file removed
BIN
-31.8 KB
pydata_sphinx_theme/static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-700-italic.woff
Binary file not shown.
Binary file removed
BIN
-25.7 KB
...ta_sphinx_theme/static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-700-italic.woff2
Binary file not shown.
Binary file removed
BIN
-29.6 KB
pydata_sphinx_theme/static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-700.woff
Binary file not shown.
Binary file removed
BIN
-24.1 KB
pydata_sphinx_theme/static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-700.woff2
Binary file not shown.
Binary file removed
BIN
-30.5 KB
pydata_sphinx_theme/static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-900-italic.woff
Binary file not shown.
Binary file removed
BIN
-25 KB
...ta_sphinx_theme/static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-900-italic.woff2
Binary file not shown.
Binary file removed
BIN
-29 KB
pydata_sphinx_theme/static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-900.woff
Binary file not shown.
Binary file removed
BIN
-23.8 KB
pydata_sphinx_theme/static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-900.woff2
Binary file not shown.
120 changes: 0 additions & 120 deletions
120
pydata_sphinx_theme/static/vendor/lato_latin-ext/1.44.1/index.css
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
pydata_sphinx_theme/static/vendor/open-sans_all/1.44.1/LICENSE.md
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-51.8 KB
pydata_sphinx_theme/static/vendor/open-sans_all/1.44.1/files/open-sans-all-400-italic.woff
Binary file not shown.
Binary file removed
BIN
-40.1 KB
pydata_sphinx_theme/static/vendor/open-sans_all/1.44.1/files/open-sans-all-400-italic.woff2
Binary file not shown.
Binary file removed
BIN
-54 KB
pydata_sphinx_theme/static/vendor/open-sans_all/1.44.1/files/open-sans-all-400.woff
Binary file not shown.
Binary file removed
BIN
-42.2 KB
pydata_sphinx_theme/static/vendor/open-sans_all/1.44.1/files/open-sans-all-400.woff2
Binary file not shown.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bollwyvl if you could take a quick look at this section (the text below here), that would be great