#include <stdint.h>
typedef hb_uint16 HB_CodePoint;
typedef char HB_Boolean;
typedef hb_uint32 HB_Fixed;
typedef hb_uint32 HB_Glyph;
typedef hb_uint32 HB_Unichar;
typedef struct _HB_GlyphMetrics HB_GlyphMetrics;
struct _HB_GlyphMetrics
{
HB_Fixed advance;
};
typedef struct _HB_Font HB_Font;
typedef struct _HB_FontClass HB_FontClass;
struct HB_FontClass {
HB_Glyph (*charToGlyph)(HB_Font *font, HB_Unichar chr);
void (*getMetrics)(HB_Font *font, HB_Glyph glyph, HB_GlyphMetrics *metrics);
HB_Boolean (*getSFontTable)(HB_Font *font, void **cookie, char **start, int *len);
HB_Boolean (*freeSFontTable)(void **cookie);
};
struct _HB_Font {
HB_FontClass *clazz;
};
typedef struct HB_Language_ *HB_Language;
HB_Language hb_language_from_string(const char *str);
const char *hb_language_to_string(HB_Language language);
typedef enum {
HB_RUN_EDGE_LINE_VISUAL_EDGE = 1 << 0,
HB_RUN_EDGE_LINE_LOGICAL_EDGE = 1 << 1,
HB_RUN_EDGE_LINE_ADD_HYPHEN = 1 << 2
} HB_RunEdge;
typedef enum {
HB_SHAPE_START_TYPE = 1 << 0,
HB_SHAPE_END_TYPE = 1 << 1
} HB_ShapeFlags;
typedef struct _HB_AttributeType *HB_AttributeType;
HB_AttributeType hb_attribute_type_from_string(const char *str);
const char *hb_attribute_type_to_string(HB_AttributeType attribute_type);
struct HB_Attribute {
HB_AttributeType type;
int start;
int end;
};
typedef enum {
HB_SCRIPT_LATIN
} HB_ShapeScript;
typedef enum {
HB_DIRECTION_LTR,
HB_DIRECTION_RTL,
HB_DIRECTION_TTB
} HB_Direction;
typedef struct _HB_ShapeInput HB_ShapeInput;
struct _HB_ShapeInput {
HB_ShapeFlags flags;
HB_CodePoint *text;
int length;
int shape_offset;
int shape_length;
HB_Direction direction;
HB_ShapeScript script;
HB_Language language;
HB_AttributeType *attributes;
int n_attributes;
HB_RunEdge start_type;
HB_RunEdge end_type;
};
struct HB_GlyphItem {
HB_Glyph glyph;
HB_Fixed x_offset;
HB_Fixed y_offset;
HB_Fixed advance;
};
typedef enum {
HB_RESULT_SUCCESS,
HB_RESULT_NO_MEMORY,
HB_SHAPE_RESULT_FAILED
} HB_Result;
typedef struct _HB_GlyphBuffer HB_GlyphBuffer;
struct _HB_GlyphBuffer {
int glyph_item_size;
int total_glyphs;
int *log_clusters;
int cluster_space;
int glyph_space;
void *glyph_buffer;
};
HB_GlyphBuffer *hb_glyph_buffer_new (size_t item_size);
void hb_glyph_buffer_clear (HB_GlyphBuffer *buf);
HB_Result hb_glyph_buffer_extend_glyphs (HB_GlyphBuffer *buf, int n_items);
HB_Result hb_glyph_buffer_extend_clusters (HB_GlyphBuffer *buf, int n_clusters);
void hb_glyph_buffer_free (HB_GlyphBuffer *buf);
#define HB_GLYPH_BUFFER_ITEM(buffer, index)
HB_Result hb_shape(HB_ShapeInput *input, HB_GlyphBuffer *output);