2 #include "hb-private.h"
3 #include "hb-atomic-private.h"
4 #include "hb-buffer-private.h"
5 // C99 port from c++ is protected by a GNU Lesser GPLv3
6 // Copyright © 2013 Sylvain BERTRAND <sylvain.bertrand@gmail.com>
7 // <sylware@legeek.net>
8 #include "hb-shaper-private.h"
9 #include "hb-font-private.h"
10 #include "hb-unicode-private.h"
12 //------------------------------------------------------------------------------
14 struct hb_fallback_shaper_face_data_t
{};
16 struct hb_fallback_shaper_face_data_t
*
17 hb_fallback_shaper_face_data_create(hb_face_t
*face HB_UNUSED
)
19 return HB_SHAPER_DATA_SUCCEEDED
;
23 hb_fallback_shaper_face_data_destroy(
24 struct hb_fallback_shaper_face_data_t
*data HB_UNUSED
)
27 //------------------------------------------------------------------------------
30 //------------------------------------------------------------------------------
32 struct hb_fallback_shaper_font_data_t
{};
34 struct hb_fallback_shaper_font_data_t
*
35 hb_fallback_shaper_font_data_create(hb_font_t
*font HB_UNUSED
)
37 return HB_SHAPER_DATA_SUCCEEDED
;
41 hb_fallback_shaper_font_data_destroy(
42 struct hb_fallback_shaper_font_data_t
*data HB_UNUSED
)
45 //------------------------------------------------------------------------------
48 //------------------------------------------------------------------------------
49 //shaper shape_plan data
50 struct hb_fallback_shaper_shape_plan_data_t
{};
52 struct hb_fallback_shaper_shape_plan_data_t
*
53 hb_fallback_shaper_shape_plan_data_create(
54 hb_shape_plan_t
*shape_plan HB_UNUSED
,
55 const hb_feature_t
*user_features HB_UNUSED
,
56 unsigned num_user_features HB_UNUSED
)
58 return HB_SHAPER_DATA_SUCCEEDED
;
62 hb_fallback_shaper_shape_plan_data_destroy(
63 struct hb_fallback_shaper_shape_plan_data_t
*data HB_UNUSED
)
66 //------------------------------------------------------------------------------
71 hb_fallback_shape(hb_shape_plan_t
*shape_plan HB_UNUSED
,
74 const hb_feature_t
*features HB_UNUSED
,
75 unsigned num_features HB_UNUSED
)
78 hb_font_get_glyph(font
, ' ', 0, &space
);
80 hb_buffer_clear_positions(buffer
);
82 unsigned count
= buffer
->len
;
84 for (unsigned i
= 0; i
< count
; i
++) {
85 if (hb_unicode_is_default_ignorable(buffer
->info
[i
].codepoint
)) {
86 buffer
->info
[i
].codepoint
= space
;
87 buffer
->pos
[i
].x_advance
= 0;
88 buffer
->pos
[i
].y_advance
= 0;
91 hb_font_get_glyph(font
,
92 buffer
->info
[i
].codepoint
,
94 &buffer
->info
[i
].codepoint
);
95 hb_font_get_glyph_advance_for_direction(font
,
96 buffer
->info
[i
].codepoint
,
97 buffer
->props
.direction
,
98 &buffer
->pos
[i
].x_advance
,
99 &buffer
->pos
[i
].y_advance
);
100 hb_font_subtract_glyph_origin_for_direction(font
,
101 buffer
->info
[i
].codepoint
,
102 buffer
->props
.direction
,
103 &buffer
->pos
[i
].x_offset
,
104 &buffer
->pos
[i
].y_offset
);
107 if (HB_DIRECTION_IS_BACKWARD(buffer
->props
.direction
))
108 hb_buffer_reverse(buffer
);