Thursday, February 14, 2013

Your Daily digest for Tech Geek`s Tools, Tips, Tricks and Tutorials

Tech Geek`s Tools, Tips, Tricks and Tutorials
Pipes Output
Ask Slashdot: What Is Your Favorite Monitor For Programming?
Feb 14th 2013, 23:03

First time accepted submitter BadassFractal writes "I'm in the market for a new large desktop monitor (or two) which I intend to use almost exclusively for programming and all sorts of software development-related work. I'm trying to keep the cost down reasonable, and I do enjoy as large of a resolution as possible. What do people 'in the know' out there use these days for that purpose? I'm thinking a 1920x1200 24" would be good, unless there's an affordable 2560xFoo option out there. I keep hearing about nameless Korean 27" screens, any thoughts on those?"

Share on Google+

Read more of this story at Slashdot.



Game Closure "DevKit" For Mobile HTML5 Games Is Open Source
Feb 14th 2013, 22:46

First time accepted submitter Chris Taylor writes "Silicon Valley startup Game Closure has open-sourced their HTML5 game development toolkit. The trailer video showcases some interesting new technology. It allows game developers to write code in JavaScript on Windows, Mac and Linux desktops to rapidly create and then deploy new games on the Internet, Android, and on iOS cellphones. The source code for the entire stack is available on GitHub, including the changes to Google V8 and Mozilla SpiderMonkey."

Share on Google+

Read more of this story at Slashdot.



Driver Trapped In Speeding Car At 125 Mph
Feb 14th 2013, 22:25

Hugh Pickens writes writes "The Guardian reports that Frank Lecerf was driving his Renault Laguna in Northern France when the car's speed jammed at 60mph. Then each time he tried to brake, the car accelerated, eventually reaching 125mph and sticking there. While uncontrollably speeding through the fast lane as other cars swerved out of his way, he managed to call emergency services who immediately dispatched a platoon of police cars. Realizing Lecerf had no choice but to keep racing along until his fuel ran out, they escorted him at high speed across almost 125 miles of French motorway, past Calais and Dunkirk, and over the Belgian border. After about an hour, Lecerf's tank spluttered empty and he managed to swerve into a ditch in Alveringem in Belgium, about 125 miles from his home. 'My life flashed before me,' says Lecerf. 'I just wanted it to stop.' His lawyer says Lecerf will file a legal complaint over 'endangerment of a person's life.'"

Share on Google+

Read more of this story at Slashdot.



Portrait Sculptures From Genetic Material
Feb 14th 2013, 21:44

rogue-girl writes "Artist Heather Dewey-Hagborg showcases portrait sculptures from genetic material collected in public spaces. DNA extraction and processing are done in a DIYbio-compliant fashion at the DIYbio hackerspace Genspace in Brooklyn, the collected information is then given as input to a 3D printer. The software developed and used for this project is awkwardly dubbed 'friendware', that is it is neither open nor closed, but only available to friends. Reconstructing faces from DNA is not new: scientists already successfully reconstructed Neanderthal man's face from ancient DNA back in 2008. At first sight, the artist's project may seem fun and quite impressive as high-voltage science proves once more feasible at home, but all the data one can have access to from totally banal samples leaves open worrying perspectives about how easy it is to use DNA collected in public spaces for "fingerprinting" people against their will and without their consent."

Share on Google+

Read more of this story at Slashdot.



RIM Co-Founder Drops His Stock
Feb 14th 2013, 21:07

drdread66 writes "Reuters reports today that Research In Motion co-founder Jim Balsillie dumped his entire stake in BlackBerry at the end of 2012. While it's common to see high-level executives sell some of their shares to gain some liquidity, it's unusual to see them exit their positions completely. This has to be seen as a massive vote of 'no confidence' from someone who was on the inside long enough to know what's going on in the company."

Share on Google+

Read more of this story at Slashdot.



Google Store Sends User Information To App Developers
Feb 14th 2013, 20:26

Several readers have passed on news of a privacy hole in the Google app store. Reader Strudelkugel writes with the news.com.au version, excerpting: "Every time you purchase an app on Google Play, your name, address and email is passed on to the developer, it has been revealed today. The 'flaw' — which appears to be by design — was discovered this morning by Sydney app developer Dan Nolan who told news.com.au that he was uncomfortable being the custodian of this information and that there was no reason for any developer to have this information at their finger tips."

Share on Google+

Read more of this story at Slashdot.



