Merge branch 'master' into cff-subset

This commit is contained in:
Michiharu Ariza 2018-10-09 10:10:35 -07:00
commit f5f505b512
24 changed files with 117 additions and 93 deletions

View File

@ -574,7 +574,7 @@ if (HB_HAVE_GOBJECT)
endif () endif ()
if (BUILD_SHARED_LIBS AND WIN32 AND NOT MINGW) if (BUILD_SHARED_LIBS AND WIN32 AND NOT MINGW)
add_definitions("-DHB_EXTERN=__declspec(dllexport) extern") add_definitions("-DHB_DLL_EXPORT")
endif () endif ()
# On Windows, g-ir-scanner requires a DLL build in order for it to work # On Windows, g-ir-scanner requires a DLL build in order for it to work
@ -772,6 +772,11 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/harfbuzz DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/harfbuzz
) )
if (HB_BUILD_UTILS) if (HB_BUILD_UTILS)
if (WIN32 AND BUILD_SHARED_LIBS)
install(TARGETS harfbuzz-subset
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif ()
install(TARGETS hb-view install(TARGETS hb-view
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
) )

View File

@ -13,7 +13,7 @@ TESTS =
check_PROGRAMS = check_PROGRAMS =
# Convenience targets: # Convenience targets:
lib: $(BUILT_SOURCES) libharfbuzz.la libharfbuzz-subset.la lib: $(BUILT_SOURCES) libharfbuzz.la
libs: $(BUILT_SOURCES) $(lib_LTLIBRARIES) libs: $(BUILT_SOURCES) $(lib_LTLIBRARIES)
fuzzing: $(BUILT_SOURCES) libharfbuzz-fuzzing.la libharfbuzz-subset-fuzzing.la fuzzing: $(BUILT_SOURCES) libharfbuzz-fuzzing.la libharfbuzz-subset-fuzzing.la

View File

@ -212,7 +212,7 @@ struct KerxSubTableFormat6
struct KerxTable struct KerxTable
{ {
friend kerx; friend struct kerx;
inline unsigned int get_size (void) const { return length; } inline unsigned int get_size (void) const { return length; }
inline unsigned int get_type (void) const { return coverage & SubtableType; } inline unsigned int get_type (void) const { return coverage & SubtableType; }

View File

@ -179,7 +179,7 @@ static void
hb_font_get_glyph_h_advances_default (hb_font_t* font, hb_font_get_glyph_h_advances_default (hb_font_t* font,
void* font_data HB_UNUSED, void* font_data HB_UNUSED,
unsigned int count, unsigned int count,
hb_codepoint_t *first_glyph, const hb_codepoint_t *first_glyph,
unsigned int glyph_stride, unsigned int glyph_stride,
hb_position_t *first_advance, hb_position_t *first_advance,
unsigned int advance_stride, unsigned int advance_stride,
@ -211,7 +211,7 @@ static void
hb_font_get_glyph_v_advances_default (hb_font_t* font, hb_font_get_glyph_v_advances_default (hb_font_t* font,
void* font_data HB_UNUSED, void* font_data HB_UNUSED,
unsigned int count, unsigned int count,
hb_codepoint_t *first_glyph, const hb_codepoint_t *first_glyph,
unsigned int glyph_stride, unsigned int glyph_stride,
hb_position_t *first_advance, hb_position_t *first_advance,
unsigned int advance_stride, unsigned int advance_stride,
@ -808,7 +808,7 @@ hb_font_get_glyph_v_advance (hb_font_t *font,
void void
hb_font_get_glyph_h_advances (hb_font_t* font, hb_font_get_glyph_h_advances (hb_font_t* font,
unsigned count, unsigned count,
hb_codepoint_t *first_glyph, const hb_codepoint_t *first_glyph,
unsigned glyph_stride, unsigned glyph_stride,
hb_position_t *first_advance, hb_position_t *first_advance,
unsigned advance_stride) unsigned advance_stride)
@ -826,7 +826,7 @@ hb_font_get_glyph_h_advances (hb_font_t* font,
void void
hb_font_get_glyph_v_advances (hb_font_t* font, hb_font_get_glyph_v_advances (hb_font_t* font,
unsigned count, unsigned count,
hb_codepoint_t *first_glyph, const hb_codepoint_t *first_glyph,
unsigned glyph_stride, unsigned glyph_stride,
hb_position_t *first_advance, hb_position_t *first_advance,
unsigned advance_stride) unsigned advance_stride)
@ -1053,7 +1053,7 @@ HB_EXTERN void
hb_font_get_glyph_advances_for_direction (hb_font_t* font, hb_font_get_glyph_advances_for_direction (hb_font_t* font,
hb_direction_t direction, hb_direction_t direction,
unsigned count, unsigned count,
hb_codepoint_t *first_glyph, const hb_codepoint_t *first_glyph,
unsigned glyph_stride, unsigned glyph_stride,
hb_position_t *first_advance, hb_position_t *first_advance,
unsigned advance_stride) unsigned advance_stride)

View File

@ -134,7 +134,7 @@ typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_v_advance_func_t;
typedef void (*hb_font_get_glyph_advances_func_t) (hb_font_t* font, void* font_data, typedef void (*hb_font_get_glyph_advances_func_t) (hb_font_t* font, void* font_data,
unsigned count, unsigned count,
hb_codepoint_t *first_glyph, const hb_codepoint_t *first_glyph,
unsigned glyph_stride, unsigned glyph_stride,
hb_position_t *first_advance, hb_position_t *first_advance,
unsigned advance_stride, unsigned advance_stride,
@ -424,14 +424,14 @@ hb_font_get_glyph_v_advance (hb_font_t *font,
HB_EXTERN void HB_EXTERN void
hb_font_get_glyph_h_advances (hb_font_t* font, hb_font_get_glyph_h_advances (hb_font_t* font,
unsigned count, unsigned count,
hb_codepoint_t *first_glyph, const hb_codepoint_t *first_glyph,
unsigned glyph_stride, unsigned glyph_stride,
hb_position_t *first_advance, hb_position_t *first_advance,
unsigned advance_stride); unsigned advance_stride);
HB_EXTERN void HB_EXTERN void
hb_font_get_glyph_v_advances (hb_font_t* font, hb_font_get_glyph_v_advances (hb_font_t* font,
unsigned count, unsigned count,
hb_codepoint_t *first_glyph, const hb_codepoint_t *first_glyph,
unsigned glyph_stride, unsigned glyph_stride,
hb_position_t *first_advance, hb_position_t *first_advance,
unsigned advance_stride); unsigned advance_stride);
@ -487,7 +487,7 @@ HB_EXTERN void
hb_font_get_glyph_advances_for_direction (hb_font_t* font, hb_font_get_glyph_advances_for_direction (hb_font_t* font,
hb_direction_t direction, hb_direction_t direction,
unsigned count, unsigned count,
hb_codepoint_t *first_glyph, const hb_codepoint_t *first_glyph,
unsigned glyph_stride, unsigned glyph_stride,
hb_position_t *first_advance, hb_position_t *first_advance,
unsigned advance_stride); unsigned advance_stride);

View File

@ -237,7 +237,7 @@ struct hb_font_t
} }
inline void get_glyph_h_advances (unsigned int count, inline void get_glyph_h_advances (unsigned int count,
hb_codepoint_t *first_glyph, const hb_codepoint_t *first_glyph,
unsigned int glyph_stride, unsigned int glyph_stride,
hb_position_t *first_advance, hb_position_t *first_advance,
unsigned int advance_stride) unsigned int advance_stride)
@ -250,7 +250,7 @@ struct hb_font_t
} }
inline void get_glyph_v_advances (unsigned int count, inline void get_glyph_v_advances (unsigned int count,
hb_codepoint_t *first_glyph, const hb_codepoint_t *first_glyph,
unsigned int glyph_stride, unsigned int glyph_stride,
hb_position_t *first_advance, hb_position_t *first_advance,
unsigned int advance_stride) unsigned int advance_stride)
@ -378,7 +378,7 @@ struct hb_font_t
} }
inline void get_glyph_advances_for_direction (hb_direction_t direction, inline void get_glyph_advances_for_direction (hb_direction_t direction,
unsigned count, unsigned count,
hb_codepoint_t *first_glyph, const hb_codepoint_t *first_glyph,
unsigned glyph_stride, unsigned glyph_stride,
hb_position_t *first_advance, hb_position_t *first_advance,
unsigned advance_stride) unsigned advance_stride)

View File

@ -221,7 +221,7 @@ hb_ft_get_variation_glyph (hb_font_t *font HB_UNUSED,
static void static void
hb_ft_get_glyph_h_advances (hb_font_t* font, void* font_data, hb_ft_get_glyph_h_advances (hb_font_t* font, void* font_data,
unsigned count, unsigned count,
hb_codepoint_t *first_glyph, const hb_codepoint_t *first_glyph,
unsigned glyph_stride, unsigned glyph_stride,
hb_position_t *first_advance, hb_position_t *first_advance,
unsigned advance_stride, unsigned advance_stride,

View File

@ -30,7 +30,6 @@
#include "hb-glib.h" #include "hb-glib.h"
#include "hb-unicode.hh"
#include "hb-machinery.hh" #include "hb-machinery.hh"
@ -202,8 +201,6 @@ hb_glib_unicode_combining_class (hb_unicode_funcs_t *ufuncs HB_UNUSED,
return (hb_unicode_combining_class_t) g_unichar_combining_class (unicode); return (hb_unicode_combining_class_t) g_unichar_combining_class (unicode);
} }
#define hb_glib_unicode_eastasian_width nullptr
static hb_unicode_general_category_t static hb_unicode_general_category_t
hb_glib_unicode_general_category (hb_unicode_funcs_t *ufuncs HB_UNUSED, hb_glib_unicode_general_category (hb_unicode_funcs_t *ufuncs HB_UNUSED,
hb_codepoint_t unicode, hb_codepoint_t unicode,
@ -328,8 +325,6 @@ hb_glib_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED,
return ret; return ret;
} }
#define hb_glib_unicode_decompose_compatibility nullptr
#ifdef HB_USE_ATEXIT #ifdef HB_USE_ATEXIT
static void free_static_glib_funcs (void); static void free_static_glib_funcs (void);
@ -341,10 +336,12 @@ static struct hb_glib_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader
{ {
hb_unicode_funcs_t *funcs = hb_unicode_funcs_create (nullptr); hb_unicode_funcs_t *funcs = hb_unicode_funcs_create (nullptr);
#define HB_UNICODE_FUNC_IMPLEMENT(name) \ hb_unicode_funcs_set_combining_class_func (funcs, hb_glib_unicode_combining_class, nullptr, nullptr);
hb_unicode_funcs_set_##name##_func (funcs, hb_glib_unicode_##name, nullptr, nullptr); hb_unicode_funcs_set_general_category_func (funcs, hb_glib_unicode_general_category, nullptr, nullptr);
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS hb_unicode_funcs_set_mirroring_func (funcs, hb_glib_unicode_mirroring, nullptr, nullptr);
#undef HB_UNICODE_FUNC_IMPLEMENT hb_unicode_funcs_set_script_func (funcs, hb_glib_unicode_script, nullptr, nullptr);
hb_unicode_funcs_set_compose_func (funcs, hb_glib_unicode_compose, nullptr, nullptr);
hb_unicode_funcs_set_decompose_func (funcs, hb_glib_unicode_decompose, nullptr, nullptr);
hb_unicode_funcs_make_immutable (funcs); hb_unicode_funcs_make_immutable (funcs);

View File

@ -31,7 +31,6 @@
#include "hb-icu.h" #include "hb-icu.h"
#include "hb-unicode.hh"
#include "hb-machinery.hh" #include "hb-machinery.hh"
#include <unicode/uchar.h> #include <unicode/uchar.h>
@ -73,8 +72,6 @@ hb_icu_unicode_combining_class (hb_unicode_funcs_t *ufuncs HB_UNUSED,
return (hb_unicode_combining_class_t) u_getCombiningClass (unicode); return (hb_unicode_combining_class_t) u_getCombiningClass (unicode);
} }
#define hb_icu_unicode_eastasian_width nullptr
static hb_unicode_general_category_t static hb_unicode_general_category_t
hb_icu_unicode_general_category (hb_unicode_funcs_t *ufuncs HB_UNUSED, hb_icu_unicode_general_category (hb_unicode_funcs_t *ufuncs HB_UNUSED,
hb_codepoint_t unicode, hb_codepoint_t unicode,
@ -292,8 +289,6 @@ hb_icu_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED,
return ret; return ret;
} }
#define hb_icu_unicode_decompose_compatibility nullptr
#ifdef HB_USE_ATEXIT #ifdef HB_USE_ATEXIT
static void free_static_icu_funcs (void); static void free_static_icu_funcs (void);
@ -312,10 +307,12 @@ static struct hb_icu_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_
hb_unicode_funcs_t *funcs = hb_unicode_funcs_create (nullptr); hb_unicode_funcs_t *funcs = hb_unicode_funcs_create (nullptr);
#define HB_UNICODE_FUNC_IMPLEMENT(name) \ hb_unicode_funcs_set_combining_class_func (funcs, hb_icu_unicode_combining_class, nullptr, nullptr);
hb_unicode_funcs_set_##name##_func (funcs, hb_icu_unicode_##name, user_data, nullptr); hb_unicode_funcs_set_general_category_func (funcs, hb_icu_unicode_general_category, nullptr, nullptr);
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS hb_unicode_funcs_set_mirroring_func (funcs, hb_icu_unicode_mirroring, nullptr, nullptr);
#undef HB_UNICODE_FUNC_IMPLEMENT hb_unicode_funcs_set_script_func (funcs, hb_icu_unicode_script, nullptr, nullptr);
hb_unicode_funcs_set_compose_func (funcs, hb_icu_unicode_compose, user_data, nullptr);
hb_unicode_funcs_set_decompose_func (funcs, hb_icu_unicode_decompose, user_data, nullptr);
hb_unicode_funcs_make_immutable (funcs); hb_unicode_funcs_make_immutable (funcs);

View File

@ -68,7 +68,7 @@ hb_ot_get_variation_glyph (hb_font_t *font HB_UNUSED,
static void static void
hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data, hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data,
unsigned count, unsigned count,
hb_codepoint_t *first_glyph, const hb_codepoint_t *first_glyph,
unsigned glyph_stride, unsigned glyph_stride,
hb_position_t *first_advance, hb_position_t *first_advance,
unsigned advance_stride, unsigned advance_stride,
@ -88,7 +88,7 @@ hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data,
static void static void
hb_ot_get_glyph_v_advances (hb_font_t* font, void* font_data, hb_ot_get_glyph_v_advances (hb_font_t* font, void* font_data,
unsigned count, unsigned count,
hb_codepoint_t *first_glyph, const hb_codepoint_t *first_glyph,
unsigned glyph_stride, unsigned glyph_stride,
hb_position_t *first_advance, hb_position_t *first_advance,
unsigned advance_stride, unsigned advance_stride,

View File

@ -435,15 +435,9 @@ _hb_ot_shape_fallback_mark_position (const hb_ot_shape_plan_t *plan,
} }
/* Performs font-assisted kerning. */ struct hb_ot_shape_fallback_kern_driver_t
void
_hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer)
{ {
struct driver_t hb_ot_shape_fallback_kern_driver_t (hb_font_t *font_,
{
driver_t (hb_font_t *font_,
hb_buffer_t *buffer) : hb_buffer_t *buffer) :
font (font_), direction (buffer->props.direction) {} font (font_), direction (buffer->props.direction) {}
@ -458,10 +452,16 @@ _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan,
hb_font_t *font; hb_font_t *font;
hb_direction_t direction; hb_direction_t direction;
} driver (font, buffer); };
hb_kern_machine_t<driver_t> machine (driver);
/* Performs font-assisted kerning. */
void
_hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer)
{
hb_ot_shape_fallback_kern_driver_t driver (font, buffer);
hb_kern_machine_t<hb_ot_shape_fallback_kern_driver_t> machine (driver);
machine.kern (font, buffer, plan->kern_mask); machine.kern (font, buffer, plan->kern_mask);
} }

View File

@ -16,7 +16,6 @@
#include "hb.hh" #include "hb.hh"
#include "hb-unicode.hh"
#include "hb-machinery.hh" #include "hb-machinery.hh"
#include "ucdn.h" #include "ucdn.h"
@ -182,8 +181,6 @@ hb_ucdn_combining_class(hb_unicode_funcs_t *ufuncs HB_UNUSED,
return (hb_unicode_combining_class_t) ucdn_get_combining_class(unicode); return (hb_unicode_combining_class_t) ucdn_get_combining_class(unicode);
} }
#define hb_ucdn_eastasian_width nullptr
static hb_unicode_general_category_t static hb_unicode_general_category_t
hb_ucdn_general_category(hb_unicode_funcs_t *ufuncs HB_UNUSED, hb_ucdn_general_category(hb_unicode_funcs_t *ufuncs HB_UNUSED,
hb_codepoint_t unicode, hb_codepoint_t unicode,
@ -224,8 +221,6 @@ hb_ucdn_decompose(hb_unicode_funcs_t *ufuncs HB_UNUSED,
return ucdn_decompose(ab, a, b); return ucdn_decompose(ab, a, b);
} }
#define hb_ucdn_decompose_compatibility nullptr
#ifdef HB_USE_ATEXIT #ifdef HB_USE_ATEXIT
static void free_static_ucdn_funcs (void); static void free_static_ucdn_funcs (void);
@ -237,10 +232,12 @@ static struct hb_ucdn_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader
{ {
hb_unicode_funcs_t *funcs = hb_unicode_funcs_create (nullptr); hb_unicode_funcs_t *funcs = hb_unicode_funcs_create (nullptr);
#define HB_UNICODE_FUNC_IMPLEMENT(name) \ hb_unicode_funcs_set_combining_class_func (funcs, hb_ucdn_combining_class, nullptr, nullptr);
hb_unicode_funcs_set_##name##_func (funcs, hb_ucdn_##name, nullptr, nullptr); hb_unicode_funcs_set_general_category_func (funcs, hb_ucdn_general_category, nullptr, nullptr);
HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS hb_unicode_funcs_set_mirroring_func (funcs, hb_ucdn_mirroring, nullptr, nullptr);
#undef HB_UNICODE_FUNC_IMPLEMENT hb_unicode_funcs_set_script_func (funcs, hb_ucdn_script, nullptr, nullptr);
hb_unicode_funcs_set_compose_func (funcs, hb_ucdn_compose, nullptr, nullptr);
hb_unicode_funcs_set_decompose_func (funcs, hb_ucdn_decompose, nullptr, nullptr);
hb_unicode_funcs_make_immutable (funcs); hb_unicode_funcs_make_immutable (funcs);

View File

@ -39,6 +39,10 @@
#define _POSIX_C_SOURCE 200809L #define _POSIX_C_SOURCE 200809L
#endif #endif
#if defined (_MSC_VER) && defined (HB_DLL_EXPORT)
#define HB_EXTERN __declspec (dllexport) extern
#endif
#include "hb.h" #include "hb.h"
#define HB_H_IN #define HB_H_IN
#ifdef HAVE_OT #ifdef HAVE_OT
@ -178,8 +182,10 @@ struct _hb_alignof
# if !defined(HB_NO_VISIBILITY) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(_MSC_VER) && !defined(__SUNPRO_CC) # if !defined(HB_NO_VISIBILITY) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(_MSC_VER) && !defined(__SUNPRO_CC)
# define HB_INTERNAL __attribute__((__visibility__("hidden"))) # define HB_INTERNAL __attribute__((__visibility__("hidden")))
# elif defined(__MINGW32__) # elif defined(__MINGW32__)
/* We use -export-symbols on mingw32, since it does not support visibility /* We use -export-symbols on mingw32, since it does not support visibility attributes. */
* attribute. */ # define HB_INTERNAL
# elif defined (_MSC_VER) && defined (HB_DLL_EXPORT)
/* We do not try to export internal symbols on Visual Studio */
# define HB_INTERNAL # define HB_INTERNAL
#else #else
# define HB_INTERNAL # define HB_INTERNAL

View File

@ -32,10 +32,11 @@ test_collect_unicodes_format4 (void)
{ {
hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.format4.ttf"); hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.format4.ttf");
hb_set_t *codepoints = hb_set_create(); hb_set_t *codepoints = hb_set_create();
hb_codepoint_t cp;
hb_face_collect_unicodes (face, codepoints); hb_face_collect_unicodes (face, codepoints);
hb_codepoint_t cp = HB_SET_VALUE_INVALID; cp = HB_SET_VALUE_INVALID;
g_assert (hb_set_next (codepoints, &cp)); g_assert (hb_set_next (codepoints, &cp));
g_assert_cmpuint (0x61, ==, cp); g_assert_cmpuint (0x61, ==, cp);
g_assert (hb_set_next (codepoints, &cp)); g_assert (hb_set_next (codepoints, &cp));
@ -53,10 +54,11 @@ test_collect_unicodes_format12 (void)
{ {
hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.format12.ttf"); hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.format12.ttf");
hb_set_t *codepoints = hb_set_create(); hb_set_t *codepoints = hb_set_create();
hb_codepoint_t cp;
hb_face_collect_unicodes (face, codepoints); hb_face_collect_unicodes (face, codepoints);
hb_codepoint_t cp = HB_SET_VALUE_INVALID; cp = HB_SET_VALUE_INVALID;
g_assert (hb_set_next (codepoints, &cp)); g_assert (hb_set_next (codepoints, &cp));
g_assert_cmpuint (0x61, ==, cp); g_assert_cmpuint (0x61, ==, cp);
g_assert (hb_set_next (codepoints, &cp)); g_assert (hb_set_next (codepoints, &cp));
@ -74,10 +76,11 @@ test_collect_unicodes (void)
{ {
hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.ttf"); hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.ttf");
hb_set_t *codepoints = hb_set_create(); hb_set_t *codepoints = hb_set_create();
hb_codepoint_t cp;
hb_face_collect_unicodes (face, codepoints); hb_face_collect_unicodes (face, codepoints);
hb_codepoint_t cp = HB_SET_VALUE_INVALID; cp = HB_SET_VALUE_INVALID;
g_assert (hb_set_next (codepoints, &cp)); g_assert (hb_set_next (codepoints, &cp));
g_assert_cmpuint (0x61, ==, cp); g_assert_cmpuint (0x61, ==, cp);
g_assert (hb_set_next (codepoints, &cp)); g_assert (hb_set_next (codepoints, &cp));

View File

@ -381,10 +381,6 @@ test_set_empty (void)
test_empty (b); test_empty (b);
hb_set_invert (b);
test_empty (b);
g_assert (!hb_set_allocation_successful (b)); g_assert (!hb_set_allocation_successful (b));
hb_set_clear (b); hb_set_clear (b);

View File

@ -55,7 +55,7 @@ glyph_h_advance_func (hb_font_t *font HB_UNUSED, void *font_data HB_UNUSED,
static hb_bool_t static hb_bool_t
glyph_func (hb_font_t *font HB_UNUSED, void *font_data HB_UNUSED, glyph_func (hb_font_t *font HB_UNUSED, void *font_data HB_UNUSED,
hb_codepoint_t unicode, hb_codepoint_t variation_selector HB_UNUSED, hb_codepoint_t unicode,
hb_codepoint_t *glyph, hb_codepoint_t *glyph,
void *user_data HB_UNUSED) void *user_data HB_UNUSED)
{ {
@ -101,7 +101,7 @@ test_shape (void)
ffuncs = hb_font_funcs_create (); ffuncs = hb_font_funcs_create ();
hb_font_funcs_set_glyph_h_advance_func (ffuncs, glyph_h_advance_func, NULL, NULL); hb_font_funcs_set_glyph_h_advance_func (ffuncs, glyph_h_advance_func, NULL, NULL);
hb_font_funcs_set_glyph_func (ffuncs, glyph_func, malloc (10), free); hb_font_funcs_set_nominal_glyph_func (ffuncs, glyph_func, malloc (10), free);
hb_font_funcs_set_glyph_h_kerning_func (ffuncs, glyph_h_kerning_func, NULL, NULL); hb_font_funcs_set_glyph_h_kerning_func (ffuncs, glyph_h_kerning_func, NULL, NULL);
hb_font_set_funcs (font, ffuncs, NULL, NULL); hb_font_set_funcs (font, ffuncs, NULL, NULL);
hb_font_funcs_destroy (ffuncs); hb_font_funcs_destroy (ffuncs);

View File

@ -105,16 +105,18 @@ test_subset_glyf_with_gsub (void)
{ {
hb_face_t *face_fil = hb_subset_test_open_font ("fonts/Roboto-Regular.gsub.fil.ttf"); hb_face_t *face_fil = hb_subset_test_open_font ("fonts/Roboto-Regular.gsub.fil.ttf");
hb_face_t *face_fi = hb_subset_test_open_font ("fonts/Roboto-Regular.gsub.fi.ttf"); hb_face_t *face_fi = hb_subset_test_open_font ("fonts/Roboto-Regular.gsub.fi.ttf");
hb_subset_input_t *input;
hb_face_t *face_subset;
hb_set_t *codepoints = hb_set_create(); hb_set_t *codepoints = hb_set_create();
hb_set_add (codepoints, 102); // f hb_set_add (codepoints, 102); // f
hb_set_add (codepoints, 105); // i hb_set_add (codepoints, 105); // i
hb_subset_input_t *input = hb_subset_test_create_input (codepoints); input = hb_subset_test_create_input (codepoints);
hb_set_destroy (codepoints); hb_set_destroy (codepoints);
hb_subset_input_set_drop_layout (input, false); hb_subset_input_set_drop_layout (input, false);
hb_face_t *face_subset = hb_subset_test_create_subset (face_fil, input); face_subset = hb_subset_test_create_subset (face_fil, input);
hb_subset_test_check (face_fi, face_subset, HB_TAG ('g','l','y','f')); hb_subset_test_check (face_fi, face_subset, HB_TAG ('g','l','y','f'));
hb_subset_test_check (face_fi, face_subset, HB_TAG ('l','o','c', 'a')); hb_subset_test_check (face_fi, face_subset, HB_TAG ('l','o','c', 'a'));
@ -130,16 +132,18 @@ test_subset_glyf_without_gsub (void)
{ {
hb_face_t *face_fil = hb_subset_test_open_font ("fonts/Roboto-Regular.gsub.fil.ttf"); hb_face_t *face_fil = hb_subset_test_open_font ("fonts/Roboto-Regular.gsub.fil.ttf");
hb_face_t *face_fi = hb_subset_test_open_font ("fonts/Roboto-Regular.nogsub.fi.ttf"); hb_face_t *face_fi = hb_subset_test_open_font ("fonts/Roboto-Regular.nogsub.fi.ttf");
hb_subset_input_t *input;
hb_face_t *face_subset;
hb_set_t *codepoints = hb_set_create(); hb_set_t *codepoints = hb_set_create();
hb_set_add (codepoints, 102); // f hb_set_add (codepoints, 102); // f
hb_set_add (codepoints, 105); // i hb_set_add (codepoints, 105); // i
hb_subset_input_t *input = hb_subset_test_create_input (codepoints); input = hb_subset_test_create_input (codepoints);
hb_set_destroy (codepoints); hb_set_destroy (codepoints);
hb_subset_input_set_drop_layout (input, true); hb_subset_input_set_drop_layout (input, true);
hb_face_t *face_subset = hb_subset_test_create_subset (face_fil, input); face_subset = hb_subset_test_create_subset (face_fil, input);
hb_subset_test_check (face_fi, face_subset, HB_TAG ('g','l','y','f')); hb_subset_test_check (face_fi, face_subset, HB_TAG ('g','l','y','f'));
hb_subset_test_check (face_fi, face_subset, HB_TAG ('l','o','c', 'a')); hb_subset_test_check (face_fi, face_subset, HB_TAG ('l','o','c', 'a'));
@ -233,16 +237,19 @@ test_subset_glyf_strip_hints_invalid (void)
'3', '@', '_', '%', '&', ')', '*', '$', '!' '3', '@', '_', '%', '&', ')', '*', '$', '!'
}; };
unsigned int i; unsigned int i;
hb_subset_input_t *input;
hb_face_t *face_subset;
for (i = 0; i < sizeof (text) / sizeof (hb_codepoint_t); i++) for (i = 0; i < sizeof (text) / sizeof (hb_codepoint_t); i++)
{ {
hb_set_add (codepoints, text[i]); hb_set_add (codepoints, text[i]);
} }
hb_subset_input_t *input = hb_subset_test_create_input (codepoints); input = hb_subset_test_create_input (codepoints);
hb_subset_input_set_drop_hints (input, true); hb_subset_input_set_drop_hints (input, true);
hb_set_destroy (codepoints); hb_set_destroy (codepoints);
hb_face_t *face_subset = hb_subset_test_create_subset (face, input); face_subset = hb_subset_test_create_subset (face, input);
g_assert (face_subset); g_assert (face_subset);
g_assert (face_subset == hb_face_get_empty ()); g_assert (face_subset == hb_face_get_empty ());

View File

@ -76,11 +76,13 @@ test_subset_hdmx_invalid (void)
hb_subset_input_t *input = hb_subset_input_create_or_fail (); hb_subset_input_t *input = hb_subset_input_create_or_fail ();
hb_set_t *codepoints = hb_subset_input_unicode_set (input); hb_set_t *codepoints = hb_subset_input_unicode_set (input);
hb_face_t *subset;
hb_set_add (codepoints, 'a'); hb_set_add (codepoints, 'a');
hb_set_add (codepoints, 'b'); hb_set_add (codepoints, 'b');
hb_set_add (codepoints, 'c'); hb_set_add (codepoints, 'c');
hb_face_t *subset = hb_subset (face, input); subset = hb_subset (face, input);
g_assert (subset); g_assert (subset);
g_assert (subset == hb_face_get_empty ()); g_assert (subset == hb_face_get_empty ());
@ -96,11 +98,13 @@ test_subset_hdmx_fails_sanitize (void)
hb_subset_input_t *input = hb_subset_input_create_or_fail (); hb_subset_input_t *input = hb_subset_input_create_or_fail ();
hb_set_t *codepoints = hb_subset_input_unicode_set (input); hb_set_t *codepoints = hb_subset_input_unicode_set (input);
hb_face_t *subset;
hb_set_add (codepoints, 'a'); hb_set_add (codepoints, 'a');
hb_set_add (codepoints, 'b'); hb_set_add (codepoints, 'b');
hb_set_add (codepoints, 'c'); hb_set_add (codepoints, 'c');
hb_face_t *subset = hb_subset (face, input); subset = hb_subset (face, input);
g_assert (subset); g_assert (subset);
g_assert (subset == hb_face_get_empty ()); g_assert (subset == hb_face_get_empty ());

View File

@ -154,6 +154,7 @@ static void
test_subset_invalid_hmtx (void) test_subset_invalid_hmtx (void)
{ {
hb_face_t *face = hb_subset_test_open_font("fonts/crash-e4e0bb1458a91b692eba492c907ae1f94e635480"); hb_face_t *face = hb_subset_test_open_font("fonts/crash-e4e0bb1458a91b692eba492c907ae1f94e635480");
hb_face_t *subset;
hb_subset_input_t *input = hb_subset_input_create_or_fail (); hb_subset_input_t *input = hb_subset_input_create_or_fail ();
hb_set_t *codepoints = hb_subset_input_unicode_set (input); hb_set_t *codepoints = hb_subset_input_unicode_set (input);
@ -161,7 +162,7 @@ test_subset_invalid_hmtx (void)
hb_set_add (codepoints, 'b'); hb_set_add (codepoints, 'b');
hb_set_add (codepoints, 'c'); hb_set_add (codepoints, 'c');
hb_face_t *subset = hb_subset (face, input); subset = hb_subset (face, input);
g_assert (subset); g_assert (subset);
g_assert (subset == hb_face_get_empty ()); g_assert (subset == hb_face_get_empty ());

View File

@ -34,11 +34,12 @@ test_post_drops_glyph_names (void)
{ {
hb_face_t *face_full = hb_subset_test_open_font ("fonts/Mplus1p-Regular.660E,6975,73E0,5EA6,8F38,6E05.ttf"); hb_face_t *face_full = hb_subset_test_open_font ("fonts/Mplus1p-Regular.660E,6975,73E0,5EA6,8F38,6E05.ttf");
hb_face_t *face_subset = hb_subset_test_open_font ("fonts/Mplus1p-Regular.660E.ttf"); hb_face_t *face_subset = hb_subset_test_open_font ("fonts/Mplus1p-Regular.660E.ttf");
hb_face_t *face_full_subset;
hb_set_t *codepoints = hb_set_create (); hb_set_t *codepoints = hb_set_create ();
hb_set_add (codepoints, 0x660E); hb_set_add (codepoints, 0x660E);
hb_face_t *face_full_subset = hb_subset_test_create_subset (face_full, hb_subset_test_create_input (codepoints)); face_full_subset = hb_subset_test_create_subset (face_full, hb_subset_test_create_input (codepoints));
hb_set_destroy (codepoints); hb_set_destroy (codepoints);
hb_subset_test_check (face_subset, face_full_subset, HB_TAG ('p','o','s','t')); hb_subset_test_check (face_subset, face_full_subset, HB_TAG ('p','o','s','t'));

View File

@ -48,11 +48,12 @@ test_subset_vmtx_simple_subset (void)
{ {
hb_face_t *face_full = hb_subset_test_open_font ("fonts/Mplus1p-Regular.660E,6975,73E0,5EA6,8F38,6E05.ttf"); hb_face_t *face_full = hb_subset_test_open_font ("fonts/Mplus1p-Regular.660E,6975,73E0,5EA6,8F38,6E05.ttf");
hb_face_t *face_subset = hb_subset_test_open_font ("fonts/Mplus1p-Regular.660E.ttf"); hb_face_t *face_subset = hb_subset_test_open_font ("fonts/Mplus1p-Regular.660E.ttf");
hb_face_t *face_full_subset;
hb_set_t *codepoints = hb_set_create (); hb_set_t *codepoints = hb_set_create ();
hb_set_add (codepoints, 0x660E); hb_set_add (codepoints, 0x660E);
hb_face_t *face_full_subset = hb_subset_test_create_subset (face_full, hb_subset_test_create_input (codepoints)); face_full_subset = hb_subset_test_create_subset (face_full, hb_subset_test_create_input (codepoints));
hb_set_destroy (codepoints); hb_set_destroy (codepoints);
check_num_vmetrics(face_full_subset, 1); /* nothing has same width */ check_num_vmetrics(face_full_subset, 1); /* nothing has same width */
@ -67,6 +68,7 @@ static void
test_subset_vmtx_noop (void) test_subset_vmtx_noop (void)
{ {
hb_face_t *face_full = hb_subset_test_open_font ("fonts/Mplus1p-Regular.660E,6975,73E0,5EA6,8F38,6E05.ttf"); hb_face_t *face_full = hb_subset_test_open_font ("fonts/Mplus1p-Regular.660E,6975,73E0,5EA6,8F38,6E05.ttf");
hb_face_t *face_full_subset;
hb_set_t *codepoints = hb_set_create(); hb_set_t *codepoints = hb_set_create();
hb_set_add (codepoints, 0x660E); hb_set_add (codepoints, 0x660E);
@ -75,7 +77,7 @@ test_subset_vmtx_noop (void)
hb_set_add (codepoints, 0x5EA6); hb_set_add (codepoints, 0x5EA6);
hb_set_add (codepoints, 0x8F38); hb_set_add (codepoints, 0x8F38);
hb_set_add (codepoints, 0x6E05); hb_set_add (codepoints, 0x6E05);
hb_face_t *face_full_subset = hb_subset_test_create_subset (face_full, hb_subset_test_create_input (codepoints)); face_full_subset = hb_subset_test_create_subset (face_full, hb_subset_test_create_input (codepoints));
hb_set_destroy (codepoints); hb_set_destroy (codepoints);
check_num_vmetrics(face_full_subset, 1); /* all have the same width */ check_num_vmetrics(face_full_subset, 1); /* all have the same width */

View File

@ -36,11 +36,13 @@ test_subset_32_tables (void)
hb_subset_input_t *input = hb_subset_input_create_or_fail (); hb_subset_input_t *input = hb_subset_input_create_or_fail ();
hb_set_t *codepoints = hb_subset_input_unicode_set (input); hb_set_t *codepoints = hb_subset_input_unicode_set (input);
hb_face_t *subset;
hb_set_add (codepoints, 'a'); hb_set_add (codepoints, 'a');
hb_set_add (codepoints, 'b'); hb_set_add (codepoints, 'b');
hb_set_add (codepoints, 'c'); hb_set_add (codepoints, 'c');
hb_face_t *subset = hb_subset (face, input); subset = hb_subset (face, input);
g_assert (subset); g_assert (subset);
g_assert (subset != hb_face_get_empty ()); g_assert (subset != hb_face_get_empty ());
@ -56,11 +58,13 @@ test_subset_no_inf_loop (void)
hb_subset_input_t *input = hb_subset_input_create_or_fail (); hb_subset_input_t *input = hb_subset_input_create_or_fail ();
hb_set_t *codepoints = hb_subset_input_unicode_set (input); hb_set_t *codepoints = hb_subset_input_unicode_set (input);
hb_face_t *subset;
hb_set_add (codepoints, 'a'); hb_set_add (codepoints, 'a');
hb_set_add (codepoints, 'b'); hb_set_add (codepoints, 'b');
hb_set_add (codepoints, 'c'); hb_set_add (codepoints, 'c');
hb_face_t *subset = hb_subset (face, input); subset = hb_subset (face, input);
g_assert (subset); g_assert (subset);
g_assert (subset == hb_face_get_empty ()); g_assert (subset == hb_face_get_empty ());
@ -76,11 +80,13 @@ test_subset_crash (void)
hb_subset_input_t *input = hb_subset_input_create_or_fail (); hb_subset_input_t *input = hb_subset_input_create_or_fail ();
hb_set_t *codepoints = hb_subset_input_unicode_set (input); hb_set_t *codepoints = hb_subset_input_unicode_set (input);
hb_face_t *subset;
hb_set_add (codepoints, 'a'); hb_set_add (codepoints, 'a');
hb_set_add (codepoints, 'b'); hb_set_add (codepoints, 'b');
hb_set_add (codepoints, 'c'); hb_set_add (codepoints, 'c');
hb_face_t *subset = hb_subset (face, input); subset = hb_subset (face, input);
g_assert (subset); g_assert (subset);
g_assert (subset == hb_face_get_empty ()); g_assert (subset == hb_face_get_empty ());

View File

@ -8,6 +8,8 @@ SUBDIRS = data
# Convenience targets: # Convenience targets:
lib: lib:
@$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib
libs:
@$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src libs
EXTRA_DIST += \ EXTRA_DIST += \
README.md \ README.md \

View File

@ -7,7 +7,7 @@ SUBDIRS = data
# Convenience targets: # Convenience targets:
lib: lib:
@$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src lib @$(MAKE) $(AM_MAKEFLAGS) -C $(top_builddir)/src libs
EXTRA_DIST += \ EXTRA_DIST += \
CMakeLists.txt \ CMakeLists.txt \