PageRenderTime 10ms CodeModel.GetById 2ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/tools/fontextract/fontdata.h

http://ftk.googlecode.com/
C++ Header | 91 lines | 48 code | 14 blank | 29 comment | 0 complexity | ff92fc292f3d758b57ecae163ea54fac MD5 | raw file
 1/*
 2 * File: fontdata.h    
 3 * Author:  Li XianJing <xianjimli@hotmail.com>
 4 * Brief:   functions to operate font data. 
 5 *
 6 * Copyright (c) 2009 - 2010  Li XianJing <xianjimli@hotmail.com>
 7 *
 8 * Licensed under the Academic Free License version 2.1
 9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23 */
24
25/*
26 * History:
27 * ================================================================
28 * 2009-09-11 Li XianJing <xianjimli@hotmail.com> created
29 *
30 */
31
32#ifdef WITHOUT_FTK
33#include "typedef.h"
34#define FTK_BEGIN_DECLS 
35#define FTK_END_DECLS 
36#else
37#include "ftk_typedef.h"
38#endif
39
40#ifndef FONT_DATA_H
41#define FONT_DATA_H
42
43FTK_BEGIN_DECLS
44
45typedef enum _Encoding
46{
47	ENC_UTF16 = 0,
48	ENC_ANSI  = 1
49}Encoding;
50
51typedef struct _Glyph
52{
53	signed char x;
54	signed char y;
55	unsigned char w;
56	unsigned char h;
57	unsigned short code;
58	unsigned short unused;
59	unsigned char* data;
60}Glyph;
61
62struct _FontData;
63typedef struct _FontData FontData;
64
65FontData* font_data_create(int char_nr, Encoding encoding);
66FontData* font_data_load(char* data, size_t length);
67FontData* font_data_load_file(const char* file_name);
68Ret font_data_add_glyph(FontData* thiz, Glyph* glyph);
69Ret font_data_get_glyph(FontData* thiz, unsigned short code, Glyph* glyph);
70
71int  font_data_get_version(FontData* thiz);
72int  font_data_get_width(FontData* thiz);
73int  font_data_get_height(FontData* thiz);
74const char* font_data_get_author(FontData* thiz);
75const char* font_data_get_family(FontData* thiz);
76const char* font_data_get_style(FontData* thiz);
77
78void font_data_set_size(FontData* thiz, int width, int height);
79void font_data_set_author(FontData* thiz, const char* author);
80void font_data_set_family(FontData* thiz, const char* family);
81void font_data_set_style(FontData* thiz, const char* style);
82
83#ifdef HAS_FONT_DATA_SAVE
84Ret font_data_save(FontData* thiz, const char* filename);
85#endif
86void font_data_destroy(FontData* thiz);
87
88FTK_END_DECLS
89
90#endif/*FONT_DATA_H*/
91