CES: Tiny Fuel Cell is Supposed to Charge a Cell Phone for Two Weeks (Video)
Feb 14th 2013, 19:46

Many of us have plug-in external batteries of one sort to recharge our smart phones when we're away from power outlets. Or we have gigantic aftermarket batteries that make our phones so fat they barely fit in our pockets. So there is this company, Lilliputian Power Systems, that is just starting to market a tiny, butane-powered fuel cell they call the Nectar that plugs into your cell phone (or whatever) through a USB port and supposedly charges it for up to two weeks. That's a lot better than an add-on battery. It looks expensive, although the power "pods" aren't too pricey at $19.99 for two. But wait a minute: Why aren't fuel cells, not internal combustion engines, the "range extenders" in plug-in hybrid cars? A decade back, fuel cells were going to revolutionize our power delivery and consumption systems. A cell phone charger is cute, but is that really all we can get fuel cells to do?

Share on Google+

Read more of this story at Slashdot.



Ask Slashdot: Spreadsheet With Decent Programming Language?
Feb 14th 2013, 19:03

First time accepted submitter slartibartfastatp writes "Spreadsheets are very flexible tools for data analysis and transformations, the obvious options being MS Excel and LibreOffice. However, I found increasingly infuriating to deal with the VBA--dialect functions or (even worse) its translated versions. Is there any spreadsheet that allows usage of a decent programming language in its formulae? I found PySpread intriguing, but still very beta (judging from its latest release version 0.2.3). Perl or even javascript would be better options than =AVERAGE(). Do you know any viable alternatives?"

Share on Google+

Read more of this story at Slashdot.



Collaborative LaTeX Editor With Preview In Your Web Browser
Feb 14th 2013, 18:32

Celarent Darii writes "Slashdot readers have undoubtedly heard of Google Docs and the many other online word processing solutions that run in the browser. However, as a long-time user of TeX and LaTeX, these solutions are not my favorite way of doing things. Wouldn't it be nice to TeX something in your browser? Well, look no further, there is now an online collaborative LaTeX editor with integrated rapid preview. Some fantastic features: quasi-instant preview, automatic versioning of source, easy collaboration and you can even upload files and pictures. Download your project later when you get home. Are you a TeX guru with some masterpieces? Might I suggest uploading them? For the beginner: you can start here."

Share on Google+

Read more of this story at Slashdot.



Iceland Considers Internet Porn Ban
Feb 14th 2013, 18:00

Onymous Hero writes "With the printing and distribution of pornography already banned in Iceland, further measures to stop internet porn are being considered by Iceland's Interior Minister Ogmundur Jonasson. From the article: "Iceland is taking a very progressive approach that no other democratic country has tried," said Professor Gail Dines, an expert on pornography and speaker at a recent conference at Reykjavik University. "It is looking a pornography from a new position — from the perspective of the harm it does to the women who appear in it and as a violation of their civil rights.""

Share on Google+

Read more of this story at Slashdot.



Elon Musk Lays Out His Evidence That NYT Tesla Test Drive Was Staged
Feb 14th 2013, 17:27

mykepredko writes "Tesla Motors CEO and founder Elon Musk definitely isn't the best guy to try to pull a fast one on. The visionary entrepreneur set Twitter a titter when he claimed earlier this week that New York Times writer John Broder had fudged details about the Tesla Models S car's range in cold weather, resulting in what he termed a 'fake' article. Musk promised evidence, and now he has delivered, via the official Tesla blog."

Share on Google+

Read more of this story at Slashdot.



Interviews: Ask Derek Khanna About Government Regulations and Technology
Feb 14th 2013, 16:45

Republican staffer Derek Khanna was thrust into the spotlight in December for being fired after submitting a controversial brief titled: Three Myths about Copyright Law and Where to Start to Fix it. In the brief Khanna said: "Current copyright law does not merely distort some markets – rather it destroys entire markets," a view not very popular with Republicans in the House of Representatives. Since the firing, Khanna has continued to speak out on the need for copyright reform and most recently on the law against unlocking cellphones. Derek has graciously agreed to take some time to answer your questions about copyright reform and IP law. As usual, ask as many questions as you'd like, but please, one question per post.

Share on Google+

Read more of this story at Slashdot.



Surface Pro: 'Virtually Unrepairable'
Feb 14th 2013, 16:12

An anonymous reader writes with a link to an article at Wired with some harsh words for Microsoft's new tablet: "The Surface Pro is not a repair-friendly machine. In fact, it's one of the least repairable devices iFixit has seen: In a teardown of Microsoft's tablet-laptop hybrid, the company gave it a rock-bottom score of just one — one! — out of 10 for repairability, lower even than Apple's iPad and the Windows Surface RT."

