add explicit freetype2 linking
[charfbuzz.git] / hb-fallback-shape.c
blobcdc0ae9a6a50a1b444db3a148db08f01bececa7c
1 /*
2 Port from c++ is protected by a GNU Lesser GPLv3
3 Copyright © 2013 Sylvain BERTRAND <sylvain.bertrand@gmail.com>
4 <sylware@legeek.net>
5 */
6 #include "hb.h"
7 #include "hb-private.h"
8 #include "hb-atomic-private.h"
9 #include "hb-buffer-private.h"
10 #include "hb-shaper-private.h"
11 #include "hb-font-private.h"
12 #include "hb-unicode-private.h"
14 /*----------------------------------------------------------------------------*/
15 /*shaper face data*/
16 struct hb_fallback_shaper_face_data_t {
17 long empty;
20 struct hb_fallback_shaper_face_data_t
21 *hb_fallback_shaper_face_data_create(hb_face_t * face HB_UNUSED)
23 return HB_SHAPER_DATA_SUCCEEDED;
26 void
27 hb_fallback_shaper_face_data_destroy(struct hb_fallback_shaper_face_data_t *data
28 HB_UNUSED)
32 /*----------------------------------------------------------------------------*/
34 /*----------------------------------------------------------------------------*/
35 /*shaper font data*/
36 struct hb_fallback_shaper_font_data_t {
37 long empty;
40 struct hb_fallback_shaper_font_data_t
41 *hb_fallback_shaper_font_data_create(hb_font_t * font HB_UNUSED)
43 return HB_SHAPER_DATA_SUCCEEDED;
46 void hb_fallback_shaper_font_data_destroy(struct hb_fallback_shaper_font_data_t
47 *data HB_UNUSED)
51 /*----------------------------------------------------------------------------*/
53 /*----------------------------------------------------------------------------*/
54 /*shaper shape_plan data*/
55 struct hb_fallback_shaper_shape_plan_data_t {
56 long empty;
59 struct hb_fallback_shaper_shape_plan_data_t
60 *hb_fallback_shaper_shape_plan_data_create(hb_shape_plan_t *
61 shape_plan HB_UNUSED,
62 const hb_feature_t *
63 user_features HB_UNUSED,
64 unsigned num_user_features HB_UNUSED)
66 return HB_SHAPER_DATA_SUCCEEDED;
69 void hb_fallback_shaper_shape_plan_data_destroy(struct
70 hb_fallback_shaper_shape_plan_data_t
71 *data HB_UNUSED)
75 /*----------------------------------------------------------------------------*/
77 /*shaper*/
78 hb_bool_t hb_fallback_shape(hb_shape_plan_t * shape_plan HB_UNUSED,
79 hb_font_t * font, hb_buffer_t * buffer,
80 const hb_feature_t * features HB_UNUSED,
81 unsigned num_features HB_UNUSED)
83 hb_codepoint_t space;
84 unsigned count;
85 unsigned i;
87 hb_font_get_glyph(font, ' ', 0, &space);
89 hb_buffer_clear_positions(buffer);
91 count = buffer->len;
93 for (i = 0; i < count; ++i) {
94 if (hb_unicode_is_default_ignorable(buffer->info[i].codepoint)) {
95 buffer->info[i].codepoint = space;
96 buffer->pos[i].x_advance = 0;
97 buffer->pos[i].y_advance = 0;
98 continue;
100 hb_font_get_glyph(font, buffer->info[i].codepoint, 0,
101 &buffer->info[i].codepoint);
102 hb_font_get_glyph_advance_for_direction(font,
103 buffer->
104 info[i].codepoint,
105 buffer->props.direction,
106 &buffer->
107 pos[i].x_advance,
108 &buffer->
109 pos[i].y_advance);
110 hb_font_subtract_glyph_origin_for_direction(font,
111 buffer->
112 info[i].codepoint,
113 buffer->
114 props.direction,
115 &buffer->
116 pos[i].x_offset,
117 &buffer->
118 pos[i].y_offset);
121 if (HB_DIRECTION_IS_BACKWARD(buffer->props.direction))
122 hb_buffer_reverse(buffer);
123 return TRUE;