Edit this page

Hybrid Font Icons

Important

The current Windows Phone 8 versions do not support web fonts loaded from a local CSS file when used in PhoneGap or HTML5 applications. Unfortunately, there are no known workarounds yet. Use the images for icons when targeting WP8 applications.

The Kendo UI Hybrid framework includes 38 integrated font icons, which can be used directly in a Kendo UI project intended to run on mobile devices by specifying a data-icon attribute with any of the icon names listed below, which are supported by all Button widgets and ListView items.

List of Basic Hybrid Font Icons

  • about
  • action
  • add
  • bookmarks
  • camera
  • cart
  • compose
  • contacts
  • delete
  • details
  • downloads
  • fastforward
  • favorites
  • featured
  • globe
  • history
  • home
  • info
  • more
  • mostrecent
  • mostviewed
  • organize
  • pause
  • play
  • phone
  • recents
  • refresh
  • reply
  • rewind
  • search
  • settings
  • share
  • sounds
  • stop
  • toprated
  • trash
  • volume
  • wifi

In addition to these icons, there are more icons available inside the font file distributed with the Kendo UI Hybrid framework. For a full list of them, check this section of the article.

Custom Font Icons

Create Custom Font Icons

Currently, to create custom font icons you have two options:

  • To use a font generator service, such as Fontello, to simplify the task, or
  • To manually prepare the icon, SVG, and fonts.

Use Font Generator Service

Using Fontello is pretty straightforward—pick the icons, choose the Unicode characters for them, type a font name, and click Download to get a .zip file with the needed for mobile TTF and WOFF font formats, which can be directly used for icons. From the other files in there, EOT is not needed as it targets only Internet Explorer 6 to 8 versions and the SVG font can be used to further the modification.

Create Icons Manually

The manual approach is considerably more difficult. First, create the desired icons using a vector editing software such as Inkscape or Adobe Illustrator. Export them to the SVG format. Consult these articles about SVG font creation using Inkscape. Import the SVG icons in Inkscape and create the SVG font icon by icon, assigning them to separate characters. After creating the SVG font, convert it to TTF/WOFF formats, using the Online Font Converter or other similar service.

The example below demonstrates how to load the two fonts (TTF/WOFF) with @font-face.

Example
<style>
    @font-face {
        font-family: "MyCustomFont";
        src: url("images/MyCustomFont.woff") format("woff"),
             url("images/MyCustomFont.ttf") format("truetype");
    }
</style>

The example below demonstrates how to override the Kendo UI font for all icons. Note that, alternatively, separate classes can be used to override them one by one.

Example
<style>
    .km-icon:after,
    .km-icon:before
    {
        font: 1em/1em "MyCustomFont";
    }
</style>

<div data-role="tabstrip">
    <a href="#index" data-icon="favorites">Home</a>
</div>

The example below demonstrates how to specify the character corresponding to every custom icon.

Example
<style>
    .km-mycustomicon:after,
    .km-mycustomicon:before
    {
        content: "\E03a";
    }
</style>

<div data-role="tabstrip">
    <a href="#index" data-icon="mycustomicon">Home</a>
</div>

In the example, mycustomicon is the icon name set in the data-icon attribute and \E03a is the Unicode character code of the icon.

Serving Font Files

As of Kendo UI Q3 2012, the hybrid framework employs an icon font for its icon rendering. To be able to render it in most of the supported mobile and desktop browsers, two font formats included in the Kendo UI distribution exist—TTF and WOFF. Most web servers do not support serving these fonts with a specific mime type. Since currently there is no standardized mime type for fonts, you only need to serve them both with mime type application/octet-stream or you can come up with any valid mime type such as application/x-font-ttf and application/x-font-woff, for example.

Configure IIS

The two mime types can be specified either through the IIS management console (inetmgr) or in the site Web.config.

The example below demonstrates how to configure IIS Web.config.

Example
<?xml version="1.0"?>
<configuration>
    ...
    <system.webServer>
        ...
        <staticContent>
            <remove fileExtension=".ttf" />
            <mimeMap fileExtension=".ttf" mimeType="application/octet-stream" />
            <remove fileExtension=".woff" />
            <mimeMap fileExtension=".woff" mimeType="application/octet-stream" />
        </staticContent>
    </system.webServer>
</configuration>

Removing the mime type first avoids clashes if the mime types for these files are already defined. Note that IIS throws exception if they are. These can be removed if not needed.

Configure Apache

Apache configuration in some distributions includes mime-types application/x-font-ttf and application/x-font-woff by default. If these mime types are not listed, they can be added easily.

Configure in .htaccess

The example below demonstrates how to configure Apache in .htaccess.