Share on Google+

Read more of this story at Slashdot.



Web Typography: Setting Weights And Styles With The @font-face Declaration
Feb 14th 2013, 15:32


  

If people are on your website, they're probably either skimming quickly, looking for something, or they've found what they're looking for and want to read it as easily as possible. Either way, keeping text readable will help them achieve their goal.

Bold and Italic Help to Organize Content

A few months ago, I wrote an article on "Avoiding Faux Weights and Styles with Google Web Fonts." I ended the article by showing that weights and styles are an important UX element when setting text. Bold and italic forms of a font help people to skim your website. They add emphasis — both strong and subtle — that can help visitors understand the organization of content before even starting to read it.

1_organize_text
Weights and styles are an important UX element. Bold and italic help readers to see structure and to skim the text more efficiently (left). The same text without bold or italic (right) feels more like a narrative.

In this article, we'll start where we left off. Because weights and styles help our visitors to read our content, we should make sure they work! And getting weights and styles to work correctly using the @font-face declaration can be a bit crazy-making. Let's look at two popular approaches to setting weights and styles with the @font-face declaration. I'll show you why they are not the best solutions, and show you a third more effective approach to follow.

Unique Font-Family Names, Normal Weights And Styles

If you've used one of FontSquirrel's amazing @font-face kits, then you're familiar with this approach to setting weights and styles. The CSS provided in every kit uses a unique font-family name for each weight and style, and sets the weight and style in the @font-face declaration to normal.

For example, the syntax for Ubuntu Italic and Ubuntu Bold looks like this:

  @font-face {     font-family: 'UbuntuItalic';        src: url('Ubuntu-RI-webfont.eot');        src: url('Ubuntu-RI-webfont.eot?#iefix') format('embedded-opentype'),             url('Ubuntu-RI-webfont.woff') format('woff'),             url('Ubuntu-RI-webfont.ttf') format('truetype'),             url('Ubuntu-RI-webfont.svg#UbuntuItalic') format('svg');     font-weight: normal;     font-style: normal;  }    @font-face {     font-family: 'UbuntuBold';        src: url('Ubuntu-B-webfont.eot');        src: url('Ubuntu-B-webfont.eot?#iefix') format('embedded-opentype'),             url('Ubuntu-B-webfont.woff') format('woff'),             url('Ubuntu-B-webfont.ttf') format('truetype'),             url('Ubuntu-B-webfont.svg#UbuntuBold') format('svg');     font-weight: normal;     font-style: normal;  }  

Notice that the font-family names are unique, with each font-family name accessing the appropriate Web font files. For example, UbuntuItalic accesses Ubuntu-RI-webfont.woff, while UbuntuBold accesses Ubuntu-B-webfont.woff.

Also, notice that the font-weight and font-style for both @font-face declarations are set to normal.

Styling Text Using This Method

To style text using this method, use the appropriate font-family name, and keep all weights and styles set to normal. For example, the Regular, Regular Italic, Bold and Bold Italic headings below are set with classes. The classes are styled like so:

  .u400 {     font-family: 'UbuntuRegular', arial, sans-serif;     font-weight: normal;     font-style: normal;  }    .u400i {     font-family: 'UbuntuRegularItalic', arial, sans-serif;     font-weight: normal;     font-style: normal;  }    .u700 {     font-family: 'UbuntuBold', arial, sans-serif;     font-weight: normal;     font-style: normal;  }    .u700i {     font-family: 'UbuntuBoldItalic', arial, sans-serif;     font-weight: normal;     font-style: normal;  }  

2_unique_font-families
Ubuntu Regular, Italic, Bold and Bold Italic on Windows 7 in Internet Explorer 8 (top) and on Mac OS X in Chrome 23 (bottom). Unique font-family names with normal weights and styles (á la FontSquirrel) work fine.

Make Sure the Weights and Styles Match!

Because the weights and styles are set to normal in the @font-face declarations, keeping the weights and styles set to normal when styling the text is important. Otherwise, the bolds may double-bold (some browsers will add a bold weight to the already bold Web font), and the italics may double-italic (some browsers will add an italic style to the already italic Web font).

