Skip to content

Update web font - #934

Closed
maxrjones wants to merge 3 commits into
masterfrom
docs-fonts
Closed

maxrjones wants to merge 3 commits into
masterfrom
docs-fonts

Conversation

@maxrjones

Copy link
Copy Markdown
Member

Description of proposed changes

This PR serves to preview different web font options based on the discussion at #933.

Fixes #933

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If adding new functionality, add an example to docstrings or tutorials.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

@maxrjones
maxrjones marked this pull request as draft February 19, 2021 18:29
@maxrjones maxrjones added documentation Improvements or additions to documentation bug Something isn't working labels Feb 19, 2021
@seisman

seisman commented Feb 19, 2021

Copy link
Copy Markdown
Member

Looks good with Microsft Edge, Google Chrome, Safari, and Firefox on macOS.

@liamtoney

Copy link
Copy Markdown
Member

From my limited knowledge of web design, I think we could serve the actual webfont file and then it should work regardless of platform.

@liamtoney

liamtoney commented Feb 19, 2021 •

Copy link
Copy Markdown
Member

Google Fonts makes it really easy to test sentences containing I and l.

Comment thread doc/_static/style.css Resolved
Comment thread doc/_static/style.css Resolved
@liamtoney

Copy link
Copy Markdown
Member

What about IBM Plex Sans? It differentiates lower-case L and upper-case I even more:

Screen Shot 2021-02-19 at 11 41 07 AM

To use one of the many Google Fonts, we could either:

  1. Link in the HTML <head> (the below code is copied straight from the Google Fonts page):

    <link rel="preconnect" href="https://fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet">
    
  2. Download the font and serve it.

In either case we don't have to bank on folks having the font installed locally, I think.

@maxrjones

Copy link
Copy Markdown
Member Author

I am not knowledgeable enough about licensing to know whether it's an option to ship fonts with PyGMT. In the python packages that I use most often, I have noticed fonts included for logos (e.g., matplotlib) but generally not for the main docs.

@liamtoney

liamtoney commented Feb 19, 2021 •

Copy link
Copy Markdown
Member

I am not knowledgeable enough about licensing to know whether it's an option to ship fonts with PyGMT. In the python packages that I use most often, I have noticed fonts included for logos (e.g., matplotlib) but generally not for the main docs.

Yeah, I think option 1) is pretty standard and likely makes more sense to keep the repo smaller etc. All Google Fonts are open-source: https://developers.google.com/fonts/faq#can_i_use_fonts_from_the_google_fonts_catalog_on_any_page

Edit:

Looks like Google actually recommends using an HTML link: https://developers.google.com/fonts/faq#will_web_fonts_slow_down_my_page

@seisman

seisman commented Feb 19, 2021

Copy link
Copy Markdown
Member
  1. Link in the HTML <head> (the below code is copied straight from the Google Fonts page):
    <link rel="preconnect" href="https://fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet">
    

Most Google services and sites are blocked in China 😞. I'd appreciate it if we can avoid using these external font resources.

@liamtoney

Copy link
Copy Markdown
Member
  1. Link in the HTML <head> (the below code is copied straight from the Google Fonts page):
    <link rel="preconnect" href="https://fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet">
    

Most Google services and sites are blocked in China 😞. I'd appreciate it if we can avoid using these external font resources.

Shoot, I didn't realize. Good point.

@liamtoney

Copy link
Copy Markdown
Member

I made a branch docs-fonts-serve which demos what serving a font would be like. @seisman I guess we can't preview unless I turn it into a PR?

This setup does not use Google. IBM Plex Sans is licensed under OFL, meaning it's free to use and serve etc. Many fonts fall into this category. Font files are about 300 KB in total so not much of an impact on repo size I think. Serving the font guarantees that all users see the same thing (I think).

Screen Shot 2021-02-19 at 1 04 58 PM

I think this looks pretty nice, but I'm a bit of an aesthete...

@seisman

seisman commented Feb 19, 2021

Copy link
Copy Markdown
Member

I guess we can't preview unless I turn it into a PR?

Yes.

@liamtoney liamtoney mentioned this pull request Feb 19, 2021
5 tasks
@liamtoney

liamtoney commented Feb 19, 2021 •

Copy link
Copy Markdown
Member

I opened #936 so we can get a preview. We can keep discussion here though (as I note in that PR).

Edit:

Preview link: https://pygmt-ocupv4u4w.vercel.app/

@weiji14

weiji14 commented Feb 19, 2021

Copy link
Copy Markdown
Member

I opened #936 so we can get a preview. We can keep discussion here though (as I note in that PR).

Edit:

Preview link: https://pygmt-ocupv4u4w.vercel.app/

I feel like the small letter I (i) looks too much like a small letter L (l), not enough spacing between the dot of the small letter i with the lower vertical part 😅

image

@liamtoney

Copy link
Copy Markdown
Member

I see what you mean. Maybe worse on lower-resolution screens? Though that could be a case for a lot of fonts.

This branch was previously deployed

1 inactive deployment
Preview — c4ee3afa Deployed Feb 19, 2021 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Better web font for I (capital i) and l (small L)

4 participants