~alcinnz/fontconfig-pure

fontconfig-pure/cbits/charsetiter.c -rw-r--r-- 838 bytes
dfb515ef — Adrian Cochrane Segfault fixes. 1 year, 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <fontconfig/fontconfig.h>
#include <stdlib.h>

struct my_FcCharSetIter {
    FcCharSet *charset;
    FcChar32 map[FC_CHARSET_MAP_SIZE];
    FcChar32 next;
};

struct my_FcCharSetIter *my_FcCharSetIterCreate(FcCharSet *a) {
    struct my_FcCharSetIter *self = malloc(sizeof(struct my_FcCharSetIter));
    self->charset = FcCharSetCopy(a);
    return self;
}

void my_FcCharSetIterDestroy(struct my_FcCharSetIter *self) {
    FcCharSetDestroy(self->charset);
    free(self);
}

FcChar32 my_FcCharSetIterStart(struct my_FcCharSetIter *self) {
    return FcCharSetFirstPage(self->charset, self->map, &self->next);
}

FcChar32 my_FcCharSetIterNext(struct my_FcCharSetIter *self) {
    return FcCharSetNextPage(self->charset, self->map, &self->next);
}

FcBool my_FcCharSetIterDone(FcChar32 chr) {
    return chr == FC_CHARSET_DONE;
}