For example, let's say we incorrectly set the font-style to italic and the font-weight to 700 (bold) in our corresponding classes:

  .u400 {     font-family: 'UbuntuRegular', arial, sans-serif;     font-weight: normal;     font-style: normal;  }    .u400i {     font-family: 'UbuntuRegularItalic', arial, sans-serif;     font-weight: normal;     font-style: italic;  }    .u700 {     font-family: 'UbuntuBold', arial, sans-serif;     font-weight: 700;     font-style: normal;  }    .u700i {     font-family: 'UbuntuBoldItalic', arial, sans-serif;     font-weight: 700;     font-style: italic;  }  

The fonts will render incorrectly in Mac OS X browsers and on iPad Safari browsers.

3_unique_double-bold
When using normal weights and styles in the @font-face declaration, give text elements normal weights and styles, too. Otherwise, your text may end up with a double-bold and double-italic. If you set text elements as bold or italic, then Ubuntu Italic, Bold and Bold Italic won't double-bold or double-italic on Windows 7 in Internet Explorer 8 (top). But look at what happens on Mac OS X in Firefox 17 and on iPad 3 with iOS 5.1 in Safari (bottom) — yikes!

Using <em> and <strong> Elements

While <em> and <strong> can be styled to communicate emphasis and importance in a variety of ways, they are often used in their default forms: with <em> set to italic text and <strong> set to bold text.

For example, the paragraph below is styled like so:

  p {     font-family: 'UbuntuRegular', arial, sans-serif;     font-weight: normal;     font-style: normal;  }  

And the <em> and <strong> elements are left in their default states:

  em {     font-style: italic;  }    strong {     font-weight: bold;  }  

4_unique_em_strong_faux
Applying <em> and <strong> in their default states results in faux italic and faux bold.

The result is a faux italic and a faux bold. Why? Because the paragraph is set to Ubuntu Regular, with the weight and style set to normal. When the <em> element is applied, the text remains Ubuntu Regular but is slanted to look like it's italic. Notice the angular "e" and the double-story "a." When the <strong> element is applied, the text remains Ubuntu Regular but is stretched to look like it's bold. Notice the letter "e" is no longer monoline — the sides of the letter look thicker than the top and bottom of the letter.

We can fix this problem by making sure the <em> and <strong> elements use the correct font-family name. For example, the paragraph below continues to be styled like so:

  p {     font-family: 'UbuntuRegular', arial, sans-serif;     font-weight: normal;     font-style: normal;  }  

And the <em> and <strong> elements are styled to use the correct corresponding font-family names:

  em {     font-family: 'UbuntuRegularItalic', arial, sans-serif;     font-weight: normal;     font-style: normal;  }    strong {     font-family: 'UbuntuBold', arial, sans-serif;     font-weight: normal;     font-style: normal;  }  

Notice that the font-weight and font-style for both <em> and <strong> are set to normal. This is counterintuitive, but necessary so that the text doesn't end up with a double-italic or a double-bold.

5_unique_em_strong_fixed
Using the correct font-family names — and setting weights and styles to normal — results in true italic and true bold.

The result is a true italic and true bold. Why? Because while the paragraph is set to Ubuntu Regular, the <em> element is set to Ubuntu Italic and the <strong> element is set to Ubuntu Bold — and all weights and styles are set to normal.

Problem: If the Fallback Font Loads, Weights and Styles Will Be Lost

While purposely stripping out weights and styles is counterintuitive, using a unique font-family name and normal weights and styles does work — as long as the Web font loads.

If the fallback font loads, then all bolds and italics will be lost — because we had set all weights and styles to normal — thus making it harder for readers to see the structure of your website's content and making it harder for them to skim the text.

6_unique_fontfail
If the Web font doesn't load, then the fallback font (here, Times New Roman) will load with a normal weight and style — undermining hierarchy and readability. Remember, we had set all weights and styles to normal when we styled the elements!

The Short Version

Using unique font-family names combined with setting font-weight and font-style to normal is unforgiving. Mismatching weights and styles could easily result in either faux italic and faux bold or double-italic and double-bold. If the Web font doesn't load, then the result will be no italic or bold! So, this approach to setting weights and styles using the @font-face declaration isn't the best solution.

Style Linking

Another way to set weights and styles is to use the same font-family name multiple times, setting the weights and styles in each @font-face declaration to match the weight and style of the Web font file being accessed. This approach is called style linking.