Example
AddType application/x-font-ttf .ttf
AddType application/x-font-woff .woff

Configure the mime.types File

The example below demonstrates how to configure the Apache mime.types file.

Example
application/x-font-ttf .ttf
application/x-font-woff .woff

Configure Nginx

For Nginx the configuration is similar.

Configure the mime.types File

The example below demonstrates how to configure the Nginx mime.types file.

application/x-font-ttf .ttf
application/x-font-woff .woff

Configuration of CORS Headers

Handle CORS Headers

Since fonts are usually copyrighted, most browsers do not allow using them across different domains. If serving multiple domains from one font location is needed, the fonts should be served with an Access-Control-Allow-Origin header. This header also supports using * instead of the domain name list, and while using it for normal text fonts is not advisable, it can be freely used for our icon font if the icons are living in a Kendo UI hybrid application.

Configure IIS

The example demonstrates how to configure IIS by placing a web.config in the font folder and adding the code below to it.

Example
<httpProtocol>
  <customHeaders>
    <add name="Access-Control-Allow-Origin" value="*" />
  </customHeaders>
</httpProtocol>

Configure Apache

The example demonstrates how to configure Apache.

Example
<FilesMatch "\.(ttf|woff)$">
<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>

Configure Nginx

The example demonstrates how to configure Nginx.

Example
location / {
    ...
    if ($filename ~* \.(ttf|woff)$){
        add_header Access-Control-Allow-Origin *;
    }
}

Usage of Custom Icons

Custom Icons with Background-Image

To use any image for an icon in the Kendo UI hybrid framework, raise the specificity of the background-image style to at least 40 to override the defaults. Use background-size to resize the image accordingly.

The example below demonstrates how to define custom background-image icon.

Example
<style>
    .km-root .km-pane .km-view .km-custom
    {
        background-image: url("custom.jpg");
        -webkit-background-clip: border-box;
    }
</style>

<div data-role="tabstrip">
    <a href="#index" data-icon="custom">Home</a>
</div>

Custom Icons with WebKit Masks

To use colorizable icon masks, specify the icon image as a box mask—either as dataURI or as a separate image. The image should be PNG8 or PNG24 with alpha channel. Note that PNG8+Alpha is supported only by few graphic editors, so you'd better stick to PNG24 if not sure. The image color is not important—it is going to be used as a mask only—the alpha transparency clips the colorized content.

Important

  • WebKit masks have numerous bugs across most platforms, so consider using them only if necessary.
  • In Android and MeeGo WebKit masks are unreliable—they can be turned into colorized rectangles by a simple CSS transformation in the wrong place. In BBOS 7.0 WebKit masks are completely broken—though they work in BBOS 6.0 and 7.1.

Define Custom WebKit Mask for Icons

The example below demonstrates how to define a custom WebKit mask for an icon.

Example
<style>
    .km-custom {
        -webkit-mask-box-image: url("foo.png");
    }
</style>

<div data-role="tabstrip">
    <a href="#index" data-icon="custom">Home</a>
</div>

Custom WebKit Masks after Kendo UI Q3 2012

Important

WebKit masks are now deprecated for Android mobile applications, where background: url() should be used instead. WebKit masks can still be used in iOS applications.

In Kendo UIQ3 2012 WebKit mask icons were deprecated due to numerous issues with them and the Kendo UI hybrid framework introduced font icons. This change requires the usage of additional styling to enable the WebKit masks as icons.

This example demonstrates how to define custom icon after Kendo UI Q3 2012. Note that the the code from below is going to disable all font icons.

Example
<style>
    .km-root .km-pane .km-view .km-icon {
        background-size: 100% 100%;
        -webkit-background-clip: border-box;
        background-color: currentcolor;
    }

    .km-custom {
        -webkit-mask-box-image: url("foo.png");
        background-color: red;
    }
</style>

<div data-role="tabstrip">
    <a href="#index" data-icon="custom">Home</a>
</div>

Restyle Only Custom Icons

If you want to add only one or two custom icons, specify them with their respective classes—.km- + data-icon name. The example below demonstrates how to restyle only the custom icons.

Example
<style>
    .km-root .km-pane .km-view .km-question {
        background-size: 100% 100%;
        -webkit-background-clip: border-box;
        background-color: currentcolor;
    }

    .km-question {
        -webkit-mask-box-image: url("foo.png");
        background-color: red;
    }
</style>

<div data-role="tabstrip">
    <a href="#index" data-icon="question">Home</a>
</div>

Hide All Hybrid Font Icons

