blob: 4e130883b07b196373b90f2b1fcb0f386d8f0939 [file] [log] [blame]
Behdad Esfahboda2a9a022008-01-15 22:46:32 +00001/*
2 * Copyright (C) 1998-2004 David Turner and Werner Lemberg
Behdad Esfahbod6c786832009-05-25 03:22:19 -04003 * Copyright (C) 2004,2007,2009 Red Hat, Inc.
Behdad Esfahbod9f8da382006-03-31 12:28:09 +00004 *
Behdad Esfahboda2a9a022008-01-15 22:46:32 +00005 * This is part of HarfBuzz, an OpenType Layout engine library.
Behdad Esfahbod9f8da382006-03-31 12:28:09 +00006 *
Behdad Esfahboda2a9a022008-01-15 22:46:32 +00007 * Permission is hereby granted, without written agreement and without
8 * license or royalty fees, to use, copy, modify, and distribute this
9 * software and its documentation for any purpose, provided that the
10 * above copyright notice and the following two paragraphs appear in
11 * all copies of this software.
Behdad Esfahbod9f8da382006-03-31 12:28:09 +000012 *
Behdad Esfahboda2a9a022008-01-15 22:46:32 +000013 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
14 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
15 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
16 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
17 * DAMAGE.
18 *
19 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
20 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
22 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
23 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24 *
25 * Red Hat Author(s): Owen Taylor, Behdad Esfahbod
Behdad Esfahbod9f8da382006-03-31 12:28:09 +000026 */
Behdad Esfahboda2a9a022008-01-15 22:46:32 +000027
Behdad Esfahbod5c0adce2009-05-20 05:42:12 -040028#ifndef HB_BUFFER_H
29#define HB_BUFFER_H
Behdad Esfahbod9f8da382006-03-31 12:28:09 +000030
Behdad Esfahbodb857b492009-05-20 05:35:14 -040031#include "hb-common.h"
Behdad Esfahbod9f8da382006-03-31 12:28:09 +000032
Behdad Esfahbodf96ffd42009-05-24 15:01:16 -040033HB_BEGIN_DECLS
Behdad Esfahbod9f8da382006-03-31 12:28:09 +000034
Behdad Esfahbodd9d2a072009-05-25 03:24:19 -040035/* XXX Hide structs? */
36
Behdad Esfahbod9f8da382006-03-31 12:28:09 +000037typedef struct HB_GlyphItemRec_ {
Behdad Esfahbodb857b492009-05-20 05:35:14 -040038 hb_codepoint_t gindex;
39 unsigned int properties;
40 unsigned int cluster;
41 unsigned short component;
42 unsigned short ligID;
43 unsigned short gproperty;
Behdad Esfahbod9f8da382006-03-31 12:28:09 +000044} HB_GlyphItemRec, *HB_GlyphItem;
45
46typedef struct HB_PositionRec_ {
Behdad Esfahbodb857b492009-05-20 05:35:14 -040047 hb_position_t x_pos;
48 hb_position_t y_pos;
49 hb_position_t x_advance;
50 hb_position_t y_advance;
51 unsigned short back; /* number of glyphs to go back
52 for drawing current glyph */
53 hb_bool_t new_advance; /* if set, the advance width values are
54 absolute, i.e., they won't be
55 added to the original glyph's value
56 but rather replace them. */
57 short cursive_chain; /* character to which this connects,
58 may be positive or negative; used
59 only internally */
Behdad Esfahbod9f8da382006-03-31 12:28:09 +000060} HB_PositionRec, *HB_Position;
61
62
Behdad Esfahbodb857b492009-05-20 05:35:14 -040063typedef struct _hb_buffer_t {
64 unsigned int allocated;
Behdad Esfahbod9f8da382006-03-31 12:28:09 +000065
Behdad Esfahbodb857b492009-05-20 05:35:14 -040066 unsigned int in_length;
67 unsigned int out_length;
68 unsigned int in_pos;
69 unsigned int out_pos;
Behdad Esfahbod5c0adce2009-05-20 05:42:12 -040070
Behdad Esfahbodb857b492009-05-20 05:35:14 -040071 hb_bool_t separate_out;
Behdad Esfahbod9f8da382006-03-31 12:28:09 +000072 HB_GlyphItem in_string;
73 HB_GlyphItem out_string;
Behdad Esfahboda8abb8b2007-10-11 00:07:58 +000074 HB_GlyphItem alt_string;
Behdad Esfahbod9f8da382006-03-31 12:28:09 +000075 HB_Position positions;
Behdad Esfahbodb857b492009-05-20 05:35:14 -040076 unsigned int max_ligID;
77} HB_BufferRec, *HB_Buffer, hb_buffer_t;
Behdad Esfahbod9f8da382006-03-31 12:28:09 +000078
Behdad Esfahbodb857b492009-05-20 05:35:14 -040079hb_buffer_t *
80hb_buffer_new (void);
Behdad Esfahbod9f8da382006-03-31 12:28:09 +000081
Behdad Esfahboda8abb8b2007-10-11 00:07:58 +000082void
Behdad Esfahbodb857b492009-05-20 05:35:14 -040083hb_buffer_free (hb_buffer_t *buffer);
Behdad Esfahbod9f8da382006-03-31 12:28:09 +000084
Behdad Esfahboda8abb8b2007-10-11 00:07:58 +000085void
Behdad Esfahbodb857b492009-05-20 05:35:14 -040086hb_buffer_clear (hb_buffer_t *buffer);
Behdad Esfahbod9f8da382006-03-31 12:28:09 +000087
Behdad Esfahbodb857b492009-05-20 05:35:14 -040088void
89hb_buffer_add_glyph (hb_buffer_t *buffer,
90 hb_codepoint_t glyph_index,
91 unsigned int properties,
92 unsigned int cluster);
Behdad Esfahbod9f8da382006-03-31 12:28:09 +000093
Behdad Esfahbodf96ffd42009-05-24 15:01:16 -040094HB_END_DECLS
Behdad Esfahbod9f8da382006-03-31 12:28:09 +000095
Behdad Esfahbod5c0adce2009-05-20 05:42:12 -040096#endif /* HB_BUFFER_H */