For example, using style linking, the syntax for Ubuntu Italic and Ubuntu Bold would look like this:

  @font-face {     font-family: 'Ubuntu';        src: url('Ubuntu-RI-webfont.eot');        src: url('Ubuntu-RI-webfont.eot?#iefix') format('embedded-opentype'),             url('Ubuntu-RI-webfont.woff') format('woff'),             url('Ubuntu-RI-webfont.ttf') format('truetype'),             url('Ubuntu-RI-webfont.svg#UbuntuItalic') format('svg');     font-weight: 400;     font-style: italic;  }    @font-face {     font-family: 'Ubuntu';        src: url('Ubuntu-B-webfont.eot');        src: url('Ubuntu-B-webfont.eot?#iefix') format('embedded-opentype'),             url('Ubuntu-B-webfont.woff') format('woff'),             url('Ubuntu-B-webfont.ttf') format('truetype'),             url('Ubuntu-B-webfont.svg#UbuntuBold') format('svg');     font-weight: 700;     font-style: normal;  }  

Notice that the font-family names are the same, regardless of what Web font file is being accessed. For example, Ubuntu accesses Ubuntu-RI-webfont.woff, and Ubuntu also accesses Ubuntu-B-webfont.woff. How does that work?

Notice that the font-weight and font-style for each @font-face declaration is set to match the weight and style of the Web font file being accessed. The Ubuntu that accesses the italic Web font file has font-style: italic. The Ubuntu that accesses the bold Web font file has font-weight: 700.

In this method, the weights and styles in the @font-face declarations act as "markers." When a browser encounters those weights and styles elsewhere in the CSS, it knows which @font-family declaration to use and which Web font files to access.

Styling Text Using Style Linking

To style text with this method, use the same font family for all versions of the font. Set weights and styles to trigger the correct Web font files that the browser should access. If you want the italic version of the font, make sure to set font-style: italic. For example, the Regular, Regular Italic, Bold and Bold Italic headings below are set with classes. The classes are styled like so:

  .u400 {     font-family: 'Ubuntu', arial, sans-serif;     font-weight: 400;     font-style: normal;  }    .u400i {     font-family: 'Ubuntu', arial, sans-serif;     font-weight: 400;     font-style: italic;  }    .u700 {     font-family: 'Ubuntu', arial, sans-serif;     font-weight: 700;     font-style: normal;  }    .u700i {     font-family: 'Ubuntu', arial, sans-serif;     font-weight: 700;     font-style: italic;  }  

7_style-linking
Ubuntu Regular, Italic, Bold and Bold Italic on Windows 7 in Internet Explorer 8 (top) and on Mac OS X in Chrome 23 (bottom). Using style linking to set weight and style appears to work fine.

Again, Make Sure the Weights and Styles Match!

Because weight and style are used to "trigger" the correct @font-face declaration, setting weights and styles to match those used in the @font-face declarations is important. As a bonus, when default rules for weights and styles are applied by browsers — like italic for <em> and bold for <strong> — then the correct fonts will automatically load (as long as your font has a bold and italic version), because the default rules will also trigger the correct @font-face declaration.

8_style-linking_em_strong
When default rules for weights and styles are applied by browsers — like italic for <em> and bold for <strong> — then the correct fonts will automatically load (as long as your font has a bold and italic version). Again, using style linking to set weight and style appears to work fine.

Bonus: If the Fallback Font Loads, Weights and Styles Will Be Retained

Unlike the first approach, setting weights and styles with style linking means that weights and styles will be retained even when the Web font fails to load. Why? Because all weights and styles were set correctly (for example, not normal) when styling the text.

Note: If the Web font doesn't load, then the fallback font (here, Times New Roman) will still provide hierarchy — bolds and italics will remain intact. Remember, we set all weights and styles to match the Web fonts when we styled the elements!

But style linking has its own problems…

Problem: Internet Explorer 7 and 8 Can Only Apply Up to Four Weights and Styles to a Single Font-Family Name

Style linking works — as long as you're not using more than four weights and styles (and as long as the person reading your Web page isn't the one of the one in eight people who still use Internet Explorer (IE) 7 or 8). If you use more than four weights and styles on the website, then IE 7 and 8 will convert all light and medium weights to normal, and all black and heavy weights to bold — so, you'll lose some of your carefully set text.

10_style-linking_fail
IE 7 and 8 can't apply more than four weights and styles to a single font-family name. Ubuntu has eight weights and styles. If you used all eight with the font-family name Ubuntu, then the Light, Light Italic, Medium and Medium Italic would convert to Regular and Regular Italic.

Problem: Crashes Browsers on BlackBerry and iPad 1