When custom icons are used and their names are the same as the integrated Kendo UI hybrid icon names, make sure that the font icons are not rendered. The example below demonstrates how to hide all Kendo UI hybrid font icons.

Example
<style>
    .km-root .km-pane .km-view .km-icon:after,
    .km-root .km-pane .km-view .km-icon:before
    {
        visibility: hidden;
    }
</style>

<div data-role="tabstrip">
    <a href="#index" data-icon="custom">Home</a>
</div>

Hide Specific Hybrid Font Icons

Again, if only several icons should be overridden, specify them with their classes instead. The example below demonstrates how to hide only one Kendo UI hybrid font icon.

Example
<style>
    .km-root .km-pane .km-view .km-favorites:after,
    .km-root .km-pane .km-view .km-favorites:before
    {
        visibility: hidden;
    }
</style>

<div data-role="tabstrip">
    <a href="#index" data-icon="favorites">Home</a>
</div>

Custom Icons on Windows Phone 8

Windows Phone 8.0 has some severe issues that may affect your icons usage. First of all, masks are not supported in any way—Firefox allows SVG mask usage, WebKit/Blink have image masks, although broken in Android. If you plan to have only a web application that runs in the browser, you can go for font icons as they look better across different resolutions and can be colorized. The default Kendo UI hybrid icons work as any icon font such as Font Awesome. Learn more about using font icons and Font Awesome from this blog post.

However, if you plan to create a hybrid application with PhoneGap or HTML5 template in WP8 SDK, font icons do not work there—the WebView does not load them at all. Kendo UI provides image replacements for its default icons, but if you want custom ones, you are left out with only normal images/backgrounds and you need to provide one for normal and another one for the selected state, if they differ. You should also think about the dark and light background themes in WP8, as the Kendo UI hybrid framework automatically supports them in Cordova.

The example below demonstrates how the WP8 application icon backgrounds are defined in the Kendo UI hybrid framework.

Example
<style>
    .km-on-wp.km-app .km-icon:after,
    .km-on-wp.km-app .km-filter-wrap:before,
    .km-on-wp.km-app .km-state-active .km-icon:after
    {
        background-image: url("images/wp8_icons.png");
    }
    .km-wp-light.km-app .km-icon:after,
    .km-wp-light.km-app .km-filter-wrap:before
    {
        background-image: url("images/wp8_inverseicons.png");
    }
    .km-on-wp.km-app .km-action:after
    {
        background-position-x: 20%;
    }
    .km-on-wp.km-app .km-add:after
    {
        background-position-x: 22%;
    }
</style>

The sprite is laid out horizontally and background-size and background-position-x are used to specify the icon offsets. This is done to allow the icon to be resized with its container size. You do not need your icons to have circles around them, as they are defined in CSS just for the TabStrip.

List of Additional Hybrid Font Icons

The icon font shipped with the Kendo UI hybrid distribution contains much more icons than the 34 defined ones—about ten times more than that. The reason for this is that the framework aims at keeping its CSS small. To use them, choose an icon from the list below and add a definition for it in your CSS using its Unicode character code. Make sure you have a km- prefix.

Example
<style>
    .km-arrow-e:after,
    .km-arrow-e:before
    {
        content: "\e000";
    }
</style>

<div data-role="tabstrip">
    <a href="#index" data-icon="arrow-e">Home</a>
</div>

Now you are able to specify it as a data-icon="arrow-e" in your application.

