Showing posts tagged design

Using Web Fonts In Your ASP.NET MVC Application

image

Typography in Web Design

For many hardcore developers, the design of a web application may be no more than an afterthought. Unless they have the luxury of working with a designer, or they themselves have a keen sense for design, the developer can easily overlook the need or importance of typography and focus on only the basic visual or graphical design elements that go into building a web application.

This may be why HTML/CSS Frameworks like Twitter Bootstrap, HTML5 Boilerplate and 52 Framework are becoming more and more popular today. These frameworks can provide a quick and easy way to build nice looking web applications without spending much time on the design process. But even beyond making a website or application visually appealing, typography is most likely the last thing many developers think about. 

Typography can be a great way to enhance the visual appearance of your application and improve the overall user experience. Selecting the appropriate font types, weights and stylings can help convey ideas, importance and emotion to the user. It can also improve the readability and comprehension of your content and greatly enhance usability and the overall quality of your design.

Choosing and Using Fonts

The challenge with selecting fonts for the web is knowing how they’ll actually render for the user. For the fonts to render as intended by the designer, the browser must have access to the dependent font files which may or may not be available depending on the operating system in which the browser is running. 

For many years, web designers focused on using only the fonts which were likely to be present on a wide range of computers. Those considered ‘web-safe’ were: 

  • Arial
  • Courier New
  • Helvetica
  • Times New Roman
  • Trebuchet
  • Georgia
  • Verdana

This short list offered little variety to the designer. Work arounds for this limitation included using images of text or embedded replacement techniques which required a browser plug-in (can you say Flash?). The problem with both of these methods was that the text in this form was not semantic, selectable or searchable.

Enter Web Fonts

One solution to this limitation was the development of web fonts, which could be available on any platform and served from an http request. In addition to having accessibility to a much wider range of typefaces, web fonts are also semantic, selectable, searchable and translatable into other languages.  And because most all of today’s browsers support the use of web fonts, they can be reliably rendered on most any platform.

Integrating Web Fonts in Your ASP.NET MVC Web Application

So, how can you use web fonts in your ASP.NET MVC application? Here’s a simple, step-by-step procedure for adding web fonts to a generic ASP.NET MVC Internet application.

1) Choose a font service. There’s a growing list of web font services and providers which offer a wide array of free and paid for services. A few of the more popular services, in no particular order, would be:

I have a subscription to Typekit which I use for all of my web projects. For the purposes of this demonstration I’ll be using Typekit, but know that most all other font services work basically the same way.

2) Select the desired font. Typekit has a large library of available fonts and a rich user interface which allows you to see how the font will render. You can easily browse the font families by properties, classification or recommended use. For this demonstration, I’ve selected Bistro Script Web.

image

3) Generate your JavaScipt code provided by your font service:

image

 4) Copy the JavaScript snippet into the <head> tag of your view engine’s _Layout.cshtml (Razor) or Site.Master (ASPX) file.

image

5) Generate your css selectors for the desired font families:

image

6) Add the css code into the Site.css file. For this example, I’ll change the font-family for the entire application by adding my “bistro-script-web” font to the css selector for the body tag:

image

NOTE: The generic ‘cursive’ font is set as a fallback font in the unlikelihood the primary font is unable to render correctly. 

And that’s all there is to it. Now, instead of the default font-family: ”Segoe UI” which renders the page like this:

image

You can see the web application now uses the Typekit “Bistro Script Web” font which renders like this:

image

Now of course in the real world, I’d never recommend using a script font like this for an entire application. The point of this exercise is to easily show the difference between how the default font and web font render in a browser and to demonstrate how easy it is to implement web fonts into your projects.

Conclusion

The availability of web fonts opens up a wide range of possibilities for web designers and developers to use typography to enhance their web designs and to clearly deliver content and improve usability. As I hope you can see from this simple demonstration, implementing web fonts in an ASP.NET MVC web application is quick and easy. 

Update: This article has been translated toSerbo-Croatian by Anja Skrba from Webhostinggeeks.com

Windows 8 Developer Camp

Today, I had the opportunity to attend the Windows 8 Developer Camp in preparation for tomorrow’s CodeStock 2012 kickoff in Knoxville, TN. The event was sponsored by Microsoft and presented by Jennifer Marsman, Principal Developer Evangelist with Microsoft. The all-day session was packed full of both lecture and hands-on lab work and was a great introduction to developing applications on the Windows 8 platform.