No matter how well your fonts load, if the page crashes the browser, people won't be able to see your content! And as of this writing, Web pages that use style linking crash BlackBerry 9900 browsers on a regular basis. They also crash iPad 1 browsers 100% of the time.

The Short Version

Using style linking appears to be more forgiving. It greatly reduces the potential for setting text that is faux italic and faux bold, or double-italic and double-bold. In addition, if the Web font doesn't load, the text will retain both style and weight. But if you're using more than four weights and styles, then text won't render properly in IE 7 and 8. In addition, style linking crashes the browsers on BlackBerry and iPad 1 devices. So, this approach to setting weights and styles using the @font-face declaration isn't the best solution at this time (although the future — when IE 7 and 8, BlackBerry 9900 and iPad 1 are all defunct — looks bright!).

Unique Font-Family Names, Matching Weights And Styles

A third — and currently the most effective — way to set weights and styles is to merge the first two methods. If you've used FontDeck for Web fonts, then you'll be familiar with this approach.

Use the unique font-family names — which allows IE to show all of the weights and styles you need. Also, use matching weights and styles (for example, do not set weights and styles to normal), which will keep the weights and styles intact should the Web font fail.

For example, the syntax for Ubuntu Italic and Ubuntu Bold would like this:

  @font-face {     font-family: 'UbuntuItalic';        src: url('Ubuntu-RI-webfont.eot');        src: url('Ubuntu-RI-webfont.eot?#iefix') format('embedded-opentype'),             url('Ubuntu-RI-webfont.woff') format('woff'),             url('Ubuntu-RI-webfont.ttf') format('truetype'),             url('Ubuntu-RI-webfont.svg#UbuntuItalic') format('svg');     font-weight: 400;     font-style: italic;  }    @font-face {     font-family: 'UbuntuBold';        src: url('Ubuntu-B-webfont.eot');        src: url('Ubuntu-B-webfont.eot?#iefix') format('embedded-opentype'),             url('Ubuntu-B-webfont.woff') format('woff'),             url('Ubuntu-B-webfont.ttf') format('truetype'),             url('Ubuntu-B-webfont.svg#UbuntuBold') format('svg');     font-weight: 700;     font-style: normal;  }  

Notice that the font-family names are unique, with each font-family name accessing the appropriate Web font files. For example, UbuntuItalic accesses Ubuntu-RI-webfont.woff, while UbuntuBold accesses Ubuntu-B-webfont.woff.

Also, notice the weight and style: The font-weight and font-style for each @font-face declaration is set to match the weight and style of the Web font file being accessed. The UbuntuItalic that accesses the italic Web font file has font-style: italic. The UbuntuBold that accesses the bold Web font file has font-weight: 700.

Styling Text Using the Combined Method

To style text with this method, use the unique font-family names, and set weights and styles to match those used in the @font-face declarations. For example, the Light, Light Italic, Regular, Regular Italic, Medium, Medium Italic, Bold and Bold Italic headings below are set with classes. The classes are styled like so:

  .u300 {     font-family: 'UbuntuLight', arial, sans-serif;     font-weight: 300;     font-style: normal;  }    .u300i {     font-family: 'UbuntuLightItalic', arial, sans-serif;     font-weight: 300;     font-style: italic;  }    .u400 {     font-family: 'UbuntuRegular', arial, sans-serif;     font-weight: 400;     font-style: normal;  }    .u400i {     font-family: 'UbuntuRegularItalic', arial, sans-serif;     font-weight: 400;     font-style: italic;  }    .u700 {     font-family: 'UbuntuMedium', arial, sans-serif;     font-weight: 500;     font-style: normal;  }    .u700i {     font-family: 'UbuntuMediumItalic', arial, sans-serif;     font-weight: 500;     font-style: italic;  }    .u900 {     font-family: 'UbuntuBold', arial, sans-serif;     font-weight: 700;     font-style: normal;  }    .u900i {     font-family: 'UbuntuBoldItalic', arial, sans-serif;     font-weight: 700;     font-style: italic;  }  

11_unique_style-linking
By combining unique font-family names with matching weights and styles, all eight weights and styles of Ubuntu will work — even on Windows 7 in IE 8. And BlackBerry and iPad 1 browsers won't crash.

Again, Make Sure the Weights and Styles Match!

Although using unique font-family names means we no longer need the weights and styles to "trigger" the correct @font-face declaration, setting all weights and styles to match is important. Applying weights and styles to text elements will keep them intact in case the Web font fails. Also, because the weights and styles match, the text won't end up with either a double-bold or double-italic, or a faux bold or faux italic.

