~alcinnz/fontconfig-pure

3ca6576c426d6d5c299e2cfc94bf8f729c7bbe51 — Adrian Cochrane 1 year, 2 months ago a454eb8
Improve lazy performance, release 0.3.0.1
2 files changed, 32 insertions(+), 1 deletions(-)

A cbits/charsetiter.c
M fontconfig-pure.cabal
A cbits/charsetiter.c => cbits/charsetiter.c +31 -0
@@ 0,0 1,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;
}

M fontconfig-pure.cabal => fontconfig-pure.cabal +1 -1
@@ 10,7 10,7 @@ name:                fontconfig-pure
-- PVP summary:      +-+------- breaking API changes
--                   | | +----- non-breaking API additions
--                   | | | +--- code changes with no API change
version:             0.3.0.0
version:             0.3.0.1

-- A short (one-line) description of the package.
synopsis:            Pure-functional language bindings to FontConfig