Wandering Thoughts archives


Firefox has a little handy font-related thing on Unix (or at least Linux)

On Linux in specific and Unix more generally, there is a notion of default system fonts that are known by the magic names of 'serif', 'sans-serif', and 'monospace'. What these magic names map to is determined by a complicated pile of decisions that are spread around the system in the form of Fontconfig (also). These decisions are generally fairly opaque and hard to peer into unless you're relatively experienced with command line tools.

Unless you configure it otherwise through Preferences, Firefox normally uses these standard font names if a website doesn't set specific fonts (or uses the generic names, which often show up as the last fallback in CSS). This means that Firefox is exposed to mysterious changes in what your Linux system actually maps these fonts to, which can vary. However, I discovered today that Firefox has a very convenient feature here.

If you go to the general section of Preferences and haven't customized your font choices, you will probably see the "Default font" listed as something like "Default (DejaVu Serif)". What this means is that Firefox is using the default meaning of 'serif', but is also telling you what font it actually maps to. If you go into "Advanced..." and have not customized your font choices, you can see what all three of the magic names map to. This can be very handy for sorting out strange font issues.

(This doesn't quite give you complete details, as it omits the Fontconfig style, which can vary and theoretically may make a difference.)

Firefox's Web Developer tools will give you a version of this for any web page (including ones that don't set any CSS fonts and so are using the system ones). However, as far as I can see the "fonts" pane won't tell you exactly why 'DejaVu Sans' is being used, just that it is (and that it's a system font). I also don't know if this will peer through other Fontconfig font aliases to tell you what they map to, or if it will faithfully report them under their pre-alias names.

(Because I was curious I just checked and Chrome does not show this information in its font preferences; it just tells you you're using the generic names. Chrome also appears to give less information about fonts in its Web Developer tools, but I probably don't know what I'm doing there.)

web/FirefoxUnixLittleFontBit written at 23:38:08; Add Comment

What versions of PyPy I can use (October 2020 edition)

We have to do something about our Python 2 programs, especially on our Ubuntu machines where Python 2 may be gone entirely in Ubuntu 22.04 (which is now less than two years away, and we move slowly). One way to keep Python 2 programs running is with PyPy, and PyPy can potentially also be used to speed up Python 3 programs (well, long running ones). Thinking about various things to do with PyPy makes me curious as to what versions of it I can use on the various systems I care about.

On Fedora 32, PyPy is at 7.3.1 (Fedora 31 is at 7.1.1, but I should upgrade all my machines). Both Python 3 and Python 2 versions are available. On Ubuntu, PyPy is at version 7.3.1 on 20.04, 5.10.0 on 18.04, and 5.1.2 on 16.04. Ubuntu 16.04 is pretty much irrelevant at this point, since it goes out of support in less than six months. Only Ubuntu 20.04 has a 'pypy3' package; 16.04 and 18.04 don't.

PyPy 7.3.1 (on my Fedora machines) reports that its Python 2 is 2.7.13 and its Python 3 version is 3.6.9, which could be worse. The Ubuntu 18.04 PyPy 5.10.0 also reports that it's Python 2.7.13; the Ubuntu 16.04 PyPy 5.1.2 says it's Python 2.7.10. This is somewhat behind everyone's actual version of Python 2.7, where Ubuntu 16.04 has Python 2.7.12, 18.04 has 2.7.17, and 20.04 has 2.7.18rc1 (Fedora 32 has the release version of 2.7.18). In practice probably no one cares that much about sub-versions of Python 2.7; there hasn't exactly been lots of change there.

(For my own reference if nothing else, see new features added to Python 2.7 maintenance releases. I'm not sure if this completely covers changes to the standard library, but I think the Python people have been trying to keep those down in 2.7 for the obvious reasons.)

I'm somewhat surprised that Ubuntu 18.04 has no Python 3 version of PyPy, because according to the PyPy 5.10 release notes it supported both. PyPy 5.10 only supposed Python 3.5, but then Ubuntu 18.04 has Python 3.6.9, so the Python 3 versions aren't all that far apart. Perhaps Ubuntu thought that the Python 3 support in PyPy wasn't quite ready to be shipped as part of a LTS release, or perhaps it just wasn't on their radar then.

We'd likely see speed improvements in newer PyPy releases, but for just running undemanding Python 2 programs I think any of these versions of PyPy are probably good enough. If speed matters we probably want to be using PyPy on Ubuntu 20.04.

(We have one or two Python programs that can do enough work that they might benefit from PyPy. Unfortunately they're Python 3 programs that run on machines that will probably not be upgraded to 20.04 for various reasons.)

python/MyPyPyVersions2020-10 written at 00:52:53; Add Comment

Page tools: See As Normal.
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.