Let harfbuzz compile on Travis

This commit is contained in:
Kovid Goyal
2017-10-25 13:25:36 +05:30
parent c841106902
commit 1356bcbb9a
2 changed files with 8 additions and 1 deletions

View File

@@ -87,7 +87,7 @@ the following dependencies are installed first.
* libpng * libpng
* glew >= 2.0 (not needed on macOS) * glew >= 2.0 (not needed on macOS)
* fontconfig (not needed on macOS) * fontconfig (not needed on macOS)
* harfbuzz (not needed on macOS) * harfbuzz >= 1.0.5 (not needed on macOS)
* xrdb (only on X11 based systems) * xrdb (only on X11 based systems)
* xsel (only on X11 systems with glfw < 3.3) * xsel (only on X11 systems with glfw < 3.3)
* ImageMagick (optional, needed to use the `kitty icat` tool to display images in the terminal) * ImageMagick (optional, needed to use the `kitty icat` tool to display images in the terminal)

View File

@@ -13,6 +13,11 @@
#include <hb.h> #include <hb.h>
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#include <hb-ft.h> #include <hb-ft.h>
#if HB_VERSION_MAJOR > 1 || (HB_VERSION_MAJOR == 1 && (HB_VERSION_MINOR > 0 || (HB_VERSION_MINOR == 0 && HB_VERSION_MICRO >= 5)))
#define HARBUZZ_HAS_LOAD_FLAGS
#endif
#include FT_FREETYPE_H #include FT_FREETYPE_H
typedef struct { typedef struct {
PyObject_HEAD PyObject_HEAD
@@ -253,7 +258,9 @@ typedef struct {
static inline void static inline void
_shape(Face *self, const char *string, int len, int hinting, int hintstyle, ShapeData *ans) { _shape(Face *self, const char *string, int len, int hinting, int hintstyle, ShapeData *ans) {
hb_buffer_clear_contents(self->harfbuzz_buffer); hb_buffer_clear_contents(self->harfbuzz_buffer);
#ifdef HARBUZZ_HAS_LOAD_FLAGS
hb_ft_font_set_load_flags(self->harfbuzz_font, get_load_flags(hinting, hintstyle, FT_LOAD_DEFAULT)); hb_ft_font_set_load_flags(self->harfbuzz_font, get_load_flags(hinting, hintstyle, FT_LOAD_DEFAULT));
#endif
hb_buffer_add_utf8(self->harfbuzz_buffer, string, len, 0, len); hb_buffer_add_utf8(self->harfbuzz_buffer, string, len, 0, len);
hb_buffer_guess_segment_properties(self->harfbuzz_buffer); hb_buffer_guess_segment_properties(self->harfbuzz_buffer);
hb_shape(self->harfbuzz_font, self->harfbuzz_buffer, NULL, 0); hb_shape(self->harfbuzz_font, self->harfbuzz_buffer, NULL, 0);