Behdad Esfahbod | 3bb300e | 2011-08-11 11:54:31 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2011 Google, Inc. |
| 3 | * |
| 4 | * This is part of HarfBuzz, a text shaping library. |
| 5 | * |
| 6 | * Permission is hereby granted, without written agreement and without |
| 7 | * license or royalty fees, to use, copy, modify, and distribute this |
| 8 | * software and its documentation for any purpose, provided that the |
| 9 | * above copyright notice and the following two paragraphs appear in |
| 10 | * all copies of this software. |
| 11 | * |
| 12 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR |
| 13 | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
| 14 | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN |
| 15 | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
| 16 | * DAMAGE. |
| 17 | * |
| 18 | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
| 19 | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
| 20 | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
| 21 | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO |
| 22 | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 23 | * |
| 24 | * Google Author(s): Behdad Esfahbod |
| 25 | */ |
| 26 | |
Behdad Esfahbod | 3bb300e | 2011-08-11 11:54:31 +0200 | [diff] [blame] | 27 | #ifndef OPTIONS_HH |
| 28 | #define OPTIONS_HH |
| 29 | |
| 30 | |
Behdad Esfahbod | 8b8b190 | 2011-09-19 16:41:17 -0400 | [diff] [blame] | 31 | #ifdef HAVE_CONFIG_H |
| 32 | #include "config.h" |
| 33 | #endif |
| 34 | |
| 35 | #include <stdlib.h> |
| 36 | #include <stddef.h> |
| 37 | #include <string.h> |
Behdad Esfahbod | 8b8b190 | 2011-09-19 16:41:17 -0400 | [diff] [blame] | 38 | #include <stdio.h> |
| 39 | #include <math.h> |
| 40 | #include <locale.h> |
| 41 | #include <errno.h> |
| 42 | #include <fcntl.h> |
Behdad Esfahbod | 52e7b14 | 2012-05-13 02:02:58 +0200 | [diff] [blame] | 43 | #ifdef HAVE_UNISTD_H |
| 44 | #include <unistd.h> /* for isatty() */ |
| 45 | #endif |
Behdad Esfahbod | 8b8b190 | 2011-09-19 16:41:17 -0400 | [diff] [blame] | 46 | #ifdef HAVE_IO_H |
| 47 | #include <io.h> /* for _setmode() under Windows */ |
| 48 | #endif |
| 49 | |
| 50 | #include <hb.h> |
Behdad Esfahbod | c87b317 | 2012-05-15 23:53:18 -0400 | [diff] [blame] | 51 | #ifdef HAVE_OT |
| 52 | #include <hb-ot.h> |
| 53 | #endif |
Behdad Esfahbod | 8b8b190 | 2011-09-19 16:41:17 -0400 | [diff] [blame] | 54 | #include <glib.h> |
| 55 | #include <glib/gprintf.h> |
| 56 | |
Behdad Esfahbod | 69b84a8 | 2012-04-12 15:50:40 -0400 | [diff] [blame] | 57 | #undef MIN |
| 58 | template <typename Type> static inline Type MIN (const Type &a, const Type &b) { return a < b ? a : b; } |
| 59 | |
| 60 | #undef MAX |
| 61 | template <typename Type> static inline Type MAX (const Type &a, const Type &b) { return a > b ? a : b; } |
| 62 | |
| 63 | |
Behdad Esfahbod | 8b8b190 | 2011-09-19 16:41:17 -0400 | [diff] [blame] | 64 | void fail (hb_bool_t suggest_help, const char *format, ...) G_GNUC_NORETURN; |
| 65 | |
| 66 | |
Behdad Esfahbod | 088c1e2 | 2011-09-20 14:43:55 -0400 | [diff] [blame] | 67 | extern hb_bool_t debug; |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 68 | |
| 69 | struct option_group_t |
| 70 | { |
| 71 | virtual void add_options (struct option_parser_t *parser) = 0; |
| 72 | |
| 73 | virtual void pre_parse (GError **error G_GNUC_UNUSED) {}; |
| 74 | virtual void post_parse (GError **error G_GNUC_UNUSED) {}; |
| 75 | }; |
| 76 | |
| 77 | |
| 78 | struct option_parser_t |
| 79 | { |
| 80 | option_parser_t (const char *usage) { |
| 81 | memset (this, 0, sizeof (*this)); |
| 82 | usage_str = usage; |
| 83 | context = g_option_context_new (usage); |
| 84 | |
| 85 | add_main_options (); |
| 86 | } |
| 87 | ~option_parser_t (void) { |
| 88 | g_option_context_free (context); |
| 89 | } |
| 90 | |
| 91 | void add_main_options (void); |
| 92 | |
| 93 | void add_group (GOptionEntry *entries, |
| 94 | const gchar *name, |
| 95 | const gchar *description, |
| 96 | const gchar *help_description, |
| 97 | option_group_t *option_group); |
| 98 | |
| 99 | void parse (int *argc, char ***argv); |
| 100 | |
| 101 | G_GNUC_NORETURN void usage (void) { |
| 102 | g_printerr ("Usage: %s [OPTION...] %s\n", g_get_prgname (), usage_str); |
| 103 | exit (1); |
| 104 | } |
| 105 | |
| 106 | const char *usage_str; |
| 107 | GOptionContext *context; |
| 108 | }; |
| 109 | |
| 110 | |
Behdad Esfahbod | 912c5ff | 2012-05-13 12:51:02 +0200 | [diff] [blame] | 111 | #define DEFAULT_MARGIN 16 |
Behdad Esfahbod | 109cb38 | 2011-09-08 16:00:04 -0400 | [diff] [blame] | 112 | #define DEFAULT_FORE "#000000" |
| 113 | #define DEFAULT_BACK "#FFFFFF" |
Behdad Esfahbod | 2097951 | 2012-05-12 15:41:48 +0200 | [diff] [blame] | 114 | #define DEFAULT_FONT_SIZE 256 |
Behdad Esfahbod | 109cb38 | 2011-09-08 16:00:04 -0400 | [diff] [blame] | 115 | |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 116 | struct view_options_t : option_group_t |
Behdad Esfahbod | 3bb300e | 2011-08-11 11:54:31 +0200 | [diff] [blame] | 117 | { |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 118 | view_options_t (option_parser_t *parser) { |
| 119 | annotate = false; |
Behdad Esfahbod | 109cb38 | 2011-09-08 16:00:04 -0400 | [diff] [blame] | 120 | fore = DEFAULT_FORE; |
| 121 | back = DEFAULT_BACK; |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 122 | line_space = 0; |
Behdad Esfahbod | 109cb38 | 2011-09-08 16:00:04 -0400 | [diff] [blame] | 123 | margin.t = margin.r = margin.b = margin.l = DEFAULT_MARGIN; |
Behdad Esfahbod | 11e5199 | 2011-09-19 09:58:55 -0400 | [diff] [blame] | 124 | font_size = DEFAULT_FONT_SIZE; |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 125 | |
| 126 | add_options (parser); |
Behdad Esfahbod | 3bb300e | 2011-08-11 11:54:31 +0200 | [diff] [blame] | 127 | } |
| 128 | |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 129 | void add_options (option_parser_t *parser); |
Behdad Esfahbod | bc4b07b | 2011-09-08 17:08:32 -0400 | [diff] [blame] | 130 | |
Behdad Esfahbod | 088c1e2 | 2011-09-20 14:43:55 -0400 | [diff] [blame] | 131 | hb_bool_t annotate; |
Behdad Esfahbod | 3bb300e | 2011-08-11 11:54:31 +0200 | [diff] [blame] | 132 | const char *fore; |
| 133 | const char *back; |
| 134 | double line_space; |
| 135 | struct margin_t { |
| 136 | double t, r, b, l; |
| 137 | } margin; |
Behdad Esfahbod | 11e5199 | 2011-09-19 09:58:55 -0400 | [diff] [blame] | 138 | double font_size; |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 139 | }; |
Behdad Esfahbod | 3bb300e | 2011-08-11 11:54:31 +0200 | [diff] [blame] | 140 | |
Behdad Esfahbod | 109cb38 | 2011-09-08 16:00:04 -0400 | [diff] [blame] | 141 | |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 142 | struct shape_options_t : option_group_t |
Behdad Esfahbod | 3bb300e | 2011-08-11 11:54:31 +0200 | [diff] [blame] | 143 | { |
Behdad Esfahbod | ae62166 | 2012-06-02 12:21:19 -0400 | [diff] [blame] | 144 | shape_options_t (option_parser_t *parser) |
| 145 | { |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 146 | direction = language = script = NULL; |
| 147 | features = NULL; |
| 148 | num_features = 0; |
| 149 | shapers = NULL; |
Behdad Esfahbod | 95cefdf | 2012-04-16 18:08:20 -0400 | [diff] [blame] | 150 | utf8_clusters = false; |
Behdad Esfahbod | 39b1783 | 2012-07-17 17:09:29 -0400 | [diff] [blame] | 151 | normalize_glyphs = false; |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 152 | |
| 153 | add_options (parser); |
Behdad Esfahbod | 3bb300e | 2011-08-11 11:54:31 +0200 | [diff] [blame] | 154 | } |
Behdad Esfahbod | ae62166 | 2012-06-02 12:21:19 -0400 | [diff] [blame] | 155 | ~shape_options_t (void) |
| 156 | { |
Behdad Esfahbod | 90e312c | 2011-09-08 16:42:37 -0400 | [diff] [blame] | 157 | free (features); |
| 158 | g_free (shapers); |
| 159 | } |
Behdad Esfahbod | 3bb300e | 2011-08-11 11:54:31 +0200 | [diff] [blame] | 160 | |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 161 | void add_options (option_parser_t *parser); |
Behdad Esfahbod | bc4b07b | 2011-09-08 17:08:32 -0400 | [diff] [blame] | 162 | |
Behdad Esfahbod | ae62166 | 2012-06-02 12:21:19 -0400 | [diff] [blame] | 163 | void setup_buffer (hb_buffer_t *buffer) |
| 164 | { |
Behdad Esfahbod | 516857e | 2011-09-08 16:50:24 -0400 | [diff] [blame] | 165 | hb_buffer_set_direction (buffer, hb_direction_from_string (direction, -1)); |
| 166 | hb_buffer_set_script (buffer, hb_script_from_string (script, -1)); |
| 167 | hb_buffer_set_language (buffer, hb_language_from_string (language, -1)); |
Behdad Esfahbod | 4f4b114 | 2011-09-08 16:49:02 -0400 | [diff] [blame] | 168 | } |
| 169 | |
Behdad Esfahbod | ae62166 | 2012-06-02 12:21:19 -0400 | [diff] [blame] | 170 | void populate_buffer (hb_buffer_t *buffer, const char *text, int text_len) |
| 171 | { |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 172 | hb_buffer_reset (buffer); |
| 173 | hb_buffer_add_utf8 (buffer, text, text_len, 0, text_len); |
Behdad Esfahbod | d530024 | 2012-01-21 19:07:22 -0500 | [diff] [blame] | 174 | |
Behdad Esfahbod | 95cefdf | 2012-04-16 18:08:20 -0400 | [diff] [blame] | 175 | if (!utf8_clusters) { |
| 176 | /* Reset cluster values to refer to Unicode character index |
| 177 | * instead of UTF-8 index. */ |
| 178 | unsigned int num_glyphs = hb_buffer_get_length (buffer); |
| 179 | hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, NULL); |
| 180 | for (unsigned int i = 0; i < num_glyphs; i++) |
| 181 | { |
| 182 | info->cluster = i; |
| 183 | info++; |
| 184 | } |
Behdad Esfahbod | d530024 | 2012-01-21 19:07:22 -0500 | [diff] [blame] | 185 | } |
| 186 | |
Behdad Esfahbod | 4f4b114 | 2011-09-08 16:49:02 -0400 | [diff] [blame] | 187 | setup_buffer (buffer); |
Behdad Esfahbod | ae62166 | 2012-06-02 12:21:19 -0400 | [diff] [blame] | 188 | } |
| 189 | |
| 190 | hb_bool_t shape (hb_font_t *font, hb_buffer_t *buffer) |
| 191 | { |
Behdad Esfahbod | 39b1783 | 2012-07-17 17:09:29 -0400 | [diff] [blame] | 192 | hb_bool_t res = hb_shape_full (font, buffer, features, num_features, shapers); |
| 193 | if (normalize_glyphs) |
| 194 | hb_buffer_normalize_glyphs (buffer); |
| 195 | return res; |
Behdad Esfahbod | 4f4b114 | 2011-09-08 16:49:02 -0400 | [diff] [blame] | 196 | } |
| 197 | |
Behdad Esfahbod | c87b317 | 2012-05-15 23:53:18 -0400 | [diff] [blame] | 198 | void shape_closure (const char *text, int text_len, |
| 199 | hb_font_t *font, hb_buffer_t *buffer, |
Behdad Esfahbod | ae62166 | 2012-06-02 12:21:19 -0400 | [diff] [blame] | 200 | hb_set_t *glyphs) |
| 201 | { |
Behdad Esfahbod | c87b317 | 2012-05-15 23:53:18 -0400 | [diff] [blame] | 202 | hb_buffer_reset (buffer); |
| 203 | hb_buffer_add_utf8 (buffer, text, text_len, 0, text_len); |
| 204 | setup_buffer (buffer); |
| 205 | hb_ot_shape_glyphs_closure (font, buffer, features, num_features, glyphs); |
| 206 | } |
| 207 | |
Behdad Esfahbod | 3bb300e | 2011-08-11 11:54:31 +0200 | [diff] [blame] | 208 | const char *direction; |
| 209 | const char *language; |
| 210 | const char *script; |
| 211 | hb_feature_t *features; |
| 212 | unsigned int num_features; |
| 213 | char **shapers; |
Behdad Esfahbod | 95cefdf | 2012-04-16 18:08:20 -0400 | [diff] [blame] | 214 | hb_bool_t utf8_clusters; |
Behdad Esfahbod | 39b1783 | 2012-07-17 17:09:29 -0400 | [diff] [blame] | 215 | hb_bool_t normalize_glyphs; |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 216 | }; |
Behdad Esfahbod | 3bb300e | 2011-08-11 11:54:31 +0200 | [diff] [blame] | 217 | |
Behdad Esfahbod | 109cb38 | 2011-09-08 16:00:04 -0400 | [diff] [blame] | 218 | |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 219 | struct font_options_t : option_group_t |
Behdad Esfahbod | 3bb300e | 2011-08-11 11:54:31 +0200 | [diff] [blame] | 220 | { |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 221 | font_options_t (option_parser_t *parser) { |
| 222 | font_file = NULL; |
| 223 | face_index = 0; |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 224 | |
| 225 | font = NULL; |
| 226 | |
| 227 | add_options (parser); |
| 228 | } |
| 229 | ~font_options_t (void) { |
| 230 | hb_font_destroy (font); |
Behdad Esfahbod | 3bb300e | 2011-08-11 11:54:31 +0200 | [diff] [blame] | 231 | } |
| 232 | |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 233 | void add_options (option_parser_t *parser); |
| 234 | |
| 235 | hb_font_t *get_font (void) const; |
Behdad Esfahbod | bc4b07b | 2011-09-08 17:08:32 -0400 | [diff] [blame] | 236 | |
Behdad Esfahbod | 3bb300e | 2011-08-11 11:54:31 +0200 | [diff] [blame] | 237 | const char *font_file; |
| 238 | int face_index; |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 239 | |
| 240 | private: |
| 241 | mutable hb_font_t *font; |
| 242 | }; |
Behdad Esfahbod | 3bb300e | 2011-08-11 11:54:31 +0200 | [diff] [blame] | 243 | |
| 244 | |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 245 | struct text_options_t : option_group_t |
| 246 | { |
| 247 | text_options_t (option_parser_t *parser) { |
| 248 | text = NULL; |
| 249 | text_file = NULL; |
Behdad Esfahbod | 3bb300e | 2011-08-11 11:54:31 +0200 | [diff] [blame] | 250 | |
Behdad Esfahbod | 55aeb04 | 2011-09-16 02:08:36 -0400 | [diff] [blame] | 251 | fp = NULL; |
| 252 | gs = NULL; |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 253 | text_len = (unsigned int) -1; |
| 254 | |
| 255 | add_options (parser); |
| 256 | } |
| 257 | ~text_options_t (void) { |
Behdad Esfahbod | 55aeb04 | 2011-09-16 02:08:36 -0400 | [diff] [blame] | 258 | if (gs) |
Behdad Esfahbod | 0594a24 | 2012-06-05 20:35:40 -0400 | [diff] [blame] | 259 | g_string_free (gs, true); |
Behdad Esfahbod | 55aeb04 | 2011-09-16 02:08:36 -0400 | [diff] [blame] | 260 | if (fp) |
| 261 | fclose (fp); |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | void add_options (option_parser_t *parser); |
| 265 | |
| 266 | void post_parse (GError **error G_GNUC_UNUSED) { |
| 267 | if (text && text_file) |
| 268 | g_set_error (error, |
| 269 | G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, |
Behdad Esfahbod | 30874b4 | 2012-05-12 15:54:27 +0200 | [diff] [blame] | 270 | "Only one of text and text-file can be set"); |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 271 | |
| 272 | }; |
| 273 | |
| 274 | const char *get_line (unsigned int *len); |
| 275 | |
| 276 | const char *text; |
| 277 | const char *text_file; |
| 278 | |
| 279 | private: |
Behdad Esfahbod | 55aeb04 | 2011-09-16 02:08:36 -0400 | [diff] [blame] | 280 | FILE *fp; |
| 281 | GString *gs; |
| 282 | unsigned int text_len; |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 283 | }; |
| 284 | |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 285 | struct output_options_t : option_group_t |
| 286 | { |
| 287 | output_options_t (option_parser_t *parser) { |
| 288 | output_file = NULL; |
| 289 | output_format = NULL; |
| 290 | |
Behdad Esfahbod | f7e2ef7 | 2011-09-15 17:52:00 -0400 | [diff] [blame] | 291 | fp = NULL; |
| 292 | |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 293 | add_options (parser); |
| 294 | } |
Behdad Esfahbod | f7e2ef7 | 2011-09-15 17:52:00 -0400 | [diff] [blame] | 295 | ~output_options_t (void) { |
Behdad Esfahbod | 55aeb04 | 2011-09-16 02:08:36 -0400 | [diff] [blame] | 296 | if (fp) |
Behdad Esfahbod | f7e2ef7 | 2011-09-15 17:52:00 -0400 | [diff] [blame] | 297 | fclose (fp); |
| 298 | } |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 299 | |
| 300 | void add_options (option_parser_t *parser); |
| 301 | |
| 302 | void post_parse (GError **error G_GNUC_UNUSED) |
| 303 | { |
| 304 | if (output_file && !output_format) { |
| 305 | output_format = strrchr (output_file, '.'); |
| 306 | if (output_format) |
| 307 | output_format++; /* skip the dot */ |
| 308 | } |
| 309 | |
Behdad Esfahbod | f7e2ef7 | 2011-09-15 17:52:00 -0400 | [diff] [blame] | 310 | if (output_file && 0 == strcmp (output_file, "-")) |
| 311 | output_file = NULL; /* STDOUT */ |
| 312 | } |
| 313 | |
Behdad Esfahbod | a75c1b1 | 2011-09-16 01:16:41 -0400 | [diff] [blame] | 314 | FILE *get_file_handle (void); |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 315 | |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 316 | const char *output_file; |
| 317 | const char *output_format; |
Behdad Esfahbod | f7e2ef7 | 2011-09-15 17:52:00 -0400 | [diff] [blame] | 318 | |
| 319 | mutable FILE *fp; |
Behdad Esfahbod | b9b10ad | 2011-09-13 13:30:39 -0400 | [diff] [blame] | 320 | }; |
Behdad Esfahbod | 3bb300e | 2011-08-11 11:54:31 +0200 | [diff] [blame] | 321 | |
Behdad Esfahbod | 8b8b190 | 2011-09-19 16:41:17 -0400 | [diff] [blame] | 322 | struct format_options_t : option_group_t |
| 323 | { |
| 324 | format_options_t (option_parser_t *parser) { |
| 325 | show_glyph_names = true; |
| 326 | show_positions = true; |
| 327 | show_clusters = true; |
Behdad Esfahbod | cc4d981 | 2012-01-19 12:32:20 -0500 | [diff] [blame] | 328 | show_text = false; |
| 329 | show_unicode = false; |
Behdad Esfahbod | cdc673d | 2012-01-19 12:46:18 -0500 | [diff] [blame] | 330 | show_line_num = false; |
Behdad Esfahbod | 8b8b190 | 2011-09-19 16:41:17 -0400 | [diff] [blame] | 331 | |
| 332 | add_options (parser); |
| 333 | } |
Behdad Esfahbod | 8b8b190 | 2011-09-19 16:41:17 -0400 | [diff] [blame] | 334 | |
| 335 | void add_options (option_parser_t *parser); |
| 336 | |
Behdad Esfahbod | cdc673d | 2012-01-19 12:46:18 -0500 | [diff] [blame] | 337 | void serialize_unicode (hb_buffer_t *buffer, |
| 338 | GString *gs); |
| 339 | void serialize_glyphs (hb_buffer_t *buffer, |
| 340 | hb_font_t *font, |
Behdad Esfahbod | 95cefdf | 2012-04-16 18:08:20 -0400 | [diff] [blame] | 341 | hb_bool_t utf8_clusters, |
Behdad Esfahbod | cdc673d | 2012-01-19 12:46:18 -0500 | [diff] [blame] | 342 | GString *gs); |
| 343 | void serialize_line_no (unsigned int line_no, |
| 344 | GString *gs); |
Behdad Esfahbod | 5db0683 | 2012-06-02 12:13:08 -0400 | [diff] [blame] | 345 | void serialize_buffer_of_text (hb_buffer_t *buffer, |
| 346 | unsigned int line_no, |
| 347 | const char *text, |
| 348 | unsigned int text_len, |
| 349 | hb_font_t *font, |
| 350 | hb_bool_t utf8_clusters, |
| 351 | GString *gs); |
| 352 | void serialize_message (unsigned int line_no, |
| 353 | const char *msg, |
| 354 | GString *gs); |
| 355 | void serialize_buffer_of_glyphs (hb_buffer_t *buffer, |
| 356 | unsigned int line_no, |
| 357 | const char *text, |
| 358 | unsigned int text_len, |
| 359 | hb_font_t *font, |
| 360 | hb_bool_t utf8_clusters, |
| 361 | GString *gs); |
Behdad Esfahbod | cdc673d | 2012-01-19 12:46:18 -0500 | [diff] [blame] | 362 | |
Behdad Esfahbod | 8b8b190 | 2011-09-19 16:41:17 -0400 | [diff] [blame] | 363 | |
Behdad Esfahbod | 088c1e2 | 2011-09-20 14:43:55 -0400 | [diff] [blame] | 364 | hb_bool_t show_glyph_names; |
| 365 | hb_bool_t show_positions; |
| 366 | hb_bool_t show_clusters; |
Behdad Esfahbod | cc4d981 | 2012-01-19 12:32:20 -0500 | [diff] [blame] | 367 | hb_bool_t show_text; |
| 368 | hb_bool_t show_unicode; |
Behdad Esfahbod | cdc673d | 2012-01-19 12:46:18 -0500 | [diff] [blame] | 369 | hb_bool_t show_line_num; |
Behdad Esfahbod | 8b8b190 | 2011-09-19 16:41:17 -0400 | [diff] [blame] | 370 | }; |
| 371 | |
Behdad Esfahbod | 3bb300e | 2011-08-11 11:54:31 +0200 | [diff] [blame] | 372 | |
| 373 | #endif |