00001 /* 00002 * Copyright (c) 2005-2008 cielacanth <cielacanth AT s60.xrea.com> 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions 00007 * are met: 00008 * 1. Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * 2. Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * 00014 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 00015 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00016 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00017 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 00018 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00019 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00020 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00021 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00022 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00023 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00024 * SUCH DAMAGE. 00025 */ 00026 00027 #ifndef __ALICEML_FONT_H__ 00028 #define __ALICEML_FONT_H__ 00029 00030 #include "aliceml.h" 00031 #include "aliceml_array.h" 00032 #include "aliceml_color.h" 00033 #include "aliceml_string.h" 00034 00035 #ifdef __cplusplus 00036 extern "C" { 00037 #endif 00038 00042 struct ML_Font { 00044 void *abstract_font; 00045 00046 ML_String8 *font_name; 00047 int font_index; 00048 int font_size; 00049 ML_FontStyle style; 00050 ML_Color color; 00051 00052 ML_Color shadow_color; 00053 int shadow_offset_x, shadow_offset_y; 00054 00055 ML_Color hemming_color; 00056 int hemming_width_x, hemming_width_y; 00057 00058 int ref_count; 00059 }; 00060 00064 typedef struct ML_SimpleFont { 00065 void *abstract_font; 00066 00067 const char *font_name; 00068 int font_index; 00069 int font_size; 00070 ML_FontStyle style; 00071 ML_Color color; 00072 } ML_SimpleFont; 00073 00077 typedef struct ML_GlyphMetrics { 00078 struct { 00082 int ascent; 00084 int offset_left; 00085 } hori; 00086 00087 /*struct vert { 00088 };*/ 00089 00091 int w, h; 00092 00094 int advance_x, advance_y; 00095 } ML_GlyphMetrics; 00096 00098 ALICEMLAPI ML_Font * ALICEMLCALL 00099 ML_Font_Create(); 00100 00102 ALICEMLAPI ML_Font * ALICEMLCALL 00103 ML_Font_Clone(const ML_Font *font); 00104 00106 ALICEMLAPI ML_Font * ALICEMLCALL 00107 ML_Font_Unique(ML_Font *font); 00108 00110 ALICEMLAPI int ALICEMLCALL 00111 ML_Font_Share(ML_Font *font); 00112 00114 ALICEMLAPI void ALICEMLCALL 00115 ML_Font_Destroy(ML_Font *font); 00116 00118 ALICEMLAPI int ALICEMLCALL 00119 ML_Font_SetFontName(ML_Font *font, ML_String8 *name); 00120 00125 ALICEMLAPI int ALICEMLCALL 00126 ML_Font_Compare(const ML_Font *font1, const ML_Font *font2); 00127 00129 ALICEMLAPI ML_SimpleFont ALICEMLCALL 00130 ML_SimpleFont_Make(const ML_Font *font); 00131 00133 ALICEMLAPI ML_Array * ALICEMLCALL 00134 ML_FontStack_Create(); 00135 00136 #ifdef __cplusplus 00137 } 00138 #endif 00139 00140 #endif
1.5.5