Add hb-deprecated.h, and rename a couple enum values

Add deprecated alias for old name.
This commit is contained in:
Behdad Esfahbod 2013-08-26 20:39:00 -04:00
parent 2e3a07abdf
commit 4dc798de19
11 changed files with 64 additions and 15 deletions

View File

@ -63,6 +63,7 @@ HBHEADERS = \
hb-blob.h \
hb-buffer.h \
hb-common.h \
hb-deprecated.h \
hb-face.h \
hb-font.h \
hb-set.h \

View File

@ -176,7 +176,7 @@ hb_buffer_t::clear (void)
hb_segment_properties_t default_props = HB_SEGMENT_PROPERTIES_DEFAULT;
props = default_props;
flags = HB_BUFFER_FLAGS_DEFAULT;
flags = HB_BUFFER_FLAG_DEFAULT;
content_type = HB_BUFFER_CONTENT_TYPE_INVALID;
in_error = false;
@ -624,7 +624,7 @@ hb_buffer_get_empty (void)
const_cast<hb_unicode_funcs_t *> (&_hb_unicode_funcs_nil),
HB_SEGMENT_PROPERTIES_DEFAULT,
HB_BUFFER_FLAGS_DEFAULT,
HB_BUFFER_FLAG_DEFAULT,
HB_BUFFER_CONTENT_TYPE_INVALID,
true, /* in_error */

View File

@ -171,8 +171,8 @@ void
hb_buffer_guess_segment_properties (hb_buffer_t *buffer);
typedef enum {
HB_BUFFER_FLAGS_DEFAULT = 0x00000000,
typedef enum { /*< flags >*/
HB_BUFFER_FLAG_DEFAULT = 0x00000000,
HB_BUFFER_FLAG_BOT = 0x00000001, /* Beginning-of-text */
HB_BUFFER_FLAG_EOT = 0x00000002, /* End-of-text */
HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES = 0x00000004
@ -274,8 +274,8 @@ hb_buffer_normalize_glyphs (hb_buffer_t *buffer);
* Serialize
*/
typedef enum {
HB_BUFFER_SERIALIZE_FLAGS_DEFAULT = 0x00000000,
typedef enum { /*< flags >*/
HB_BUFFER_SERIALIZE_FLAG_DEFAULT = 0x00000000,
HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS = 0x00000001,
HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS = 0x00000002,
HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES = 0x00000004

View File

@ -273,11 +273,6 @@ typedef enum
/*---*/ HB_SCRIPT_INVALID = HB_TAG_NONE
} hb_script_t;
#ifndef HB_DISABLE_DEPRECATED
/* Deprecated misspelling. */
#define HB_SCRIPT_CANADIAN_ABORIGINAL HB_SCRIPT_CANADIAN_SYLLABICS
#endif
/* These are moved out of hb_script_t because glib-mkenums chokes otherwise. */
#if 0
/*7.0*/ HB_SCRIPT_BASSA_VAH = HB_TAG ('B','a','s','s'),

51
src/hb-deprecated.h Normal file
View File

@ -0,0 +1,51 @@
/*
* Copyright © 2013 Google, Inc.
*
* This is part of HarfBuzz, a text shaping library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Google Author(s): Behdad Esfahbod
*/
#ifndef HB_H_IN
#error "Include <hb.h> instead."
#endif
#ifndef HB_DEPRECATED_H
#define HB_DEPRECATED_H
#include "hb-common.h"
#include "hb-unicode.h"
#include "hb-font.h"
HB_BEGIN_DECLS
#ifndef HB_DISABLE_DEPRECATED
#define HB_SCRIPT_CANADIAN_ABORIGINAL HB_SCRIPT_CANADIAN_SYLLABICS
#define HB_BUFFER_FLAGS_DEFAULT HB_BUFFER_FLAG_DEFAULT
#define HB_BUFFER_SERIALIZE_FLAGS_DEFAULT HB_BUFFER_SERIALIZE_FLAG_DEFAULT
#endif
HB_END_DECLS
#endif /* HB_DEPRECATED_H */

View File

@ -31,6 +31,7 @@
#include "hb-blob.h"
#include "hb-buffer.h"
#include "hb-common.h"
#include "hb-deprecated.h"
#include "hb-face.h"
#include "hb-font.h"
#include "hb-set.h"

View File

@ -114,7 +114,7 @@ main (int argc, char **argv)
hb_buffer_serialize_glyphs (buf, 0, hb_buffer_get_length (buf),
out, sizeof (out), NULL,
font, HB_BUFFER_SERIALIZE_FORMAT_JSON,
HB_BUFFER_SERIALIZE_FLAGS_DEFAULT);
HB_BUFFER_SERIALIZE_FLAG_DEFAULT);
puts (out);
}

View File

@ -110,7 +110,7 @@ test_buffer_properties (fixture_t *fixture, gconstpointer user_data)
g_assert (hb_buffer_get_direction (b) == HB_DIRECTION_INVALID);
g_assert (hb_buffer_get_script (b) == HB_SCRIPT_INVALID);
g_assert (hb_buffer_get_language (b) == NULL);
g_assert (hb_buffer_get_flags (b) == HB_BUFFER_FLAGS_DEFAULT);
g_assert (hb_buffer_get_flags (b) == HB_BUFFER_FLAG_DEFAULT);
/* test property changes are retained */

View File

@ -9,6 +9,7 @@ MAINTAINERCLEANFILES =
bin_PROGRAMS =
AM_CPPFLAGS = \
-DHB_DISABLE_DEPRECATED \
-I$(top_srcdir)/src/ \
-I$(top_builddir)/src/ \
$(GLIB_CFLAGS) \

View File

@ -60,7 +60,7 @@ struct output_buffer_t
output_format = HB_BUFFER_SERIALIZE_FORMAT_TEXT;
}
unsigned int flags = HB_BUFFER_SERIALIZE_FLAGS_DEFAULT;
unsigned int flags = HB_BUFFER_SERIALIZE_FLAG_DEFAULT;
if (!format.show_glyph_names)
flags |= HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES;
if (!format.show_clusters)

View File

@ -167,7 +167,7 @@ struct shape_options_t : option_group_t
hb_buffer_set_direction (buffer, hb_direction_from_string (direction, -1));
hb_buffer_set_script (buffer, hb_script_from_string (script, -1));
hb_buffer_set_language (buffer, hb_language_from_string (language, -1));
hb_buffer_set_flags (buffer, (hb_buffer_flags_t) (HB_BUFFER_FLAGS_DEFAULT |
hb_buffer_set_flags (buffer, (hb_buffer_flags_t) (HB_BUFFER_FLAG_DEFAULT |
(bot ? HB_BUFFER_FLAG_BOT : 0) |
(eot ? HB_BUFFER_FLAG_EOT : 0) |
(preserve_default_ignorables ? HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES : 0)));