# Iconfont

- category: API
- chinese: iconfont
- type: API

---

## Design

This component provides a static method to define an icon font set. SVG icons is not supported by now.

**Notice:** This feature is experientmental and if font source is a remote ttf file, icons may not be rendered at the first time page showing. To avoid conflicts of network and icon render, we sugguest to use pictures instead , or pre-load font files (You can also integrate them into app source).

## API

### Iconfont

```js
Iconfont({
  name: 'your-unique-font-name',
  url: 'https://at.alicdn.com/t/font_1474198576_7440977.ttf'
});

// \u mode，code must be variable
const code = '\ue60f';
<Text style={{ fontSize: 40, fontFamily: 'your-unique-font-name' }}>{code}</Text>;

// or
<Text style={{ fontSize: 40, fontFamily: 'your-unique-font-name' }}>&#xe600;</Text>;
```

#### options

- options.name : iconfont name, for example 'your-unique-font-name'
- options.url : iconfont path, currently support `ttf` and `woff`

### formatUnicode

```js
const { formatUnicode } = Iconfont;
formatUnicode('&#xe600;'); // \ue600
```

Transform icon html code into unicode to fit both weex and web
