reed@android.com | 5469607 | 2010-04-08 18:48:12 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 1998-2004 David Turner and Werner Lemberg |
| 3 | * Copyright (C) 2004,2007 Red Hat, Inc. |
| 4 | * |
| 5 | * This is part of HarfBuzz, an OpenType Layout engine library. |
| 6 | * |
| 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. |
| 12 | * |
| 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 |
| 26 | */ |
| 27 | |
| 28 | #ifndef HARFBUZZ_BUFFER_PRIVATE_H |
| 29 | #define HARFBUZZ_BUFFER_PRIVATE_H |
| 30 | |
| 31 | #include "harfbuzz-impl.h" |
| 32 | #include "harfbuzz-buffer.h" |
| 33 | |
| 34 | HB_BEGIN_HEADER |
| 35 | |
| 36 | #define HB_GLYPH_PROPERTIES_UNKNOWN 0xFFFF |
| 37 | |
| 38 | HB_INTERNAL void |
| 39 | _hb_buffer_swap( HB_Buffer buffer ); |
| 40 | |
| 41 | HB_INTERNAL void |
| 42 | _hb_buffer_clear_output( HB_Buffer buffer ); |
| 43 | |
| 44 | HB_INTERNAL HB_Error |
| 45 | _hb_buffer_clear_positions( HB_Buffer buffer ); |
| 46 | |
| 47 | HB_INTERNAL HB_Error |
| 48 | _hb_buffer_add_output_glyphs( HB_Buffer buffer, |
| 49 | HB_UShort num_in, |
| 50 | HB_UShort num_out, |
| 51 | HB_UShort *glyph_data, |
| 52 | HB_UShort component, |
| 53 | HB_UShort ligID ); |
| 54 | |
| 55 | HB_INTERNAL HB_Error |
| 56 | _hb_buffer_add_output_glyph ( HB_Buffer buffer, |
| 57 | HB_UInt glyph_index, |
| 58 | HB_UShort component, |
| 59 | HB_UShort ligID ); |
| 60 | |
| 61 | HB_INTERNAL HB_Error |
| 62 | _hb_buffer_copy_output_glyph ( HB_Buffer buffer ); |
| 63 | |
| 64 | HB_INTERNAL HB_Error |
| 65 | _hb_buffer_replace_output_glyph ( HB_Buffer buffer, |
| 66 | HB_UInt glyph_index, |
| 67 | HB_Bool inplace ); |
| 68 | |
| 69 | HB_INTERNAL HB_UShort |
| 70 | _hb_buffer_allocate_ligid( HB_Buffer buffer ); |
| 71 | |
| 72 | |
| 73 | /* convenience macros */ |
| 74 | |
| 75 | #define IN_GLYPH( pos ) (buffer->in_string[(pos)].gindex) |
| 76 | #define IN_ITEM( pos ) (&buffer->in_string[(pos)]) |
| 77 | #define IN_CURGLYPH() (buffer->in_string[buffer->in_pos].gindex) |
| 78 | #define IN_CURITEM() (&buffer->in_string[buffer->in_pos]) |
| 79 | #define IN_PROPERTIES( pos ) (buffer->in_string[(pos)].properties) |
| 80 | #define IN_LIGID( pos ) (buffer->in_string[(pos)].ligID) |
| 81 | #define IN_COMPONENT( pos ) (buffer->in_string[(pos)].component) |
| 82 | #define POSITION( pos ) (&buffer->positions[(pos)]) |
| 83 | #define OUT_GLYPH( pos ) (buffer->out_string[(pos)].gindex) |
| 84 | #define OUT_ITEM( pos ) (&buffer->out_string[(pos)]) |
| 85 | |
| 86 | #define CHECK_Property( gdef, index, flags, property ) \ |
| 87 | ( ( error = _HB_GDEF_Check_Property( (gdef), (index), (flags), \ |
| 88 | (property) ) ) != HB_Err_Ok ) |
| 89 | |
| 90 | #define ADD_String( buffer, num_in, num_out, glyph_data, component, ligID ) \ |
| 91 | ( ( error = _hb_buffer_add_output_glyphs( (buffer), \ |
| 92 | (num_in), (num_out), \ |
| 93 | (glyph_data), (component), (ligID) \ |
| 94 | ) ) != HB_Err_Ok ) |
| 95 | #define ADD_Glyph( buffer, glyph_index, component, ligID ) \ |
| 96 | ( ( error = _hb_buffer_add_output_glyph( (buffer), \ |
| 97 | (glyph_index), (component), (ligID) \ |
| 98 | ) ) != HB_Err_Ok ) |
| 99 | #define REPLACE_Glyph( buffer, glyph_index, nesting_level ) \ |
| 100 | ( ( error = _hb_buffer_replace_output_glyph( (buffer), (glyph_index), \ |
| 101 | (nesting_level) == 1 ) ) != HB_Err_Ok ) |
| 102 | #define COPY_Glyph( buffer ) \ |
| 103 | ( (error = _hb_buffer_copy_output_glyph ( buffer ) ) != HB_Err_Ok ) |
| 104 | |
| 105 | HB_END_HEADER |
| 106 | |
| 107 | #endif /* HARFBUZZ_BUFFER_PRIVATE_H */ |