Archives page: 9

Conditionally Loading Web Fonts

Services like typekit, fontdeck, and the new Webfonts by H&FJ give web designers options we didn’t have a few years ago — which is great, but it slows down the web.

I hope additional services and the competition between providers will help make web fonts even better and more performant in the future. However, if you care about performance today you should use your best judgement when adding fonts to your web design project, as they come at the cost of your website’s perceived performance and download time by creating additional network requests and bulking up the overall size of your website — which can have a significant impact on mobile website’s performance.

One option I’ve used to increase performance on smaller screened devices when building responsive sites is simply not serving the web fonts to those devices. This makes sense if your project values performance over maintaining a consistent typographical look on both your mobile and desktop sites. It’s not for everyone, but I’ve worked on some projects where there were so many assets being loaded, it just made sense to cut the fonts out to help speed up the site.

You should already be smartly not including styles and weights you’re not going to use, like excluding an italic variant if your using that font just for headings.

So assuming you want to load some fonts conditionally based on screen size, you might initially think of including them through a media query like so:

( media min-width: 620px ) {
@font-face {
font-family: "goudy-oldstyle";
url('webfonts/goudy.woff') format('woff')
}
html { font-family: "goudy-oldstyle", ... ; }
}

While this works for loading fonts from your own server, if you’re using a service like typekit it’s not so simple. This is because typekit requires the fonts be loaded from it’s servers and it’s API accessed via a JavaScript call in the head of your document.

To work around this you can check the width (or some other relavant property) of the browser viewport in the head of the document and then use document.write to load the typekit scripts if your condition has been met. In the head of the document within a “<script>” tag you would want to do something like this:

if ( window.innerWidth > 600 ) {
document.write('<script type="text/javascript" src="//use.typekit.net/your_key.js"?><\/script><script>try{Typekit.load();}catch(e){}<\/script>')
}

The value “600” is arbitrary, but would be the width in pixels of the browser width you’re trying to target. You would want to replace “//use.typekit.net/your_key.js” with your own typekit account key. Again, this technique isn’t for everyone, but it’s a simple way of saving resources if serving fonts isn’t essential for your mobile users.

Danny O’Brien for EFF:

A Web where you cannot cut and paste text; where your browser can’t “Save As…” an image; where the “allowed” uses of saved files are monitored beyond the browser; where JavaScript is sealed away in opaque tombs; and maybe even where we can no longer effectively “View Source” on some sites, is a very different Web from the one we have today. It’s a Web where user agents—browsers—must navigate a nest of enforced duties every time they visit a page. It’s a place where the next Tim Berners-Lee or Mozilla, if they were building a new browser from scratch, couldn’t just look up the details of all the “Web” technologies. They’d have to negotiate and sign compliance agreements with a raft of DRM providers just to be fully standards-compliant and interoperable.

Really surprised (and concerned) that DRM seems to be working its way into W3C proposals.

Source

Remaking the line-mode browser

Actually, there’s one hack that was pretty cool. As mentioned, the original browser parsed and then drew to the screen character by character. Which basically means you see the browser draw, quite quickly, but still very noticeably, each character to the screen,. We wanted to emulate this, as it is as much a part of the original experience as the monochrome screen, or monospace font used.

Our original idea was to use CSS animations for this. But, this would require wrapping every individual character in a span element, then showing each character one by one.

Then in most likely a caffeine fuelled brainstorm, we came up with the idea of covering the document with a black, opaque canvas, then repeatedly erasing a rectangle the size of a character column by column, line by line.

Source

It’s a really nice touch: Launch the Line Mode Browser

Controlling CSS Animations and Transitions with JavaScript

Some of the most useful yet little-known JavaScript tricks for manipulating CSS transitions and animations are the DOM events they fire. Like: animationend, animationstart, and animationiteration for animations and transitionend for transitions. You might guess what they do. These animation events fire when the animation on an element ends, starts, or completes one iteration, respectively.

Source

Goodbye Tucson – Hello Seattle

I had been throwing around the idea of leaving Tucson for the past year or so and was pretty set on moving to the Bay Area in late 2013. However after returning to Tucson from a weekend trip to San Diego I made a hasty decision to move to Seattle instead. It’s been 12 years since I’ve lived in Seattle and thought it would be nice to be closer to family. I normally enjoy Tucson summers and especially the monsoon season, but temperatures this June were out of my comfort zone. I chose to move to Seattle instead of the Bay Area because I have family there and figured housing would be easier to come by.

It took me a month and a half, but I eventually found an apartment close to downtown on Capitol Hill and am now comfortably situated and very well caffeinated.

Seattle has been for the most part dry, pleasant, and in the 80’s. Perfect for bike rides if you’re comfortable going up and down hills (I had to swap out the chain ring on my fixed gear to accommodate these). Clouds and rainy systems have been rolling in more frequently lately, but they’re a welcome addition to the mix in my mind, especially after 5 years of basically non-stop sunshine courtesy of Tucson in all it’s subtle, yet nevertheless-summer-like seasons.

I’m looking forward to cooler weather, fall colors, and being a little more aware of the tides.

Popular Posts

Talks