Introducing Metro

The most interesting and informative aspect of the session for me was the heavy emphasis on the ‘Touch First’ approach used by Windows 8 to better optimize applications across a wide variety of form factors such as slates, tablets, laptops and desktops. The ‘Metro’ design language is at the core of this approach. 

Metro is intended to provide an instinctive and natural user experience. It employs touch, navigation, branding and commanding design patterns. A great resource for for designing Metro applications with detailed design and UX guidelines, including Photoshop templates can be found at http://design.windows.com

Metro Design Principals

  • Content should always comes first (content before chrome)
  • Immerse your users in the content
  • Keep the most relevant elements on screen and minimize distractions

Layout

  • Give content breathing room
  • Create intentional white space
  • Remove lines and boxes for organizing groups of content
  • Use typography to create sense of structure and hierarchy
  • Fixed font sizes and weights will convey feeling and importance
  • Let content flow from edge to edge
  • Pan only on single axis to create stability
  • Don’t forget ergonomics using portrait or horizontal appropriately

Interaction

  • Integrate commands into the content
  • Leverage the edge (left, right, top and bottom)
  • Provide commands contextually using the App bar and Charms bar

Navigation

  • Views should be about where you are, not where you could be
  • Integrate navigational elements into the content
  • Hierarchical or Flat navigational patterns
  • Make heavy but appropriate use of semantic zoom

Fast and Fluid

  • Continuity through motion
  • Use motion and animation to tell the story
  • Built in controls exist in Visual Studio templates

Design for Touch First

  • Keep hands and fingers in mind
  • Controls should be where users can easily use them
  • Provide visual feedback
  • Take advantage of sliding interactions
  • Pan 1-axis only

Snap and Scale Beautifully

  • Design for multiple views or layouts (a snap view is required)
  • Snapping is built into Windows 8 scenario
  • A great snapped view keeps your app on the screen
  • Design a purposeful snapped state which maintains state 
  • Design for wide range of screen sizes and resolutions
  • Use fluid layouts to optimize real estate
  • Scale to fit fixed layouts
  • Use SVG or provide 3 asset sizes (100%, 140% and 180%)

Use the Right Contracts

  • Leverage other apps to complete scenarios
  • Charms provide consistent invocation model
  • Share as source and/or target
  • Leverage search to your content from anywhere in Windows
  • Place all application settings under one roof
  • Keep it simple, minimize number of settings

Invest in a Great Tile

  • Tiles are the front door to your application
  • Use secondary tiles to promote interesting content
  • Provide Pin command when content is pinnable

Connected and Alive

  • Live tiles draw users to your app
  • Cycle through last 5 updates
  • Toast notifications deliver transient messages outside app context
  • Use for time sensitive information
  • Use only where needed

Roam to The Cloud

  • Maintains state and preferences across machines
  • Preferences maintained in users account
  • Users can continue tasks across devices by roaming app data
  • Roaming is best for user preferences, links and small data files

Overall, a great session and great presenter. I learned a lot about developing for the Windows 8 platform and am now excited to jump in with both feet. The Windows 8 Developer Camp was well worth the extra day spent in Knoxville and a great warm-up for CodeStock 2012.

Test Your Responsive Web Design With The Responsinator

Web analytics and usage statistics continue to show the meteoric rise in the use of mobile devices on the web, creating the need to develop websites that dynamically respond and adapt to a widening number of display sizes across an array of mobile devices. 

One of the biggest challenges when coding the responsive design is knowing how it will look across multiple devices and viewports. A few months back, I came across a handy tool which can help both the designer and developer effectively create a responsive website.

The Responsinator is a simple, easy to use web tool which can help you optimize your responsive design and visualize how your site responds on a variety of today’s most popular mobile devices. This tool works great for testing the breakpoints of your media queries and seeing how font and image resizing or fluid grid and layout changes will look on devices displayed in both portrait and landscape modes. You can also evaluate your fixed width sites by simply adding &fixed_width=x to the end of the URL where x is the fixed width of your site.

I’ve used this on a few projects now and it’s proven to be incredibly helpful for evaluating my design and testing my code. And even though it’s proved to be a valuable tool to have in your toolbox, nothing can compare to the real thing. The Responsinator will closely approximate how your site will look on a mobile device, but of course the most accurate testing will always be on the device itself.

Are you working on a responsive web project? Try it out for yourself at: responsinator.com.