Keep in mind that icons with Unicode codes from \e0ca to \e0f0 are the original Kendo UI hybrid icons listed at the beginning of this article. Also, the ones starting from \e200 are already defined and in use, but only in the iOS7 platform theme and are available as of Kendo UI Q2 2013 SP.

  • \e000
  • \e001
  • \e002
  • \e003
  • \e004
  • \e005
  • \e006
  • \e007
  • \e008
  • \e009
  • \e00a
  • \e00b
  • \e00c
  • \e00d
  • \e00e
  • \e00f
  • \e010
  • \e011
  • \e012
  • \e013
  • \e014
  • \e015
  • \e016
  • \e017
  • \e018
  • \e019
  • \e01a
  • \e01b
  • \e01c
  • \e01d
  • \e01e
  • \e01f
  • \e020
  • \e021
  • \e022
  • \e023
  • \e024
  • \e025
  • \e026
  • \e027
  • \e028
  • \e029
  • \e02a
  • \e02b
  • \e02c
  • \e02d
  • \e02e
  • \e02f
  • \e030
  • \e031
  • \e032
  • \e033
  • \e034
  • \e035
  • \e036
  • \e037
  • \e038
  • \e039
  • \e03a
  • \e03b
  • \e03c
  • \e03d
  • \e03e
  • \e03f
  • \e040
  • \e041
  • \e042
  • \e043
  • \e044
  • \e045
  • \e046
  • \e047
  • \e048
  • \e049
  • \e04a
  • \e04b
  • \e04c
  • \e04d
  • \e04e
  • \e04f
  • \e050
  • \e051
  • \e057
  • \e058
  • \e059
  • \e05a
  • \e05b
  • \e05c
  • \e05d
  • \e05e
  • \e05f
  • \e060
  • \e061
  • \e062
  • \e063
  • \e064
  • \e065
  • \e066
  • \e067
  • \e068
  • \e069
  • \e06a
  • \e06b
  • \e06c
  • \e06d
  • \e06e
  • \e06f
  • \e070
  • \e071
  • \e072
  • \e073
  • \e074
  • \e075
  • \e076
  • \e077
  • \e078
  • \e079
  • \e07a
  • \e07b
  • \e07c
  • \e07d
  • \e07e
  • \e07f
  • \e080
  • \e081
  • \e082
  • \e083
  • \e084
  • \e085
  • \e086
  • \e087
  • \e088
  • \e089
  • \e08a
  • \e08b
  • \e08c
  • \e08d
  • \e08e
  • \e08f
  • \e090
  • \e091
  • \e092
  • \e093
  • \e094
  • \e095
  • \e096
  • \e097
  • \e098
  • \e099
  • \e09a
  • \e09b
  • \e09c
  • \e09d
  • \e09e
  • \e09f
  • \e0a0
  • \e0a1
  • \e0a2
  • \e0a3
  • \e0a4
  • \e0a5
  • \e0a6
  • \e0a7
  • \e0a8
  • \e0a9
  • \e0aa
  • \e0ab
  • \e0ac
  • \e0ad
  • \e0ae
  • \e0af
  • \e0b0
  • \e0b1
  • \e0b2
  • \e0b3
  • \e0b4
  • \e0b5
  • \e0b6
  • \e0b7
  • \e0b8
  • \e0b9
  • \e0ba
  • \e0bb
  • \e0bc
  • \e0bd
  • \e0be
  • \e0bf
  • \e0c0
  • \e0c1
  • \e0c2
  • \e0c3
  • \e0c4
  • \e0c5
  • \e0c6
  • \e0c7
  • \e0c8
  • \e0c9
  • \e0ca
  • \e0cb
  • \e0cc
  • \e0cd
  • \e0ce
  • \e0cf
  • \e0d0
  • \e0d1
  • \e0d2
  • \e0d3
  • \e0d4
  • \e0d5
  • \e0d6
  • \e0d7
  • \e0d8
  • \e0d9
  • \e0da
  • \e0db
  • \e0dc
  • \e0dd
  • \e0de
  • \e0df
  • \e0e0
  • \e0e1
  • \e0e2
  • \e0e3
  • \e0e4
  • \e0e5
  • \e0e6
  • \e0e7
  • \e0e8
  • \e0e9
  • \e0ea
  • \e0eb
  • \e0ec
  • \e0ed
  • \e0ee
  • \e0ef
  • \e0f0
  • \e0f1
  • \e0f2
  • \e0f3
  • \e0f4
  • \e0f5
  • \e0f6
  • \e0f7
  • \e0f8
  • \e0f9
  • \e0fa
  • \e0fb
  • \e0fc
  • \e0fd
  • \e0fe
  • \e0ff
  • \e100
  • \e101
  • \e102
  • \e103
  • \e104
  • \e200
  • \e203
  • \e204
  • \e205
  • \e206
  • \e207
  • \e209
  • \e20a
  • \e20b
  • \e20c
  • \e20d
  • \e20e
  • \e20f
  • \e212
  • \e213
  • \e214
  • \e215
  • \e216
  • \e217
  • \e218
  • \e219
  • \e21a
  • \e21b
  • \e21c
  • \e21d
  • \e21e
  • \e21f
  • \e220
  • \e221
  • \e222
  • \e223
  • \e224
  • \e225
  • \e226
  • \e300
  • \e303
  • \e304
  • \e305
  • \e306
  • \e307
  • \e309
  • \e30a
  • \e30b
  • \e30c
  • \e30d
  • \e30e
  • \e30f
  • \e312
  • \e313
  • \e314
  • \e315
  • \e316
  • \e317
  • \e318
  • \e319
  • \e31a
  • \e31b
  • \e31c
  • \e31d
  • \e31e
  • \e31f
  • \e320
  • \e321
  • \e322
  • \e323
  • \e324
  • \e325
  • \e326

See Also

Other articles related to the appearance and styling of Kendo UI hybrid distribution:

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy