Add DejaVu Sans Mono web font to the forum - Page 1
Forum section: electronics / general

author: Nominal Animal
author_rank: Super Contributor
timestamp: December 26, 2023, 02:35:24 am
content: The forum currently uses Verdana (with Monaco as a backup) for normal text, and DejaVu Sans Mono for monospace text and code snippets.(MathJax rendering already uses MathJax web fonts.)I suggest adding at least DejaVu Sans Mono as a web font to the CSS files, so that all users will see the code snippets and teletype text the same way, including the same (wide!) Unicode coverage, even when they do not have the DejaVu Sans Mono font installed. The CSS needed is@font-face {font-family: 'DejaVu Sans Mono';src: url('uri/DejaVuSansMono.woff2') format('woff2'),url('uri/DejaVuSansMono.woff') format('woff');/* This is a free font; see license aturi/DejaVuSansMono.txt */}where theuriprefix is on your server or in your content delivery network;DejaVuSansMono.woff2andDejaVuSansMono.wofffiles are created from theDejaVuSansMono.ttfTrueType font in the officialfont package, anduri/DejaVuSansMono.txtis theLICENSEfile front the same package (or the text ofdejavu-fonts.github.io/License.html).To create the.woff2and.wofffiles in Linux, you need to haveFontForgeand its python bindings (python3-fontforge), andfonttoolsinstalled. Then, runpython3 -c 'import fontforge ; fontforge.open("DejaVuSansMono.ttf").generate("DejaVuSansMono.woff")'python3 -m fontTools.ttLib.woff2 compress -o DejaVuSansMono.woff2 DejaVuSansMono.ttfin the same directory you copiedDejaVuSansMono.ttfto. After that, theDejaVuSansMono.ttffile is no longer needed, and can be deleted.Usingdejavu-fonts-ttf-2.37.tar.bz2, fonttools 4.5.0, and FontForge 20190801, the result is the three files in the attachedDejaVuSansMonoWoffs.zipfile, with the followingsha256sumchecksums:Code:7a083b136e64d064794c3419751e5c7dd10d2f64c108fe5ba161eae5e5958a93 *DejaVuSansMono.txtbc716022e425cea49d9b82c38584678c5d91aa9cb6771e42dbdf47597dfcd03a *DejaVuSansMono.woffabaac016b3a92fb5b066187673312b6a308a550c26d83ed9767d4941e24a897e *DejaVuSansMono.woff2You can check theDejaVu Fonts home page, and theWikipedia DejaVu fontspage to see that this is indeed okay.

author: magic
author_rank: Super Contributor
timestamp: December 27, 2023, 10:19:08 am
content: Not an expert on webshit stuff, does it mean that the font will now be sent to all visitors even if they already have it installed?Also, I'm pretty sure at least some of the extensions I have installed at least on some systems mentioned blocking font downloads on the basis of security.I alwaysat efforts to render websites "the same for everyone" given the variety of OSs, displays, browsers, extensions and customizations out there. As far as I'm concerned any mono font with equal character width is a good enough mono font

author: nctnico
author_rank: Super Contributor
timestamp: December 28, 2023, 03:19:35 am
content: I'd leave it alone as the browser likely has better fonts locally and users may have set things up to improve accessability of websites which then get overruled! Don't try and fix something that isn't broken. Quite a few websites show text which is complete garbage when font smoothing is disabled. If EEVblog becomes like that, I'm gone.

author: Nominal Animal
author_rank: Super Contributor
timestamp: December 28, 2023, 10:36:49 am
content: Quote from: magic on December 27, 2023, 10:19:08 amThe above CSS does that, yes.However, with@font-face {font-family: 'DejaVu Sans Mono Webfont';src: url('uri/DejaVuSansMono.woff2') format('woff2'),url('uri/DejaVuSansMono.woff') format('woff');/* This is a free font; see license aturi/DejaVuSansMono.txt */}and in the CSS snippets for tt and code elements,font-family: 'DejaVu Sans Mono', 'DejaVu Sans Mono Webfont', 'monaco', 'lucida console', 'courier new', monospace;then OS-installed DejaVu Sans Mono would be preferred, otherwise the webfont would be used; and browsers that don't want to use the webfont fall back to the same list as now.Quote from: magic on December 27, 2023, 10:19:08 amThat only happens when the webfont is hosted elsewhere, not in the same domain as the page was loaded from.Quote from: magic on December 27, 2023, 10:19:08 amThe problem is, their Unicode glyph coverage varies a lot, so they display rectangles instead of the desired glyph. Anything outside Latin letters may, or may not be displayed correctly.Quote from: nctnico on December 28, 2023, 03:19:35 amImpossible, for DejaVu Sans Mono. The webfont created using the instructions I listed is the same as the TrueType original,DejaVu Sans Mono.ttf. The Web Open Font format simply compresses it (lossless compression) and adds an XML description to it. In particular, hinting information is retained.If you consider the alternative fonts, like Monaco, their Unicode coverage is worse than DejaVu Sans Mono, so using those already installed "better fonts" some glyphs us that do have DejaVu Sans Mono installed (or use the equivalent webfont), may see just rectangles instead of the proper intended glyphs.

author: tszaboo
author_rank: Super Contributor
timestamp: December 28, 2023, 11:28:48 am
content: You are clearly skilled enough to change it client side.

author: Nominal Animal
author_rank: Super Contributor
timestamp: December 28, 2023, 12:35:56 pm
content: Quote from: tszaboo on December 28, 2023, 11:28:48 amI can. I just dislike it when others say they can't see all the glyphs in my posts, especially the ones using Unicode Box Drawing, Mathematical Operators, and so on, that are included in the font set for this forum in teletype text and code snippets, but not in the backup fonts like Monaco.I especially dislike it when people claim it is a Linux problem. It has nothing to do with Linux, and everything to do with what fonts are used on web pages, and how.

author: magic
author_rank: Super Contributor
timestamp: December 28, 2023, 05:51:54 pm
content: Pretty sure that NoScript blocks fonts from all domains, or at least offers blocking as an option (which I usually enabled because I don't care about somebody's gimmick fonts).The font would also need to be kept up to date, or next year somebody will complain that latest "brown poo" Unicode emoticon doesn't workI was wondering why anyone would even want weird characters in code blocks, but box drawing perhaps makes sense. That being said, in such situations I simply use whatever's available in ASCII or create a graphical diagram of one sort or another...

author: thm_w
author_rank: Super Contributor
timestamp: December 28, 2023, 10:09:01 pm
content: Quote from: nctnico on December 28, 2023, 03:19:35 amWhat an absurd threat.If you care about having specific fonts, it takes about 10 seconds to change them to your own preference:https://support.mozilla.org/en-US/kb/change-fonts-and-colors-websites-usethey don't get magically overruled.

author: Nominal Animal
author_rank: Super Contributor
timestamp: December 29, 2023, 12:13:25 pm
content: I createda test page herefor DejaVu Sans Mono, which always uses the web font. (As I wrote above, it is trivial to set it as a backup version for a system-installed DejaVu Sans Mono.)It also shows most of the glyphs I use from various Unicode blocks.

author: Veteran68
author_rank: Frequent Contributor
timestamp: December 30, 2023, 12:38:36 am
content: If it matters, I support this suggestion. I'm a bit of an OCD font nerd myself.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: December 30, 2023, 07:14:00 am
content: I wouldn't mind having an inline code format either, for examplettcould be set with a subtle colored background. But a more distinctive font will help too.Tim