Categories
hyperweb

Killing Comic Sans

Sure, you could just uninstall the Microsoft core fonts (they are non-free, after all), but they’re nice to have around (I guess?). Or you could just remove Comic Sans itself, but maybe you’ll one day want to use it for good or ill (who knows?) So instead you might turn to fontconfig.

First you might try a substitution rule like:

<alias>
    <family>Comic Sans MS</family>
    <prefer><family>DejaVu Sans</family></prefer>
</alias>

The prefer families specified should (?) be used before using the matched font family, even if it exists. But in testing, that didn’t work for me. Don’t force it, use a bigger hammer.

So I switched to a match/edit rule like:

<match target="font">
    <test name="family" compare="eq" qual="any">
        <string>Comic Sans MS</string>
    </test>
    <edit name="family" mode="assign">
        <string>DejaVu Sans</string>
    </edit>
</match>

This worked, but was too big of a hammer for my taste. For example, in gedit font selection it no longer says, “Comic Sans MS.” It just says, “DejaVu Sans.” What we’re after is substitution of the face, not the whole entry.

As I’m not in the habit of using Comic Sans by choice, the target of the exercise is the web. Ah, but it’s much easier to replace the font for the web. So we walk away from fontconfig and walk over to Stylish (or userstyle.css if you don’t want an add-on to help).

Now we just need a rule that tells the browser, “replace Comic Sans when you see it.” In comes @font-face. We can use this to define, for the browser, what the meaning of a particular font is:

@font-face {
    font-family: "Comic Sans MS";
    src: local("DejaVu Sans");
}

Great! Well, great-ish. We can’t specify the alias “sans-serif” because it’s an alias. That means if you change which font your alias uses (in this case, away from DejaVu Sans), it will require you to update your style rule.

We have limited options here. You could specify the font-weight, but that will interfere with the site’s own weighting. The best case is to use a distinctive replacement font. Or just give up (my choice in this case). Defeating Comic Sans is enough, no need to gloat.

Categories
hyperweb

Customizing the Web

I use the web quite a bit, and one of the things I do quite often is customize my experience on sites I frequent. Most of that customization comes via Stylish and Scriptish (the latter a fork of Grease Monkey).

Some of the things I customize are minor, like page aesthetics. Some I consider more important. Take Google Search for example. Did you know some of your search results are censored? This is thanks to laws like the Digital Millennium Copyright Act (DMCA). Google is good enough to notify you when censorship has occurred.

But only if you scroll to the bottom of the search page. Which you may not do for quick, one-off searches. This is the equivalent to newspapers printing important news on page 8N which is otherwise a full page of ads.

But thanks to Stylish:

@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("google.com") {
  #mfr {
    position: absolute !important;
    top: -20px !important;
    right: 0px !important;
    width: 300px !important;
    background-color: #FCC !important;
    font-size: 1.2em !important;
  }
}

This adds a bit of styling to the notice and throws it at the top-left of the search results.

With most software this wouldn’t be possible. Without the open web that notice (if there at all) would be permanently stuck down at the bottom. Maybe I would adopt the practice of always looking for it, but it’s doubtful.

Instead, I can remain aware of the prevalence of censored results. I can find out more.

The challenge is opening up this technology to those who don’t know CSS, JavaScript, HTML, or how to debug those technologies (as modifying the page often requires understanding it rather than simple repositioning like above). There are ways to do that, but so far they seem limited to having programmers hand ready-made solutions to novices (eg, via sharing snippets like that above).

The problem with that approach is that it limits the idea pool to those who either can implement a modification themselves or knows someone who can.