Problem: Using <em> and <strong> Elements

Using unique font-family names brings back an earlier problem: getting <em> and <strong> elements to work properly. Default styling on these elements will result in faux italic and faux bold text.

For example, the three paragraphs below are styled like so:

  p.light {     font-family: 'UbuntuLight', arial, sans-serif;     font-weight: 300;     font-style: normal;  }    p {     font-family: 'UbuntuRegular', arial, sans-serif;     font-weight: normal;     font-style: normal;  }    p.medium {     font-family: 'UbuntuMedium', arial, sans-serif;     font-weight: 500;     font-style: normal;  }  

And the <em> and <strong> elements are left in their default states:

  em {     font-style: italic;  }    strong {     font-weight: bold;  }  

12_unique_style-linking_EmStrong_default
Applying <em> and <strong> in their default states will result in faux italic and (usually) faux bold.

The result is a faux italic and a faux bold (when it's applied). Why? Because we're using unique font-family names. Let's look at the middle paragraph. It's set to Ubuntu Regular, with weight and style set to match (weight: normal and style: normal). When the <em> element is applied, the text remains Ubuntu Regular but is slanted to look like it's italic. When the <strong> element is applied, the text remains Ubuntu Regular but is stretched to look like it's bold.

We can fix the bold text by making sure the <strong> element uses the correct font-family name, weight and style:

  strong {     font-family: 'UbuntuBold', arial, sans-serif;     font-weight: 700;     font-style: normal;  }   

The <em> is a bit more difficult to fix. We can set it to Ubuntu Regular Italic and use the matching weight and style:

  em {     font-family: 'UbuntuRegularItalic', arial, sans-serif;     font-weight: 400;     font-style: italic;  }  

13_unique_style-linking_EmStrong_set
Setting <em> to UbuntuRegularItalic and <strong> to UbuntuBold will result in an italic that's too heavy for light text and too light for medium text.

The result is a bold and italic that are consistent throughout, regardless of the weight of the paragraph text. This may be fine for the <strong> element, but the <em> element looks a bit out of place on both the light and medium text.

The only way to fix this is to create a variety of classes for the <em> element, like so:

  em {     font-family: 'UbuntuRegularItalic', arial, sans-serif;     font-weight: 400;     font-style: italic;  }    em.light {     font-family: 'UbuntuLightItalic', arial, sans-serif;     font-weight: 300;     font-style: italic;  }    em.medium {     font-family: 'UbuntuMediumItalic', arial, sans-serif;     font-weight: 500;     font-style: italic;  }  

14_unique_style-linking_Em3Strong_set
Creating three versions of the <em> element (em, em.light, em.medium) will result in italics that "match" the weight of the text.

This will result in italics that match the weight of the text in each paragraph. This creates much better hierarchy, but it undermines the beauty of cascading style sheets and the simplicity of using a single <em> element.

Bonus: If the Fallback Font Loads, Weights and Styles Will Be Retained

Setting all weights and styles correctly (for example, not normal) when styling the text means that basic weights and styles will be retained even if the Web font doesn't load.

15_unique_style-linking_fontfail
If the Web font doesn't load, then the fallback font (here, Times New Roman) will still provide hierarchy — bolds and italics will remain intact. But because fallback fonts don't usually have "extra" weights (such as Light, Medium and Black), some weights will revert to Normal and Bold.

The Short Version

Using unique font-family names and setting weights and styles to match (for example, not setting them to normal) is the most effective method of getting weights and styles to work with the @font-face declaration. An extra step is required (i.e. setting and using unique font-family names — even with elements such as <em> and <strong>) to avoid faux italic and faux bold, but the solution does reduce the potential for double-italic and double-bold text. In addition, if the Web font doesn't load, then the text will retain both style and weight. Finally, text will render properly in IE 7 and 8 (even if you're using more than four weights and styles), and your pages won't crash the browsers on BlackBerry 9900 and iPad 1 devices.

Make Sure Your Weights And Styles Work

Weights and styles help visitors read the content on your website. So, make sure your weights and styles load correctly — whether for IE 8, Chrome, Mac OS X Firefox or an iPad and whether or not the Web font loads correctly (or visitors see a fallback font).

When choosing which method to use for your website, ask yourself two questions:

  1. Will I be using more than four weights and styles on the website?
  2. Are BlackBerry and iPad 1 users part of my target audience?

If the answer to both questions is "no," then go ahead and use style linking. It's elegant and forgiving.

