Initial commit
[charfbuzz.git] / hb-shape.c
blob1ff445b5de783fb0aa041f34d75919614b21ad34
1 // C99 port from c++ is protected by a GNU Lesser GPLv3
2 // Copyright © 2013 Sylvain BERTRAND <sylvain.bertrand@gmail.com>
3 // <sylware@legeek.net>
4 #include <stddef.h>
5 #include <assert.h>
7 #include "hb.h"
8 #include "hb-private.h"
9 #include "hb-atomic-private.h"
10 #include "hb-buffer-private.h"
11 #include "hb-shaper-private.h"
12 #include "hb-shape-plan-private.h"
13 #include "hb-font-private.h"
15 hb_bool_t
16 hb_shape_full(hb_font_t *font,
17 hb_buffer_t *buffer,
18 const hb_feature_t *features,
19 unsigned num_features,
20 const char * const *shaper_list)
22 if (!buffer->len)
23 return TRUE;
25 assert(buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE);
27 hb_shape_plan_t *shape_plan = hb_shape_plan_create_cached(font->face,
28 &buffer->props, features, num_features, shaper_list);
30 hb_bool_t res = hb_shape_plan_execute(shape_plan, font, buffer, features,
31 num_features);
32 hb_shape_plan_destroy(shape_plan);
34 if (res)
35 buffer->content_type = HB_BUFFER_CONTENT_TYPE_GLYPHS;
36 return res;
39 void
40 hb_shape(hb_font_t *font,
41 hb_buffer_t *buffer,
42 const hb_feature_t *features,
43 unsigned num_features)
45 hb_shape_full(font, buffer, features, num_features, NULL);