Project

General

Profile

Revision 313

organizing fonts

View differences:

font.c
84 84
        return NULL;
85 85
    }
86 86
}
87
void (font_dtor)(font_t *p){
88
    if(p == NULL) return;
87
int (font_dtor)(font_t *p){
88
    if(p == NULL) return SUCCESS;
89 89
    for(size_t i = 0; i < p->nchars; ++i)
90 90
        glyph_dtor(p->glyphs[i]);
91 91
    free(p->glyphs);
92 92
    free(p);
93
    return SUCCESS;
93 94
}
94 95

  
96
font_t *consolas = NULL;
97
font_t *default_font = NULL;
98

  
99
int (font_init)(void){
100
    consolas = font_ctor("/home/lcom/labs/proj/media/font/Consolas/xpm2");
101
    if(consolas == NULL) return NULL_PTR;
102
    default_font = consolas;
103
    return SUCCESS;
104
}
105
int (font_free)(void){
106
    int r;
107
    if((r = font_dtor(consolas))) return r;
108
    consolas = NULL;
109
    default_font = NULL;
110
    return SUCCESS;
111
}
112

  
95 113
struct text{
96 114
    const font_t *fnt;
97 115
    char *txt;

Also available in: Unified diff