diff options
Diffstat (limited to 'src/3rdparty/harfbuzz-ng')
-rw-r--r-- | src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro | 134 | ||||
-rw-r--r-- | src/3rdparty/harfbuzz-ng/src/config.h | 17 | ||||
-rw-r--r-- | src/3rdparty/harfbuzz-ng/src/hb-coretext.cc | 46 | ||||
-rw-r--r-- | src/3rdparty/harfbuzz-ng/src/hb-coretext.h | 8 |
4 files changed, 166 insertions, 39 deletions
diff --git a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro new file mode 100644 index 0000000000..7d997d7d8b --- /dev/null +++ b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro @@ -0,0 +1,134 @@ +TARGET = qtharfbuzzng +TEMPLATE = lib + +CONFIG += \ + static \ + hide_symbols \ + exceptions_off rtti_off +CONFIG -= qt + +DESTDIR = $$QT_BUILD_TREE/lib + +DEFINES += HAVE_CONFIG_H +HEADERS += $$PWD/src/config.h + +INCLUDEPATH += $$PWD/include + +SOURCES += \ + $$PWD/src/hb-blob.cc \ + $$PWD/src/hb-buffer.cc \ + $$PWD/src/hb-buffer-serialize.cc \ + $$PWD/src/hb-common.cc \ + $$PWD/src/hb-face.cc \ + $$PWD/src/hb-font.cc \ + $$PWD/src/hb-ot-tag.cc \ + $$PWD/src/hb-set.cc \ + $$PWD/src/hb-shape.cc \ + $$PWD/src/hb-shape-plan.cc \ + $$PWD/src/hb-shaper.cc \ + $$PWD/src/hb-unicode.cc \ + $$PWD/src/hb-warning.cc + +HEADERS += \ + $$PWD/src/hb-atomic-private.hh \ + $$PWD/src/hb-buffer-private.hh \ + $$PWD/src/hb-buffer-deserialize-json.hh \ + $$PWD/src/hb-buffer-deserialize-text.hh \ + $$PWD/src/hb-cache-private.hh \ + $$PWD/src/hb-face-private.hh \ + $$PWD/src/hb-font-private.hh \ + $$PWD/src/hb-mutex-private.hh \ + $$PWD/src/hb-object-private.hh \ + $$PWD/src/hb-open-file-private.hh \ + $$PWD/src/hb-open-type-private.hh \ + $$PWD/src/hb-ot-head-table.hh \ + $$PWD/src/hb-ot-hhea-table.hh \ + $$PWD/src/hb-ot-hmtx-table.hh \ + $$PWD/src/hb-ot-maxp-table.hh \ + $$PWD/src/hb-ot-name-table.hh \ + $$PWD/src/hb-private.hh \ + $$PWD/src/hb-set-private.hh \ + $$PWD/src/hb-shape-plan-private.hh \ + $$PWD/src/hb-shaper-impl-private.hh \ + $$PWD/src/hb-shaper-list.hh \ + $$PWD/src/hb-shaper-private.hh \ + $$PWD/src/hb-unicode-private.hh \ + $$PWD/src/hb-utf-private.hh + +HEADERS += \ + $$PWD/src/hb.h \ + $$PWD/src/hb-blob.h \ + $$PWD/src/hb-buffer.h \ + $$PWD/src/hb-common.h \ + $$PWD/src/hb-face.h \ + $$PWD/src/hb-font.h \ + $$PWD/src/hb-set.h \ + $$PWD/src/hb-shape.h \ + $$PWD/src/hb-shape-plan.h \ + $$PWD/src/hb-unicode.h \ + $$PWD/src/hb-version.h + +# Open Type +SOURCES += \ + $$PWD/src/hb-ot-layout.cc \ + $$PWD/src/hb-ot-map.cc \ + $$PWD/src/hb-ot-shape.cc \ + $$PWD/src/hb-ot-shape-complex-arabic.cc \ + $$PWD/src/hb-ot-shape-complex-default.cc \ + $$PWD/src/hb-ot-shape-complex-hangul.cc \ + $$PWD/src/hb-ot-shape-complex-hebrew.cc \ + $$PWD/src/hb-ot-shape-complex-indic.cc \ + $$PWD/src/hb-ot-shape-complex-indic-table.cc \ + $$PWD/src/hb-ot-shape-complex-myanmar.cc \ + $$PWD/src/hb-ot-shape-complex-sea.cc \ + $$PWD/src/hb-ot-shape-complex-thai.cc \ + $$PWD/src/hb-ot-shape-complex-tibetan.cc \ + $$PWD/src/hb-ot-shape-fallback.cc \ + $$PWD/src/hb-ot-shape-normalize.cc + +HEADERS += \ + $$PWD/src/hb-ot-layout-common-private.hh \ + $$PWD/src/hb-ot-layout-gdef-table.hh \ + $$PWD/src/hb-ot-layout-gpos-table.hh \ + $$PWD/src/hb-ot-layout-gsubgpos-private.hh \ + $$PWD/src/hb-ot-layout-gsub-table.hh \ + $$PWD/src/hb-ot-layout-jstf-table.hh \ + $$PWD/src/hb-ot-layout-private.hh \ + $$PWD/src/hb-ot-map-private.hh \ + $$PWD/src/hb-ot-shape-complex-arabic-fallback.hh \ + $$PWD/src/hb-ot-shape-complex-arabic-table.hh \ + $$PWD/src/hb-ot-shape-complex-indic-machine.hh \ + $$PWD/src/hb-ot-shape-complex-indic-private.hh \ + $$PWD/src/hb-ot-shape-complex-myanmar-machine.hh \ + $$PWD/src/hb-ot-shape-complex-private.hh \ + $$PWD/src/hb-ot-shape-complex-sea-machine.hh \ + $$PWD/src/hb-ot-shape-fallback-private.hh \ + $$PWD/src/hb-ot-shape-normalize-private.hh \ + $$PWD/src/hb-ot-shape-private.hh + +HEADERS += \ + $$PWD/src/hb-ot.h \ + $$PWD/src/hb-ot-layout.h \ + $$PWD/src/hb-ot-shape.h \ + $$PWD/src/hb-ot-tag.h + +mac { + # Apple Advanced Typography + DEFINES += HAVE_CORETEXT + + SOURCES += \ + $$PWD/src/hb-coretext.cc + + HEADERS += \ + $$PWD/src/hb-coretext.h + + ios: \ + # On iOS CoreText and CoreGraphics are stand-alone frameworks + LIBS_PRIVATE += -framework CoreText -framework CoreGraphics + else: \ + # On Mac OS they are part of the ApplicationServices umbrella framework, + # even in 10.8 where they were also made available stand-alone. + LIBS_PRIVATE += -framework ApplicationServices +} + +TARGET = $$TARGET$$qtPlatformTargetSuffix() diff --git a/src/3rdparty/harfbuzz-ng/src/config.h b/src/3rdparty/harfbuzz-ng/src/config.h index db706987fe..cb68ab0e5b 100644 --- a/src/3rdparty/harfbuzz-ng/src/config.h +++ b/src/3rdparty/harfbuzz-ng/src/config.h @@ -2,29 +2,14 @@ #define HB_CONFIG_H #define HAVE_OT +#define HAVE_ATEXIT #define HB_NO_MT #define HB_NO_UNICODE_FUNCS #define HB_DISABLE_DEPRECATED -#include <QtCore/qglobal.h> - -#ifndef HB_INTERNAL -# define HB_INTERNAL Q_DECL_HIDDEN -#endif - -#if !defined(QT_NO_DEBUG) -# define NDEBUG -#endif - // because strdup() is not part of strict Posix, declare it here extern "C" char *strdup(const char *src); -#ifndef HAVE_ATEXIT -# define HAVE_ATEXIT 1 -# include <QtCore/qcoreapplication.h> -# define atexit qAddPostRoutine -#endif - #endif /* HB_CONFIG_H */ diff --git a/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc b/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc index 5a34eddecc..40c06371bd 100644 --- a/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc +++ b/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc @@ -32,7 +32,6 @@ #include "hb-coretext.h" #include "hb-face-private.hh" -#include <private/qfontengine_p.h> #ifndef HB_DEBUG_CORETEXT @@ -44,6 +43,19 @@ HB_SHAPER_DATA_ENSURE_DECLARE(coretext, face) HB_SHAPER_DATA_ENSURE_DECLARE(coretext, font) +typedef bool (*qt_get_font_table_func_t) (void *user_data, unsigned int tag, unsigned char *buffer, unsigned int *length); + +struct FontEngineFaceData { + void *user_data; + qt_get_font_table_func_t get_font_table; +}; + +struct CoreTextFontEngineData { + CTFontRef ctFont; + CGFontRef cgFont; +}; + + /* * shaper face data */ @@ -83,25 +95,11 @@ _hb_coretext_shaper_face_data_create (hb_face_t *face) if (unlikely (!data)) return NULL; - QFontEngine *fe = (QFontEngine *) ((QFontEngine::FaceData *) face->user_data)->user_data; - if (fe->type () == QFontEngine::Mac) - { - data->cg_font = (CGFontRef) fe->userData ().value<void *> (); - if (likely (data->cg_font)) - CFRetain (data->cg_font); - } - else - { - hb_blob_t *blob = hb_face_reference_blob (face); - unsigned int blob_length; - const char *blob_data = hb_blob_get_data (blob, &blob_length); - if (unlikely (!blob_length)) - DEBUG_MSG (CORETEXT, face, "Face has empty blob"); - - CGDataProviderRef provider = CGDataProviderCreateWithData (blob, blob_data, blob_length, &release_data); - data->cg_font = CGFontCreateWithDataProvider (provider); - CGDataProviderRelease (provider); - } + FontEngineFaceData *fontEngineFaceData = (FontEngineFaceData *) face->user_data; + CoreTextFontEngineData *coreTextFontEngineData = (CoreTextFontEngineData *) fontEngineFaceData->user_data; + data->cg_font = coreTextFontEngineData->cgFont; + if (likely (data->cg_font)) + CFRetain (data->cg_font); if (unlikely (!data->cg_font)) { DEBUG_MSG (CORETEXT, face, "Face CGFontCreateWithDataProvider() failed"); @@ -146,9 +144,13 @@ _hb_coretext_shaper_font_data_create (hb_font_t *font) return NULL; hb_face_t *face = font->face; - hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face); - data->ct_font = CTFontCreateWithGraphicsFont (face_data->cg_font, font->y_scale / 64, NULL, NULL); + FontEngineFaceData *fontEngineFaceData = (FontEngineFaceData *) face->user_data; + CoreTextFontEngineData *coreTextFontEngineData = (CoreTextFontEngineData *) fontEngineFaceData->user_data; + data->ct_font = coreTextFontEngineData->ctFont; + if (likely (data->ct_font)) + CFRetain (data->ct_font); + if (unlikely (!data->ct_font)) { DEBUG_MSG (CORETEXT, font, "Font CTFontCreateWithGraphicsFont() failed"); free (data); diff --git a/src/3rdparty/harfbuzz-ng/src/hb-coretext.h b/src/3rdparty/harfbuzz-ng/src/hb-coretext.h index bcf1de7141..aa4bf69a52 100644 --- a/src/3rdparty/harfbuzz-ng/src/hb-coretext.h +++ b/src/3rdparty/harfbuzz-ng/src/hb-coretext.h @@ -29,7 +29,13 @@ #include "hb.h" -#include <ApplicationServices/ApplicationServices.h> +#include <TargetConditionals.h> +#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE +# include <CoreText/CoreText.h> +# include <CoreGraphics/CoreGraphics.h> +#else +# include <ApplicationServices/ApplicationServices.h> +#endif HB_BEGIN_DECLS |