If the answer to either question is "yes," then use the combined method. Currently, the only way to make sure your weights and styles work cross-browser is to use unique font-family names in conjunction with matching weights and styles (and, of course, to make sure your font has a bold and italic version). This might sound like a chore, requiring extra care and typing (UbuntuRegularItalic is longer to type than Ubuntu, after all), but as with most typographic details, the best results take time and effort. Even Typekit, which uses JavaScript to handle the intricacies of Web fonts, requires variation-specific font-family names to support older versions of IE.

Once IE 7 and 8, BlackBerry 9900 browsers and the iPad 1 are defunct, using style linking alone should be enough to get the job done. But as of 28 January 2013, StatCounter reports that IE 7 and 8 alone were used for 12.3% of the 45 billion page views collected from November 2012 to January 2013. Information on mobile browsers is not clear, but a minimum of 1 in 8 visitors still need us to go the extra mile. So, for now, we've got some extra typing to do.

Further Resources

(al)


© Laura Franz for Smashing Magazine, 2013.

When Google Got Flu Wrong
Feb 14th 2013, 15:13

ananyo writes "When influenza hit early and hard in the United States this year, it quietly claimed an unacknowledged victim: one of the cutting-edge techniques being used to monitor the outbreak. A comparison with traditional surveillance data showed that Google Flu Trends, which estimates prevalence from flu-related Internet searches, had drastically overestimated peak flu levels. The glitch is no more than a temporary setback for a promising strategy, experts say, and Google is sure to refine its algorithms. But with flu-tracking techniques based on mining of web data and on social media taking off, Nature looks at how these potentially cheaper, faster methods measure up against traditional epidemiological surveillance networks." Crowdsourcing is often useful, but it seems to have limits.

Share on Google+

Read more of this story at Slashdot.



Unscrambling an Android Telephone With FROST
Feb 14th 2013, 14:26

Noryungi writes "Researchers at the University of Erlangen demonstrate how to recover an Android phone's confidential content, with the help of a freezer and FROST, a specially-crafted Android ROM. Quite an interesting set of pictures, starting with wrapping your Android phone in a freezer bag."

Share on Google+

Read more of this story at Slashdot.



Create a Draggable 360 Preview with jQuery ThreeSixty
Feb 14th 2013, 07:01

Advertise here via BSA

ThreeSixty is a jQuery plugin for generating a draggable 360 preview from an image sequence. Simply include the latest jQuery and threesixty.js in your HTML page. Keyboard arrow keys are supported. It also supports touch and wipe on mobile devices as well. nextFrame() & prevFrame() methods allows users to connect UI controls.

threesixty

Requirements: jQuery Framework
Download Link: http://nick-jonas.github.com/threesixtyjs/
License: MIT License

Sponsors

Professional Web Icons for Your Websites and Applications

Magento. How to setup a Newsletter
Feb 13th 2013, 11:28

This tutorial is going to show you how to setup a Newsletter on your Magento store. First off, make sure that your newsletter is enabled on your site. From the Magento dashboard, you need to navigate to the System -> …

Joomla 2.5.x. How to install a new language and duplicate the menus in Gantry/K2 based template
Feb 1st 2013, 15:16

This tutorial is going to show you how to implement a multi-language site in Joomla 2.5 with K2 and Gantry.

WordPress. How to sort custom posts by custom field
Feb 1st 2013, 09:40

This tutorial is going to show you how to sort custom posts of your WordPress template by custom field.

Magento. Listing sub-categories on a category page
Jan 29th 2013, 16:29

This tutorial is going to show you one of the ways to list sub-categories on category pages of your Magento store.

Magento. How to change a Google web font
Dec 19th 2012, 16:24

This tutorial shows how to change a Google web font in Magento template.

JS Animated. How to change a Google web font
Dec 19th 2012, 15:56

This tutorial shows how to change a Google web font in JS Animated template.

Joomla. How to change a Google web font
Dec 19th 2012, 15:33

This tutorial shows how to change a Google web font in Joomla template.

Drupal. How to change a Google web font
Dec 19th 2012, 15:04

This tutorial shows how to change a Google web font in Drupal template.

VirtueMart. How to change a Google web font
Dec 19th 2012, 14:41

This tutorial shows how to change a Google web font in VirtueMart template.

WordPress. How to install Cherry framework template
Dec 19th 2012, 14:00

In this tutorial we will learn how to install Cherry Framework and the template on Wordpress.

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions