ft-hb-types.h (4139B)
1 /* 2 * Copyright © 2009, 2023 Red Hat, Inc. 3 * Copyright © 2015 Google, Inc. 4 * 5 * Permission is hereby granted, without written agreement and without 6 * license or royalty fees, to use, copy, modify, and distribute this 7 * software and its documentation for any purpose, provided that the 8 * above copyright notice and the following two paragraphs appear in 9 * all copies of this software. 10 * 11 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 12 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 13 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 14 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 15 * DAMAGE. 16 * 17 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 18 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 20 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 21 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 22 * 23 * Red Hat Author(s): Behdad Esfahbod, Matthias Clasen 24 * Google Author(s): Behdad Esfahbod 25 */ 26 27 28 /* This file is a condensed version of the public HarfBuzz header file */ 29 /* `hb-common.h`, also including some additional HarfBuzz declarations */ 30 /* and macros. It allows FreeType to load HarfBuzz dynamically without */ 31 /* actually using its header files. */ 32 33 34 #ifndef FT_HB_TYPES_H 35 #define FT_HB_TYPES_H 36 37 #if defined (_AIX) 38 # include <sys/inttypes.h> 39 #elif defined (_MSC_VER) && _MSC_VER < 1600 40 /* VS 2010 (_MSC_VER 1600) has stdint.h */ 41 typedef __int8 int8_t; 42 typedef unsigned __int8 uint8_t; 43 typedef __int16 int16_t; 44 typedef unsigned __int16 uint16_t; 45 typedef __int32 int32_t; 46 typedef unsigned __int32 uint32_t; 47 typedef __int64 int64_t; 48 typedef unsigned __int64 uint64_t; 49 #elif defined (_MSC_VER) && _MSC_VER < 1800 50 /* VS 2013 (_MSC_VER 1800) has inttypes.h */ 51 # include <stdint.h> 52 #else 53 # include <inttypes.h> 54 #endif 55 #include <stddef.h> 56 57 typedef int hb_bool_t; 58 typedef uint32_t hb_codepoint_t; 59 #define HB_CODEPOINT_INVALID ((hb_codepoint_t) -1) 60 typedef uint32_t hb_tag_t; 61 62 #define HB_TAG(c1,c2,c3,c4) ((hb_tag_t)((((uint32_t)(c1)&0xFF)<<24)|(((uint32_t)(c2)&0xFF)<<16)|(((uint32_t)(c3)&0xFF)<<8)|((uint32_t)(c4)&0xFF))) 63 #define HB_TAG_NONE HB_TAG(0,0,0,0) 64 #define HB_TAG_MAX_SIGNED HB_TAG(0x7f,0xff,0xff,0xff) 65 #define HB_OT_TAG_DEFAULT_SCRIPT HB_TAG ('D', 'F', 'L', 'T') 66 #define HB_OT_TAG_GPOS HB_TAG('G','P','O','S') 67 #define HB_OT_TAG_GSUB HB_TAG('G','S','U','B') 68 69 typedef int32_t hb_position_t; 70 typedef uint32_t hb_mask_t; 71 72 typedef enum { 73 HB_DIRECTION_INVALID = 0, 74 HB_DIRECTION_LTR = 4, 75 HB_DIRECTION_RTL, 76 HB_DIRECTION_TTB, 77 HB_DIRECTION_BTT 78 } hb_direction_t; 79 typedef enum { 80 HB_MEMORY_MODE_DUPLICATE, 81 HB_MEMORY_MODE_READONLY, 82 HB_MEMORY_MODE_WRITABLE, 83 HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE 84 } hb_memory_mode_t; 85 86 #define HB_NO_SINGLE_HEADER_ERROR 87 #include "hb-script-list.h" 88 #undef HB_NO_SINGLE_HEADER_ERROR 89 90 typedef const struct hb_language_impl_t *hb_language_t; 91 #define HB_LANGUAGE_INVALID ((hb_language_t) 0) 92 #define HB_SET_VALUE_INVALID HB_CODEPOINT_INVALID 93 94 typedef struct hb_feature_t { 95 hb_tag_t tag; 96 uint32_t value; 97 unsigned int start; 98 unsigned int end; 99 } hb_feature_t; 100 101 #define HB_FEATURE_GLOBAL_START 0 102 #define HB_FEATURE_GLOBAL_END ((unsigned int) -1) 103 104 typedef struct hb_glyph_info_t { 105 hb_codepoint_t codepoint; 106 hb_mask_t mask; 107 uint32_t cluster; 108 uint32_t var1; 109 uint32_t var2; 110 } hb_glyph_info_t; 111 112 typedef struct hb_glyph_position_t { 113 hb_position_t x_advance; 114 hb_position_t y_advance; 115 hb_position_t x_offset; 116 hb_position_t y_offset; 117 uint32_t var; 118 } hb_glyph_position_t; 119 120 typedef struct hb_blob_t hb_blob_t; 121 typedef struct hb_buffer_t hb_buffer_t; 122 typedef struct hb_face_t hb_face_t; 123 typedef struct hb_font_t hb_font_t; 124 typedef struct hb_set_t hb_set_t; 125 126 typedef void (*hb_destroy_func_t) (void *data); 127 typedef hb_blob_t * (*hb_reference_table_func_t) (hb_face_t *face, hb_tag_t tag, void *user_data); 128 129 #endif /* FT_HB_TYPES_H */