Behdad Esfahbod | a2a9a02 | 2008-01-15 22:46:32 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 1998-2004 David Turner and Werner Lemberg |
Behdad Esfahbod | 6c78683 | 2009-05-25 03:22:19 -0400 | [diff] [blame] | 3 | * Copyright (C) 2004,2007,2009 Red Hat, Inc. |
Behdad Esfahbod | 6b34713 | 2007-10-11 08:30:50 +0000 | [diff] [blame] | 4 | * |
Behdad Esfahbod | a2a9a02 | 2008-01-15 22:46:32 +0000 | [diff] [blame] | 5 | * This is part of HarfBuzz, an OpenType Layout engine library. |
Behdad Esfahbod | 6b34713 | 2007-10-11 08:30:50 +0000 | [diff] [blame] | 6 | * |
Behdad Esfahbod | a2a9a02 | 2008-01-15 22:46:32 +0000 | [diff] [blame] | 7 | * 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 Esfahbod | 6b34713 | 2007-10-11 08:30:50 +0000 | [diff] [blame] | 12 | * |
Behdad Esfahbod | a2a9a02 | 2008-01-15 22:46:32 +0000 | [diff] [blame] | 13 | * 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 Esfahbod | 6b34713 | 2007-10-11 08:30:50 +0000 | [diff] [blame] | 26 | */ |
Behdad Esfahbod | a2a9a02 | 2008-01-15 22:46:32 +0000 | [diff] [blame] | 27 | |
Behdad Esfahbod | 5c0adce | 2009-05-20 05:42:12 -0400 | [diff] [blame] | 28 | #ifndef HB_BUFFER_PRIVATE_H |
| 29 | #define HB_BUFFER_PRIVATE_H |
Behdad Esfahbod | 6b34713 | 2007-10-11 08:30:50 +0000 | [diff] [blame] | 30 | |
Behdad Esfahbod | 3015c41 | 2009-05-20 06:01:16 -0400 | [diff] [blame] | 31 | #include "hb-private.h" |
Behdad Esfahbod | 5c0adce | 2009-05-20 05:42:12 -0400 | [diff] [blame] | 32 | #include "hb-buffer.h" |
Behdad Esfahbod | 6b34713 | 2007-10-11 08:30:50 +0000 | [diff] [blame] | 33 | |
Behdad Esfahbod | f96ffd4 | 2009-05-24 15:01:16 -0400 | [diff] [blame] | 34 | HB_BEGIN_DECLS |
Behdad Esfahbod | 6b34713 | 2007-10-11 08:30:50 +0000 | [diff] [blame] | 35 | |
Behdad Esfahbod | c968fc2 | 2009-05-25 04:04:24 -0400 | [diff] [blame] | 36 | #define HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN 0xFFFF |
Behdad Esfahbod | 6b34713 | 2007-10-11 08:30:50 +0000 | [diff] [blame] | 37 | |
Behdad Esfahbod | 11fbb54 | 2009-08-01 22:19:06 -0400 | [diff] [blame] | 38 | |
Behdad Esfahbod | f1322e5 | 2009-08-01 22:53:04 -0400 | [diff] [blame^] | 39 | typedef struct _hb_internal_glyph_info_t { |
| 40 | hb_codepoint_t codepoint; |
| 41 | uint32_t properties; |
| 42 | uint32_t cluster; |
| 43 | uint16_t component; |
| 44 | uint16_t lig_id; |
| 45 | uint32_t gproperty; |
| 46 | } hb_internal_glyph_info_t; |
| 47 | |
| 48 | typedef struct _hb_internal_glyph_position_t { |
| 49 | hb_position_t x_pos; |
| 50 | hb_position_t y_pos; |
| 51 | hb_position_t x_advance; |
| 52 | hb_position_t y_advance; |
| 53 | hb_bool_t new_advance :1; /* 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 | unsigned short back : 15; /* number of glyphs to go back |
| 58 | for drawing current glyph */ |
| 59 | short cursive_chain : 16; /* character to which this connects, |
| 60 | may be positive or negative; used |
| 61 | only internally */ |
| 62 | } hb_internal_glyph_position_t; |
| 63 | |
| 64 | ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_internal_glyph_info_t)); |
| 65 | ASSERT_STATIC (sizeof (hb_glyph_position_t) == sizeof (hb_internal_glyph_position_t)); |
| 66 | ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t)); |
| 67 | |
| 68 | |
Behdad Esfahbod | 11fbb54 | 2009-08-01 22:19:06 -0400 | [diff] [blame] | 69 | struct _hb_buffer_t { |
| 70 | hb_reference_count_t ref_count; |
| 71 | |
| 72 | unsigned int allocated; |
| 73 | |
| 74 | unsigned int in_length; |
| 75 | unsigned int out_length; |
| 76 | unsigned int in_pos; |
| 77 | unsigned int out_pos; |
| 78 | |
Behdad Esfahbod | f1322e5 | 2009-08-01 22:53:04 -0400 | [diff] [blame^] | 79 | hb_internal_glyph_info_t *in_string; |
| 80 | hb_internal_glyph_info_t *out_string; |
| 81 | hb_internal_glyph_info_t *alt_string; |
| 82 | hb_internal_glyph_position_t *positions; |
Behdad Esfahbod | 11fbb54 | 2009-08-01 22:19:06 -0400 | [diff] [blame] | 83 | |
| 84 | hb_direction_t direction; |
| 85 | unsigned int max_lig_id; |
| 86 | }; |
| 87 | |
| 88 | |
Behdad Esfahbod | 6b34713 | 2007-10-11 08:30:50 +0000 | [diff] [blame] | 89 | HB_INTERNAL void |
Behdad Esfahbod | 3015c41 | 2009-05-20 06:01:16 -0400 | [diff] [blame] | 90 | _hb_buffer_swap (hb_buffer_t *buffer); |
Behdad Esfahbod | 6b34713 | 2007-10-11 08:30:50 +0000 | [diff] [blame] | 91 | |
| 92 | HB_INTERNAL void |
Behdad Esfahbod | 3015c41 | 2009-05-20 06:01:16 -0400 | [diff] [blame] | 93 | _hb_buffer_clear_output (hb_buffer_t *buffer); |
Behdad Esfahbod | 6b34713 | 2007-10-11 08:30:50 +0000 | [diff] [blame] | 94 | |
Behdad Esfahbod | c968fc2 | 2009-05-25 04:04:24 -0400 | [diff] [blame] | 95 | HB_INTERNAL void |
Behdad Esfahbod | 3015c41 | 2009-05-20 06:01:16 -0400 | [diff] [blame] | 96 | _hb_buffer_add_output_glyphs (hb_buffer_t *buffer, |
| 97 | unsigned int num_in, |
| 98 | unsigned int num_out, |
Behdad Esfahbod | 88a5f5a | 2009-05-25 03:39:11 -0400 | [diff] [blame] | 99 | const uint16_t *glyph_data_be, |
Behdad Esfahbod | 3015c41 | 2009-05-20 06:01:16 -0400 | [diff] [blame] | 100 | unsigned short component, |
| 101 | unsigned short ligID); |
Behdad Esfahbod | 6b34713 | 2007-10-11 08:30:50 +0000 | [diff] [blame] | 102 | |
Behdad Esfahbod | c968fc2 | 2009-05-25 04:04:24 -0400 | [diff] [blame] | 103 | HB_INTERNAL void |
Behdad Esfahbod | 3015c41 | 2009-05-20 06:01:16 -0400 | [diff] [blame] | 104 | _hb_buffer_add_output_glyph (hb_buffer_t *buffer, |
| 105 | hb_codepoint_t glyph_index, |
| 106 | unsigned short component, |
| 107 | unsigned short ligID); |
Behdad Esfahbod | 6b34713 | 2007-10-11 08:30:50 +0000 | [diff] [blame] | 108 | |
Behdad Esfahbod | c968fc2 | 2009-05-25 04:04:24 -0400 | [diff] [blame] | 109 | HB_INTERNAL void |
Behdad Esfahbod | 3015c41 | 2009-05-20 06:01:16 -0400 | [diff] [blame] | 110 | _hb_buffer_next_glyph (hb_buffer_t *buffer); |
Behdad Esfahbod | 6b34713 | 2007-10-11 08:30:50 +0000 | [diff] [blame] | 111 | |
Behdad Esfahbod | c968fc2 | 2009-05-25 04:04:24 -0400 | [diff] [blame] | 112 | HB_INTERNAL void |
Behdad Esfahbod | 3015c41 | 2009-05-20 06:01:16 -0400 | [diff] [blame] | 113 | _hb_buffer_replace_glyph (hb_buffer_t *buffer, |
| 114 | hb_codepoint_t glyph_index); |
Behdad Esfahbod | 6b34713 | 2007-10-11 08:30:50 +0000 | [diff] [blame] | 115 | |
Behdad Esfahbod | 3015c41 | 2009-05-20 06:01:16 -0400 | [diff] [blame] | 116 | HB_INTERNAL unsigned short |
Behdad Esfahbod | c968fc2 | 2009-05-25 04:04:24 -0400 | [diff] [blame] | 117 | _hb_buffer_allocate_lig_id (hb_buffer_t *buffer); |
Behdad Esfahbod | 6b34713 | 2007-10-11 08:30:50 +0000 | [diff] [blame] | 118 | |
Behdad Esfahbod | 78ef65b | 2007-11-07 08:06:01 +0000 | [diff] [blame] | 119 | |
| 120 | /* convenience macros */ |
Behdad Esfahbod | f1322e5 | 2009-08-01 22:53:04 -0400 | [diff] [blame^] | 121 | #define IN_GLYPH(pos) (buffer->in_string[(pos)].codepoint) |
Behdad Esfahbod | c968fc2 | 2009-05-25 04:04:24 -0400 | [diff] [blame] | 122 | #define IN_INFO(pos) (&buffer->in_string[(pos)]) |
Behdad Esfahbod | f1322e5 | 2009-08-01 22:53:04 -0400 | [diff] [blame^] | 123 | #define IN_CURGLYPH() (buffer->in_string[buffer->in_pos].codepoint) |
Behdad Esfahbod | c968fc2 | 2009-05-25 04:04:24 -0400 | [diff] [blame] | 124 | #define IN_CURINFO() (&buffer->in_string[buffer->in_pos]) |
Behdad Esfahbod | 3015c41 | 2009-05-20 06:01:16 -0400 | [diff] [blame] | 125 | #define IN_PROPERTIES(pos) (buffer->in_string[(pos)].properties) |
Behdad Esfahbod | f1322e5 | 2009-08-01 22:53:04 -0400 | [diff] [blame^] | 126 | #define IN_LIGID(pos) (buffer->in_string[(pos)].lig_id) |
Behdad Esfahbod | 3015c41 | 2009-05-20 06:01:16 -0400 | [diff] [blame] | 127 | #define IN_COMPONENT(pos) (buffer->in_string[(pos)].component) |
| 128 | #define POSITION(pos) (&buffer->positions[(pos)]) |
| 129 | #define CURPOSITION() (&buffer->positions[buffer->in_pos]) |
Behdad Esfahbod | f1322e5 | 2009-08-01 22:53:04 -0400 | [diff] [blame^] | 130 | #define OUT_GLYPH(pos) (buffer->out_string[(pos)].codepoint) |
Behdad Esfahbod | c968fc2 | 2009-05-25 04:04:24 -0400 | [diff] [blame] | 131 | #define OUT_INFO(pos) (&buffer->out_string[(pos)]) |
Behdad Esfahbod | 78ef65b | 2007-11-07 08:06:01 +0000 | [diff] [blame] | 132 | |
Behdad Esfahbod | f96ffd4 | 2009-05-24 15:01:16 -0400 | [diff] [blame] | 133 | HB_END_DECLS |
Behdad Esfahbod | 6b34713 | 2007-10-11 08:30:50 +0000 | [diff] [blame] | 134 | |
Behdad Esfahbod | 5c0adce | 2009-05-20 05:42:12 -0400 | [diff] [blame] | 135 | #endif /* HB_BUFFER_PRIVATE_H */ |