Browse Source

Clean up

- removed unused files
- added license
- added readme stub
shared-context
Mikko Mononen 8 years ago
parent
commit
4d1ef0cace
9 changed files with 23 additions and 759 deletions
  1. +18
    -0
      LICENSE.txt
  2. +5
    -128
      README.md
  3. BIN
      example/FiraSans-Bold.ttf
  4. BIN
      example/FiraSans-Light.ttf
  5. BIN
      example/FiraSans-Regular.ttf
  6. +0
    -116
      example/glstash.h
  7. +0
    -431
      example/icons.txt
  8. BIN
      example/mfglabsiconset-webfont.ttf
  9. +0
    -84
      example/templates.xml

+ 18
- 0
LICENSE.txt View File

@@ -0,0 +1,18 @@
Copyright (c) 2013 Mikko Mononen memon@inside.org
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

+ 5
- 128
README.md View File

@@ -1,138 +1,15 @@
Font Stash
==========

Font stash is light-weight online font texture atlas builder written in C. It uses [stb_truetype](http://nothings.org) to render fonts on demand to a texture atlas.

The code is split in two parts, the font atlas and glyph quad generator [fontstash.h](/src/fontstash.h), and an example OpenGL backend ([glstash.h](/glstash.h).

## Screenshot

![screenshot of some text rendered witht the sample program](/screenshots/screen-01.png?raw=true)

## Example
``` C
// Create stash for 512x512 texture, our coordinate system has zero at top-left.
struct FONSparams params;
memset(&params, 0, sizeof(params));
params.width = 512;
params.height = 512;
params.flags = FONS_ZERO_TOPLEFT;
glstInit(&params);
struct FONScontext* fs = fonsCreate(&params);

// Add font to stash.
int fontNormal = fonsAddFont(fs, "DroidSerif-Regular.ttf");

// Render some text
float dx = 10, dy = 10;
unsigned int white = glstRGBA(255,255,255,255);
unsigned int brown = glstRGBA(192,128,0,128);

struct fontstash_style styleBig = { FONT_NORMAL, 124.0f, white };

fonsSetFont(fs, fontNormal);
fonsSetSize(fs, 124.0f);
fonsSetColor(fs, white);
fonsDrawText(fs, dx,dy,"The big ", &dx);

fonsSetSize(fs, 24.0f);
fonsSetColor(fs, brown);
fonsDrawText(fs, dx,dy,"brown fox", &dx);
```

## Using Font Stash in your project

In order to use fontstash in your own project, just copy fontstash.h, stb_truetype.h, and potentially glstash.h to your project.
In one C/C++ define FONTSTASH_IMPLEMENTATION before including the library to expand the font stash implementation in that file.

``` C
#include <stdio.h> // malloc, free, fopen, fclose, ftell, fseek, fread
#include <string.h> // memset
#define FONTSTASH_IMPLEMENTATION // Expands implementation
#include "fontstash.h"
```
/work in progress.../

``` C
#include <GLFW/glfw3.h> // Or any other GL header of your choice.
#define GLSTASH_IMPLEMENTATION // Expands implementation
#include "glstash.h"
```

## Creating new rendering backend

The default rendering backend uses OpenGL to render the glyphs. If you want to render the text using some other API, or want tighter integration with your code base you can write your own rendering backend. Take a look at the [glstash.h](/src/glstash.h) for reference implementation.

The rendering interface FontStash assumes access to is defined in the FONSparams structure. The call to `glstInit()` fills in variables.

```C
struct FONSparams {
...
void* userPtr;
int (*renderCreate)(void* uptr, int width, int height);
void (*renderUpdate)(void* uptr, int* rect, const unsigned char* data);
void (*renderDraw)(void* uptr, const float* verts, const float* tcoords, const unsigned int* colors, int nverts);
void (*renderDelete)(void* uptr);
};
```

- **renderCreate** is called to create renderer for specific API, this is where you should create a texture of given size.
- return 1 of success, or 0 on failure.
- **renderUpdate** is called to update texture data
- _rect_ describes the region of the texture that has changed
- _data_ pointer to full texture data
- **renderDraw** is called when the font triangles should be drawn
- _verts_ pointer to vertex position data, 2 floats per vertex
- _tcoords_ pointer to texture coordinate data, 2 floats per vertex
- _colors_ pointer to color data, 1 uint per vertex (or 4 bytes)
- _nverts_ is the number of vertices to draw
- **renderDelete** is called when the renderer should be deleted
- **userPtr** is passed to all calls as first parameter

FontStash uses this API as follows:

```
fonsDrawText() {
foreach (glyph in input string) {
if (internal buffer full) {
updateTexture()
render()
}
add glyph to interal draw buffer
}
updateTexture()
render()
}
```

The size of the internal buffer is defined using `FONS_VERTEX_COUNT` define. The default value is 1024, you can override it when you include fontstash.h and specify the implementation:

``` C
#define FONS_VERTEX_COUNT 2048
#define FONTSTASH_IMPLEMENTATION // Expands implementation
#include "fontstash.h"
```

## Compiling

In order to compile the demo project, your will need to install [GLFW](http://www.glfw.org/) to compile.

FontStash example project uses [premake4](http://industriousone.com/premake) to build platform specific projects, now is good time to install it if you don't have it already. To build the example, navigate into the root folder in your favorite terminal, then:

- *OS X*: `premake4 xcode4`
- *Windows*: `premake4 vs2010`
- *Linux*: `premake4 gmake`
NanoVG
==========

See premake4 documentation for full list of supported build file types. The projects will be created in `build` folder. An example of building and running the example on OS X:
NanoVG is small vector graphics rendering library for OpenGL aimed for UI coding.

```bash
$ premake4 gmake
$ cd build/
$ make
$ ./example
```

# License
The library is licensed under [zlib license](LICENSE.txt)

## Links
Uses [stb_truetype](http://nothings.org) for font rendering.
Uses [stb_image](http://nothings.org) for image loading.

BIN
example/FiraSans-Bold.ttf View File


BIN
example/FiraSans-Light.ttf View File


BIN
example/FiraSans-Regular.ttf View File


+ 0
- 116
example/glstash.h View File

@@ -1,116 +0,0 @@
//
// Copyright (c) 2009-2013 Mikko Mononen memon@inside.org
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
//
#ifndef GLSTASH_H
#define GLSTASH_H

int glstInit(struct FONSparams* params);
unsigned int glstRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);

#endif

#ifdef GLSTASH_IMPLEMENTATION

struct GLSTcontext {
GLuint tex;
int width, height;
};

static int glst__renderCreate(void* userPtr, int width, int height)
{
struct GLSTcontext* gl = (struct GLSTcontext*)userPtr;
glGenTextures(1, &gl->tex);
if (!gl->tex) return 0;
gl->width = width;
gl->height = width;
glBindTexture(GL_TEXTURE_2D, gl->tex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, gl->width, gl->height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
return 1;
}

static void glst__renderUpdate(void* userPtr, int* rect, const unsigned char* data)
{
struct GLSTcontext* gl = (struct GLSTcontext*)userPtr;
if (gl->tex == 0) return;
int w = rect[2] - rect[0];
int h = rect[3] - rect[1];
glBindTexture(GL_TEXTURE_2D, gl->tex);
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
glPixelStorei(GL_UNPACK_ROW_LENGTH, gl->width);
glPixelStorei(GL_UNPACK_SKIP_PIXELS, rect[0]);
glPixelStorei(GL_UNPACK_SKIP_ROWS, rect[1]);
glTexSubImage2D(GL_TEXTURE_2D, 0, rect[0], rect[1], w, h, GL_ALPHA,GL_UNSIGNED_BYTE, data);
}

static void glst__renderDraw(void* userPtr, const float* verts, const float* tcoords, const unsigned int* colors, int nverts)
{
struct GLSTcontext* gl = (struct GLSTcontext*)userPtr;
if (gl->tex == 0) return;
glBindTexture(GL_TEXTURE_2D, gl->tex);
glEnable(GL_TEXTURE_2D);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);

glVertexPointer(2, GL_FLOAT, sizeof(float)*2, verts);
glTexCoordPointer(2, GL_FLOAT, sizeof(float)*2, tcoords);
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(unsigned int), colors);

glDrawArrays(GL_TRIANGLES, 0, nverts);

glDisable(GL_TEXTURE_2D);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
}

static void glst__renderDelete(void* userPtr)
{
struct GLSTcontext* gl = (struct GLSTcontext*)userPtr;
if (gl->tex)
glDeleteTextures(1, &gl->tex);
gl->tex = 0;
free(gl);
}


int glstInit(struct FONSparams* params)
{
struct GLSTcontext* gl = (struct GLSTcontext*)malloc(sizeof(struct GLSTcontext));
if (gl == NULL) goto error;
memset(gl, 0, sizeof(struct GLSTcontext));

params->renderCreate = glst__renderCreate;
params->renderUpdate = glst__renderUpdate;
params->renderDraw = glst__renderDraw;
params->renderDelete = glst__renderDelete;
params->userPtr = gl;

return 1;

error:
if (gl != NULL) free(gl);
return 0;
}

unsigned int glstRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
{
return (r) | (g << 8) | (b << 16) | (a << 24);
}

#endif

+ 0
- 431
example/icons.txt View File

@@ -1,431 +0,0 @@
struct Icon {
const char* name;
int codepoint;
};


const char* getIcon(const char* name)
{
static struct Icon icons[] = {
{ "phone", 0x1F4DE },
{ "mobile", 0x1F4F1 },
{ "mouse", 0xE789 },
{ "address", 0xE723 },
{ "mail", 0x2709 },
{ "paper-plane", 0x1F53F },
{ "pencil", 0x270E },
{ "feather", 0x2712 },
{ "attach", 0x1F4CE },
{ "inbox", 0xE777 },
{ "reply", 0xE712 },
{ "reply-all", 0xE713 },
{ "forward", 0x27A6 },
{ "user", 0x1F464 },
{ "users", 0x1F465 },
{ "add-user", 0xE700 },
{ "vcard", 0xE722 },
{ "export", 0xE715 },
{ "location", 0xE724 },
{ "map", 0xE727 },
{ "compass", 0xE728 },
{ "direction", 0x27A2 },
{ "hair-cross", 0x1F3AF },
{ "share", 0xE73C },
{ "shareable", 0xE73E },
{ "heart", 0x2665 },
{ "heart-empty", 0x2661 },
{ "star", 0x2605 },
{ "star-empty", 0x2606 },
{ "thumbs-up", 0x1F44D },
{ "thumbs-down", 0x1F44E },
{ "chat", 0xE720 },
{ "comment", 0xE718 },
{ "quote", 0x275E },
{ "home", 0x2302 },
{ "popup", 0xE74C },
{ "search", 0x1F50D },
{ "flashlight", 0x1F526 },
{ "print", 0xE716 },
{ "bell", 0x1F514 },
{ "link", 0x1F517 },
{ "flag", 0x2691 },
{ "cog", 0x2699 },
{ "tools", 0x2692 },
{ "trophy", 0x1F3C6 },
{ "tag", 0xE70C },
{ "camera", 0x1F4F7 },
{ "megaphone", 0x1F4E3 },
{ "moon", 0x263D },
{ "palette", 0x1F3A8 },
{ "leaf", 0x1F342 },
{ "note", 0x266A },
{ "beamed-note", 0x266B },
{ "new", 0x1F4A5 },
{ "graduation-cap", 0x1F393 },
{ "book", 0x1F4D5 },
{ "newspaper", 0x1F4F0 },
{ "bag", 0x1F45C },
{ "airplane", 0x2708 },
{ "lifebuoy", 0xE788 },
{ "eye", 0xE70A },
{ "clock", 0x1F554 },
{ "mic", 0x1F3A4 },
{ "calendar", 0x1F4C5 },
{ "flash", 0x26A1 },
{ "thunder-cloud", 0x26C8 },
{ "droplet", 0x1F4A7 },
{ "cd", 0x1F4BF },
{ "briefcase", 0x1F4BC },
{ "air", 0x1F4A8 },
{ "hourglass", 0x23F3 },
{ "gauge", 0x1F6C7 },
{ "language", 0x1F394 },
{ "network", 0xE776 },
{ "key", 0x1F511 },
{ "battery", 0x1F50B },
{ "bucket", 0x1F4FE },
{ "magnet", 0xE7A1 },
{ "drive", 0x1F4FD },
{ "cup", 0x2615 },
{ "rocket", 0x1F680 },
{ "brush", 0xE79A },
{ "suitcase", 0x1F6C6 },
{ "traffic-cone", 0x1F6C8 },
{ "globe", 0x1F30E },
{ "keyboard", 0x2328 },
{ "browser", 0xE74E },
{ "publish", 0xE74D },
{ "progress-3", 0xE76B },
{ "progress-2", 0xE76A },
{ "progress-1", 0xE769 },
{ "progress-0", 0xE768 },
{ "light-down", 0x1F505 },
{ "light-up", 0x1F506 },
{ "adjust", 0x25D1 },
{ "code", 0xE714 },
{ "monitor", 0x1F4BB },
{ "infinity", 0x221E },
{ "light-bulb", 0x1F4A1 },
{ "credit-card", 0x1F4B3 },
{ "database", 0x1F4F8 },
{ "voicemail", 0x2707 },
{ "clipboard", 0x1F4CB },
{ "cart", 0xE73D },
{ "box", 0x1F4E6 },
{ "ticket", 0x1F3AB },
{ "rss", 0xE73A },
{ "signal", 0x1F4F6 },
{ "thermometer", 0x1F4FF },
{ "water", 0x1F4A6 },
{ "sweden", 0xF601 },
{ "line-graph", 0x1F4C8 },
{ "pie-chart", 0x25F4 },
{ "bar-graph", 0x1F4CA },
{ "area-graph", 0x1F53E },
{ "lock", 0x1F512 },
{ "lock-open", 0x1F513 },
{ "logout", 0xE741 },
{ "login", 0xE740 },
{ "check", 0x2713 },
{ "cross", 0x274C },
{ "squared-minus", 0x229F },
{ "squared-plus", 0x229E },
{ "squared-cross", 0x274E },
{ "circled-minus", 0x2296 },
{ "circled-plus", 0x2295 },
{ "circled-cross", 0x2716 },
{ "minus", 0x2796 },
{ "plus", 0x2795 },
{ "erase", 0x232B },
{ "block", 0x1F6AB },
{ "info", 0x2139 },
{ "circled-info", 0xE705 },
{ "help", 0x2753 },
{ "circled-help", 0xE704 },
{ "warning", 0x26A0 },
{ "cycle", 0x1F504 },
{ "cw", 0x27F3 },
{ "ccw", 0x27F2 },
{ "shuffle", 0x1F500 },
{ "back", 0x1F519 },
{ "level-down", 0x21B3 },
{ "retweet", 0xE717 },
{ "loop", 0x1F501 },
{ "back-in-time", 0xE771 },
{ "level-up", 0x21B0 },
{ "switch", 0x21C6 },
{ "numbered-list", 0xE005 },
{ "add-to-list", 0xE003 },
{ "layout", 0x268F },
{ "list", 0x2630 },
{ "text-doc", 0x1F4C4 },
{ "text-doc-inverted", 0xE731},
{ "doc", 0xE730 },
{ "docs", 0xE736 },
{ "landscape-doc", 0xE737 },
{ "picture", 0x1F304 },
{ "video", 0x1F3AC },
{ "music", 0x1F3B5 },
{ "folder", 0x1F4C1 },
{ "archive", 0xE800 },
{ "trash", 0xE729 },
{ "upload", 0x1F4E4 },
{ "download", 0x1F4E5 },
{ "save", 0x1F4BE },
{ "install", 0xE778 },
{ "cloud", 0x2601 },
{ "upload-cloud", 0xE711 },
{ "bookmark", 0x1F516 },
{ "bookmarks", 0x1F4D1 },
{ "open-book", 0x1F4D6 },
{ "play", 0x25B6 },
{ "paus", 0x2016 },
{ "record", 0x25CF },
{ "stop", 0x25A0 },
{ "ff", 0x23E9 },
{ "fb", 0x23EA },
{ "to-start", 0x23EE },
{ "to-end", 0x23ED },
{ "resize-full", 0xE744 },
{ "resize-small", 0xE746 },
{ "volume", 0x23F7 },
{ "sound", 0x1F50A },
{ "mute", 0x1F507 },
{ "flow-cascade", 0x1F568 },
{ "flow-branch", 0x1F569 },
{ "flow-tree", 0x1F56A },
{ "flow-line", 0x1F56B },
{ "flow-parallel", 0x1F56C },
{ "left-bold", 0xE4AD },
{ "down-bold", 0xE4B0 },
{ "up-bold", 0xE4AF },
{ "right-bold", 0xE4AE },
{ "left", 0x2B05 },
{ "down", 0x2B07 },
{ "up", 0x2B06 },
{ "right", 0x27A1 },
{ "circled-left", 0xE759 },
{ "circled-down", 0xE758 },
{ "circled-up", 0xE75B },
{ "circled-right", 0xE75A },
{ "triangle-left", 0x25C2 },
{ "triangle-down", 0x25BE },
{ "triangle-up", 0x25B4 },
{ "triangle-right", 0x25B8 },
{ "chevron-left", 0xE75D },
{ "chevron-down", 0xE75C },
{ "chevron-up", 0xE75F },
{ "chevron-right", 0xE75E },
{ "chevron-small-left", 0xE761 },
{ "chevron-small-down", 0xE760 },
{ "chevron-small-up", 0xE763 },
{ "chevron-small-right",0xE762 },
{ "chevron-thin-left", 0xE765 },
{ "chevron-thin-down", 0xE764 },
{ "chevron-thin-up", 0xE767 },
{ "chevron-thin-right", 0xE766 },
{ "left-thin", 0x2190 },
{ "down-thin", 0x2193 },
{ "up-thin", 0x2191 },
{ "right-thin", 0x2192 },
{ "arrow-combo", 0xE74F },
{ "three-dots", 0x23F6 },
{ "two-dots", 0x23F5 },
{ "dot", 0x23F4 },
{ "cc", 0x1F545 },
{ "cc-by", 0x1F546 },
{ "cc-nc", 0x1F547 },
{ "cc-nc-eu", 0x1F548 },
{ "cc-nc-jp", 0x1F549 },
{ "cc-sa", 0x1F54A },
{ "cc-nd", 0x1F54B },
{ "cc-pd", 0x1F54C },
{ "cc-zero", 0x1F54D },
{ "cc-share", 0x1F54E },
{ "cc-remix", 0x1F54F },
{ "db-logo", 0x1F5F9 },
{ "db-shape", 0x1F5FA },

/* { "icon-cloud", 0x2601 },
{ "icon-at", 0x0040 },
{ "icon-plus", 0x002B },

{ "icon-arrow_up", 0x2191 },
{ "icon-arrow_down", 0x2193 },
{ "icon-arrow_right", 0x2192 },
{ "icon-arrow_left", 0x2190 },
{ "icon-chevron_down", 0xf004 },
{ "icon-chevron_up", 0xf005 },
{ "icon-chevron_right", 0xf006 },
{ "icon-chevron_left", 0xf007 },
{ "icon-reorder", 0xf008 },
{ "icon-list", 0xf009 },
{ "icon-reorder_square", 0xf00a },
{ "icon-reorder_square_line", 0xf00b },
{ "icon-coverflow", 0xf00c },
{ "icon-coverflow_line", 0xf00d },
{ "icon-pause", 0xf00e },
{ "icon-play", 0xf00f },

{ "icon-step_forward", 0xf010 },
{ "icon-step_backward", 0xf011 },
{ "icon-fast_forward", 0xf012 },
{ "icon-fast_backward", 0xf013 },
{ "icon-cloud_upload", 0xf014 },
{ "icon-cloud_download", 0xf015 },
{ "icon-data_science", 0xf016 },
{ "icon-data_science_black", 0xf017 },
{ "icon-globe", 0xf018 },
{ "icon-globe_black", 0xf019 },
{ "icon-math_ico", 0xf01a },
{ "icon-math", 0xf01b },
{ "icon-math_black", 0xf01c },
{ "icon-paperplane_ico", 0xf01d },
{ "icon-paperplane", 0xf01e },
{ "icon-paperplane_black", 0xf01f },

{ "icon-color_balance", 0xf020 },
{ "icon-star", 0x2605 },
{ "icon-star_half", 0xf022 },
{ "icon-star_empty", 0x2606 },
{ "icon-star_half_empty", 0xf024 },
{ "icon-reload", 0xf025 },

{ "icon-heart", 0x2665 },
{ "icon-heart_broken", 0xf028 },
{ "icon-hashtag", 0xf029 },
{ "icon-reply", 0xf02a },
{ "icon-retweet", 0xf02b },
{ "icon-signin", 0xf02c },
{ "icon-signout", 0xf02d },
{ "icon-download", 0xf02e },
{ "icon-upload", 0xf02f },


{ "icon-placepin", 0xf031 },
{ "icon-display_screen", 0xf032 },
{ "icon-tablet", 0xf033 },
{ "icon-smartphone", 0xf034 },
{ "icon-connected_object", 0xf035 },
{ "icon-lock", 0xF512 },
{ "icon-unlock", 0xF513 },
{ "icon-camera", 0xF4F7 },
{ "icon-isight", 0xf039 },
{ "icon-video_camera", 0xf03a },
{ "icon-random", 0xf03b },
{ "icon-message", 0xF4AC },
{ "icon-discussion", 0xf03d },
{ "icon-calendar", 0xF4C5 },
{ "icon-ringbell", 0xf03f },

{ "icon-movie", 0xf040 },
{ "icon-mail", 0x2709 },
{ "icon-pen", 0x270F },
{ "icon-settings", 0x9881 },
{ "icon-measure", 0xf044 },
{ "icon-vector", 0xf045 },
{ "icon-vector_pen", 0x2712 },
{ "icon-mute_on", 0xf047 },
{ "icon-mute_off", 0xf048 },
{ "icon-home", 0x2302 },
{ "icon-sheet", 0xf04a },
{ "icon-arrow_big_right", 0x21C9 },
{ "icon-arrow_big_left", 0x21C7 },
{ "icon-arrow_big_down", 0x21CA },
{ "icon-arrow_big_up", 0x21C8 },
{ "icon-dribbble_circle", 0xf04f },

{ "icon-dribbble", 0xf050 },
{ "icon-facebook_circle", 0xf051 },
{ "icon-facebook", 0xf052 },
{ "icon-git_circle_alt", 0xf053 },
{ "icon-git_circle", 0xf054 },
{ "icon-git", 0xf055 },
{ "icon-octopus", 0xf056 },
{ "icon-twitter_circle", 0xf057 },
{ "icon-twitter", 0xf058 },
{ "icon-google_plus_circle", 0xf059 },
{ "icon-google_plus", 0xf05a },
{ "icon-linked_in_circle", 0xf05b },
{ "icon-linked_in", 0xf05c },
{ "icon-instagram", 0xf05d },
{ "icon-instagram_circle", 0xf05e },
{ "icon-mfg_icon", 0xf05f },

{ "icon-mfg_icon_circle", 0xf060 },
{ "icon-user", 0xf061 },
{ "icon-user_male", 0xf062 },
{ "icon-user_female", 0xf063 },
{ "icon-users", 0xf064 },

{ "icon-file_open", 0xF4C2 },
{ "icon-file_close", 0xf067 },
{ "icon-file_alt", 0xf068 },
{ "icon-file_close_alt", 0xf069 },
{ "icon-attachment", 0xf06a },
{ "icon-check", 0x2713 },
{ "icon-cross_mark", 0x274C },
{ "icon-cancel_circle", 0xF06E },
{ "icon-check_circle", 0xf06d },
{ "icon-magnifying", 0xF50D },

{ "icon-inbox", 0xf070 },
{ "icon-clock", 0x23F2 },
{ "icon-stopwatch", 0x23F1 },
{ "icon-hourglass", 0x231B },
{ "icon-trophy", 0xf074 },
{ "icon-unlock_alt", 0xF075 },
{ "icon-lock_alt", 0xF510 },
{ "icon-arrow_doubled_right", 0x21D2 },
{ "icon-arrow_doubled_left", 0x21D0 },
{ "icon-arrow_doubled_down", 0x21D3 },
{ "icon-arrow_doubled_up", 0x21D1 },
{ "icon-link", 0xf07B },
{ "icon-warning", 0x2757 },
{ "icon-warning_alt", 0x2755 },
{ "icon-magnifying_plus", 0xf07E },
{ "icon-magnifying_minus", 0xf07F },

{ "icon-white_question", 0x2754 },
{ "icon-black_question", 0x2753 },
{ "icon-stop", 0xf080 },
{ "icon-share", 0xf081 },
{ "icon-eye", 0xf082 },
{ "icon-trash_can", 0xf083 },
{ "icon-hard_drive", 0xf084 },
{ "icon-information_black", 0xf085 },
{ "icon-information_white", 0xf086 },
{ "icon-printer", 0xf087 },
{ "icon-letter", 0xf088 },
{ "icon-soundcloud", 0xf089 },
{ "icon-soundcloud_circle", 0xf08A },
{ "icon-anchor", 0x2693 },

{ "icon-female_sign", 0x2640 },
{ "icon-male_sign", 0x2642 },
{ "icon-joystick", 0xF514 },
{ "icon-high_voltage", 0x26A1 },
{ "icon-fire", 0xF525 },
{ "icon-newspaper", 0xF4F0 },
{ "icon-chart", 0xF526 },
{ "icon-spread", 0xF527 },

{ "icon-spinner_1", 0xF528 },
{ "icon-spinner_2", 0xF529 },

{ "icon-chart_alt", 0xF530 },
{ "icon-label", 0xF531 },*/
};
static const int nicons = sizeof(icons) / sizeof(struct Icon);
int i;
static char str[8];

for (i = 0; i < nicons; i++) {
if (strcmp(icons[i].name, name) == 0) {
cpToUTF8(icons[i].codepoint, str);
return str;
}
}

return "";
}

BIN
example/mfglabsiconset-webfont.ttf View File


+ 0
- 84
example/templates.xml View File

@@ -1,84 +0,0 @@
<style>
$color = rgba(255,255,255,255);
@font-face {
font-family: "Roboto";
font-weight: bold;
src: "../examples/Roboto-light.ttf";
}
@font-face {
font-family: "Entypo";
src: "../examples/entypo.ttf";
}

.icon-search {
font-family: "Entypo";
font-size: 28px;
content: 0x1F50D;
}
.icon-circled-cross {
font-family: "Entypo";
font-size: 28px;
content: 0x2716;
}
.icon-plus {
font-family: "Entypo";
font-size: 28px;
content: "\2796";
}

.search-box {
padding: 5px;
}

.footer-buttons {
padding: 5px;
}

/* default style */
header {
height: 30px;
/*font-size: 26px;*/
}

input {
height: ;
font-size: 26px;
}

</style>

<template id="material-window">
<win width="300px" height="500px" align="justify">
<col align="justify">
<header>Materials</header>
<row height="auto" style="search-box">
<input id="search" grow="1">
<icon style="icon-search" />
<field grow="1" />
<icon style="icon-circled-cross" />
</input>
</row>
<col id="materials" grow="1" height="10px" align="justify" />
<row height="auto" style="footer-buttons">
<spacer grow="1" />
<button id="add-item"><icon style="icon-plus"/>Add</button>
<button id="remove">Remove</button>
</row>
</col>
</win>
</template>

<template id="material-item">
<item padding="4px" align="center">
<img id="thumbnail" width="25px" height="25px" />
<label id="name" grow="1" />
</item>
</template>

<template id="material-noitems">
<col padding="4px" pack="center" align="center">
<icon src="sad-face" />
<label>Sorry, no items found.</label>
</col>
</template>

Loading…
Cancel
Save