summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.tests/unix/mips_dsp/mips_dsp.cpp45
-rw-r--r--config.tests/unix/mips_dsp/mips_dsp.pro2
-rw-r--r--config.tests/unix/mips_dspr2/mips_dspr2.cpp47
-rw-r--r--config.tests/unix/mips_dspr2/mips_dspr2.pro2
-rw-r--r--configure.json21
-rw-r--r--configure.pri30
-rw-r--r--doc/global/compat.qdocconf3
-rw-r--r--examples/widgets/tools/regularexpression/regularexpressiondialog.cpp98
-rw-r--r--examples/widgets/tools/regularexpression/regularexpressiondialog.h1
-rw-r--r--examples/xml/xmlstreamlint/xmlstreamlint.pro1
-rw-r--r--mkspecs/common/gcc-base.conf2
-rw-r--r--mkspecs/common/msvc-version.conf6
-rw-r--r--mkspecs/features/android/android_deployment_settings.prf3
-rw-r--r--mkspecs/features/create_cmake.prf2
-rw-r--r--mkspecs/features/ctest_testcase_common.prf7
-rw-r--r--mkspecs/features/default_post.prf5
-rw-r--r--mkspecs/features/qml_plugin.prf4
-rw-r--r--mkspecs/features/qt_build_config.prf1
-rw-r--r--mkspecs/features/qt_common.prf4
-rw-r--r--mkspecs/features/qt_config.prf8
-rw-r--r--mkspecs/features/qt_configure.prf8
-rw-r--r--mkspecs/features/qt_module.prf8
-rw-r--r--mkspecs/features/qt_module_pris.prf20
-rw-r--r--mkspecs/features/win32/default_pre.prf2
-rw-r--r--mkspecs/linux-icc/qmake.conf2
-rw-r--r--mkspecs/win32-icc/qmake.conf56
-rw-r--r--qmake/Makefile.win324
-rw-r--r--qmake/generators/projectgenerator.cpp8
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp6
-rw-r--r--qmake/library/qmakeevaluator.cpp12
-rw-r--r--qmake/library/qmakeglobals.cpp33
-rw-r--r--qmake/library/qmakeglobals.h13
-rw-r--r--qmake/option.cpp14
-rw-r--r--src/3rdparty/harfbuzz-ng/NEWS311
-rw-r--r--src/3rdparty/harfbuzz-ng/README3
-rw-r--r--src/3rdparty/harfbuzz-ng/TODO16
-rw-r--r--src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro19
-rw-r--r--src/3rdparty/harfbuzz-ng/include/harfbuzz/hb-ot-math.h1
-rw-r--r--src/3rdparty/harfbuzz-ng/qt_attribution.json1
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh25
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-blob.cc1
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-blob.h24
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-buffer-private.hh114
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-buffer-serialize.cc88
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-buffer.cc489
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-buffer.h254
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-cache-private.hh8
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-common.cc52
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-common.h59
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-coretext.cc267
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-coretext.h6
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-deprecated.h10
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-face.cc2
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-face.h34
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-fallback-shape.cc143
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-font-private.hh290
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-font.cc586
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-font.h246
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-open-file-private.hh4
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-open-type-private.hh45
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-cbdt-table.hh384
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-cmap-table.hh125
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-font.cc466
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-font.h2
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-glyf-table.hh8
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-head-table.hh8
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-hhea-table.hh2
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-hmtx-table.hh6
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-layout-common-private.hh551
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gdef-table.hh54
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gpos-table.hh253
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsub-table.hh87
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsubgpos-private.hh91
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-layout-jstf-table.hh2
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-layout-math-table.hh722
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-layout-private.hh208
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-layout.cc305
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-layout.h75
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-map-private.hh37
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-map.cc125
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-math.cc272
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-math.h209
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-maxp-table.hh2
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-os2-table.hh105
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-post-table.hh119
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-table.hh56
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-win1256.hh323
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic.cc249
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-default.cc4
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-hangul.cc10
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-hebrew.cc16
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-machine.hh2026
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-private.hh45
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-table.cc718
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic.cc151
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-myanmar.cc17
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-private.hh37
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-thai.cc9
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-tibetan.cc4
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-machine.hh588
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-private.hh1
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-table.cc224
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use.cc99
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-fallback-private.hh4
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-fallback.cc67
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-normalize.cc77
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-private.hh6
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape.cc196
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape.h4
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-tag.cc187
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-tag.h8
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot.h1
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-private.hh51
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-set-private.hh4
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-set.h52
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-shape-plan-private.hh9
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc107
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-shape-plan.h37
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-shape.cc17
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-shape.h10
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-shaper-list.hh3
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-unicode-private.hh61
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-unicode.cc6
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-unicode.h71
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-utf-private.hh46
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-version.h12
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb.h4
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-thai.c2
-rw-r--r--src/3rdparty/libpng/ANNOUNCE45
-rw-r--r--src/3rdparty/libpng/CHANGES354
-rw-r--r--src/3rdparty/libpng/INSTALL103
-rw-r--r--src/3rdparty/libpng/LICENSE35
-rw-r--r--src/3rdparty/libpng/README5
-rw-r--r--src/3rdparty/libpng/libpng-manual.txt65
-rw-r--r--src/3rdparty/libpng/png.c534
-rw-r--r--src/3rdparty/libpng/png.h380
-rw-r--r--src/3rdparty/libpng/pngconf.h50
-rw-r--r--src/3rdparty/libpng/pngdebug.h2
-rw-r--r--src/3rdparty/libpng/pngerror.c70
-rw-r--r--src/3rdparty/libpng/pngget.c72
-rw-r--r--src/3rdparty/libpng/pnginfo.h2
-rw-r--r--src/3rdparty/libpng/pngmem.c22
-rw-r--r--src/3rdparty/libpng/pngpread.c46
-rw-r--r--src/3rdparty/libpng/pngpriv.h275
-rw-r--r--src/3rdparty/libpng/pngread.c435
-rw-r--r--src/3rdparty/libpng/pngrio.c6
-rw-r--r--src/3rdparty/libpng/pngrtran.c96
-rw-r--r--src/3rdparty/libpng/pngrutil.c327
-rw-r--r--src/3rdparty/libpng/pngset.c304
-rw-r--r--src/3rdparty/libpng/pngstruct.h10
-rw-r--r--src/3rdparty/libpng/pngtrans.c15
-rw-r--r--src/3rdparty/libpng/pngwio.c6
-rw-r--r--src/3rdparty/libpng/pngwrite.c297
-rw-r--r--src/3rdparty/libpng/pngwtran.c10
-rw-r--r--src/3rdparty/libpng/pngwutil.c328
-rw-r--r--src/3rdparty/libpng/qt_attribution.json21
-rw-r--r--src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp6
-rw-r--r--src/corelib/Qt5CoreMacros.cmake2
-rw-r--r--src/corelib/global/qcompilerdetection.h34
-rw-r--r--src/corelib/global/qflags.h4
-rw-r--r--src/corelib/global/qfloat16.h1
-rw-r--r--src/corelib/global/qglobal.cpp6
-rw-r--r--src/corelib/global/qnumeric_p.h11
-rw-r--r--src/corelib/io/qdatastream.h8
-rw-r--r--src/corelib/io/qfiledevice.cpp3
-rw-r--r--src/corelib/io/qloggingregistry.cpp7
-rw-r--r--src/corelib/io/qsettings_mac.cpp4
-rw-r--r--src/corelib/kernel/qcore_foundation.mm12
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp8
-rw-r--r--src/corelib/kernel/qcoreapplication_win.cpp27
-rw-r--r--src/corelib/kernel/qvariant.cpp12
-rw-r--r--src/corelib/thread/qmutex.cpp3
-rw-r--r--src/corelib/tools/qalgorithms.h13
-rw-r--r--src/corelib/tools/qbytearraymatcher.cpp4
-rw-r--r--src/corelib/tools/qcollator.h2
-rw-r--r--src/corelib/tools/qcollator_icu.cpp5
-rw-r--r--src/corelib/tools/qcollator_macx.cpp5
-rw-r--r--src/corelib/tools/qcollator_p.h4
-rw-r--r--src/corelib/tools/qcollator_win.cpp3
-rw-r--r--src/corelib/tools/qdatetimeparser.cpp4
-rw-r--r--src/corelib/tools/qdatetimeparser_p.h2
-rw-r--r--src/corelib/tools/qlocale_p.h3
-rw-r--r--src/corelib/tools/qsimd_p.h51
-rw-r--r--src/corelib/tools/qstring.cpp10
-rw-r--r--src/corelib/tools/qstringlist.cpp2
-rw-r--r--src/corelib/tools/qstringmatcher.cpp2
-rw-r--r--src/corelib/tools/qunicodetools.cpp2
-rw-r--r--src/dbus/qdbusconnection_p.h2
-rw-r--r--src/dbus/qdbusmetatype.h2
-rw-r--r--src/gui/accessible/qaccessible.cpp12
-rw-r--r--src/gui/configure.json4
-rw-r--r--src/gui/image/qimage_conversions.cpp18
-rw-r--r--src/gui/image/qimage_darwin.mm4
-rw-r--r--src/gui/image/qpixmap_raster.cpp2
-rw-r--r--src/gui/image/qpnghandler.cpp6
-rw-r--r--src/gui/kernel/qdrag.cpp2
-rw-r--r--src/gui/kernel/qplatformdrag.cpp2
-rw-r--r--src/gui/kernel/qplatformwindow.cpp2
-rw-r--r--src/gui/kernel/qplatformwindow.h1
-rw-r--r--src/gui/kernel/qwindow.cpp67
-rw-r--r--src/gui/kernel/qwindow_p.h1
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp4
-rw-r--r--src/gui/painting/qdrawhelper.cpp459
-rw-r--r--src/gui/painting/qdrawhelper_mips_dsp.cpp15
-rw-r--r--src/gui/painting/qdrawhelper_mips_dsp_p.h12
-rw-r--r--src/gui/painting/qdrawhelper_neon.cpp13
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp2
-rw-r--r--src/gui/painting/qpainter.cpp1
-rw-r--r--src/gui/text/qfontmetrics.cpp6
-rw-r--r--src/gui/text/qharfbuzzng.cpp117
-rw-r--r--src/gui/text/qtextengine.cpp28
-rw-r--r--src/network/access/qhstspolicy.cpp8
-rw-r--r--src/network/socket/qnativesocketengine.cpp8
-rw-r--r--src/network/socket/qsocks5socketengine.cpp13
-rw-r--r--src/network/socket/qsocks5socketengine_p.h1
-rw-r--r--src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp2
-rw-r--r--src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp25
-rw-r--r--src/plugins/bearer/generic/generic.pro2
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp81
-rw-r--r--src/plugins/generic/tuiotouch/qtuiohandler.cpp2
-rw-r--r--src/plugins/platforms/android/qandroideventdispatcher.cpp6
-rw-r--r--src/plugins/platforms/android/qandroideventdispatcher.h4
-rw-r--r--src/plugins/platforms/android/qandroidplatformwindow.h2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm11
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm3
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm12
-rw-r--r--src/plugins/platforms/cocoa/qnswindowdelegate.mm2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp7
-rw-r--r--src/plugins/platforms/windows/openglblacklists/default.json14
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.h17
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp4
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3menu.h2
-rw-r--r--src/sql/configure.pri7
-rw-r--r--src/sql/models/qsqltablemodel.cpp5
-rw-r--r--src/sql/models/qsqltablemodel_p.h4
-rw-r--r--src/widgets/dialogs/qdialog.cpp2
-rw-r--r--src/widgets/dialogs/qdialog_p.h18
-rw-r--r--src/widgets/dialogs/qinputdialog.cpp106
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp2
-rw-r--r--src/widgets/kernel/qapplication.cpp9
-rw-r--r--src/widgets/kernel/qsizepolicy.cpp2
-rw-r--r--src/widgets/kernel/qwidget.cpp2
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp5
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp4
-rw-r--r--src/widgets/util/qundostack.cpp2
-rw-r--r--src/widgets/widgets/qmainwindow.cpp2
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp29
-rw-r--r--src/widgets/widgets/qmainwindowlayout_p.h4
-rw-r--r--src/widgets/widgets/qtabbar.cpp18
-rw-r--r--src/winmain/qtmain_win.cpp9
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp62
-rw-r--r--tests/auto/corelib/io/qsettings/qsettings.qrc1
-rw-r--r--tests/auto/corelib/io/qsettings/resourcefile6.plist10
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp18
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp5
-rw-r--r--tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp1
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp15
-rw-r--r--tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp13
-rw-r--r--tests/auto/gui/image/qpixmap/tst_qpixmap.cpp14
-rw-r--r--tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp12
-rw-r--r--tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp3
-rw-r--r--tests/auto/gui/text/qstatictext/tst_qstatictext.cpp3
-rw-r--r--tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp19
-rw-r--r--tests/auto/widgets/dialogs/qinputdialog/qinputdialog.pro2
-rw-r--r--tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp71
-rw-r--r--tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp57
-rw-r--r--tests/benchmarks/gui/painting/qtbench/benchmarktests.h6
-rw-r--r--tests/manual/diaglib/diaglib.pri2
-rw-r--r--tests/manual/windowflags/controllerwindow.cpp12
-rw-r--r--tests/manual/windowflags/controls.cpp96
-rw-r--r--tests/manual/windowflags/controls.h33
273 files changed, 12873 insertions, 6412 deletions
diff --git a/config.tests/unix/mips_dsp/mips_dsp.cpp b/config.tests/unix/mips_dsp/mips_dsp.cpp
deleted file mode 100644
index 4a3ce25672..0000000000
--- a/config.tests/unix/mips_dsp/mips_dsp.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-int main(int, char**)
-{
- int result;
- __builtin_mips_lhx(&result, 10);
- return result;
-}
diff --git a/config.tests/unix/mips_dsp/mips_dsp.pro b/config.tests/unix/mips_dsp/mips_dsp.pro
deleted file mode 100644
index 428b106c46..0000000000
--- a/config.tests/unix/mips_dsp/mips_dsp.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-SOURCES = mips_dsp.cpp
-CONFIG -= x11 qt
diff --git a/config.tests/unix/mips_dspr2/mips_dspr2.cpp b/config.tests/unix/mips_dspr2/mips_dspr2.cpp
deleted file mode 100644
index 1cf95681bb..0000000000
--- a/config.tests/unix/mips_dspr2/mips_dspr2.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-int main(int, char**)
-{
- int result, tmp1, tmp2;
- tmp1 = 10;
- tmp2 = 20;
- result = __builtin_mips_append (tmp1, tmp2, 10);
- return result;
-}
diff --git a/config.tests/unix/mips_dspr2/mips_dspr2.pro b/config.tests/unix/mips_dspr2/mips_dspr2.pro
deleted file mode 100644
index a938742229..0000000000
--- a/config.tests/unix/mips_dspr2/mips_dspr2.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-SOURCES = mips_dspr2.cpp
-CONFIG -= x11 qt
diff --git a/configure.json b/configure.json
index cb64e6313a..f8660e6d7f 100644
--- a/configure.json
+++ b/configure.json
@@ -194,7 +194,7 @@
"detectPkgConfig": [ "cross_compile", "machineTuple" ],
"library": [ "pkg-config" ],
"getPkgConfigVariable": [ "pkg-config" ],
- "neon": [ "architecture" ]
+ "subarch": [ "architecture" ]
},
"testTypeAliases": {
@@ -321,10 +321,6 @@
"type": "compile",
"test": "common/avx"
},
- "avx_apple_clang": {
- "label": "bugfree AVX support in compiler",
- "type": "avx_test_apple_clang"
- },
"avx2": {
"label": "AVX2 instructions",
"type": "compile",
@@ -386,17 +382,18 @@
},
"mips_dsp": {
"label": "MIPS DSP instructions",
- "type": "compile",
- "test": "unix/mips_dsp"
+ "type": "subarch",
+ "subarch": "dsp"
},
"mips_dspr2": {
"label": "MIPS DSPr2 instructions",
- "type": "compile",
- "test": "common/mips_dspr2"
+ "type": "subarch",
+ "subarch": "dspr2"
},
"neon": {
"label": "NEON instructions",
- "type": "neon"
+ "type": "subarch",
+ "subarch": "neon"
},
"mremap": {
@@ -466,7 +463,7 @@
"cross_compile": {
"label": "Cross compiling",
"condition": "call.crossCompile",
- "output": [ "publicConfig", "privateConfig", "publicFeature" ]
+ "output": [ "publicConfig", "privateConfig", "publicFeature", "crossCompile" ]
},
"cxx11default": {
"label": "Compiler defaults to C++11 or higher",
@@ -774,7 +771,7 @@
},
"avx": {
"label": "AVX",
- "condition": "features.sse4_2 && tests.avx && tests.avx_apple_clang",
+ "condition": "features.sse4_2 && tests.avx",
"output": [
"privateConfig",
{ "type": "define", "name": "QT_COMPILER_SUPPORTS_AVX", "value": 1 }
diff --git a/configure.pri b/configure.pri
index 75e6927d8f..2dde7477a0 100644
--- a/configure.pri
+++ b/configure.pri
@@ -274,18 +274,6 @@ defineTest(qtConfTest_architecture) {
return(true)
}
-defineTest(qtConfTest_avx_test_apple_clang) {
- !*g++*:!*-clang*: return(true)
-
- qtRunLoggedCommand("$$QMAKE_CXX --version", compiler)|return(false)
- contains(compiler, "Apple clang version [23]") {
- # Some clang versions produce internal compiler errors compiling Qt AVX code
- return(false)
- } else {
- return(true)
- }
-}
-
defineTest(qtConfTest_gnumake) {
make = $$qtConfFindInPath("gmake")
isEmpty(make): make = $$qtConfFindInPath("make")
@@ -369,8 +357,9 @@ defineTest(qtConfTest_detectPkgConfig) {
return(true)
}
-defineTest(qtConfTest_neon) {
- contains($${currentConfig}.tests.architecture.subarch, "neon"): return(true)
+defineTest(qtConfTest_subarch) {
+ subarch = $$eval($${1}.subarch)
+ contains($${currentConfig}.tests.architecture.subarch, $${subarch}): return(true)
return(false)
}
@@ -859,6 +848,9 @@ defineTest(qtConfOutput_reloadSpec) {
!isEmpty(config.input.sysroot): \
reloadSpec()
+ # toolchain.prf uses this.
+ dummy = $$qtConfEvaluate("features.cross_compile")
+
bypassNesting() {
QMAKE_INTERNAL_INCLUDED_FEATURES -= \
$$[QT_HOST_DATA/src]/mkspecs/features/mac/toolchain.prf \
@@ -942,6 +934,14 @@ defineTest(qtConfOutput_pkgConfig) {
}
}
+defineTest(qtConfOutput_crossCompile) {
+ !$${2}: return()
+
+ # We need to preempt the output here, as subsequent tests rely on it
+ CONFIG += cross_compile
+ export(CONFIG)
+}
+
defineTest(qtConfOutput_useGoldLinker) {
!$${2}: return()
@@ -1026,7 +1026,7 @@ defineTest(qtConfOutput_gccSysroot) {
defineTest(qtConfOutput_qmakeArgs) {
!$${2}: return()
- $${currentConfig}.output.privatePro = "!host_build {"
+ $${currentConfig}.output.privatePro = "!host_build|!cross_compile {"
for (a, config.input.qmakeArgs) {
$${currentConfig}.output.privatePro += " $$a"
EXTRA_QMAKE_ARGS += $$system_quote($$a)
diff --git a/doc/global/compat.qdocconf b/doc/global/compat.qdocconf
index 12d061a28a..df3f49c653 100644
--- a/doc/global/compat.qdocconf
+++ b/doc/global/compat.qdocconf
@@ -6,4 +6,5 @@ macro.endquote = "\\endquotation"
macro.relatesto = "\\relates"
spurious = "Missing comma in .*" \
- "Missing pattern .*"
+ "Missing pattern .*" \
+ "Unable to parse (QML|JavaScript).*"
diff --git a/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp b/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp
index 7a67c763d8..371e2bda4b 100644
--- a/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp
+++ b/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp
@@ -109,6 +109,19 @@ RegularExpressionDialog::RegularExpressionDialog(QWidget *parent)
refresh();
}
+void RegularExpressionDialog::setResultUiEnabled(bool enabled)
+{
+ matchDetailsTreeWidget->setEnabled(enabled);
+ namedGroupsTreeWidget->setEnabled(enabled);
+}
+
+static void setTextColor(QWidget *widget, const QColor &color)
+{
+ QPalette palette = widget->palette();
+ palette.setColor(QPalette::Text, color);
+ widget->setPalette(palette);
+}
+
void RegularExpressionDialog::refresh()
{
setUpdatesEnabled(false);
@@ -125,7 +138,30 @@ void RegularExpressionDialog::refresh()
escaped.append(QLatin1Char('"'));
escapedPatternLineEdit->setText(escaped);
+ setTextColor(patternLineEdit, subjectTextEdit->palette().color(QPalette::Text));
+ matchDetailsTreeWidget->clear();
+ namedGroupsTreeWidget->clear();
+ regexpStatusLabel->setText(QString());
+
+ if (pattern.isEmpty()) {
+ setResultUiEnabled(false);
+ setUpdatesEnabled(true);
+ return;
+ }
+
QRegularExpression rx(pattern);
+ if (!rx.isValid()) {
+ setTextColor(patternLineEdit, Qt::red);
+ regexpStatusLabel->setText(tr("Invalid: syntax error at position %1 (%2)")
+ .arg(rx.patternErrorOffset())
+ .arg(rx.errorString()));
+ setResultUiEnabled(false);
+ setUpdatesEnabled(true);
+ return;
+ }
+
+ setResultUiEnabled(true);
+
QRegularExpression::MatchType matchType = matchTypeComboBox->currentData().value<QRegularExpression::MatchType>();
QRegularExpression::PatternOptions patternOptions = QRegularExpression::NoPatternOption;
QRegularExpression::MatchOptions matchOptions = QRegularExpression::NoMatchOption;
@@ -156,60 +192,40 @@ void RegularExpressionDialog::refresh()
rx.setPatternOptions(patternOptions);
- QPalette palette = patternLineEdit->palette();
- if (rx.isValid())
- palette.setColor(QPalette::Text, subjectTextEdit->palette().color(QPalette::Text));
- else
- palette.setColor(QPalette::Text, Qt::red);
- patternLineEdit->setPalette(palette);
-
- matchDetailsTreeWidget->clear();
- matchDetailsTreeWidget->setEnabled(rx.isValid());
+ const int capturingGroupsCount = rx.captureCount() + 1;
- if (rx.isValid()) {
- const int capturingGroupsCount = rx.captureCount() + 1;
+ QRegularExpressionMatchIterator iterator = rx.globalMatch(text, offsetSpinBox->value(), matchType, matchOptions);
+ int i = 0;
- QRegularExpressionMatchIterator iterator = rx.globalMatch(text, offsetSpinBox->value(), matchType, matchOptions);
- int i = 0;
+ while (iterator.hasNext()) {
+ QRegularExpressionMatch match = iterator.next();
- while (iterator.hasNext()) {
- QRegularExpressionMatch match = iterator.next();
+ QTreeWidgetItem *matchDetailTopItem = new QTreeWidgetItem(matchDetailsTreeWidget);
+ matchDetailTopItem->setText(0, QString::number(i));
- QTreeWidgetItem *matchDetailTopItem = new QTreeWidgetItem(matchDetailsTreeWidget);
- matchDetailTopItem->setText(0, QString::number(i));
-
- for (int captureGroupIndex = 0; captureGroupIndex < capturingGroupsCount; ++captureGroupIndex) {
- QTreeWidgetItem *matchDetailItem = new QTreeWidgetItem(matchDetailTopItem);
- matchDetailItem->setText(1, QString::number(captureGroupIndex));
- matchDetailItem->setText(2, match.captured(captureGroupIndex));
- }
-
- ++i;
+ for (int captureGroupIndex = 0; captureGroupIndex < capturingGroupsCount; ++captureGroupIndex) {
+ QTreeWidgetItem *matchDetailItem = new QTreeWidgetItem(matchDetailTopItem);
+ matchDetailItem->setText(1, QString::number(captureGroupIndex));
+ matchDetailItem->setText(2, match.captured(captureGroupIndex));
}
+
+ ++i;
}
matchDetailsTreeWidget->expandAll();
- namedGroupsTreeWidget->clear();
- namedGroupsTreeWidget->setEnabled(rx.isValid());
-
- if (rx.isValid()) {
- regexpStatusLabel->setText(tr("Valid"));
+ regexpStatusLabel->setText(tr("Valid"));
- const QStringList namedCaptureGroups = rx.namedCaptureGroups();
- for (int i = 0; i < namedCaptureGroups.size(); ++i) {
- const QString currentNamedCaptureGroup = namedCaptureGroups.at(i);
+ const QStringList namedCaptureGroups = rx.namedCaptureGroups();
+ for (int i = 0; i < namedCaptureGroups.size(); ++i) {
+ const QString currentNamedCaptureGroup = namedCaptureGroups.at(i);
- QTreeWidgetItem *namedGroupItem = new QTreeWidgetItem(namedGroupsTreeWidget);
- namedGroupItem->setText(0, QString::number(i));
- namedGroupItem->setText(1, currentNamedCaptureGroup.isNull() ? tr("<no name>") : currentNamedCaptureGroup);
- }
- } else {
- regexpStatusLabel->setText(tr("Invalid: syntax error at position %1 (%2)")
- .arg(rx.patternErrorOffset())
- .arg(rx.errorString()));
+ QTreeWidgetItem *namedGroupItem = new QTreeWidgetItem(namedGroupsTreeWidget);
+ namedGroupItem->setText(0, QString::number(i));
+ namedGroupItem->setText(1, currentNamedCaptureGroup.isNull() ? tr("<no name>") : currentNamedCaptureGroup);
}
+
setUpdatesEnabled(true);
}
diff --git a/examples/widgets/tools/regularexpression/regularexpressiondialog.h b/examples/widgets/tools/regularexpression/regularexpressiondialog.h
index e75abc83e8..f7d64085fc 100644
--- a/examples/widgets/tools/regularexpression/regularexpressiondialog.h
+++ b/examples/widgets/tools/regularexpression/regularexpressiondialog.h
@@ -78,6 +78,7 @@ private:
void setupUi();
QWidget *setupLeftUi();
QWidget *setupRightUi();
+ void setResultUiEnabled(bool enabled);
QLineEdit *patternLineEdit;
QLineEdit *escapedPatternLineEdit;
diff --git a/examples/xml/xmlstreamlint/xmlstreamlint.pro b/examples/xml/xmlstreamlint/xmlstreamlint.pro
index 97526693d0..cf03c4817a 100644
--- a/examples/xml/xmlstreamlint/xmlstreamlint.pro
+++ b/examples/xml/xmlstreamlint/xmlstreamlint.pro
@@ -1,7 +1,6 @@
CONFIG += console
CONFIG -= app_bundle
QT -= gui
-QT += xml
SOURCES += main.cpp
# install
diff --git a/mkspecs/common/gcc-base.conf b/mkspecs/common/gcc-base.conf
index 0ee8769bf2..529beff4ab 100644
--- a/mkspecs/common/gcc-base.conf
+++ b/mkspecs/common/gcc-base.conf
@@ -97,6 +97,8 @@ QMAKE_CFLAGS_AVX512VL += -mavx512vl
QMAKE_CFLAGS_AVX512IFMA += -mavx512ifma
QMAKE_CFLAGS_AVX512VBMI += -mavx512vbmi
QMAKE_CFLAGS_NEON += -mfpu=neon
+QMAKE_CFLAGS_MIPS_DSP += -mdsp
+QMAKE_CFLAGS_MIPS_DSPR2 += -mdspr2
# Wrapper tools that understand .o/.a files with GIMPLE instead of machine code
QMAKE_AR_LTCG = gcc-ar cqs
diff --git a/mkspecs/common/msvc-version.conf b/mkspecs/common/msvc-version.conf
index 664e48b042..a69ea98a2d 100644
--- a/mkspecs/common/msvc-version.conf
+++ b/mkspecs/common/msvc-version.conf
@@ -66,6 +66,12 @@ greaterThan(QMAKE_MSC_VER, 1899) {
QMAKE_CFLAGS_AVX2 = -arch:AVX2
QMAKE_CXXFLAGS += -Zc:strictStrings -Zc:throwingNew
QMAKE_CXXFLAGS_WARN_ON += -w44456 -w44457 -w44458 -wd4577 -wd4467
+
+ greaterThan(QMAKE_MSC_FULL_VER, 190023918):!intel_icl {
+ isEmpty(QT_CLANG_MAJOR_VERSION)|!lessThan(QT_CLANG_MAJOR_VERSION, 4) {
+ QMAKE_CFLAGS_UTF8_SOURCE = -utf-8
+ }
+ }
}
greaterThan(QMAKE_MSC_VER, 1909) {
diff --git a/mkspecs/features/android/android_deployment_settings.prf b/mkspecs/features/android/android_deployment_settings.prf
index 848de485f8..9fe1e26075 100644
--- a/mkspecs/features/android/android_deployment_settings.prf
+++ b/mkspecs/features/android/android_deployment_settings.prf
@@ -20,7 +20,10 @@ contains(TEMPLATE, ".*app"):!build_pass: {
NDK_TOOLCHAIN_PREFIX = $$(ANDROID_NDK_TOOLCHAIN_PREFIX)
isEmpty(NDK_TOOLCHAIN_PREFIX) {
equals(ANDROID_TARGET_ARCH, x86): NDK_TOOLCHAIN_PREFIX = x86
+ else: equals(ANDROID_TARGET_ARCH, x86_64): NDK_TOOLCHAIN_PREFIX = x86_64
else: equals(ANDROID_TARGET_ARCH, mips): NDK_TOOLCHAIN_PREFIX = mipsel-linux-android
+ else: equals(ANDROID_TARGET_ARCH, mips64): NDK_TOOLCHAIN_PREFIX = mips64el-linux-android
+ else: equals(ANDROID_TARGET_ARCH, arm64-v8a): NDK_TOOLCHAIN_PREFIX = aarch64-linux-android
else: NDK_TOOLCHAIN_PREFIX = arm-linux-androideabi
}
FILE_CONTENT += " \"toolchain-prefix\": $$emitString($$NDK_TOOLCHAIN_PREFIX),"
diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
index 1099e14b17..bb5083c925 100644
--- a/mkspecs/features/create_cmake.prf
+++ b/mkspecs/features/create_cmake.prf
@@ -268,7 +268,7 @@ mac {
} else {
CMAKE_LIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}.so.$$eval(QT.$${MODULE}.VERSION)
CMAKE_LIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.so.$$eval(QT.$${MODULE}.VERSION)
- CMAKE_LIB_SONAME = lib$${CMAKE_QT_STEM}.so.$$eval(QT.$${MODULE}.MAJOR_VERSION)
+ CMAKE_LIB_SONAME = lib$${CMAKE_QT_STEM}.so.$$section(QT.$${MODULE}.VERSION, ., 0, 0)
}
}
diff --git a/mkspecs/features/ctest_testcase_common.prf b/mkspecs/features/ctest_testcase_common.prf
index 8cdad77a78..cdc5cca1d7 100644
--- a/mkspecs/features/ctest_testcase_common.prf
+++ b/mkspecs/features/ctest_testcase_common.prf
@@ -77,10 +77,11 @@ CMAKE_MODULE_VERSIONS =
CMAKE_MODULES_UNDER_TEST =
for (MODULE_UNDER_TEST, CMAKE_QT_MODULES_UNDER_TEST) {
CMAKE_NAME = $$cmakeModuleName($$MODULE_UNDER_TEST)
+ ver = $$eval(QT.$${MODULE_UNDER_TEST}.VERSION)
CMAKE_MODULE_VERSIONS += \
- -DCMAKE_$${CMAKE_NAME}_MODULE_MAJOR_VERSION=$$eval(QT.$${MODULE_UNDER_TEST}.MAJOR_VERSION) \
- -DCMAKE_$${CMAKE_NAME}_MODULE_MINOR_VERSION=$$eval(QT.$${MODULE_UNDER_TEST}.MINOR_VERSION) \
- -DCMAKE_$${CMAKE_NAME}_MODULE_PATCH_VERSION=$$eval(QT.$${MODULE_UNDER_TEST}.PATCH_VERSION)
+ -DCMAKE_$${CMAKE_NAME}_MODULE_MAJOR_VERSION=$$section(ver, ., 0, 0) \
+ -DCMAKE_$${CMAKE_NAME}_MODULE_MINOR_VERSION=$$section(ver, ., 1, 1) \
+ -DCMAKE_$${CMAKE_NAME}_MODULE_PATCH_VERSION=$$section(ver, ., 2, 2)
CMAKE_MODULES_UNDER_TEST += $$CMAKE_NAME
}
CMAKE_MODULES_UNDER_TEST = $$join(CMAKE_MODULES_UNDER_TEST, ;)
diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf
index e19e9c9760..d1ec0ce637 100644
--- a/mkspecs/features/default_post.prf
+++ b/mkspecs/features/default_post.prf
@@ -121,6 +121,11 @@ c++11|c++14|c++1z {
unset(cxxstd)
}
+utf8_source {
+ QMAKE_CFLAGS += $$QMAKE_CFLAGS_UTF8_SOURCE
+ QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_UTF8_SOURCE
+}
+
!precompile_header: SOURCES += $$NO_PCH_SOURCES
QMAKE_INCDIR += $$QMAKE_INCDIR_POST
diff --git a/mkspecs/features/qml_plugin.prf b/mkspecs/features/qml_plugin.prf
index de036c129e..d49f4c49c1 100644
--- a/mkspecs/features/qml_plugin.prf
+++ b/mkspecs/features/qml_plugin.prf
@@ -101,10 +101,10 @@ load(qt_common)
build_pass|!debug_and_release {
isEmpty(IMPORT_VERSION) {
no_cxx_module {
- IMPORT_VERSION = $$replace(MODULE_VERSION, ^(\\d+\\.\\d+).*, \\1)
+ IMPORT_VERSION = $$section(MODULE_VERSION, ., 0, 1)
isEmpty(IMPORT_VERSION): error("Must set IMPORT_VERSION")
} else {
- IMPORT_VERSION = $$eval(QT.$${CXX_MODULE}.MAJOR_VERSION).$$eval(QT.$${CXX_MODULE}.MINOR_VERSION)
+ IMPORT_VERSION = $$section(QT.$${CXX_MODULE}.VERSION, ., 0, 1)
}
}
diff --git a/mkspecs/features/qt_build_config.prf b/mkspecs/features/qt_build_config.prf
index 8b1034a2d8..150d2b2cc3 100644
--- a/mkspecs/features/qt_build_config.prf
+++ b/mkspecs/features/qt_build_config.prf
@@ -84,6 +84,7 @@ android|uikit|winrt: \
CONFIG += builtin_testdata
CONFIG += \
+ utf8_source \
create_prl link_prl \
prepare_docs qt_docs_targets \
no_private_qt_headers_warning QTDIR_build \
diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf
index c4c78554b3..3da6bf8c11 100644
--- a/mkspecs/features/qt_common.prf
+++ b/mkspecs/features/qt_common.prf
@@ -72,10 +72,10 @@ warnings_are_errors:warning_clean {
# compiler.
clang {
# Apple clang 4.0-4.2,5.0-5.1,6.0-6.4,7.0-7.3
- # Regular clang 3.3-3.9
+ # Regular clang 3.3-3.9, 4.0
apple_ver = $${QT_APPLE_CLANG_MAJOR_VERSION}.$${QT_APPLE_CLANG_MINOR_VERSION}
reg_ver = $${QT_CLANG_MAJOR_VERSION}.$${QT_CLANG_MINOR_VERSION}
- contains(apple_ver, "4\\.[012]|5\\.[01]|6\\.[01234]|7\\.[0123]")|contains(reg_ver, "3\\.[3-9]") {
+ contains(apple_ver, "4\\.[012]|5\\.[01]|6\\.[01234]|7\\.[0123]")|contains(reg_ver, "3\\.[3-9]|4\\.0") {
QMAKE_CXXFLAGS_WARN_ON += -Werror -Wno-error=\\$${LITERAL_HASH}warnings -Wno-error=deprecated-declarations $$WERROR
}
} else:intel_icc:linux {
diff --git a/mkspecs/features/qt_config.prf b/mkspecs/features/qt_config.prf
index 973a2182c9..93c54e3010 100644
--- a/mkspecs/features/qt_config.prf
+++ b/mkspecs/features/qt_config.prf
@@ -26,11 +26,7 @@ QMAKE_QT_CONFIG = $$[QT_HOST_DATA/get]/mkspecs/qconfig.pri
QT_MODULE_INCLUDE_BASE = $$[QT_INSTALL_HEADERS]
QT_MODULE_LIB_BASE = $$[QT_INSTALL_LIBS]
QT_MODULE_HOST_LIB_BASE = $$[QT_HOST_LIBS]
- QT_MODULE_PLUGIN_BASE = $$[QT_INSTALL_PLUGINS]
- QT_MODULE_LIBEXEC_BASE = $$[QT_INSTALL_LIBEXECS]
QT_MODULE_BIN_BASE = $$[QT_INSTALL_BINS]
- QT_MODULE_IMPORT_BASE = $$[QT_INSTALL_IMPORTS]
- QT_MODULE_QML_BASE = $$[QT_INSTALL_QML]
include($$mod)
}
unset(mods)
@@ -39,11 +35,7 @@ QMAKE_QT_CONFIG = $$[QT_HOST_DATA/get]/mkspecs/qconfig.pri
unset(QT_MODULE_INCLUDE_BASE)
unset(QT_MODULE_LIB_BASE)
unset(QT_MODULE_HOST_LIB_BASE)
- unset(QT_MODULE_PLUGIN_BASE)
- unset(QT_MODULE_LIBEXEC_BASE)
unset(QT_MODULE_BIN_BASE)
- unset(QT_MODULE_IMPORT_BASE)
- unset(QT_MODULE_QML_BASE)
}
load(qt_functions)
diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf
index c8e0e70f90..761b037e22 100644
--- a/mkspecs/features/qt_configure.prf
+++ b/mkspecs/features/qt_configure.prf
@@ -750,7 +750,7 @@ defineTest(qtConfTest_compile) {
qmake_args += "\"CONFIG += $$qmake_configs\""
- !$$host {
+ !$$host|!cross_compile {
# On WinRT we need to change the entry point as we cannot create windows
# applications
winrt: \
@@ -768,6 +768,12 @@ defineTest(qtConfTest_compile) {
qmake_args += $$EXTRA_QMAKE_ARGS
}
+ # make sure to make this the last override (because of -early)
+ cross_compile {
+ # must be done before loading default_pre.prf.
+ qmake_args += -early "\"CONFIG += cross_compile\""
+ }
+
# Clean up after previous run
exists($$test_out_dir/Makefile): \
QMAKE_MAKE = "$$QMAKE_MAKE clean && $$QMAKE_MAKE"
diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf
index 87cc18e8d5..22ead1b2b4 100644
--- a/mkspecs/features/qt_module.prf
+++ b/mkspecs/features/qt_module.prf
@@ -76,9 +76,9 @@ load(qt_build_paths)
header_module {
TEMPLATE = aux
- CONFIG += \
- force_qt \ # Needed for the headers_clean tests.
- qt_no_install_library
+ CONFIG += force_qt # Needed for the headers_clean tests.
+ !lib_bundle: \
+ CONFIG += qt_no_install_library
} else {
TEMPLATE = lib
}
@@ -272,7 +272,7 @@ load(qt_targets)
QMAKE_PKGCONFIG_NAME = $$replace(TARGET, ^Qt, "Qt$$QT_MAJOR_VERSION ")
QMAKE_PKGCONFIG_FILE = $$replace(TARGET, ^Qt, Qt$$QT_MAJOR_VERSION)
for(i, MODULE_DEPENDS): \
- QMAKE_PKGCONFIG_REQUIRES += $$replace(QT.$${i}.name, ^Qt, Qt$$eval(QT.$${i}.MAJOR_VERSION))
+ QMAKE_PKGCONFIG_REQUIRES += $$replace(QT.$${i}.name, ^Qt, Qt$$section(QT.$${i}.VERSION, ., 0, 0))
isEmpty(QMAKE_PKGCONFIG_DESCRIPTION): \
QMAKE_PKGCONFIG_DESCRIPTION = $$replace(TARGET, ^Qt, "Qt ") module
pclib_replace.match = $$lib_replace.match
diff --git a/mkspecs/features/qt_module_pris.prf b/mkspecs/features/qt_module_pris.prf
index 57160d11eb..77bedb1d7f 100644
--- a/mkspecs/features/qt_module_pris.prf
+++ b/mkspecs/features/qt_module_pris.prf
@@ -110,9 +110,6 @@ defineReplace(qtExportLibsForModule) {
module_master =
MODULE_PRI_CONT = \
"QT.$${MODULE_ID}.VERSION = $${VERSION}" \
- "QT.$${MODULE_ID}.MAJOR_VERSION = $$section(VERSION, ., 0, 0)" \
- "QT.$${MODULE_ID}.MINOR_VERSION = $$section(VERSION, ., 1, 1)" \
- "QT.$${MODULE_ID}.PATCH_VERSION = $$section(VERSION, ., 2, 2)" \
"" \
"QT.$${MODULE_ID}.name = $$TARGET" \
"QT.$${MODULE_ID}.module = $$module_module" \
@@ -122,10 +119,6 @@ defineReplace(qtExportLibsForModule) {
"QT.$${MODULE_ID}.frameworks =$$MODULE_FRAMEWORKS"
!host_build: MODULE_PRI_CONT += \
"QT.$${MODULE_ID}.bins = \$\$QT_MODULE_BIN_BASE" \
- "QT.$${MODULE_ID}.libexecs = \$\$QT_MODULE_LIBEXEC_BASE" \
- "QT.$${MODULE_ID}.plugins = \$\$QT_MODULE_PLUGIN_BASE" \
- "QT.$${MODULE_ID}.imports = \$\$QT_MODULE_IMPORT_BASE" \
- "QT.$${MODULE_ID}.qml = \$\$QT_MODULE_QML_BASE" \
$$module_plugtypes
MODULE_PRI_CONT += \
"QT.$${MODULE_ID}.depends =$$join(MODULE_DEPENDS, " ", " ")" \
@@ -151,9 +144,6 @@ defineReplace(qtExportLibsForModule) {
private_deps ~= s,-private$,_private,g
MODULE_PRIVATE_PRI_CONT = \
"QT.$${MODULE}_private.VERSION = $${VERSION}" \
- "QT.$${MODULE}_private.MAJOR_VERSION = $$section(VERSION, ., 0, 0)" \
- "QT.$${MODULE}_private.MINOR_VERSION = $$section(VERSION, ., 1, 1)" \
- "QT.$${MODULE}_private.PATCH_VERSION = $$section(VERSION, ., 2, 2)" \
"" \
"QT.$${MODULE}_private.name = $${TARGET}" \ # Same name as base module
"QT.$${MODULE}_private.module =" \
@@ -181,12 +171,8 @@ defineReplace(qtExportLibsForModule) {
MODULE_FWD_PRI_CONT = \
"QT_MODULE_BIN_BASE = $$val_escape(MODULE_BASE_OUTDIR)/bin" \
"QT_MODULE_INCLUDE_BASE = $$val_escape(MODULE_BASE_INCDIR)/include" \
- "QT_MODULE_IMPORT_BASE = $$val_escape(MODULE_BASE_OUTDIR)/imports" \
- "QT_MODULE_QML_BASE = $$val_escape(MODULE_BASE_OUTDIR)/qml" \
"QT_MODULE_LIB_BASE = $$val_escape(MODULE_BASE_OUTDIR)/lib" \
"QT_MODULE_HOST_LIB_BASE = $$val_escape(MODULE_BASE_OUTDIR)/lib" \
- "QT_MODULE_LIBEXEC_BASE = $$val_escape(MODULE_BASE_OUTDIR)/libexec" \
- "QT_MODULE_PLUGIN_BASE = $$val_escape(MODULE_BASE_OUTDIR)/plugins" \
"include($$val_escape(MODULE_PRI))" \
"QT.$${MODULE_ID}.priority = 1"
!internal_module:!no_private_module: MODULE_FWD_PRI_CONT += \
@@ -210,12 +196,8 @@ defineReplace(qtExportLibsForModule) {
# This is needed for the direct include() below. Mirrors qt_config.prf
QT_MODULE_BIN_BASE = $$[QT_INSTALL_BINS]
QT_MODULE_INCLUDE_BASE = $$[QT_INSTALL_HEADERS]
- QT_MODULE_IMPORT_BASE = $$[QT_INSTALL_IMPORTS]
- QT_MODULE_QML_BASE = $$[QT_INSTALL_QML]
QT_MODULE_LIB_BASE = $$[QT_INSTALL_LIBS]
QT_MODULE_HOST_LIB_BASE = $$[QT_HOST_LIBS]
- QT_MODULE_LIBEXEC_BASE = $$[QT_INSTALL_LIBEXECS]
- QT_MODULE_PLUGIN_BASE = $$[QT_INSTALL_PLUGINS]
}
@@ -227,7 +209,7 @@ defineReplace(qtExportLibsForModule) {
for(mod, mods_to_load) {
for(var, $$list(VERSION MAJOR_VERSION MINOR_VERSION PATCH_VERSION \
name module depends run_depends plugin_types module_config CONFIG DEFINES \
- priority includes bins libs frameworks libexecs plugins imports qml \
+ priority includes bins libs frameworks \
winrt_capabilities winrt_capabilities_device \
)):defined(QT.$${mod}.$$var, var):cache(QT.$${mod}.$$var, transient)
}
diff --git a/mkspecs/features/win32/default_pre.prf b/mkspecs/features/win32/default_pre.prf
index a9b247e113..4bd1653aee 100644
--- a/mkspecs/features/win32/default_pre.prf
+++ b/mkspecs/features/win32/default_pre.prf
@@ -1,2 +1,2 @@
-CONFIG = incremental_off windows $$CONFIG
+CONFIG = windows $$CONFIG
load(default_pre)
diff --git a/mkspecs/linux-icc/qmake.conf b/mkspecs/linux-icc/qmake.conf
index 8ca2767061..4822d2a0e0 100644
--- a/mkspecs/linux-icc/qmake.conf
+++ b/mkspecs/linux-icc/qmake.conf
@@ -16,7 +16,7 @@ QMAKE_CFLAGS_APP = -fPIC
QMAKE_CFLAGS_DEPS = -M
QMAKE_CFLAGS_WARN_ON = -w1 -Wall -Wcheck -wd1572,873,2259,2261,3373
QMAKE_CFLAGS_WARN_OFF = -w
-QMAKE_CFLAGS_RELEASE = -O2 -falign-functions=16 -ansi-alias -fstrict-aliasing
+QMAKE_CFLAGS_RELEASE = -O2 -ansi-alias -fstrict-aliasing
QMAKE_CFLAGS_DEBUG = -O0 -g
QMAKE_CFLAGS_SHLIB = -fPIC
QMAKE_CFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_SHLIB
diff --git a/mkspecs/win32-icc/qmake.conf b/mkspecs/win32-icc/qmake.conf
index 7cf94c3e40..6e2589b4c4 100644
--- a/mkspecs/win32-icc/qmake.conf
+++ b/mkspecs/win32-icc/qmake.conf
@@ -4,25 +4,19 @@
# Written for Intel C++
#
-MAKEFILE_GENERATOR = MSVC.NET
-QMAKE_PLATFORM = win32
-CONFIG += incremental flat debug_and_release debug_and_release_target
-DEFINES += UNICODE
-QMAKE_COMPILER_DEFINES += __INTEL_COMPILER WIN32
+# Use the Visual Studio configuration
-QMAKE_COMPILER = msvc intel_icl # icl pretends to be msvc
+include(../common/msvc-desktop.conf)
+
+# Now override with the Intel compiler settings
+
+QMAKE_COMPILER += intel_icl # icl pretends to be msvc
QMAKE_CC = icl
-QMAKE_LEX = flex
-QMAKE_LEXFLAGS =
-QMAKE_YACC = bison -y
-QMAKE_YACCFLAGS = -d
QMAKE_CFLAGS = -nologo -Zm200 /Qprec /Qwd1744,1738,809,3373
QMAKE_CFLAGS_WARN_ON = -W3 /Qwd673
QMAKE_CFLAGS_WARN_OFF = -W0 /Qwd673
-QMAKE_CFLAGS_RELEASE = -O2 -MD
QMAKE_CFLAGS_DEBUG = -Zi -MDd -Od
-QMAKE_CFLAGS_YACC =
QMAKE_CFLAGS_LTCG = -Qipo
QMAKE_CFLAGS_DISABLE_LTCG = -Qno-ipo
QMAKE_CFLAGS_SSE2 = -QxSSE2
@@ -44,15 +38,6 @@ QMAKE_CXX = $$QMAKE_CC
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS /Zc:forScope
QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON
QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
-QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
-QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG
-QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC
-QMAKE_CXXFLAGS_STL_ON = -GX
-QMAKE_CXXFLAGS_STL_OFF =
-QMAKE_CXXFLAGS_RTTI_ON = -GR
-QMAKE_CXXFLAGS_RTTI_OFF =
-QMAKE_CXXFLAGS_EXCEPTIONS_ON = -EHsc
-QMAKE_CXXFLAGS_EXCEPTIONS_OFF =
QMAKE_CXXFLAGS_CXX11 = -Qstd=c++11
# ICC supports the following but Qt won't compile
#QMAKE_CXXFLAGS_CXX14 = -Qstd=c++14
@@ -60,41 +45,14 @@ QMAKE_CXXFLAGS_CXX11 = -Qstd=c++11
QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
QMAKE_CXXFLAGS_DISABLE_LTCG = $$QMAKE_CFLAGS_DISABLE_LTCG
-QMAKE_INCDIR =
-
-QMAKE_RUN_CC = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$obj $src
-QMAKE_RUN_CC_IMP = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ $<
-QMAKE_RUN_CC_IMP_BATCH = $(CC) -c $(CFLAGS) $(INCPATH) -Fo$@ @<<
-QMAKE_RUN_CXX = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$obj $src
-QMAKE_RUN_CXX_IMP = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ $<
-QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<<
-
QMAKE_LINK = xilink
QMAKE_LFLAGS = /NOLOGO
QMAKE_LFLAGS_RELEASE =
+QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO =
QMAKE_LFLAGS_DEBUG = /DEBUG
-QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:console
-QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:windows
-QMAKE_LFLAGS_DLL = /DLL
QMAKE_LFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
-QMAKE_PREFIX_SHLIB =
-QMAKE_EXTENSION_SHLIB = dll
-QMAKE_PREFIX_STATICLIB =
-QMAKE_EXTENSION_STATICLIB = lib
-
-QMAKE_LIBS =
-QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib
-QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib ws2_32.lib ole32.lib user32.lib advapi32.lib
-QMAKE_LIBS_NETWORK = ws2_32.lib
-QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib delayimp.lib
-QMAKE_LIBS_OPENGL_ES2 = gdi32.lib user32.lib
-QMAKE_LIBS_OPENGL_ES2_DEBUG = gdi32.lib user32.lib
-QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib
-QMAKE_LIBS_QT_ENTRY = -lqtmain
-QMAKE_IDL = midl
QMAKE_LIB = xilib /NOLOGO
-QMAKE_RC = rc
DSP_EXTENSION = .dsp
diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32
index 74934cc38f..f2e9be5728 100644
--- a/qmake/Makefile.win32
+++ b/qmake/Makefile.win32
@@ -205,12 +205,12 @@ qmake_pch.obj:
{$(SOURCE_PATH)\src\corelib\json}.cpp{}.obj::
$(CXX) $(CXXFLAGS) $<
-# Make sure qstring_compat.obj isn't compiled with PCH enabled
+# Make sure qstring_compat.obj and qlibraryinfo.obj aren't compiled with PCH enabled
qstring_compat.obj: $(SOURCE_PATH)\src\corelib\tools\qstring_compat.cpp
$(CXX) -c $(CXXFLAGS_BARE) $(SOURCE_PATH)\src\corelib\tools\qstring_compat.cpp
qlibraryinfo.obj: $(SOURCE_PATH)\src\corelib\global\qlibraryinfo.cpp
- $(CXX) $(CXXFLAGS) -DQT_BUILD_QMAKE_BOOTSTRAP $(SOURCE_PATH)\src\corelib\global\qlibraryinfo.cpp
+ $(CXX) $(CXXFLAGS_BARE) -DQT_BUILD_QMAKE_BOOTSTRAP $(SOURCE_PATH)\src\corelib\global\qlibraryinfo.cpp
qlibraryinfo_final.obj: $(SOURCE_PATH)\src\corelib\global\qlibraryinfo.cpp $(BUILD_PATH)\src\corelib\global\qconfig.cpp
$(CXX) $(CXXFLAGS) -Foqlibraryinfo_final.obj $(SOURCE_PATH)\src\corelib\global\qlibraryinfo.cpp
diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp
index d4532315d0..eb4f46cd7e 100644
--- a/qmake/generators/projectgenerator.cpp
+++ b/qmake/generators/projectgenerator.cpp
@@ -326,8 +326,8 @@ ProjectGenerator::writeMakefile(QTextStream &t)
t << "######################################################################" << endl;
t << "# Automatically generated by qmake (" QMAKE_VERSION_STR ") " << QDateTime::currentDateTime().toString() << endl;
t << "######################################################################" << endl << endl;
- if (!Option::globals->precmds.isEmpty())
- t << Option::globals->precmds << endl;
+ if (!Option::globals->extra_cmds[QMakeEvalBefore].isEmpty())
+ t << Option::globals->extra_cmds[QMakeEvalBefore] << endl;
t << getWritableVar("TEMPLATE_ASSIGN", false);
if(project->first("TEMPLATE_ASSIGN") == "subdirs") {
t << endl << "# Directories" << "\n"
@@ -364,8 +364,8 @@ ProjectGenerator::writeMakefile(QTextStream &t)
<< getWritableVar("RESOURCES")
<< getWritableVar("TRANSLATIONS");
}
- if (!Option::globals->postcmds.isEmpty())
- t << Option::globals->postcmds << endl;
+ if (!Option::globals->extra_cmds[QMakeEvalAfter].isEmpty())
+ t << Option::globals->extra_cmds[QMakeEvalAfter] << endl;
return true;
}
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 3d5b80e06d..48b8bea812 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -568,8 +568,8 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
// Make sure that all temp projects are configured
// for release so that the depends are created
// without the debug <lib>dxxx.lib name mangling
- QString old_after_vars = Option::globals->postcmds;
- Option::globals->postcmds.append("\nCONFIG+=release");
+ QString old_after_vars = Option::globals->extra_cmds[QMakeEvalAfter];
+ Option::globals->extra_cmds[QMakeEvalAfter].append("\nCONFIG+=release");
QHash<QString, QString> profileLookup;
QHash<QString, QString> projGuids;
@@ -623,7 +623,7 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
t << slnConf;
// Restore previous after_user_var options
- Option::globals->postcmds = old_after_vars;
+ Option::globals->extra_cmds[QMakeEvalAfter] = old_after_vars;
t << _slnProjConfBeg;
for(QList<VcsolutionDepend*>::Iterator it = solution_cleanup.begin(); it != solution_cleanup.end(); ++it) {
diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp
index 4b3eeb4e7a..b0ed01e3aa 100644
--- a/qmake/library/qmakeevaluator.cpp
+++ b/qmake/library/qmakeevaluator.cpp
@@ -1430,6 +1430,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
if (flags & LoadPreFiles) {
setupProject();
+ if (!m_option->extra_cmds[QMakeEvalEarly].isEmpty())
+ evaluateCommand(m_option->extra_cmds[QMakeEvalEarly], fL1S("(command line -early)"));
+
for (ProValueMap::ConstIterator it = m_extraVars.constBegin();
it != m_extraVars.constEnd(); ++it)
m_valuemapStack.first().insert(it.key(), it.value());
@@ -1441,8 +1444,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
if ((vr = evaluateFeatureFile(QLatin1String("default_pre.prf"))) == ReturnError)
goto failed;
- if (!m_option->precmds.isEmpty()) {
- evaluateCommand(m_option->precmds, fL1S("(command line)"));
+ if (!m_option->extra_cmds[QMakeEvalBefore].isEmpty()) {
+ evaluateCommand(m_option->extra_cmds[QMakeEvalBefore], fL1S("(command line)"));
// Again, after user configs, to override them
applyExtraConfigs();
@@ -1455,7 +1458,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
debugMsg(1, "done visiting file %s", qPrintable(pro->fileName()));
if (flags & LoadPostFiles) {
- evaluateCommand(m_option->postcmds, fL1S("(command line -after)"));
+ evaluateCommand(m_option->extra_cmds[QMakeEvalAfter], fL1S("(command line -after)"));
// Again, to ensure the project does not mess with us.
// Specifically, do not allow a project to override debug/release within a
@@ -1465,6 +1468,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
if ((vr = evaluateFeatureFile(QLatin1String("default_post.prf"))) == ReturnError)
goto failed;
+ if (!m_option->extra_cmds[QMakeEvalLate].isEmpty())
+ evaluateCommand(m_option->extra_cmds[QMakeEvalLate], fL1S("(command line -late)"));
+
if ((vr = evaluateConfigFeatures()) == ReturnError)
goto failed;
}
diff --git a/qmake/library/qmakeglobals.cpp b/qmake/library/qmakeglobals.cpp
index b282b08d5c..b6dc8b20b6 100644
--- a/qmake/library/qmakeglobals.cpp
+++ b/qmake/library/qmakeglobals.cpp
@@ -111,10 +111,7 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments(
QString arg = args.at(*pos);
switch (argState) {
case ArgConfig:
- if (state.after)
- state.postconfigs << arg;
- else
- state.preconfigs << arg;
+ state.configs[state.phase] << arg;
break;
case ArgSpec:
qmakespec = args[*pos] = cleanSpec(state, arg);
@@ -141,8 +138,14 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments(
args.erase(args.begin() + *pos, args.end());
return ArgumentsOk;
}
- if (arg == QLatin1String("-after"))
- state.after = true;
+ if (arg == QLatin1String("-early"))
+ state.phase = QMakeEvalEarly;
+ else if (arg == QLatin1String("-before"))
+ state.phase = QMakeEvalBefore;
+ else if (arg == QLatin1String("-after"))
+ state.phase = QMakeEvalAfter;
+ else if (arg == QLatin1String("-late"))
+ state.phase = QMakeEvalLate;
else if (arg == QLatin1String("-config"))
argState = ArgConfig;
else if (arg == QLatin1String("-nocache"))
@@ -166,10 +169,7 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments(
else
return ArgumentUnknown;
} else if (arg.contains(QLatin1Char('='))) {
- if (state.after)
- state.postcmds << arg;
- else
- state.precmds << arg;
+ state.cmds[state.phase] << arg;
} else {
return ArgumentUnknown;
}
@@ -184,18 +184,17 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments(
void QMakeGlobals::commitCommandLineArguments(QMakeCmdLineParserState &state)
{
- if (!state.preconfigs.isEmpty())
- state.precmds << (fL1S("CONFIG += ") + state.preconfigs.join(QLatin1Char(' ')));
if (!state.extraargs.isEmpty()) {
QString extra = fL1S("QMAKE_EXTRA_ARGS =");
for (const QString &ea : qAsConst(state.extraargs))
extra += QLatin1Char(' ') + QMakeEvaluator::quoteValue(ProString(ea));
- state.precmds << extra;
+ state.cmds[QMakeEvalBefore] << extra;
+ }
+ for (int p = 0; p < 4; p++) {
+ if (!state.configs[p].isEmpty())
+ state.cmds[p] << (fL1S("CONFIG += ") + state.configs[p].join(QLatin1Char(' ')));
+ extra_cmds[p] = state.cmds[p].join(QLatin1Char('\n'));
}
- precmds = state.precmds.join(QLatin1Char('\n'));
- if (!state.postconfigs.isEmpty())
- state.postcmds << (fL1S("CONFIG += ") + state.postconfigs.join(QLatin1Char(' ')));
- postcmds = state.postcmds.join(QLatin1Char('\n'));
if (xqmakespec.isEmpty())
xqmakespec = qmakespec;
diff --git a/qmake/library/qmakeglobals.h b/qmake/library/qmakeglobals.h
index 86b1d28da4..000f685b73 100644
--- a/qmake/library/qmakeglobals.h
+++ b/qmake/library/qmakeglobals.h
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
class QMakeEvaluator;
+enum QMakeEvalPhase { QMakeEvalEarly, QMakeEvalBefore, QMakeEvalAfter, QMakeEvalLate };
+
class QMakeBaseKey
{
public:
@@ -83,12 +85,13 @@ public:
class QMAKE_EXPORT QMakeCmdLineParserState
{
public:
- QMakeCmdLineParserState(const QString &_pwd) : pwd(_pwd), after(false) {}
+ QMakeCmdLineParserState(const QString &_pwd) : pwd(_pwd), phase(QMakeEvalBefore) {}
QString pwd;
- QStringList precmds, preconfigs, postcmds, postconfigs, extraargs;
- bool after;
+ QStringList cmds[4], configs[4];
+ QStringList extraargs;
+ QMakeEvalPhase phase;
- void flush() { after = false; }
+ void flush() { phase = QMakeEvalBefore; }
};
class QMAKE_EXPORT QMakeGlobals
@@ -110,7 +113,7 @@ public:
QString qtconf;
QString qmakespec, xqmakespec;
QString user_template, user_template_prefix;
- QString precmds, postcmds;
+ QString extra_cmds[4];
#ifdef PROEVALUATOR_DEBUG
int debugLevel;
diff --git a/qmake/option.cpp b/qmake/option.cpp
index 9dcd343c8a..52f9cb8a0e 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -151,17 +151,23 @@ bool usage(const char *a0)
" -Wdeprecated Turn on deprecation warnings (on by default)\n"
"\n"
"Options:\n"
- " * You can place any variable assignment in options and it will be *\n"
- " * processed as if it was in [files]. These assignments will be parsed *\n"
- " * before [files]. *\n"
+ " * You can place any variable assignment in options and it will be *\n"
+ " * processed as if it was in [files]. These assignments will be *\n"
+ " * processed before [files] by default. *\n"
" -o file Write output to file\n"
" -d Increase debug level\n"
" -t templ Overrides TEMPLATE as templ\n"
" -tp prefix Overrides TEMPLATE so that prefix is prefixed into the value\n"
" -help This help\n"
" -v Version information\n"
- " -after All variable assignments after this will be\n"
+ " -early All subsequent variable assignments will be\n"
+ " parsed right before default_pre.prf\n"
+ " -before All subsequent variable assignments will be\n"
+ " parsed right before [files] (the default)\n"
+ " -after All subsequent variable assignments will be\n"
" parsed after [files]\n"
+ " -late All subsequent variable assignments will be\n"
+ " parsed right after default_post.prf\n"
" -norecursive Don't do a recursive search\n"
" -recursive Do a recursive search\n"
" -set <prop> <value> Set persistent property\n"
diff --git a/src/3rdparty/harfbuzz-ng/NEWS b/src/3rdparty/harfbuzz-ng/NEWS
index f2b0a32401..8c3ef117dd 100644
--- a/src/3rdparty/harfbuzz-ng/NEWS
+++ b/src/3rdparty/harfbuzz-ng/NEWS
@@ -1,3 +1,314 @@
+Overview of changes leading to 1.4.1
+Thursday, January 5, 2017
+====================================
+
+- Always build and use UCDN for Unicode data by default.
+ Reduces dependence on version of Unicode data in glib,
+ specially in the Windows bundles we are shipping, which
+ have very old glib.
+
+
+Overview of changes leading to 1.4.0
+Thursday, January 5, 2017
+====================================
+
+- Merged "OpenType GX" branch which adds core of support for
+ OpenType 1.8 Font Variations. To that extent, the relevant
+ new API is:
+
+New API:
+hb_font_set_var_coords_normalized()
+
+ with supporting API:
+
+New API:
+HB_OT_LAYOUT_NO_VARIATIONS_INDEX
+hb_ot_layout_table_find_feature_variations()
+hb_ot_layout_feature_with_variations_get_lookups()
+hb_shape_plan_create2()
+hb_shape_plan_create_cached2()
+
+ Currently variations in GSUB/GPOS/GDEF are fully supported,
+ and no other tables are supported. In particular, fvar/avar
+ are NOT supported, hence the hb_font_set_var_coords_normalized()
+ taking normalized coordinates. API to take design coordinates
+ will be added in the future.
+
+ HVAR/VVAR/MVAR support will also be added to hb-ot-font in the
+ future.
+
+- Fix regression in GDEF glyph class processing.
+- Add decompositions for Chakma, Limbu, and Balinese in USE shaper.
+- Misc fixes.
+
+
+Overview of changes leading to 1.3.4
+Monday, December 5, 2016
+====================================
+
+- Fix vertical glyph origin in hb-ot-font.
+- Implement CBDT/CBLC color font glyph extents in hb-ot-font.
+
+
+Overview of changes leading to 1.3.3
+Wednesday, September 28, 2016
+====================================
+
+- Implement parsing of OpenType MATH table.
+New API:
+HB_OT_TAG_MATH
+HB_OT_MATH_SCRIPT
+hb_ot_math_constant_t
+hb_ot_math_kern_t
+hb_ot_math_glyph_variant_t
+hb_ot_math_glyph_part_flags_t
+hb_ot_math_glyph_part_t
+hb_ot_math_has_data
+hb_ot_math_get_constant
+hb_ot_math_get_glyph_italics_correction
+hb_ot_math_get_glyph_top_accent_attachment
+hb_ot_math_get_glyph_kerning
+hb_ot_math_is_glyph_extended_shape
+hb_ot_math_get_glyph_variants
+hb_ot_math_get_min_connector_overlap
+hb_ot_math_get_glyph_assembly
+
+
+Overview of changes leading to 1.3.2
+Wednesday, September 27, 2016
+====================================
+
+- Fix build of hb-coretext on older OS X versions.
+
+
+Overview of changes leading to 1.3.1
+Wednesday, September 7, 2016
+====================================
+
+- Blacklist bad GDEF of more fonts (Padauk).
+- More CoreText backend crash fixes with OS X 10.9.5.
+- Misc fixes.
+
+
+Overview of changes leading to 1.3.0
+Thursday, July 21, 2016
+====================================
+
+- Update to Unicode 9.0.0
+- Move Javanese from Indic shaper to Universal Shaping Engine.
+- Allow MultipleSubst to delete a glyph (matching Windows engine).
+- Update Universal Shaping Engine to latest draft from Microsoft.
+- DirectWrite backend improvements. Note: this backend is for testing ONLY.
+- CoreText backend improvements with unreachable fonts.
+- Implement symbol fonts (cmap 3.0.0) in hb-ft and hb-ot-font.
+- Blacklist bad GDEF of more fonts (Tahoma & others).
+- Misc fixes.
+
+
+Overview of changes leading to 1.2.7
+Monday, May 2, 2016
+====================================
+
+- Blacklist another version of Times New Roman (Bold) Italic from Windows 7.
+- Fix Mongolian Free Variation Selectors shaping with certain fonts.
+- Fix Tibetan shorthand contractions shaping.
+- Improved list of language tag mappings.
+- Unbreak build on Windows CE.
+- Make 'glyf' table loading lazy in hb-ot-font.
+
+
+Overview of changes leading to 1.2.6
+Friday, April 8, 2016
+====================================
+
+- Blacklist GDEF table of another set of Times New Roman (Bold) Italic.
+- DirectWrite backend improvements. Note: DirectWrite backend is
+ exclusively for our internal testing and should NOT be used in any
+ production system whatsoever.
+
+
+Overview of changes leading to 1.2.5
+Monday, April 4, 2016
+====================================
+
+- Fix GDEF mark-filtering-set, which was broken in 1.2.3.
+
+
+Overview of changes leading to 1.2.4
+Thursday, March 17, 2016
+====================================
+
+- Synthesize GDEF glyph class for any glyph that does not have one in GDEF.
+ I really hope we don't discover broken fonts that shape badly with this
+ change.
+- Misc build and other minor fixes.
+- API changes:
+ - Added HB_NDEBUG. It's fine for production systems to define this to
+ disable high-overhead debugging checks. However, I also reduced the
+ overhead of those checks, so it's a non-issue right now. You can
+ forget it. Just not defining anything at all is fine.
+
+
+Overview of changes leading to 1.2.3
+Thursday, February 25, 2016
+====================================
+
+- Blacklist GDEF table of certain versions of Times New Roman (Bold) Italic,
+ due to bug in glyph class of ASCII double-quote character. This should
+ address "regression" introduced in 1.2.0 when we switched mark zeroing
+ in most shapers from BY_UNICODE_LATE to BY_GDEF_LATE.
+ This fourth release in a week should finally stablize things...
+
+- hb-ot-font's get_glyph() implementation saw some optimizations. Though,
+ might be really hard to measure in real-world situations.
+
+- Also, two rather small API changes:
+
+We now disable some time-consuming internal bookkeeping if built with NDEBUG
+defined. This is a first time that we use NDEBUG to disable debug code. If
+there exist production systems that do NOT want to enable NDEBUG, please let
+me know and I'll add HB_NDEBUG.
+
+Added get_nominal_glyph() and get_variation_glyph() instead of get_glyph()
+
+New API:
+- hb_font_get_nominal_glyph_func_t
+- hb_font_get_variation_glyph_func_t
+- hb_font_funcs_set_nominal_glyph_func()
+- hb_font_funcs_set_variation_glyph_func()
+- hb_font_get_nominal_glyph()
+- hb_font_get_variation_glyph()
+
+Deprecated API:
+- hb_font_get_glyph_func_t
+- hb_font_funcs_set_glyph_func()
+
+Clients that implement their own font-funcs are encouraged to replace
+their get_glyph() implementation with a get_nominal_glyph() and
+get_variation_glyph() pair. The variation version can assume that
+variation_selector argument is not zero. Old (deprecated) functions
+will continue working indefinitely using internal gymnastics; it is
+just more efficient to use the new functions.
+
+
+Overview of changes leading to 1.2.2
+Wednesday, February 24, 2016
+====================================
+
+- Fix regression with mark positioning with fonts that have
+ non-zero mark advances. This was introduced in 1.2.0 while
+ trying to make mark and cursive attachments to work together.
+ I have partially reverted that, so this version is much more
+ like what we had before. All clients who updated to 1.2.0
+ should update to this version.
+
+
+Overview of changes leading to 1.2.1
+Tuesday, February 23, 2016
+====================================
+
+- CoreText: Fix bug with wrong scale if font scale was changed later.
+ https://github.com/libass/libass/issues/212
+- CoreText: Drastically speed up font initialization.
+- CoreText: Fix tiny leak.
+- Group ZWJ/ZWNJ with previous syllable under cluster-level=0.
+ https://github.com/behdad/harfbuzz/issues/217
+- Add test/shaping/README.md about how to add tests to the suite.
+
+
+Overview of changes leading to 1.2.0
+Friday, February 19, 2016
+====================================
+
+- Fix various issues (hangs mostly) in case of memory allocation failure.
+- Change mark zeroing types of most shapers from BY_UNICODE_LATE to
+ BY_GDEF_LATE. This seems to be what Uniscribe does.
+- Change mark zeroing of USE shaper from NONE to BY_GDEF_EARLY. That's
+ what Windows does.
+- Allow GPOS cursive connection on marks, and fix the interaction with
+ mark attachment. This work resulted in some changes to how mark
+ attachments work. See:
+ https://github.com/behdad/harfbuzz/issues/211
+ https://github.com/behdad/harfbuzz/commit/86c68c7a2c971efe8e35b1f1bd99401dc8b688d2
+- Graphite2 shaper: improved negative advance handling (eg. Nastaliq).
+- Add nmake-based build system for Windows.
+- Minor speedup.
+- Misc. improvements.
+
+
+Overview of changes leading to 1.1.3
+Monday, January 11, 2016
+====================================
+
+- Ported Indic shaper to Unicode 8.0 data.
+- Universal Shaping Engine fixes.
+- Speed up CoreText shaper when font fallback happens in CoreText.
+- Documentation improvements, thanks to Khaled Hosny.
+- Very rough directwrite shaper for testing, thanks to Ebrahim Byagowi.
+- Misc bug fixes.
+- New API:
+
+ * Font extents:
+ hb_font_extents_t
+ hb_font_get_font_extents_func_t
+ hb_font_get_font_h_extents_func_t
+ hb_font_get_font_v_extents_func_t
+ hb_font_funcs_set_font_h_extents_func
+ hb_font_funcs_set_font_v_extents_func
+ hb_font_get_h_extents
+ hb_font_get_v_extents
+ hb_font_get_extents_for_direction
+
+ * Buffer message (aka debug):
+ hb_buffer_message_func_t
+ hb_buffer_set_message_func()
+ Actual message protocol to be fleshed out later.
+
+
+Overview of changes leading to 1.1.2
+Wednesday, November 26, 2015
+====================================
+
+- Fix badly-broken fallback shaper that affected terminology.
+ https://github.com/behdad/harfbuzz/issues/187
+- Fix y_scaling in Graphite shaper.
+- API changes:
+ * An unset glyph_h_origin() function in font-funcs now (sensibly)
+ implies horizontal origin at 0,0. Ie, the nil callback returns
+ true instead of false. As such, implementations that have a
+ glyph_h_origin() that simply returns true, can remove that function
+ with HarfBuzz >= 1.1.2. This results in a tiny speedup.
+
+
+Overview of changes leading to 1.1.1
+Wednesday, November 24, 2015
+====================================
+
+- Build fixes, specially for hb-coretext.
+
+
+Overview of changes leading to 1.1.0
+Wednesday, November 18, 2015
+====================================
+
+- Implement 'stch' stretch feature for Syriac Abbreviation Mark.
+ https://github.com/behdad/harfbuzz/issues/141
+- Disable use of decompose_compatibility() callback.
+- Implement "shaping" of various Unicode space characters, even
+ if the font does not support them.
+ https://github.com/behdad/harfbuzz/issues/153
+- If font does not support U+2011 NO-BREAK HYPHEN, fallback to
+ U+2010 HYPHEN.
+- Changes resulting from libFuzzer continuous fuzzing:
+ * Reject font tables that need more than 8 edits,
+ * Bound buffer growth during shaping to 32x,
+ * Fix assertions and other issues at OOM / buffer max-growth.
+- Misc fixes and optimizations.
+- API changes:
+ * All fonts created with hb_font_create() now inherit from
+ (ie. have parent) hb_font_get_empty().
+
+
Overview of changes leading to 1.0.6
Thursday, October 15, 2015
====================================
diff --git a/src/3rdparty/harfbuzz-ng/README b/src/3rdparty/harfbuzz-ng/README
index dea10688f3..69a1bdd9ff 100644
--- a/src/3rdparty/harfbuzz-ng/README
+++ b/src/3rdparty/harfbuzz-ng/README
@@ -1,6 +1,7 @@
[![Build Status](https://travis-ci.org/behdad/harfbuzz.svg)](https://travis-ci.org/behdad/harfbuzz)
+[![Build Status](https://ci.appveyor.com/api/projects/status/4oaq58ns2h0m2soa?svg=true)](https://ci.appveyor.com/project/behdad/harfbuzz)
[![Coverage Status](https://img.shields.io/coveralls/behdad/harfbuzz.svg)](https://coveralls.io/r/behdad/harfbuzz)
-[![Coverity Scan](https://img.shields.io/coverity/scan/5450.svg)](https://scan.coverity.com/projects/5450)
+[ABI Tracker](http://abi-laboratory.pro/tracker/timeline/harfbuzz/)
This is HarfBuzz, a text shaping library.
diff --git a/src/3rdparty/harfbuzz-ng/TODO b/src/3rdparty/harfbuzz-ng/TODO
index e1aa39c4c0..4f37f605b1 100644
--- a/src/3rdparty/harfbuzz-ng/TODO
+++ b/src/3rdparty/harfbuzz-ng/TODO
@@ -9,26 +9,14 @@ General fixes:
- mask propagation? (when ligation, "or" the masks).
-- Warn at compile time (and runtime with HB_DEBUG?) if no Unicode / font
- funcs found / set.
-- Do proper rounding when scaling from font space? May be a non-issue.
-
-- Misc features:
- * init/medi/fina/isol for non-cursive scripts
-
-
-API issues to fix before 1.0:
-============================
+API issues:
+===========
- API to accept a list of languages?
- Add init_func to font_funcs. Adjust ft.
-- hb-ft load_flags issues.
-
-- Add pkg-config files for glue codes (harfbuzz-glib, etc)
-
- 'const' for getter APIs? (use mutable internally)
- Remove hb_ot_shape_glyphs_closure()?
diff --git a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro
index 0f7d7c2bda..3b7b11c8ee 100644
--- a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro
+++ b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro
@@ -15,8 +15,13 @@ SHAPERS += opentype # HB's main shaper; enabling it should be enough most
# native shaper on Apple platforms; could be used alone to handle both OT and AAT fonts
darwin: SHAPERS += coretext
+# fallback shaper: not really useful with opentype or coretext shaper
+#SHAPERS += fallback
+
DEFINES += HAVE_CONFIG_H
DEFINES += HB_NO_UNICODE_FUNCS HB_DISABLE_DEPRECATED
+DEFINES += HB_NDEBUG
+DEFINES += HB_EXTERN=
# platform/compiler specific definitions
DEFINES += HAVE_ATEXIT
@@ -57,6 +62,7 @@ HEADERS += \
$$PWD/src/hb-object-private.hh \
$$PWD/src/hb-open-file-private.hh \
$$PWD/src/hb-open-type-private.hh \
+ $$PWD/src/hb-ot-cbdt-table.hh \
$$PWD/src/hb-ot-cmap-table.hh \
$$PWD/src/hb-ot-glyf-table.hh \
$$PWD/src/hb-ot-head-table.hh \
@@ -64,6 +70,8 @@ HEADERS += \
$$PWD/src/hb-ot-hmtx-table.hh \
$$PWD/src/hb-ot-maxp-table.hh \
$$PWD/src/hb-ot-name-table.hh \
+ $$PWD/src/hb-ot-os2-table.hh \
+ $$PWD/src/hb-ot-post-table.hh \
$$PWD/src/hb-private.hh \
$$PWD/src/hb-set-private.hh \
$$PWD/src/hb-shape-plan-private.hh \
@@ -94,6 +102,7 @@ contains(SHAPERS, opentype) {
$$PWD/src/hb-ot-font.cc \
$$PWD/src/hb-ot-layout.cc \
$$PWD/src/hb-ot-map.cc \
+ $$PWD/src/hb-ot-math.cc \
$$PWD/src/hb-ot-shape.cc \
$$PWD/src/hb-ot-shape-complex-arabic.cc \
$$PWD/src/hb-ot-shape-complex-default.cc \
@@ -116,11 +125,13 @@ contains(SHAPERS, opentype) {
$$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-math-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-private.hh \
$$PWD/src/hb-ot-shape-complex-arabic-table.hh \
+# $$PWD/src/hb-ot-shape-complex-arabic-win1256.hh \ # disabled with HB_NO_WIN1256
$$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 \
@@ -135,6 +146,7 @@ contains(SHAPERS, opentype) {
$$PWD/src/hb-ot.h \
$$PWD/src/hb-ot-font.h \
$$PWD/src/hb-ot-layout.h \
+ $$PWD/src/hb-ot-math.h \
$$PWD/src/hb-ot-shape.h \
$$PWD/src/hb-ot-tag.h
}
@@ -172,3 +184,10 @@ contains(SHAPERS, coretext) {
}
}
}
+
+contains(SHAPERS, fallback)|isEmpty(SHAPERS) {
+ DEFINES += HAVE_FALLBACK
+
+ SOURCES += \
+ $$PWD/src/hb-fallback-shape.cc
+}
diff --git a/src/3rdparty/harfbuzz-ng/include/harfbuzz/hb-ot-math.h b/src/3rdparty/harfbuzz-ng/include/harfbuzz/hb-ot-math.h
new file mode 100644
index 0000000000..d1b9e5ff80
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/include/harfbuzz/hb-ot-math.h
@@ -0,0 +1 @@
+#include "../../src/hb-ot-math.h"
diff --git a/src/3rdparty/harfbuzz-ng/qt_attribution.json b/src/3rdparty/harfbuzz-ng/qt_attribution.json
index 4d3eb79150..a5eee600d6 100644
--- a/src/3rdparty/harfbuzz-ng/qt_attribution.json
+++ b/src/3rdparty/harfbuzz-ng/qt_attribution.json
@@ -6,6 +6,7 @@
"Description": "HarfBuzz is an OpenType text shaping engine.",
"Homepage": "http://harfbuzz.org",
+ "Version": "1.4.1",
"License": "MIT License",
"LicenseId": "MIT",
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh
index 8179571ad2..100ba539e3 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh
@@ -119,6 +119,31 @@ typedef unsigned int hb_atomic_int_impl_t;
#define hb_atomic_ptr_impl_cmpexch(P,O,N) ( ({__machine_rw_barrier ();}), atomic_cas_ptr ((void **) (P), (void *) (O), (void *) (N)) == (void *) (O) ? true : false)
+#elif !defined(HB_NO_MT) && defined(_AIX) && defined(__IBMCPP__)
+
+#include <builtins.h>
+
+
+static inline int hb_fetch_and_add(volatile int* AI, unsigned int V) {
+ __lwsync();
+ int result = __fetch_and_add(AI, V);
+ __isync();
+ return result;
+}
+static inline int hb_compare_and_swaplp(volatile long* P, long O, long N) {
+ __sync();
+ int result = __compare_and_swaplp (P, &O, N);
+ __sync();
+ return result;
+}
+
+typedef int hb_atomic_int_impl_t;
+#define HB_ATOMIC_INT_IMPL_INIT(V) (V)
+#define hb_atomic_int_impl_add(AI, V) hb_fetch_and_add (&(AI), (V))
+
+#define hb_atomic_ptr_impl_get(P) (__sync(), (void *) *(P))
+#define hb_atomic_ptr_impl_cmpexch(P,O,N) hb_compare_and_swaplp ((long*)(P), (long)(O), (long)(N))
+
#elif !defined(HB_NO_MT)
#define HB_ATOMIC_INT_NIL 1 /* Warn that fallback implementation is in use. */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-blob.cc b/src/3rdparty/harfbuzz-ng/src/hb-blob.cc
index a6870dc06e..fb48f03cab 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-blob.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-blob.cc
@@ -104,7 +104,6 @@ hb_blob_create (const char *data,
if (!length ||
length >= 1u << 31 ||
- data + length < data /* overflows */ ||
!(blob = hb_object_create<hb_blob_t> ())) {
if (destroy)
destroy (user_data);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-blob.h b/src/3rdparty/harfbuzz-ng/src/hb-blob.h
index b2419abfd2..ef3fc98c05 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-blob.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-blob.h
@@ -64,7 +64,7 @@ typedef enum {
typedef struct hb_blob_t hb_blob_t;
-hb_blob_t *
+HB_EXTERN hb_blob_t *
hb_blob_create (const char *data,
unsigned int length,
hb_memory_mode_t mode,
@@ -77,21 +77,21 @@ hb_blob_create (const char *data,
* modify the parent data as that data may be
* shared among multiple sub-blobs.
*/
-hb_blob_t *
+HB_EXTERN hb_blob_t *
hb_blob_create_sub_blob (hb_blob_t *parent,
unsigned int offset,
unsigned int length);
-hb_blob_t *
+HB_EXTERN hb_blob_t *
hb_blob_get_empty (void);
-hb_blob_t *
+HB_EXTERN hb_blob_t *
hb_blob_reference (hb_blob_t *blob);
-void
+HB_EXTERN void
hb_blob_destroy (hb_blob_t *blob);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_blob_set_user_data (hb_blob_t *blob,
hb_user_data_key_t *key,
void * data,
@@ -99,25 +99,25 @@ hb_blob_set_user_data (hb_blob_t *blob,
hb_bool_t replace);
-void *
+HB_EXTERN void *
hb_blob_get_user_data (hb_blob_t *blob,
hb_user_data_key_t *key);
-void
+HB_EXTERN void
hb_blob_make_immutable (hb_blob_t *blob);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_blob_is_immutable (hb_blob_t *blob);
-unsigned int
+HB_EXTERN unsigned int
hb_blob_get_length (hb_blob_t *blob);
-const char *
+HB_EXTERN const char *
hb_blob_get_data (hb_blob_t *blob, unsigned int *length);
-char *
+HB_EXTERN char *
hb_blob_get_data_writable (hb_blob_t *blob, unsigned int *length);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-buffer-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-buffer-private.hh
index 7fed7386b0..bca308da2f 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-buffer-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-buffer-private.hh
@@ -35,9 +35,36 @@
#include "hb-unicode-private.hh"
+#ifndef HB_BUFFER_MAX_EXPANSION_FACTOR
+#define HB_BUFFER_MAX_EXPANSION_FACTOR 32
+#endif
+#ifndef HB_BUFFER_MAX_LEN_MIN
+#define HB_BUFFER_MAX_LEN_MIN 8192
+#endif
+#ifndef HB_BUFFER_MAX_LEN_DEFAULT
+#define HB_BUFFER_MAX_LEN_DEFAULT 0x3FFFFFFF /* Shaping more than a billion chars? Let us know! */
+#endif
+
ASSERT_STATIC (sizeof (hb_glyph_info_t) == 20);
ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t));
+HB_MARK_AS_FLAG_T (hb_buffer_flags_t);
+HB_MARK_AS_FLAG_T (hb_buffer_serialize_flags_t);
+
+enum hb_buffer_scratch_flags_t {
+ HB_BUFFER_SCRATCH_FLAG_DEFAULT = 0x00000000u,
+ HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII = 0x00000001u,
+ HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES = 0x00000002u,
+ HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK = 0x00000004u,
+ HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT = 0x00000008u,
+ /* Reserved for complex shapers' internal use. */
+ HB_BUFFER_SCRATCH_FLAG_COMPLEX0 = 0x01000000u,
+ HB_BUFFER_SCRATCH_FLAG_COMPLEX1 = 0x02000000u,
+ HB_BUFFER_SCRATCH_FLAG_COMPLEX2 = 0x04000000u,
+ HB_BUFFER_SCRATCH_FLAG_COMPLEX3 = 0x08000000u,
+};
+HB_MARK_AS_FLAG_T (hb_buffer_scratch_flags_t);
+
/*
* hb_buffer_t
@@ -52,6 +79,8 @@ struct hb_buffer_t {
hb_buffer_flags_t flags; /* BOT / EOT / etc. */
hb_buffer_cluster_level_t cluster_level;
hb_codepoint_t replacement; /* U+FFFD or something else. */
+ hb_buffer_scratch_flags_t scratch_flags; /* Have space-flallback, etc. */
+ unsigned int max_len; /* Maximum allowed len. */
/* Buffer contents */
hb_buffer_content_type_t content_type;
@@ -76,17 +105,13 @@ struct hb_buffer_t {
inline hb_glyph_position_t &cur_pos (unsigned int i = 0) { return pos[idx + i]; }
inline hb_glyph_position_t cur_pos (unsigned int i = 0) const { return pos[idx + i]; }
- inline hb_glyph_info_t &prev (void) { return out_info[out_len - 1]; }
- inline hb_glyph_info_t prev (void) const { return info[out_len - 1]; }
+ inline hb_glyph_info_t &prev (void) { return out_info[out_len ? out_len - 1 : 0]; }
+ inline hb_glyph_info_t prev (void) const { return out_info[out_len ? out_len - 1 : 0]; }
inline bool has_separate_output (void) const { return info != out_info; }
unsigned int serial;
- /* These reflect current allocations of the bytes in glyph_info_t's var1 and var2. */
- uint8_t allocated_var_bytes[8];
- const char *allocated_var_owner[8];
-
/* Text before / after the main buffer contents.
* Always in Unicode, and ordered outward.
* Index 0 is for "pre-context", 1 for "post-context". */
@@ -94,6 +119,52 @@ struct hb_buffer_t {
hb_codepoint_t context[2][CONTEXT_LENGTH];
unsigned int context_len[2];
+ /* Debugging API */
+ hb_buffer_message_func_t message_func;
+ void *message_data;
+ hb_destroy_func_t message_destroy;
+
+ /* Internal debugging. */
+ /* The bits here reflect current allocations of the bytes in glyph_info_t's var1 and var2. */
+#ifndef HB_NDEBUG
+ uint8_t allocated_var_bits;
+#endif
+ inline void allocate_var (unsigned int start, unsigned int count)
+ {
+#ifndef HB_NDEBUG
+ unsigned int end = start + count;
+ assert (end <= 8);
+ unsigned int bits = (1u<<end) - (1u<<start);
+ assert (0 == (allocated_var_bits & bits));
+ allocated_var_bits |= bits;
+#endif
+ }
+ inline void deallocate_var (unsigned int start, unsigned int count)
+ {
+#ifndef HB_NDEBUG
+ unsigned int end = start + count;
+ assert (end <= 8);
+ unsigned int bits = (1u<<end) - (1u<<start);
+ assert (bits == (allocated_var_bits & bits));
+ allocated_var_bits &= ~bits;
+#endif
+ }
+ inline void assert_var (unsigned int start, unsigned int count)
+ {
+#ifndef HB_NDEBUG
+ unsigned int end = start + count;
+ assert (end <= 8);
+ unsigned int bits = (1u<<end) - (1u<<start);
+ assert (bits == (allocated_var_bits & bits));
+#endif
+ }
+ inline void deallocate_var_all (void)
+ {
+#ifndef HB_NDEBUG
+ allocated_var_bits = 0;
+#endif
+ }
+
/* Methods */
@@ -106,11 +177,6 @@ struct hb_buffer_t {
{ return len - idx; }
inline unsigned int next_serial (void) { return serial++; }
- HB_INTERNAL void allocate_var (unsigned int byte_i, unsigned int count, const char *owner);
- HB_INTERNAL void deallocate_var (unsigned int byte_i, unsigned int count, const char *owner);
- HB_INTERNAL void assert_var (unsigned int byte_i, unsigned int count, const char *owner);
- HB_INTERNAL void deallocate_var_all (void);
-
HB_INTERNAL void add (hb_codepoint_t codepoint,
unsigned int cluster);
HB_INTERNAL void add_info (const hb_glyph_info_t &glyph_info);
@@ -203,18 +269,28 @@ struct hb_buffer_t {
inline void clear_context (unsigned int side) { context_len[side] = 0; }
HB_INTERNAL void sort (unsigned int start, unsigned int end, int(*compar)(const hb_glyph_info_t *, const hb_glyph_info_t *));
+
+ inline bool messaging (void) { return unlikely (message_func); }
+ inline bool message (hb_font_t *font, const char *fmt, ...) HB_PRINTF_FUNC(3, 4)
+ {
+ if (!messaging ())
+ return true;
+ va_list ap;
+ va_start (ap, fmt);
+ bool ret = message_impl (font, fmt, ap);
+ va_end (ap);
+ return ret;
+ }
+ HB_INTERNAL bool message_impl (hb_font_t *font, const char *fmt, va_list ap) HB_PRINTF_FUNC(3, 0);
};
-#define HB_BUFFER_XALLOCATE_VAR(b, func, var, owner) \
+#define HB_BUFFER_XALLOCATE_VAR(b, func, var) \
b->func (offsetof (hb_glyph_info_t, var) - offsetof(hb_glyph_info_t, var1), \
- sizeof (b->info[0].var), owner)
-#define HB_BUFFER_ALLOCATE_VAR(b, var) \
- HB_BUFFER_XALLOCATE_VAR (b, allocate_var, var (), #var)
-#define HB_BUFFER_DEALLOCATE_VAR(b, var) \
- HB_BUFFER_XALLOCATE_VAR (b, deallocate_var, var (), #var)
-#define HB_BUFFER_ASSERT_VAR(b, var) \
- HB_BUFFER_XALLOCATE_VAR (b, assert_var, var (), #var)
+ sizeof (b->info[0].var))
+#define HB_BUFFER_ALLOCATE_VAR(b, var) HB_BUFFER_XALLOCATE_VAR (b, allocate_var, var ())
+#define HB_BUFFER_DEALLOCATE_VAR(b, var) HB_BUFFER_XALLOCATE_VAR (b, deallocate_var, var ())
+#define HB_BUFFER_ASSERT_VAR(b, var) HB_BUFFER_XALLOCATE_VAR (b, assert_var, var ())
#endif /* HB_BUFFER_PRIVATE_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-buffer-serialize.cc b/src/3rdparty/harfbuzz-ng/src/hb-buffer-serialize.cc
index 7839cbc3f0..63a0f34669 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-buffer-serialize.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-buffer-serialize.cc
@@ -36,11 +36,12 @@ static const char *serialize_formats[] = {
/**
* hb_buffer_serialize_list_formats:
*
- *
+ * Returns a list of supported buffer serialization formats.
*
* Return value: (transfer none):
+ * A string array of buffer serialization formats. Should not be freed.
*
- * Since: 0.9.2
+ * Since: 0.9.7
**/
const char **
hb_buffer_serialize_list_formats (void)
@@ -50,14 +51,17 @@ hb_buffer_serialize_list_formats (void)
/**
* hb_buffer_serialize_format_from_string:
- * @str:
- * @len:
+ * @str: (array length=len) (element-type uint8_t): a string to parse
+ * @len: length of @str, or -1 if string is %NULL terminated
*
- *
+ * Parses a string into an #hb_buffer_serialize_format_t. Does not check if
+ * @str is a valid buffer serialization format, use
+ * hb_buffer_serialize_list_formats() to get the list of supported formats.
*
* Return value:
+ * The parsed #hb_buffer_serialize_format_t.
*
- * Since: 0.9.2
+ * Since: 0.9.7
**/
hb_buffer_serialize_format_t
hb_buffer_serialize_format_from_string (const char *str, int len)
@@ -68,13 +72,15 @@ hb_buffer_serialize_format_from_string (const char *str, int len)
/**
* hb_buffer_serialize_format_to_string:
- * @format:
+ * @format: an #hb_buffer_serialize_format_t to convert.
*
- *
+ * Converts @format to the string corresponding it, or %NULL if it is not a valid
+ * #hb_buffer_serialize_format_t.
*
- * Return value:
+ * Return value: (transfer none):
+ * A %NULL terminated string corresponding to @format. Should not be freed.
*
- * Since: 0.9.2
+ * Since: 0.9.7
**/
const char *
hb_buffer_serialize_format_to_string (hb_buffer_serialize_format_t format)
@@ -242,24 +248,51 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer,
return end - start;
}
-/* Returns number of items, starting at start, that were serialized. */
/**
* hb_buffer_serialize_glyphs:
- * @buffer: a buffer.
- * @start:
- * @end:
- * @buf: (array length=buf_size):
- * @buf_size:
- * @buf_consumed: (out):
- * @font:
- * @format:
- * @flags:
+ * @buffer: an #hb_buffer_t buffer.
+ * @start: the first item in @buffer to serialize.
+ * @end: the last item in @buffer to serialize.
+ * @buf: (out) (array length=buf_size) (element-type uint8_t): output string to
+ * write serialized buffer into.
+ * @buf_size: the size of @buf.
+ * @buf_consumed: (out) (allow-none): if not %NULL, will be set to the number of byes written into @buf.
+ * @font: (allow-none): the #hb_font_t used to shape this buffer, needed to
+ * read glyph names and extents. If %NULL, and empty font will be used.
+ * @format: the #hb_buffer_serialize_format_t to use for formatting the output.
+ * @flags: the #hb_buffer_serialize_flags_t that control what glyph properties
+ * to serialize.
*
- *
+ * Serializes @buffer into a textual representation of its glyph content,
+ * useful for showing the contents of the buffer, for example during debugging.
+ * There are currently two supported serialization formats:
+ *
+ * ## text
+ * A human-readable, plain text format.
+ * The serialized glyphs will look something like:
+ *
+ * ```
+ * [uni0651=0@518,0+0|uni0628=0+1897]
+ * ```
+ * - The serialized glyphs are delimited with `[` and `]`.
+ * - Glyphs are separated with `|`
+ * - Each glyph starts with glyph name, or glyph index if
+ * #HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES flag is set. Then,
+ * - If #HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS is not set, `=` then #hb_glyph_info_t.cluster.
+ * - If #HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS is not set, the #hb_glyph_position_t in the format:
+ * - If both #hb_glyph_position_t.x_offset and #hb_glyph_position_t.y_offset are not 0, `@x_offset,y_offset`. Then,
+ * - `+x_advance`, then `,y_advance` if #hb_glyph_position_t.y_advance is not 0. Then,
+ * - If #HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS is set, the
+ * #hb_glyph_extents_t in the format
+ * `&lt;x_bearing,y_bearing,width,height&gt;`
+ *
+ * ## json
+ * TODO.
*
* Return value:
+ * The number of serialized items.
*
- * Since: 0.9.2
+ * Since: 0.9.7
**/
unsigned int
hb_buffer_serialize_glyphs (hb_buffer_t *buffer,
@@ -267,8 +300,8 @@ hb_buffer_serialize_glyphs (hb_buffer_t *buffer,
unsigned int end,
char *buf,
unsigned int buf_size,
- unsigned int *buf_consumed, /* May be NULL */
- hb_font_t *font, /* May be NULL */
+ unsigned int *buf_consumed,
+ hb_font_t *font,
hb_buffer_serialize_format_t format,
hb_buffer_serialize_flags_t flags)
{
@@ -282,6 +315,9 @@ hb_buffer_serialize_glyphs (hb_buffer_t *buffer,
assert ((!buffer->len && buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID) ||
buffer->content_type == HB_BUFFER_CONTENT_TYPE_GLYPHS);
+ if (!buffer->have_positions)
+ flags |= HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS;
+
if (unlikely (start == end))
return 0;
@@ -355,7 +391,7 @@ parse_int (const char *pp, const char *end, int32_t *pv)
/**
* hb_buffer_deserialize_glyphs:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t buffer.
* @buf: (array length=buf_len):
* @buf_len:
* @end_ptr: (out):
@@ -366,7 +402,7 @@ parse_int (const char *pp, const char *end, int32_t *pv)
*
* Return value:
*
- * Since: 0.9.2
+ * Since: 0.9.7
**/
hb_bool_t
hb_buffer_deserialize_glyphs (hb_buffer_t *buffer,
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-buffer.cc b/src/3rdparty/harfbuzz-ng/src/hb-buffer.cc
index 50710dd23e..3940a3dbf8 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-buffer.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-buffer.cc
@@ -35,8 +35,26 @@
#define HB_DEBUG_BUFFER (HB_DEBUG+0)
#endif
+/**
+ * SECTION: hb-buffer
+ * @title: Buffers
+ * @short_description: Input and output buffers
+ * @include: hb.h
+ *
+ * Buffers serve dual role in HarfBuzz; they hold the input characters that are
+ * passed hb_shape(), and after shaping they hold the output glyphs.
+ **/
/**
+ * hb_segment_properties_equal:
+ * @a: first #hb_segment_properties_t to compare.
+ * @b: second #hb_segment_properties_t to compare.
+ *
+ * Checks the equality of two #hb_segment_properties_t's.
+ *
+ * Return value:
+ * %true if all properties of @a equal those of @b, false otherwise.
+ *
* Since: 0.9.7
**/
hb_bool_t
@@ -52,6 +70,14 @@ hb_segment_properties_equal (const hb_segment_properties_t *a,
}
/**
+ * hb_segment_properties_hash:
+ * @p: #hb_segment_properties_t to hash.
+ *
+ * Creates a hash representing @p.
+ *
+ * Return value:
+ * A hash of @p.
+ *
* Since: 0.9.7
**/
unsigned int
@@ -91,6 +117,11 @@ hb_buffer_t::enlarge (unsigned int size)
{
if (unlikely (in_error))
return false;
+ if (unlikely (size > max_len))
+ {
+ in_error = true;
+ return false;
+ }
unsigned int new_allocated = allocated;
hb_glyph_position_t *new_pos = NULL;
@@ -152,6 +183,12 @@ hb_buffer_t::shift_forward (unsigned int count)
if (unlikely (!ensure (len + count))) return false;
memmove (info + idx + count, info + idx, (len - idx) * sizeof (info[0]));
+ if (idx + count > len)
+ {
+ /* Under memory failure we might expose this area. At least
+ * clean it up. Oh well... */
+ memset (info + len, 0, (idx + count - len) * sizeof (info[0]));
+ }
len += count;
idx += count;
@@ -198,6 +235,7 @@ hb_buffer_t::clear (void)
hb_segment_properties_t default_props = HB_SEGMENT_PROPERTIES_DEFAULT;
props = default_props;
+ scratch_flags = HB_BUFFER_SCRATCH_FLAG_DEFAULT;
content_type = HB_BUFFER_CONTENT_TYPE_INVALID;
in_error = false;
@@ -210,11 +248,11 @@ hb_buffer_t::clear (void)
out_info = info;
serial = 0;
- memset (allocated_var_bytes, 0, sizeof allocated_var_bytes);
- memset (allocated_var_owner, 0, sizeof allocated_var_owner);
memset (context, 0, sizeof context);
memset (context_len, 0, sizeof context_len);
+
+ deallocate_var_all ();
}
void
@@ -375,6 +413,8 @@ hb_buffer_t::move_to (unsigned int i)
idx = i;
return true;
}
+ if (unlikely (in_error))
+ return false;
assert (i <= out_len + (len - idx));
@@ -392,6 +432,8 @@ hb_buffer_t::move_to (unsigned int i)
/* Tricky part: rewinding... */
unsigned int count = out_len - i;
+ /* This will blow in our face if memory allocation fails later
+ * in this same lookup... */
if (unlikely (idx < count && !shift_forward (count + 32))) return false;
assert (idx >= count);
@@ -627,82 +669,19 @@ hb_buffer_t::guess_segment_properties (void)
}
-static inline void
-dump_var_allocation (const hb_buffer_t *buffer)
-{
- char buf[80];
- for (unsigned int i = 0; i < 8; i++)
- buf[i] = '0' + buffer->allocated_var_bytes[7 - i];
- buf[8] = '\0';
- DEBUG_MSG (BUFFER, buffer,
- "Current var allocation: %s",
- buf);
-}
-
-void hb_buffer_t::allocate_var (unsigned int byte_i, unsigned int count, const char *owner)
-{
- assert (byte_i < 8 && byte_i + count <= 8);
-
- if (DEBUG_ENABLED (BUFFER))
- dump_var_allocation (this);
- DEBUG_MSG (BUFFER, this,
- "Allocating var bytes %d..%d for %s",
- byte_i, byte_i + count - 1, owner);
-
- for (unsigned int i = byte_i; i < byte_i + count; i++) {
- assert (!allocated_var_bytes[i]);
- allocated_var_bytes[i]++;
- allocated_var_owner[i] = owner;
- }
-}
-
-void hb_buffer_t::deallocate_var (unsigned int byte_i, unsigned int count, const char *owner)
-{
- if (DEBUG_ENABLED (BUFFER))
- dump_var_allocation (this);
-
- DEBUG_MSG (BUFFER, this,
- "Deallocating var bytes %d..%d for %s",
- byte_i, byte_i + count - 1, owner);
-
- assert (byte_i < 8 && byte_i + count <= 8);
- for (unsigned int i = byte_i; i < byte_i + count; i++) {
- assert (allocated_var_bytes[i]);
- assert (0 == strcmp (allocated_var_owner[i], owner));
- allocated_var_bytes[i]--;
- }
-}
-
-void hb_buffer_t::assert_var (unsigned int byte_i, unsigned int count, const char *owner)
-{
- if (DEBUG_ENABLED (BUFFER))
- dump_var_allocation (this);
-
- DEBUG_MSG (BUFFER, this,
- "Asserting var bytes %d..%d for %s",
- byte_i, byte_i + count - 1, owner);
-
- assert (byte_i < 8 && byte_i + count <= 8);
- for (unsigned int i = byte_i; i < byte_i + count; i++) {
- assert (allocated_var_bytes[i]);
- assert (0 == strcmp (allocated_var_owner[i], owner));
- }
-}
-
-void hb_buffer_t::deallocate_var_all (void)
-{
- memset (allocated_var_bytes, 0, sizeof (allocated_var_bytes));
- memset (allocated_var_owner, 0, sizeof (allocated_var_owner));
-}
-
/* Public API */
/**
* hb_buffer_create: (Xconstructor)
*
- *
+ * Creates a new #hb_buffer_t with all properties to defaults.
*
- * Return value: (transfer full)
+ * Return value: (transfer full):
+ * A newly allocated #hb_buffer_t with a reference count of 1. The initial
+ * reference count should be released with hb_buffer_destroy() when you are done
+ * using the #hb_buffer_t. This function never returns %NULL. If memory cannot
+ * be allocated, a special #hb_buffer_t object will be returned on which
+ * hb_buffer_allocation_successful() returns %false.
*
* Since: 0.9.2
**/
@@ -714,6 +693,8 @@ hb_buffer_create (void)
if (!(buffer = hb_object_create<hb_buffer_t> ()))
return hb_buffer_get_empty ();
+ buffer->max_len = HB_BUFFER_MAX_LEN_DEFAULT;
+
buffer->reset ();
return buffer;
@@ -738,6 +719,8 @@ hb_buffer_get_empty (void)
HB_BUFFER_FLAG_DEFAULT,
HB_BUFFER_CLUSTER_LEVEL_DEFAULT,
HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT,
+ HB_BUFFER_SCRATCH_FLAG_DEFAULT,
+ HB_BUFFER_MAX_LEN_DEFAULT,
HB_BUFFER_CONTENT_TYPE_INVALID,
HB_SEGMENT_PROPERTIES_DEFAULT,
@@ -753,11 +736,13 @@ hb_buffer_get_empty (void)
/**
* hb_buffer_reference: (skip)
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
*
- *
+ * Increases the reference count on @buffer by one. This prevents @buffer from
+ * being destroyed until a matching call to hb_buffer_destroy() is made.
*
* Return value: (transfer full):
+ * The referenced #hb_buffer_t.
*
* Since: 0.9.2
**/
@@ -769,9 +754,11 @@ hb_buffer_reference (hb_buffer_t *buffer)
/**
* hb_buffer_destroy: (skip)
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
*
- *
+ * Deallocate the @buffer.
+ * Decreases the reference count on @buffer by one. If the result is zero, then
+ * @buffer and all associated resources are freed. See hb_buffer_reference().
*
* Since: 0.9.2
**/
@@ -784,13 +771,15 @@ hb_buffer_destroy (hb_buffer_t *buffer)
free (buffer->info);
free (buffer->pos);
+ if (buffer->message_destroy)
+ buffer->message_destroy (buffer->message_data);
free (buffer);
}
/**
* hb_buffer_set_user_data: (skip)
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
* @key:
* @data:
* @destroy:
@@ -814,7 +803,7 @@ hb_buffer_set_user_data (hb_buffer_t *buffer,
/**
* hb_buffer_get_user_data: (skip)
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
* @key:
*
*
@@ -833,10 +822,11 @@ hb_buffer_get_user_data (hb_buffer_t *buffer,
/**
* hb_buffer_set_content_type:
- * @buffer: a buffer.
- * @content_type:
+ * @buffer: an #hb_buffer_t.
+ * @content_type: the type of buffer contents to set
*
- *
+ * Sets the type of @buffer contents, buffers are either empty, contain
+ * characters (before shaping) or glyphs (the result of shaping).
*
* Since: 0.9.5
**/
@@ -849,11 +839,12 @@ hb_buffer_set_content_type (hb_buffer_t *buffer,
/**
* hb_buffer_get_content_type:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
*
- *
+ * see hb_buffer_set_content_type().
*
- * Return value:
+ * Return value:
+ * The type of @buffer contents.
*
* Since: 0.9.5
**/
@@ -866,7 +857,7 @@ hb_buffer_get_content_type (hb_buffer_t *buffer)
/**
* hb_buffer_set_unicode_funcs:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
* @unicode_funcs:
*
*
@@ -891,7 +882,7 @@ hb_buffer_set_unicode_funcs (hb_buffer_t *buffer,
/**
* hb_buffer_get_unicode_funcs:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
*
*
*
@@ -907,10 +898,16 @@ hb_buffer_get_unicode_funcs (hb_buffer_t *buffer)
/**
* hb_buffer_set_direction:
- * @buffer: a buffer.
- * @direction:
+ * @buffer: an #hb_buffer_t.
+ * @direction: the #hb_direction_t of the @buffer
*
- *
+ * Set the text flow direction of the buffer. No shaping can happen without
+ * setting @buffer direction, and it controls the visual direction for the
+ * output glyphs; for RTL direction the glyphs will be reversed. Many layout
+ * features depend on the proper setting of the direction, for example,
+ * reversing RTL text before shaping, then shaping with LTR direction is not
+ * the same as keeping the text in logical order and shaping with RTL
+ * direction.
*
* Since: 0.9.2
**/
@@ -927,11 +924,12 @@ hb_buffer_set_direction (hb_buffer_t *buffer,
/**
* hb_buffer_get_direction:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
*
- *
+ * See hb_buffer_set_direction()
*
- * Return value:
+ * Return value:
+ * The direction of the @buffer.
*
* Since: 0.9.2
**/
@@ -943,10 +941,18 @@ hb_buffer_get_direction (hb_buffer_t *buffer)
/**
* hb_buffer_set_script:
- * @buffer: a buffer.
- * @script:
+ * @buffer: an #hb_buffer_t.
+ * @script: an #hb_script_t to set.
*
- *
+ * Sets the script of @buffer to @script.
+ *
+ * Script is crucial for choosing the proper shaping behaviour for scripts that
+ * require it (e.g. Arabic) and the which OpenType features defined in the font
+ * to be applied.
+ *
+ * You can pass one of the predefined #hb_script_t values, or use
+ * hb_script_from_string() or hb_script_from_iso15924_tag() to get the
+ * corresponding script from an ISO 15924 script tag.
*
* Since: 0.9.2
**/
@@ -962,11 +968,12 @@ hb_buffer_set_script (hb_buffer_t *buffer,
/**
* hb_buffer_get_script:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
*
- *
+ * See hb_buffer_set_script().
*
- * Return value:
+ * Return value:
+ * The #hb_script_t of the @buffer.
*
* Since: 0.9.2
**/
@@ -978,10 +985,18 @@ hb_buffer_get_script (hb_buffer_t *buffer)
/**
* hb_buffer_set_language:
- * @buffer: a buffer.
- * @language:
+ * @buffer: an #hb_buffer_t.
+ * @language: an hb_language_t to set.
*
- *
+ * Sets the language of @buffer to @language.
+ *
+ * Languages are crucial for selecting which OpenType feature to apply to the
+ * buffer which can result in applying language-specific behaviour. Languages
+ * are orthogonal to the scripts, and though they are related, they are
+ * different concepts and should not be confused with each other.
+ *
+ * Use hb_language_from_string() to convert from ISO 639 language codes to
+ * #hb_language_t.
*
* Since: 0.9.2
**/
@@ -997,11 +1012,12 @@ hb_buffer_set_language (hb_buffer_t *buffer,
/**
* hb_buffer_get_language:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
*
- *
+ * See hb_buffer_set_language().
*
* Return value: (transfer none):
+ * The #hb_language_t of the buffer. Must not be freed by the caller.
*
* Since: 0.9.2
**/
@@ -1013,10 +1029,12 @@ hb_buffer_get_language (hb_buffer_t *buffer)
/**
* hb_buffer_set_segment_properties:
- * @buffer: a buffer.
- * @props:
+ * @buffer: an #hb_buffer_t.
+ * @props: an #hb_segment_properties_t to use.
*
- *
+ * Sets the segment properties of the buffer, a shortcut for calling
+ * hb_buffer_set_direction(), hb_buffer_set_script() and
+ * hb_buffer_set_language() individually.
*
* Since: 0.9.7
**/
@@ -1032,10 +1050,10 @@ hb_buffer_set_segment_properties (hb_buffer_t *buffer,
/**
* hb_buffer_get_segment_properties:
- * @buffer: a buffer.
- * @props: (out):
+ * @buffer: an #hb_buffer_t.
+ * @props: (out): the output #hb_segment_properties_t.
*
- *
+ * Sets @props to the #hb_segment_properties_t of @buffer.
*
* Since: 0.9.7
**/
@@ -1049,10 +1067,10 @@ hb_buffer_get_segment_properties (hb_buffer_t *buffer,
/**
* hb_buffer_set_flags:
- * @buffer: a buffer.
- * @flags:
+ * @buffer: an #hb_buffer_t.
+ * @flags: the buffer flags to set.
*
- *
+ * Sets @buffer flags to @flags. See #hb_buffer_flags_t.
*
* Since: 0.9.7
**/
@@ -1068,11 +1086,12 @@ hb_buffer_set_flags (hb_buffer_t *buffer,
/**
* hb_buffer_get_flags:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
*
- *
+ * See hb_buffer_set_flags().
*
* Return value:
+ * The @buffer flags.
*
* Since: 0.9.7
**/
@@ -1084,7 +1103,7 @@ hb_buffer_get_flags (hb_buffer_t *buffer)
/**
* hb_buffer_set_cluster_level:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
* @cluster_level:
*
*
@@ -1103,7 +1122,7 @@ hb_buffer_set_cluster_level (hb_buffer_t *buffer,
/**
* hb_buffer_get_cluster_level:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
*
*
*
@@ -1120,10 +1139,13 @@ hb_buffer_get_cluster_level (hb_buffer_t *buffer)
/**
* hb_buffer_set_replacement_codepoint:
- * @buffer: a buffer.
- * @replacement:
+ * @buffer: an #hb_buffer_t.
+ * @replacement: the replacement #hb_codepoint_t
*
- *
+ * Sets the #hb_codepoint_t that replaces invalid entries for a given encoding
+ * when adding text to @buffer.
+ *
+ * Default is %HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT.
*
* Since: 0.9.31
**/
@@ -1139,11 +1161,12 @@ hb_buffer_set_replacement_codepoint (hb_buffer_t *buffer,
/**
* hb_buffer_get_replacement_codepoint:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
*
- *
+ * See hb_buffer_set_replacement_codepoint().
*
* Return value:
+ * The @buffer replacement #hb_codepoint_t.
*
* Since: 0.9.31
**/
@@ -1156,9 +1179,10 @@ hb_buffer_get_replacement_codepoint (hb_buffer_t *buffer)
/**
* hb_buffer_reset:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
*
- *
+ * Resets the buffer to its initial status, as if it was just newly created
+ * with hb_buffer_create().
*
* Since: 0.9.2
**/
@@ -1170,9 +1194,10 @@ hb_buffer_reset (hb_buffer_t *buffer)
/**
* hb_buffer_clear_contents:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
*
- *
+ * Similar to hb_buffer_reset(), but does not clear the Unicode functions and
+ * the replacement code point.
*
* Since: 0.9.11
**/
@@ -1184,12 +1209,13 @@ hb_buffer_clear_contents (hb_buffer_t *buffer)
/**
* hb_buffer_pre_allocate:
- * @buffer: a buffer.
- * @size:
+ * @buffer: an #hb_buffer_t.
+ * @size: number of items to pre allocate.
*
- *
+ * Pre allocates memory for @buffer to fit at least @size number of items.
*
- * Return value:
+ * Return value:
+ * %true if @buffer memory allocation succeeded, %false otherwise.
*
* Since: 0.9.2
**/
@@ -1201,11 +1227,12 @@ hb_buffer_pre_allocate (hb_buffer_t *buffer, unsigned int size)
/**
* hb_buffer_allocation_successful:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
*
- *
+ * Check if allocating memory for the buffer succeeded.
*
- * Return value:
+ * Return value:
+ * %true if @buffer memory allocation succeeded, %false otherwise.
*
* Since: 0.9.2
**/
@@ -1217,11 +1244,18 @@ hb_buffer_allocation_successful (hb_buffer_t *buffer)
/**
* hb_buffer_add:
- * @buffer: a buffer.
- * @codepoint:
- * @cluster:
+ * @buffer: an #hb_buffer_t.
+ * @codepoint: a Unicode code point.
+ * @cluster: the cluster value of @codepoint.
*
- *
+ * Appends a character with the Unicode value of @codepoint to @buffer, and
+ * gives it the initial cluster value of @cluster. Clusters can be any thing
+ * the client wants, they are usually used to refer to the index of the
+ * character in the input text stream and are output in
+ * #hb_glyph_info_t.cluster field.
+ *
+ * This function does not check the validity of @codepoint, it is up to the
+ * caller to ensure it is a valid Unicode code point.
*
* Since: 0.9.7
**/
@@ -1236,12 +1270,14 @@ hb_buffer_add (hb_buffer_t *buffer,
/**
* hb_buffer_set_length:
- * @buffer: a buffer.
- * @length:
+ * @buffer: an #hb_buffer_t.
+ * @length: the new length of @buffer.
*
- *
+ * Similar to hb_buffer_pre_allocate(), but clears any new items added at the
+ * end.
*
* Return value:
+ * %true if @buffer memory allocation succeeded, %false otherwise.
*
* Since: 0.9.2
**/
@@ -1276,11 +1312,13 @@ hb_buffer_set_length (hb_buffer_t *buffer,
/**
* hb_buffer_get_length:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
*
* Returns the number of items in the buffer.
*
- * Return value: buffer length.
+ * Return value:
+ * The @buffer length.
+ * The value valid as long as buffer has not been modified.
*
* Since: 0.9.2
**/
@@ -1292,13 +1330,15 @@ hb_buffer_get_length (hb_buffer_t *buffer)
/**
* hb_buffer_get_glyph_infos:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
* @length: (out): output array length.
*
- * Returns buffer glyph information array. Returned pointer
- * is valid as long as buffer contents are not modified.
+ * Returns @buffer glyph information array. Returned pointer
+ * is valid as long as @buffer contents are not modified.
*
- * Return value: (transfer none) (array length=length): buffer glyph information array.
+ * Return value: (transfer none) (array length=length):
+ * The @buffer glyph information array.
+ * The value valid as long as buffer has not been modified.
*
* Since: 0.9.2
**/
@@ -1314,13 +1354,15 @@ hb_buffer_get_glyph_infos (hb_buffer_t *buffer,
/**
* hb_buffer_get_glyph_positions:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
* @length: (out): output length.
*
- * Returns buffer glyph position array. Returned pointer
- * is valid as long as buffer contents are not modified.
+ * Returns @buffer glyph position array. Returned pointer
+ * is valid as long as @buffer contents are not modified.
*
- * Return value: (transfer none) (array length=length): buffer glyph position array.
+ * Return value: (transfer none) (array length=length):
+ * The @buffer glyph position array.
+ * The value valid as long as buffer has not been modified.
*
* Since: 0.9.2
**/
@@ -1339,7 +1381,7 @@ hb_buffer_get_glyph_positions (hb_buffer_t *buffer,
/**
* hb_buffer_reverse:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
*
* Reverses buffer contents.
*
@@ -1353,7 +1395,7 @@ hb_buffer_reverse (hb_buffer_t *buffer)
/**
* hb_buffer_reverse_range:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
* @start: start index.
* @end: end index.
*
@@ -1370,7 +1412,7 @@ hb_buffer_reverse_range (hb_buffer_t *buffer,
/**
* hb_buffer_reverse_clusters:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
*
* Reverses buffer clusters. That is, the buffer contents are
* reversed, then each cluster (consecutive items having the
@@ -1386,7 +1428,7 @@ hb_buffer_reverse_clusters (hb_buffer_t *buffer)
/**
* hb_buffer_guess_segment_properties:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
*
* Sets unset buffer segment properties based on buffer Unicode
* contents. If buffer is not empty, it must have content type
@@ -1485,13 +1527,18 @@ hb_buffer_add_utf (hb_buffer_t *buffer,
/**
* hb_buffer_add_utf8:
- * @buffer: a buffer.
- * @text: (array length=text_length) (element-type uint8_t):
- * @text_length:
- * @item_offset:
- * @item_length:
+ * @buffer: an #hb_buffer_t.
+ * @text: (array length=text_length) (element-type uint8_t): an array of UTF-8
+ * characters to append.
+ * @text_length: the length of the @text, or -1 if it is %NULL terminated.
+ * @item_offset: the offset of the first character to add to the @buffer.
+ * @item_length: the number of characters to add to the @buffer, or -1 for the
+ * end of @text (assuming it is %NULL terminated).
*
- *
+ * See hb_buffer_add_codepoints().
+ *
+ * Replaces invalid UTF-8 characters with the @buffer replacement code point,
+ * see hb_buffer_set_replacement_codepoint().
*
* Since: 0.9.2
**/
@@ -1507,13 +1554,17 @@ hb_buffer_add_utf8 (hb_buffer_t *buffer,
/**
* hb_buffer_add_utf16:
- * @buffer: a buffer.
- * @text: (array length=text_length):
- * @text_length:
- * @item_offset:
- * @item_length:
+ * @buffer: an #hb_buffer_t.
+ * @text: (array length=text_length): an array of UTF-16 characters to append.
+ * @text_length: the length of the @text, or -1 if it is %NULL terminated.
+ * @item_offset: the offset of the first character to add to the @buffer.
+ * @item_length: the number of characters to add to the @buffer, or -1 for the
+ * end of @text (assuming it is %NULL terminated).
*
- *
+ * See hb_buffer_add_codepoints().
+ *
+ * Replaces invalid UTF-16 characters with the @buffer replacement code point,
+ * see hb_buffer_set_replacement_codepoint().
*
* Since: 0.9.2
**/
@@ -1529,13 +1580,17 @@ hb_buffer_add_utf16 (hb_buffer_t *buffer,
/**
* hb_buffer_add_utf32:
- * @buffer: a buffer.
- * @text: (array length=text_length):
- * @text_length:
- * @item_offset:
- * @item_length:
+ * @buffer: an #hb_buffer_t.
+ * @text: (array length=text_length): an array of UTF-32 characters to append.
+ * @text_length: the length of the @text, or -1 if it is %NULL terminated.
+ * @item_offset: the offset of the first character to add to the @buffer.
+ * @item_length: the number of characters to add to the @buffer, or -1 for the
+ * end of @text (assuming it is %NULL terminated).
*
- *
+ * See hb_buffer_add_codepoints().
+ *
+ * Replaces invalid UTF-32 characters with the @buffer replacement code point,
+ * see hb_buffer_set_replacement_codepoint().
*
* Since: 0.9.2
**/
@@ -1551,13 +1606,18 @@ hb_buffer_add_utf32 (hb_buffer_t *buffer,
/**
* hb_buffer_add_latin1:
- * @buffer: a buffer.
- * @text: (array length=text_length) (element-type uint8_t):
- * @text_length:
- * @item_offset:
- * @item_length:
+ * @buffer: an #hb_buffer_t.
+ * @text: (array length=text_length) (element-type uint8_t): an array of UTF-8
+ * characters to append.
+ * @text_length: the length of the @text, or -1 if it is %NULL terminated.
+ * @item_offset: the offset of the first character to add to the @buffer.
+ * @item_length: the number of characters to add to the @buffer, or -1 for the
+ * end of @text (assuming it is %NULL terminated).
*
- *
+ * Similar to hb_buffer_add_codepoints(), but allows only access to first 256
+ * Unicode code points that can fit in 8-bit strings.
+ *
+ * <note>Has nothing to do with non-Unicode Latin-1 encoding.</note>
*
* Since: 0.9.39
**/
@@ -1573,13 +1633,25 @@ hb_buffer_add_latin1 (hb_buffer_t *buffer,
/**
* hb_buffer_add_codepoints:
- * @buffer: a buffer.
- * @text: (array length=text_length):
- * @text_length:
- * @item_offset:
- * @item_length:
- *
- *
+ * @buffer: a #hb_buffer_t to append characters to.
+ * @text: (array length=text_length): an array of Unicode code points to append.
+ * @text_length: the length of the @text, or -1 if it is %NULL terminated.
+ * @item_offset: the offset of the first code point to add to the @buffer.
+ * @item_length: the number of code points to add to the @buffer, or -1 for the
+ * end of @text (assuming it is %NULL terminated).
+ *
+ * Appends characters from @text array to @buffer. The @item_offset is the
+ * position of the first character from @text that will be appended, and
+ * @item_length is the number of character. When shaping part of a larger text
+ * (e.g. a run of text from a paragraph), instead of passing just the substring
+ * corresponding to the run, it is preferable to pass the whole
+ * paragraph and specify the run start and length as @item_offset and
+ * @item_length, respectively, to give HarfBuzz the full context to be able,
+ * for example, to do cross-run Arabic shaping or properly handle combining
+ * marks at stat of run.
+ *
+ * This function does not check the validity of @text, it is up to the caller
+ * to ensure it contains a valid Unicode code points.
*
* Since: 0.9.31
**/
@@ -1651,9 +1723,12 @@ normalize_glyphs_cluster (hb_buffer_t *buffer,
/**
* hb_buffer_normalize_glyphs:
- * @buffer: a buffer.
+ * @buffer: an #hb_buffer_t.
*
- *
+ * Reorders a glyph buffer to have canonical in-cluster glyph order / position.
+ * The resulting clusters should behave identical to pre-reordering clusters.
+ *
+ * <note>This has nothing to do with Unicode normalization.</note>
*
* Since: 0.9.2
**/
@@ -1699,3 +1774,45 @@ hb_buffer_t::sort (unsigned int start, unsigned int end, int(*compar)(const hb_g
}
}
}
+
+/*
+ * Debugging.
+ */
+
+/**
+ * hb_buffer_set_message_func:
+ * @buffer: an #hb_buffer_t.
+ * @func: (closure user_data) (destroy destroy) (scope notified):
+ * @user_data:
+ * @destroy:
+ *
+ *
+ *
+ * Since: 1.1.3
+ **/
+void
+hb_buffer_set_message_func (hb_buffer_t *buffer,
+ hb_buffer_message_func_t func,
+ void *user_data, hb_destroy_func_t destroy)
+{
+ if (buffer->message_destroy)
+ buffer->message_destroy (buffer->message_data);
+
+ if (func) {
+ buffer->message_func = func;
+ buffer->message_data = user_data;
+ buffer->message_destroy = destroy;
+ } else {
+ buffer->message_func = NULL;
+ buffer->message_data = NULL;
+ buffer->message_destroy = NULL;
+ }
+}
+
+bool
+hb_buffer_t::message_impl (hb_font_t *font, const char *fmt, va_list ap)
+{
+ char buf[100];
+ vsnprintf (buf, sizeof (buf), fmt, ap);
+ return (bool) this->message_func (this, font, buf, this->message_data);
+}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-buffer.h b/src/3rdparty/harfbuzz-ng/src/hb-buffer.h
index bb89dc3de7..bf289c19b3 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-buffer.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-buffer.h
@@ -40,7 +40,27 @@
HB_BEGIN_DECLS
-
+/**
+ * hb_glyph_info_t:
+ * @codepoint: either a Unicode code point (before shaping) or a glyph index
+ * (after shaping).
+ * @mask:
+ * @cluster: the index of the character in the original text that corresponds
+ * to this #hb_glyph_info_t, or whatever the client passes to
+ * hb_buffer_add(). More than one #hb_glyph_info_t can have the same
+ * @cluster value, if they resulted from the same character (e.g. one
+ * to many glyph substitution), and when more than one character gets
+ * merged in the same glyph (e.g. many to one glyph substitution) the
+ * #hb_glyph_info_t will have the smallest cluster value of them.
+ * By default some characters are merged into the same cluster
+ * (e.g. combining marks have the same cluster as their bases)
+ * even if they are separate glyphs, hb_buffer_set_cluster_level()
+ * allow selecting more fine-grained cluster handling.
+ *
+ * The #hb_glyph_info_t is the structure that holds information about the
+ * glyphs and their relation to input text.
+ *
+ */
typedef struct hb_glyph_info_t {
hb_codepoint_t codepoint;
hb_mask_t mask;
@@ -51,6 +71,22 @@ typedef struct hb_glyph_info_t {
hb_var_int_t var2;
} hb_glyph_info_t;
+/**
+ * hb_glyph_position_t:
+ * @x_advance: how much the line advances after drawing this glyph when setting
+ * text in horizontal direction.
+ * @y_advance: how much the line advances after drawing this glyph when setting
+ * text in vertical direction.
+ * @x_offset: how much the glyph moves on the X-axis before drawing it, this
+ * should not affect how much the line advances.
+ * @y_offset: how much the glyph moves on the Y-axis before drawing it, this
+ * should not affect how much the line advances.
+ *
+ * The #hb_glyph_position_t is the structure that holds the positions of the
+ * glyph in both horizontal and vertical directions. All positions in
+ * #hb_glyph_position_t are relative to the current point.
+ *
+ */
typedef struct hb_glyph_position_t {
hb_position_t x_advance;
hb_position_t y_advance;
@@ -61,7 +97,16 @@ typedef struct hb_glyph_position_t {
hb_var_int_t var;
} hb_glyph_position_t;
-
+/**
+ * hb_segment_properties_t:
+ * @direction: the #hb_direction_t of the buffer, see hb_buffer_set_direction().
+ * @script: the #hb_script_t of the buffer, see hb_buffer_set_script().
+ * @language: the #hb_language_t of the buffer, see hb_buffer_set_language().
+ *
+ * The structure that holds various text properties of an #hb_buffer_t. Can be
+ * set and retrieved using hb_buffer_set_segment_properties() and
+ * hb_buffer_get_segment_properties(), respectively.
+ */
typedef struct hb_segment_properties_t {
hb_direction_t direction;
hb_script_t script;
@@ -77,101 +122,125 @@ typedef struct hb_segment_properties_t {
NULL, \
NULL}
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_segment_properties_equal (const hb_segment_properties_t *a,
const hb_segment_properties_t *b);
-unsigned int
+HB_EXTERN unsigned int
hb_segment_properties_hash (const hb_segment_properties_t *p);
-/*
- * hb_buffer_t
+/**
+ * hb_buffer_t:
+ *
+ * The main structure holding the input text and its properties before shaping,
+ * and output glyphs and their information after shaping.
*/
typedef struct hb_buffer_t hb_buffer_t;
-hb_buffer_t *
+HB_EXTERN hb_buffer_t *
hb_buffer_create (void);
-hb_buffer_t *
+HB_EXTERN hb_buffer_t *
hb_buffer_get_empty (void);
-hb_buffer_t *
+HB_EXTERN hb_buffer_t *
hb_buffer_reference (hb_buffer_t *buffer);
-void
+HB_EXTERN void
hb_buffer_destroy (hb_buffer_t *buffer);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_buffer_set_user_data (hb_buffer_t *buffer,
hb_user_data_key_t *key,
void * data,
hb_destroy_func_t destroy,
hb_bool_t replace);
-void *
+HB_EXTERN void *
hb_buffer_get_user_data (hb_buffer_t *buffer,
hb_user_data_key_t *key);
-
+/**
+ * hb_buffer_content_type_t:
+ * @HB_BUFFER_CONTENT_TYPE_INVALID: Initial value for new buffer.
+ * @HB_BUFFER_CONTENT_TYPE_UNICODE: The buffer contains input characters (before shaping).
+ * @HB_BUFFER_CONTENT_TYPE_GLYPHS: The buffer contains output glyphs (after shaping).
+ */
typedef enum {
HB_BUFFER_CONTENT_TYPE_INVALID = 0,
HB_BUFFER_CONTENT_TYPE_UNICODE,
HB_BUFFER_CONTENT_TYPE_GLYPHS
} hb_buffer_content_type_t;
-void
+HB_EXTERN void
hb_buffer_set_content_type (hb_buffer_t *buffer,
hb_buffer_content_type_t content_type);
-hb_buffer_content_type_t
+HB_EXTERN hb_buffer_content_type_t
hb_buffer_get_content_type (hb_buffer_t *buffer);
-void
+HB_EXTERN void
hb_buffer_set_unicode_funcs (hb_buffer_t *buffer,
hb_unicode_funcs_t *unicode_funcs);
-hb_unicode_funcs_t *
+HB_EXTERN hb_unicode_funcs_t *
hb_buffer_get_unicode_funcs (hb_buffer_t *buffer);
-void
+HB_EXTERN void
hb_buffer_set_direction (hb_buffer_t *buffer,
hb_direction_t direction);
-hb_direction_t
+HB_EXTERN hb_direction_t
hb_buffer_get_direction (hb_buffer_t *buffer);
-void
+HB_EXTERN void
hb_buffer_set_script (hb_buffer_t *buffer,
hb_script_t script);
-hb_script_t
+HB_EXTERN hb_script_t
hb_buffer_get_script (hb_buffer_t *buffer);
-void
+HB_EXTERN void
hb_buffer_set_language (hb_buffer_t *buffer,
hb_language_t language);
-hb_language_t
+HB_EXTERN hb_language_t
hb_buffer_get_language (hb_buffer_t *buffer);
-void
+HB_EXTERN void
hb_buffer_set_segment_properties (hb_buffer_t *buffer,
const hb_segment_properties_t *props);
-void
+HB_EXTERN void
hb_buffer_get_segment_properties (hb_buffer_t *buffer,
hb_segment_properties_t *props);
-void
+HB_EXTERN void
hb_buffer_guess_segment_properties (hb_buffer_t *buffer);
-/*
+/**
+ * hb_buffer_flags_t:
+ * @HB_BUFFER_FLAG_DEFAULT: the default buffer flag.
+ * @HB_BUFFER_FLAG_BOT: flag indicating that special handling of the beginning
+ * of text paragraph can be applied to this buffer. Should usually
+ * be set, unless you are passing to the buffer only part
+ * of the text without the full context.
+ * @HB_BUFFER_FLAG_EOT: flag indicating that special handling of the end of text
+ * paragraph can be applied to this buffer, similar to
+ * @HB_BUFFER_FLAG_EOT.
+ * @HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES:
+ * flag indication that character with Default_Ignorable
+ * Unicode property should use the corresponding glyph
+ * from the font, instead of hiding them (currently done
+ * by replacing them with the space glyph and zeroing the
+ * advance width.)
+ *
* Since: 0.9.20
*/
typedef enum { /*< flags >*/
@@ -181,11 +250,11 @@ typedef enum { /*< flags >*/
HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES = 0x00000004u
} hb_buffer_flags_t;
-void
+HB_EXTERN void
hb_buffer_set_flags (hb_buffer_t *buffer,
hb_buffer_flags_t flags);
-hb_buffer_flags_t
+HB_EXTERN hb_buffer_flags_t
hb_buffer_get_flags (hb_buffer_t *buffer);
/*
@@ -198,93 +267,92 @@ typedef enum {
HB_BUFFER_CLUSTER_LEVEL_DEFAULT = HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES
} hb_buffer_cluster_level_t;
-void
+HB_EXTERN void
hb_buffer_set_cluster_level (hb_buffer_t *buffer,
hb_buffer_cluster_level_t cluster_level);
-hb_buffer_cluster_level_t
+HB_EXTERN hb_buffer_cluster_level_t
hb_buffer_get_cluster_level (hb_buffer_t *buffer);
+/**
+ * HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT:
+ *
+ * The default code point for replacing invalid characters in a given encoding.
+ * Set to U+FFFD REPLACEMENT CHARACTER.
+ *
+ * Since: 0.9.31
+ */
#define HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT 0xFFFDu
-/* Sets codepoint used to replace invalid UTF-8/16/32 entries.
- * Default is 0xFFFDu. */
-void
+HB_EXTERN void
hb_buffer_set_replacement_codepoint (hb_buffer_t *buffer,
hb_codepoint_t replacement);
-hb_codepoint_t
+HB_EXTERN hb_codepoint_t
hb_buffer_get_replacement_codepoint (hb_buffer_t *buffer);
-/* Resets the buffer. Afterwards it's as if it was just created,
- * except that it has a larger buffer allocated perhaps... */
-void
+HB_EXTERN void
hb_buffer_reset (hb_buffer_t *buffer);
-/* Like reset, but does NOT clear unicode_funcs and replacement_codepoint. */
-void
+HB_EXTERN void
hb_buffer_clear_contents (hb_buffer_t *buffer);
-/* Returns false if allocation failed */
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_buffer_pre_allocate (hb_buffer_t *buffer,
unsigned int size);
-/* Returns false if allocation has failed before */
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_buffer_allocation_successful (hb_buffer_t *buffer);
-void
+HB_EXTERN void
hb_buffer_reverse (hb_buffer_t *buffer);
-void
+HB_EXTERN void
hb_buffer_reverse_range (hb_buffer_t *buffer,
unsigned int start, unsigned int end);
-void
+HB_EXTERN void
hb_buffer_reverse_clusters (hb_buffer_t *buffer);
/* Filling the buffer in */
-void
+HB_EXTERN void
hb_buffer_add (hb_buffer_t *buffer,
hb_codepoint_t codepoint,
unsigned int cluster);
-void
+HB_EXTERN void
hb_buffer_add_utf8 (hb_buffer_t *buffer,
const char *text,
int text_length,
unsigned int item_offset,
int item_length);
-void
+HB_EXTERN void
hb_buffer_add_utf16 (hb_buffer_t *buffer,
const uint16_t *text,
int text_length,
unsigned int item_offset,
int item_length);
-void
+HB_EXTERN void
hb_buffer_add_utf32 (hb_buffer_t *buffer,
const uint32_t *text,
int text_length,
unsigned int item_offset,
int item_length);
-/* Allows only access to first 256 Unicode codepoints. */
-void
+HB_EXTERN void
hb_buffer_add_latin1 (hb_buffer_t *buffer,
const uint8_t *text,
int text_length,
unsigned int item_offset,
int item_length);
-/* Like add_utf32 but does NOT check for invalid Unicode codepoints. */
-void
+HB_EXTERN void
hb_buffer_add_codepoints (hb_buffer_t *buffer,
const hb_codepoint_t *text,
int text_length,
@@ -292,32 +360,25 @@ hb_buffer_add_codepoints (hb_buffer_t *buffer,
int item_length);
-/* Clears any new items added at the end */
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_buffer_set_length (hb_buffer_t *buffer,
unsigned int length);
-/* Return value valid as long as buffer not modified */
-unsigned int
+HB_EXTERN unsigned int
hb_buffer_get_length (hb_buffer_t *buffer);
/* Getting glyphs out of the buffer */
-/* Return value valid as long as buffer not modified */
-hb_glyph_info_t *
+HB_EXTERN hb_glyph_info_t *
hb_buffer_get_glyph_infos (hb_buffer_t *buffer,
unsigned int *length);
-/* Return value valid as long as buffer not modified */
-hb_glyph_position_t *
+HB_EXTERN hb_glyph_position_t *
hb_buffer_get_glyph_positions (hb_buffer_t *buffer,
unsigned int *length);
-/* Reorders a glyph buffer to have canonical in-cluster glyph order / position.
- * The resulting clusters should behave identical to pre-reordering clusters.
- * NOTE: This has nothing to do with Unicode normalization. */
-void
+HB_EXTERN void
hb_buffer_normalize_glyphs (hb_buffer_t *buffer);
@@ -325,7 +386,16 @@ hb_buffer_normalize_glyphs (hb_buffer_t *buffer);
* Serialize
*/
-/*
+/**
+ * hb_buffer_serialize_flags_t:
+ * @HB_BUFFER_SERIALIZE_FLAG_DEFAULT: serialize glyph names, clusters and positions.
+ * @HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS: do not serialize glyph cluster.
+ * @HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS: do not serialize glyph position information.
+ * @HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES: do no serialize glyph name.
+ * @HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS: serialize glyph extents.
+ *
+ * Flags that control what glyph information are serialized in hb_buffer_serialize_glyphs().
+ *
* Since: 0.9.20
*/
typedef enum { /*< flags >*/
@@ -336,43 +406,67 @@ typedef enum { /*< flags >*/
HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS = 0x00000008u
} hb_buffer_serialize_flags_t;
+/**
+ * hb_buffer_serialize_format_t:
+ * @HB_BUFFER_SERIALIZE_FORMAT_TEXT: a human-readable, plain text format.
+ * @HB_BUFFER_SERIALIZE_FORMAT_JSON: a machine-readable JSON format.
+ * @HB_BUFFER_SERIALIZE_FORMAT_INVALID: invalid format.
+ *
+ * The buffer serialization and de-serialization format used in
+ * hb_buffer_serialize_glyphs() and hb_buffer_deserialize_glyphs().
+ *
+ * Since: 0.9.2
+ */
typedef enum {
HB_BUFFER_SERIALIZE_FORMAT_TEXT = HB_TAG('T','E','X','T'),
HB_BUFFER_SERIALIZE_FORMAT_JSON = HB_TAG('J','S','O','N'),
HB_BUFFER_SERIALIZE_FORMAT_INVALID = HB_TAG_NONE
} hb_buffer_serialize_format_t;
-/* len=-1 means str is NUL-terminated. */
-hb_buffer_serialize_format_t
+HB_EXTERN hb_buffer_serialize_format_t
hb_buffer_serialize_format_from_string (const char *str, int len);
-const char *
+HB_EXTERN const char *
hb_buffer_serialize_format_to_string (hb_buffer_serialize_format_t format);
-const char **
+HB_EXTERN const char **
hb_buffer_serialize_list_formats (void);
-/* Returns number of items, starting at start, that were serialized. */
-unsigned int
+HB_EXTERN unsigned int
hb_buffer_serialize_glyphs (hb_buffer_t *buffer,
unsigned int start,
unsigned int end,
char *buf,
unsigned int buf_size,
- unsigned int *buf_consumed, /* May be NULL */
- hb_font_t *font, /* May be NULL */
+ unsigned int *buf_consumed,
+ hb_font_t *font,
hb_buffer_serialize_format_t format,
hb_buffer_serialize_flags_t flags);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_buffer_deserialize_glyphs (hb_buffer_t *buffer,
const char *buf,
- int buf_len, /* -1 means nul-terminated */
- const char **end_ptr, /* May be NULL */
- hb_font_t *font, /* May be NULL */
+ int buf_len,
+ const char **end_ptr,
+ hb_font_t *font,
hb_buffer_serialize_format_t format);
+/*
+ * Debugging.
+ */
+
+typedef hb_bool_t (*hb_buffer_message_func_t) (hb_buffer_t *buffer,
+ hb_font_t *font,
+ const char *message,
+ void *user_data);
+
+HB_EXTERN void
+hb_buffer_set_message_func (hb_buffer_t *buffer,
+ hb_buffer_message_func_t func,
+ void *user_data, hb_destroy_func_t destroy);
+
+
HB_END_DECLS
#endif /* HB_BUFFER_H */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-cache-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-cache-private.hh
index 19b70b7e39..24957e1e96 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-cache-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-cache-private.hh
@@ -45,11 +45,11 @@ struct hb_cache_t
inline bool get (unsigned int key, unsigned int *value)
{
- unsigned int k = key & ((1<<cache_bits)-1);
+ unsigned int k = key & ((1u<<cache_bits)-1);
unsigned int v = values[k];
if ((v >> value_bits) != (key >> cache_bits))
return false;
- *value = v & ((1<<value_bits)-1);
+ *value = v & ((1u<<value_bits)-1);
return true;
}
@@ -57,14 +57,14 @@ struct hb_cache_t
{
if (unlikely ((key >> key_bits) || (value >> value_bits)))
return false; /* Overflows */
- unsigned int k = key & ((1<<cache_bits)-1);
+ unsigned int k = key & ((1u<<cache_bits)-1);
unsigned int v = ((key>>cache_bits)<<value_bits) | value;
values[k] = v;
return true;
}
private:
- unsigned int values[1<<cache_bits];
+ unsigned int values[1u<<cache_bits];
};
typedef hb_cache_t<21, 16, 8> hb_cmap_cache_t;
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-common.cc b/src/3rdparty/harfbuzz-ng/src/hb-common.cc
index e67059d10b..3564e43557 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-common.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-common.cc
@@ -88,7 +88,7 @@ hb_tag_from_string (const char *str, int len)
/**
* hb_tag_to_string:
* @tag:
- * @buf: (array fixed-size=4):
+ * @buf: (out caller-allocates) (array fixed-size=4) (element-type uint8_t):
*
*
*
@@ -281,12 +281,15 @@ retry:
/**
* hb_language_from_string:
- * @str: (array length=len) (element-type uint8_t):
- * @len:
+ * @str: (array length=len) (element-type uint8_t): a string representing
+ * ISO 639 language code
+ * @len: length of the @str, or -1 if it is %NULL-terminated.
*
- *
+ * Converts @str representing an ISO 639 language code to the corresponding
+ * #hb_language_t.
*
* Return value: (transfer none):
+ * The #hb_language_t corresponding to the ISO 639 language code.
*
* Since: 0.9.2
**/
@@ -314,11 +317,13 @@ hb_language_from_string (const char *str, int len)
/**
* hb_language_to_string:
- * @language:
+ * @language: an #hb_language_t to convert.
*
- *
+ * See hb_language_from_string().
*
- * Return value: (transfer none):
+ * Return value: (transfer none):
+ * A %NULL-terminated string representing the @language. Must not be freed by
+ * the caller.
*
* Since: 0.9.2
**/
@@ -357,11 +362,12 @@ hb_language_get_default (void)
/**
* hb_script_from_iso15924_tag:
- * @tag:
+ * @tag: an #hb_tag_t representing an ISO 15924 tag.
*
- *
+ * Converts an ISO 15924 script tag to a corresponding #hb_script_t.
*
* Return value:
+ * An #hb_script_t corresponding to the ISO 15924 tag.
*
* Since: 0.9.2
**/
@@ -401,28 +407,33 @@ hb_script_from_iso15924_tag (hb_tag_t tag)
/**
* hb_script_from_string:
- * @s: (array length=len) (element-type uint8_t):
- * @len:
+ * @str: (array length=len) (element-type uint8_t): a string representing an
+ * ISO 15924 tag.
+ * @len: length of the @str, or -1 if it is %NULL-terminated.
*
- *
+ * Converts a string @str representing an ISO 15924 script tag to a
+ * corresponding #hb_script_t. Shorthand for hb_tag_from_string() then
+ * hb_script_from_iso15924_tag().
*
* Return value:
+ * An #hb_script_t corresponding to the ISO 15924 tag.
*
* Since: 0.9.2
**/
hb_script_t
-hb_script_from_string (const char *s, int len)
+hb_script_from_string (const char *str, int len)
{
- return hb_script_from_iso15924_tag (hb_tag_from_string (s, len));
+ return hb_script_from_iso15924_tag (hb_tag_from_string (str, len));
}
/**
* hb_script_to_iso15924_tag:
- * @script:
+ * @script: an #hb_script_ to convert.
*
- *
+ * See hb_script_from_iso15924_tag().
*
- * Return value:
+ * Return value:
+ * An #hb_tag_t representing an ISO 15924 script tag.
*
* Since: 0.9.2
**/
@@ -496,6 +507,9 @@ hb_script_get_horizontal_direction (hb_script_t script)
/* Unicode-8.0 additions */
case HB_SCRIPT_OLD_HUNGARIAN:
+ /* Unicode-9.0 additions */
+ case HB_SCRIPT_ADLAM:
+
return HB_DIRECTION_RTL;
}
@@ -521,7 +535,7 @@ hb_user_data_array_t::set (hb_user_data_key_t *key,
}
}
hb_user_data_item_t item = {key, data, destroy};
- bool ret = !!items.replace_or_insert (item, lock, replace);
+ bool ret = !!items.replace_or_insert (item, lock, (bool) replace);
return ret;
}
@@ -529,7 +543,7 @@ hb_user_data_array_t::set (hb_user_data_key_t *key,
void *
hb_user_data_array_t::get (hb_user_data_key_t *key)
{
- hb_user_data_item_t item = {NULL };
+ hb_user_data_item_t item = {NULL, NULL, NULL};
return items.find (key, &item, lock) ? item.data : NULL;
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-common.h b/src/3rdparty/harfbuzz-ng/src/hb-common.h
index c291dbbe94..2cbee76a8f 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-common.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-common.h
@@ -98,16 +98,22 @@ typedef uint32_t hb_tag_t;
#define HB_TAG_MAX_SIGNED HB_TAG(0x7f,0xff,0xff,0xff)
/* len=-1 means str is NUL-terminated. */
-hb_tag_t
+HB_EXTERN hb_tag_t
hb_tag_from_string (const char *str, int len);
/* buf should have 4 bytes. */
-void
+HB_EXTERN void
hb_tag_to_string (hb_tag_t tag, char *buf);
-/* hb_direction_t */
-
+/**
+ * hb_direction_t:
+ * @HB_DIRECTION_INVALID: Initial, unset direction.
+ * @HB_DIRECTION_LTR: Text is set horizontally from left to right.
+ * @HB_DIRECTION_RTL: Text is set horizontally from right to left.
+ * @HB_DIRECTION_TTB: Text is set vertically from top to bottom.
+ * @HB_DIRECTION_BTT: Text is set vertically from bottom to top.
+ */
typedef enum {
HB_DIRECTION_INVALID = 0,
HB_DIRECTION_LTR = 4,
@@ -117,10 +123,10 @@ typedef enum {
} hb_direction_t;
/* len=-1 means str is NUL-terminated */
-hb_direction_t
+HB_EXTERN hb_direction_t
hb_direction_from_string (const char *str, int len);
-const char *
+HB_EXTERN const char *
hb_direction_to_string (hb_direction_t direction);
#define HB_DIRECTION_IS_VALID(dir) ((((unsigned int) (dir)) & ~3U) == 4)
@@ -136,16 +142,15 @@ hb_direction_to_string (hb_direction_t direction);
typedef const struct hb_language_impl_t *hb_language_t;
-/* len=-1 means str is NUL-terminated */
-hb_language_t
+HB_EXTERN hb_language_t
hb_language_from_string (const char *str, int len);
-const char *
+HB_EXTERN const char *
hb_language_to_string (hb_language_t language);
#define HB_LANGUAGE_INVALID ((hb_language_t) NULL)
-hb_language_t
+HB_EXTERN hb_language_t
hb_language_get_default (void);
@@ -299,12 +304,22 @@ typedef enum
/*7.0*/ HB_SCRIPT_TIRHUTA = HB_TAG ('T','i','r','h'),
/*7.0*/ HB_SCRIPT_WARANG_CITI = HB_TAG ('W','a','r','a'),
- /*8.0*/ HB_SCRIPT_AHOM = HB_TAG ('A','h','o','m'),
- /*8.0*/ HB_SCRIPT_ANATOLIAN_HIEROGLYPHS = HB_TAG ('H','l','u','w'),
- /*8.0*/ HB_SCRIPT_HATRAN = HB_TAG ('H','a','t','r'),
- /*8.0*/ HB_SCRIPT_MULTANI = HB_TAG ('M','u','l','t'),
- /*8.0*/ HB_SCRIPT_OLD_HUNGARIAN = HB_TAG ('H','u','n','g'),
- /*8.0*/ HB_SCRIPT_SIGNWRITING = HB_TAG ('S','g','n','w'),
+ /*8.0*/ HB_SCRIPT_AHOM = HB_TAG ('A','h','o','m'),
+ /*8.0*/ HB_SCRIPT_ANATOLIAN_HIEROGLYPHS = HB_TAG ('H','l','u','w'),
+ /*8.0*/ HB_SCRIPT_HATRAN = HB_TAG ('H','a','t','r'),
+ /*8.0*/ HB_SCRIPT_MULTANI = HB_TAG ('M','u','l','t'),
+ /*8.0*/ HB_SCRIPT_OLD_HUNGARIAN = HB_TAG ('H','u','n','g'),
+ /*8.0*/ HB_SCRIPT_SIGNWRITING = HB_TAG ('S','g','n','w'),
+
+ /*
+ * Since 1.3.0
+ */
+ /*9.0*/ HB_SCRIPT_ADLAM = HB_TAG ('A','d','l','m'),
+ /*9.0*/ HB_SCRIPT_BHAIKSUKI = HB_TAG ('B','h','k','s'),
+ /*9.0*/ HB_SCRIPT_MARCHEN = HB_TAG ('M','a','r','c'),
+ /*9.0*/ HB_SCRIPT_OSAGE = HB_TAG ('O','s','g','e'),
+ /*9.0*/ HB_SCRIPT_TANGUT = HB_TAG ('T','a','n','g'),
+ /*9.0*/ HB_SCRIPT_NEWA = HB_TAG ('N','e','w','a'),
/* No script set. */
HB_SCRIPT_INVALID = HB_TAG_NONE,
@@ -324,18 +339,16 @@ typedef enum
/* Script functions */
-hb_script_t
+HB_EXTERN hb_script_t
hb_script_from_iso15924_tag (hb_tag_t tag);
-/* sugar for tag_from_string() then script_from_iso15924_tag */
-/* len=-1 means s is NUL-terminated */
-hb_script_t
-hb_script_from_string (const char *s, int len);
+HB_EXTERN hb_script_t
+hb_script_from_string (const char *str, int len);
-hb_tag_t
+HB_EXTERN hb_tag_t
hb_script_to_iso15924_tag (hb_script_t script);
-hb_direction_t
+HB_EXTERN hb_direction_t
hb_script_get_horizontal_direction (hb_script_t script);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc b/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
index 76c81e48f4..9865bbba41 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
@@ -27,7 +27,6 @@
*/
#define HB_SHAPER coretext
-#define hb_coretext_shaper_face_data_t CGFont
#include "hb-shaper-impl-private.hh"
#include "hb-coretext.h"
@@ -91,6 +90,29 @@ HB_SHAPER_DATA_ENSURE_DECLARE(coretext, font)
* shaper face data
*/
+static CTFontDescriptorRef
+get_last_resort_font_desc (void)
+{
+ // TODO Handle allocation failures?
+ CTFontDescriptorRef last_resort = CTFontDescriptorCreateWithNameAndSize (CFSTR("LastResort"), 0);
+ CFArrayRef cascade_list = CFArrayCreate (kCFAllocatorDefault,
+ (const void **) &last_resort,
+ 1,
+ &kCFTypeArrayCallBacks);
+ CFRelease (last_resort);
+ CFDictionaryRef attributes = CFDictionaryCreate (kCFAllocatorDefault,
+ (const void **) &kCTFontCascadeListAttribute,
+ (const void **) &cascade_list,
+ 1,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+ CFRelease (cascade_list);
+
+ CTFontDescriptorRef font_desc = CTFontDescriptorCreateWithAttributes (attributes);
+ CFRelease (attributes);
+ return font_desc;
+}
+
static void
release_data (void *info, const void *data, size_t size)
{
@@ -100,15 +122,14 @@ release_data (void *info, const void *data, size_t size)
hb_blob_destroy ((hb_blob_t *) info);
}
-hb_coretext_shaper_face_data_t *
-_hb_coretext_shaper_face_data_create (hb_face_t *face)
+static CGFontRef
+create_cg_font (hb_face_t *face)
{
- hb_coretext_shaper_face_data_t *data = NULL;
-
+ CGFontRef cg_font = NULL;
#if 0
if (face->destroy == (hb_destroy_func_t) CGFontRelease)
{
- data = CGFontRetain ((CGFontRef) face->user_data);
+ cg_font = CGFontRetain ((CGFontRef) face->user_data);
}
else
{
@@ -121,18 +142,119 @@ _hb_coretext_shaper_face_data_create (hb_face_t *face)
CGDataProviderRef provider = CGDataProviderCreateWithData (blob, blob_data, blob_length, &release_data);
if (likely (provider))
{
- data = CGFontCreateWithDataProvider (provider);
+ cg_font = CGFontCreateWithDataProvider (provider);
+ if (unlikely (!cg_font))
+ DEBUG_MSG (CORETEXT, face, "Face CGFontCreateWithDataProvider() failed");
CGDataProviderRelease (provider);
}
}
#else
FontEngineFaceData *fontEngineFaceData = (FontEngineFaceData *) face->user_data;
CoreTextFontEngineData *coreTextFontEngineData = (CoreTextFontEngineData *) fontEngineFaceData->user_data;
- data = CGFontRetain (coreTextFontEngineData->cgFont);
+ cg_font = CGFontRetain (coreTextFontEngineData->cgFont);
#endif
+ return cg_font;
+}
+
+static CTFontRef
+create_ct_font (CGFontRef cg_font, CGFloat font_size)
+{
+ CTFontRef ct_font = CTFontCreateWithGraphicsFont (cg_font, font_size, NULL, NULL);
+ if (unlikely (!ct_font)) {
+ DEBUG_MSG (CORETEXT, cg_font, "Font CTFontCreateWithGraphicsFont() failed");
+ return NULL;
+ }
+
+ /* crbug.com/576941 and crbug.com/625902 and the investigation in the latter
+ * bug indicate that the cascade list reconfiguration occasionally causes
+ * crashes in CoreText on OS X 10.9, thus let's skip this step on older
+ * operating system versions. Except for the emoji font, where _not_
+ * reconfiguring the cascade list causes CoreText crashes. For details, see
+ * crbug.com/549610 */
+ // 0x00070000 stands for "kCTVersionNumber10_10", see CoreText.h
+ if (&CTGetCoreTextVersion != NULL && CTGetCoreTextVersion() < 0x00070000) {
+ CFStringRef fontName = CTFontCopyPostScriptName (ct_font);
+ bool isEmojiFont = CFStringCompare (fontName, CFSTR("AppleColorEmoji"), 0) == kCFCompareEqualTo;
+ CFRelease (fontName);
+ if (!isEmojiFont)
+ return ct_font;
+ }
+
+ CFURLRef original_url = (CFURLRef)CTFontCopyAttribute(ct_font, kCTFontURLAttribute);
+
+ /* Create font copy with cascade list that has LastResort first; this speeds up CoreText
+ * font fallback which we don't need anyway. */
+ {
+ CTFontDescriptorRef last_resort_font_desc = get_last_resort_font_desc ();
+ CTFontRef new_ct_font = CTFontCreateCopyWithAttributes (ct_font, 0.0, NULL, last_resort_font_desc);
+ CFRelease (last_resort_font_desc);
+ if (new_ct_font)
+ {
+ /* The CTFontCreateCopyWithAttributes call fails to stay on the same font
+ * when reconfiguring the cascade list and may switch to a different font
+ * when there are fonts that go by the same name, since the descriptor is
+ * just name and size.
+ *
+ * Avoid reconfiguring the cascade lists if the new font is outside the
+ * system locations that we cannot access from the sandboxed renderer
+ * process in Blink. This can be detected by the new file URL location
+ * that the newly found font points to. */
+ CFURLRef new_url = (CFURLRef) CTFontCopyAttribute (new_ct_font, kCTFontURLAttribute);
+ // Keep reconfigured font if URL cannot be retrieved (seems to be the case
+ // on Mac OS 10.12 Sierra), speculative fix for crbug.com/625606
+ if (!original_url || !new_url || CFEqual (original_url, new_url)) {
+ CFRelease (ct_font);
+ ct_font = new_ct_font;
+ } else {
+ CFRelease (new_ct_font);
+ DEBUG_MSG (CORETEXT, ct_font, "Discarding reconfigured CTFont, location changed.");
+ }
+ if (new_url)
+ CFRelease (new_url);
+ }
+ else
+ DEBUG_MSG (CORETEXT, ct_font, "Font copy with empty cascade list failed");
+ }
+
+ if (original_url)
+ CFRelease (original_url);
+ return ct_font;
+}
+
+struct hb_coretext_shaper_face_data_t {
+ CGFontRef cg_font;
+ CTFontRef ct_font;
+};
+
+hb_coretext_shaper_face_data_t *
+_hb_coretext_shaper_face_data_create (hb_face_t *face)
+{
+ hb_coretext_shaper_face_data_t *data = (hb_coretext_shaper_face_data_t *) calloc (1, sizeof (hb_coretext_shaper_face_data_t));
+ if (unlikely (!data))
+ return NULL;
+
+ data->cg_font = create_cg_font (face);
+ if (unlikely (!data->cg_font))
+ {
+ DEBUG_MSG (CORETEXT, face, "CGFont creation failed..");
+ free (data);
+ return NULL;
+ }
- if (unlikely (!data)) {
- DEBUG_MSG (CORETEXT, face, "Face CGFontCreateWithDataProvider() failed");
+ /* We use 36pt size instead of UPEM, because CoreText implements the 'trak' table,
+ * which can make the font too tight at large sizes. 36pt should be a good semi-neutral
+ * size.
+ *
+ * Since we always create CTFont at a fixed size, our CTFont lives in face_data
+ * instead of font_data. Which is good, because when people change scale on
+ * hb_font_t, we won't need to update our CTFont. */
+ data->ct_font = create_ct_font (data->cg_font, 36.);
+ if (unlikely (!data->ct_font))
+ {
+ DEBUG_MSG (CORETEXT, face, "CTFont creation failed.");
+ CFRelease (data->cg_font);
+ free (data);
+ return NULL;
}
return data;
@@ -141,7 +263,9 @@ _hb_coretext_shaper_face_data_create (hb_face_t *face)
void
_hb_coretext_shaper_face_data_destroy (hb_coretext_shaper_face_data_t *data)
{
- CFRelease (data);
+ CFRelease (data->ct_font);
+ CFRelease (data->cg_font);
+ free (data);
}
/*
@@ -152,7 +276,7 @@ hb_coretext_face_get_cg_font (hb_face_t *face)
{
if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return NULL;
hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face);
- return face_data;
+ return face_data->cg_font;
}
@@ -160,56 +284,17 @@ hb_coretext_face_get_cg_font (hb_face_t *face)
* shaper font data
*/
-struct hb_coretext_shaper_font_data_t {
- CTFontRef ct_font;
- CGFloat x_mult, y_mult; /* From CT space to HB space. */
-};
+struct hb_coretext_shaper_font_data_t {};
hb_coretext_shaper_font_data_t *
-_hb_coretext_shaper_font_data_create (hb_font_t *font)
+_hb_coretext_shaper_font_data_create (hb_font_t *font HB_UNUSED)
{
- if (unlikely (!hb_coretext_shaper_face_data_ensure (font->face))) return NULL;
-
- hb_coretext_shaper_font_data_t *data = (hb_coretext_shaper_font_data_t *) calloc (1, sizeof (hb_coretext_shaper_font_data_t));
- if (unlikely (!data))
- return NULL;
-
- hb_face_t *face = font->face;
-#if 0
- hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face);
-
- /* Choose a CoreText font size and calculate multipliers to convert to HarfBuzz space. */
- /* TODO: use upem instead of 36? */
- CGFloat font_size = 36.; /* Default... */
- /* No idea if the following is even a good idea. */
- if (font->y_ppem)
- font_size = font->y_ppem;
-
- if (font_size < 0)
- font_size = -font_size;
- data->x_mult = (CGFloat) font->x_scale / font_size;
- data->y_mult = (CGFloat) font->y_scale / font_size;
- data->ct_font = CTFontCreateWithGraphicsFont (face_data, font_size, NULL, NULL);
-#else
- data->x_mult = data->y_mult = (CGFloat) 64.0f;
- FontEngineFaceData *fontEngineFaceData = (FontEngineFaceData *) face->user_data;
- CoreTextFontEngineData *coreTextFontEngineData = (CoreTextFontEngineData *) fontEngineFaceData->user_data;
- data->ct_font = (CTFontRef) CFRetain (coreTextFontEngineData->ctFont);
-#endif
- if (unlikely (!data->ct_font)) {
- DEBUG_MSG (CORETEXT, font, "Font CTFontCreateWithGraphicsFont() failed");
- free (data);
- return NULL;
- }
-
- return data;
+ return (hb_coretext_shaper_font_data_t *) HB_SHAPER_DATA_SUCCEEDED;
}
void
_hb_coretext_shaper_font_data_destroy (hb_coretext_shaper_font_data_t *data)
{
- CFRelease (data->ct_font);
- free (data);
}
@@ -222,7 +307,9 @@ struct hb_coretext_shaper_shape_plan_data_t {};
hb_coretext_shaper_shape_plan_data_t *
_hb_coretext_shaper_shape_plan_data_create (hb_shape_plan_t *shape_plan HB_UNUSED,
const hb_feature_t *user_features HB_UNUSED,
- unsigned int num_user_features HB_UNUSED)
+ unsigned int num_user_features HB_UNUSED,
+ const int *coords HB_UNUSED,
+ unsigned int num_coords HB_UNUSED)
{
return (hb_coretext_shaper_shape_plan_data_t *) HB_SHAPER_DATA_SUCCEEDED;
}
@@ -235,9 +322,10 @@ _hb_coretext_shaper_shape_plan_data_destroy (hb_coretext_shaper_shape_plan_data_
CTFontRef
hb_coretext_font_get_ct_font (hb_font_t *font)
{
- if (unlikely (!hb_coretext_shaper_font_data_ensure (font))) return NULL;
- hb_coretext_shaper_font_data_t *font_data = HB_SHAPER_DATA_GET (font);
- return font_data->ct_font;
+ hb_face_t *face = font->face;
+ if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return NULL;
+ hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face);
+ return face_data->ct_font;
}
@@ -470,7 +558,10 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
{
hb_face_t *face = font->face;
hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face);
- hb_coretext_shaper_font_data_t *font_data = HB_SHAPER_DATA_GET (font);
+
+ CGFloat ct_font_size = CTFontGetSize (face_data->ct_font);
+ CGFloat x_mult = (CGFloat) font->x_scale / ct_font_size;
+ CGFloat y_mult = (CGFloat) font->y_scale / ct_font_size;
/* Attach marks to their bases, to match the 'ot' shaper.
* Adapted from hb-ot-shape:hb_form_clusters().
@@ -479,6 +570,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
* B1 M1 B2 M2, and B1-B2 form a ligature, M2's cluster will
* continue pointing to B2 even though B2 was merged into B1's
* cluster... */
+ if (buffer->cluster_level == HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES)
{
hb_unicode_funcs_t *unicode = buffer->unicode;
unsigned int count = buffer->len;
@@ -601,7 +693,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
CTFontDescriptorRef font_desc = CTFontDescriptorCreateWithAttributes (attributes);
CFRelease (attributes);
- range->font = CTFontCreateCopyWithAttributes (font_data->ct_font, 0.0, NULL, font_desc);
+ range->font = CTFontCreateCopyWithAttributes (face_data->ct_font, 0.0, NULL, font_desc);
CFRelease (font_desc);
}
else
@@ -662,7 +754,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
pchars[chars_len++] = 0xFFFDu;
else {
pchars[chars_len++] = 0xD800u + ((c - 0x10000u) >> 10);
- pchars[chars_len++] = 0xDC00u + ((c - 0x10000u) & ((1 << 10) - 1));
+ pchars[chars_len++] = 0xDC00u + ((c - 0x10000u) & ((1u << 10) - 1));
}
}
@@ -719,7 +811,6 @@ resize_and_retry:
scratch += old_scratch_used;
scratch_size -= old_scratch_used;
}
-retry:
{
string_ref = CFStringCreateWithCharactersNoCopy (NULL,
pchars, chars_len,
@@ -759,7 +850,7 @@ retry:
CFRelease (lang);
}
CFAttributedStringSetAttribute (attr_string, CFRangeMake (0, chars_len),
- kCTFontAttributeName, font_data->ct_font);
+ kCTFontAttributeName, face_data->ct_font);
if (num_features)
{
@@ -844,8 +935,6 @@ retry:
run_advance = -run_advance;
DEBUG_MSG (CORETEXT, run, "Run advance: %g", run_advance);
- CFRange range = CTRunGetStringRange (run);
-
/* CoreText does automatic font fallback (AKA "cascading") for characters
* not supported by the requested font, and provides no way to turn it off,
* so we must detect if the returned run uses a font other than the requested
@@ -854,7 +943,7 @@ retry:
*/
CFDictionaryRef attributes = CTRunGetAttributes (run);
CTFontRef run_ct_font = static_cast<CTFontRef>(CFDictionaryGetValue (attributes, kCTFontAttributeName));
- if (!CFEqual (run_ct_font, font_data->ct_font))
+ if (!CFEqual (run_ct_font, face_data->ct_font))
{
/* The run doesn't use our main font instance. We have to figure out
* whether font fallback happened, or this is just CoreText giving us
@@ -874,15 +963,11 @@ retry:
* backend.
*
* However, even that wouldn't work if we were passed in the CGFont to
- * begin with.
- *
- * Webkit uses a slightly different approach: it installs LastResort
- * as fallback chain, and then checks PS name of used font against
- * LastResort. That one is safe for any font except for LastResort,
- * as opposed to ours, which can fail if we are using any uninstalled
- * font that has the same name as an installed font.
+ * construct a hb_face to begin with.
*
* See: http://github.com/behdad/harfbuzz/pull/36
+ *
+ * Also see: https://bugs.chromium.org/p/chromium/issues/detail?id=597098
*/
bool matched = false;
for (unsigned int i = 0; i < range_records.len; i++)
@@ -896,13 +981,13 @@ retry:
CGFontRef run_cg_font = CTFontCopyGraphicsFont (run_ct_font, 0);
if (run_cg_font)
{
- matched = CFEqual (run_cg_font, face_data);
+ matched = CFEqual (run_cg_font, face_data->cg_font);
CFRelease (run_cg_font);
}
}
if (!matched)
{
- CFStringRef font_ps_name = CTFontCopyName (font_data->ct_font, kCTFontPostScriptNameKey);
+ CFStringRef font_ps_name = CTFontCopyName (face_data->ct_font, kCTFontPostScriptNameKey);
CFStringRef run_ps_name = CTFontCopyName (run_ct_font, kCTFontPostScriptNameKey);
CFComparisonResult result = CFStringCompare (run_ps_name, font_ps_name, 0);
CFRelease (run_ps_name);
@@ -912,6 +997,7 @@ retry:
}
if (!matched)
{
+ CFRange range = CTRunGetStringRange (run);
DEBUG_MSG (CORETEXT, run, "Run used fallback font: %ld..%ld",
range.location, range.location + range.length);
if (!buffer->ensure_inplace (buffer->len + range.length))
@@ -963,13 +1049,7 @@ retry:
if (num_glyphs == 0)
continue;
- /* ### temporary fix for QTBUG-38113 */
- /* CoreText throws away the PDF token, while the OpenType backend will add a zero-advance
- * glyph for this. We need to make sure the two produce the same output. */
- UniChar endGlyph = CFStringGetCharacterAtIndex (string_ref, range.location + range.length - 1);
- bool endsWithPDF = endGlyph == 0x202c;
-
- if (!buffer->ensure_inplace (buffer->len + num_glyphs + (endsWithPDF ? 1 : 0)))
+ if (!buffer->ensure_inplace (buffer->len + num_glyphs))
goto resize_and_retry;
hb_glyph_info_t *run_info = buffer->info + buffer->len;
@@ -1027,7 +1107,6 @@ retry:
positions = position_buf;
}
hb_glyph_info_t *info = run_info;
- CGFloat x_mult = font_data->x_mult, y_mult = font_data->y_mult;
if (HB_DIRECTION_IS_HORIZONTAL (buffer->props.direction))
{
hb_position_t x_offset = (positions[0].x - advances_so_far) * x_mult;
@@ -1060,20 +1139,6 @@ retry:
info++;
}
}
- if (endsWithPDF) {
- /* Ensure a zero-advance glyph the PDF token */
- if (unlikely (HB_DIRECTION_IS_BACKWARD (buffer->props.direction))) {
- memmove (run_info + 1, run_info, num_glyphs * sizeof (hb_glyph_info_t));
- info = run_info;
- }
- info->codepoint = 0xffff;
- info->cluster = log_clusters[range.location + range.length - 1];
- info->mask = 0;
- info->var1.u32 = 0;
- info->var2.u32 = 0;
-
- buffer->len++;
- }
SCRATCH_RESTORE();
advances_so_far += run_advance;
}
@@ -1176,10 +1241,6 @@ fail:
* AAT shaper
*/
-HB_SHAPER_DATA_ENSURE_DECLARE(coretext_aat, face)
-HB_SHAPER_DATA_ENSURE_DECLARE(coretext_aat, font)
-
-
/*
* shaper face data
*/
@@ -1240,7 +1301,9 @@ struct hb_coretext_aat_shaper_shape_plan_data_t {};
hb_coretext_aat_shaper_shape_plan_data_t *
_hb_coretext_aat_shaper_shape_plan_data_create (hb_shape_plan_t *shape_plan HB_UNUSED,
const hb_feature_t *user_features HB_UNUSED,
- unsigned int num_user_features HB_UNUSED)
+ unsigned int num_user_features HB_UNUSED,
+ const int *coords HB_UNUSED,
+ unsigned int num_coords HB_UNUSED)
{
return (hb_coretext_aat_shaper_shape_plan_data_t *) HB_SHAPER_DATA_SUCCEEDED;
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-coretext.h b/src/3rdparty/harfbuzz-ng/src/hb-coretext.h
index 25267bc978..82066e4e0d 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-coretext.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-coretext.h
@@ -44,14 +44,14 @@ HB_BEGIN_DECLS
#define HB_CORETEXT_TAG_MORX HB_TAG('m','o','r','x')
-hb_face_t *
+HB_EXTERN hb_face_t *
hb_coretext_face_create (CGFontRef cg_font);
-CGFontRef
+HB_EXTERN CGFontRef
hb_coretext_face_get_cg_font (hb_face_t *face);
-CTFontRef
+HB_EXTERN CTFontRef
hb_coretext_font_get_ct_font (hb_font_t *font);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-deprecated.h b/src/3rdparty/harfbuzz-ng/src/hb-deprecated.h
index 30ae4b1caf..0398dfae60 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-deprecated.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-deprecated.h
@@ -44,6 +44,16 @@ HB_BEGIN_DECLS
#define HB_BUFFER_FLAGS_DEFAULT HB_BUFFER_FLAG_DEFAULT
#define HB_BUFFER_SERIALIZE_FLAGS_DEFAULT HB_BUFFER_SERIALIZE_FLAG_DEFAULT
+typedef hb_bool_t (*hb_font_get_glyph_func_t) (hb_font_t *font, void *font_data,
+ hb_codepoint_t unicode, hb_codepoint_t variation_selector,
+ hb_codepoint_t *glyph,
+ void *user_data);
+
+HB_EXTERN void
+hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
+ hb_font_get_glyph_func_t func,
+ void *user_data, hb_destroy_func_t destroy);
+
#endif
HB_END_DECLS
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-face.cc b/src/3rdparty/harfbuzz-ng/src/hb-face.cc
index 9effc41c88..6b563bc8f1 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-face.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-face.cc
@@ -35,8 +35,6 @@
#include "hb-ot-head-table.hh"
#include "hb-ot-maxp-table.hh"
-#include "hb-cache-private.hh"
-
#include <string.h>
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-face.h b/src/3rdparty/harfbuzz-ng/src/hb-face.h
index f682c468de..91237b7085 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-face.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-face.h
@@ -43,28 +43,28 @@ HB_BEGIN_DECLS
typedef struct hb_face_t hb_face_t;
-hb_face_t *
+HB_EXTERN hb_face_t *
hb_face_create (hb_blob_t *blob,
unsigned int index);
typedef hb_blob_t * (*hb_reference_table_func_t) (hb_face_t *face, hb_tag_t tag, void *user_data);
/* calls destroy() when not needing user_data anymore */
-hb_face_t *
+HB_EXTERN hb_face_t *
hb_face_create_for_tables (hb_reference_table_func_t reference_table_func,
void *user_data,
hb_destroy_func_t destroy);
-hb_face_t *
+HB_EXTERN hb_face_t *
hb_face_get_empty (void);
-hb_face_t *
+HB_EXTERN hb_face_t *
hb_face_reference (hb_face_t *face);
-void
+HB_EXTERN void
hb_face_destroy (hb_face_t *face);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_face_set_user_data (hb_face_t *face,
hb_user_data_key_t *key,
void * data,
@@ -72,43 +72,43 @@ hb_face_set_user_data (hb_face_t *face,
hb_bool_t replace);
-void *
+HB_EXTERN void *
hb_face_get_user_data (hb_face_t *face,
hb_user_data_key_t *key);
-void
+HB_EXTERN void
hb_face_make_immutable (hb_face_t *face);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_face_is_immutable (hb_face_t *face);
-hb_blob_t *
+HB_EXTERN hb_blob_t *
hb_face_reference_table (hb_face_t *face,
hb_tag_t tag);
-hb_blob_t *
+HB_EXTERN hb_blob_t *
hb_face_reference_blob (hb_face_t *face);
-void
+HB_EXTERN void
hb_face_set_index (hb_face_t *face,
unsigned int index);
-unsigned int
+HB_EXTERN unsigned int
hb_face_get_index (hb_face_t *face);
-void
+HB_EXTERN void
hb_face_set_upem (hb_face_t *face,
unsigned int upem);
-unsigned int
+HB_EXTERN unsigned int
hb_face_get_upem (hb_face_t *face);
-void
+HB_EXTERN void
hb_face_set_glyph_count (hb_face_t *face,
unsigned int glyph_count);
-unsigned int
+HB_EXTERN unsigned int
hb_face_get_glyph_count (hb_face_t *face);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-fallback-shape.cc b/src/3rdparty/harfbuzz-ng/src/hb-fallback-shape.cc
new file mode 100644
index 0000000000..ac6d4b00f5
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/src/hb-fallback-shape.cc
@@ -0,0 +1,143 @@
+/*
+ * Copyright © 2011 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
+ */
+
+#define HB_SHAPER fallback
+#include "hb-shaper-impl-private.hh"
+
+
+/*
+ * shaper face data
+ */
+
+struct hb_fallback_shaper_face_data_t {};
+
+hb_fallback_shaper_face_data_t *
+_hb_fallback_shaper_face_data_create (hb_face_t *face HB_UNUSED)
+{
+ return (hb_fallback_shaper_face_data_t *) HB_SHAPER_DATA_SUCCEEDED;
+}
+
+void
+_hb_fallback_shaper_face_data_destroy (hb_fallback_shaper_face_data_t *data HB_UNUSED)
+{
+}
+
+
+/*
+ * shaper font data
+ */
+
+struct hb_fallback_shaper_font_data_t {};
+
+hb_fallback_shaper_font_data_t *
+_hb_fallback_shaper_font_data_create (hb_font_t *font HB_UNUSED)
+{
+ return (hb_fallback_shaper_font_data_t *) HB_SHAPER_DATA_SUCCEEDED;
+}
+
+void
+_hb_fallback_shaper_font_data_destroy (hb_fallback_shaper_font_data_t *data HB_UNUSED)
+{
+}
+
+
+/*
+ * shaper shape_plan data
+ */
+
+struct hb_fallback_shaper_shape_plan_data_t {};
+
+hb_fallback_shaper_shape_plan_data_t *
+_hb_fallback_shaper_shape_plan_data_create (hb_shape_plan_t *shape_plan HB_UNUSED,
+ const hb_feature_t *user_features HB_UNUSED,
+ unsigned int num_user_features HB_UNUSED,
+ const int *coords HB_UNUSED,
+ unsigned int num_coords HB_UNUSED)
+{
+ return (hb_fallback_shaper_shape_plan_data_t *) HB_SHAPER_DATA_SUCCEEDED;
+}
+
+void
+_hb_fallback_shaper_shape_plan_data_destroy (hb_fallback_shaper_shape_plan_data_t *data HB_UNUSED)
+{
+}
+
+
+/*
+ * shaper
+ */
+
+hb_bool_t
+_hb_fallback_shape (hb_shape_plan_t *shape_plan HB_UNUSED,
+ hb_font_t *font,
+ hb_buffer_t *buffer,
+ const hb_feature_t *features HB_UNUSED,
+ unsigned int num_features HB_UNUSED)
+{
+ /* TODO
+ *
+ * - Apply fallback kern.
+ * - Handle Variation Selectors?
+ * - Apply normalization?
+ *
+ * This will make the fallback shaper into a dumb "TrueType"
+ * shaper which many people unfortunately still request.
+ */
+
+ hb_codepoint_t space;
+ bool has_space = (bool) font->get_nominal_glyph (' ', &space);
+
+ buffer->clear_positions ();
+
+ hb_direction_t direction = buffer->props.direction;
+ hb_unicode_funcs_t *unicode = buffer->unicode;
+ unsigned int count = buffer->len;
+ hb_glyph_info_t *info = buffer->info;
+ hb_glyph_position_t *pos = buffer->pos;
+ for (unsigned int i = 0; i < count; i++)
+ {
+ if (has_space && unicode->is_default_ignorable (info[i].codepoint)) {
+ info[i].codepoint = space;
+ pos[i].x_advance = 0;
+ pos[i].y_advance = 0;
+ continue;
+ }
+ font->get_nominal_glyph (info[i].codepoint, &info[i].codepoint);
+ font->get_glyph_advance_for_direction (info[i].codepoint,
+ direction,
+ &pos[i].x_advance,
+ &pos[i].y_advance);
+ font->subtract_glyph_origin_for_direction (info[i].codepoint,
+ direction,
+ &pos[i].x_offset,
+ &pos[i].y_offset);
+ }
+
+ if (HB_DIRECTION_IS_BACKWARD (direction))
+ hb_buffer_reverse (buffer);
+
+ return true;
+}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-font-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-font-private.hh
index c05499d4c2..53671d78d2 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-font-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-font-private.hh
@@ -42,7 +42,10 @@
*/
#define HB_FONT_FUNCS_IMPLEMENT_CALLBACKS \
- HB_FONT_FUNC_IMPLEMENT (glyph) \
+ HB_FONT_FUNC_IMPLEMENT (font_h_extents) \
+ HB_FONT_FUNC_IMPLEMENT (font_v_extents) \
+ HB_FONT_FUNC_IMPLEMENT (nominal_glyph) \
+ HB_FONT_FUNC_IMPLEMENT (variation_glyph) \
HB_FONT_FUNC_IMPLEMENT (glyph_h_advance) \
HB_FONT_FUNC_IMPLEMENT (glyph_v_advance) \
HB_FONT_FUNC_IMPLEMENT (glyph_h_origin) \
@@ -61,14 +64,6 @@ struct hb_font_funcs_t {
hb_bool_t immutable;
- /* Don't access these directly. Call hb_font_get_*() instead. */
-
- struct {
-#define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_func_t name;
- HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
-#undef HB_FONT_FUNC_IMPLEMENT
- } get;
-
struct {
#define HB_FONT_FUNC_IMPLEMENT(name) void *name;
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
@@ -80,6 +75,16 @@ struct hb_font_funcs_t {
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT
} destroy;
+
+ /* Don't access these directly. Call font->get_*() instead. */
+ union get_t {
+ struct get_funcs_t {
+#define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_func_t name;
+ HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
+#undef HB_FONT_FUNC_IMPLEMENT
+ } f;
+ void (*array[VAR]) (void);
+ } get;
};
@@ -103,6 +108,10 @@ struct hb_font_t {
unsigned int x_ppem;
unsigned int y_ppem;
+ /* Font variation coordinates. */
+ unsigned int num_coords;
+ int *coords;
+
hb_font_funcs_t *klass;
void *user_data;
hb_destroy_func_t destroy;
@@ -111,8 +120,14 @@ struct hb_font_t {
/* Convert from font-space to user-space */
- inline hb_position_t em_scale_x (int16_t v) { return em_scale (v, this->x_scale); }
- inline hb_position_t em_scale_y (int16_t v) { return em_scale (v, this->y_scale); }
+ inline int dir_scale (hb_direction_t direction)
+ { return HB_DIRECTION_IS_VERTICAL(direction) ? y_scale : x_scale; }
+ inline hb_position_t em_scale_x (int16_t v) { return em_scale (v, x_scale); }
+ inline hb_position_t em_scale_y (int16_t v) { return em_scale (v, y_scale); }
+ inline hb_position_t em_scalef_x (float v) { return em_scalef (v, this->x_scale); }
+ inline hb_position_t em_scalef_y (float v) { return em_scalef (v, this->y_scale); }
+ inline hb_position_t em_scale_dir (int16_t v, hb_direction_t direction)
+ { return em_scale (v, dir_scale (direction)); }
/* Convert from parent-font user-space to our user-space */
inline hb_position_t parent_scale_x_distance (hb_position_t v) {
@@ -144,95 +159,133 @@ struct hb_font_t {
/* Public getters */
- inline hb_bool_t has_glyph (hb_codepoint_t unicode)
+ HB_INTERNAL bool has_func (unsigned int i);
+
+ /* has_* ... */
+#define HB_FONT_FUNC_IMPLEMENT(name) \
+ bool \
+ has_##name##_func (void) \
+ { \
+ hb_font_funcs_t *funcs = this->klass; \
+ unsigned int i = offsetof (hb_font_funcs_t::get_t::get_funcs_t, name) / sizeof (funcs->get.array[0]); \
+ return has_func (i); \
+ }
+ HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
+#undef HB_FONT_FUNC_IMPLEMENT
+
+ inline hb_bool_t get_font_h_extents (hb_font_extents_t *extents)
+ {
+ memset (extents, 0, sizeof (*extents));
+ return klass->get.f.font_h_extents (this, user_data,
+ extents,
+ klass->user_data.font_h_extents);
+ }
+ inline hb_bool_t get_font_v_extents (hb_font_extents_t *extents)
+ {
+ memset (extents, 0, sizeof (*extents));
+ return klass->get.f.font_v_extents (this, user_data,
+ extents,
+ klass->user_data.font_v_extents);
+ }
+
+ inline bool has_glyph (hb_codepoint_t unicode)
{
hb_codepoint_t glyph;
- return get_glyph (unicode, 0, &glyph);
+ return get_nominal_glyph (unicode, &glyph);
}
- inline hb_bool_t get_glyph (hb_codepoint_t unicode, hb_codepoint_t variation_selector,
- hb_codepoint_t *glyph)
+ inline hb_bool_t get_nominal_glyph (hb_codepoint_t unicode,
+ hb_codepoint_t *glyph)
{
*glyph = 0;
- return klass->get.glyph (this, user_data,
- unicode, variation_selector, glyph,
- klass->user_data.glyph);
+ return klass->get.f.nominal_glyph (this, user_data,
+ unicode, glyph,
+ klass->user_data.nominal_glyph);
+ }
+
+ inline hb_bool_t get_variation_glyph (hb_codepoint_t unicode, hb_codepoint_t variation_selector,
+ hb_codepoint_t *glyph)
+ {
+ *glyph = 0;
+ return klass->get.f.variation_glyph (this, user_data,
+ unicode, variation_selector, glyph,
+ klass->user_data.variation_glyph);
}
inline hb_position_t get_glyph_h_advance (hb_codepoint_t glyph)
{
- return klass->get.glyph_h_advance (this, user_data,
- glyph,
- klass->user_data.glyph_h_advance);
+ return klass->get.f.glyph_h_advance (this, user_data,
+ glyph,
+ klass->user_data.glyph_h_advance);
}
inline hb_position_t get_glyph_v_advance (hb_codepoint_t glyph)
{
- return klass->get.glyph_v_advance (this, user_data,
- glyph,
- klass->user_data.glyph_v_advance);
+ return klass->get.f.glyph_v_advance (this, user_data,
+ glyph,
+ klass->user_data.glyph_v_advance);
}
inline hb_bool_t get_glyph_h_origin (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
{
*x = *y = 0;
- return klass->get.glyph_h_origin (this, user_data,
- glyph, x, y,
- klass->user_data.glyph_h_origin);
+ return klass->get.f.glyph_h_origin (this, user_data,
+ glyph, x, y,
+ klass->user_data.glyph_h_origin);
}
inline hb_bool_t get_glyph_v_origin (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
{
*x = *y = 0;
- return klass->get.glyph_v_origin (this, user_data,
- glyph, x, y,
- klass->user_data.glyph_v_origin);
+ return klass->get.f.glyph_v_origin (this, user_data,
+ glyph, x, y,
+ klass->user_data.glyph_v_origin);
}
inline hb_position_t get_glyph_h_kerning (hb_codepoint_t left_glyph, hb_codepoint_t right_glyph)
{
- return klass->get.glyph_h_kerning (this, user_data,
- left_glyph, right_glyph,
- klass->user_data.glyph_h_kerning);
+ return klass->get.f.glyph_h_kerning (this, user_data,
+ left_glyph, right_glyph,
+ klass->user_data.glyph_h_kerning);
}
inline hb_position_t get_glyph_v_kerning (hb_codepoint_t top_glyph, hb_codepoint_t bottom_glyph)
{
- return klass->get.glyph_v_kerning (this, user_data,
- top_glyph, bottom_glyph,
- klass->user_data.glyph_v_kerning);
+ return klass->get.f.glyph_v_kerning (this, user_data,
+ top_glyph, bottom_glyph,
+ klass->user_data.glyph_v_kerning);
}
inline hb_bool_t get_glyph_extents (hb_codepoint_t glyph,
hb_glyph_extents_t *extents)
{
memset (extents, 0, sizeof (*extents));
- return klass->get.glyph_extents (this, user_data,
- glyph,
- extents,
- klass->user_data.glyph_extents);
+ return klass->get.f.glyph_extents (this, user_data,
+ glyph,
+ extents,
+ klass->user_data.glyph_extents);
}
inline hb_bool_t get_glyph_contour_point (hb_codepoint_t glyph, unsigned int point_index,
hb_position_t *x, hb_position_t *y)
{
*x = *y = 0;
- return klass->get.glyph_contour_point (this, user_data,
- glyph, point_index,
- x, y,
- klass->user_data.glyph_contour_point);
+ return klass->get.f.glyph_contour_point (this, user_data,
+ glyph, point_index,
+ x, y,
+ klass->user_data.glyph_contour_point);
}
inline hb_bool_t get_glyph_name (hb_codepoint_t glyph,
char *name, unsigned int size)
{
if (size) *name = '\0';
- return klass->get.glyph_name (this, user_data,
- glyph,
- name, size,
- klass->user_data.glyph_name);
+ return klass->get.f.glyph_name (this, user_data,
+ glyph,
+ name, size,
+ klass->user_data.glyph_name);
}
inline hb_bool_t get_glyph_from_name (const char *name, int len, /* -1 means nul-terminated */
@@ -240,15 +293,43 @@ struct hb_font_t {
{
*glyph = 0;
if (len == -1) len = strlen (name);
- return klass->get.glyph_from_name (this, user_data,
- name, len,
- glyph,
- klass->user_data.glyph_from_name);
+ return klass->get.f.glyph_from_name (this, user_data,
+ name, len,
+ glyph,
+ klass->user_data.glyph_from_name);
}
/* A bit higher-level, and with fallback */
+ inline void get_h_extents_with_fallback (hb_font_extents_t *extents)
+ {
+ if (!get_font_h_extents (extents))
+ {
+ extents->ascender = y_scale * .8;
+ extents->descender = extents->ascender - y_scale;
+ extents->line_gap = 0;
+ }
+ }
+ inline void get_v_extents_with_fallback (hb_font_extents_t *extents)
+ {
+ if (!get_font_v_extents (extents))
+ {
+ extents->ascender = x_scale / 2;
+ extents->descender = extents->ascender - x_scale;
+ extents->line_gap = 0;
+ }
+ }
+
+ inline void get_extents_for_direction (hb_direction_t direction,
+ hb_font_extents_t *extents)
+ {
+ if (likely (HB_DIRECTION_IS_HORIZONTAL (direction)))
+ get_h_extents_with_fallback (extents);
+ else
+ get_v_extents_with_fallback (extents);
+ }
+
inline void get_glyph_advance_for_direction (hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y)
@@ -262,14 +343,38 @@ struct hb_font_t {
}
}
- /* Internal only */
inline void guess_v_origin_minus_h_origin (hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y)
{
*x = get_glyph_h_advance (glyph) / 2;
- /* TODO use font_metrics.ascent */
- *y = y_scale;
+ /* TODO cache this somehow?! */
+ hb_font_extents_t extents;
+ get_h_extents_with_fallback (&extents);
+ *y = extents.ascender;
+ }
+
+ inline void get_glyph_h_origin_with_fallback (hb_codepoint_t glyph,
+ hb_position_t *x, hb_position_t *y)
+ {
+ if (!get_glyph_h_origin (glyph, x, y) &&
+ get_glyph_v_origin (glyph, x, y))
+ {
+ hb_position_t dx, dy;
+ guess_v_origin_minus_h_origin (glyph, &dx, &dy);
+ *x -= dx; *y -= dy;
+ }
+ }
+ inline void get_glyph_v_origin_with_fallback (hb_codepoint_t glyph,
+ hb_position_t *x, hb_position_t *y)
+ {
+ if (!get_glyph_v_origin (glyph, x, y) &&
+ get_glyph_h_origin (glyph, x, y))
+ {
+ hb_position_t dx, dy;
+ guess_v_origin_minus_h_origin (glyph, &dx, &dy);
+ *x += dx; *y += dy;
+ }
}
inline void get_glyph_origin_for_direction (hb_codepoint_t glyph,
@@ -277,27 +382,31 @@ struct hb_font_t {
hb_position_t *x, hb_position_t *y)
{
if (likely (HB_DIRECTION_IS_HORIZONTAL (direction)))
- {
- if (!get_glyph_h_origin (glyph, x, y) &&
- get_glyph_v_origin (glyph, x, y))
- {
- hb_position_t dx, dy;
- guess_v_origin_minus_h_origin (glyph, &dx, &dy);
- *x -= dx; *y -= dy;
- }
- }
+ get_glyph_h_origin_with_fallback (glyph, x, y);
else
- {
- if (!get_glyph_v_origin (glyph, x, y) &&
- get_glyph_h_origin (glyph, x, y))
- {
- hb_position_t dx, dy;
- guess_v_origin_minus_h_origin (glyph, &dx, &dy);
- *x += dx; *y += dy;
- }
- }
+ get_glyph_v_origin_with_fallback (glyph, x, y);
}
+ inline void add_glyph_h_origin (hb_codepoint_t glyph,
+ hb_position_t *x, hb_position_t *y)
+ {
+ hb_position_t origin_x, origin_y;
+
+ get_glyph_h_origin_with_fallback (glyph, &origin_x, &origin_y);
+
+ *x += origin_x;
+ *y += origin_y;
+ }
+ inline void add_glyph_v_origin (hb_codepoint_t glyph,
+ hb_position_t *x, hb_position_t *y)
+ {
+ hb_position_t origin_x, origin_y;
+
+ get_glyph_v_origin_with_fallback (glyph, &origin_x, &origin_y);
+
+ *x += origin_x;
+ *y += origin_y;
+ }
inline void add_glyph_origin_for_direction (hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y)
@@ -310,6 +419,26 @@ struct hb_font_t {
*y += origin_y;
}
+ inline void subtract_glyph_h_origin (hb_codepoint_t glyph,
+ hb_position_t *x, hb_position_t *y)
+ {
+ hb_position_t origin_x, origin_y;
+
+ get_glyph_h_origin_with_fallback (glyph, &origin_x, &origin_y);
+
+ *x -= origin_x;
+ *y -= origin_y;
+ }
+ inline void subtract_glyph_v_origin (hb_codepoint_t glyph,
+ hb_position_t *x, hb_position_t *y)
+ {
+ hb_position_t origin_x, origin_y;
+
+ get_glyph_v_origin_with_fallback (glyph, &origin_x, &origin_y);
+
+ *x -= origin_x;
+ *y -= origin_y;
+ }
inline void subtract_glyph_origin_for_direction (hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y)
@@ -394,15 +523,24 @@ struct hb_font_t {
hb_codepoint_t unichar;
if (0 == strncmp (s, "uni", 3) &&
hb_codepoint_parse (s + 3, len - 3, 16, &unichar) &&
- get_glyph (unichar, 0, glyph))
+ get_nominal_glyph (unichar, glyph))
return true;
}
return false;
}
- private:
- inline hb_position_t em_scale (int16_t v, int scale) { return (hb_position_t) (v * (int64_t) scale / face->get_upem ()); }
+ inline hb_position_t em_scale (int16_t v, int scale)
+ {
+ int upem = face->get_upem ();
+ int64_t scaled = v * (int64_t) scale;
+ scaled += scaled >= 0 ? upem/2 : -upem/2; /* Round. */
+ return (hb_position_t) (scaled / upem);
+ }
+ inline hb_position_t em_scalef (float v, int scale)
+ {
+ return (hb_position_t) (v * scale / face->get_upem ());
+ }
};
#define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-font.cc b/src/3rdparty/harfbuzz-ng/src/hb-font.cc
index 6a69cae313..2935c4b4fd 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-font.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-font.cc
@@ -35,8 +35,6 @@
#include "hb-ot-head-table.hh"
#include "hb-ot-maxp-table.hh"
-#include "hb-cache-private.hh"
-
#include <string.h>
@@ -45,130 +43,246 @@
*/
static hb_bool_t
-hb_font_get_glyph_nil (hb_font_t *font,
- void *font_data HB_UNUSED,
- hb_codepoint_t unicode,
- hb_codepoint_t variation_selector,
- hb_codepoint_t *glyph,
- void *user_data HB_UNUSED)
+hb_font_get_font_h_extents_nil (hb_font_t *font,
+ void *font_data HB_UNUSED,
+ hb_font_extents_t *metrics,
+ void *user_data HB_UNUSED)
{
- if (font->parent)
- return font->parent->get_glyph (unicode, variation_selector, glyph);
+ memset (metrics, 0, sizeof (*metrics));
+ return false;
+}
+static hb_bool_t
+hb_font_get_font_h_extents_parent (hb_font_t *font,
+ void *font_data HB_UNUSED,
+ hb_font_extents_t *metrics,
+ void *user_data HB_UNUSED)
+{
+ hb_bool_t ret = font->parent->get_font_h_extents (metrics);
+ if (ret) {
+ metrics->ascender = font->parent_scale_y_distance (metrics->ascender);
+ metrics->descender = font->parent_scale_y_distance (metrics->descender);
+ metrics->line_gap = font->parent_scale_y_distance (metrics->line_gap);
+ }
+ return ret;
+}
+static hb_bool_t
+hb_font_get_font_v_extents_nil (hb_font_t *font,
+ void *font_data HB_UNUSED,
+ hb_font_extents_t *metrics,
+ void *user_data HB_UNUSED)
+{
+ memset (metrics, 0, sizeof (*metrics));
+ return false;
+}
+static hb_bool_t
+hb_font_get_font_v_extents_parent (hb_font_t *font,
+ void *font_data HB_UNUSED,
+ hb_font_extents_t *metrics,
+ void *user_data HB_UNUSED)
+{
+ hb_bool_t ret = font->parent->get_font_v_extents (metrics);
+ if (ret) {
+ metrics->ascender = font->parent_scale_x_distance (metrics->ascender);
+ metrics->descender = font->parent_scale_x_distance (metrics->descender);
+ metrics->line_gap = font->parent_scale_x_distance (metrics->line_gap);
+ }
+ return ret;
+}
+
+static hb_bool_t
+hb_font_get_nominal_glyph_nil (hb_font_t *font HB_UNUSED,
+ void *font_data HB_UNUSED,
+ hb_codepoint_t unicode,
+ hb_codepoint_t *glyph,
+ void *user_data HB_UNUSED)
+{
*glyph = 0;
return false;
}
+static hb_bool_t
+hb_font_get_nominal_glyph_parent (hb_font_t *font,
+ void *font_data HB_UNUSED,
+ hb_codepoint_t unicode,
+ hb_codepoint_t *glyph,
+ void *user_data HB_UNUSED)
+{
+ return font->parent->get_nominal_glyph (unicode, glyph);
+}
+
+static hb_bool_t
+hb_font_get_variation_glyph_nil (hb_font_t *font HB_UNUSED,
+ void *font_data HB_UNUSED,
+ hb_codepoint_t unicode,
+ hb_codepoint_t variation_selector,
+ hb_codepoint_t *glyph,
+ void *user_data HB_UNUSED)
+{
+ *glyph = 0;
+ return false;
+}
+static hb_bool_t
+hb_font_get_variation_glyph_parent (hb_font_t *font,
+ void *font_data HB_UNUSED,
+ hb_codepoint_t unicode,
+ hb_codepoint_t variation_selector,
+ hb_codepoint_t *glyph,
+ void *user_data HB_UNUSED)
+{
+ return font->parent->get_variation_glyph (unicode, variation_selector, glyph);
+}
+
static hb_position_t
-hb_font_get_glyph_h_advance_nil (hb_font_t *font,
+hb_font_get_glyph_h_advance_nil (hb_font_t *font HB_UNUSED,
void *font_data HB_UNUSED,
hb_codepoint_t glyph,
void *user_data HB_UNUSED)
{
- if (font->parent)
- return font->parent_scale_x_distance (font->parent->get_glyph_h_advance (glyph));
-
return font->x_scale;
}
+static hb_position_t
+hb_font_get_glyph_h_advance_parent (hb_font_t *font,
+ void *font_data HB_UNUSED,
+ hb_codepoint_t glyph,
+ void *user_data HB_UNUSED)
+{
+ return font->parent_scale_x_distance (font->parent->get_glyph_h_advance (glyph));
+}
static hb_position_t
-hb_font_get_glyph_v_advance_nil (hb_font_t *font,
+hb_font_get_glyph_v_advance_nil (hb_font_t *font HB_UNUSED,
void *font_data HB_UNUSED,
hb_codepoint_t glyph,
void *user_data HB_UNUSED)
{
- if (font->parent)
- return font->parent_scale_y_distance (font->parent->get_glyph_v_advance (glyph));
-
+ /* TODO use font_extents.ascender+descender */
return font->y_scale;
}
+static hb_position_t
+hb_font_get_glyph_v_advance_parent (hb_font_t *font,
+ void *font_data HB_UNUSED,
+ hb_codepoint_t glyph,
+ void *user_data HB_UNUSED)
+{
+ return font->parent_scale_y_distance (font->parent->get_glyph_v_advance (glyph));
+}
static hb_bool_t
-hb_font_get_glyph_h_origin_nil (hb_font_t *font,
+hb_font_get_glyph_h_origin_nil (hb_font_t *font HB_UNUSED,
void *font_data HB_UNUSED,
hb_codepoint_t glyph,
hb_position_t *x,
hb_position_t *y,
void *user_data HB_UNUSED)
{
- if (font->parent) {
- hb_bool_t ret = font->parent->get_glyph_h_origin (glyph, x, y);
- if (ret)
- font->parent_scale_position (x, y);
- return ret;
- }
-
*x = *y = 0;
- return false;
+ return true;
+}
+static hb_bool_t
+hb_font_get_glyph_h_origin_parent (hb_font_t *font,
+ void *font_data HB_UNUSED,
+ hb_codepoint_t glyph,
+ hb_position_t *x,
+ hb_position_t *y,
+ void *user_data HB_UNUSED)
+{
+ hb_bool_t ret = font->parent->get_glyph_h_origin (glyph, x, y);
+ if (ret)
+ font->parent_scale_position (x, y);
+ return ret;
}
static hb_bool_t
-hb_font_get_glyph_v_origin_nil (hb_font_t *font,
+hb_font_get_glyph_v_origin_nil (hb_font_t *font HB_UNUSED,
void *font_data HB_UNUSED,
hb_codepoint_t glyph,
hb_position_t *x,
hb_position_t *y,
void *user_data HB_UNUSED)
{
- if (font->parent) {
- hb_bool_t ret = font->parent->get_glyph_v_origin (glyph, x, y);
- if (ret)
- font->parent_scale_position (x, y);
- return ret;
- }
-
*x = *y = 0;
return false;
}
+static hb_bool_t
+hb_font_get_glyph_v_origin_parent (hb_font_t *font,
+ void *font_data HB_UNUSED,
+ hb_codepoint_t glyph,
+ hb_position_t *x,
+ hb_position_t *y,
+ void *user_data HB_UNUSED)
+{
+ hb_bool_t ret = font->parent->get_glyph_v_origin (glyph, x, y);
+ if (ret)
+ font->parent_scale_position (x, y);
+ return ret;
+}
static hb_position_t
-hb_font_get_glyph_h_kerning_nil (hb_font_t *font,
+hb_font_get_glyph_h_kerning_nil (hb_font_t *font HB_UNUSED,
void *font_data HB_UNUSED,
hb_codepoint_t left_glyph,
hb_codepoint_t right_glyph,
void *user_data HB_UNUSED)
{
- if (font->parent)
- return font->parent_scale_x_distance (font->parent->get_glyph_h_kerning (left_glyph, right_glyph));
-
return 0;
}
+static hb_position_t
+hb_font_get_glyph_h_kerning_parent (hb_font_t *font,
+ void *font_data HB_UNUSED,
+ hb_codepoint_t left_glyph,
+ hb_codepoint_t right_glyph,
+ void *user_data HB_UNUSED)
+{
+ return font->parent_scale_x_distance (font->parent->get_glyph_h_kerning (left_glyph, right_glyph));
+}
static hb_position_t
-hb_font_get_glyph_v_kerning_nil (hb_font_t *font,
+hb_font_get_glyph_v_kerning_nil (hb_font_t *font HB_UNUSED,
void *font_data HB_UNUSED,
hb_codepoint_t top_glyph,
hb_codepoint_t bottom_glyph,
void *user_data HB_UNUSED)
{
- if (font->parent)
- return font->parent_scale_y_distance (font->parent->get_glyph_v_kerning (top_glyph, bottom_glyph));
-
return 0;
}
+static hb_position_t
+hb_font_get_glyph_v_kerning_parent (hb_font_t *font,
+ void *font_data HB_UNUSED,
+ hb_codepoint_t top_glyph,
+ hb_codepoint_t bottom_glyph,
+ void *user_data HB_UNUSED)
+{
+ return font->parent_scale_y_distance (font->parent->get_glyph_v_kerning (top_glyph, bottom_glyph));
+}
static hb_bool_t
-hb_font_get_glyph_extents_nil (hb_font_t *font,
+hb_font_get_glyph_extents_nil (hb_font_t *font HB_UNUSED,
void *font_data HB_UNUSED,
hb_codepoint_t glyph,
hb_glyph_extents_t *extents,
void *user_data HB_UNUSED)
{
- if (font->parent) {
- hb_bool_t ret = font->parent->get_glyph_extents (glyph, extents);
- if (ret) {
- font->parent_scale_position (&extents->x_bearing, &extents->y_bearing);
- font->parent_scale_distance (&extents->width, &extents->height);
- }
- return ret;
- }
-
memset (extents, 0, sizeof (*extents));
return false;
}
+static hb_bool_t
+hb_font_get_glyph_extents_parent (hb_font_t *font,
+ void *font_data HB_UNUSED,
+ hb_codepoint_t glyph,
+ hb_glyph_extents_t *extents,
+ void *user_data HB_UNUSED)
+{
+ hb_bool_t ret = font->parent->get_glyph_extents (glyph, extents);
+ if (ret) {
+ font->parent_scale_position (&extents->x_bearing, &extents->y_bearing);
+ font->parent_scale_distance (&extents->width, &extents->height);
+ }
+ return ret;
+}
static hb_bool_t
-hb_font_get_glyph_contour_point_nil (hb_font_t *font,
+hb_font_get_glyph_contour_point_nil (hb_font_t *font HB_UNUSED,
void *font_data HB_UNUSED,
hb_codepoint_t glyph,
unsigned int point_index,
@@ -176,45 +290,63 @@ hb_font_get_glyph_contour_point_nil (hb_font_t *font,
hb_position_t *y,
void *user_data HB_UNUSED)
{
- if (font->parent) {
- hb_bool_t ret = font->parent->get_glyph_contour_point (glyph, point_index, x, y);
- if (ret)
- font->parent_scale_position (x, y);
- return ret;
- }
-
*x = *y = 0;
return false;
}
+static hb_bool_t
+hb_font_get_glyph_contour_point_parent (hb_font_t *font,
+ void *font_data HB_UNUSED,
+ hb_codepoint_t glyph,
+ unsigned int point_index,
+ hb_position_t *x,
+ hb_position_t *y,
+ void *user_data HB_UNUSED)
+{
+ hb_bool_t ret = font->parent->get_glyph_contour_point (glyph, point_index, x, y);
+ if (ret)
+ font->parent_scale_position (x, y);
+ return ret;
+}
static hb_bool_t
-hb_font_get_glyph_name_nil (hb_font_t *font,
+hb_font_get_glyph_name_nil (hb_font_t *font HB_UNUSED,
void *font_data HB_UNUSED,
hb_codepoint_t glyph,
char *name, unsigned int size,
void *user_data HB_UNUSED)
{
- if (font->parent)
- return font->parent->get_glyph_name (glyph, name, size);
-
if (size) *name = '\0';
return false;
}
+static hb_bool_t
+hb_font_get_glyph_name_parent (hb_font_t *font,
+ void *font_data HB_UNUSED,
+ hb_codepoint_t glyph,
+ char *name, unsigned int size,
+ void *user_data HB_UNUSED)
+{
+ return font->parent->get_glyph_name (glyph, name, size);
+}
static hb_bool_t
-hb_font_get_glyph_from_name_nil (hb_font_t *font,
+hb_font_get_glyph_from_name_nil (hb_font_t *font HB_UNUSED,
void *font_data HB_UNUSED,
const char *name, int len, /* -1 means nul-terminated */
hb_codepoint_t *glyph,
void *user_data HB_UNUSED)
{
- if (font->parent)
- return font->parent->get_glyph_from_name (name, len, glyph);
-
*glyph = 0;
return false;
}
-
+static hb_bool_t
+hb_font_get_glyph_from_name_parent (hb_font_t *font,
+ void *font_data HB_UNUSED,
+ const char *name, int len, /* -1 means nul-terminated */
+ hb_codepoint_t *glyph,
+ void *user_data HB_UNUSED)
+{
+ return font->parent->get_glyph_from_name (name, len, glyph);
+}
static const hb_font_funcs_t _hb_font_funcs_nil = {
HB_OBJECT_HEADER_STATIC,
@@ -222,9 +354,44 @@ static const hb_font_funcs_t _hb_font_funcs_nil = {
true, /* immutable */
{
+#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
+ HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
+#undef HB_FONT_FUNC_IMPLEMENT
+ },
+ {
+#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
+ HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
+#undef HB_FONT_FUNC_IMPLEMENT
+ },
+ {
+ {
#define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_nil,
+ HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
+#undef HB_FONT_FUNC_IMPLEMENT
+ }
+ }
+};
+static const hb_font_funcs_t _hb_font_funcs_parent = {
+ HB_OBJECT_HEADER_STATIC,
+
+ true, /* immutable */
+
+ {
+#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
+ HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
+#undef HB_FONT_FUNC_IMPLEMENT
+ },
+ {
+#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT
+ },
+ {
+ {
+#define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_parent,
+ HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
+#undef HB_FONT_FUNC_IMPLEMENT
+ }
}
};
@@ -246,7 +413,7 @@ hb_font_funcs_create (void)
if (!(ffuncs = hb_object_create<hb_font_funcs_t> ()))
return hb_font_funcs_get_empty ();
- ffuncs->get = _hb_font_funcs_nil.get;
+ ffuncs->get = _hb_font_funcs_parent.get;
return ffuncs;
}
@@ -263,7 +430,7 @@ hb_font_funcs_create (void)
hb_font_funcs_t *
hb_font_funcs_get_empty (void)
{
- return const_cast<hb_font_funcs_t *> (&_hb_font_funcs_nil);
+ return const_cast<hb_font_funcs_t *> (&_hb_font_funcs_parent);
}
/**
@@ -398,11 +565,11 @@ hb_font_funcs_set_##name##_func (hb_font_funcs_t *ffuncs, \
ffuncs->destroy.name (ffuncs->user_data.name); \
\
if (func) { \
- ffuncs->get.name = func; \
+ ffuncs->get.f.name = func; \
ffuncs->user_data.name = user_data; \
ffuncs->destroy.name = destroy; \
} else { \
- ffuncs->get.name = hb_font_get_##name##_nil; \
+ ffuncs->get.f.name = hb_font_get_##name##_parent; \
ffuncs->user_data.name = NULL; \
ffuncs->destroy.name = NULL; \
} \
@@ -411,10 +578,53 @@ hb_font_funcs_set_##name##_func (hb_font_funcs_t *ffuncs, \
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT
+bool
+hb_font_t::has_func (unsigned int i)
+{
+ if (parent && parent != hb_font_get_empty () && parent->has_func (i))
+ return true;
+ return this->klass->get.array[i] != _hb_font_funcs_parent.get.array[i];
+}
/* Public getters */
/**
+ * hb_font_get_h_extents:
+ * @font: a font.
+ * @extents: (out):
+ *
+ *
+ *
+ * Return value:
+ *
+ * Since: 1.1.3
+ **/
+hb_bool_t
+hb_font_get_h_extents (hb_font_t *font,
+ hb_font_extents_t *extents)
+{
+ return font->get_font_h_extents (extents);
+}
+
+/**
+ * hb_font_get_v_extents:
+ * @font: a font.
+ * @extents: (out):
+ *
+ *
+ *
+ * Return value:
+ *
+ * Since: 1.1.3
+ **/
+hb_bool_t
+hb_font_get_v_extents (hb_font_t *font,
+ hb_font_extents_t *extents)
+{
+ return font->get_font_v_extents (extents);
+}
+
+/**
* hb_font_get_glyph:
* @font: a font.
* @unicode:
@@ -432,7 +642,50 @@ hb_font_get_glyph (hb_font_t *font,
hb_codepoint_t unicode, hb_codepoint_t variation_selector,
hb_codepoint_t *glyph)
{
- return font->get_glyph (unicode, variation_selector, glyph);
+ if (unlikely (variation_selector))
+ return font->get_variation_glyph (unicode, variation_selector, glyph);
+ return font->get_nominal_glyph (unicode, glyph);
+}
+
+/**
+ * hb_font_get_nominal_glyph:
+ * @font: a font.
+ * @unicode:
+ * @glyph: (out):
+ *
+ *
+ *
+ * Return value:
+ *
+ * Since: 1.2.3
+ **/
+hb_bool_t
+hb_font_get_nominal_glyph (hb_font_t *font,
+ hb_codepoint_t unicode,
+ hb_codepoint_t *glyph)
+{
+ return font->get_nominal_glyph (unicode, glyph);
+}
+
+/**
+ * hb_font_get_variation_glyph:
+ * @font: a font.
+ * @unicode:
+ * @variation_selector:
+ * @glyph: (out):
+ *
+ *
+ *
+ * Return value:
+ *
+ * Since: 1.2.3
+ **/
+hb_bool_t
+hb_font_get_variation_glyph (hb_font_t *font,
+ hb_codepoint_t unicode, hb_codepoint_t variation_selector,
+ hb_codepoint_t *glyph)
+{
+ return font->get_variation_glyph (unicode, variation_selector, glyph);
}
/**
@@ -639,6 +892,23 @@ hb_font_get_glyph_from_name (hb_font_t *font,
/* A bit higher-level, and with fallback */
/**
+ * hb_font_get_extents_for_direction:
+ * @font: a font.
+ * @direction:
+ * @extents:
+ *
+ *
+ *
+ * Since: 1.1.3
+ **/
+void
+hb_font_get_extents_for_direction (hb_font_t *font,
+ hb_direction_t direction,
+ hb_font_extents_t *extents)
+{
+ return font->get_extents_for_direction (direction, extents);
+}
+/**
* hb_font_get_glyph_advance_for_direction:
* @font: a font.
* @glyph:
@@ -858,6 +1128,7 @@ hb_font_create (hb_face_t *face)
return hb_font_get_empty ();
hb_face_make_immutable (face);
+ font->parent = hb_font_get_empty ();
font->face = hb_face_reference (face);
font->klass = hb_font_funcs_get_empty ();
@@ -894,6 +1165,8 @@ hb_font_create_sub_font (hb_font_t *parent)
font->x_ppem = parent->x_ppem;
font->y_ppem = parent->y_ppem;
+ /* TODO: copy variation coordinates. */
+
return font;
}
@@ -917,12 +1190,15 @@ hb_font_get_empty (void)
NULL, /* parent */
const_cast<hb_face_t *> (&_hb_face_nil),
- 0, /* x_scale */
- 0, /* y_scale */
+ 1000, /* x_scale */
+ 1000, /* y_scale */
0, /* x_ppem */
0, /* y_ppem */
+ 0, /* num_coords */
+ NULL, /* coords */
+
const_cast<hb_font_funcs_t *> (&_hb_font_funcs_nil), /* klass */
NULL, /* user_data */
NULL, /* destroy */
@@ -977,6 +1253,8 @@ hb_font_destroy (hb_font_t *font)
hb_face_destroy (font->face);
hb_font_funcs_destroy (font->klass);
+ free (font->coords);
+
free (font);
}
@@ -1264,3 +1542,157 @@ hb_font_get_ppem (hb_font_t *font,
if (x_ppem) *x_ppem = font->x_ppem;
if (y_ppem) *y_ppem = font->y_ppem;
}
+
+
+void
+hb_font_set_var_coords_normalized (hb_font_t *font,
+ int *coords, /* XXX 2.14 normalized */
+ unsigned int coords_length)
+{
+ if (font->immutable)
+ return;
+
+ /* Skip tail zero entries. */
+ while (coords_length && !coords[coords_length - 1])
+ coords_length--;
+
+ int *copy = coords_length ? (int *) calloc (coords_length, sizeof (coords[0])) : NULL;
+ if (unlikely (coords_length && !copy))
+ return;
+
+ free (font->coords);
+
+ if (coords_length)
+ memcpy (copy, coords, coords_length * sizeof (coords[0]));
+
+ font->coords = copy;
+ font->num_coords = coords_length;
+}
+
+
+#ifndef HB_DISABLE_DEPRECATED
+
+/*
+ * Deprecated get_glyph_func():
+ */
+
+struct hb_trampoline_closure_t
+{
+ void *user_data;
+ hb_destroy_func_t destroy;
+ unsigned int ref_count;
+};
+
+template <typename FuncType>
+struct hb_trampoline_t
+{
+ hb_trampoline_closure_t closure; /* Must be first. */
+ FuncType func;
+};
+
+template <typename FuncType>
+static hb_trampoline_t<FuncType> *
+trampoline_create (FuncType func,
+ void *user_data,
+ hb_destroy_func_t destroy)
+{
+ typedef hb_trampoline_t<FuncType> trampoline_t;
+
+ trampoline_t *trampoline = (trampoline_t *) calloc (1, sizeof (trampoline_t));
+
+ if (unlikely (!trampoline))
+ return NULL;
+
+ trampoline->closure.user_data = user_data;
+ trampoline->closure.destroy = destroy;
+ trampoline->closure.ref_count = 1;
+ trampoline->func = func;
+
+ return trampoline;
+}
+
+static void
+trampoline_reference (hb_trampoline_closure_t *closure)
+{
+ closure->ref_count++;
+}
+
+static void
+trampoline_destroy (void *user_data)
+{
+ hb_trampoline_closure_t *closure = (hb_trampoline_closure_t *) user_data;
+
+ if (--closure->ref_count)
+ return;
+
+ if (closure->destroy)
+ closure->destroy (closure->user_data);
+ free (closure);
+}
+
+typedef hb_trampoline_t<hb_font_get_glyph_func_t> hb_font_get_glyph_trampoline_t;
+
+static hb_bool_t
+hb_font_get_nominal_glyph_trampoline (hb_font_t *font,
+ void *font_data,
+ hb_codepoint_t unicode,
+ hb_codepoint_t *glyph,
+ void *user_data)
+{
+ hb_font_get_glyph_trampoline_t *trampoline = (hb_font_get_glyph_trampoline_t *) user_data;
+ return trampoline->func (font, font_data, unicode, 0, glyph, trampoline->closure.user_data);
+}
+
+static hb_bool_t
+hb_font_get_variation_glyph_trampoline (hb_font_t *font,
+ void *font_data,
+ hb_codepoint_t unicode,
+ hb_codepoint_t variation_selector,
+ hb_codepoint_t *glyph,
+ void *user_data)
+{
+ hb_font_get_glyph_trampoline_t *trampoline = (hb_font_get_glyph_trampoline_t *) user_data;
+ return trampoline->func (font, font_data, unicode, variation_selector, glyph, trampoline->closure.user_data);
+}
+
+/**
+ * hb_font_funcs_set_glyph_func:
+ * @ffuncs: font functions.
+ * @func: (closure user_data) (destroy destroy) (scope notified):
+ * @user_data:
+ * @destroy:
+ *
+ * Deprecated. Use hb_font_funcs_set_nominal_glyph_func() and
+ * hb_font_funcs_set_variation_glyph_func() instead.
+ *
+ * Since: 0.9.2
+ * Deprecated: 1.2.3
+ **/
+void
+hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
+ hb_font_get_glyph_func_t func,
+ void *user_data, hb_destroy_func_t destroy)
+{
+ hb_font_get_glyph_trampoline_t *trampoline;
+
+ trampoline = trampoline_create (func, user_data, destroy);
+ if (unlikely (!trampoline))
+ {
+ if (destroy)
+ destroy (user_data);
+ return;
+ }
+
+ hb_font_funcs_set_nominal_glyph_func (ffuncs,
+ hb_font_get_nominal_glyph_trampoline,
+ trampoline,
+ trampoline_destroy);
+
+ trampoline_reference (&trampoline->closure);
+ hb_font_funcs_set_variation_glyph_func (ffuncs,
+ hb_font_get_variation_glyph_trampoline,
+ trampoline,
+ trampoline_destroy);
+}
+
+#endif /* HB_DISABLE_DEPRECATED */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-font.h b/src/3rdparty/harfbuzz-ng/src/hb-font.h
index fb4a0eab5a..8813286726 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-font.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-font.h
@@ -46,19 +46,19 @@ typedef struct hb_font_t hb_font_t;
typedef struct hb_font_funcs_t hb_font_funcs_t;
-hb_font_funcs_t *
+HB_EXTERN hb_font_funcs_t *
hb_font_funcs_create (void);
-hb_font_funcs_t *
+HB_EXTERN hb_font_funcs_t *
hb_font_funcs_get_empty (void);
-hb_font_funcs_t *
+HB_EXTERN hb_font_funcs_t *
hb_font_funcs_reference (hb_font_funcs_t *ffuncs);
-void
+HB_EXTERN void
hb_font_funcs_destroy (hb_font_funcs_t *ffuncs);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_font_funcs_set_user_data (hb_font_funcs_t *ffuncs,
hb_user_data_key_t *key,
void * data,
@@ -66,19 +66,37 @@ hb_font_funcs_set_user_data (hb_font_funcs_t *ffuncs,
hb_bool_t replace);
-void *
+HB_EXTERN void *
hb_font_funcs_get_user_data (hb_font_funcs_t *ffuncs,
hb_user_data_key_t *key);
-void
+HB_EXTERN void
hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_font_funcs_is_immutable (hb_font_funcs_t *ffuncs);
-/* glyph extents */
+/* font and glyph extents */
+
+/* Note that typically ascender is positive and descender negative in coordinate systems that grow up. */
+typedef struct hb_font_extents_t
+{
+ hb_position_t ascender; /* typographic ascender. */
+ hb_position_t descender; /* typographic descender. */
+ hb_position_t line_gap; /* suggested line spacing gap. */
+ /*< private >*/
+ hb_position_t reserved9;
+ hb_position_t reserved8;
+ hb_position_t reserved7;
+ hb_position_t reserved6;
+ hb_position_t reserved5;
+ hb_position_t reserved4;
+ hb_position_t reserved3;
+ hb_position_t reserved2;
+ hb_position_t reserved1;
+} hb_font_extents_t;
/* Note that height is negative in coordinate systems that grow up. */
typedef struct hb_glyph_extents_t
@@ -89,13 +107,23 @@ typedef struct hb_glyph_extents_t
hb_position_t height; /* distance from top to bottom side. */
} hb_glyph_extents_t;
-
/* func types */
-typedef hb_bool_t (*hb_font_get_glyph_func_t) (hb_font_t *font, void *font_data,
- hb_codepoint_t unicode, hb_codepoint_t variation_selector,
- hb_codepoint_t *glyph,
- void *user_data);
+typedef hb_bool_t (*hb_font_get_font_extents_func_t) (hb_font_t *font, void *font_data,
+ hb_font_extents_t *metrics,
+ void *user_data);
+typedef hb_font_get_font_extents_func_t hb_font_get_font_h_extents_func_t;
+typedef hb_font_get_font_extents_func_t hb_font_get_font_v_extents_func_t;
+
+
+typedef hb_bool_t (*hb_font_get_nominal_glyph_func_t) (hb_font_t *font, void *font_data,
+ hb_codepoint_t unicode,
+ hb_codepoint_t *glyph,
+ void *user_data);
+typedef hb_bool_t (*hb_font_get_variation_glyph_func_t) (hb_font_t *font, void *font_data,
+ hb_codepoint_t unicode, hb_codepoint_t variation_selector,
+ hb_codepoint_t *glyph,
+ void *user_data);
typedef hb_position_t (*hb_font_get_glyph_advance_func_t) (hb_font_t *font, void *font_data,
@@ -141,7 +169,39 @@ typedef hb_bool_t (*hb_font_get_glyph_from_name_func_t) (hb_font_t *font, void *
/* func setters */
/**
- * hb_font_funcs_set_glyph_func:
+ * hb_font_funcs_set_font_h_extents_func:
+ * @ffuncs: font functions.
+ * @func: (closure user_data) (destroy destroy) (scope notified):
+ * @user_data:
+ * @destroy:
+ *
+ *
+ *
+ * Since: 1.1.2
+ **/
+HB_EXTERN void
+hb_font_funcs_set_font_h_extents_func (hb_font_funcs_t *ffuncs,
+ hb_font_get_font_h_extents_func_t func,
+ void *user_data, hb_destroy_func_t destroy);
+
+/**
+ * hb_font_funcs_set_font_v_extents_func:
+ * @ffuncs: font functions.
+ * @func: (closure user_data) (destroy destroy) (scope notified):
+ * @user_data:
+ * @destroy:
+ *
+ *
+ *
+ * Since: 1.1.2
+ **/
+HB_EXTERN void
+hb_font_funcs_set_font_v_extents_func (hb_font_funcs_t *ffuncs,
+ hb_font_get_font_v_extents_func_t func,
+ void *user_data, hb_destroy_func_t destroy);
+
+/**
+ * hb_font_funcs_set_nominal_glyph_func:
* @ffuncs: font functions.
* @func: (closure user_data) (destroy destroy) (scope notified):
* @user_data:
@@ -149,12 +209,28 @@ typedef hb_bool_t (*hb_font_get_glyph_from_name_func_t) (hb_font_t *font, void *
*
*
*
- * Since: 0.9.2
+ * Since: 1.2.3
+ **/
+HB_EXTERN void
+hb_font_funcs_set_nominal_glyph_func (hb_font_funcs_t *ffuncs,
+ hb_font_get_nominal_glyph_func_t func,
+ void *user_data, hb_destroy_func_t destroy);
+
+/**
+ * hb_font_funcs_set_variation_glyph_func:
+ * @ffuncs: font functions.
+ * @func: (closure user_data) (destroy destroy) (scope notified):
+ * @user_data:
+ * @destroy:
+ *
+ *
+ *
+ * Since: 1.2.3
**/
-void
-hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
- hb_font_get_glyph_func_t func,
- void *user_data, hb_destroy_func_t destroy);
+HB_EXTERN void
+hb_font_funcs_set_variation_glyph_func (hb_font_funcs_t *ffuncs,
+ hb_font_get_variation_glyph_func_t func,
+ void *user_data, hb_destroy_func_t destroy);
/**
* hb_font_funcs_set_glyph_h_advance_func:
@@ -167,7 +243,7 @@ hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
*
* Since: 0.9.2
**/
-void
+HB_EXTERN void
hb_font_funcs_set_glyph_h_advance_func (hb_font_funcs_t *ffuncs,
hb_font_get_glyph_h_advance_func_t func,
void *user_data, hb_destroy_func_t destroy);
@@ -183,7 +259,7 @@ hb_font_funcs_set_glyph_h_advance_func (hb_font_funcs_t *ffuncs,
*
* Since: 0.9.2
**/
-void
+HB_EXTERN void
hb_font_funcs_set_glyph_v_advance_func (hb_font_funcs_t *ffuncs,
hb_font_get_glyph_v_advance_func_t func,
void *user_data, hb_destroy_func_t destroy);
@@ -199,7 +275,7 @@ hb_font_funcs_set_glyph_v_advance_func (hb_font_funcs_t *ffuncs,
*
* Since: 0.9.2
**/
-void
+HB_EXTERN void
hb_font_funcs_set_glyph_h_origin_func (hb_font_funcs_t *ffuncs,
hb_font_get_glyph_h_origin_func_t func,
void *user_data, hb_destroy_func_t destroy);
@@ -215,7 +291,7 @@ hb_font_funcs_set_glyph_h_origin_func (hb_font_funcs_t *ffuncs,
*
* Since: 0.9.2
**/
-void
+HB_EXTERN void
hb_font_funcs_set_glyph_v_origin_func (hb_font_funcs_t *ffuncs,
hb_font_get_glyph_v_origin_func_t func,
void *user_data, hb_destroy_func_t destroy);
@@ -231,7 +307,7 @@ hb_font_funcs_set_glyph_v_origin_func (hb_font_funcs_t *ffuncs,
*
* Since: 0.9.2
**/
-void
+HB_EXTERN void
hb_font_funcs_set_glyph_h_kerning_func (hb_font_funcs_t *ffuncs,
hb_font_get_glyph_h_kerning_func_t func,
void *user_data, hb_destroy_func_t destroy);
@@ -247,7 +323,7 @@ hb_font_funcs_set_glyph_h_kerning_func (hb_font_funcs_t *ffuncs,
*
* Since: 0.9.2
**/
-void
+HB_EXTERN void
hb_font_funcs_set_glyph_v_kerning_func (hb_font_funcs_t *ffuncs,
hb_font_get_glyph_v_kerning_func_t func,
void *user_data, hb_destroy_func_t destroy);
@@ -263,7 +339,7 @@ hb_font_funcs_set_glyph_v_kerning_func (hb_font_funcs_t *ffuncs,
*
* Since: 0.9.2
**/
-void
+HB_EXTERN void
hb_font_funcs_set_glyph_extents_func (hb_font_funcs_t *ffuncs,
hb_font_get_glyph_extents_func_t func,
void *user_data, hb_destroy_func_t destroy);
@@ -279,7 +355,7 @@ hb_font_funcs_set_glyph_extents_func (hb_font_funcs_t *ffuncs,
*
* Since: 0.9.2
**/
-void
+HB_EXTERN void
hb_font_funcs_set_glyph_contour_point_func (hb_font_funcs_t *ffuncs,
hb_font_get_glyph_contour_point_func_t func,
void *user_data, hb_destroy_func_t destroy);
@@ -295,7 +371,7 @@ hb_font_funcs_set_glyph_contour_point_func (hb_font_funcs_t *ffuncs,
*
* Since: 0.9.2
**/
-void
+HB_EXTERN void
hb_font_funcs_set_glyph_name_func (hb_font_funcs_t *ffuncs,
hb_font_get_glyph_name_func_t func,
void *user_data, hb_destroy_func_t destroy);
@@ -311,57 +387,67 @@ hb_font_funcs_set_glyph_name_func (hb_font_funcs_t *ffuncs,
*
* Since: 0.9.2
**/
-void
+HB_EXTERN void
hb_font_funcs_set_glyph_from_name_func (hb_font_funcs_t *ffuncs,
hb_font_get_glyph_from_name_func_t func,
void *user_data, hb_destroy_func_t destroy);
-
/* func dispatch */
-hb_bool_t
-hb_font_get_glyph (hb_font_t *font,
- hb_codepoint_t unicode, hb_codepoint_t variation_selector,
- hb_codepoint_t *glyph);
+HB_EXTERN hb_bool_t
+hb_font_get_h_extents (hb_font_t *font,
+ hb_font_extents_t *extents);
+HB_EXTERN hb_bool_t
+hb_font_get_v_extents (hb_font_t *font,
+ hb_font_extents_t *extents);
+
+HB_EXTERN hb_bool_t
+hb_font_get_nominal_glyph (hb_font_t *font,
+ hb_codepoint_t unicode,
+ hb_codepoint_t *glyph);
+HB_EXTERN hb_bool_t
+hb_font_get_variation_glyph (hb_font_t *font,
+ hb_codepoint_t unicode, hb_codepoint_t variation_selector,
+ hb_codepoint_t *glyph);
-hb_position_t
+HB_EXTERN hb_position_t
hb_font_get_glyph_h_advance (hb_font_t *font,
hb_codepoint_t glyph);
-hb_position_t
+HB_EXTERN hb_position_t
hb_font_get_glyph_v_advance (hb_font_t *font,
hb_codepoint_t glyph);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_font_get_glyph_h_origin (hb_font_t *font,
hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_font_get_glyph_v_origin (hb_font_t *font,
hb_codepoint_t glyph,
hb_position_t *x, hb_position_t *y);
-hb_position_t
+HB_EXTERN hb_position_t
hb_font_get_glyph_h_kerning (hb_font_t *font,
hb_codepoint_t left_glyph, hb_codepoint_t right_glyph);
-hb_position_t
+HB_EXTERN hb_position_t
hb_font_get_glyph_v_kerning (hb_font_t *font,
hb_codepoint_t top_glyph, hb_codepoint_t bottom_glyph);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_font_get_glyph_extents (hb_font_t *font,
hb_codepoint_t glyph,
hb_glyph_extents_t *extents);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_font_get_glyph_contour_point (hb_font_t *font,
hb_codepoint_t glyph, unsigned int point_index,
hb_position_t *x, hb_position_t *y);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_font_get_glyph_name (hb_font_t *font,
hb_codepoint_t glyph,
char *name, unsigned int size);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_font_get_glyph_from_name (hb_font_t *font,
const char *name, int len, /* -1 means nul-terminated */
hb_codepoint_t *glyph);
@@ -369,52 +455,63 @@ hb_font_get_glyph_from_name (hb_font_t *font,
/* high-level funcs, with fallback */
-void
+/* Calls either hb_font_get_nominal_glyph() if variation_selector is 0,
+ * otherwise callse hb_font_get_variation_glyph(). */
+HB_EXTERN hb_bool_t
+hb_font_get_glyph (hb_font_t *font,
+ hb_codepoint_t unicode, hb_codepoint_t variation_selector,
+ hb_codepoint_t *glyph);
+
+HB_EXTERN void
+hb_font_get_extents_for_direction (hb_font_t *font,
+ hb_direction_t direction,
+ hb_font_extents_t *extents);
+HB_EXTERN void
hb_font_get_glyph_advance_for_direction (hb_font_t *font,
hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y);
-void
+HB_EXTERN void
hb_font_get_glyph_origin_for_direction (hb_font_t *font,
hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y);
-void
+HB_EXTERN void
hb_font_add_glyph_origin_for_direction (hb_font_t *font,
hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y);
-void
+HB_EXTERN void
hb_font_subtract_glyph_origin_for_direction (hb_font_t *font,
hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y);
-void
+HB_EXTERN void
hb_font_get_glyph_kerning_for_direction (hb_font_t *font,
hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_font_get_glyph_extents_for_origin (hb_font_t *font,
hb_codepoint_t glyph,
hb_direction_t direction,
hb_glyph_extents_t *extents);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_font_get_glyph_contour_point_for_origin (hb_font_t *font,
hb_codepoint_t glyph, unsigned int point_index,
hb_direction_t direction,
hb_position_t *x, hb_position_t *y);
/* Generates gidDDD if glyph has no name. */
-void
+HB_EXTERN void
hb_font_glyph_to_string (hb_font_t *font,
hb_codepoint_t glyph,
char *s, unsigned int size);
/* Parses gidDDD and uniUUUU strings automatically. */
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_font_glyph_from_string (hb_font_t *font,
const char *s, int len, /* -1 means nul-terminated */
hb_codepoint_t *glyph);
@@ -426,22 +523,22 @@ hb_font_glyph_from_string (hb_font_t *font,
/* Fonts are very light-weight objects */
-hb_font_t *
+HB_EXTERN hb_font_t *
hb_font_create (hb_face_t *face);
-hb_font_t *
+HB_EXTERN hb_font_t *
hb_font_create_sub_font (hb_font_t *parent);
-hb_font_t *
+HB_EXTERN hb_font_t *
hb_font_get_empty (void);
-hb_font_t *
+HB_EXTERN hb_font_t *
hb_font_reference (hb_font_t *font);
-void
+HB_EXTERN void
hb_font_destroy (hb_font_t *font);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_font_set_user_data (hb_font_t *font,
hb_user_data_key_t *key,
void * data,
@@ -449,46 +546,46 @@ hb_font_set_user_data (hb_font_t *font,
hb_bool_t replace);
-void *
+HB_EXTERN void *
hb_font_get_user_data (hb_font_t *font,
hb_user_data_key_t *key);
-void
+HB_EXTERN void
hb_font_make_immutable (hb_font_t *font);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_font_is_immutable (hb_font_t *font);
-void
+HB_EXTERN void
hb_font_set_parent (hb_font_t *font,
hb_font_t *parent);
-hb_font_t *
+HB_EXTERN hb_font_t *
hb_font_get_parent (hb_font_t *font);
-hb_face_t *
+HB_EXTERN hb_face_t *
hb_font_get_face (hb_font_t *font);
-void
+HB_EXTERN void
hb_font_set_funcs (hb_font_t *font,
hb_font_funcs_t *klass,
void *font_data,
hb_destroy_func_t destroy);
/* Be *very* careful with this function! */
-void
+HB_EXTERN void
hb_font_set_funcs_data (hb_font_t *font,
void *font_data,
hb_destroy_func_t destroy);
-void
+HB_EXTERN void
hb_font_set_scale (hb_font_t *font,
int x_scale,
int y_scale);
-void
+HB_EXTERN void
hb_font_get_scale (hb_font_t *font,
int *x_scale,
int *y_scale);
@@ -496,17 +593,22 @@ hb_font_get_scale (hb_font_t *font,
/*
* A zero value means "no hinting in that direction"
*/
-void
+HB_EXTERN void
hb_font_set_ppem (hb_font_t *font,
unsigned int x_ppem,
unsigned int y_ppem);
-void
+HB_EXTERN void
hb_font_get_ppem (hb_font_t *font,
unsigned int *x_ppem,
unsigned int *y_ppem);
+HB_EXTERN void
+hb_font_set_var_coords_normalized (hb_font_t *font,
+ int *coords, /* XXX 2.14 normalized */
+ unsigned int coords_length);
+
HB_END_DECLS
#endif /* HB_FONT_H */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-open-file-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-open-file-private.hh
index 152230a0e5..5357ddcf5b 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-open-file-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-open-file-private.hh
@@ -140,7 +140,7 @@ struct TTCHeaderVersion1
protected:
Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */
- FixedVersion version; /* Version of the TTC Header (1.0),
+ FixedVersion<>version; /* Version of the TTC Header (1.0),
* 0x00010000u */
ArrayOf<OffsetTo<OffsetTable, ULONG>, ULONG>
table; /* Array of offsets to the OffsetTable for each font
@@ -187,7 +187,7 @@ struct TTCHeader
union {
struct {
Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */
- FixedVersion version; /* Version of the TTC Header (1.0 or 2.0),
+ FixedVersion<>version; /* Version of the TTC Header (1.0 or 2.0),
* 0x00010000u or 0x00020000u */
} header;
TTCHeaderVersion1 version1;
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-open-type-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-open-type-private.hh
index f053502ded..2cc1fb20d2 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-open-type-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-open-type-private.hh
@@ -101,13 +101,11 @@ static inline Type& StructAfter(TObject &X)
#define DEFINE_SIZE_STATIC(size) \
DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size)); \
static const unsigned int static_size = (size); \
- static const unsigned int min_size = (size)
-
-/* Size signifying variable-sized array */
-#define VAR 1
+ static const unsigned int min_size = (size); \
+ inline unsigned int get_size (void) const { return (size); }
#define DEFINE_SIZE_UNION(size, _member) \
- DEFINE_INSTANCE_ASSERTION (this->u._member.static_size == (size)); \
+ DEFINE_INSTANCE_ASSERTION (0*sizeof(this->u._member.static_size) + sizeof(this->u._member) == (size)); \
static const unsigned int min_size = (size)
#define DEFINE_SIZE_MIN(size) \
@@ -185,7 +183,7 @@ struct hb_dispatch_context_t
/* This limits sanitizing time on really broken fonts. */
#ifndef HB_SANITIZE_MAX_EDITS
-#define HB_SANITIZE_MAX_EDITS 100
+#define HB_SANITIZE_MAX_EDITS 32
#endif
struct hb_sanitize_context_t :
@@ -652,7 +650,9 @@ struct IntType
DEFINE_SIZE_STATIC (Size);
};
+typedef IntType<int8_t , 1> CHAR; /* 8-bit signed integer. */
typedef IntType<uint8_t , 1> BYTE; /* 8-bit unsigned integer. */
+typedef IntType<int8_t , 1> INT8; /* 8-bit signed integer. */
typedef IntType<uint16_t, 2> USHORT; /* 16-bit unsigned integer. */
typedef IntType<int16_t, 2> SHORT; /* 16-bit signed integer. */
typedef IntType<uint32_t, 4> ULONG; /* 32-bit unsigned integer. */
@@ -665,6 +665,24 @@ typedef SHORT FWORD;
/* 16-bit unsigned integer (USHORT) that describes a quantity in FUnits. */
typedef USHORT UFWORD;
+/* 16-bit signed fixed number with the low 14 bits of fraction (2.14). */
+struct F2DOT14 : SHORT
+{
+ //inline float to_float (void) const { return ???; }
+ //inline void set_float (float f) { v.set (f * ???); }
+ public:
+ DEFINE_SIZE_STATIC (2);
+};
+
+/* 32-bit signed fixed-point number (16.16). */
+struct Fixed: LONG
+{
+ //inline float to_float (void) const { return ???; }
+ //inline void set_float (float f) { v.set (f * ???); }
+ public:
+ DEFINE_SIZE_STATIC (4);
+};
+
/* Date represented in number of seconds since 12:00 midnight, January 1,
* 1904. The value is represented as a signed 64-bit integer. */
struct LONGDATETIME
@@ -742,9 +760,10 @@ struct CheckSum : ULONG
* Version Numbers
*/
+template <typename FixedType=USHORT>
struct FixedVersion
{
- inline uint32_t to_int (void) const { return (major << 16) + minor; }
+ inline uint32_t to_int (void) const { return (major << (sizeof(FixedType) * 8)) + minor; }
inline bool sanitize (hb_sanitize_context_t *c) const
{
@@ -752,10 +771,10 @@ struct FixedVersion
return_trace (c->check_struct (this));
}
- USHORT major;
- USHORT minor;
+ FixedType major;
+ FixedType minor;
public:
- DEFINE_SIZE_STATIC (4);
+ DEFINE_SIZE_STATIC (2 * sizeof(FixedType));
};
@@ -788,6 +807,7 @@ struct OffsetTo : Offset<OffsetType>
if (unlikely (!c->check_struct (this))) return_trace (false);
unsigned int offset = *this;
if (unlikely (!offset)) return_trace (true);
+ if (unlikely (!c->check_range (base, offset))) return_trace (false);
const Type &obj = StructAtOffset<Type> (base, offset);
return_trace (likely (obj.sanitize (c)) || neuter (c));
}
@@ -798,6 +818,7 @@ struct OffsetTo : Offset<OffsetType>
if (unlikely (!c->check_struct (this))) return_trace (false);
unsigned int offset = *this;
if (unlikely (!offset)) return_trace (true);
+ if (unlikely (!c->check_range (base, offset))) return_trace (false);
const Type &obj = StructAtOffset<Type> (base, offset);
return_trace (likely (obj.sanitize (c, user_data)) || neuter (c));
}
@@ -931,8 +952,8 @@ struct ArrayOf
};
/* Array of Offset's */
-template <typename Type>
-struct OffsetArrayOf : ArrayOf<OffsetTo<Type> > {};
+template <typename Type, typename OffsetType=USHORT>
+struct OffsetArrayOf : ArrayOf<OffsetTo<Type, OffsetType> > {};
/* Array of offsets relative to the beginning of the array itself. */
template <typename Type>
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-cbdt-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-cbdt-table.hh
new file mode 100644
index 0000000000..52897abd3a
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-cbdt-table.hh
@@ -0,0 +1,384 @@
+/*
+ * Copyright © 2016 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): Seigo Nonaka
+ */
+
+#ifndef HB_OT_CBDT_TABLE_HH
+#define HB_OT_CBDT_TABLE_HH
+
+#include "hb-open-type-private.hh"
+
+namespace OT {
+
+struct SmallGlyphMetrics
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ inline void get_extents (hb_glyph_extents_t *extents) const
+ {
+ extents->x_bearing = bearingX;
+ extents->y_bearing = bearingY;
+ extents->width = width;
+ extents->height = -height;
+ }
+
+ BYTE height;
+ BYTE width;
+ CHAR bearingX;
+ CHAR bearingY;
+ BYTE advance;
+
+ DEFINE_SIZE_STATIC(5);
+};
+
+struct BigGlyphMetrics : SmallGlyphMetrics
+{
+ CHAR vertBearingX;
+ CHAR vertBearingY;
+ BYTE vertAdvance;
+
+ DEFINE_SIZE_STATIC(8);
+};
+
+struct SBitLineMetrics
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ CHAR ascender;
+ CHAR decender;
+ BYTE widthMax;
+ CHAR caretSlopeNumerator;
+ CHAR caretSlopeDenominator;
+ CHAR caretOffset;
+ CHAR minOriginSB;
+ CHAR minAdvanceSB;
+ CHAR maxBeforeBL;
+ CHAR minAfterBL;
+ CHAR padding1;
+ CHAR padding2;
+
+ DEFINE_SIZE_STATIC(12);
+};
+
+
+/*
+ * Index Subtables.
+ */
+
+struct IndexSubtableHeader
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ USHORT indexFormat;
+ USHORT imageFormat;
+ ULONG imageDataOffset;
+
+ DEFINE_SIZE_STATIC(8);
+};
+
+template <typename OffsetType>
+struct IndexSubtableFormat1Or3
+{
+ inline bool sanitize (hb_sanitize_context_t *c, unsigned int glyph_count) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ c->check_array (offsetArrayZ, offsetArrayZ[0].static_size, glyph_count + 1));
+ }
+
+ bool get_image_data (unsigned int idx,
+ unsigned int *offset,
+ unsigned int *length) const
+ {
+ if (unlikely (offsetArrayZ[idx + 1] <= offsetArrayZ[idx]))
+ return false;
+
+ *offset = header.imageDataOffset + offsetArrayZ[idx];
+ *length = offsetArrayZ[idx + 1] - offsetArrayZ[idx];
+ return true;
+ }
+
+ IndexSubtableHeader header;
+ Offset<OffsetType> offsetArrayZ[VAR];
+
+ DEFINE_SIZE_ARRAY(8, offsetArrayZ);
+};
+
+struct IndexSubtableFormat1 : IndexSubtableFormat1Or3<ULONG> {};
+struct IndexSubtableFormat3 : IndexSubtableFormat1Or3<USHORT> {};
+
+struct IndexSubtable
+{
+ inline bool sanitize (hb_sanitize_context_t *c, unsigned int glyph_count) const
+ {
+ TRACE_SANITIZE (this);
+ if (!u.header.sanitize (c)) return_trace (false);
+ switch (u.header.indexFormat) {
+ case 1: return_trace (u.format1.sanitize (c, glyph_count));
+ case 3: return_trace (u.format3.sanitize (c, glyph_count));
+ default:return_trace (true);
+ }
+ }
+
+ inline bool get_extents (hb_glyph_extents_t *extents) const
+ {
+ switch (u.header.indexFormat) {
+ case 2: case 5: /* TODO */
+ case 1: case 3: case 4: /* Variable-metrics formats do not have metrics here. */
+ default:return (false);
+ }
+ }
+
+ bool get_image_data (unsigned int idx,
+ unsigned int *offset,
+ unsigned int *length,
+ unsigned int *format) const
+ {
+ *format = u.header.imageFormat;
+ switch (u.header.indexFormat) {
+ case 1: return u.format1.get_image_data (idx, offset, length);
+ case 3: return u.format3.get_image_data (idx, offset, length);
+ default: return false;
+ }
+ }
+
+ protected:
+ union {
+ IndexSubtableHeader header;
+ IndexSubtableFormat1 format1;
+ IndexSubtableFormat3 format3;
+ /* TODO: Format 2, 4, 5. */
+ } u;
+ public:
+ DEFINE_SIZE_UNION (8, header);
+};
+
+struct IndexSubtableRecord
+{
+ inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ firstGlyphIndex <= lastGlyphIndex &&
+ offsetToSubtable.sanitize (c, this, lastGlyphIndex - firstGlyphIndex + 1));
+ }
+
+ inline bool get_extents (hb_glyph_extents_t *extents) const
+ {
+ return (this+offsetToSubtable).get_extents (extents);
+ }
+
+ bool get_image_data (unsigned int gid,
+ unsigned int *offset,
+ unsigned int *length,
+ unsigned int *format) const
+ {
+ if (gid < firstGlyphIndex || gid > lastGlyphIndex)
+ {
+ return false;
+ }
+ return (this+offsetToSubtable).get_image_data (gid - firstGlyphIndex,
+ offset, length, format);
+ }
+
+ USHORT firstGlyphIndex;
+ USHORT lastGlyphIndex;
+ OffsetTo<IndexSubtable, ULONG> offsetToSubtable;
+
+ DEFINE_SIZE_STATIC(8);
+};
+
+struct IndexSubtableArray
+{
+ inline bool sanitize (hb_sanitize_context_t *c, unsigned int count) const
+ {
+ TRACE_SANITIZE (this);
+ if (unlikely (!c->check_array (&indexSubtablesZ, indexSubtablesZ[0].static_size, count)))
+ return_trace (false);
+ for (unsigned int i = 0; i < count; i++)
+ if (unlikely (!indexSubtablesZ[i].sanitize (c, this)))
+ return_trace (false);
+ return_trace (true);
+ }
+
+ public:
+ const IndexSubtableRecord* find_table (hb_codepoint_t glyph, unsigned int numTables) const
+ {
+ for (unsigned int i = 0; i < numTables; ++i)
+ {
+ unsigned int firstGlyphIndex = indexSubtablesZ[i].firstGlyphIndex;
+ unsigned int lastGlyphIndex = indexSubtablesZ[i].lastGlyphIndex;
+ if (firstGlyphIndex <= glyph && glyph <= lastGlyphIndex) {
+ return &indexSubtablesZ[i];
+ }
+ }
+ return NULL;
+ }
+
+ protected:
+ IndexSubtableRecord indexSubtablesZ[VAR];
+
+ public:
+ DEFINE_SIZE_ARRAY(0, indexSubtablesZ);
+};
+
+struct BitmapSizeTable
+{
+ friend struct CBLC;
+
+ inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ indexSubtableArrayOffset.sanitize (c, base, numberOfIndexSubtables) &&
+ c->check_range (&(base+indexSubtableArrayOffset), indexTablesSize) &&
+ horizontal.sanitize (c) &&
+ vertical.sanitize (c));
+ }
+
+ const IndexSubtableRecord *find_table (hb_codepoint_t glyph, const void *base) const
+ {
+ return (base+indexSubtableArrayOffset).find_table (glyph, numberOfIndexSubtables);
+ }
+
+ protected:
+ OffsetTo<IndexSubtableArray, ULONG> indexSubtableArrayOffset;
+ ULONG indexTablesSize;
+ ULONG numberOfIndexSubtables;
+ ULONG colorRef;
+ SBitLineMetrics horizontal;
+ SBitLineMetrics vertical;
+ USHORT startGlyphIndex;
+ USHORT endGlyphIndex;
+ BYTE ppemX;
+ BYTE ppemY;
+ BYTE bitDepth;
+ CHAR flags;
+
+public:
+ DEFINE_SIZE_STATIC(48);
+};
+
+
+/*
+ * Glyph Bitmap Data Formats.
+ */
+
+struct GlyphBitmapDataFormat17
+{
+ SmallGlyphMetrics glyphMetrics;
+ ULONG dataLen;
+ BYTE dataZ[VAR];
+
+ DEFINE_SIZE_ARRAY(9, dataZ);
+};
+
+
+/*
+ * CBLC -- Color Bitmap Location Table
+ */
+
+#define HB_OT_TAG_CBLC HB_TAG('C','B','L','C')
+
+struct CBLC
+{
+ static const hb_tag_t tableTag = HB_OT_TAG_CBLC;
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ likely (version.major == 2 || version.major == 3) &&
+ sizeTables.sanitize (c, this));
+ }
+
+ public:
+ const IndexSubtableRecord *find_table (hb_codepoint_t glyph,
+ unsigned int *x_ppem, unsigned int *y_ppem) const
+ {
+ /* TODO: Make it possible to select strike. */
+
+ unsigned int count = sizeTables.len;
+ for (uint32_t i = 0; i < count; ++i)
+ {
+ unsigned int startGlyphIndex = sizeTables.array[i].startGlyphIndex;
+ unsigned int endGlyphIndex = sizeTables.array[i].endGlyphIndex;
+ if (startGlyphIndex <= glyph && glyph <= endGlyphIndex)
+ {
+ *x_ppem = sizeTables[i].ppemX;
+ *y_ppem = sizeTables[i].ppemY;
+ return sizeTables[i].find_table (glyph, this);
+ }
+ }
+
+ return NULL;
+ }
+
+ protected:
+ FixedVersion<>version;
+ ArrayOf<BitmapSizeTable, ULONG> sizeTables;
+
+ public:
+ DEFINE_SIZE_ARRAY(8, sizeTables);
+};
+
+/*
+ * CBDT -- Color Bitmap Data Table
+ */
+#define HB_OT_TAG_CBDT HB_TAG('C','B','D','T')
+
+struct CBDT
+{
+ static const hb_tag_t tableTag = HB_OT_TAG_CBDT;
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ likely (version.major == 2 || version.major == 3));
+ }
+
+ protected:
+ FixedVersion<>version;
+ BYTE dataZ[VAR];
+
+ public:
+ DEFINE_SIZE_ARRAY(4, dataZ);
+};
+
+} /* namespace OT */
+
+#endif /* HB_OT_CBDT_TABLE_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-cmap-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-cmap-table.hh
index c9161f0ef4..d7a94a1ef0 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-cmap-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-cmap-table.hh
@@ -69,61 +69,78 @@ struct CmapSubtableFormat0
struct CmapSubtableFormat4
{
- inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
+ struct accelerator_t
{
- unsigned int segCount;
- const USHORT *endCount;
- const USHORT *startCount;
- const USHORT *idDelta;
- const USHORT *idRangeOffset;
- const USHORT *glyphIdArray;
- unsigned int glyphIdArrayLength;
+ inline void init (const CmapSubtableFormat4 *subtable)
+ {
+ segCount = subtable->segCountX2 / 2;
+ endCount = subtable->values;
+ startCount = endCount + segCount + 1;
+ idDelta = startCount + segCount;
+ idRangeOffset = idDelta + segCount;
+ glyphIdArray = idRangeOffset + segCount;
+ glyphIdArrayLength = (subtable->length - 16 - 8 * segCount) / 2;
+ }
- segCount = this->segCountX2 / 2;
- endCount = this->values;
- startCount = endCount + segCount + 1;
- idDelta = startCount + segCount;
- idRangeOffset = idDelta + segCount;
- glyphIdArray = idRangeOffset + segCount;
- glyphIdArrayLength = (this->length - 16 - 8 * segCount) / 2;
-
- /* Custom two-array bsearch. */
- int min = 0, max = (int) segCount - 1;
- unsigned int i;
- while (min <= max)
+ static inline bool get_glyph_func (const void *obj, hb_codepoint_t codepoint, hb_codepoint_t *glyph)
{
- int mid = (min + max) / 2;
- if (codepoint < startCount[mid])
- max = mid - 1;
- else if (codepoint > endCount[mid])
- min = mid + 1;
+ const accelerator_t *thiz = (const accelerator_t *) obj;
+
+ /* Custom two-array bsearch. */
+ int min = 0, max = (int) thiz->segCount - 1;
+ const USHORT *startCount = thiz->startCount;
+ const USHORT *endCount = thiz->endCount;
+ unsigned int i;
+ while (min <= max)
+ {
+ int mid = (min + max) / 2;
+ if (codepoint < startCount[mid])
+ max = mid - 1;
+ else if (codepoint > endCount[mid])
+ min = mid + 1;
+ else
+ {
+ i = mid;
+ goto found;
+ }
+ }
+ return false;
+
+ found:
+ hb_codepoint_t gid;
+ unsigned int rangeOffset = thiz->idRangeOffset[i];
+ if (rangeOffset == 0)
+ gid = codepoint + thiz->idDelta[i];
else
{
- i = mid;
- goto found;
+ /* Somebody has been smoking... */
+ unsigned int index = rangeOffset / 2 + (codepoint - thiz->startCount[i]) + i - thiz->segCount;
+ if (unlikely (index >= thiz->glyphIdArrayLength))
+ return false;
+ gid = thiz->glyphIdArray[index];
+ if (unlikely (!gid))
+ return false;
+ gid += thiz->idDelta[i];
}
- }
- return false;
-
- found:
- hb_codepoint_t gid;
- unsigned int rangeOffset = idRangeOffset[i];
- if (rangeOffset == 0)
- gid = codepoint + idDelta[i];
- else
- {
- /* Somebody has been smoking... */
- unsigned int index = rangeOffset / 2 + (codepoint - startCount[i]) + i - segCount;
- if (unlikely (index >= glyphIdArrayLength))
- return false;
- gid = glyphIdArray[index];
- if (unlikely (!gid))
- return false;
- gid += idDelta[i];
+
+ *glyph = gid & 0xFFFFu;
+ return true;
}
- *glyph = gid & 0xFFFFu;
- return true;
+ const USHORT *endCount;
+ const USHORT *startCount;
+ const USHORT *idDelta;
+ const USHORT *idRangeOffset;
+ const USHORT *glyphIdArray;
+ unsigned int segCount;
+ unsigned int glyphIdArrayLength;
+ };
+
+ inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
+ {
+ accelerator_t accel;
+ accel.init (this);
+ return accel.get_glyph_func (&accel, codepoint, glyph);
}
inline bool sanitize (hb_sanitize_context_t *c) const
@@ -388,7 +405,7 @@ struct CmapSubtableFormat14
}
protected:
- USHORT format; /* Format number is set to 0. */
+ USHORT format; /* Format number is set to 14. */
ULONG lengthZ; /* Byte length of this subtable. */
SortedArrayOf<VariationSelectorRecord, ULONG>
record; /* Variation selector records; sorted
@@ -416,16 +433,6 @@ struct CmapSubtable
}
}
- inline glyph_variant_t get_glyph_variant (hb_codepoint_t codepoint,
- hb_codepoint_t variation_selector,
- hb_codepoint_t *glyph) const
- {
- switch (u.format) {
- case 14: return u.format14.get_glyph_variant(codepoint, variation_selector, glyph);
- default: return GLYPH_VARIANT_NOT_FOUND;
- }
- }
-
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@@ -442,7 +449,7 @@ struct CmapSubtable
}
}
- protected:
+ public:
union {
USHORT format; /* Format identifier */
CmapSubtableFormat0 format0;
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-font.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-font.cc
index 69d2503abb..5be055d344 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-font.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-font.cc
@@ -31,10 +31,13 @@
#include "hb-font-private.hh"
#include "hb-ot-cmap-table.hh"
+#include "hb-ot-cbdt-table.hh"
#include "hb-ot-glyf-table.hh"
#include "hb-ot-head-table.hh"
#include "hb-ot-hhea-table.hh"
#include "hb-ot-hmtx-table.hh"
+#include "hb-ot-os2-table.hh"
+//#include "hb-ot-post-table.hh"
struct hb_ot_face_metrics_accelerator_t
@@ -42,24 +45,63 @@ struct hb_ot_face_metrics_accelerator_t
unsigned int num_metrics;
unsigned int num_advances;
unsigned int default_advance;
+ unsigned short ascender;
+ unsigned short descender;
+ unsigned short line_gap;
+ bool has_font_extents;
+
const OT::_mtx *table;
hb_blob_t *blob;
inline void init (hb_face_t *face,
- hb_tag_t _hea_tag, hb_tag_t _mtx_tag,
- unsigned int default_advance_)
+ hb_tag_t _hea_tag,
+ hb_tag_t _mtx_tag,
+ hb_tag_t os2_tag,
+ unsigned int default_advance = 0)
{
- this->default_advance = default_advance_;
- this->num_metrics = face->get_num_glyphs ();
+ this->default_advance = default_advance ? default_advance : face->get_upem ();
+
+ bool got_font_extents = false;
+ if (os2_tag)
+ {
+ hb_blob_t *os2_blob = OT::Sanitizer<OT::os2>::sanitize (face->reference_table (os2_tag));
+ const OT::os2 *os2 = OT::Sanitizer<OT::os2>::lock_instance (os2_blob);
+#define USE_TYPO_METRICS (1u<<7)
+ if (0 != (os2->fsSelection & USE_TYPO_METRICS))
+ {
+ this->ascender = os2->sTypoAscender;
+ this->descender = os2->sTypoDescender;
+ this->line_gap = os2->sTypoLineGap;
+ got_font_extents = (this->ascender | this->descender) != 0;
+ }
+ hb_blob_destroy (os2_blob);
+ }
hb_blob_t *_hea_blob = OT::Sanitizer<OT::_hea>::sanitize (face->reference_table (_hea_tag));
const OT::_hea *_hea = OT::Sanitizer<OT::_hea>::lock_instance (_hea_blob);
this->num_advances = _hea->numberOfLongMetrics;
+ if (!got_font_extents)
+ {
+ this->ascender = _hea->ascender;
+ this->descender = _hea->descender;
+ this->line_gap = _hea->lineGap;
+ got_font_extents = (this->ascender | this->descender) != 0;
+ }
hb_blob_destroy (_hea_blob);
+ this->has_font_extents = got_font_extents;
+
this->blob = OT::Sanitizer<OT::_mtx>::sanitize (face->reference_table (_mtx_tag));
- if (unlikely (!this->num_advances ||
- 2 * (this->num_advances + this->num_metrics) > hb_blob_get_length (this->blob)))
+
+ /* Cap num_metrics() and num_advances() based on table length. */
+ unsigned int len = hb_blob_get_length (this->blob);
+ if (unlikely (this->num_advances * 4 > len))
+ this->num_advances = len / 4;
+ this->num_metrics = this->num_advances + (len - 4 * this->num_advances) / 2;
+
+ /* We MUST set num_metrics to zero if num_advances is zero.
+ * Our get_advance() depends on that. */
+ if (unlikely (!this->num_advances))
{
this->num_metrics = this->num_advances = 0;
hb_blob_destroy (this->blob);
@@ -166,10 +208,133 @@ struct hb_ot_face_glyf_accelerator_t
}
};
+struct hb_ot_face_cbdt_accelerator_t
+{
+ hb_blob_t *cblc_blob;
+ hb_blob_t *cbdt_blob;
+ const OT::CBLC *cblc;
+ const OT::CBDT *cbdt;
+
+ unsigned int cbdt_len;
+ float upem;
+
+ inline void init (hb_face_t *face)
+ {
+ upem = face->get_upem();
+
+ cblc_blob = OT::Sanitizer<OT::CBLC>::sanitize (face->reference_table (HB_OT_TAG_CBLC));
+ cbdt_blob = OT::Sanitizer<OT::CBDT>::sanitize (face->reference_table (HB_OT_TAG_CBDT));
+ cbdt_len = hb_blob_get_length (cbdt_blob);
+
+ if (hb_blob_get_length (cblc_blob) == 0) {
+ cblc = NULL;
+ cbdt = NULL;
+ return; /* Not a bitmap font. */
+ }
+ cblc = OT::Sanitizer<OT::CBLC>::lock_instance (cblc_blob);
+ cbdt = OT::Sanitizer<OT::CBDT>::lock_instance (cbdt_blob);
+
+ }
+
+ inline void fini (void)
+ {
+ hb_blob_destroy (this->cblc_blob);
+ hb_blob_destroy (this->cbdt_blob);
+ }
+
+ inline bool get_extents (hb_codepoint_t glyph, hb_glyph_extents_t *extents) const
+ {
+ unsigned int x_ppem = upem, y_ppem = upem; /* TODO Use font ppem if available. */
+
+ if (cblc == NULL)
+ return false; // Not a color bitmap font.
+
+ const OT::IndexSubtableRecord *subtable_record = this->cblc->find_table(glyph, &x_ppem, &y_ppem);
+ if (subtable_record == NULL)
+ return false;
+
+ if (subtable_record->get_extents (extents))
+ return true;
+
+ unsigned int image_offset = 0, image_length = 0, image_format = 0;
+ if (!subtable_record->get_image_data (glyph, &image_offset, &image_length, &image_format))
+ return false;
+
+ {
+ /* TODO Move the following into CBDT struct when adding more formats. */
+
+ if (unlikely (image_offset > cbdt_len || cbdt_len - image_offset < image_length))
+ return false;
+
+ switch (image_format)
+ {
+ case 17: {
+ if (unlikely (image_length < OT::GlyphBitmapDataFormat17::min_size))
+ return false;
+
+ const OT::GlyphBitmapDataFormat17& glyphFormat17 =
+ OT::StructAtOffset<OT::GlyphBitmapDataFormat17> (this->cbdt, image_offset);
+ glyphFormat17.glyphMetrics.get_extents (extents);
+ }
+ break;
+ default:
+ // TODO: Support other image formats.
+ return false;
+ }
+ }
+
+ /* Convert to the font units. */
+ extents->x_bearing *= upem / (float) x_ppem;
+ extents->y_bearing *= upem / (float) y_ppem;
+ extents->width *= upem / (float) x_ppem;
+ extents->height *= upem / (float) y_ppem;
+
+ return true;
+ }
+};
+
+typedef bool (*hb_cmap_get_glyph_func_t) (const void *obj,
+ hb_codepoint_t codepoint,
+ hb_codepoint_t *glyph);
+
+template <typename Type>
+static inline bool get_glyph_from (const void *obj,
+ hb_codepoint_t codepoint,
+ hb_codepoint_t *glyph)
+{
+ const Type *typed_obj = (const Type *) obj;
+ return typed_obj->get_glyph (codepoint, glyph);
+}
+
+template <typename Type>
+static inline bool get_glyph_from_symbol (const void *obj,
+ hb_codepoint_t codepoint,
+ hb_codepoint_t *glyph)
+{
+ const Type *typed_obj = (const Type *) obj;
+ if (likely (typed_obj->get_glyph (codepoint, glyph)))
+ return true;
+
+ if (codepoint <= 0x00FFu)
+ {
+ /* For symbol-encoded OpenType fonts, we duplicate the
+ * U+F000..F0FF range at U+0000..U+00FF. That's what
+ * Windows seems to do, and that's hinted about at:
+ * http://www.microsoft.com/typography/otspec/recom.htm
+ * under "Non-Standard (Symbol) Fonts". */
+ return typed_obj->get_glyph (0xF000u + codepoint, glyph);
+ }
+
+ return false;
+}
+
struct hb_ot_face_cmap_accelerator_t
{
- const OT::CmapSubtable *table;
- const OT::CmapSubtable *uvs_table;
+ hb_cmap_get_glyph_func_t get_glyph_func;
+ const void *get_glyph_data;
+ OT::CmapSubtableFormat4::accelerator_t format4_accel;
+
+ const OT::CmapSubtableFormat14 *uvs_table;
hb_blob_t *blob;
inline void init (hb_face_t *face)
@@ -177,8 +342,9 @@ struct hb_ot_face_cmap_accelerator_t
this->blob = OT::Sanitizer<OT::cmap>::sanitize (face->reference_table (HB_OT_TAG_cmap));
const OT::cmap *cmap = OT::Sanitizer<OT::cmap>::lock_instance (this->blob);
const OT::CmapSubtable *subtable = NULL;
- const OT::CmapSubtable *subtable_uvs = NULL;
+ const OT::CmapSubtableFormat14 *subtable_uvs = NULL;
+ bool symbol = false;
/* 32-bit subtables. */
if (!subtable) subtable = cmap->find_subtable (3, 10);
if (!subtable) subtable = cmap->find_subtable (0, 6);
@@ -189,17 +355,42 @@ struct hb_ot_face_cmap_accelerator_t
if (!subtable) subtable = cmap->find_subtable (0, 2);
if (!subtable) subtable = cmap->find_subtable (0, 1);
if (!subtable) subtable = cmap->find_subtable (0, 0);
- if (!subtable) subtable = cmap->find_subtable (3, 0);
+ if (!subtable)
+ {
+ subtable = cmap->find_subtable (3, 0);
+ if (subtable) symbol = true;
+ }
/* Meh. */
if (!subtable) subtable = &OT::Null(OT::CmapSubtable);
/* UVS subtable. */
- if (!subtable_uvs) subtable_uvs = cmap->find_subtable (0, 5);
+ if (!subtable_uvs)
+ {
+ const OT::CmapSubtable *st = cmap->find_subtable (0, 5);
+ if (st && st->u.format == 14)
+ subtable_uvs = &st->u.format14;
+ }
/* Meh. */
- if (!subtable_uvs) subtable_uvs = &OT::Null(OT::CmapSubtable);
+ if (!subtable_uvs) subtable_uvs = &OT::Null(OT::CmapSubtableFormat14);
- this->table = subtable;
this->uvs_table = subtable_uvs;
+
+ this->get_glyph_data = subtable;
+ if (unlikely (symbol))
+ this->get_glyph_func = get_glyph_from_symbol<OT::CmapSubtable>;
+ else
+ switch (subtable->u.format) {
+ /* Accelerate format 4 and format 12. */
+ default: this->get_glyph_func = get_glyph_from<OT::CmapSubtable>; break;
+ case 12: this->get_glyph_func = get_glyph_from<OT::CmapSubtableFormat12>; break;
+ case 4:
+ {
+ this->format4_accel.init (&subtable->u.format4);
+ this->get_glyph_data = &this->format4_accel;
+ this->get_glyph_func = this->format4_accel.get_glyph_func;
+ }
+ break;
+ }
}
inline void fini (void)
@@ -207,33 +398,78 @@ struct hb_ot_face_cmap_accelerator_t
hb_blob_destroy (this->blob);
}
- inline bool get_glyph (hb_codepoint_t unicode,
- hb_codepoint_t variation_selector,
- hb_codepoint_t *glyph) const
+ inline bool get_nominal_glyph (hb_codepoint_t unicode,
+ hb_codepoint_t *glyph) const
{
- if (unlikely (variation_selector))
+ return this->get_glyph_func (this->get_glyph_data, unicode, glyph);
+ }
+
+ inline bool get_variation_glyph (hb_codepoint_t unicode,
+ hb_codepoint_t variation_selector,
+ hb_codepoint_t *glyph) const
+ {
+ switch (this->uvs_table->get_glyph_variant (unicode,
+ variation_selector,
+ glyph))
{
- switch (this->uvs_table->get_glyph_variant (unicode,
- variation_selector,
- glyph))
- {
- case OT::GLYPH_VARIANT_NOT_FOUND: return false;
- case OT::GLYPH_VARIANT_FOUND: return true;
- case OT::GLYPH_VARIANT_USE_DEFAULT: break;
- }
+ case OT::GLYPH_VARIANT_NOT_FOUND: return false;
+ case OT::GLYPH_VARIANT_FOUND: return true;
+ case OT::GLYPH_VARIANT_USE_DEFAULT: break;
}
- return this->table->get_glyph (unicode, glyph);
+ return get_nominal_glyph (unicode, glyph);
}
};
+template <typename T>
+struct hb_lazy_loader_t
+{
+ inline void init (hb_face_t *face_)
+ {
+ face = face_;
+ instance = NULL;
+ }
+
+ inline void fini (void)
+ {
+ if (instance && instance != &OT::Null(T))
+ {
+ instance->fini();
+ free (instance);
+ }
+ }
+
+ inline const T* operator-> (void) const
+ {
+ retry:
+ T *p = (T *) hb_atomic_ptr_get (&instance);
+ if (unlikely (!p))
+ {
+ p = (T *) calloc (1, sizeof (T));
+ if (unlikely (!p))
+ return &OT::Null(T);
+ p->init (face);
+ if (unlikely (!hb_atomic_ptr_cmpexch (const_cast<T **>(&instance), NULL, p)))
+ {
+ p->fini ();
+ goto retry;
+ }
+ }
+ return p;
+ }
+
+ private:
+ hb_face_t *face;
+ T *instance;
+};
struct hb_ot_font_t
{
hb_ot_face_cmap_accelerator_t cmap;
hb_ot_face_metrics_accelerator_t h_metrics;
hb_ot_face_metrics_accelerator_t v_metrics;
- hb_ot_face_glyf_accelerator_t glyf;
+ hb_lazy_loader_t<hb_ot_face_glyf_accelerator_t> glyf;
+ hb_lazy_loader_t<hb_ot_face_cbdt_accelerator_t> cbdt;
};
@@ -245,12 +481,12 @@ _hb_ot_font_create (hb_face_t *face)
if (unlikely (!ot_font))
return NULL;
- unsigned int upem = face->get_upem ();
-
ot_font->cmap.init (face);
- ot_font->h_metrics.init (face, HB_OT_TAG_hhea, HB_OT_TAG_hmtx, upem>>1);
- ot_font->v_metrics.init (face, HB_OT_TAG_vhea, HB_OT_TAG_vmtx, upem); /* TODO Can we do this lazily? */
+ ot_font->h_metrics.init (face, HB_OT_TAG_hhea, HB_OT_TAG_hmtx, HB_OT_TAG_os2);
+ ot_font->v_metrics.init (face, HB_OT_TAG_vhea, HB_OT_TAG_vmtx, HB_TAG_NONE,
+ ot_font->h_metrics.ascender - ot_font->h_metrics.descender); /* TODO Can we do this lazily? */
ot_font->glyf.init (face);
+ ot_font->cbdt.init (face);
return ot_font;
}
@@ -262,88 +498,54 @@ _hb_ot_font_destroy (hb_ot_font_t *ot_font)
ot_font->h_metrics.fini ();
ot_font->v_metrics.fini ();
ot_font->glyf.fini ();
+ ot_font->cbdt.fini ();
free (ot_font);
}
static hb_bool_t
-hb_ot_get_glyph (hb_font_t *font HB_UNUSED,
- void *font_data,
- hb_codepoint_t unicode,
- hb_codepoint_t variation_selector,
- hb_codepoint_t *glyph,
- void *user_data HB_UNUSED)
+hb_ot_get_nominal_glyph (hb_font_t *font HB_UNUSED,
+ void *font_data,
+ hb_codepoint_t unicode,
+ hb_codepoint_t *glyph,
+ void *user_data HB_UNUSED)
{
const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
- return ot_font->cmap.get_glyph (unicode, variation_selector, glyph);
+ return ot_font->cmap.get_nominal_glyph (unicode, glyph);
}
-static hb_position_t
-hb_ot_get_glyph_h_advance (hb_font_t *font HB_UNUSED,
+static hb_bool_t
+hb_ot_get_variation_glyph (hb_font_t *font HB_UNUSED,
void *font_data,
- hb_codepoint_t glyph,
+ hb_codepoint_t unicode,
+ hb_codepoint_t variation_selector,
+ hb_codepoint_t *glyph,
void *user_data HB_UNUSED)
{
const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
- return font->em_scale_x (ot_font->h_metrics.get_advance (glyph));
+ return ot_font->cmap.get_variation_glyph (unicode, variation_selector, glyph);
}
static hb_position_t
-hb_ot_get_glyph_v_advance (hb_font_t *font HB_UNUSED,
+hb_ot_get_glyph_h_advance (hb_font_t *font HB_UNUSED,
void *font_data,
hb_codepoint_t glyph,
void *user_data HB_UNUSED)
{
const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
- return font->em_scale_y (-(int) ot_font->v_metrics.get_advance (glyph));
-}
-
-static hb_bool_t
-hb_ot_get_glyph_h_origin (hb_font_t *font HB_UNUSED,
- void *font_data HB_UNUSED,
- hb_codepoint_t glyph HB_UNUSED,
- hb_position_t *x HB_UNUSED,
- hb_position_t *y HB_UNUSED,
- void *user_data HB_UNUSED)
-{
- /* We always work in the horizontal coordinates. */
- return true;
-}
-
-static hb_bool_t
-hb_ot_get_glyph_v_origin (hb_font_t *font HB_UNUSED,
- void *font_data,
- hb_codepoint_t glyph,
- hb_position_t *x,
- hb_position_t *y,
- void *user_data HB_UNUSED)
-{
- /* TODO */
- return false;
+ return font->em_scale_x (ot_font->h_metrics.get_advance (glyph));
}
static hb_position_t
-hb_ot_get_glyph_h_kerning (hb_font_t *font,
+hb_ot_get_glyph_v_advance (hb_font_t *font HB_UNUSED,
void *font_data,
- hb_codepoint_t left_glyph,
- hb_codepoint_t right_glyph,
- void *user_data HB_UNUSED)
-{
- /* TODO */
- return 0;
-}
-
-static hb_position_t
-hb_ot_get_glyph_v_kerning (hb_font_t *font HB_UNUSED,
- void *font_data HB_UNUSED,
- hb_codepoint_t top_glyph HB_UNUSED,
- hb_codepoint_t bottom_glyph HB_UNUSED,
+ hb_codepoint_t glyph,
void *user_data HB_UNUSED)
{
- /* OpenType doesn't have vertical-kerning other than GPOS. */
- return 0;
+ const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
+ return font->em_scale_y (-(int) ot_font->v_metrics.get_advance (glyph));
}
static hb_bool_t
@@ -354,7 +556,9 @@ hb_ot_get_glyph_extents (hb_font_t *font HB_UNUSED,
void *user_data HB_UNUSED)
{
const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
- bool ret = ot_font->glyf.get_extents (glyph, extents);
+ bool ret = ot_font->glyf->get_extents (glyph, extents);
+ if (!ret)
+ ret = ot_font->cbdt->get_extents (glyph, extents);
extents->x_bearing = font->em_scale_x (extents->x_bearing);
extents->y_bearing = font->em_scale_y (extents->y_bearing);
extents->width = font->em_scale_x (extents->width);
@@ -363,61 +567,85 @@ hb_ot_get_glyph_extents (hb_font_t *font HB_UNUSED,
}
static hb_bool_t
-hb_ot_get_glyph_contour_point (hb_font_t *font HB_UNUSED,
- void *font_data,
- hb_codepoint_t glyph,
- unsigned int point_index,
- hb_position_t *x,
- hb_position_t *y,
- void *user_data HB_UNUSED)
+hb_ot_get_font_h_extents (hb_font_t *font HB_UNUSED,
+ void *font_data,
+ hb_font_extents_t *metrics,
+ void *user_data HB_UNUSED)
{
- /* TODO */
- return false;
+ const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
+ metrics->ascender = font->em_scale_y (ot_font->h_metrics.ascender);
+ metrics->descender = font->em_scale_y (ot_font->h_metrics.descender);
+ metrics->line_gap = font->em_scale_y (ot_font->h_metrics.line_gap);
+ return ot_font->h_metrics.has_font_extents;
}
static hb_bool_t
-hb_ot_get_glyph_name (hb_font_t *font HB_UNUSED,
- void *font_data,
- hb_codepoint_t glyph,
- char *name, unsigned int size,
- void *user_data HB_UNUSED)
+hb_ot_get_font_v_extents (hb_font_t *font HB_UNUSED,
+ void *font_data,
+ hb_font_extents_t *metrics,
+ void *user_data HB_UNUSED)
{
- /* TODO */
- return false;
+ const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
+ metrics->ascender = font->em_scale_x (ot_font->v_metrics.ascender);
+ metrics->descender = font->em_scale_x (ot_font->v_metrics.descender);
+ metrics->line_gap = font->em_scale_x (ot_font->v_metrics.line_gap);
+ return ot_font->v_metrics.has_font_extents;
}
-static hb_bool_t
-hb_ot_get_glyph_from_name (hb_font_t *font HB_UNUSED,
- void *font_data,
- const char *name, int len, /* -1 means nul-terminated */
- hb_codepoint_t *glyph,
- void *user_data HB_UNUSED)
+static hb_font_funcs_t *static_ot_funcs = NULL;
+
+#ifdef HB_USE_ATEXIT
+static
+void free_static_ot_funcs (void)
{
- /* TODO */
- return false;
+ hb_font_funcs_destroy (static_ot_funcs);
}
-
+#endif
static hb_font_funcs_t *
_hb_ot_get_font_funcs (void)
{
- static const hb_font_funcs_t ot_ffuncs = {
- HB_OBJECT_HEADER_STATIC,
-
- true, /* immutable */
+retry:
+ hb_font_funcs_t *funcs = (hb_font_funcs_t *) hb_atomic_ptr_get (&static_ot_funcs);
- {
-#define HB_FONT_FUNC_IMPLEMENT(name) hb_ot_get_##name,
- HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
-#undef HB_FONT_FUNC_IMPLEMENT
+ if (unlikely (!funcs))
+ {
+ funcs = hb_font_funcs_create ();
+
+ hb_font_funcs_set_font_h_extents_func (funcs, hb_ot_get_font_h_extents, NULL, NULL);
+ hb_font_funcs_set_font_v_extents_func (funcs, hb_ot_get_font_v_extents, NULL, NULL);
+ hb_font_funcs_set_nominal_glyph_func (funcs, hb_ot_get_nominal_glyph, NULL, NULL);
+ hb_font_funcs_set_variation_glyph_func (funcs, hb_ot_get_variation_glyph, NULL, NULL);
+ hb_font_funcs_set_glyph_h_advance_func (funcs, hb_ot_get_glyph_h_advance, NULL, NULL);
+ hb_font_funcs_set_glyph_v_advance_func (funcs, hb_ot_get_glyph_v_advance, NULL, NULL);
+ //hb_font_funcs_set_glyph_h_origin_func (funcs, hb_ot_get_glyph_h_origin, NULL, NULL);
+ //hb_font_funcs_set_glyph_v_origin_func (funcs, hb_ot_get_glyph_v_origin, NULL, NULL);
+ //hb_font_funcs_set_glyph_h_kerning_func (funcs, hb_ot_get_glyph_h_kerning, NULL, NULL); TODO
+ //hb_font_funcs_set_glyph_v_kerning_func (funcs, hb_ot_get_glyph_v_kerning, NULL, NULL);
+ hb_font_funcs_set_glyph_extents_func (funcs, hb_ot_get_glyph_extents, NULL, NULL);
+ //hb_font_funcs_set_glyph_contour_point_func (funcs, hb_ot_get_glyph_contour_point, NULL, NULL); TODO
+ //hb_font_funcs_set_glyph_name_func (funcs, hb_ot_get_glyph_name, NULL, NULL); TODO
+ //hb_font_funcs_set_glyph_from_name_func (funcs, hb_ot_get_glyph_from_name, NULL, NULL); TODO
+
+ hb_font_funcs_make_immutable (funcs);
+
+ if (!hb_atomic_ptr_cmpexch (&static_ot_funcs, NULL, funcs)) {
+ hb_font_funcs_destroy (funcs);
+ goto retry;
}
+
+#ifdef HB_USE_ATEXIT
+ atexit (free_static_ot_funcs); /* First person registers atexit() callback. */
+#endif
};
- return const_cast<hb_font_funcs_t *> (&ot_ffuncs);
+ return funcs;
}
/**
+ * hb_ot_font_set_funcs:
+ *
* Since: 0.9.28
**/
void
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-font.h b/src/3rdparty/harfbuzz-ng/src/hb-ot-font.h
index b9947a16bc..80eaa54b1a 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-font.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-font.h
@@ -36,7 +36,7 @@
HB_BEGIN_DECLS
-void
+HB_EXTERN void
hb_ot_font_set_funcs (hb_font_t *font);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-glyf-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-glyf-table.hh
index 9e5af6d10d..dc7aa8469a 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-glyf-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-glyf-table.hh
@@ -90,10 +90,10 @@ struct glyfGlyphHeader
* greater than or equal to zero,
* this is a simple glyph; if negative,
* this is a composite glyph. */
- SHORT xMin; /* Minimum x for coordinate data. */
- SHORT yMin; /* Minimum y for coordinate data. */
- SHORT xMax; /* Maximum x for coordinate data. */
- SHORT yMax; /* Maximum y for coordinate data. */
+ FWORD xMin; /* Minimum x for coordinate data. */
+ FWORD yMin; /* Minimum y for coordinate data. */
+ FWORD xMax; /* Maximum x for coordinate data. */
+ FWORD yMax; /* Maximum y for coordinate data. */
DEFINE_SIZE_STATIC (10);
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-head-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-head-table.hh
index fc351cfb48..9c3e51eb08 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-head-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-head-table.hh
@@ -55,13 +55,15 @@ struct head
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
- return_trace (c->check_struct (this) && likely (version.major == 1));
+ return_trace (c->check_struct (this) &&
+ version.major == 1 &&
+ magicNumber == 0x5F0F3CF5u);
}
protected:
- FixedVersion version; /* Version of the head table--currently
+ FixedVersion<>version; /* Version of the head table--currently
* 0x00010000u for version 1.0. */
- FixedVersion fontRevision; /* Set by font manufacturer. */
+ FixedVersion<>fontRevision; /* Set by font manufacturer. */
ULONG checkSumAdjustment; /* To compute: set it to 0, sum the
* entire font as ULONG, then store
* 0xB1B0AFBAu - sum. */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-hhea-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-hhea-table.hh
index 24114534a7..c8e9536cf1 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-hhea-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-hhea-table.hh
@@ -56,7 +56,7 @@ struct _hea
}
public:
- FixedVersion version; /* 0x00010000u for version 1.0. */
+ FixedVersion<>version; /* 0x00010000u for version 1.0. */
FWORD ascender; /* Typographic ascent. */
FWORD descender; /* Typographic descent. */
FWORD lineGap; /* Typographic line gap. */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-hmtx-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-hmtx-table.hh
index 49056e6769..a9606b3d27 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-hmtx-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-hmtx-table.hh
@@ -44,8 +44,8 @@ namespace OT {
struct LongMetric
{
- USHORT advance; /* Advance width/height. */
- SHORT lsb; /* Leading (left/top) side bearing. */
+ UFWORD advance; /* Advance width/height. */
+ FWORD lsb; /* Leading (left/top) side bearing. */
public:
DEFINE_SIZE_STATIC (4);
};
@@ -74,7 +74,7 @@ struct _mtx
* be in the array, but that entry is
* required. The last entry applies to
* all subsequent glyphs. */
- SHORT leadingBearingX[VAR]; /* Here the advance is assumed
+ FWORD leadingBearingX[VAR]; /* Here the advance is assumed
* to be the same as the advance
* for the last entry above. The
* number of entries in this array is
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-common-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-common-private.hh
index ea61f5c1bd..62ca7a348e 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-common-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-common-private.hh
@@ -34,6 +34,14 @@
#include "hb-set-private.hh"
+#ifndef HB_MAX_NESTING_LEVEL
+#define HB_MAX_NESTING_LEVEL 6
+#endif
+#ifndef HB_MAX_CONTEXT_LENGTH
+#define HB_MAX_CONTEXT_LENGTH 64
+#endif
+
+
namespace OT {
@@ -44,8 +52,6 @@ namespace OT {
#define NOT_COVERED ((unsigned int) -1)
-#define MAX_NESTING_LEVEL 6
-#define MAX_CONTEXT_LENGTH 64
@@ -501,7 +507,7 @@ struct Feature
{ return this+featureParams; }
inline bool sanitize (hb_sanitize_context_t *c,
- const Record<Feature>::sanitize_closure_t *closure) const
+ const Record<Feature>::sanitize_closure_t *closure = NULL) const
{
TRACE_SANITIZE (this);
if (unlikely (!(c->check_struct (this) && lookupIndex.sanitize (c))))
@@ -539,6 +545,9 @@ struct Feature
c->try_set (&featureParams, new_offset) &&
!featureParams.sanitize (c, this, closure ? closure->tag : HB_TAG_NONE))
return_trace (false);
+
+ if (c->edit_count > 1)
+ c->edit_count--; /* This was a "legitimate" edit; don't contribute to error count. */
}
return_trace (true);
@@ -573,6 +582,11 @@ struct LookupFlag : USHORT
DEFINE_SIZE_STATIC (2);
};
+} /* namespace OT */
+/* This has to be outside the namespace. */
+HB_MARK_AS_FLAG_T (OT::LookupFlag::Flags);
+namespace OT {
+
struct Lookup
{
inline unsigned int get_subtable_count (void) const { return subTable.len; }
@@ -717,8 +731,8 @@ struct CoverageFormat1
inline void init (const struct CoverageFormat1 &c_) { c = &c_; i = 0; };
inline bool more (void) { return i < c->glyphArray.len; }
inline void next (void) { i++; }
- inline uint16_t get_glyph (void) { return c->glyphArray[i]; }
- inline uint16_t get_coverage (void) { return i; }
+ inline hb_codepoint_t get_glyph (void) { return c->glyphArray[i]; }
+ inline unsigned int get_coverage (void) { return i; }
private:
const struct CoverageFormat1 *c;
@@ -756,7 +770,11 @@ struct CoverageFormat2
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
- if (unlikely (!num_glyphs)) return_trace (true);
+ if (unlikely (!num_glyphs))
+ {
+ rangeRecord.len.set (0);
+ return_trace (true);
+ }
unsigned int num_ranges = 1;
for (unsigned int i = 1; i < num_glyphs; i++)
@@ -811,26 +829,33 @@ struct CoverageFormat2
public:
/* Older compilers need this to be public. */
- struct Iter {
- inline void init (const CoverageFormat2 &c_) {
+ struct Iter
+ {
+ inline void init (const CoverageFormat2 &c_)
+ {
c = &c_;
coverage = 0;
i = 0;
j = c->rangeRecord.len ? c_.rangeRecord[0].start : 0;
}
inline bool more (void) { return i < c->rangeRecord.len; }
- inline void next (void) {
- coverage++;
- if (j == c->rangeRecord[i].end) {
+ inline void next (void)
+ {
+ if (j >= c->rangeRecord[i].end)
+ {
i++;
if (more ())
+ {
j = c->rangeRecord[i].start;
+ coverage = c->rangeRecord[i].value;
+ }
return;
}
+ coverage++;
j++;
}
- inline uint16_t get_glyph (void) { return j; }
- inline uint16_t get_coverage (void) { return coverage; }
+ inline hb_codepoint_t get_glyph (void) { return j; }
+ inline unsigned int get_coverage (void) { return coverage; }
private:
const struct CoverageFormat2 *c;
@@ -939,14 +964,14 @@ struct Coverage
default: break;
}
}
- inline uint16_t get_glyph (void) {
+ inline hb_codepoint_t get_glyph (void) {
switch (format) {
case 1: return u.format1.get_glyph ();
case 2: return u.format2.get_glyph ();
default:return 0;
}
}
- inline uint16_t get_coverage (void) {
+ inline unsigned int get_coverage (void) {
switch (format) {
case 1: return u.format1.get_coverage ();
case 2: return u.format2.get_coverage ();
@@ -1144,11 +1169,380 @@ struct ClassDef
/*
+ * Item Variation Store
+ */
+
+struct VarRegionAxis
+{
+ inline float evaluate (int coord) const
+ {
+ int start = startCoord, peak = peakCoord, end = endCoord;
+
+ /* TODO Move these to sanitize(). */
+ if (unlikely (start > peak || peak > end))
+ return 1.;
+ if (unlikely (start < 0 && end > 0 && peak != 0))
+ return 1.;
+
+ if (peak == 0 || coord == peak)
+ return 1.;
+
+ if (coord <= start || end <= coord)
+ return 0.;
+
+ /* Interpolate */
+ if (coord < peak)
+ return float (coord - start) / (peak - start);
+ else
+ return float (end - coord) / (end - peak);
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ /* TODO Handle invalid start/peak/end configs, so we don't
+ * have to do that at runtime. */
+ }
+
+ public:
+ F2DOT14 startCoord;
+ F2DOT14 peakCoord;
+ F2DOT14 endCoord;
+ public:
+ DEFINE_SIZE_STATIC (6);
+};
+
+struct VarRegionList
+{
+ inline float evaluate (unsigned int region_index,
+ int *coords, unsigned int coord_len) const
+ {
+ if (unlikely (region_index >= regionCount))
+ return 0.;
+
+ const VarRegionAxis *axes = axesZ + (region_index * axisCount);
+
+ float v = 1.;
+ unsigned int count = MIN (coord_len, (unsigned int) axisCount);
+ for (unsigned int i = 0; i < count; i++)
+ {
+ float factor = axes[i].evaluate (coords[i]);
+ if (factor == 0.)
+ return 0.;
+ v *= factor;
+ }
+ return v;
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ c->check_array (axesZ, axesZ[0].static_size,
+ (unsigned int) axisCount * (unsigned int) regionCount));
+ }
+
+ protected:
+ USHORT axisCount;
+ USHORT regionCount;
+ VarRegionAxis axesZ[VAR];
+ public:
+ DEFINE_SIZE_ARRAY (4, axesZ);
+};
+
+struct VarData
+{
+ inline unsigned int get_row_size (void) const
+ { return shortCount + regionIndices.len; }
+
+ inline unsigned int get_size (void) const
+ { return itemCount * get_row_size (); }
+
+ inline float get_delta (unsigned int inner,
+ int *coords, unsigned int coord_count,
+ const VarRegionList &regions) const
+ {
+ if (unlikely (inner >= itemCount))
+ return 0.;
+
+ unsigned int count = regionIndices.len;
+ unsigned int scount = shortCount;
+
+ const BYTE *bytes = &StructAfter<BYTE> (regionIndices);
+ const BYTE *row = bytes + inner * (scount + count);
+
+ float delta = 0.;
+ unsigned int i = 0;
+
+ const SHORT *scursor = reinterpret_cast<const SHORT *> (row);
+ for (; i < scount; i++)
+ {
+ float scalar = regions.evaluate (regionIndices.array[i], coords, coord_count);
+ delta += scalar * *scursor++;
+ }
+ const INT8 *bcursor = reinterpret_cast<const INT8 *> (scursor);
+ for (; i < count; i++)
+ {
+ float scalar = regions.evaluate (regionIndices.array[i], coords, coord_count);
+ delta += scalar * *bcursor++;
+ }
+
+ return delta;
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ regionIndices.sanitize(c) &&
+ shortCount <= regionIndices.len &&
+ c->check_array (&StructAfter<BYTE> (regionIndices),
+ get_row_size (), itemCount));
+ }
+
+ protected:
+ USHORT itemCount;
+ USHORT shortCount;
+ ArrayOf<USHORT> regionIndices;
+ BYTE bytesX[VAR];
+ public:
+ DEFINE_SIZE_ARRAY2 (6, regionIndices, bytesX);
+};
+
+struct VariationStore
+{
+ inline float get_delta (unsigned int outer, unsigned int inner,
+ int *coords, unsigned int coord_count) const
+ {
+ if (unlikely (outer >= dataSets.len))
+ return 0.;
+
+ return (this+dataSets[outer]).get_delta (inner,
+ coords, coord_count,
+ this+regions);
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ format == 1 &&
+ regions.sanitize (c, this) &&
+ dataSets.sanitize (c, this));
+ }
+
+ protected:
+ USHORT format;
+ OffsetTo<VarRegionList, ULONG> regions;
+ OffsetArrayOf<VarData, ULONG> dataSets;
+ public:
+ DEFINE_SIZE_ARRAY (8, dataSets);
+};
+
+/*
+ * Feature Variations
+ */
+
+struct ConditionFormat1
+{
+ friend struct Condition;
+
+ private:
+ inline bool evaluate (const int *coords, unsigned int coord_len) const
+ {
+ int coord = axisIndex < coord_len ? coords[axisIndex] : 0;
+ return filterRangeMinValue <= coord && coord <= filterRangeMaxValue;
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ protected:
+ USHORT format; /* Format identifier--format = 1 */
+ USHORT axisIndex;
+ F2DOT14 filterRangeMinValue;
+ F2DOT14 filterRangeMaxValue;
+ public:
+ DEFINE_SIZE_STATIC (8);
+};
+
+struct Condition
+{
+ inline bool evaluate (const int *coords, unsigned int coord_len) const
+ {
+ switch (u.format) {
+ case 1: return u.format1.evaluate (coords, coord_len);
+ default:return false;
+ }
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ if (!u.format.sanitize (c)) return_trace (false);
+ switch (u.format) {
+ case 1: return_trace (u.format1.sanitize (c));
+ default:return_trace (true);
+ }
+ }
+
+ protected:
+ union {
+ USHORT format; /* Format identifier */
+ ConditionFormat1 format1;
+ } u;
+ public:
+ DEFINE_SIZE_UNION (2, format);
+};
+
+struct ConditionSet
+{
+ inline bool evaluate (const int *coords, unsigned int coord_len) const
+ {
+ unsigned int count = conditions.len;
+ for (unsigned int i = 0; i < count; i++)
+ if (!(this+conditions.array[i]).evaluate (coords, coord_len))
+ return false;
+ return true;
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (conditions.sanitize (c, this));
+ }
+
+ protected:
+ OffsetArrayOf<Condition, ULONG> conditions;
+ public:
+ DEFINE_SIZE_ARRAY (2, conditions);
+};
+
+struct FeatureTableSubstitutionRecord
+{
+ friend struct FeatureTableSubstitution;
+
+ inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) && feature.sanitize (c, base));
+ }
+
+ protected:
+ USHORT featureIndex;
+ OffsetTo<Feature, ULONG> feature;
+ public:
+ DEFINE_SIZE_STATIC (6);
+};
+
+struct FeatureTableSubstitution
+{
+ inline const Feature *find_substitute (unsigned int feature_index) const
+ {
+ unsigned int count = substitutions.len;
+ for (unsigned int i = 0; i < count; i++)
+ {
+ const FeatureTableSubstitutionRecord &record = substitutions.array[i];
+ if (record.featureIndex == feature_index)
+ return &(this+record.feature);
+ }
+ return NULL;
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (version.sanitize (c) &&
+ likely (version.major == 1) &&
+ substitutions.sanitize (c, this));
+ }
+
+ protected:
+ FixedVersion<> version; /* Version--0x00010000u */
+ ArrayOf<FeatureTableSubstitutionRecord>
+ substitutions;
+ public:
+ DEFINE_SIZE_ARRAY (6, substitutions);
+};
+
+struct FeatureVariationRecord
+{
+ friend struct FeatureVariations;
+
+ inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (conditions.sanitize (c, base) &&
+ substitutions.sanitize (c, base));
+ }
+
+ protected:
+ OffsetTo<ConditionSet, ULONG>
+ conditions;
+ OffsetTo<FeatureTableSubstitution, ULONG>
+ substitutions;
+ public:
+ DEFINE_SIZE_STATIC (8);
+};
+
+struct FeatureVariations
+{
+ static const unsigned int NOT_FOUND_INDEX = 0xFFFFFFFFu;
+
+ inline bool find_index (const int *coords, unsigned int coord_len,
+ unsigned int *index) const
+ {
+ unsigned int count = varRecords.len;
+ for (unsigned int i = 0; i < count; i++)
+ {
+ const FeatureVariationRecord &record = varRecords.array[i];
+ if ((this+record.conditions).evaluate (coords, coord_len))
+ {
+ *index = i;
+ return true;
+ }
+ }
+ *index = NOT_FOUND_INDEX;
+ return false;
+ }
+
+ inline const Feature *find_substitute (unsigned int variations_index,
+ unsigned int feature_index) const
+ {
+ const FeatureVariationRecord &record = varRecords[variations_index];
+ return (this+record.substitutions).find_substitute (feature_index);
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (version.sanitize (c) &&
+ likely (version.major == 1) &&
+ varRecords.sanitize (c, this));
+ }
+
+ protected:
+ FixedVersion<> version; /* Version--0x00010000u */
+ ArrayOf<FeatureVariationRecord, ULONG>
+ varRecords;
+ public:
+ DEFINE_SIZE_ARRAY (8, varRecords);
+};
+
+
+/*
* Device Tables
*/
-struct Device
+struct HintingDevice
{
+ friend struct Device;
+
+ private:
inline hb_position_t get_x_delta (hb_font_t *font) const
{ return get_delta (font->x_ppem, font->x_scale); }
@@ -1156,6 +1550,21 @@ struct Device
inline hb_position_t get_y_delta (hb_font_t *font) const
{ return get_delta (font->y_ppem, font->y_scale); }
+ inline unsigned int get_size (void) const
+ {
+ unsigned int f = deltaFormat;
+ if (unlikely (f < 1 || f > 3 || startSize > endSize)) return 3 * USHORT::static_size;
+ return USHORT::static_size * (4 + ((endSize - startSize) >> (4 - f)));
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) && c->check_range (this, this->get_size ()));
+ }
+
+ private:
+
inline int get_delta (unsigned int ppem, int scale) const
{
if (!ppem) return 0;
@@ -1166,8 +1575,6 @@ struct Device
return (int) (pixels * (int64_t) scale / ppem);
}
-
-
inline int get_delta_pixels (unsigned int ppem_size) const
{
unsigned int f = deltaFormat;
@@ -1191,19 +1598,6 @@ struct Device
return delta;
}
- inline unsigned int get_size (void) const
- {
- unsigned int f = deltaFormat;
- if (unlikely (f < 1 || f > 3 || startSize > endSize)) return 3 * USHORT::static_size;
- return USHORT::static_size * (4 + ((endSize - startSize) >> (4 - f)));
- }
-
- inline bool sanitize (hb_sanitize_context_t *c) const
- {
- TRACE_SANITIZE (this);
- return_trace (c->check_struct (this) && c->check_range (this, this->get_size ()));
- }
-
protected:
USHORT startSize; /* Smallest size to correct--in ppem */
USHORT endSize; /* Largest size to correct--in ppem */
@@ -1217,6 +1611,101 @@ struct Device
DEFINE_SIZE_ARRAY (6, deltaValue);
};
+struct VariationDevice
+{
+ friend struct Device;
+
+ private:
+
+ inline hb_position_t get_x_delta (hb_font_t *font, const VariationStore &store) const
+ { return font->em_scalef_x (get_delta (font, store)); }
+
+ inline hb_position_t get_y_delta (hb_font_t *font, const VariationStore &store) const
+ { return font->em_scalef_y (get_delta (font, store)); }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ private:
+
+ inline float get_delta (hb_font_t *font, const VariationStore &store) const
+ {
+ return store.get_delta (outerIndex, innerIndex, font->coords, font->num_coords);
+ }
+
+ protected:
+ USHORT outerIndex;
+ USHORT innerIndex;
+ USHORT deltaFormat; /* Format identifier for this table: 0x0x8000 */
+ public:
+ DEFINE_SIZE_STATIC (6);
+};
+
+struct DeviceHeader
+{
+ protected:
+ USHORT reserved1;
+ USHORT reserved2;
+ public:
+ USHORT format; /* Format identifier */
+ public:
+ DEFINE_SIZE_STATIC (6);
+};
+
+struct Device
+{
+ inline hb_position_t get_x_delta (hb_font_t *font, const VariationStore &store=Null(VariationStore)) const
+ {
+ switch (u.b.format)
+ {
+ case 1: case 2: case 3:
+ return u.hinting.get_x_delta (font);
+ case 0x8000:
+ return u.variation.get_x_delta (font, store);
+ default:
+ return 0;
+ }
+ }
+ inline hb_position_t get_y_delta (hb_font_t *font, const VariationStore &store=Null(VariationStore)) const
+ {
+ switch (u.b.format)
+ {
+ case 1: case 2: case 3:
+ return u.hinting.get_y_delta (font);
+ case 0x8000:
+ return u.variation.get_y_delta (font, store);
+ default:
+ return 0;
+ }
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ if (!u.b.format.sanitize (c)) return_trace (false);
+ switch (u.b.format) {
+ case 1: case 2: case 3:
+ return_trace (u.hinting.sanitize (c));
+ case 0x8000:
+ return_trace (u.variation.sanitize (c));
+ default:
+ return_trace (true);
+ }
+ }
+
+ protected:
+ union {
+ DeviceHeader b;
+ HintingDevice hinting;
+ VariationDevice variation;
+ } u;
+ public:
+ DEFINE_SIZE_UNION (6, b);
+};
+
} /* namespace OT */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gdef-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gdef-table.hh
index bc36436be7..b70cbb7a38 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gdef-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gdef-table.hh
@@ -97,7 +97,7 @@ struct CaretValueFormat1
friend struct CaretValue;
private:
- inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id HB_UNUSED) const
+ inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction) const
{
return HB_DIRECTION_IS_HORIZONTAL (direction) ? font->em_scale_x (coordinate) : font->em_scale_y (coordinate);
}
@@ -146,11 +146,11 @@ struct CaretValueFormat3
{
friend struct CaretValue;
- inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id HB_UNUSED) const
+ inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction, const VariationStore &var_store) const
{
return HB_DIRECTION_IS_HORIZONTAL (direction) ?
- font->em_scale_x (coordinate) + (this+deviceTable).get_x_delta (font) :
- font->em_scale_y (coordinate) + (this+deviceTable).get_y_delta (font);
+ font->em_scale_x (coordinate) + (this+deviceTable).get_x_delta (font, var_store) :
+ font->em_scale_y (coordinate) + (this+deviceTable).get_y_delta (font, var_store);
}
inline bool sanitize (hb_sanitize_context_t *c) const
@@ -172,12 +172,15 @@ struct CaretValueFormat3
struct CaretValue
{
- inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id) const
+ inline hb_position_t get_caret_value (hb_font_t *font,
+ hb_direction_t direction,
+ hb_codepoint_t glyph_id,
+ const VariationStore &var_store) const
{
switch (u.format) {
- case 1: return u.format1.get_caret_value (font, direction, glyph_id);
+ case 1: return u.format1.get_caret_value (font, direction);
case 2: return u.format2.get_caret_value (font, direction, glyph_id);
- case 3: return u.format3.get_caret_value (font, direction, glyph_id);
+ case 3: return u.format3.get_caret_value (font, direction, var_store);
default:return 0;
}
}
@@ -210,6 +213,7 @@ struct LigGlyph
inline unsigned int get_lig_carets (hb_font_t *font,
hb_direction_t direction,
hb_codepoint_t glyph_id,
+ const VariationStore &var_store,
unsigned int start_offset,
unsigned int *caret_count /* IN/OUT */,
hb_position_t *caret_array /* OUT */) const
@@ -218,7 +222,7 @@ struct LigGlyph
const OffsetTo<CaretValue> *array = carets.sub_array (start_offset, caret_count);
unsigned int count = *caret_count;
for (unsigned int i = 0; i < count; i++)
- caret_array[i] = (this+array[i]).get_caret_value (font, direction, glyph_id);
+ caret_array[i] = (this+array[i]).get_caret_value (font, direction, glyph_id, var_store);
}
return carets.len;
@@ -244,6 +248,7 @@ struct LigCaretList
inline unsigned int get_lig_carets (hb_font_t *font,
hb_direction_t direction,
hb_codepoint_t glyph_id,
+ const VariationStore &var_store,
unsigned int start_offset,
unsigned int *caret_count /* IN/OUT */,
hb_position_t *caret_array /* OUT */) const
@@ -256,7 +261,7 @@ struct LigCaretList
return 0;
}
const LigGlyph &lig_glyph = this+ligGlyph[index];
- return lig_glyph.get_lig_carets (font, direction, glyph_id, start_offset, caret_count, caret_array);
+ return lig_glyph.get_lig_carets (font, direction, glyph_id, var_store, start_offset, caret_count, caret_array);
}
inline bool sanitize (hb_sanitize_context_t *c) const
@@ -367,11 +372,17 @@ struct GDEF
unsigned int start_offset,
unsigned int *caret_count /* IN/OUT */,
hb_position_t *caret_array /* OUT */) const
- { return (this+ligCaretList).get_lig_carets (font, direction, glyph_id, start_offset, caret_count, caret_array); }
+ { return (this+ligCaretList).get_lig_carets (font,
+ direction, glyph_id, get_var_store(),
+ start_offset, caret_count, caret_array); }
- inline bool has_mark_sets (void) const { return version.to_int () >= 0x00010002u && markGlyphSetsDef[0] != 0; }
+ inline bool has_mark_sets (void) const { return version.to_int () >= 0x00010002u && markGlyphSetsDef != 0; }
inline bool mark_set_covers (unsigned int set_index, hb_codepoint_t glyph_id) const
- { return version.to_int () >= 0x00010002u && (this+markGlyphSetsDef[0]).covers (set_index, glyph_id); }
+ { return version.to_int () >= 0x00010002u && (this+markGlyphSetsDef).covers (set_index, glyph_id); }
+
+ inline bool has_var_store (void) const { return version.to_int () >= 0x00010003u && varStore != 0; }
+ inline const VariationStore &get_var_store (void) const
+ { return version.to_int () >= 0x00010003u ? this+varStore : Null(VariationStore); }
inline bool sanitize (hb_sanitize_context_t *c) const
{
@@ -382,10 +393,10 @@ struct GDEF
attachList.sanitize (c, this) &&
ligCaretList.sanitize (c, this) &&
markAttachClassDef.sanitize (c, this) &&
- (version.to_int () < 0x00010002u || markGlyphSetsDef[0].sanitize (c, this)));
+ (version.to_int () < 0x00010002u || markGlyphSetsDef.sanitize (c, this)) &&
+ (version.to_int () < 0x00010003u || varStore.sanitize (c, this)));
}
-
/* glyph_props is a 16-bit integer where the lower 8-bit have bits representing
* glyph class and other bits, and high 8-bit gthe mark attachment type (if any).
* Not to be confused with lookup_props which is very similar. */
@@ -409,8 +420,8 @@ struct GDEF
protected:
- FixedVersion version; /* Version of the GDEF table--currently
- * 0x00010002u */
+ FixedVersion<>version; /* Version of the GDEF table--currently
+ * 0x00010003u */
OffsetTo<ClassDef>
glyphClassDef; /* Offset to class definition table
* for glyph type--from beginning of
@@ -428,12 +439,17 @@ struct GDEF
* mark attachment type--from beginning
* of GDEF header (may be Null) */
OffsetTo<MarkGlyphSets>
- markGlyphSetsDef[VAR]; /* Offset to the table of mark set
+ markGlyphSetsDef; /* Offset to the table of mark set
* definitions--from beginning of GDEF
* header (may be NULL). Introduced
- * in version 00010002. */
+ * in version 0x00010002. */
+ OffsetTo<VariationStore, ULONG>
+ varStore; /* Offset to the table of Item Variation
+ * Store--from beginning of GDEF
+ * header (may be NULL). Introduced
+ * in version 0x00010003. */
public:
- DEFINE_SIZE_ARRAY (12, markGlyphSetsDef);
+ DEFINE_SIZE_MIN (12);
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gpos-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gpos-table.hh
index 568b5f63a9..952fd60fec 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gpos-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gpos-table.hh
@@ -36,8 +36,17 @@ namespace OT {
/* buffer **position** var allocations */
-#define attach_lookback() var.u16[0] /* number of glyphs to go back to attach this glyph to its base */
-#define cursive_chain() var.i16[1] /* character to which this connects, may be positive or negative */
+#define attach_chain() var.i16[0] /* glyph to which this attaches to, relative to current glyphs; negative for going back, positive for forward. */
+#define attach_type() var.u8[2] /* attachment type */
+/* Note! if attach_chain() is zero, the value of attach_type() is irrelevant. */
+
+enum attach_type_t {
+ ATTACH_TYPE_NONE = 0X00,
+
+ /* Each attachment should be either a mark or a cursive; can't be both. */
+ ATTACH_TYPE_MARK = 0X01,
+ ATTACH_TYPE_CURSIVE = 0X02,
+};
/* Shared Tables: ValueRecord, Anchor Table, and MarkArray */
@@ -94,18 +103,17 @@ struct ValueFormat : USHORT
inline unsigned int get_size (void) const
{ return get_len () * Value::static_size; }
- void apply_value (hb_font_t *font,
- hb_direction_t direction,
+ void apply_value (hb_apply_context_t *c,
const void *base,
const Value *values,
hb_glyph_position_t &glyph_pos) const
{
- unsigned int x_ppem, y_ppem;
unsigned int format = *this;
- hb_bool_t horizontal = HB_DIRECTION_IS_HORIZONTAL (direction);
-
if (!format) return;
+ hb_font_t *font = c->font;
+ hb_bool_t horizontal = HB_DIRECTION_IS_HORIZONTAL (c->direction);
+
if (format & xPlacement) glyph_pos.x_offset += font->em_scale_x (get_short (values++));
if (format & yPlacement) glyph_pos.y_offset += font->em_scale_y (get_short (values++));
if (format & xAdvance) {
@@ -120,27 +128,29 @@ struct ValueFormat : USHORT
if (!has_device ()) return;
- x_ppem = font->x_ppem;
- y_ppem = font->y_ppem;
+ bool use_x_device = font->x_ppem || font->num_coords;
+ bool use_y_device = font->y_ppem || font->num_coords;
+
+ if (!use_x_device && !use_y_device) return;
- if (!x_ppem && !y_ppem) return;
+ const VariationStore &store = c->var_store;
/* pixel -> fractional pixel */
if (format & xPlaDevice) {
- if (x_ppem) glyph_pos.x_offset += (base + get_device (values)).get_x_delta (font);
+ if (use_x_device) glyph_pos.x_offset += (base + get_device (values)).get_x_delta (font, store);
values++;
}
if (format & yPlaDevice) {
- if (y_ppem) glyph_pos.y_offset += (base + get_device (values)).get_y_delta (font);
+ if (use_y_device) glyph_pos.y_offset += (base + get_device (values)).get_y_delta (font, store);
values++;
}
if (format & xAdvDevice) {
- if (horizontal && x_ppem) glyph_pos.x_advance += (base + get_device (values)).get_x_delta (font);
+ if (horizontal && use_x_device) glyph_pos.x_advance += (base + get_device (values)).get_x_delta (font, store);
values++;
}
if (format & yAdvDevice) {
/* y_advance values grow downward but font-space grows upward, hence negation */
- if (!horizontal && y_ppem) glyph_pos.y_advance -= (base + get_device (values)).get_y_delta (font);
+ if (!horizontal && use_y_device) glyph_pos.y_advance -= (base + get_device (values)).get_y_delta (font, store);
values++;
}
}
@@ -222,11 +232,12 @@ struct ValueFormat : USHORT
struct AnchorFormat1
{
- inline void get_anchor (hb_font_t *font, hb_codepoint_t glyph_id HB_UNUSED,
+ inline void get_anchor (hb_apply_context_t *c, hb_codepoint_t glyph_id HB_UNUSED,
hb_position_t *x, hb_position_t *y) const
{
- *x = font->em_scale_x (xCoordinate);
- *y = font->em_scale_y (yCoordinate);
+ hb_font_t *font = c->font;
+ *x = font->em_scale_x (xCoordinate);
+ *y = font->em_scale_y (yCoordinate);
}
inline bool sanitize (hb_sanitize_context_t *c) const
@@ -245,18 +256,19 @@ struct AnchorFormat1
struct AnchorFormat2
{
- inline void get_anchor (hb_font_t *font, hb_codepoint_t glyph_id,
+ inline void get_anchor (hb_apply_context_t *c, hb_codepoint_t glyph_id,
hb_position_t *x, hb_position_t *y) const
{
- unsigned int x_ppem = font->x_ppem;
- unsigned int y_ppem = font->y_ppem;
- hb_position_t cx, cy;
- hb_bool_t ret;
+ hb_font_t *font = c->font;
+ unsigned int x_ppem = font->x_ppem;
+ unsigned int y_ppem = font->y_ppem;
+ hb_position_t cx, cy;
+ hb_bool_t ret;
- ret = (x_ppem || y_ppem) &&
- font->get_glyph_contour_point_for_origin (glyph_id, anchorPoint, HB_DIRECTION_LTR, &cx, &cy);
- *x = ret && x_ppem ? cx : font->em_scale_x (xCoordinate);
- *y = ret && y_ppem ? cy : font->em_scale_y (yCoordinate);
+ ret = (x_ppem || y_ppem) &&
+ font->get_glyph_contour_point_for_origin (glyph_id, anchorPoint, HB_DIRECTION_LTR, &cx, &cy);
+ *x = ret && x_ppem ? cx : font->em_scale_x (xCoordinate);
+ *y = ret && y_ppem ? cy : font->em_scale_y (yCoordinate);
}
inline bool sanitize (hb_sanitize_context_t *c) const
@@ -276,16 +288,17 @@ struct AnchorFormat2
struct AnchorFormat3
{
- inline void get_anchor (hb_font_t *font, hb_codepoint_t glyph_id HB_UNUSED,
+ inline void get_anchor (hb_apply_context_t *c, hb_codepoint_t glyph_id HB_UNUSED,
hb_position_t *x, hb_position_t *y) const
{
- *x = font->em_scale_x (xCoordinate);
- *y = font->em_scale_y (yCoordinate);
+ hb_font_t *font = c->font;
+ *x = font->em_scale_x (xCoordinate);
+ *y = font->em_scale_y (yCoordinate);
- if (font->x_ppem)
- *x += (this+xDeviceTable).get_x_delta (font);
- if (font->y_ppem)
- *y += (this+yDeviceTable).get_x_delta (font);
+ if (font->x_ppem || font->num_coords)
+ *x += (this+xDeviceTable).get_x_delta (font, c->var_store);
+ if (font->y_ppem || font->num_coords)
+ *y += (this+yDeviceTable).get_y_delta (font, c->var_store);
}
inline bool sanitize (hb_sanitize_context_t *c) const
@@ -312,14 +325,14 @@ struct AnchorFormat3
struct Anchor
{
- inline void get_anchor (hb_font_t *font, hb_codepoint_t glyph_id,
+ inline void get_anchor (hb_apply_context_t *c, hb_codepoint_t glyph_id,
hb_position_t *x, hb_position_t *y) const
{
*x = *y = 0;
switch (u.format) {
- case 1: u.format1.get_anchor (font, glyph_id, x, y); return;
- case 2: u.format2.get_anchor (font, glyph_id, x, y); return;
- case 3: u.format3.get_anchor (font, glyph_id, x, y); return;
+ case 1: u.format1.get_anchor (c, glyph_id, x, y); return;
+ case 2: u.format2.get_anchor (c, glyph_id, x, y); return;
+ case 3: u.format3.get_anchor (c, glyph_id, x, y); return;
default: return;
}
}
@@ -361,7 +374,7 @@ struct AnchorMatrix
{
TRACE_SANITIZE (this);
if (!c->check_struct (this)) return_trace (false);
- if (unlikely (rows > 0 && cols >= ((unsigned int) -1) / rows)) return_trace (false);
+ if (unlikely (_hb_unsigned_int_mul_overflows (rows, cols))) return_trace (false);
unsigned int count = rows * cols;
if (!c->check_array (matrixZ, matrixZ[0].static_size, count)) return_trace (false);
for (unsigned int i = 0; i < count; i++)
@@ -419,13 +432,15 @@ struct MarkArray : ArrayOf<MarkRecord> /* Array of MarkRecords--in Coverage orde
hb_position_t mark_x, mark_y, base_x, base_y;
- mark_anchor.get_anchor (c->font, buffer->cur().codepoint, &mark_x, &mark_y);
- glyph_anchor.get_anchor (c->font, buffer->info[glyph_pos].codepoint, &base_x, &base_y);
+ mark_anchor.get_anchor (c, buffer->cur().codepoint, &mark_x, &mark_y);
+ glyph_anchor.get_anchor (c, buffer->info[glyph_pos].codepoint, &base_x, &base_y);
hb_glyph_position_t &o = buffer->cur_pos();
o.x_offset = base_x - mark_x;
o.y_offset = base_y - mark_y;
- o.attach_lookback() = buffer->idx - glyph_pos;
+ o.attach_type() = ATTACH_TYPE_MARK;
+ o.attach_chain() = (int) glyph_pos - (int) buffer->idx;
+ buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT;
buffer->idx++;
return_trace (true);
@@ -461,8 +476,7 @@ struct SinglePosFormat1
unsigned int index = (this+coverage).get_coverage (buffer->cur().codepoint);
if (likely (index == NOT_COVERED)) return_trace (false);
- valueFormat.apply_value (c->font, c->direction, this,
- values, buffer->cur_pos());
+ valueFormat.apply_value (c, this, values, buffer->cur_pos());
buffer->idx++;
return_trace (true);
@@ -512,7 +526,7 @@ struct SinglePosFormat2
if (likely (index >= valueCount)) return_trace (false);
- valueFormat.apply_value (c->font, c->direction, this,
+ valueFormat.apply_value (c, this,
&values[index * valueFormat.get_len ()],
buffer->cur_pos());
@@ -629,10 +643,8 @@ struct PairSet
min = mid + 1;
else
{
- valueFormats[0].apply_value (c->font, c->direction, this,
- &record->values[0], buffer->cur_pos());
- valueFormats[1].apply_value (c->font, c->direction, this,
- &record->values[len1], buffer->pos[pos]);
+ valueFormats[0].apply_value (c, this, &record->values[0], buffer->cur_pos());
+ valueFormats[1].apply_value (c, this, &record->values[len1], buffer->pos[pos]);
if (len2)
pos++;
buffer->idx = pos;
@@ -678,7 +690,7 @@ struct PairPosFormat1
(this+coverage).add_coverage (c->input);
unsigned int count = pairSet.len;
for (unsigned int i = 0; i < count; i++)
- (this+pairSet[i]).collect_glyphs (c, &valueFormat1);
+ (this+pairSet[i]).collect_glyphs (c, valueFormat);
}
inline const Coverage &get_coverage (void) const
@@ -697,7 +709,7 @@ struct PairPosFormat1
skippy_iter.reset (buffer->idx, 1);
if (!skippy_iter.next ()) return_trace (false);
- return_trace ((this+pairSet[index]).apply (c, &valueFormat1, skippy_iter.idx));
+ return_trace ((this+pairSet[index]).apply (c, valueFormat, skippy_iter.idx));
}
inline bool sanitize (hb_sanitize_context_t *c) const
@@ -706,11 +718,11 @@ struct PairPosFormat1
if (!c->check_struct (this)) return_trace (false);
- unsigned int len1 = valueFormat1.get_len ();
- unsigned int len2 = valueFormat2.get_len ();
+ unsigned int len1 = valueFormat[0].get_len ();
+ unsigned int len2 = valueFormat[1].get_len ();
PairSet::sanitize_closure_t closure = {
this,
- &valueFormat1,
+ valueFormat,
len1,
1 + len1 + len2
};
@@ -723,10 +735,10 @@ struct PairPosFormat1
OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from
* beginning of subtable */
- ValueFormat valueFormat1; /* Defines the types of data in
+ ValueFormat valueFormat[2]; /* [0] Defines the types of data in
* ValueRecord1--for the first glyph
* in the pair--may be zero (0) */
- ValueFormat valueFormat2; /* Defines the types of data in
+ /* [1] Defines the types of data in
* ValueRecord2--for the second glyph
* in the pair--may be zero (0) */
OffsetArrayOf<PairSet>
@@ -741,7 +753,7 @@ struct PairPosFormat2
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
- /* (this+coverage).add_coverage (c->input); // Don't need this. */
+ (this+coverage).add_coverage (c->input);
unsigned int count1 = class1Count;
const ClassDef &klass1 = this+classDef1;
@@ -779,10 +791,8 @@ struct PairPosFormat2
if (unlikely (klass1 >= class1Count || klass2 >= class2Count)) return_trace (false);
const Value *v = &values[record_len * (klass1 * class2Count + klass2)];
- valueFormat1.apply_value (c->font, c->direction, this,
- v, buffer->cur_pos());
- valueFormat2.apply_value (c->font, c->direction, this,
- v + len1, buffer->pos[skippy_iter.idx]);
+ valueFormat1.apply_value (c, this, v, buffer->cur_pos());
+ valueFormat2.apply_value (c, this, v + len1, buffer->pos[skippy_iter.idx]);
buffer->idx = skippy_iter.idx;
if (len2)
@@ -906,9 +916,6 @@ struct CursivePosFormat1
TRACE_APPLY (this);
hb_buffer_t *buffer = c->buffer;
- /* We don't handle mark glyphs here. */
- if (unlikely (_hb_glyph_info_is_mark (&buffer->cur()))) return_trace (false);
-
const EntryExitRecord &this_record = entryExitRecord[(this+coverage).get_coverage (buffer->cur().codepoint)];
if (!this_record.exitAnchor) return_trace (false);
@@ -923,8 +930,8 @@ struct CursivePosFormat1
unsigned int j = skippy_iter.idx;
hb_position_t entry_x, entry_y, exit_x, exit_y;
- (this+this_record.exitAnchor).get_anchor (c->font, buffer->info[i].codepoint, &exit_x, &exit_y);
- (this+next_record.entryAnchor).get_anchor (c->font, buffer->info[j].codepoint, &entry_x, &entry_y);
+ (this+this_record.exitAnchor).get_anchor (c, buffer->info[i].codepoint, &exit_x, &exit_y);
+ (this+next_record.entryAnchor).get_anchor (c, buffer->info[j].codepoint, &entry_x, &entry_y);
hb_glyph_position_t *pos = buffer->pos;
@@ -992,7 +999,9 @@ struct CursivePosFormat1
*/
reverse_cursive_minor_offset (pos, child, c->direction, parent);
- pos[child].cursive_chain() = parent - child;
+ pos[child].attach_type() = ATTACH_TYPE_CURSIVE;
+ pos[child].attach_chain() = (int) parent - (int) child;
+ buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT;
if (likely (HB_DIRECTION_IS_HORIZONTAL (c->direction)))
pos[child].y_offset = y_offset;
else
@@ -1067,7 +1076,7 @@ struct MarkBasePosFormat1
unsigned int mark_index = (this+markCoverage).get_coverage (buffer->cur().codepoint);
if (likely (mark_index == NOT_COVERED)) return_trace (false);
- /* now we search backwards for a non-mark glyph */
+ /* Now we search backwards for a non-mark glyph */
hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
skippy_iter.reset (buffer->idx, 1);
skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks);
@@ -1079,7 +1088,7 @@ struct MarkBasePosFormat1
} while (1);
/* Checking that matched glyph is actually a base glyph by GDEF is too strong; disabled */
- if (!_hb_glyph_info_is_base_glyph (&buffer->info[skippy_iter.idx])) { /*return_trace (false);*/ }
+ //if (!_hb_glyph_info_is_base_glyph (&buffer->info[skippy_iter.idx])) { return_trace (false); }
unsigned int base_index = (this+baseCoverage).get_coverage (buffer->info[skippy_iter.idx].codepoint);
if (base_index == NOT_COVERED) return_trace (false);
@@ -1168,14 +1177,14 @@ struct MarkLigPosFormat1
unsigned int mark_index = (this+markCoverage).get_coverage (buffer->cur().codepoint);
if (likely (mark_index == NOT_COVERED)) return_trace (false);
- /* now we search backwards for a non-mark glyph */
+ /* Now we search backwards for a non-mark glyph */
hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
skippy_iter.reset (buffer->idx, 1);
skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks);
if (!skippy_iter.prev ()) return_trace (false);
/* Checking that matched glyph is actually a ligature by GDEF is too strong; disabled */
- if (!_hb_glyph_info_is_ligature (&buffer->info[skippy_iter.idx])) { /*return_trace (false);*/ }
+ //if (!_hb_glyph_info_is_ligature (&buffer->info[skippy_iter.idx])) { return_trace (false); }
unsigned int j = skippy_iter.idx;
unsigned int lig_index = (this+ligatureCoverage).get_coverage (buffer->info[j].codepoint);
@@ -1499,7 +1508,8 @@ struct GPOS : GSUBGPOS
{ return CastR<PosLookup> (GSUBGPOS::get_lookup (i)); }
static inline void position_start (hb_font_t *font, hb_buffer_t *buffer);
- static inline void position_finish (hb_font_t *font, hb_buffer_t *buffer);
+ static inline void position_finish_advances (hb_font_t *font, hb_buffer_t *buffer);
+ static inline void position_finish_offsets (hb_font_t *font, hb_buffer_t *buffer);
inline bool sanitize (hb_sanitize_context_t *c) const
{
@@ -1508,21 +1518,19 @@ struct GPOS : GSUBGPOS
const OffsetTo<PosLookupList> &list = CastR<OffsetTo<PosLookupList> > (lookupList);
return_trace (list.sanitize (c, this));
}
- public:
- DEFINE_SIZE_STATIC (10);
};
static void
reverse_cursive_minor_offset (hb_glyph_position_t *pos, unsigned int i, hb_direction_t direction, unsigned int new_parent)
{
- unsigned int j = pos[i].cursive_chain();
- if (likely (!j))
+ int chain = pos[i].attach_chain(), type = pos[i].attach_type();
+ if (likely (!chain || 0 == (type & ATTACH_TYPE_CURSIVE)))
return;
- j += i;
+ pos[i].attach_chain() = 0;
- pos[i].cursive_chain() = 0;
+ unsigned int j = (int) i + chain;
/* Stop if we see new parent in the chain. */
if (j == new_parent)
@@ -1535,62 +1543,68 @@ reverse_cursive_minor_offset (hb_glyph_position_t *pos, unsigned int i, hb_direc
else
pos[j].x_offset = -pos[i].x_offset;
- pos[j].cursive_chain() = i - j;
+ pos[j].attach_chain() = -chain;
+ pos[j].attach_type() = type;
}
static void
-fix_cursive_minor_offset (hb_glyph_position_t *pos, unsigned int i, hb_direction_t direction)
+propagate_attachment_offsets (hb_glyph_position_t *pos, unsigned int i, hb_direction_t direction)
{
- unsigned int j = pos[i].cursive_chain();
- if (likely (!j))
+ /* Adjusts offsets of attached glyphs (both cursive and mark) to accumulate
+ * offset of glyph they are attached to. */
+ int chain = pos[i].attach_chain(), type = pos[i].attach_type();
+ if (likely (!chain))
return;
- j += i;
-
- pos[i].cursive_chain() = 0;
+ unsigned int j = (int) i + chain;
- fix_cursive_minor_offset (pos, j, direction);
+ pos[i].attach_chain() = 0;
- if (HB_DIRECTION_IS_HORIZONTAL (direction))
- pos[i].y_offset += pos[j].y_offset;
- else
- pos[i].x_offset += pos[j].x_offset;
-}
+ propagate_attachment_offsets (pos, j, direction);
-static void
-fix_mark_attachment (hb_glyph_position_t *pos, unsigned int i, hb_direction_t direction)
-{
- if (likely (!(pos[i].attach_lookback())))
- return;
+ assert (!!(type & ATTACH_TYPE_MARK) ^ !!(type & ATTACH_TYPE_CURSIVE));
- unsigned int j = i - pos[i].attach_lookback();
-
- pos[i].x_offset += pos[j].x_offset;
- pos[i].y_offset += pos[j].y_offset;
+ if (type & ATTACH_TYPE_CURSIVE)
+ {
+ if (HB_DIRECTION_IS_HORIZONTAL (direction))
+ pos[i].y_offset += pos[j].y_offset;
+ else
+ pos[i].x_offset += pos[j].x_offset;
+ }
+ else /*if (type & ATTACH_TYPE_MARK)*/
+ {
+ pos[i].x_offset += pos[j].x_offset;
+ pos[i].y_offset += pos[j].y_offset;
- if (HB_DIRECTION_IS_FORWARD (direction))
- for (unsigned int k = j; k < i; k++) {
- pos[i].x_offset -= pos[k].x_advance;
- pos[i].y_offset -= pos[k].y_advance;
- }
- else
- for (unsigned int k = j + 1; k < i + 1; k++) {
- pos[i].x_offset += pos[k].x_advance;
- pos[i].y_offset += pos[k].y_advance;
- }
+ assert (j < i);
+ if (HB_DIRECTION_IS_FORWARD (direction))
+ for (unsigned int k = j; k < i; k++) {
+ pos[i].x_offset -= pos[k].x_advance;
+ pos[i].y_offset -= pos[k].y_advance;
+ }
+ else
+ for (unsigned int k = j + 1; k < i + 1; k++) {
+ pos[i].x_offset += pos[k].x_advance;
+ pos[i].y_offset += pos[k].y_advance;
+ }
+ }
}
void
GPOS::position_start (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
{
- buffer->clear_positions ();
-
unsigned int count = buffer->len;
for (unsigned int i = 0; i < count; i++)
- buffer->pos[i].attach_lookback() = buffer->pos[i].cursive_chain() = 0;
+ buffer->pos[i].attach_chain() = buffer->pos[i].attach_type() = 0;
}
void
-GPOS::position_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
+GPOS::position_finish_advances (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
+{
+ //_hb_buffer_assert_gsubgpos_vars (buffer);
+}
+
+void
+GPOS::position_finish_offsets (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
{
_hb_buffer_assert_gsubgpos_vars (buffer);
@@ -1598,13 +1612,10 @@ GPOS::position_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
hb_glyph_position_t *pos = hb_buffer_get_glyph_positions (buffer, &len);
hb_direction_t direction = buffer->props.direction;
- /* Handle cursive connections */
- for (unsigned int i = 0; i < len; i++)
- fix_cursive_minor_offset (pos, i, direction);
-
/* Handle attachments */
- for (unsigned int i = 0; i < len; i++)
- fix_mark_attachment (pos, i, direction);
+ if (buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT)
+ for (unsigned int i = 0; i < len; i++)
+ propagate_attachment_offsets (pos, i, direction);
}
@@ -1633,8 +1644,8 @@ template <typename context_t>
}
-#undef attach_lookback
-#undef cursive_chain
+#undef attach_chain
+#undef attach_type
} /* namespace OT */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsub-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsub-table.hh
index eebc87b4c5..66fcb3f3af 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsub-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsub-table.hh
@@ -41,7 +41,10 @@ struct SingleSubstFormat1
{
TRACE_CLOSURE (this);
Coverage::Iter iter;
- for (iter.init (this+coverage); iter.more (); iter.next ()) {
+ for (iter.init (this+coverage); iter.more (); iter.next ())
+ {
+ /* TODO Switch to range-based API to work around malicious fonts.
+ * https://github.com/behdad/harfbuzz/issues/363 */
hb_codepoint_t glyph_id = iter.get_glyph ();
if (c->glyphs->has (glyph_id))
c->glyphs->add ((glyph_id + deltaGlyphID) & 0xFFFFu);
@@ -52,7 +55,10 @@ struct SingleSubstFormat1
{
TRACE_COLLECT_GLYPHS (this);
Coverage::Iter iter;
- for (iter.init (this+coverage); iter.more (); iter.next ()) {
+ for (iter.init (this+coverage); iter.more (); iter.next ())
+ {
+ /* TODO Switch to range-based API to work around malicious fonts.
+ * https://github.com/behdad/harfbuzz/issues/363 */
hb_codepoint_t glyph_id = iter.get_glyph ();
c->input->add (glyph_id);
c->output->add ((glyph_id + deltaGlyphID) & 0xFFFFu);
@@ -120,7 +126,11 @@ struct SingleSubstFormat2
{
TRACE_CLOSURE (this);
Coverage::Iter iter;
- for (iter.init (this+coverage); iter.more (); iter.next ()) {
+ unsigned int count = substitute.len;
+ for (iter.init (this+coverage); iter.more (); iter.next ())
+ {
+ if (unlikely (iter.get_coverage () >= count))
+ break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
if (c->glyphs->has (iter.get_glyph ()))
c->glyphs->add (substitute[iter.get_coverage ()]);
}
@@ -130,7 +140,11 @@ struct SingleSubstFormat2
{
TRACE_COLLECT_GLYPHS (this);
Coverage::Iter iter;
- for (iter.init (this+coverage); iter.more (); iter.next ()) {
+ unsigned int count = substitute.len;
+ for (iter.init (this+coverage); iter.more (); iter.next ())
+ {
+ if (unlikely (iter.get_coverage () >= count))
+ break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
c->input->add (iter.get_glyph ());
c->output->add (substitute[iter.get_coverage ()]);
}
@@ -265,16 +279,6 @@ struct Sequence
TRACE_APPLY (this);
unsigned int count = substitute.len;
- /* TODO:
- * Testing shows that Uniscribe actually allows zero-len susbstitute,
- * which essentially deletes a glyph. We don't allow for now. It
- * can be confusing to the client since the cluster from the deleted
- * glyph won't be merged with any output cluster... Also, currently
- * buffer->move_to() makes assumptions about this too. Perhaps fix
- * in the future after figuring out what to do with the clusters.
- */
- if (unlikely (!count)) return_trace (false);
-
/* Special-case to make it in-place and not consider this
* as a "multiplied" substitution. */
if (unlikely (count == 1))
@@ -282,6 +286,13 @@ struct Sequence
c->replace_glyph (substitute.array[0]);
return_trace (true);
}
+ /* Spec disallows this, but Uniscribe allows it.
+ * https://github.com/behdad/harfbuzz/issues/253 */
+ else if (unlikely (count == 0))
+ {
+ c->buffer->delete_glyph ();
+ return_trace (true);
+ }
unsigned int klass = _hb_glyph_info_is_ligature (&c->buffer->cur()) ?
HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH : 0;
@@ -324,7 +335,11 @@ struct MultipleSubstFormat1
{
TRACE_CLOSURE (this);
Coverage::Iter iter;
- for (iter.init (this+coverage); iter.more (); iter.next ()) {
+ unsigned int count = sequence.len;
+ for (iter.init (this+coverage); iter.more (); iter.next ())
+ {
+ if (unlikely (iter.get_coverage () >= count))
+ break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
if (c->glyphs->has (iter.get_glyph ()))
(this+sequence[iter.get_coverage ()]).closure (c);
}
@@ -442,7 +457,11 @@ struct AlternateSubstFormat1
{
TRACE_CLOSURE (this);
Coverage::Iter iter;
- for (iter.init (this+coverage); iter.more (); iter.next ()) {
+ unsigned int count = alternateSet.len;
+ for (iter.init (this+coverage); iter.more (); iter.next ())
+ {
+ if (unlikely (iter.get_coverage () >= count))
+ break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
if (c->glyphs->has (iter.get_glyph ())) {
const AlternateSet &alt_set = this+alternateSet[iter.get_coverage ()];
unsigned int count = alt_set.len;
@@ -456,7 +475,11 @@ struct AlternateSubstFormat1
{
TRACE_COLLECT_GLYPHS (this);
Coverage::Iter iter;
- for (iter.init (this+coverage); iter.more (); iter.next ()) {
+ unsigned int count = alternateSet.len;
+ for (iter.init (this+coverage); iter.more (); iter.next ())
+ {
+ if (unlikely (iter.get_coverage () >= count))
+ break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
c->input->add (iter.get_glyph ());
const AlternateSet &alt_set = this+alternateSet[iter.get_coverage ()];
unsigned int count = alt_set.len;
@@ -630,7 +653,7 @@ struct Ligature
unsigned int total_component_count = 0;
unsigned int match_length = 0;
- unsigned int match_positions[MAX_CONTEXT_LENGTH];
+ unsigned int match_positions[HB_MAX_CONTEXT_LENGTH];
if (likely (!match_input (c, count,
&component[1],
@@ -765,7 +788,11 @@ struct LigatureSubstFormat1
{
TRACE_CLOSURE (this);
Coverage::Iter iter;
- for (iter.init (this+coverage); iter.more (); iter.next ()) {
+ unsigned int count = ligatureSet.len;
+ for (iter.init (this+coverage); iter.more (); iter.next ())
+ {
+ if (unlikely (iter.get_coverage () >= count))
+ break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
if (c->glyphs->has (iter.get_glyph ()))
(this+ligatureSet[iter.get_coverage ()]).closure (c);
}
@@ -775,7 +802,11 @@ struct LigatureSubstFormat1
{
TRACE_COLLECT_GLYPHS (this);
Coverage::Iter iter;
- for (iter.init (this+coverage); iter.more (); iter.next ()) {
+ unsigned int count = ligatureSet.len;
+ for (iter.init (this+coverage); iter.more (); iter.next ())
+ {
+ if (unlikely (iter.get_coverage () >= count))
+ break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
c->input->add (iter.get_glyph ());
(this+ligatureSet[iter.get_coverage ()]).collect_glyphs (c);
}
@@ -926,7 +957,11 @@ struct ReverseChainSingleSubstFormat1
const ArrayOf<GlyphID> &substitute = StructAfter<ArrayOf<GlyphID> > (lookahead);
Coverage::Iter iter;
- for (iter.init (this+coverage); iter.more (); iter.next ()) {
+ count = substitute.len;
+ for (iter.init (this+coverage); iter.more (); iter.next ())
+ {
+ if (unlikely (iter.get_coverage () >= count))
+ break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
if (c->glyphs->has (iter.get_glyph ()))
c->glyphs->add (substitute[iter.get_coverage ()]);
}
@@ -970,7 +1005,7 @@ struct ReverseChainSingleSubstFormat1
inline bool apply (hb_apply_context_t *c) const
{
TRACE_APPLY (this);
- if (unlikely (c->nesting_level_left != MAX_NESTING_LEVEL))
+ if (unlikely (c->nesting_level_left != HB_MAX_NESTING_LEVEL))
return_trace (false); /* No chaining to this type */
unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
@@ -1268,7 +1303,6 @@ struct GSUB : GSUBGPOS
{ return CastR<SubstLookup> (GSUBGPOS::get_lookup (i)); }
static inline void substitute_start (hb_font_t *font, hb_buffer_t *buffer);
- static inline void substitute_finish (hb_font_t *font, hb_buffer_t *buffer);
inline bool sanitize (hb_sanitize_context_t *c) const
{
@@ -1277,8 +1311,6 @@ struct GSUB : GSUBGPOS
const OffsetTo<SubstLookupList> &list = CastR<OffsetTo<SubstLookupList> > (lookupList);
return_trace (list.sanitize (c, this));
}
- public:
- DEFINE_SIZE_STATIC (10);
};
@@ -1297,11 +1329,6 @@ GSUB::substitute_start (hb_font_t *font, hb_buffer_t *buffer)
}
}
-void
-GSUB::substitute_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer HB_UNUSED)
-{
-}
-
/* Out-of-class implementation for methods recursing */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsubgpos-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsubgpos-private.hh
index 230b3b6851..fd75c5425a 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsubgpos-private.hh
@@ -74,7 +74,7 @@ struct hb_closure_context_t :
hb_closure_context_t (hb_face_t *face_,
hb_set_t *glyphs_,
- unsigned int nesting_level_left_ = MAX_NESTING_LEVEL) :
+ unsigned int nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
face (face_),
glyphs (glyphs_),
recurse_func (NULL),
@@ -196,7 +196,7 @@ struct hb_collect_glyphs_context_t :
hb_set_t *glyphs_input, /* OUT. May be NULL */
hb_set_t *glyphs_after, /* OUT. May be NULL */
hb_set_t *glyphs_output, /* OUT. May be NULL */
- unsigned int nesting_level_left_ = MAX_NESTING_LEVEL) :
+ unsigned int nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
face (face_),
before (glyphs_before ? glyphs_before : hb_set_get_empty ()),
input (glyphs_input ? glyphs_input : hb_set_get_empty ()),
@@ -319,7 +319,7 @@ struct hb_apply_context_t :
if (!c->check_glyph_property (&info, lookup_props))
return SKIP_YES;
- if (unlikely (_hb_glyph_info_is_default_ignorable (&info) &&
+ if (unlikely (_hb_glyph_info_is_default_ignorable_and_not_fvs (&info) &&
(ignore_zwnj || !_hb_glyph_info_is_zwnj (&info)) &&
(ignore_zwj || !_hb_glyph_info_is_zwj (&info))))
return SKIP_MAYBE;
@@ -469,6 +469,7 @@ struct hb_apply_context_t :
unsigned int lookup_props;
const GDEF &gdef;
bool has_glyph_classes;
+ const VariationStore &var_store;
skipping_iterator_t iter_input, iter_context;
unsigned int lookup_index;
unsigned int debug_depth;
@@ -483,10 +484,11 @@ struct hb_apply_context_t :
lookup_mask (1),
auto_zwj (true),
recurse_func (NULL),
- nesting_level_left (MAX_NESTING_LEVEL),
+ nesting_level_left (HB_MAX_NESTING_LEVEL),
lookup_props (0),
gdef (*hb_ot_layout_from_face (face)->gdef),
has_glyph_classes (gdef.has_glyph_classes ()),
+ var_store (gdef.get_var_store ()),
iter_input (),
iter_context (),
lookup_index ((unsigned int) -1),
@@ -704,13 +706,13 @@ static inline bool match_input (hb_apply_context_t *c,
match_func_t match_func,
const void *match_data,
unsigned int *end_offset,
- unsigned int match_positions[MAX_CONTEXT_LENGTH],
+ unsigned int match_positions[HB_MAX_CONTEXT_LENGTH],
bool *p_is_mark_ligature = NULL,
unsigned int *p_total_component_count = NULL)
{
TRACE_APPLY (NULL);
- if (unlikely (count > MAX_CONTEXT_LENGTH)) return_trace (false);
+ if (unlikely (count > HB_MAX_CONTEXT_LENGTH)) return_trace (false);
hb_buffer_t *buffer = c->buffer;
@@ -784,7 +786,7 @@ static inline bool match_input (hb_apply_context_t *c,
}
static inline bool ligate_input (hb_apply_context_t *c,
unsigned int count, /* Including the first glyph */
- unsigned int match_positions[MAX_CONTEXT_LENGTH], /* Including the first glyph */
+ unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], /* Including the first glyph */
unsigned int match_length,
hb_codepoint_t lig_glyph,
bool is_mark_ligature,
@@ -836,19 +838,21 @@ static inline bool ligate_input (hb_apply_context_t *c,
if (_hb_glyph_info_get_general_category (&buffer->cur()) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
{
_hb_glyph_info_set_general_category (&buffer->cur(), HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER);
- _hb_glyph_info_set_modified_combining_class (&buffer->cur(), 0);
}
}
c->replace_glyph_with_ligature (lig_glyph, klass);
for (unsigned int i = 1; i < count; i++)
{
- while (buffer->idx < match_positions[i])
+ while (buffer->idx < match_positions[i] && !buffer->in_error)
{
if (!is_mark_ligature) {
+ unsigned int this_comp = _hb_glyph_info_get_lig_comp (&buffer->cur());
+ if (this_comp == 0)
+ this_comp = last_num_components;
unsigned int new_lig_comp = components_so_far - last_num_components +
- MIN (MAX (_hb_glyph_info_get_lig_comp (&buffer->cur()), 1u), last_num_components);
- _hb_glyph_info_set_lig_props_for_mark (&buffer->cur(), lig_id, new_lig_comp);
+ MIN (this_comp, last_num_components);
+ _hb_glyph_info_set_lig_props_for_mark (&buffer->cur(), lig_id, new_lig_comp);
}
buffer->next_glyph ();
}
@@ -865,8 +869,11 @@ static inline bool ligate_input (hb_apply_context_t *c,
/* Re-adjust components for any marks following. */
for (unsigned int i = buffer->idx; i < buffer->len; i++) {
if (last_lig_id == _hb_glyph_info_get_lig_id (&buffer->info[i])) {
+ unsigned int this_comp = _hb_glyph_info_get_lig_comp (&buffer->info[i]);
+ if (!this_comp)
+ break;
unsigned int new_lig_comp = components_so_far - last_num_components +
- MIN (MAX (_hb_glyph_info_get_lig_comp (&buffer->info[i]), 1u), last_num_components);
+ MIN (this_comp, last_num_components);
_hb_glyph_info_set_lig_props_for_mark (&buffer->info[i], lig_id, new_lig_comp);
} else
break;
@@ -944,7 +951,7 @@ static inline void recurse_lookups (context_t *c,
static inline bool apply_lookup (hb_apply_context_t *c,
unsigned int count, /* Including the first glyph */
- unsigned int match_positions[MAX_CONTEXT_LENGTH], /* Including the first glyph */
+ unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], /* Including the first glyph */
unsigned int lookupCount,
const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
unsigned int match_length)
@@ -966,12 +973,17 @@ static inline bool apply_lookup (hb_apply_context_t *c,
match_positions[j] += delta;
}
- for (unsigned int i = 0; i < lookupCount; i++)
+ for (unsigned int i = 0; i < lookupCount && !buffer->in_error; i++)
{
unsigned int idx = lookupRecord[i].sequenceIndex;
if (idx >= count)
continue;
+ /* Don't recurse to ourself at same position.
+ * Note that this test is too naive, it doesn't catch longer loops. */
+ if (idx == 0 && lookupRecord[i].lookupListIndex == c->lookup_index)
+ continue;
+
buffer->move_to (match_positions[idx]);
unsigned int orig_len = buffer->backtrack_len () + buffer->lookahead_len ();
@@ -986,16 +998,23 @@ static inline bool apply_lookup (hb_apply_context_t *c,
/* Recursed lookup changed buffer len. Adjust. */
- /* end can't go back past the current match position.
- * Note: this is only true because we do NOT allow MultipleSubst
- * with zero sequence len. */
- end = MAX ((int) match_positions[idx] + 1, int (end) + delta);
+ end = int (end) + delta;
+ if (end <= match_positions[idx])
+ {
+ /* End might end up being smaller than match_positions[idx] if the recursed
+ * lookup ended up removing many items, more than we have had matched.
+ * Just never rewind end back and get out of here.
+ * https://bugs.chromium.org/p/chromium/issues/detail?id=659496 */
+ end = match_positions[idx];
+ /* There can't be any further changes. */
+ break;
+ }
unsigned int next = idx + 1; /* next now is the position after the recursed lookup. */
if (delta > 0)
{
- if (unlikely (delta + count > MAX_CONTEXT_LENGTH))
+ if (unlikely (delta + count > HB_MAX_CONTEXT_LENGTH))
break;
}
else
@@ -1094,7 +1113,7 @@ static inline bool context_apply_lookup (hb_apply_context_t *c,
ContextApplyLookupContext &lookup_context)
{
unsigned int match_length = 0;
- unsigned int match_positions[MAX_CONTEXT_LENGTH];
+ unsigned int match_positions[HB_MAX_CONTEXT_LENGTH];
return match_input (c,
inputCount, input,
lookup_context.funcs.match, lookup_context.match_data,
@@ -1621,7 +1640,7 @@ static inline bool chain_context_apply_lookup (hb_apply_context_t *c,
ChainContextApplyLookupContext &lookup_context)
{
unsigned int match_length = 0;
- unsigned int match_positions[MAX_CONTEXT_LENGTH];
+ unsigned int match_positions[HB_MAX_CONTEXT_LENGTH];
return match_input (c,
inputCount, input,
lookup_context.funcs.match, lookup_context.match_data[1],
@@ -2256,6 +2275,24 @@ struct GSUBGPOS
inline const Lookup& get_lookup (unsigned int i) const
{ return (this+lookupList)[i]; }
+ inline bool find_variations_index (const int *coords, unsigned int num_coords,
+ unsigned int *index) const
+ { return (version.to_int () >= 0x00010001u ? this+featureVars : Null(FeatureVariations))
+ .find_index (coords, num_coords, index); }
+ inline const Feature& get_feature_variation (unsigned int feature_index,
+ unsigned int variations_index) const
+ {
+ if (FeatureVariations::NOT_FOUND_INDEX != variations_index &&
+ version.to_int () >= 0x00010001u)
+ {
+ const Feature *feature = (this+featureVars).find_substitute (variations_index,
+ feature_index);
+ if (feature)
+ return *feature;
+ }
+ return get_feature (feature_index);
+ }
+
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@@ -2263,11 +2300,12 @@ struct GSUBGPOS
likely (version.major == 1) &&
scriptList.sanitize (c, this) &&
featureList.sanitize (c, this) &&
- lookupList.sanitize (c, this));
+ lookupList.sanitize (c, this) &&
+ (version.to_int () < 0x00010001u || featureVars.sanitize (c, this)));
}
protected:
- FixedVersion version; /* Version of the GSUB/GPOS table--initially set
+ FixedVersion<>version; /* Version of the GSUB/GPOS table--initially set
* to 0x00010000u */
OffsetTo<ScriptList>
scriptList; /* ScriptList table */
@@ -2275,8 +2313,13 @@ struct GSUBGPOS
featureList; /* FeatureList table */
OffsetTo<LookupList>
lookupList; /* LookupList table */
+ OffsetTo<FeatureVariations, ULONG>
+ featureVars; /* Offset to Feature Variations
+ table--from beginning of table
+ * (may be NULL). Introduced
+ * in version 0x00010001. */
public:
- DEFINE_SIZE_STATIC (10);
+ DEFINE_SIZE_MIN (10);
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-jstf-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-jstf-table.hh
index 7e199c2e14..c3068491be 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-jstf-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-jstf-table.hh
@@ -218,7 +218,7 @@ struct JSTF
}
protected:
- FixedVersion version; /* Version of the JSTF table--initially set
+ FixedVersion<>version; /* Version of the JSTF table--initially set
* to 0x00010000u */
RecordArrayOf<JstfScript>
scriptList; /* Array of JstfScripts--listed
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-math-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-math-table.hh
new file mode 100644
index 0000000000..b52b1215d2
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-math-table.hh
@@ -0,0 +1,722 @@
+/*
+ * Copyright © 2016 Igalia S.L.
+ *
+ * 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.
+ *
+ * Igalia Author(s): Frédéric Wang
+ */
+
+#ifndef HB_OT_LAYOUT_MATH_TABLE_HH
+#define HB_OT_LAYOUT_MATH_TABLE_HH
+
+#include "hb-open-type-private.hh"
+#include "hb-ot-layout-common-private.hh"
+#include "hb-ot-math.h"
+
+namespace OT {
+
+
+struct MathValueRecord
+{
+ inline hb_position_t get_x_value (hb_font_t *font, const void *base) const
+ { return font->em_scale_x (value) + (base+deviceTable).get_x_delta (font); }
+ inline hb_position_t get_y_value (hb_font_t *font, const void *base) const
+ { return font->em_scale_y (value) + (base+deviceTable).get_y_delta (font); }
+
+ inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) && deviceTable.sanitize (c, base));
+ }
+
+ protected:
+ SHORT value; /* The X or Y value in design units */
+ OffsetTo<Device> deviceTable; /* Offset to the device table - from the
+ * beginning of parent table. May be NULL.
+ * Suggested format for device table is 1. */
+
+ public:
+ DEFINE_SIZE_STATIC (4);
+};
+
+struct MathConstants
+{
+ inline bool sanitize_math_value_records (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+
+ unsigned int count = ARRAY_LENGTH (mathValueRecords);
+ for (unsigned int i = 0; i < count; i++)
+ if (!mathValueRecords[i].sanitize (c, this))
+ return_trace (false);
+
+ return_trace (true);
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) && sanitize_math_value_records(c));
+ }
+
+ inline hb_position_t get_value (hb_ot_math_constant_t constant,
+ hb_font_t *font) const
+ {
+ switch (constant) {
+
+ case HB_OT_MATH_CONSTANT_SCRIPT_PERCENT_SCALE_DOWN:
+ case HB_OT_MATH_CONSTANT_SCRIPT_SCRIPT_PERCENT_SCALE_DOWN:
+ return percentScaleDown[constant - HB_OT_MATH_CONSTANT_SCRIPT_PERCENT_SCALE_DOWN];
+
+ case HB_OT_MATH_CONSTANT_DELIMITED_SUB_FORMULA_MIN_HEIGHT:
+ case HB_OT_MATH_CONSTANT_DISPLAY_OPERATOR_MIN_HEIGHT:
+ return font->em_scale_y (minHeight[constant - HB_OT_MATH_CONSTANT_DELIMITED_SUB_FORMULA_MIN_HEIGHT]);
+
+ case HB_OT_MATH_CONSTANT_RADICAL_KERN_AFTER_DEGREE:
+ case HB_OT_MATH_CONSTANT_RADICAL_KERN_BEFORE_DEGREE:
+ case HB_OT_MATH_CONSTANT_SKEWED_FRACTION_HORIZONTAL_GAP:
+ case HB_OT_MATH_CONSTANT_SPACE_AFTER_SCRIPT:
+ return mathValueRecords[constant - HB_OT_MATH_CONSTANT_MATH_LEADING].get_x_value(font, this);
+
+ case HB_OT_MATH_CONSTANT_ACCENT_BASE_HEIGHT:
+ case HB_OT_MATH_CONSTANT_AXIS_HEIGHT:
+ case HB_OT_MATH_CONSTANT_FLATTENED_ACCENT_BASE_HEIGHT:
+ case HB_OT_MATH_CONSTANT_FRACTION_DENOMINATOR_DISPLAY_STYLE_SHIFT_DOWN:
+ case HB_OT_MATH_CONSTANT_FRACTION_DENOMINATOR_GAP_MIN:
+ case HB_OT_MATH_CONSTANT_FRACTION_DENOMINATOR_SHIFT_DOWN:
+ case HB_OT_MATH_CONSTANT_FRACTION_DENOM_DISPLAY_STYLE_GAP_MIN:
+ case HB_OT_MATH_CONSTANT_FRACTION_NUMERATOR_DISPLAY_STYLE_SHIFT_UP:
+ case HB_OT_MATH_CONSTANT_FRACTION_NUMERATOR_GAP_MIN:
+ case HB_OT_MATH_CONSTANT_FRACTION_NUMERATOR_SHIFT_UP:
+ case HB_OT_MATH_CONSTANT_FRACTION_NUM_DISPLAY_STYLE_GAP_MIN:
+ case HB_OT_MATH_CONSTANT_FRACTION_RULE_THICKNESS:
+ case HB_OT_MATH_CONSTANT_LOWER_LIMIT_BASELINE_DROP_MIN:
+ case HB_OT_MATH_CONSTANT_LOWER_LIMIT_GAP_MIN:
+ case HB_OT_MATH_CONSTANT_MATH_LEADING:
+ case HB_OT_MATH_CONSTANT_OVERBAR_EXTRA_ASCENDER:
+ case HB_OT_MATH_CONSTANT_OVERBAR_RULE_THICKNESS:
+ case HB_OT_MATH_CONSTANT_OVERBAR_VERTICAL_GAP:
+ case HB_OT_MATH_CONSTANT_RADICAL_DISPLAY_STYLE_VERTICAL_GAP:
+ case HB_OT_MATH_CONSTANT_RADICAL_EXTRA_ASCENDER:
+ case HB_OT_MATH_CONSTANT_RADICAL_RULE_THICKNESS:
+ case HB_OT_MATH_CONSTANT_RADICAL_VERTICAL_GAP:
+ case HB_OT_MATH_CONSTANT_SKEWED_FRACTION_VERTICAL_GAP:
+ case HB_OT_MATH_CONSTANT_STACK_BOTTOM_DISPLAY_STYLE_SHIFT_DOWN:
+ case HB_OT_MATH_CONSTANT_STACK_BOTTOM_SHIFT_DOWN:
+ case HB_OT_MATH_CONSTANT_STACK_DISPLAY_STYLE_GAP_MIN:
+ case HB_OT_MATH_CONSTANT_STACK_GAP_MIN:
+ case HB_OT_MATH_CONSTANT_STACK_TOP_DISPLAY_STYLE_SHIFT_UP:
+ case HB_OT_MATH_CONSTANT_STACK_TOP_SHIFT_UP:
+ case HB_OT_MATH_CONSTANT_STRETCH_STACK_BOTTOM_SHIFT_DOWN:
+ case HB_OT_MATH_CONSTANT_STRETCH_STACK_GAP_ABOVE_MIN:
+ case HB_OT_MATH_CONSTANT_STRETCH_STACK_GAP_BELOW_MIN:
+ case HB_OT_MATH_CONSTANT_STRETCH_STACK_TOP_SHIFT_UP:
+ case HB_OT_MATH_CONSTANT_SUBSCRIPT_BASELINE_DROP_MIN:
+ case HB_OT_MATH_CONSTANT_SUBSCRIPT_SHIFT_DOWN:
+ case HB_OT_MATH_CONSTANT_SUBSCRIPT_TOP_MAX:
+ case HB_OT_MATH_CONSTANT_SUB_SUPERSCRIPT_GAP_MIN:
+ case HB_OT_MATH_CONSTANT_SUPERSCRIPT_BASELINE_DROP_MAX:
+ case HB_OT_MATH_CONSTANT_SUPERSCRIPT_BOTTOM_MAX_WITH_SUBSCRIPT:
+ case HB_OT_MATH_CONSTANT_SUPERSCRIPT_BOTTOM_MIN:
+ case HB_OT_MATH_CONSTANT_SUPERSCRIPT_SHIFT_UP:
+ case HB_OT_MATH_CONSTANT_SUPERSCRIPT_SHIFT_UP_CRAMPED:
+ case HB_OT_MATH_CONSTANT_UNDERBAR_EXTRA_DESCENDER:
+ case HB_OT_MATH_CONSTANT_UNDERBAR_RULE_THICKNESS:
+ case HB_OT_MATH_CONSTANT_UNDERBAR_VERTICAL_GAP:
+ case HB_OT_MATH_CONSTANT_UPPER_LIMIT_BASELINE_RISE_MIN:
+ case HB_OT_MATH_CONSTANT_UPPER_LIMIT_GAP_MIN:
+ return mathValueRecords[constant - HB_OT_MATH_CONSTANT_MATH_LEADING].get_y_value(font, this);
+
+ case HB_OT_MATH_CONSTANT_RADICAL_DEGREE_BOTTOM_RAISE_PERCENT:
+ return radicalDegreeBottomRaisePercent;
+
+ default:
+ return 0;
+ }
+ }
+
+ protected:
+ SHORT percentScaleDown[2];
+ USHORT minHeight[2];
+ MathValueRecord mathValueRecords[51];
+ SHORT radicalDegreeBottomRaisePercent;
+
+ public:
+ DEFINE_SIZE_STATIC (214);
+};
+
+struct MathItalicsCorrectionInfo
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ coverage.sanitize (c, this) &&
+ italicsCorrection.sanitize (c, this));
+ }
+
+ inline hb_position_t get_value (hb_codepoint_t glyph,
+ hb_font_t *font) const
+ {
+ unsigned int index = (this+coverage).get_coverage (glyph);
+ return italicsCorrection[index].get_x_value (font, this);
+ }
+
+ protected:
+ OffsetTo<Coverage> coverage; /* Offset to Coverage table -
+ * from the beginning of
+ * MathItalicsCorrectionInfo
+ * table. */
+ ArrayOf<MathValueRecord> italicsCorrection; /* Array of MathValueRecords
+ * defining italics correction
+ * values for each
+ * covered glyph. */
+
+ public:
+ DEFINE_SIZE_ARRAY (4, italicsCorrection);
+};
+
+struct MathTopAccentAttachment
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ topAccentCoverage.sanitize (c, this) &&
+ topAccentAttachment.sanitize (c, this));
+ }
+
+ inline hb_position_t get_value (hb_codepoint_t glyph,
+ hb_font_t *font) const
+ {
+ unsigned int index = (this+topAccentCoverage).get_coverage (glyph);
+ if (index == NOT_COVERED)
+ return font->get_glyph_h_advance (glyph) / 2;
+ return topAccentAttachment[index].get_x_value(font, this);
+ }
+
+ protected:
+ OffsetTo<Coverage> topAccentCoverage; /* Offset to Coverage table -
+ * from the beginning of
+ * MathTopAccentAttachment
+ * table. */
+ ArrayOf<MathValueRecord> topAccentAttachment; /* Array of MathValueRecords
+ * defining top accent
+ * attachment points for each
+ * covered glyph. */
+
+ public:
+ DEFINE_SIZE_ARRAY (2 + 2, topAccentAttachment);
+};
+
+struct MathKern
+{
+ inline bool sanitize_math_value_records (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ unsigned int count = 2 * heightCount + 1;
+ for (unsigned int i = 0; i < count; i++)
+ if (!mathValueRecords[i].sanitize (c, this)) return_trace (false);
+ return_trace (true);
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ c->check_array (mathValueRecords,
+ mathValueRecords[0].static_size,
+ 2 * heightCount + 1) &&
+ sanitize_math_value_records (c));
+ }
+
+ inline hb_position_t get_value (hb_position_t correction_height, hb_font_t *font) const
+ {
+ const MathValueRecord* correctionHeight = mathValueRecords;
+ const MathValueRecord* kernValue = mathValueRecords + heightCount;
+ int sign = font->y_scale < 0 ? -1 : +1;
+
+ /* The description of the MathKern table is a ambiguous, but interpreting
+ * "between the two heights found at those indexes" for 0 < i < len as
+ *
+ * correctionHeight[i-1] < correction_height <= correctionHeight[i]
+ *
+ * makes the result consistent with the limit cases and we can just use the
+ * binary search algorithm of std::upper_bound:
+ */
+ unsigned int i = 0;
+ unsigned int count = heightCount;
+ while (count > 0)
+ {
+ unsigned int half = count / 2;
+ hb_position_t height = correctionHeight[i + half].get_y_value(font, this);
+ if (sign * height < sign * correction_height)
+ {
+ i += half + 1;
+ count -= half + 1;
+ } else
+ count = half;
+ }
+ return kernValue[i].get_x_value(font, this);
+ }
+
+ protected:
+ USHORT heightCount;
+ MathValueRecord mathValueRecords[VAR]; /* Array of correction heights at
+ * which the kern value changes.
+ * Sorted by the height value in
+ * design units (heightCount entries),
+ * Followed by:
+ * Array of kern values corresponding
+ * to heights. (heightCount+1 entries).
+ */
+
+ public:
+ DEFINE_SIZE_ARRAY (2, mathValueRecords);
+};
+
+struct MathKernInfoRecord
+{
+ inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
+ {
+ TRACE_SANITIZE (this);
+
+ unsigned int count = ARRAY_LENGTH (mathKern);
+ for (unsigned int i = 0; i < count; i++)
+ if (unlikely (!mathKern[i].sanitize (c, base)))
+ return_trace (false);
+
+ return_trace (true);
+ }
+
+ inline hb_position_t get_kerning (hb_ot_math_kern_t kern,
+ hb_position_t correction_height,
+ hb_font_t *font,
+ const void *base) const
+ {
+ unsigned int idx = kern;
+ if (unlikely (idx >= ARRAY_LENGTH (mathKern))) return 0;
+ return (base+mathKern[idx]).get_value (correction_height, font);
+ }
+
+ protected:
+ /* Offset to MathKern table for each corner -
+ * from the beginning of MathKernInfo table. May be NULL. */
+ OffsetTo<MathKern> mathKern[4];
+
+ public:
+ DEFINE_SIZE_STATIC (8);
+};
+
+struct MathKernInfo
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ mathKernCoverage.sanitize (c, this) &&
+ mathKernInfoRecords.sanitize (c, this));
+ }
+
+ inline hb_position_t get_kerning (hb_codepoint_t glyph,
+ hb_ot_math_kern_t kern,
+ hb_position_t correction_height,
+ hb_font_t *font) const
+ {
+ unsigned int index = (this+mathKernCoverage).get_coverage (glyph);
+ return mathKernInfoRecords[index].get_kerning (kern, correction_height, font, this);
+ }
+
+ protected:
+ OffsetTo<Coverage> mathKernCoverage; /* Offset to Coverage table -
+ * from the beginning of the
+ * MathKernInfo table. */
+ ArrayOf<MathKernInfoRecord> mathKernInfoRecords; /* Array of
+ * MathKernInfoRecords,
+ * per-glyph information for
+ * mathematical positioning
+ * of subscripts and
+ * superscripts. */
+
+ public:
+ DEFINE_SIZE_ARRAY (4, mathKernInfoRecords);
+};
+
+struct MathGlyphInfo
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ mathItalicsCorrectionInfo.sanitize (c, this) &&
+ mathTopAccentAttachment.sanitize (c, this) &&
+ extendedShapeCoverage.sanitize (c, this) &&
+ mathKernInfo.sanitize(c, this));
+ }
+
+ inline hb_position_t
+ get_italics_correction (hb_codepoint_t glyph, hb_font_t *font) const
+ { return (this+mathItalicsCorrectionInfo).get_value (glyph, font); }
+
+ inline hb_position_t
+ get_top_accent_attachment (hb_codepoint_t glyph, hb_font_t *font) const
+ { return (this+mathTopAccentAttachment).get_value (glyph, font); }
+
+ inline bool is_extended_shape (hb_codepoint_t glyph) const
+ { return (this+extendedShapeCoverage).get_coverage (glyph) != NOT_COVERED; }
+
+ inline hb_position_t get_kerning (hb_codepoint_t glyph,
+ hb_ot_math_kern_t kern,
+ hb_position_t correction_height,
+ hb_font_t *font) const
+ { return (this+mathKernInfo).get_kerning (glyph, kern, correction_height, font); }
+
+ protected:
+ /* Offset to MathItalicsCorrectionInfo table -
+ * from the beginning of MathGlyphInfo table. */
+ OffsetTo<MathItalicsCorrectionInfo> mathItalicsCorrectionInfo;
+
+ /* Offset to MathTopAccentAttachment table -
+ * from the beginning of MathGlyphInfo table. */
+ OffsetTo<MathTopAccentAttachment> mathTopAccentAttachment;
+
+ /* Offset to coverage table for Extended Shape glyphs -
+ * from the beginning of MathGlyphInfo table. When the left or right glyph of
+ * a box is an extended shape variant, the (ink) box (and not the default
+ * position defined by values in MathConstants table) should be used for
+ * vertical positioning purposes. May be NULL.. */
+ OffsetTo<Coverage> extendedShapeCoverage;
+
+ /* Offset to MathKernInfo table -
+ * from the beginning of MathGlyphInfo table. */
+ OffsetTo<MathKernInfo> mathKernInfo;
+
+ public:
+ DEFINE_SIZE_STATIC (8);
+};
+
+struct MathGlyphVariantRecord
+{
+ friend struct MathGlyphConstruction;
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ protected:
+ GlyphID variantGlyph; /* Glyph ID for the variant. */
+ USHORT advanceMeasurement; /* Advance width/height, in design units, of the
+ * variant, in the direction of requested
+ * glyph extension. */
+
+ public:
+ DEFINE_SIZE_STATIC (4);
+};
+
+struct PartFlags : USHORT
+{
+ enum Flags {
+ Extender = 0x0001u, /* If set, the part can be skipped or repeated. */
+
+ Defined = 0x0001u, /* All defined flags. */
+ };
+
+ public:
+ DEFINE_SIZE_STATIC (2);
+};
+
+struct MathGlyphPartRecord
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ inline void extract (hb_ot_math_glyph_part_t &out,
+ int scale,
+ hb_font_t *font) const
+ {
+ out.glyph = glyph;
+
+ out.start_connector_length = font->em_scale (startConnectorLength, scale);
+ out.end_connector_length = font->em_scale (endConnectorLength, scale);
+ out.full_advance = font->em_scale (fullAdvance, scale);
+
+ ASSERT_STATIC ((unsigned int) HB_MATH_GLYPH_PART_FLAG_EXTENDER ==
+ (unsigned int) PartFlags::Extender);
+
+ out.flags = (hb_ot_math_glyph_part_flags_t)
+ (unsigned int)
+ (partFlags & PartFlags::Defined);
+ }
+
+ protected:
+ GlyphID glyph; /* Glyph ID for the part. */
+ USHORT startConnectorLength; /* Advance width/ height of the straight bar
+ * connector material, in design units, is at
+ * the beginning of the glyph, in the
+ * direction of the extension. */
+ USHORT endConnectorLength; /* Advance width/ height of the straight bar
+ * connector material, in design units, is at
+ * the end of the glyph, in the direction of
+ * the extension. */
+ USHORT fullAdvance; /* Full advance width/height for this part,
+ * in the direction of the extension.
+ * In design units. */
+ PartFlags partFlags; /* Part qualifiers. */
+
+ public:
+ DEFINE_SIZE_STATIC (10);
+};
+
+struct MathGlyphAssembly
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ italicsCorrection.sanitize(c, this) &&
+ partRecords.sanitize(c));
+ }
+
+ inline unsigned int get_parts (hb_direction_t direction,
+ hb_font_t *font,
+ unsigned int start_offset,
+ unsigned int *parts_count, /* IN/OUT */
+ hb_ot_math_glyph_part_t *parts /* OUT */,
+ hb_position_t *italics_correction /* OUT */) const
+ {
+ if (parts_count)
+ {
+ int scale = font->dir_scale (direction);
+ const MathGlyphPartRecord *arr =
+ partRecords.sub_array (start_offset, parts_count);
+ unsigned int count = *parts_count;
+ for (unsigned int i = 0; i < count; i++)
+ arr[i].extract (parts[i], scale, font);
+ }
+
+ if (italics_correction)
+ *italics_correction = italicsCorrection.get_x_value (font, this);
+
+ return partRecords.len;
+ }
+
+ protected:
+ MathValueRecord italicsCorrection; /* Italics correction of this
+ * MathGlyphAssembly. Should not
+ * depend on the assembly size. */
+ ArrayOf<MathGlyphPartRecord> partRecords; /* Array of part records, from
+ * left to right and bottom to
+ * top. */
+
+ public:
+ DEFINE_SIZE_ARRAY (6, partRecords);
+};
+
+struct MathGlyphConstruction
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ glyphAssembly.sanitize(c, this) &&
+ mathGlyphVariantRecord.sanitize(c));
+ }
+
+ inline const MathGlyphAssembly &get_assembly (void) const
+ { return this+glyphAssembly; }
+
+ inline unsigned int get_variants (hb_direction_t direction,
+ hb_font_t *font,
+ unsigned int start_offset,
+ unsigned int *variants_count, /* IN/OUT */
+ hb_ot_math_glyph_variant_t *variants /* OUT */) const
+ {
+ if (variants_count)
+ {
+ int scale = font->dir_scale (direction);
+ const MathGlyphVariantRecord *arr =
+ mathGlyphVariantRecord.sub_array (start_offset, variants_count);
+ unsigned int count = *variants_count;
+ for (unsigned int i = 0; i < count; i++)
+ {
+ variants[i].glyph = arr[i].variantGlyph;
+ variants[i].advance = font->em_scale (arr[i].advanceMeasurement, scale);
+ }
+ }
+ return mathGlyphVariantRecord.len;
+ }
+
+ protected:
+ /* Offset to MathGlyphAssembly table for this shape - from the beginning of
+ MathGlyphConstruction table. May be NULL. */
+ OffsetTo<MathGlyphAssembly> glyphAssembly;
+
+ /* MathGlyphVariantRecords for alternative variants of the glyphs. */
+ ArrayOf<MathGlyphVariantRecord> mathGlyphVariantRecord;
+
+ public:
+ DEFINE_SIZE_ARRAY (4, mathGlyphVariantRecord);
+};
+
+struct MathVariants
+{
+ inline bool sanitize_offsets (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ unsigned int count = vertGlyphCount + horizGlyphCount;
+ for (unsigned int i = 0; i < count; i++)
+ if (!glyphConstruction[i].sanitize (c, this)) return_trace (false);
+ return_trace (true);
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ vertGlyphCoverage.sanitize (c, this) &&
+ horizGlyphCoverage.sanitize (c, this) &&
+ c->check_array (glyphConstruction,
+ glyphConstruction[0].static_size,
+ vertGlyphCount + horizGlyphCount) &&
+ sanitize_offsets (c));
+ }
+
+ inline hb_position_t get_min_connector_overlap (hb_direction_t direction,
+ hb_font_t *font) const
+ { return font->em_scale_dir (minConnectorOverlap, direction); }
+
+ inline unsigned int get_glyph_variants (hb_codepoint_t glyph,
+ hb_direction_t direction,
+ hb_font_t *font,
+ unsigned int start_offset,
+ unsigned int *variants_count, /* IN/OUT */
+ hb_ot_math_glyph_variant_t *variants /* OUT */) const
+ { return get_glyph_construction (glyph, direction, font)
+ .get_variants (direction, font, start_offset, variants_count, variants); }
+
+ inline unsigned int get_glyph_parts (hb_codepoint_t glyph,
+ hb_direction_t direction,
+ hb_font_t *font,
+ unsigned int start_offset,
+ unsigned int *parts_count, /* IN/OUT */
+ hb_ot_math_glyph_part_t *parts /* OUT */,
+ hb_position_t *italics_correction /* OUT */) const
+ { return get_glyph_construction (glyph, direction, font)
+ .get_assembly ()
+ .get_parts (direction, font,
+ start_offset, parts_count, parts,
+ italics_correction); }
+
+ private:
+ inline const MathGlyphConstruction &
+ get_glyph_construction (hb_codepoint_t glyph,
+ hb_direction_t direction,
+ hb_font_t *font) const
+ {
+ bool vertical = HB_DIRECTION_IS_VERTICAL (direction);
+ unsigned int count = vertical ? vertGlyphCount : horizGlyphCount;
+ const OffsetTo<Coverage> &coverage = vertical ? vertGlyphCoverage
+ : horizGlyphCoverage;
+
+ unsigned int index = (this+coverage).get_coverage (glyph);
+ if (unlikely (index >= count)) return Null(MathGlyphConstruction);
+
+ if (!vertical)
+ index += vertGlyphCount;
+
+ return this+glyphConstruction[index];
+ }
+
+ protected:
+ USHORT minConnectorOverlap; /* Minimum overlap of connecting
+ * glyphs during glyph construction,
+ * in design units. */
+ OffsetTo<Coverage> vertGlyphCoverage; /* Offset to Coverage table -
+ * from the beginning of MathVariants
+ * table. */
+ OffsetTo<Coverage> horizGlyphCoverage; /* Offset to Coverage table -
+ * from the beginning of MathVariants
+ * table. */
+ USHORT vertGlyphCount; /* Number of glyphs for which
+ * information is provided for
+ * vertically growing variants. */
+ USHORT horizGlyphCount; /* Number of glyphs for which
+ * information is provided for
+ * horizontally growing variants. */
+
+ /* Array of offsets to MathGlyphConstruction tables - from the beginning of
+ the MathVariants table, for shapes growing in vertical/horizontal
+ direction. */
+ OffsetTo<MathGlyphConstruction> glyphConstruction[VAR];
+
+ public:
+ DEFINE_SIZE_ARRAY (10, glyphConstruction);
+};
+
+
+/*
+ * MATH -- The MATH Table
+ */
+
+struct MATH
+{
+ static const hb_tag_t tableTag = HB_OT_TAG_MATH;
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (version.sanitize (c) &&
+ likely (version.major == 1) &&
+ mathConstants.sanitize (c, this) &&
+ mathGlyphInfo.sanitize (c, this) &&
+ mathVariants.sanitize (c, this));
+ }
+
+ inline hb_position_t get_constant (hb_ot_math_constant_t constant,
+ hb_font_t *font) const
+ { return (this+mathConstants).get_value (constant, font); }
+
+ inline const MathGlyphInfo &get_math_glyph_info (void) const
+ { return this+mathGlyphInfo; }
+
+ inline const MathVariants &get_math_variants (void) const
+ { return this+mathVariants; }
+
+ protected:
+ FixedVersion<>version; /* Version of the MATH table
+ * initially set to 0x00010000u */
+ OffsetTo<MathConstants> mathConstants;/* MathConstants table */
+ OffsetTo<MathGlyphInfo> mathGlyphInfo;/* MathGlyphInfo table */
+ OffsetTo<MathVariants> mathVariants; /* MathVariants table */
+
+ public:
+ DEFINE_SIZE_STATIC (10);
+};
+
+} /* mathspace OT */
+
+
+#endif /* HB_OT_LAYOUT_MATH_TABLE_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-private.hh
index d168e27f53..a4272de631 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-private.hh
@@ -49,7 +49,7 @@ hb_ot_layout_table_find_feature (hb_face_t *face,
* GDEF
*/
-typedef enum
+enum hb_ot_layout_glyph_props_flags_t
{
/* The following three match LookupFlags::Ignore* numbers. */
HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH = 0x02u,
@@ -64,7 +64,8 @@ typedef enum
HB_OT_LAYOUT_GLYPH_PROPS_PRESERVE = HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED |
HB_OT_LAYOUT_GLYPH_PROPS_LIGATED |
HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED
-} hb_ot_layout_glyph_class_mask_t;
+};
+HB_MARK_AS_FLAG_T (hb_ot_layout_glyph_props_flags_t);
/*
@@ -98,21 +99,20 @@ hb_ot_layout_substitute_lookup (OT::hb_apply_context_t *c,
const hb_ot_layout_lookup_accelerator_t &accel);
-/* Should be called after all the substitute_lookup's are done */
-HB_INTERNAL void
-hb_ot_layout_substitute_finish (hb_font_t *font,
- hb_buffer_t *buffer);
-
-
-/* Should be called before all the position_lookup's are done. Resets positions to zero. */
+/* Should be called before all the position_lookup's are done. */
HB_INTERNAL void
hb_ot_layout_position_start (hb_font_t *font,
hb_buffer_t *buffer);
-/* Should be called after all the position_lookup's are done */
+/* Should be called after all the position_lookup's are done, to finish advances. */
+HB_INTERNAL void
+hb_ot_layout_position_finish_advances (hb_font_t *font,
+ hb_buffer_t *buffer);
+
+/* Should be called after hb_ot_layout_position_finish_advances, to finish offsets. */
HB_INTERNAL void
-hb_ot_layout_position_finish (hb_font_t *font,
- hb_buffer_t *buffer);
+hb_ot_layout_position_finish_offsets (hb_font_t *font,
+ hb_buffer_t *buffer);
@@ -124,6 +124,7 @@ namespace OT {
struct GDEF;
struct GSUB;
struct GPOS;
+ struct MATH;
}
struct hb_ot_layout_lookup_accelerator_t
@@ -152,10 +153,12 @@ struct hb_ot_layout_t
hb_blob_t *gdef_blob;
hb_blob_t *gsub_blob;
hb_blob_t *gpos_blob;
+ hb_blob_t *math_blob;
const struct OT::GDEF *gdef;
const struct OT::GSUB *gsub;
const struct OT::GPOS *gpos;
+ const struct OT::MATH *math;
unsigned int gsub_lookup_count;
unsigned int gpos_lookup_count;
@@ -180,8 +183,7 @@ _hb_ot_layout_destroy (hb_ot_layout_t *layout);
*/
/* buffer var allocations, used during the entire shaping process */
-#define unicode_props0() var2.u8[0]
-#define unicode_props1() var2.u8[1]
+#define unicode_props() var2.u16[0]
/* buffer var allocations, used during the GSUB/GPOS processing */
#define glyph_props() var1.u16[0] /* GDEF glyph properties */
@@ -214,48 +216,146 @@ _next_syllable (hb_buffer_t *buffer, unsigned int start)
/* unicode_props */
-enum {
- MASK0_ZWJ = 0x20u,
- MASK0_ZWNJ = 0x40u,
- MASK0_IGNORABLE = 0x80u,
- MASK0_GEN_CAT = 0x1Fu
+/* Design:
+ * unicode_props() is a two-byte number. The low byte includes:
+ * - General_Category: 5 bits.
+ * - A bit each for:
+ * * Is it Default_Ignorable(); we have a modified Default_Ignorable().
+ * * Whether it's one of the three Mongolian Free Variation Selectors.
+ * * One free bit right now.
+ *
+ * The high-byte has different meanings, switched by the Gen-Cat:
+ * - For Mn,Mc,Me: the modified Combining_Class.
+ * - For Cf: whether it's ZWJ, ZWNJ, or something else.
+ * - For Ws: index of which space character this is, if space fallback
+ * is needed, ie. we don't set this by default, only if asked to.
+ */
+
+enum hb_unicode_props_flags_t {
+ UPROPS_MASK_GEN_CAT = 0x001Fu,
+ UPROPS_MASK_IGNORABLE = 0x0020u,
+ UPROPS_MASK_FVS = 0x0040u, /* MONGOLIAN FREE VARIATION SELECTOR 1..3 */
+
+ /* If GEN_CAT=FORMAT, top byte masks: */
+ UPROPS_MASK_Cf_ZWJ = 0x0100u,
+ UPROPS_MASK_Cf_ZWNJ = 0x0200u
};
+HB_MARK_AS_FLAG_T (hb_unicode_props_flags_t);
static inline void
-_hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *unicode)
+_hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer)
{
- /* XXX This shouldn't be inlined, or at least not while is_default_ignorable() is inline. */
- info->unicode_props0() = ((unsigned int) unicode->general_category (info->codepoint)) |
- (unicode->is_default_ignorable (info->codepoint) ? MASK0_IGNORABLE : 0) |
- (info->codepoint == 0x200Cu ? MASK0_ZWNJ : 0) |
- (info->codepoint == 0x200Du ? MASK0_ZWJ : 0);
- info->unicode_props1() = unicode->modified_combining_class (info->codepoint);
+ hb_unicode_funcs_t *unicode = buffer->unicode;
+ unsigned int u = info->codepoint;
+ unsigned int gen_cat = (unsigned int) unicode->general_category (u);
+ unsigned int props = gen_cat;
+
+ if (u >= 0x80)
+ {
+ buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII;
+ if (unlikely (unicode->is_default_ignorable (u)))
+ {
+ buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES;
+ props |= UPROPS_MASK_IGNORABLE;
+ if (u == 0x200Cu) props |= UPROPS_MASK_Cf_ZWNJ;
+ if (u == 0x200Du) props |= UPROPS_MASK_Cf_ZWJ;
+ /* Mongolian Free Variation Selectors need to be remembered
+ * because although we need to hide them like default-ignorables,
+ * they need to non-ignorable during shaping. This is similar to
+ * what we do for joiners in Indic-like shapers, but since the
+ * FVSes are GC=Mn, we have use a separate bit to remember them.
+ * Fixes:
+ * https://github.com/behdad/harfbuzz/issues/234
+ */
+ if (unlikely (hb_in_range (u, 0x180Bu, 0x180Du))) props |= UPROPS_MASK_FVS;
+ }
+ else if (unlikely (HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK_OR_MODIFIER_SYMBOL (gen_cat)))
+ {
+ /* The above check is just an optimization to let in only things we need further
+ * processing on. */
+
+ /* Only Mn and Mc can have non-zero ccc:
+ * http://www.unicode.org/policies/stability_policy.html#Property_Value
+ * """
+ * Canonical_Combining_Class, General_Category
+ * All characters other than those with General_Category property values
+ * Spacing_Mark (Mc) and Nonspacing_Mark (Mn) have the Canonical_Combining_Class
+ * property value 0.
+ * 1.1.5+
+ * """
+ *
+ * Also, all Mn's that are Default_Ignorable, have ccc=0, hence
+ * the "else if".
+ */
+ props |= unicode->modified_combining_class (info->codepoint)<<8;
+
+ /* Recategorize emoji skin-tone modifiers as Unicode mark, so they
+ * behave correctly in non-native directionality. They originally
+ * are MODIFIER_SYMBOL. Fixes:
+ * https://github.com/behdad/harfbuzz/issues/169
+ */
+ if (unlikely (hb_in_range (u, 0x1F3FBu, 0x1F3FFu)))
+ {
+ props = gen_cat = HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK;
+ }
+ }
+ }
+
+ info->unicode_props() = props;
}
static inline void
_hb_glyph_info_set_general_category (hb_glyph_info_t *info,
hb_unicode_general_category_t gen_cat)
{
- info->unicode_props0() = (unsigned int) gen_cat | ((info->unicode_props0()) & ~MASK0_GEN_CAT);
+ /* Clears top-byte. */
+ info->unicode_props() = (unsigned int) gen_cat | (info->unicode_props() & (0xFF & ~UPROPS_MASK_GEN_CAT));
}
static inline hb_unicode_general_category_t
_hb_glyph_info_get_general_category (const hb_glyph_info_t *info)
{
- return (hb_unicode_general_category_t) (info->unicode_props0() & MASK0_GEN_CAT);
+ return (hb_unicode_general_category_t) (info->unicode_props() & UPROPS_MASK_GEN_CAT);
}
+static inline bool
+_hb_glyph_info_is_unicode_mark (const hb_glyph_info_t *info)
+{
+ return HB_UNICODE_GENERAL_CATEGORY_IS_MARK (info->unicode_props() & UPROPS_MASK_GEN_CAT);
+}
static inline void
_hb_glyph_info_set_modified_combining_class (hb_glyph_info_t *info,
unsigned int modified_class)
{
- info->unicode_props1() = modified_class;
+ if (unlikely (!_hb_glyph_info_is_unicode_mark (info)))
+ return;
+ info->unicode_props() = (modified_class<<8) | (info->unicode_props() & 0xFF);
}
-
static inline unsigned int
_hb_glyph_info_get_modified_combining_class (const hb_glyph_info_t *info)
{
- return info->unicode_props1();
+ return _hb_glyph_info_is_unicode_mark (info) ? info->unicode_props()>>8 : 0;
+}
+
+static inline bool
+_hb_glyph_info_is_unicode_space (const hb_glyph_info_t *info)
+{
+ return _hb_glyph_info_get_general_category (info) ==
+ HB_UNICODE_GENERAL_CATEGORY_SPACE_SEPARATOR;
+}
+static inline void
+_hb_glyph_info_set_unicode_space_fallback_type (hb_glyph_info_t *info, hb_unicode_funcs_t::space_t s)
+{
+ if (unlikely (!_hb_glyph_info_is_unicode_space (info)))
+ return;
+ info->unicode_props() = (((unsigned int) s)<<8) | (info->unicode_props() & 0xFF);
+}
+static inline hb_unicode_funcs_t::space_t
+_hb_glyph_info_get_unicode_space_fallback_type (const hb_glyph_info_t *info)
+{
+ return _hb_glyph_info_is_unicode_space (info) ?
+ (hb_unicode_funcs_t::space_t) (info->unicode_props()>>8) :
+ hb_unicode_funcs_t::NOT_SPACE;
}
static inline bool _hb_glyph_info_ligated (const hb_glyph_info_t *info);
@@ -263,25 +363,44 @@ static inline bool _hb_glyph_info_ligated (const hb_glyph_info_t *info);
static inline hb_bool_t
_hb_glyph_info_is_default_ignorable (const hb_glyph_info_t *info)
{
- return (info->unicode_props0() & MASK0_IGNORABLE) && !_hb_glyph_info_ligated (info);
+ return (info->unicode_props() & UPROPS_MASK_IGNORABLE) &&
+ !_hb_glyph_info_ligated (info);
+}
+static inline hb_bool_t
+_hb_glyph_info_is_default_ignorable_and_not_fvs (const hb_glyph_info_t *info)
+{
+ return ((info->unicode_props() & (UPROPS_MASK_IGNORABLE|UPROPS_MASK_FVS))
+ == UPROPS_MASK_IGNORABLE) &&
+ !_hb_glyph_info_ligated (info);
}
+static inline bool
+_hb_glyph_info_is_unicode_format (const hb_glyph_info_t *info)
+{
+ return _hb_glyph_info_get_general_category (info) ==
+ HB_UNICODE_GENERAL_CATEGORY_FORMAT;
+}
static inline hb_bool_t
_hb_glyph_info_is_zwnj (const hb_glyph_info_t *info)
{
- return !!(info->unicode_props0() & MASK0_ZWNJ);
+ return _hb_glyph_info_is_unicode_format (info) && (info->unicode_props() & UPROPS_MASK_Cf_ZWNJ);
}
-
static inline hb_bool_t
_hb_glyph_info_is_zwj (const hb_glyph_info_t *info)
{
- return !!(info->unicode_props0() & MASK0_ZWJ);
+ return _hb_glyph_info_is_unicode_format (info) && (info->unicode_props() & UPROPS_MASK_Cf_ZWJ);
+}
+static inline hb_bool_t
+_hb_glyph_info_is_joiner (const hb_glyph_info_t *info)
+{
+ return _hb_glyph_info_is_unicode_format (info) && (info->unicode_props() & (UPROPS_MASK_Cf_ZWNJ|UPROPS_MASK_Cf_ZWJ));
}
-
static inline void
_hb_glyph_info_flip_joiners (hb_glyph_info_t *info)
{
- info->unicode_props0() ^= MASK0_ZWNJ | MASK0_ZWJ;
+ if (!_hb_glyph_info_is_unicode_format (info))
+ return;
+ info->unicode_props() ^= UPROPS_MASK_Cf_ZWNJ | UPROPS_MASK_Cf_ZWJ;
}
/* lig_props: aka lig_id / lig_comp
@@ -442,11 +561,9 @@ _hb_glyph_info_clear_ligated_and_multiplied (hb_glyph_info_t *info)
}
static inline void
-_hb_glyph_info_clear_substituted_and_ligated_and_multiplied (hb_glyph_info_t *info)
+_hb_glyph_info_clear_substituted (hb_glyph_info_t *info)
{
- info->glyph_props() &= ~(HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED |
- HB_OT_LAYOUT_GLYPH_PROPS_LIGATED |
- HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED);
+ info->glyph_props() &= ~(HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED);
}
@@ -455,22 +572,19 @@ _hb_glyph_info_clear_substituted_and_ligated_and_multiplied (hb_glyph_info_t *in
static inline void
_hb_buffer_allocate_unicode_vars (hb_buffer_t *buffer)
{
- HB_BUFFER_ALLOCATE_VAR (buffer, unicode_props0);
- HB_BUFFER_ALLOCATE_VAR (buffer, unicode_props1);
+ HB_BUFFER_ALLOCATE_VAR (buffer, unicode_props);
}
static inline void
_hb_buffer_deallocate_unicode_vars (hb_buffer_t *buffer)
{
- HB_BUFFER_DEALLOCATE_VAR (buffer, unicode_props0);
- HB_BUFFER_DEALLOCATE_VAR (buffer, unicode_props1);
+ HB_BUFFER_DEALLOCATE_VAR (buffer, unicode_props);
}
static inline void
_hb_buffer_assert_unicode_vars (hb_buffer_t *buffer)
{
- HB_BUFFER_ASSERT_VAR (buffer, unicode_props0);
- HB_BUFFER_ASSERT_VAR (buffer, unicode_props1);
+ HB_BUFFER_ASSERT_VAR (buffer, unicode_props);
}
static inline void
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout.cc
index 275a960d58..145ec76389 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout.cc
@@ -60,6 +60,92 @@ _hb_ot_layout_create (hb_face_t *face)
layout->gpos_blob = OT::Sanitizer<OT::GPOS>::sanitize (face->reference_table (HB_OT_TAG_GPOS));
layout->gpos = OT::Sanitizer<OT::GPOS>::lock_instance (layout->gpos_blob);
+ /* The MATH table is rarely used, so only try and load it in _get_math. */
+ layout->math_blob = NULL;
+ layout->math = NULL;
+
+ {
+ /*
+ * The ugly business of blacklisting individual fonts' tables happen here!
+ * See this thread for why we finally had to bend in and do this:
+ * https://lists.freedesktop.org/archives/harfbuzz/2016-February/005489.html
+ */
+ unsigned int gdef_len = hb_blob_get_length (layout->gdef_blob);
+ unsigned int gsub_len = hb_blob_get_length (layout->gsub_blob);
+ unsigned int gpos_len = hb_blob_get_length (layout->gpos_blob);
+ if (0
+ /* sha1sum:c5ee92f0bca4bfb7d06c4d03e8cf9f9cf75d2e8a Windows 7? timesi.ttf */
+ || (442 == gdef_len && 42038 == gpos_len && 2874 == gsub_len)
+ /* sha1sum:37fc8c16a0894ab7b749e35579856c73c840867b Windows 7? timesbi.ttf */
+ || (430 == gdef_len && 40662 == gpos_len && 2874 == gsub_len)
+ /* sha1sum:19fc45110ea6cd3cdd0a5faca256a3797a069a80 Windows 7 timesi.ttf */
+ || (442 == gdef_len && 39116 == gpos_len && 2874 == gsub_len)
+ /* sha1sum:6d2d3c9ed5b7de87bc84eae0df95ee5232ecde26 Windows 7 timesbi.ttf */
+ || (430 == gdef_len && 39374 == gpos_len && 2874 == gsub_len)
+ /* sha1sum:8583225a8b49667c077b3525333f84af08c6bcd8 OS X 10.11.3 Times New Roman Italic.ttf */
+ || (490 == gdef_len && 41638 == gpos_len && 3046 == gsub_len)
+ /* sha1sum:ec0f5a8751845355b7c3271d11f9918a966cb8c9 OS X 10.11.3 Times New Roman Bold Italic.ttf */
+ || (478 == gdef_len && 41902 == gpos_len && 3046 == gsub_len)
+ )
+ {
+ /* In certain versions of Times New Roman Italic and Bold Italic,
+ * ASCII double quotation mark U+0022, mapped to glyph 5, has wrong
+ * glyph class 3 (mark) in GDEF. Nuke the GDEF to avoid zero-width
+ * double-quote. See:
+ * https://lists.freedesktop.org/archives/harfbuzz/2016-February/005489.html
+ */
+ if (3 == layout->gdef->get_glyph_class (5))
+ layout->gdef = &OT::Null(OT::GDEF);
+ }
+ else if (0
+ /* sha1sum:96eda93f7d33e79962451c6c39a6b51ee893ce8c tahoma.ttf from Windows 8 */
+ || (898 == gdef_len && 46470 == gpos_len && 12554 == gsub_len)
+ /* sha1sum:20928dc06014e0cd120b6fc942d0c3b1a46ac2bc tahomabd.ttf from Windows 8 */
+ || (910 == gdef_len && 47732 == gpos_len && 12566 == gsub_len)
+ /* sha1sum:4f95b7e4878f60fa3a39ca269618dfde9721a79e tahoma.ttf from Windows 8.1 */
+ || (928 == gdef_len && 59332 == gpos_len && 23298 == gsub_len)
+ /* sha1sum:6d400781948517c3c0441ba42acb309584b73033 tahomabd.ttf from Windows 8.1 */
+ || (940 == gdef_len && 60732 == gpos_len && 23310 == gsub_len)
+ /* sha1sum:e55fa2dfe957a9f7ec26be516a0e30b0c925f846 tahoma.ttf from Windows 10 */
+ || (994 == gdef_len && 60336 == gpos_len && 24474 == gsub_len)
+ /* sha1sum:7199385abb4c2cc81c83a151a7599b6368e92343 tahomabd.ttf from Windows 10 */
+ || (1006 == gdef_len && 61740 == gpos_len && 24470 == gsub_len)
+ /* sha1sum:b0d36cf5a2fbe746a3dd277bffc6756a820807a7 Tahoma.ttf from Mac OS X 10.9 */
+ || (832 == gdef_len && 47162 == gpos_len && 7324 == gsub_len)
+ /* sha1sum:12fc4538e84d461771b30c18b5eb6bd434e30fba Tahoma Bold.ttf from Mac OS X 10.9 */
+ || (844 == gdef_len && 45474 == gpos_len && 7302 == gsub_len)
+ /* sha1sum:73da7f025b238a3f737aa1fde22577a6370f77b0 himalaya.ttf from Windows 8 */
+ || (192 == gdef_len && 7254 == gpos_len && 12638 == gsub_len)
+ /* sha1sum:6e80fd1c0b059bbee49272401583160dc1e6a427 himalaya.ttf from Windows 8.1 */
+ || (192 == gdef_len && 7254 == gpos_len && 12690 == gsub_len)
+ /* 8d9267aea9cd2c852ecfb9f12a6e834bfaeafe44 cantarell-fonts-0.0.21/otf/Cantarell-Regular.otf */
+ /* 983988ff7b47439ab79aeaf9a45bd4a2c5b9d371 cantarell-fonts-0.0.21/otf/Cantarell-Oblique.otf */
+ || (188 == gdef_len && 3852 == gpos_len && 248 == gsub_len)
+ /* 2c0c90c6f6087ffbfea76589c93113a9cbb0e75f cantarell-fonts-0.0.21/otf/Cantarell-Bold.otf */
+ /* 55461f5b853c6da88069ffcdf7f4dd3f8d7e3e6b cantarell-fonts-0.0.21/otf/Cantarell-Bold-Oblique.otf */
+ || (188 == gdef_len && 3426 == gpos_len && 264 == gsub_len)
+ /* 6c93b63b64e8b2c93f5e824e78caca555dc887c7 padauk-2.80/Padauk-book.ttf */
+ || (1046 == gdef_len && 17112 == gpos_len && 71788 == gsub_len)
+ /* d89b1664058359b8ec82e35d3531931125991fb9 padauk-2.80/Padauk-bookbold.ttf */
+ || (1058 == gdef_len && 17514 == gpos_len && 71794 == gsub_len)
+ /* 824cfd193aaf6234b2b4dc0cf3c6ef576c0d00ef padauk-3.0/Padauk-book.ttf */
+ || (1330 == gdef_len && 57938 == gpos_len && 109904 == gsub_len)
+ /* 91fcc10cf15e012d27571e075b3b4dfe31754a8a padauk-3.0/Padauk-bookbold.ttf */
+ || (1330 == gdef_len && 58972 == gpos_len && 109904 == gsub_len)
+ )
+ {
+ /* Many versions of Tahoma have bad GDEF tables that incorrectly classify some spacing marks
+ * such as certain IPA symbols as glyph class 3. So do older versions of Microsoft Himalaya,
+ * and the version of Cantarell shipped by Ubuntu 16.04.
+ * Nuke the GDEF tables of these fonts to avoid unwanted width-zeroing.
+ * See https://bugzilla.mozilla.org/show_bug.cgi?id=1279925
+ * https://bugzilla.mozilla.org/show_bug.cgi?id=1279693
+ * https://bugzilla.mozilla.org/show_bug.cgi?id=1279875
+ */
+ layout->gdef = &OT::Null(OT::GDEF);
+ }
+ }
+
layout->gsub_lookup_count = layout->gsub->get_lookup_count ();
layout->gpos_lookup_count = layout->gpos->get_lookup_count ();
@@ -95,6 +181,7 @@ _hb_ot_layout_destroy (hb_ot_layout_t *layout)
hb_blob_destroy (layout->gdef_blob);
hb_blob_destroy (layout->gsub_blob);
hb_blob_destroy (layout->gpos_blob);
+ hb_blob_destroy (layout->math_blob);
free (layout);
}
@@ -118,7 +205,6 @@ _get_gpos (hb_face_t *face)
return *hb_ot_layout_from_face (face)->gpos;
}
-
/*
* GDEF
*/
@@ -130,6 +216,8 @@ hb_ot_layout_has_glyph_classes (hb_face_t *face)
}
/**
+ * hb_ot_layout_get_glyph_class:
+ *
* Since: 0.9.7
**/
hb_ot_layout_glyph_class_t
@@ -140,6 +228,8 @@ hb_ot_layout_get_glyph_class (hb_face_t *face,
}
/**
+ * hb_ot_layout_get_glyphs_in_class:
+ *
* Since: 0.9.7
**/
void
@@ -365,6 +455,8 @@ hb_ot_layout_language_get_required_feature_index (hb_face_t *face,
}
/**
+ * hb_ot_layout_language_get_required_feature:
+ *
* Since: 0.9.30
**/
hb_bool_t
@@ -452,6 +544,8 @@ hb_ot_layout_language_find_feature (hb_face_t *face,
}
/**
+ * hb_ot_layout_feature_get_lookups:
+ *
* Since: 0.9.7
**/
unsigned int
@@ -462,13 +556,18 @@ hb_ot_layout_feature_get_lookups (hb_face_t *face,
unsigned int *lookup_count /* IN/OUT */,
unsigned int *lookup_indexes /* OUT */)
{
- const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
- const OT::Feature &f = g.get_feature (feature_index);
-
- return f.get_lookup_indexes (start_offset, lookup_count, lookup_indexes);
+ return hb_ot_layout_feature_with_variations_get_lookups (face,
+ table_tag,
+ feature_index,
+ HB_OT_LAYOUT_NO_VARIATIONS_INDEX,
+ start_offset,
+ lookup_count,
+ lookup_indexes);
}
/**
+ * hb_ot_layout_table_get_lookup_count:
+ *
* Since: 0.9.22
**/
unsigned int
@@ -629,6 +728,8 @@ _hb_ot_layout_collect_lookups_languages (hb_face_t *face,
}
/**
+ * hb_ot_layout_collect_lookups:
+ *
* Since: 0.9.8
**/
void
@@ -673,6 +774,8 @@ hb_ot_layout_collect_lookups (hb_face_t *face,
}
/**
+ * hb_ot_layout_lookup_collect_glyphs:
+ *
* Since: 0.9.7
**/
void
@@ -710,6 +813,38 @@ hb_ot_layout_lookup_collect_glyphs (hb_face_t *face,
}
+/* Variations support */
+
+hb_bool_t
+hb_ot_layout_table_find_feature_variations (hb_face_t *face,
+ hb_tag_t table_tag,
+ const int *coords,
+ unsigned int num_coords,
+ unsigned int *variations_index /* out */)
+{
+ const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
+
+ return g.find_variations_index (coords, num_coords, variations_index);
+}
+
+unsigned int
+hb_ot_layout_feature_with_variations_get_lookups (hb_face_t *face,
+ hb_tag_t table_tag,
+ unsigned int feature_index,
+ unsigned int variations_index,
+ unsigned int start_offset,
+ unsigned int *lookup_count /* IN/OUT */,
+ unsigned int *lookup_indexes /* OUT */)
+{
+ ASSERT_STATIC (OT::FeatureVariations::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_VARIATIONS_INDEX);
+ const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
+
+ const OT::Feature &f = g.get_feature_variation (feature_index, variations_index);
+
+ return f.get_lookup_indexes (start_offset, lookup_count, lookup_indexes);
+}
+
+
/*
* OT::GSUB
*/
@@ -721,6 +856,8 @@ hb_ot_layout_has_substitution (hb_face_t *face)
}
/**
+ * hb_ot_layout_lookup_would_substitute:
+ *
* Since: 0.9.7
**/
hb_bool_t
@@ -742,7 +879,7 @@ hb_ot_layout_lookup_would_substitute_fast (hb_face_t *face,
hb_bool_t zero_context)
{
if (unlikely (lookup_index >= hb_ot_layout_from_face (face)->gsub_lookup_count)) return false;
- OT::hb_would_apply_context_t c (face, glyphs, glyphs_length, zero_context);
+ OT::hb_would_apply_context_t c (face, glyphs, glyphs_length, (bool) zero_context);
const OT::SubstLookup& l = hb_ot_layout_from_face (face)->gsub->get_lookup (lookup_index);
@@ -755,13 +892,9 @@ hb_ot_layout_substitute_start (hb_font_t *font, hb_buffer_t *buffer)
OT::GSUB::substitute_start (font, buffer);
}
-void
-hb_ot_layout_substitute_finish (hb_font_t *font, hb_buffer_t *buffer)
-{
- OT::GSUB::substitute_finish (font, buffer);
-}
-
/**
+ * hb_ot_layout_lookup_substitute_closure:
+ *
* Since: 0.9.7
**/
void
@@ -793,12 +926,20 @@ hb_ot_layout_position_start (hb_font_t *font, hb_buffer_t *buffer)
}
void
-hb_ot_layout_position_finish (hb_font_t *font, hb_buffer_t *buffer)
+hb_ot_layout_position_finish_advances (hb_font_t *font, hb_buffer_t *buffer)
+{
+ OT::GPOS::position_finish_advances (font, buffer);
+}
+
+void
+hb_ot_layout_position_finish_offsets (hb_font_t *font, hb_buffer_t *buffer)
{
- OT::GPOS::position_finish (font, buffer);
+ OT::GPOS::position_finish_offsets (font, buffer);
}
/**
+ * hb_ot_layout_get_size_params:
+ *
* Since: 0.9.10
**/
hb_bool_t
@@ -882,20 +1023,79 @@ struct GPOSProxy
};
-template <typename Obj>
+struct hb_get_subtables_context_t :
+ OT::hb_dispatch_context_t<hb_get_subtables_context_t, hb_void_t, HB_DEBUG_APPLY>
+{
+ template <typename Type>
+ static inline bool apply_to (const void *obj, OT::hb_apply_context_t *c)
+ {
+ const Type *typed_obj = (const Type *) obj;
+ return typed_obj->apply (c);
+ }
+
+ typedef bool (*hb_apply_func_t) (const void *obj, OT::hb_apply_context_t *c);
+
+ struct hb_applicable_t
+ {
+ inline void init (const void *obj_, hb_apply_func_t apply_func_)
+ {
+ obj = obj_;
+ apply_func = apply_func_;
+ }
+
+ inline bool apply (OT::hb_apply_context_t *c) const { return apply_func (obj, c); }
+
+ private:
+ const void *obj;
+ hb_apply_func_t apply_func;
+ };
+
+ typedef hb_auto_array_t<hb_applicable_t> array_t;
+
+ /* Dispatch interface. */
+ inline const char *get_name (void) { return "GET_SUBTABLES"; }
+ template <typename T>
+ inline return_t dispatch (const T &obj)
+ {
+ hb_applicable_t *entry = array.push();
+ if (likely (entry))
+ entry->init (&obj, apply_to<T>);
+ return HB_VOID;
+ }
+ static return_t default_return_value (void) { return HB_VOID; }
+ bool stop_sublookup_iteration (return_t r HB_UNUSED) const { return false; }
+
+ hb_get_subtables_context_t (array_t &array_) :
+ array (array_),
+ debug_depth (0) {}
+
+ array_t &array;
+ unsigned int debug_depth;
+};
+
static inline bool
apply_forward (OT::hb_apply_context_t *c,
- const Obj &obj,
- const hb_ot_layout_lookup_accelerator_t &accel)
+ const hb_ot_layout_lookup_accelerator_t &accel,
+ const hb_get_subtables_context_t::array_t &subtables)
{
bool ret = false;
hb_buffer_t *buffer = c->buffer;
- while (buffer->idx < buffer->len)
+ while (buffer->idx < buffer->len && !buffer->in_error)
{
+ bool applied = false;
if (accel.may_have (buffer->cur().codepoint) &&
(buffer->cur().mask & c->lookup_mask) &&
- c->check_glyph_property (&buffer->cur(), c->lookup_props) &&
- obj.apply (c))
+ c->check_glyph_property (&buffer->cur(), c->lookup_props))
+ {
+ for (unsigned int i = 0; i < subtables.len; i++)
+ if (subtables[i].apply (c))
+ {
+ applied = true;
+ break;
+ }
+ }
+
+ if (applied)
ret = true;
else
buffer->next_glyph ();
@@ -903,11 +1103,10 @@ apply_forward (OT::hb_apply_context_t *c,
return ret;
}
-template <typename Obj>
static inline bool
apply_backward (OT::hb_apply_context_t *c,
- const Obj &obj,
- const hb_ot_layout_lookup_accelerator_t &accel)
+ const hb_ot_layout_lookup_accelerator_t &accel,
+ const hb_get_subtables_context_t::array_t &subtables)
{
bool ret = false;
hb_buffer_t *buffer = c->buffer;
@@ -915,9 +1114,15 @@ apply_backward (OT::hb_apply_context_t *c,
{
if (accel.may_have (buffer->cur().codepoint) &&
(buffer->cur().mask & c->lookup_mask) &&
- c->check_glyph_property (&buffer->cur(), c->lookup_props) &&
- obj.apply (c))
- ret = true;
+ c->check_glyph_property (&buffer->cur(), c->lookup_props))
+ {
+ for (unsigned int i = 0; i < subtables.len; i++)
+ if (subtables[i].apply (c))
+ {
+ ret = true;
+ break;
+ }
+ }
/* The reverse lookup doesn't "advance" cursor (for good reason). */
buffer->idx--;
@@ -926,26 +1131,6 @@ apply_backward (OT::hb_apply_context_t *c,
return ret;
}
-struct hb_apply_forward_context_t :
- OT::hb_dispatch_context_t<hb_apply_forward_context_t, bool, HB_DEBUG_APPLY>
-{
- inline const char *get_name (void) { return "APPLY_FWD"; }
- template <typename T>
- inline return_t dispatch (const T &obj) { return apply_forward (c, obj, accel); }
- static return_t default_return_value (void) { return false; }
- bool stop_sublookup_iteration (return_t r HB_UNUSED) const { return true; }
-
- hb_apply_forward_context_t (OT::hb_apply_context_t *c_,
- const hb_ot_layout_lookup_accelerator_t &accel_) :
- c (c_),
- accel (accel_),
- debug_depth (0) {}
-
- OT::hb_apply_context_t *c;
- const hb_ot_layout_lookup_accelerator_t &accel;
- unsigned int debug_depth;
-};
-
template <typename Proxy>
static inline void
apply_string (OT::hb_apply_context_t *c,
@@ -959,6 +1144,10 @@ apply_string (OT::hb_apply_context_t *c,
c->set_lookup_props (lookup.get_props ());
+ hb_get_subtables_context_t::array_t subtables;
+ hb_get_subtables_context_t c_get_subtables (subtables);
+ lookup.dispatch (&c_get_subtables);
+
if (likely (!lookup.is_reverse ()))
{
/* in/out forward substitution/positioning */
@@ -967,13 +1156,7 @@ apply_string (OT::hb_apply_context_t *c,
buffer->idx = 0;
bool ret;
- if (lookup.get_subtable_count () == 1)
- {
- hb_apply_forward_context_t c_forward (c, accel);
- ret = lookup.dispatch (&c_forward);
- }
- else
- ret = apply_forward (c, lookup, accel);
+ ret = apply_forward (c, accel, subtables);
if (ret)
{
if (!Proxy::inplace)
@@ -989,7 +1172,7 @@ apply_string (OT::hb_apply_context_t *c,
buffer->remove_output ();
buffer->idx = buffer->len - 1;
- apply_backward (c, lookup, accel);
+ apply_backward (c, accel, subtables);
}
}
@@ -1008,25 +1191,15 @@ inline void hb_ot_map_t::apply (const Proxy &proxy,
const stage_map_t *stage = &stages[table_index][stage_index];
for (; i < stage->last_lookup; i++)
{
-#if 0
- char buf[4096];
- hb_buffer_serialize_glyphs (buffer, 0, buffer->len,
- buf, sizeof (buf), NULL,
- font,
- HB_BUFFER_SERIALIZE_FORMAT_TEXT,
- Proxy::table_index == 0 ?
- HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS :
- HB_BUFFER_SERIALIZE_FLAG_DEFAULT);
- printf ("buf: [%s]\n", buf);
-#endif
-
unsigned int lookup_index = lookups[table_index][i].index;
+ if (!buffer->message (font, "start lookup %d", lookup_index)) continue;
c.set_lookup_index (lookup_index);
c.set_lookup_mask (lookups[table_index][i].mask);
c.set_auto_zwj (lookups[table_index][i].auto_zwj);
apply_string<Proxy> (&c,
proxy.table.get_lookup (lookup_index),
proxy.accels[lookup_index]);
+ (void) buffer->message (font, "end lookup %d", lookup_index);
}
if (stage->pause_func)
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout.h b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout.h
index 949678ac42..9861f0fc7b 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout.h
@@ -48,7 +48,7 @@ HB_BEGIN_DECLS
* GDEF
*/
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_ot_layout_has_glyph_classes (hb_face_t *face);
typedef enum {
@@ -59,11 +59,11 @@ typedef enum {
HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT = 4
} hb_ot_layout_glyph_class_t;
-hb_ot_layout_glyph_class_t
+HB_EXTERN hb_ot_layout_glyph_class_t
hb_ot_layout_get_glyph_class (hb_face_t *face,
hb_codepoint_t glyph);
-void
+HB_EXTERN void
hb_ot_layout_get_glyphs_in_class (hb_face_t *face,
hb_ot_layout_glyph_class_t klass,
hb_set_t *glyphs /* OUT */);
@@ -71,7 +71,7 @@ hb_ot_layout_get_glyphs_in_class (hb_face_t *face,
/* Not that useful. Provides list of attach points for a glyph that a
* client may want to cache */
-unsigned int
+HB_EXTERN unsigned int
hb_ot_layout_get_attach_points (hb_face_t *face,
hb_codepoint_t glyph,
unsigned int start_offset,
@@ -79,7 +79,7 @@ hb_ot_layout_get_attach_points (hb_face_t *face,
unsigned int *point_array /* OUT */);
/* Ligature caret positions */
-unsigned int
+HB_EXTERN unsigned int
hb_ot_layout_get_ligature_carets (hb_font_t *font,
hb_direction_t direction,
hb_codepoint_t glyph,
@@ -95,36 +95,37 @@ hb_ot_layout_get_ligature_carets (hb_font_t *font,
#define HB_OT_LAYOUT_NO_SCRIPT_INDEX 0xFFFFu
#define HB_OT_LAYOUT_NO_FEATURE_INDEX 0xFFFFu
#define HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX 0xFFFFu
+#define HB_OT_LAYOUT_NO_VARIATIONS_INDEX 0xFFFFFFFFu
-unsigned int
+HB_EXTERN unsigned int
hb_ot_layout_table_get_script_tags (hb_face_t *face,
hb_tag_t table_tag,
unsigned int start_offset,
unsigned int *script_count /* IN/OUT */,
hb_tag_t *script_tags /* OUT */);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_ot_layout_table_find_script (hb_face_t *face,
hb_tag_t table_tag,
hb_tag_t script_tag,
unsigned int *script_index);
/* Like find_script, but takes zero-terminated array of scripts to test */
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_ot_layout_table_choose_script (hb_face_t *face,
hb_tag_t table_tag,
const hb_tag_t *script_tags,
unsigned int *script_index,
hb_tag_t *chosen_script);
-unsigned int
+HB_EXTERN unsigned int
hb_ot_layout_table_get_feature_tags (hb_face_t *face,
hb_tag_t table_tag,
unsigned int start_offset,
unsigned int *feature_count /* IN/OUT */,
hb_tag_t *feature_tags /* OUT */);
-unsigned int
+HB_EXTERN unsigned int
hb_ot_layout_script_get_language_tags (hb_face_t *face,
hb_tag_t table_tag,
unsigned int script_index,
@@ -132,21 +133,21 @@ hb_ot_layout_script_get_language_tags (hb_face_t *face,
unsigned int *language_count /* IN/OUT */,
hb_tag_t *language_tags /* OUT */);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_ot_layout_script_find_language (hb_face_t *face,
hb_tag_t table_tag,
unsigned int script_index,
hb_tag_t language_tag,
unsigned int *language_index);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_ot_layout_language_get_required_feature_index (hb_face_t *face,
hb_tag_t table_tag,
unsigned int script_index,
unsigned int language_index,
unsigned int *feature_index);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_ot_layout_language_get_required_feature (hb_face_t *face,
hb_tag_t table_tag,
unsigned int script_index,
@@ -154,7 +155,7 @@ hb_ot_layout_language_get_required_feature (hb_face_t *face,
unsigned int *feature_index,
hb_tag_t *feature_tag);
-unsigned int
+HB_EXTERN unsigned int
hb_ot_layout_language_get_feature_indexes (hb_face_t *face,
hb_tag_t table_tag,
unsigned int script_index,
@@ -163,7 +164,7 @@ hb_ot_layout_language_get_feature_indexes (hb_face_t *face,
unsigned int *feature_count /* IN/OUT */,
unsigned int *feature_indexes /* OUT */);
-unsigned int
+HB_EXTERN unsigned int
hb_ot_layout_language_get_feature_tags (hb_face_t *face,
hb_tag_t table_tag,
unsigned int script_index,
@@ -172,7 +173,7 @@ hb_ot_layout_language_get_feature_tags (hb_face_t *face,
unsigned int *feature_count /* IN/OUT */,
hb_tag_t *feature_tags /* OUT */);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_ot_layout_language_find_feature (hb_face_t *face,
hb_tag_t table_tag,
unsigned int script_index,
@@ -180,7 +181,7 @@ hb_ot_layout_language_find_feature (hb_face_t *face,
hb_tag_t feature_tag,
unsigned int *feature_index);
-unsigned int
+HB_EXTERN unsigned int
hb_ot_layout_feature_get_lookups (hb_face_t *face,
hb_tag_t table_tag,
unsigned int feature_index,
@@ -188,12 +189,12 @@ hb_ot_layout_feature_get_lookups (hb_face_t *face,
unsigned int *lookup_count /* IN/OUT */,
unsigned int *lookup_indexes /* OUT */);
-unsigned int
+HB_EXTERN unsigned int
hb_ot_layout_table_get_lookup_count (hb_face_t *face,
hb_tag_t table_tag);
-void
+HB_EXTERN void
hb_ot_layout_collect_lookups (hb_face_t *face,
hb_tag_t table_tag,
const hb_tag_t *scripts,
@@ -201,7 +202,7 @@ hb_ot_layout_collect_lookups (hb_face_t *face,
const hb_tag_t *features,
hb_set_t *lookup_indexes /* OUT */);
-void
+HB_EXTERN void
hb_ot_layout_lookup_collect_glyphs (hb_face_t *face,
hb_tag_t table_tag,
unsigned int lookup_index,
@@ -228,7 +229,7 @@ typedef hb_bool_t
const hb_ot_layout_glyph_sequence_t *sequence,
void *user_data);
-void
+HB_EXTERN void
Xhb_ot_layout_lookup_enumerate_sequences (hb_face_t *face,
hb_tag_t table_tag,
unsigned int lookup_index,
@@ -236,22 +237,40 @@ Xhb_ot_layout_lookup_enumerate_sequences (hb_face_t *face,
void *user_data);
#endif
+/* Variations support */
+
+HB_EXTERN hb_bool_t
+hb_ot_layout_table_find_feature_variations (hb_face_t *face,
+ hb_tag_t table_tag,
+ const int *coords,
+ unsigned int num_coords,
+ unsigned int *variations_index /* out */);
+
+HB_EXTERN unsigned int
+hb_ot_layout_feature_with_variations_get_lookups (hb_face_t *face,
+ hb_tag_t table_tag,
+ unsigned int feature_index,
+ unsigned int variations_index,
+ unsigned int start_offset,
+ unsigned int *lookup_count /* IN/OUT */,
+ unsigned int *lookup_indexes /* OUT */);
+
/*
* GSUB
*/
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_ot_layout_has_substitution (hb_face_t *face);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_ot_layout_lookup_would_substitute (hb_face_t *face,
unsigned int lookup_index,
const hb_codepoint_t *glyphs,
unsigned int glyphs_length,
hb_bool_t zero_context);
-void
+HB_EXTERN void
hb_ot_layout_lookup_substitute_closure (hb_face_t *face,
unsigned int lookup_index,
hb_set_t *glyphs
@@ -259,7 +278,7 @@ hb_ot_layout_lookup_substitute_closure (hb_face_t *face,
#ifdef HB_NOT_IMPLEMENTED
/* Note: You better have GDEF when using this API, or marks won't do much. */
-hb_bool_t
+HB_EXTERN hb_bool_t
Xhb_ot_layout_lookup_substitute (hb_font_t *font,
unsigned int lookup_index,
const hb_ot_layout_glyph_sequence_t *sequence,
@@ -274,12 +293,12 @@ Xhb_ot_layout_lookup_substitute (hb_font_t *font,
* GPOS
*/
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_ot_layout_has_positioning (hb_face_t *face);
#ifdef HB_NOT_IMPLEMENTED
/* Note: You better have GDEF when using this API, or marks won't do much. */
-hb_bool_t
+HB_EXTERN hb_bool_t
Xhb_ot_layout_lookup_position (hb_font_t *font,
unsigned int lookup_index,
const hb_ot_layout_glyph_sequence_t *sequence,
@@ -288,7 +307,7 @@ Xhb_ot_layout_lookup_position (hb_font_t *font,
/* Optical 'size' feature info. Returns true if found.
* http://www.microsoft.com/typography/otspec/features_pt.htm#size */
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_ot_layout_get_size_params (hb_face_t *face,
unsigned int *design_size, /* OUT. May be NULL */
unsigned int *subfamily_id, /* OUT. May be NULL */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-map-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-map-private.hh
index f9538af183..0395c9c22f 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-map-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-map-private.hh
@@ -139,12 +139,6 @@ struct hb_ot_map_t
private:
- HB_INTERNAL void add_lookups (hb_face_t *face,
- unsigned int table_index,
- unsigned int feature_index,
- hb_mask_t mask,
- bool auto_zwj);
-
hb_mask_t global_mask;
hb_prealloced_array_t<feature_map_t, 8> features;
@@ -159,23 +153,9 @@ enum hb_ot_map_feature_flags_t {
F_MANUAL_ZWJ = 0x0004u, /* Don't skip over ZWJ when matching. */
F_GLOBAL_SEARCH = 0x0008u /* If feature not found in LangSys, look for it in global feature list and pick one. */
};
+HB_MARK_AS_FLAG_T (hb_ot_map_feature_flags_t);
/* Macro version for where const is desired. */
#define F_COMBINE(l,r) (hb_ot_map_feature_flags_t ((unsigned int) (l) | (unsigned int) (r)))
-static inline hb_ot_map_feature_flags_t
-operator | (hb_ot_map_feature_flags_t l, hb_ot_map_feature_flags_t r)
-{ return hb_ot_map_feature_flags_t ((unsigned int) l | (unsigned int) r); }
-static inline hb_ot_map_feature_flags_t
-operator & (hb_ot_map_feature_flags_t l, hb_ot_map_feature_flags_t r)
-{ return hb_ot_map_feature_flags_t ((unsigned int) l & (unsigned int) r); }
-static inline hb_ot_map_feature_flags_t
-operator ~ (hb_ot_map_feature_flags_t r)
-{ return hb_ot_map_feature_flags_t (~(unsigned int) r); }
-static inline hb_ot_map_feature_flags_t&
-operator |= (hb_ot_map_feature_flags_t &l, hb_ot_map_feature_flags_t r)
-{ l = l | r; return l; }
-static inline hb_ot_map_feature_flags_t&
-operator &= (hb_ot_map_feature_flags_t& l, hb_ot_map_feature_flags_t r)
-{ l = l & r; return l; }
struct hb_ot_map_builder_t
@@ -196,7 +176,9 @@ struct hb_ot_map_builder_t
inline void add_gpos_pause (hb_ot_map_t::pause_func_t pause_func)
{ add_pause (1, pause_func); }
- HB_INTERNAL void compile (struct hb_ot_map_t &m);
+ HB_INTERNAL void compile (hb_ot_map_t &m,
+ const int *coords,
+ unsigned int num_coords);
inline void finish (void) {
feature_infos.finish ();
@@ -208,6 +190,14 @@ struct hb_ot_map_builder_t
private:
+ HB_INTERNAL void add_lookups (hb_ot_map_t &m,
+ hb_face_t *face,
+ unsigned int table_index,
+ unsigned int feature_index,
+ unsigned int variations_index,
+ hb_mask_t mask,
+ bool auto_zwj);
+
struct feature_info_t {
hb_tag_t tag;
unsigned int seq; /* sequence#, used for stable sorting only */
@@ -217,7 +207,8 @@ struct hb_ot_map_builder_t
unsigned int stage[2]; /* GSUB/GPOS */
static int cmp (const feature_info_t *a, const feature_info_t *b)
- { return (a->tag != b->tag) ? (a->tag < b->tag ? -1 : 1) : (a->seq < b->seq ? -1 : 1); }
+ { return (a->tag != b->tag) ? (a->tag < b->tag ? -1 : 1) :
+ (a->seq < b->seq ? -1 : a->seq > b->seq ? 1 : 0); }
};
struct stage_info_t {
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-map.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-map.cc
index 95bd04ee8e..9b331d5210 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-map.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-map.cc
@@ -31,44 +31,13 @@
#include "hb-ot-layout-private.hh"
-void
-hb_ot_map_t::add_lookups (hb_face_t *face,
- unsigned int table_index,
- unsigned int feature_index,
- hb_mask_t mask,
- bool auto_zwj)
+void hb_ot_map_t::collect_lookups (unsigned int table_index, hb_set_t *lookups_out) const
{
- unsigned int lookup_indices[32];
- unsigned int offset, len;
- unsigned int table_lookup_count;
-
- table_lookup_count = hb_ot_layout_table_get_lookup_count (face, table_tags[table_index]);
-
- offset = 0;
- do {
- len = ARRAY_LENGTH (lookup_indices);
- hb_ot_layout_feature_get_lookups (face,
- table_tags[table_index],
- feature_index,
- offset, &len,
- lookup_indices);
-
- for (unsigned int i = 0; i < len; i++)
- {
- if (lookup_indices[i] >= table_lookup_count)
- continue;
- hb_ot_map_t::lookup_map_t *lookup = lookups[table_index].push ();
- if (unlikely (!lookup))
- return;
- lookup->mask = mask;
- lookup->index = lookup_indices[i];
- lookup->auto_zwj = auto_zwj;
- }
-
- offset += len;
- } while (len == ARRAY_LENGTH (lookup_indices));
+ for (unsigned int i = 0; i < lookups[table_index].len; i++)
+ hb_set_add (lookups_out, lookups[table_index][i].index);
}
+
hb_ot_map_builder_t::hb_ot_map_builder_t (hb_face_t *face_,
const hb_segment_properties_t *props_)
{
@@ -89,7 +58,7 @@ hb_ot_map_builder_t::hb_ot_map_builder_t (hb_face_t *face_,
for (unsigned int table_index = 0; table_index < 2; table_index++) {
hb_tag_t table_tag = table_tags[table_index];
- found_script[table_index] = hb_ot_layout_table_choose_script (face, table_tag, script_tags, &script_index[table_index], &chosen_script[table_index]);
+ found_script[table_index] = (bool) hb_ot_layout_table_choose_script (face, table_tag, script_tags, &script_index[table_index], &chosen_script[table_index]);
hb_ot_layout_script_find_language (face, table_tag, script_index[table_index], language_tag, &language_index[table_index]);
}
}
@@ -109,13 +78,48 @@ void hb_ot_map_builder_t::add_feature (hb_tag_t tag, unsigned int value,
info->stage[1] = current_stage[1];
}
-
-void hb_ot_map_t::collect_lookups (unsigned int table_index, hb_set_t *lookups_out) const
+void
+hb_ot_map_builder_t::add_lookups (hb_ot_map_t &m,
+ hb_face_t *face,
+ unsigned int table_index,
+ unsigned int feature_index,
+ unsigned int variations_index,
+ hb_mask_t mask,
+ bool auto_zwj)
{
- for (unsigned int i = 0; i < lookups[table_index].len; i++)
- hb_set_add (lookups_out, lookups[table_index][i].index);
+ unsigned int lookup_indices[32];
+ unsigned int offset, len;
+ unsigned int table_lookup_count;
+
+ table_lookup_count = hb_ot_layout_table_get_lookup_count (face, table_tags[table_index]);
+
+ offset = 0;
+ do {
+ len = ARRAY_LENGTH (lookup_indices);
+ hb_ot_layout_feature_with_variations_get_lookups (face,
+ table_tags[table_index],
+ feature_index,
+ variations_index,
+ offset, &len,
+ lookup_indices);
+
+ for (unsigned int i = 0; i < len; i++)
+ {
+ if (lookup_indices[i] >= table_lookup_count)
+ continue;
+ hb_ot_map_t::lookup_map_t *lookup = m.lookups[table_index].push ();
+ if (unlikely (!lookup))
+ return;
+ lookup->mask = mask;
+ lookup->index = lookup_indices[i];
+ lookup->auto_zwj = auto_zwj;
+ }
+
+ offset += len;
+ } while (len == ARRAY_LENGTH (lookup_indices));
}
+
void hb_ot_map_builder_t::add_pause (unsigned int table_index, hb_ot_map_t::pause_func_t pause_func)
{
stage_info_t *s = stages[table_index].push ();
@@ -128,7 +132,9 @@ void hb_ot_map_builder_t::add_pause (unsigned int table_index, hb_ot_map_t::paus
}
void
-hb_ot_map_builder_t::compile (hb_ot_map_t &m)
+hb_ot_map_builder_t::compile (hb_ot_map_t &m,
+ const int *coords,
+ unsigned int num_coords)
{
m.global_mask = 1;
@@ -193,7 +199,8 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m)
/* Uses the global bit */
bits_needed = 0;
else
- bits_needed = _hb_bit_storage (info->max_value);
+ /* Limit to 8 bits per feature. */
+ bits_needed = MIN(8u, _hb_bit_storage (info->max_value));
if (!info->max_value || next_bit + bits_needed > 8 * sizeof (hb_mask_t))
continue; /* Feature disabled, or not enough bits. */
@@ -204,11 +211,8 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m)
for (unsigned int table_index = 0; table_index < 2; table_index++)
{
if (required_feature_tag[table_index] == info->tag)
- {
required_feature_stage[table_index] = info->stage[table_index];
- found = true;
- continue;
- }
+
found |= hb_ot_layout_language_find_feature (face,
table_tags[table_index],
script_index[table_index],
@@ -246,11 +250,11 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m)
map->mask = 1;
} else {
map->shift = next_bit;
- map->mask = (1 << (next_bit + bits_needed)) - (1 << next_bit);
+ map->mask = (1u << (next_bit + bits_needed)) - (1u << next_bit);
next_bit += bits_needed;
m.global_mask |= (info->default_value << map->shift) & map->mask;
}
- map->_1_mask = (1 << map->shift) & map->mask;
+ map->_1_mask = (1u << map->shift) & map->mask;
map->needs_fallback = !found;
}
@@ -264,23 +268,32 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m)
{
/* Collect lookup indices for features */
+ unsigned int variations_index;
+ hb_ot_layout_table_find_feature_variations (face,
+ table_tags[table_index],
+ coords,
+ num_coords,
+ &variations_index);
+
unsigned int stage_index = 0;
unsigned int last_num_lookups = 0;
for (unsigned stage = 0; stage < current_stage[table_index]; stage++)
{
if (required_feature_index[table_index] != HB_OT_LAYOUT_NO_FEATURE_INDEX &&
required_feature_stage[table_index] == stage)
- m.add_lookups (face, table_index,
- required_feature_index[table_index],
- 1 /* mask */,
- true /* auto_zwj */);
+ add_lookups (m, face, table_index,
+ required_feature_index[table_index],
+ variations_index,
+ 1 /* mask */,
+ true /* auto_zwj */);
for (unsigned i = 0; i < m.features.len; i++)
if (m.features[i].stage[table_index] == stage)
- m.add_lookups (face, table_index,
- m.features[i].index[table_index],
- m.features[i].mask,
- m.features[i].auto_zwj);
+ add_lookups (m, face, table_index,
+ m.features[i].index[table_index],
+ variations_index,
+ m.features[i].mask,
+ m.features[i].auto_zwj);
/* Sort lookups and merge duplicates */
if (last_num_lookups < m.lookups[table_index].len)
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-math.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-math.cc
new file mode 100644
index 0000000000..9ef21d2995
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-math.cc
@@ -0,0 +1,272 @@
+/*
+ * Copyright © 2016 Igalia S.L.
+ *
+ * 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.
+ *
+ * Igalia Author(s): Frédéric Wang
+ */
+
+#include "hb-open-type-private.hh"
+
+#include "hb-ot-layout-math-table.hh"
+
+HB_SHAPER_DATA_ENSURE_DECLARE(ot, face)
+
+static inline const OT::MATH&
+_get_math (hb_face_t *face)
+{
+ if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(OT::MATH);
+
+ hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
+
+retry:
+ const OT::MATH *math = (const OT::MATH *) hb_atomic_ptr_get (&layout->math);
+
+ if (unlikely (!math))
+ {
+ hb_blob_t *blob = OT::Sanitizer<OT::MATH>::sanitize (face->reference_table (HB_OT_TAG_MATH));
+ math = OT::Sanitizer<OT::MATH>::lock_instance (blob);
+ if (!hb_atomic_ptr_cmpexch (&layout->math, NULL, math))
+ {
+ hb_blob_destroy (blob);
+ goto retry;
+ }
+ layout->math_blob = blob;
+ }
+
+ return *math;
+}
+
+/*
+ * OT::MATH
+ */
+
+/**
+ * hb_ot_math_has_data:
+ * @face: #hb_face_t to test
+ *
+ * This function allows to verify the presence of an OpenType MATH table on the
+ * face. If so, such a table will be loaded into memory and sanitized. You can
+ * then safely call other functions for math layout and shaping.
+ *
+ * Return value: #TRUE if face has a MATH table and #FALSE otherwise
+ *
+ * Since: 1.3.3
+ **/
+hb_bool_t
+hb_ot_math_has_data (hb_face_t *face)
+{
+ return &_get_math (face) != &OT::Null(OT::MATH);
+}
+
+/**
+ * hb_ot_math_get_constant:
+ * @font: #hb_font_t from which to retrieve the value
+ * @constant: #hb_ot_math_constant_t the constant to retrieve
+ *
+ * This function returns the requested math constants as a #hb_position_t.
+ * If the request constant is HB_OT_MATH_CONSTANT_SCRIPT_PERCENT_SCALE_DOWN,
+ * HB_OT_MATH_CONSTANT_SCRIPT_SCRIPT_PERCENT_SCALE_DOWN or
+ * HB_OT_MATH_CONSTANT_SCRIPT_PERCENT_SCALE_DOWN then the return value is
+ * actually an integer between 0 and 100 representing that percentage.
+ *
+ * Return value: the requested constant or 0
+ *
+ * Since: 1.3.3
+ **/
+hb_position_t
+hb_ot_math_get_constant (hb_font_t *font,
+ hb_ot_math_constant_t constant)
+{
+ const OT::MATH &math = _get_math (font->face);
+ return math.get_constant(constant, font);
+}
+
+/**
+ * hb_ot_math_get_glyph_italics_correction:
+ * @font: #hb_font_t from which to retrieve the value
+ * @glyph: glyph index from which to retrieve the value
+ *
+ * Return value: the italics correction of the glyph or 0
+ *
+ * Since: 1.3.3
+ **/
+hb_position_t
+hb_ot_math_get_glyph_italics_correction (hb_font_t *font,
+ hb_codepoint_t glyph)
+{
+ const OT::MATH &math = _get_math (font->face);
+ return math.get_math_glyph_info().get_italics_correction (glyph, font);
+}
+
+/**
+ * hb_ot_math_get_glyph_top_accent_attachment:
+ * @font: #hb_font_t from which to retrieve the value
+ * @glyph: glyph index from which to retrieve the value
+ *
+ * Return value: the top accent attachment of the glyph or 0
+ *
+ * Since: 1.3.3
+ **/
+hb_position_t
+hb_ot_math_get_glyph_top_accent_attachment (hb_font_t *font,
+ hb_codepoint_t glyph)
+{
+ const OT::MATH &math = _get_math (font->face);
+ return math.get_math_glyph_info().get_top_accent_attachment (glyph, font);
+}
+
+/**
+ * hb_ot_math_is_glyph_extended_shape:
+ * @font: a #hb_font_t to test
+ * @glyph: a glyph index to test
+ *
+ * Return value: #TRUE if the glyph is an extended shape and #FALSE otherwise
+ *
+ * Since: 1.3.3
+ **/
+hb_bool_t
+hb_ot_math_is_glyph_extended_shape (hb_face_t *face,
+ hb_codepoint_t glyph)
+{
+ const OT::MATH &math = _get_math (face);
+ return math.get_math_glyph_info().is_extended_shape (glyph);
+}
+
+/**
+ * hb_ot_math_get_glyph_kerning:
+ * @font: #hb_font_t from which to retrieve the value
+ * @glyph: glyph index from which to retrieve the value
+ * @kern: the #hb_ot_math_kern_t from which to retrieve the value
+ * @correction_height: the correction height to use to determine the kerning.
+ *
+ * This function tries to retrieve the MathKern table for the specified font,
+ * glyph and #hb_ot_math_kern_t. Then it browses the list of heights from the
+ * MathKern table to find one value that is greater or equal to specified
+ * correction_height. If one is found the corresponding value from the list of
+ * kerns is returned and otherwise the last kern value is returned.
+ *
+ * Return value: requested kerning or 0
+ *
+ * Since: 1.3.3
+ **/
+hb_position_t
+hb_ot_math_get_glyph_kerning (hb_font_t *font,
+ hb_codepoint_t glyph,
+ hb_ot_math_kern_t kern,
+ hb_position_t correction_height)
+{
+ const OT::MATH &math = _get_math (font->face);
+ return math.get_math_glyph_info().get_kerning (glyph, kern, correction_height, font);
+}
+
+/**
+ * hb_ot_math_get_glyph_variants:
+ * @font: #hb_font_t from which to retrieve the values
+ * @glyph: index of the glyph to stretch
+ * @direction: direction of the stretching
+ * @start_offset: offset of the first variant to retrieve
+ * @variants_count: maximum number of variants to retrieve after start_offset
+ * (IN) and actual number of variants retrieved (OUT)
+ * @variants: array of size at least @variants_count to store the result
+ *
+ * This function tries to retrieve the MathGlyphConstruction for the specified
+ * font, glyph and direction. Note that only the value of
+ * #HB_DIRECTION_IS_HORIZONTAL is considered. It provides the corresponding list
+ * of size variants as an array of hb_ot_math_glyph_variant_t structs.
+ *
+ * Return value: the total number of size variants available or 0
+ *
+ * Since: 1.3.3
+ **/
+unsigned int
+hb_ot_math_get_glyph_variants (hb_font_t *font,
+ hb_codepoint_t glyph,
+ hb_direction_t direction,
+ unsigned int start_offset,
+ unsigned int *variants_count, /* IN/OUT */
+ hb_ot_math_glyph_variant_t *variants /* OUT */)
+{
+ const OT::MATH &math = _get_math (font->face);
+ return math.get_math_variants().get_glyph_variants (glyph, direction, font,
+ start_offset,
+ variants_count,
+ variants);
+}
+
+/**
+ * hb_ot_math_get_min_connector_overlap:
+ * @font: #hb_font_t from which to retrieve the value
+ * @direction: direction of the stretching
+ *
+ * This function tries to retrieve the MathVariants table for the specified
+ * font and returns the minimum overlap of connecting glyphs to draw a glyph
+ * assembly in the specified direction. Note that only the value of
+ * #HB_DIRECTION_IS_HORIZONTAL is considered.
+ *
+ * Return value: requested min connector overlap or 0
+ *
+ * Since: 1.3.3
+ **/
+hb_position_t
+hb_ot_math_get_min_connector_overlap (hb_font_t *font,
+ hb_direction_t direction)
+{
+ const OT::MATH &math = _get_math (font->face);
+ return math.get_math_variants().get_min_connector_overlap (direction, font);
+}
+
+/**
+ * hb_ot_math_get_glyph_assembly:
+ * @font: #hb_font_t from which to retrieve the values
+ * @glyph: index of the glyph to stretch
+ * @direction: direction of the stretching
+ * @start_offset: offset of the first glyph part to retrieve
+ * @parts_count: maximum number of glyph parts to retrieve after start_offset
+ * (IN) and actual number of parts retrieved (OUT)
+ * @parts: array of size at least @parts_count to store the result
+ * @italics_correction: italic correction of the glyph assembly
+ *
+ * This function tries to retrieve the GlyphAssembly for the specified font,
+ * glyph and direction. Note that only the value of #HB_DIRECTION_IS_HORIZONTAL
+ * is considered. It provides the information necessary to draw the glyph
+ * assembly as an array of #hb_ot_math_glyph_part_t.
+ *
+ * Return value: the total number of parts in the glyph assembly
+ *
+ * Since: 1.3.3
+ **/
+unsigned int
+hb_ot_math_get_glyph_assembly (hb_font_t *font,
+ hb_codepoint_t glyph,
+ hb_direction_t direction,
+ unsigned int start_offset,
+ unsigned int *parts_count, /* IN/OUT */
+ hb_ot_math_glyph_part_t *parts, /* OUT */
+ hb_position_t *italics_correction /* OUT */)
+{
+ const OT::MATH &math = _get_math (font->face);
+ return math.get_math_variants().get_glyph_parts (glyph, direction, font,
+ start_offset,
+ parts_count,
+ parts,
+ italics_correction);
+}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-math.h b/src/3rdparty/harfbuzz-ng/src/hb-ot-math.h
new file mode 100644
index 0000000000..521a5ca037
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-math.h
@@ -0,0 +1,209 @@
+/*
+ * Copyright © 2016 Igalia S.L.
+ *
+ * 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.
+ *
+ * Igalia Author(s): Frédéric Wang
+ */
+
+#ifndef HB_OT_H_IN
+#error "Include <hb-ot.h> instead."
+#endif
+
+#ifndef HB_OT_MATH_H
+#define HB_OT_MATH_H
+
+#include "hb.h"
+
+HB_BEGIN_DECLS
+
+
+/*
+ * MATH
+ */
+
+#define HB_OT_TAG_MATH HB_TAG('M','A','T','H')
+
+/* Use with hb_buffer_set_script() for math shaping. */
+#define HB_OT_MATH_SCRIPT HB_TAG('m','a','t','h')
+
+/* Types */
+
+/**
+ * hb_ot_math_constant_t:
+ *
+ * Since: 1.3.3
+ */
+typedef enum {
+ HB_OT_MATH_CONSTANT_SCRIPT_PERCENT_SCALE_DOWN = 0,
+ HB_OT_MATH_CONSTANT_SCRIPT_SCRIPT_PERCENT_SCALE_DOWN = 1,
+ HB_OT_MATH_CONSTANT_DELIMITED_SUB_FORMULA_MIN_HEIGHT = 2,
+ HB_OT_MATH_CONSTANT_DISPLAY_OPERATOR_MIN_HEIGHT = 3,
+ HB_OT_MATH_CONSTANT_MATH_LEADING = 4,
+ HB_OT_MATH_CONSTANT_AXIS_HEIGHT = 5,
+ HB_OT_MATH_CONSTANT_ACCENT_BASE_HEIGHT = 6,
+ HB_OT_MATH_CONSTANT_FLATTENED_ACCENT_BASE_HEIGHT = 7,
+ HB_OT_MATH_CONSTANT_SUBSCRIPT_SHIFT_DOWN = 8,
+ HB_OT_MATH_CONSTANT_SUBSCRIPT_TOP_MAX = 9,
+ HB_OT_MATH_CONSTANT_SUBSCRIPT_BASELINE_DROP_MIN = 10,
+ HB_OT_MATH_CONSTANT_SUPERSCRIPT_SHIFT_UP = 11,
+ HB_OT_MATH_CONSTANT_SUPERSCRIPT_SHIFT_UP_CRAMPED = 12,
+ HB_OT_MATH_CONSTANT_SUPERSCRIPT_BOTTOM_MIN = 13,
+ HB_OT_MATH_CONSTANT_SUPERSCRIPT_BASELINE_DROP_MAX = 14,
+ HB_OT_MATH_CONSTANT_SUB_SUPERSCRIPT_GAP_MIN = 15,
+ HB_OT_MATH_CONSTANT_SUPERSCRIPT_BOTTOM_MAX_WITH_SUBSCRIPT = 16,
+ HB_OT_MATH_CONSTANT_SPACE_AFTER_SCRIPT = 17,
+ HB_OT_MATH_CONSTANT_UPPER_LIMIT_GAP_MIN = 18,
+ HB_OT_MATH_CONSTANT_UPPER_LIMIT_BASELINE_RISE_MIN = 19,
+ HB_OT_MATH_CONSTANT_LOWER_LIMIT_GAP_MIN = 20,
+ HB_OT_MATH_CONSTANT_LOWER_LIMIT_BASELINE_DROP_MIN = 21,
+ HB_OT_MATH_CONSTANT_STACK_TOP_SHIFT_UP = 22,
+ HB_OT_MATH_CONSTANT_STACK_TOP_DISPLAY_STYLE_SHIFT_UP = 23,
+ HB_OT_MATH_CONSTANT_STACK_BOTTOM_SHIFT_DOWN = 24,
+ HB_OT_MATH_CONSTANT_STACK_BOTTOM_DISPLAY_STYLE_SHIFT_DOWN = 25,
+ HB_OT_MATH_CONSTANT_STACK_GAP_MIN = 26,
+ HB_OT_MATH_CONSTANT_STACK_DISPLAY_STYLE_GAP_MIN = 27,
+ HB_OT_MATH_CONSTANT_STRETCH_STACK_TOP_SHIFT_UP = 28,
+ HB_OT_MATH_CONSTANT_STRETCH_STACK_BOTTOM_SHIFT_DOWN = 29,
+ HB_OT_MATH_CONSTANT_STRETCH_STACK_GAP_ABOVE_MIN = 30,
+ HB_OT_MATH_CONSTANT_STRETCH_STACK_GAP_BELOW_MIN = 31,
+ HB_OT_MATH_CONSTANT_FRACTION_NUMERATOR_SHIFT_UP = 32,
+ HB_OT_MATH_CONSTANT_FRACTION_NUMERATOR_DISPLAY_STYLE_SHIFT_UP = 33,
+ HB_OT_MATH_CONSTANT_FRACTION_DENOMINATOR_SHIFT_DOWN = 34,
+ HB_OT_MATH_CONSTANT_FRACTION_DENOMINATOR_DISPLAY_STYLE_SHIFT_DOWN = 35,
+ HB_OT_MATH_CONSTANT_FRACTION_NUMERATOR_GAP_MIN = 36,
+ HB_OT_MATH_CONSTANT_FRACTION_NUM_DISPLAY_STYLE_GAP_MIN = 37,
+ HB_OT_MATH_CONSTANT_FRACTION_RULE_THICKNESS = 38,
+ HB_OT_MATH_CONSTANT_FRACTION_DENOMINATOR_GAP_MIN = 39,
+ HB_OT_MATH_CONSTANT_FRACTION_DENOM_DISPLAY_STYLE_GAP_MIN = 40,
+ HB_OT_MATH_CONSTANT_SKEWED_FRACTION_HORIZONTAL_GAP = 41,
+ HB_OT_MATH_CONSTANT_SKEWED_FRACTION_VERTICAL_GAP = 42,
+ HB_OT_MATH_CONSTANT_OVERBAR_VERTICAL_GAP = 43,
+ HB_OT_MATH_CONSTANT_OVERBAR_RULE_THICKNESS = 44,
+ HB_OT_MATH_CONSTANT_OVERBAR_EXTRA_ASCENDER = 45,
+ HB_OT_MATH_CONSTANT_UNDERBAR_VERTICAL_GAP = 46,
+ HB_OT_MATH_CONSTANT_UNDERBAR_RULE_THICKNESS = 47,
+ HB_OT_MATH_CONSTANT_UNDERBAR_EXTRA_DESCENDER = 48,
+ HB_OT_MATH_CONSTANT_RADICAL_VERTICAL_GAP = 49,
+ HB_OT_MATH_CONSTANT_RADICAL_DISPLAY_STYLE_VERTICAL_GAP = 50,
+ HB_OT_MATH_CONSTANT_RADICAL_RULE_THICKNESS = 51,
+ HB_OT_MATH_CONSTANT_RADICAL_EXTRA_ASCENDER = 52,
+ HB_OT_MATH_CONSTANT_RADICAL_KERN_BEFORE_DEGREE = 53,
+ HB_OT_MATH_CONSTANT_RADICAL_KERN_AFTER_DEGREE = 54,
+ HB_OT_MATH_CONSTANT_RADICAL_DEGREE_BOTTOM_RAISE_PERCENT = 55
+} hb_ot_math_constant_t;
+
+/**
+ * hb_ot_math_kern_t:
+ *
+ * Since: 1.3.3
+ */
+typedef enum {
+ HB_OT_MATH_KERN_TOP_RIGHT = 0,
+ HB_OT_MATH_KERN_TOP_LEFT = 1,
+ HB_OT_MATH_KERN_BOTTOM_RIGHT = 2,
+ HB_OT_MATH_KERN_BOTTOM_LEFT = 3
+} hb_ot_math_kern_t;
+
+/**
+ * hb_ot_math_glyph_variant_t:
+ *
+ * Since: 1.3.3
+ */
+typedef struct hb_ot_math_glyph_variant_t {
+ hb_codepoint_t glyph;
+ hb_position_t advance;
+} hb_ot_math_glyph_variant_t;
+
+/**
+ * hb_ot_math_glyph_part_flags_t:
+ *
+ * Since: 1.3.3
+ */
+typedef enum { /*< flags >*/
+ HB_MATH_GLYPH_PART_FLAG_EXTENDER = 0x00000001u /* Extender glyph */
+} hb_ot_math_glyph_part_flags_t;
+
+/**
+ * hb_ot_math_glyph_part_t:
+ *
+ * Since: 1.3.3
+ */
+typedef struct hb_ot_math_glyph_part_t {
+ hb_codepoint_t glyph;
+ hb_position_t start_connector_length;
+ hb_position_t end_connector_length;
+ hb_position_t full_advance;
+ hb_ot_math_glyph_part_flags_t flags;
+} hb_ot_math_glyph_part_t;
+
+/* Methods */
+
+HB_EXTERN hb_bool_t
+hb_ot_math_has_data (hb_face_t *face);
+
+HB_EXTERN hb_position_t
+hb_ot_math_get_constant (hb_font_t *font,
+ hb_ot_math_constant_t constant);
+
+HB_EXTERN hb_position_t
+hb_ot_math_get_glyph_italics_correction (hb_font_t *font,
+ hb_codepoint_t glyph);
+
+HB_EXTERN hb_position_t
+hb_ot_math_get_glyph_top_accent_attachment (hb_font_t *font,
+ hb_codepoint_t glyph);
+
+HB_EXTERN hb_bool_t
+hb_ot_math_is_glyph_extended_shape (hb_face_t *face,
+ hb_codepoint_t glyph);
+
+HB_EXTERN hb_position_t
+hb_ot_math_get_glyph_kerning (hb_font_t *font,
+ hb_codepoint_t glyph,
+ hb_ot_math_kern_t kern,
+ hb_position_t correction_height);
+
+HB_EXTERN unsigned int
+hb_ot_math_get_glyph_variants (hb_font_t *font,
+ hb_codepoint_t glyph,
+ hb_direction_t direction,
+ unsigned int start_offset,
+ unsigned int *variants_count, /* IN/OUT */
+ hb_ot_math_glyph_variant_t *variants /* OUT */);
+
+HB_EXTERN hb_position_t
+hb_ot_math_get_min_connector_overlap (hb_font_t *font,
+ hb_direction_t direction);
+
+HB_EXTERN unsigned int
+hb_ot_math_get_glyph_assembly (hb_font_t *font,
+ hb_codepoint_t glyph,
+ hb_direction_t direction,
+ unsigned int start_offset,
+ unsigned int *parts_count, /* IN/OUT */
+ hb_ot_math_glyph_part_t *parts, /* OUT */
+ hb_position_t *italics_correction /* OUT */);
+
+
+HB_END_DECLS
+
+#endif /* HB_OT_MATH_H */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-maxp-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-maxp-table.hh
index 27105af132..943e3908c7 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-maxp-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-maxp-table.hh
@@ -58,7 +58,7 @@ struct maxp
/* We only implement version 0.5 as none of the extra fields in version 1.0 are useful. */
protected:
- FixedVersion version; /* Version of the maxp table (0.5 or 1.0),
+ FixedVersion<>version; /* Version of the maxp table (0.5 or 1.0),
* 0x00005000u or 0x00010000u. */
USHORT numGlyphs; /* The number of glyphs in the font. */
public:
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-os2-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-os2-table.hh
new file mode 100644
index 0000000000..4709cd6e87
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-os2-table.hh
@@ -0,0 +1,105 @@
+/*
+ * Copyright © 2011,2012 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_OT_OS2_TABLE_HH
+#define HB_OT_OS2_TABLE_HH
+
+#include "hb-open-type-private.hh"
+
+
+namespace OT {
+
+/*
+ * OS/2 and Windows Metrics
+ * http://www.microsoft.com/typography/otspec/os2.htm
+ */
+
+#define HB_OT_TAG_os2 HB_TAG('O','S','/','2')
+
+struct os2
+{
+ static const hb_tag_t tableTag = HB_OT_TAG_os2;
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ public:
+ USHORT version;
+
+ /* Version 0 */
+ SHORT xAvgCharWidth;
+ USHORT usWeightClass;
+ USHORT usWidthClass;
+ USHORT fsType;
+ SHORT ySubscriptXSize;
+ SHORT ySubscriptYSize;
+ SHORT ySubscriptXOffset;
+ SHORT ySubscriptYOffset;
+ SHORT ySuperscriptXSize;
+ SHORT ySuperscriptYSize;
+ SHORT ySuperscriptXOffset;
+ SHORT ySuperscriptYOffset;
+ SHORT yStrikeoutSize;
+ SHORT yStrikeoutPosition;
+ SHORT sFamilyClass;
+ BYTE panose[10];
+ ULONG ulUnicodeRange[4];
+ Tag achVendID;
+ USHORT fsSelection;
+ USHORT usFirstCharIndex;
+ USHORT usLastCharIndex;
+ SHORT sTypoAscender;
+ SHORT sTypoDescender;
+ SHORT sTypoLineGap;
+ USHORT usWinAscent;
+ USHORT usWinDescent;
+
+ /* Version 1 */
+ //ULONG ulCodePageRange1;
+ //ULONG ulCodePageRange2;
+
+ /* Version 2 */
+ //SHORT sxHeight;
+ //SHORT sCapHeight;
+ //USHORT usDefaultChar;
+ //USHORT usBreakChar;
+ //USHORT usMaxContext;
+
+ /* Version 5 */
+ //USHORT usLowerOpticalPointSize;
+ //USHORT usUpperOpticalPointSize;
+
+ public:
+ DEFINE_SIZE_STATIC (78);
+};
+
+} /* namespace OT */
+
+
+#endif /* HB_OT_OS2_TABLE_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-post-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-post-table.hh
new file mode 100644
index 0000000000..82ab3882a8
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-post-table.hh
@@ -0,0 +1,119 @@
+/*
+ * Copyright © 2016 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_OT_POST_TABLE_HH
+#define HB_OT_POST_TABLE_HH
+
+#include "hb-open-type-private.hh"
+
+
+namespace OT {
+
+
+/*
+ * post -- PostScript
+ */
+
+#define HB_OT_TAG_post HB_TAG('p','o','s','t')
+
+
+struct postV2Tail
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (numberOfGlyphs.sanitize (c) &&
+ c->check_array (glyphNameIndex, sizeof (USHORT), numberOfGlyphs));
+ }
+
+ USHORT numberOfGlyphs; /* Number of glyphs (this should be the
+ * same as numGlyphs in 'maxp' table). */
+ USHORT glyphNameIndex[VAR]; /* This is not an offset, but is the
+ * ordinal number of the glyph in 'post'
+ * string tables. */
+ BYTE namesX[VAR]; /* Glyph names with length bytes [variable]
+ * (a Pascal string). */
+
+ DEFINE_SIZE_ARRAY2 (2, glyphNameIndex, namesX);
+};
+
+struct post
+{
+ static const hb_tag_t tableTag = HB_OT_TAG_post;
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ if (unlikely (!c->check_struct (this)))
+ return_trace (false);
+ if (version.to_int () == 0x00020000)
+ {
+ const postV2Tail &v2 = StructAfter<postV2Tail>(*this);
+ return_trace (v2.sanitize (c));
+ }
+ return_trace (true);
+ }
+
+ public:
+ FixedVersion<>version; /* 0x00010000 for version 1.0
+ * 0x00020000 for version 2.0
+ * 0x00025000 for version 2.5 (deprecated)
+ * 0x00030000 for version 3.0 */
+ Fixed italicAngle; /* Italic angle in counter-clockwise degrees
+ * from the vertical. Zero for upright text,
+ * negative for text that leans to the right
+ * (forward). */
+ FWORD underlinePosition; /* This is the suggested distance of the top
+ * of the underline from the baseline
+ * (negative values indicate below baseline).
+ * The PostScript definition of this FontInfo
+ * dictionary key (the y coordinate of the
+ * center of the stroke) is not used for
+ * historical reasons. The value of the
+ * PostScript key may be calculated by
+ * subtracting half the underlineThickness
+ * from the value of this field. */
+ FWORD underlineThickness; /* Suggested values for the underline
+ thickness. */
+ ULONG isFixedPitch; /* Set to 0 if the font is proportionally
+ * spaced, non-zero if the font is not
+ * proportionally spaced (i.e. monospaced). */
+ ULONG minMemType42; /* Minimum memory usage when an OpenType font
+ * is downloaded. */
+ ULONG maxMemType42; /* Maximum memory usage when an OpenType font
+ * is downloaded. */
+ ULONG minMemType1; /* Minimum memory usage when an OpenType font
+ * is downloaded as a Type 1 font. */
+ ULONG maxMemType1; /* Maximum memory usage when an OpenType font
+ * is downloaded as a Type 1 font. */
+/*postV2Tail v2[VAR];*/
+ DEFINE_SIZE_STATIC (32);
+};
+
+} /* namespace OT */
+
+
+#endif /* HB_OT_POST_TABLE_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-table.hh
index 80d5044354..736c7f76b3 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-table.hh
@@ -6,10 +6,10 @@
*
* on files with these headers:
*
- * # ArabicShaping-8.0.0.txt
- * # Date: 2015-02-17, 23:33:00 GMT [RP]
- * # Blocks-8.0.0.txt
- * # Date: 2014-11-10, 23:04:00 GMT [KW]
+ * # ArabicShaping-9.0.0.txt
+ * # Date: 2016-02-24, 22:25:00 GMT [RP]
+ * # Blocks-9.0.0.txt
+ * # Date: 2016-02-05, 23:48:00 GMT [KW]
* UnicodeData.txt does not have a header.
*/
@@ -19,6 +19,7 @@
#define X JOINING_TYPE_X
#define R JOINING_TYPE_R
+#define T JOINING_TYPE_T
#define U JOINING_TYPE_U
#define A JOINING_GROUP_ALAPH
#define DR JOINING_GROUP_DALATH_RISH
@@ -76,9 +77,11 @@ static const uint8_t joining_table[] =
/* Arabic Extended-A */
- /* 08A0 */ D,D,D,D,D,D,D,D,D,D,R,R,R,U,R,D,D,R,R,D,D,
+ /* 08A0 */ D,D,D,D,D,D,D,D,D,D,R,R,R,U,R,D,D,R,R,D,D,X,D,D,D,R,D,D,D,D,X,X,
+ /* 08C0 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
+ /* 08E0 */ X,X,U,
-#define joining_offset_0x1806u 693
+#define joining_offset_0x1806u 739
/* Mongolian */
@@ -86,43 +89,48 @@ static const uint8_t joining_table[] =
/* 1820 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
/* 1840 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
/* 1860 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,X,X,X,X,X,X,X,X,
- /* 1880 */ U,U,U,U,U,U,U,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
+ /* 1880 */ U,U,U,U,U,T,T,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
/* 18A0 */ D,D,D,D,D,D,D,D,D,X,D,
-#define joining_offset_0x200cu 858
+#define joining_offset_0x200cu 904
/* General Punctuation */
- /* 2000 */ U,C,
+ /* 2000 */ U,C,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
+ /* 2020 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,U,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
+ /* 2040 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
+ /* 2060 */ X,X,X,X,X,X,U,U,U,U,
-#define joining_offset_0x2066u 860
-
- /* General Punctuation */
-
- /* 2060 */ U,U,U,U,
-
-#define joining_offset_0xa840u 864
+#define joining_offset_0xa840u 998
/* Phags-pa */
/* A840 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
/* A860 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,L,U,
-#define joining_offset_0x10ac0u 916
+#define joining_offset_0x10ac0u 1050
/* Manichaean */
/* 10AC0 */ D,D,D,D,D,R,U,R,U,R,R,U,U,L,R,R,R,R,R,D,D,D,D,L,D,D,D,D,D,R,D,D,
/* 10AE0 */ D,R,U,U,R,X,X,X,X,X,X,D,D,D,D,R,
-#define joining_offset_0x10b80u 964
+#define joining_offset_0x10b80u 1098
/* Psalter Pahlavi */
/* 10B80 */ D,R,D,R,R,R,D,D,D,R,D,D,R,D,R,R,D,R,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
/* 10BA0 */ X,X,X,X,X,X,X,X,X,R,R,R,R,D,D,U,
-}; /* Table items: 1012; occupancy: 57% */
+#define joining_offset_0x1e900u 1146
+
+ /* Adlam */
+
+ /* 1E900 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
+ /* 1E920 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
+ /* 1E940 */ D,D,D,D,
+
+}; /* Table items: 1214; occupancy: 54% */
static unsigned int
@@ -131,7 +139,7 @@ joining_type (hb_codepoint_t u)
switch (u >> 12)
{
case 0x0u:
- if (hb_in_range (u, 0x0600u, 0x08B4u)) return joining_table[u - 0x0600u + joining_offset_0x0600u];
+ if (hb_in_range (u, 0x0600u, 0x08E2u)) return joining_table[u - 0x0600u + joining_offset_0x0600u];
break;
case 0x1u:
@@ -139,8 +147,7 @@ joining_type (hb_codepoint_t u)
break;
case 0x2u:
- if (hb_in_range (u, 0x200Cu, 0x200Du)) return joining_table[u - 0x200Cu + joining_offset_0x200cu];
- if (hb_in_range (u, 0x2066u, 0x2069u)) return joining_table[u - 0x2066u + joining_offset_0x2066u];
+ if (hb_in_range (u, 0x200Cu, 0x2069u)) return joining_table[u - 0x200Cu + joining_offset_0x200cu];
break;
case 0xAu:
@@ -152,6 +159,10 @@ joining_type (hb_codepoint_t u)
if (hb_in_range (u, 0x10B80u, 0x10BAFu)) return joining_table[u - 0x10B80u + joining_offset_0x10b80u];
break;
+ case 0x1Eu:
+ if (hb_in_range (u, 0x1E900u, 0x1E943u)) return joining_table[u - 0x1E900u + joining_offset_0x1e900u];
+ break;
+
default:
break;
}
@@ -160,6 +171,7 @@ joining_type (hb_codepoint_t u)
#undef X
#undef R
+#undef T
#undef U
#undef A
#undef DR
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-win1256.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-win1256.hh
new file mode 100644
index 0000000000..e70c48f427
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-win1256.hh
@@ -0,0 +1,323 @@
+/*
+ * Copyright © 2014 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_OT_SHAPE_COMPLEX_ARABIC_WIN1256_HH
+
+
+/*
+ * The macros in the first part of this file are generic macros that can
+ * be used to define the bytes for OpenType table data in code in a
+ * readable manner. We can move the macros to reside with their respective
+ * struct types, but since we only use these to define one data table, the
+ * Windows-1256 Arabic shaping table in this file, we keep them here.
+ */
+
+
+/* First we measure, then we cut. */
+#ifndef OT_MEASURE
+#define OT_MEASURE
+#define OT_TABLE_START static const struct TABLE_NAME {
+#define OT_TABLE_END }
+#define OT_LABEL_START(Name) unsigned char Name[
+#define OT_LABEL_END ];
+#define OT_BYTE(u8) +1/*byte*/
+#define OT_USHORT(u16) +2/*bytes*/
+#else
+#undef OT_MEASURE
+#define OT_TABLE_START TABLE_NAME = {
+#define OT_TABLE_END };
+#define OT_LABEL_START(Name) {
+#define OT_LABEL_END },
+#define OT_BYTE(u8) (u8),
+#define OT_USHORT(u16) (unsigned char)((u16)>>8), (unsigned char)((u16)&0xFFu),
+#define OT_COUNT(Name, ItemSize) ((unsigned int) sizeof(((struct TABLE_NAME*)0)->Name) \
+ / (unsigned int)(ItemSize) \
+ /* OT_ASSERT it's divisible (and positive). */)
+#define OT_DISTANCE(From,To) ((unsigned int) \
+ ((char*)(&((struct TABLE_NAME*)0)->To) - \
+ (char*)(&((struct TABLE_NAME*)0)->From)) \
+ /* OT_ASSERT it's positive. */)
+#endif
+
+
+#define OT_LABEL(Name) \
+ OT_LABEL_END \
+ OT_LABEL_START(Name)
+
+/* Whenever we receive an argument that is a list, it will expand to
+ * contain commas. That cannot be passed to another macro because the
+ * commas will throw off the preprocessor. The solution is to wrap
+ * the passed-in argument in OT_LIST() before passing to the next macro.
+ * Unfortunately this trick requires vararg macros. */
+#define OT_LIST(...) __VA_ARGS__
+
+
+/*
+ * Basic Types
+ */
+
+#define OT_TAG(a,b,c,d) \
+ OT_BYTE(a) OT_BYTE(b) OT_BYTE(c) OT_BYTE(d)
+
+#define OT_OFFSET(From, To) /* Offset from From to To in bytes */ \
+ OT_USHORT(OT_DISTANCE(From, To))
+
+#define OT_GLYPHID /* GlyphID */ \
+ OT_USHORT
+
+#define OT_UARRAY(Name, Items) \
+ OT_LABEL_START(Name) \
+ OT_USHORT(OT_COUNT(Name##Data, 2)) \
+ OT_LABEL(Name##Data) \
+ Items \
+ OT_LABEL_END
+
+#define OT_UHEADLESSARRAY(Name, Items) \
+ OT_LABEL_START(Name) \
+ OT_USHORT(OT_COUNT(Name##Data, 2) + 1) \
+ OT_LABEL(Name##Data) \
+ Items \
+ OT_LABEL_END
+
+
+/*
+ * Common Types
+ */
+
+#define OT_LOOKUP_FLAG_IGNORE_MARKS 0x08u
+
+#define OT_LOOKUP(Name, LookupType, LookupFlag, SubLookupOffsets) \
+ OT_LABEL_START(Name) \
+ OT_USHORT(LookupType) \
+ OT_USHORT(LookupFlag) \
+ OT_LABEL_END \
+ OT_UARRAY(Name##SubLookupOffsetsArray, OT_LIST(SubLookupOffsets))
+
+#define OT_SUBLOOKUP(Name, SubFormat, Items) \
+ OT_LABEL_START(Name) \
+ OT_USHORT(SubFormat) \
+ Items
+
+#define OT_COVERAGE1(Name, Items) \
+ OT_LABEL_START(Name) \
+ OT_USHORT(1) \
+ OT_LABEL_END \
+ OT_UARRAY(Name##Glyphs, OT_LIST(Items))
+
+
+/*
+ * GSUB
+ */
+
+#define OT_LOOKUP_TYPE_SUBST_SINGLE 1u
+#define OT_LOOKUP_TYPE_SUBST_LIGATURE 4u
+
+#define OT_SUBLOOKUP_SINGLE_SUBST_FORMAT2(Name, FromGlyphs, ToGlyphs) \
+ OT_SUBLOOKUP(Name, 2, \
+ OT_OFFSET(Name, Name##Coverage) \
+ OT_LABEL_END \
+ OT_UARRAY(Name##Substitute, OT_LIST(ToGlyphs)) \
+ ) \
+ OT_COVERAGE1(Name##Coverage, OT_LIST(FromGlyphs)) \
+ /* ASSERT_STATIC_EXPR_ZERO (len(FromGlyphs) == len(ToGlyphs)) */
+
+#define OT_SUBLOOKUP_LIGATURE_SUBST_FORMAT1(Name, FirstGlyphs, LigatureSetOffsets) \
+ OT_SUBLOOKUP(Name, 1, \
+ OT_OFFSET(Name, Name##Coverage) \
+ OT_LABEL_END \
+ OT_UARRAY(Name##LigatureSetOffsetsArray, OT_LIST(LigatureSetOffsets)) \
+ ) \
+ OT_COVERAGE1(Name##Coverage, OT_LIST(FirstGlyphs)) \
+ /* ASSERT_STATIC_EXPR_ZERO (len(FirstGlyphs) == len(LigatureSetOffsets)) */
+
+#define OT_LIGATURE_SET(Name, LigatureSetOffsets) \
+ OT_UARRAY(Name, OT_LIST(LigatureSetOffsets))
+
+#define OT_LIGATURE(Name, Components, LigGlyph) \
+ OT_LABEL_START(Name) \
+ LigGlyph \
+ OT_LABEL_END \
+ OT_UHEADLESSARRAY(Name##ComponentsArray, OT_LIST(Components))
+
+/*
+ *
+ * Start of Windows-1256 shaping table.
+ *
+ */
+
+/* Table name. */
+#define TABLE_NAME arabic_win1256_gsub_lookups
+
+/* Table manifest. */
+#define MANIFEST(Items) \
+ OT_LABEL_START(manifest) \
+ OT_USHORT(OT_COUNT(manifestData, 6)) \
+ OT_LABEL(manifestData) \
+ Items \
+ OT_LABEL_END
+
+#define MANIFEST_LOOKUP(Tag, Name) \
+ Tag \
+ OT_OFFSET(manifest, Name)
+
+/* Shorthand. */
+#define G OT_GLYPHID
+
+/*
+ * Table Start
+ */
+OT_TABLE_START
+
+
+/*
+ * Manifest
+ */
+MANIFEST(
+ MANIFEST_LOOKUP(OT_TAG('r','l','i','g'), rligLookup)
+ MANIFEST_LOOKUP(OT_TAG('i','n','i','t'), initLookup)
+ MANIFEST_LOOKUP(OT_TAG('m','e','d','i'), mediLookup)
+ MANIFEST_LOOKUP(OT_TAG('f','i','n','a'), finaLookup)
+ MANIFEST_LOOKUP(OT_TAG('r','l','i','g'), rligMarksLookup)
+)
+
+/*
+ * Lookups
+ */
+OT_LOOKUP(initLookup, OT_LOOKUP_TYPE_SUBST_SINGLE, OT_LOOKUP_FLAG_IGNORE_MARKS,
+ OT_OFFSET(initLookup, initmediSubLookup)
+ OT_OFFSET(initLookup, initSubLookup)
+)
+OT_LOOKUP(mediLookup, OT_LOOKUP_TYPE_SUBST_SINGLE, OT_LOOKUP_FLAG_IGNORE_MARKS,
+ OT_OFFSET(mediLookup, initmediSubLookup)
+ OT_OFFSET(mediLookup, mediSubLookup)
+ OT_OFFSET(mediLookup, medifinaLamAlefSubLookup)
+)
+OT_LOOKUP(finaLookup, OT_LOOKUP_TYPE_SUBST_SINGLE, OT_LOOKUP_FLAG_IGNORE_MARKS,
+ OT_OFFSET(finaLookup, finaSubLookup)
+ /* We don't need this one currently as the sequence inherits masks
+ * from the first item. Just in case we change that in the future
+ * to be smart about Arabic masks when ligating... */
+ OT_OFFSET(finaLookup, medifinaLamAlefSubLookup)
+)
+OT_LOOKUP(rligLookup, OT_LOOKUP_TYPE_SUBST_LIGATURE, OT_LOOKUP_FLAG_IGNORE_MARKS,
+ OT_OFFSET(rligLookup, lamAlefLigaturesSubLookup)
+)
+OT_LOOKUP(rligMarksLookup, OT_LOOKUP_TYPE_SUBST_LIGATURE, 0,
+ OT_OFFSET(rligMarksLookup, shaddaLigaturesSubLookup)
+)
+
+/*
+ * init/medi/fina forms
+ */
+OT_SUBLOOKUP_SINGLE_SUBST_FORMAT2(initmediSubLookup,
+ G(198) G(200) G(201) G(202) G(203) G(204) G(205) G(206) G(211)
+ G(212) G(213) G(214) G(223) G(225) G(227) G(228) G(236) G(237),
+ G(162) G(4) G(5) G(5) G(6) G(7) G(9) G(11) G(13)
+ G(14) G(15) G(26) G(140) G(141) G(142) G(143) G(154) G(154)
+)
+OT_SUBLOOKUP_SINGLE_SUBST_FORMAT2(initSubLookup,
+ G(218) G(219) G(221) G(222) G(229),
+ G(27) G(30) G(128) G(131) G(144)
+)
+OT_SUBLOOKUP_SINGLE_SUBST_FORMAT2(mediSubLookup,
+ G(218) G(219) G(221) G(222) G(229),
+ G(28) G(31) G(129) G(138) G(149)
+)
+OT_SUBLOOKUP_SINGLE_SUBST_FORMAT2(finaSubLookup,
+ G(194) G(195) G(197) G(198) G(199) G(201) G(204) G(205) G(206)
+ G(218) G(219) G(229) G(236) G(237),
+ G(2) G(1) G(3) G(181) G(0) G(159) G(8) G(10) G(12)
+ G(29) G(127) G(152) G(160) G(156)
+)
+OT_SUBLOOKUP_SINGLE_SUBST_FORMAT2(medifinaLamAlefSubLookup,
+ G(165) G(178) G(180) G(252),
+ G(170) G(179) G(185) G(255)
+)
+
+/*
+ * Lam+Alef ligatures
+ */
+OT_SUBLOOKUP_LIGATURE_SUBST_FORMAT1(lamAlefLigaturesSubLookup,
+ G(225),
+ OT_OFFSET(lamAlefLigaturesSubLookup, lamLigatureSet)
+)
+OT_LIGATURE_SET(lamLigatureSet,
+ OT_OFFSET(lamLigatureSet, lamInitLigature1)
+ OT_OFFSET(lamLigatureSet, lamInitLigature2)
+ OT_OFFSET(lamLigatureSet, lamInitLigature3)
+ OT_OFFSET(lamLigatureSet, lamInitLigature4)
+)
+OT_LIGATURE(lamInitLigature1, G(199), G(165))
+OT_LIGATURE(lamInitLigature2, G(195), G(178))
+OT_LIGATURE(lamInitLigature3, G(194), G(180))
+OT_LIGATURE(lamInitLigature4, G(197), G(252))
+
+/*
+ * Shadda ligatures
+ */
+OT_SUBLOOKUP_LIGATURE_SUBST_FORMAT1(shaddaLigaturesSubLookup,
+ G(248),
+ OT_OFFSET(shaddaLigaturesSubLookup, shaddaLigatureSet)
+)
+OT_LIGATURE_SET(shaddaLigatureSet,
+ OT_OFFSET(shaddaLigatureSet, shaddaLigature1)
+ OT_OFFSET(shaddaLigatureSet, shaddaLigature2)
+ OT_OFFSET(shaddaLigatureSet, shaddaLigature3)
+)
+OT_LIGATURE(shaddaLigature1, G(243), G(172))
+OT_LIGATURE(shaddaLigature2, G(245), G(173))
+OT_LIGATURE(shaddaLigature3, G(246), G(175))
+
+/*
+ * Table end
+ */
+OT_TABLE_END
+
+
+/*
+ * Clean up
+ */
+#undef OT_TABLE_START
+#undef OT_TABLE_END
+#undef OT_LABEL_START
+#undef OT_LABEL_END
+#undef OT_BYTE
+#undef OT_USHORT
+#undef OT_DISTANCE
+#undef OT_COUNT
+
+/*
+ * Include a second time to get the table data...
+ */
+#if 0
+#include "hb-private.hh" /* Make check-includes.sh happy. */
+#endif
+#ifdef OT_MEASURE
+#include "hb-ot-shape-complex-arabic-win1256.hh"
+#endif
+
+#define HB_OT_SHAPE_COMPLEX_ARABIC_WIN1256_HH
+#endif /* HB_OT_SHAPE_COMPLEX_ARABIC_WIN1256_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic.cc
index cde02e0a56..56ec5cd65c 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic.cc
@@ -28,9 +28,38 @@
#include "hb-ot-shape-private.hh"
+#ifndef HB_DEBUG_ARABIC
+#define HB_DEBUG_ARABIC (HB_DEBUG+0)
+#endif
+
+
/* buffer var allocations */
#define arabic_shaping_action() complex_var_u8_0() /* arabic shaping action */
+#define HB_BUFFER_SCRATCH_FLAG_ARABIC_HAS_STCH HB_BUFFER_SCRATCH_FLAG_COMPLEX0
+
+/* See:
+ * https://github.com/behdad/harfbuzz/commit/6e6f82b6f3dde0fc6c3c7d991d9ec6cfff57823d#commitcomment-14248516 */
+#define HB_ARABIC_GENERAL_CATEGORY_IS_WORD(gen_cat) \
+ (FLAG_SAFE (gen_cat) & \
+ (FLAG (HB_UNICODE_GENERAL_CATEGORY_UNASSIGNED) | \
+ FLAG (HB_UNICODE_GENERAL_CATEGORY_PRIVATE_USE) | \
+ /*FLAG (HB_UNICODE_GENERAL_CATEGORY_LOWERCASE_LETTER) |*/ \
+ FLAG (HB_UNICODE_GENERAL_CATEGORY_MODIFIER_LETTER) | \
+ FLAG (HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER) | \
+ /*FLAG (HB_UNICODE_GENERAL_CATEGORY_TITLECASE_LETTER) |*/ \
+ /*FLAG (HB_UNICODE_GENERAL_CATEGORY_UPPERCASE_LETTER) |*/ \
+ FLAG (HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) | \
+ FLAG (HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) | \
+ FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) | \
+ FLAG (HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER) | \
+ FLAG (HB_UNICODE_GENERAL_CATEGORY_LETTER_NUMBER) | \
+ FLAG (HB_UNICODE_GENERAL_CATEGORY_OTHER_NUMBER) | \
+ FLAG (HB_UNICODE_GENERAL_CATEGORY_CURRENCY_SYMBOL) | \
+ FLAG (HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL) | \
+ FLAG (HB_UNICODE_GENERAL_CATEGORY_MATH_SYMBOL) | \
+ FLAG (HB_UNICODE_GENERAL_CATEGORY_OTHER_SYMBOL)))
+
/*
* Joining types:
@@ -84,7 +113,7 @@ static const hb_tag_t arabic_features[] =
/* Same order as the feature array */
-enum {
+enum arabic_action_t {
ISOL,
FINA,
FIN2,
@@ -95,7 +124,11 @@ enum {
NONE,
- ARABIC_NUM_FEATURES = NONE
+ ARABIC_NUM_FEATURES = NONE,
+
+ /* We abuse the same byte for other things... */
+ STCH_FIXED,
+ STCH_REPEATING,
};
static const struct arabic_state_table_entry {
@@ -140,6 +173,11 @@ arabic_fallback_shape (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer);
static void
+record_stch (const hb_ot_shape_plan_t *plan,
+ hb_font_t *font,
+ hb_buffer_t *buffer);
+
+static void
collect_features_arabic (hb_ot_shape_planner_t *plan)
{
hb_ot_map_builder_t *map = &plan->map;
@@ -165,6 +203,9 @@ collect_features_arabic (hb_ot_shape_planner_t *plan)
map->add_gsub_pause (nuke_joiners);
+ map->add_global_bool_feature (HB_TAG('s','t','c','h'));
+ map->add_gsub_pause (record_stch);
+
map->add_global_bool_feature (HB_TAG('c','c','m','p'));
map->add_global_bool_feature (HB_TAG('l','o','c','l'));
@@ -182,7 +223,6 @@ collect_features_arabic (hb_ot_shape_planner_t *plan)
map->add_gsub_pause (arabic_fallback_shape);
map->add_global_bool_feature (HB_TAG('c','a','l','t'));
- map->add_gsub_pause (NULL);
/* The spec includes 'cswh'. Earlier versions of Windows
* used to enable this by default, but testing suggests
@@ -192,6 +232,7 @@ collect_features_arabic (hb_ot_shape_planner_t *plan)
* Note that IranNastaliq uses this feature extensively
* to fixup broken glyph sequences. Oh well...
* Test case: U+0643,U+0640,U+0631. */
+ //map->add_gsub_pause (NULL);
//map->add_global_bool_feature (HB_TAG('c','s','w','h'));
map->add_global_bool_feature (HB_TAG('m','s','e','t'));
}
@@ -208,8 +249,10 @@ struct arabic_shape_plan_t
* mask_array[NONE] == 0. */
hb_mask_t mask_array[ARABIC_NUM_FEATURES + 1];
- bool do_fallback;
arabic_fallback_plan_t *fallback_plan;
+
+ unsigned int do_fallback : 1;
+ unsigned int has_stch : 1;
};
void *
@@ -220,6 +263,7 @@ data_create_arabic (const hb_ot_shape_plan_t *plan)
return NULL;
arabic_plan->do_fallback = plan->props.script == HB_SCRIPT_ARABIC;
+ arabic_plan->has_stch = !!plan->map.get_1_mask (HB_TAG ('s','t','c','h'));
for (unsigned int i = 0; i < ARABIC_NUM_FEATURES; i++) {
arabic_plan->mask_array[i] = plan->map.get_1_mask (arabic_features[i]);
arabic_plan->do_fallback = arabic_plan->do_fallback &&
@@ -320,8 +364,6 @@ setup_masks_arabic_plan (const arabic_shape_plan_t *arabic_plan,
hb_glyph_info_t *info = buffer->info;
for (unsigned int i = 0; i < count; i++)
info[i].mask |= arabic_plan->mask_array[info[i].arabic_shaping_action()];
-
- HB_BUFFER_DEALLOCATE_VAR (buffer, arabic_shaping_action);
}
static void
@@ -371,6 +413,197 @@ retry:
arabic_fallback_plan_shape (fallback_plan, font, buffer);
}
+/*
+ * Stretch feature: "stch".
+ * See example here:
+ * https://www.microsoft.com/typography/OpenTypeDev/syriac/intro.htm
+ * We implement this in a generic way, such that the Arabic subtending
+ * marks can use it as well.
+ */
+
+static void
+record_stch (const hb_ot_shape_plan_t *plan,
+ hb_font_t *font,
+ hb_buffer_t *buffer)
+{
+ const arabic_shape_plan_t *arabic_plan = (const arabic_shape_plan_t *) plan->data;
+ if (!arabic_plan->has_stch)
+ return;
+
+ /* 'stch' feature was just applied. Look for anything that multiplied,
+ * and record it for stch treatment later. Note that rtlm, frac, etc
+ * are applied before stch, but we assume that they didn't result in
+ * anything multiplying into 5 pieces, so it's safe-ish... */
+
+ unsigned int count = buffer->len;
+ hb_glyph_info_t *info = buffer->info;
+ for (unsigned int i = 0; i < count; i++)
+ if (unlikely (_hb_glyph_info_multiplied (&info[i])))
+ {
+ unsigned int comp = _hb_glyph_info_get_lig_comp (&info[i]);
+ info[i].arabic_shaping_action() = comp % 2 ? STCH_REPEATING : STCH_FIXED;
+ buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_ARABIC_HAS_STCH;
+ }
+}
+
+static void
+apply_stch (const hb_ot_shape_plan_t *plan,
+ hb_buffer_t *buffer,
+ hb_font_t *font)
+{
+ if (likely (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_ARABIC_HAS_STCH)))
+ return;
+
+ /* The Arabic shaper currently always processes in RTL mode, so we should
+ * stretch / position the stretched pieces to the left / preceding glyphs. */
+
+ /* We do a two pass implementation:
+ * First pass calculates the exact number of extra glyphs we need,
+ * We then enlarge buffer to have that much room,
+ * Second pass applies the stretch, copying things to the end of buffer.
+ */
+
+ int sign = font->x_scale < 0 ? -1 : +1;
+ unsigned int extra_glyphs_needed = 0; // Set during MEASURE, used during CUT
+ typedef enum { MEASURE, CUT } step_t;
+
+ for (step_t step = MEASURE; step <= CUT; step = (step_t) (step + 1))
+ {
+ unsigned int count = buffer->len;
+ hb_glyph_info_t *info = buffer->info;
+ hb_glyph_position_t *pos = buffer->pos;
+ unsigned int new_len = count + extra_glyphs_needed; // write head during CUT
+ unsigned int j = new_len;
+ for (unsigned int i = count; i; i--)
+ {
+ if (!hb_in_range<unsigned> (info[i - 1].arabic_shaping_action(), STCH_FIXED, STCH_REPEATING))
+ {
+ if (step == CUT)
+ {
+ --j;
+ info[j] = info[i - 1];
+ pos[j] = pos[i - 1];
+ }
+ continue;
+ }
+
+ /* Yay, justification! */
+
+ hb_position_t w_total = 0; // Total to be filled
+ hb_position_t w_fixed = 0; // Sum of fixed tiles
+ hb_position_t w_repeating = 0; // Sum of repeating tiles
+ int n_fixed = 0;
+ int n_repeating = 0;
+
+ unsigned int end = i;
+ while (i &&
+ hb_in_range<unsigned> (info[i - 1].arabic_shaping_action(), STCH_FIXED, STCH_REPEATING))
+ {
+ i--;
+ hb_position_t width = font->get_glyph_h_advance (info[i].codepoint);
+ if (info[i].arabic_shaping_action() == STCH_FIXED)
+ {
+ w_fixed += width;
+ n_fixed++;
+ }
+ else
+ {
+ w_repeating += width;
+ n_repeating++;
+ }
+ }
+ unsigned int start = i;
+ unsigned int context = i;
+ while (context &&
+ !hb_in_range<unsigned> (info[context - 1].arabic_shaping_action(), STCH_FIXED, STCH_REPEATING) &&
+ (_hb_glyph_info_is_default_ignorable (&info[context - 1]) ||
+ HB_ARABIC_GENERAL_CATEGORY_IS_WORD (_hb_glyph_info_get_general_category (&info[context - 1]))))
+ {
+ context--;
+ w_total += pos[context].x_advance;
+ }
+ i++; // Don't touch i again.
+
+ DEBUG_MSG (ARABIC, NULL, "%s stretch at (%d,%d,%d)",
+ step == MEASURE ? "measuring" : "cutting", context, start, end);
+ DEBUG_MSG (ARABIC, NULL, "rest of word: count=%d width %d", start - context, w_total);
+ DEBUG_MSG (ARABIC, NULL, "fixed tiles: count=%d width=%d", n_fixed, w_fixed);
+ DEBUG_MSG (ARABIC, NULL, "repeating tiles: count=%d width=%d", n_repeating, w_repeating);
+
+ /* Number of additional times to repeat each repeating tile. */
+ int n_copies = 0;
+
+ hb_position_t w_remaining = w_total - w_fixed;
+ if (sign * w_remaining > sign * w_repeating && sign * w_repeating > 0)
+ n_copies = (sign * w_remaining) / (sign * w_repeating) - 1;
+
+ /* See if we can improve the fit by adding an extra repeat and squeezing them together a bit. */
+ hb_position_t extra_repeat_overlap = 0;
+ hb_position_t shortfall = sign * w_remaining - sign * w_repeating * (n_copies + 1);
+ if (shortfall > 0)
+ {
+ ++n_copies;
+ hb_position_t excess = (n_copies + 1) * sign * w_repeating - sign * w_remaining;
+ if (excess > 0)
+ extra_repeat_overlap = excess / (n_copies * n_repeating);
+ }
+
+ if (step == MEASURE)
+ {
+ extra_glyphs_needed += n_copies * n_repeating;
+ DEBUG_MSG (ARABIC, NULL, "will add extra %d copies of repeating tiles", n_copies);
+ }
+ else
+ {
+ hb_position_t x_offset = 0;
+ for (unsigned int k = end; k > start; k--)
+ {
+ hb_position_t width = font->get_glyph_h_advance (info[k - 1].codepoint);
+
+ unsigned int repeat = 1;
+ if (info[k - 1].arabic_shaping_action() == STCH_REPEATING)
+ repeat += n_copies;
+
+ DEBUG_MSG (ARABIC, NULL, "appending %d copies of glyph %d; j=%d",
+ repeat, info[k - 1].codepoint, j);
+ for (unsigned int n = 0; n < repeat; n++)
+ {
+ x_offset -= width;
+ if (n > 0)
+ x_offset += extra_repeat_overlap;
+ pos[k - 1].x_offset = x_offset;
+ /* Append copy. */
+ --j;
+ info[j] = info[k - 1];
+ pos[j] = pos[k - 1];
+ }
+ }
+ }
+ }
+
+ if (step == MEASURE)
+ {
+ if (unlikely (!buffer->ensure (count + extra_glyphs_needed)))
+ break;
+ }
+ else
+ {
+ assert (j == 0);
+ buffer->len = new_len;
+ }
+ }
+}
+
+
+static void
+postprocess_glyphs_arabic (const hb_ot_shape_plan_t *plan,
+ hb_buffer_t *buffer,
+ hb_font_t *font)
+{
+ apply_stch (plan, buffer, font);
+
+ HB_BUFFER_DEALLOCATE_VAR (buffer, arabic_shaping_action);
+}
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_arabic =
{
@@ -379,11 +612,13 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_arabic =
NULL, /* override_features */
data_create_arabic,
data_destroy_arabic,
- NULL, /* preprocess_text_arabic */
+ NULL, /* preprocess_text */
+ postprocess_glyphs_arabic,
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
NULL, /* decompose */
NULL, /* compose */
setup_masks_arabic,
+ NULL, /* disable_otl */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
true, /* fallback_position */
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-default.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-default.cc
index f7f097eeda..42830ab618 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-default.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-default.cc
@@ -35,10 +35,12 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_default =
NULL, /* data_create */
NULL, /* data_destroy */
NULL, /* preprocess_text */
+ NULL, /* postprocess_glyphs */
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
NULL, /* decompose */
NULL, /* compose */
NULL, /* setup_masks */
- HB_OT_SHAPE_ZERO_WIDTH_MARKS_DEFAULT,
+ NULL, /* disable_otl */
+ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
true, /* fallback_position */
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-hangul.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-hangul.cc
index 1fa79ce6d4..eb95a28c09 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-hangul.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-hangul.cc
@@ -188,7 +188,7 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan,
*/
unsigned int count = buffer->len;
- for (buffer->idx = 0; buffer->idx < count;)
+ for (buffer->idx = 0; buffer->idx < count && !buffer->in_error;)
{
hb_codepoint_t u = buffer->cur().codepoint;
@@ -411,13 +411,15 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hangul =
"hangul",
collect_features_hangul,
override_features_hangul,
- data_create_hangul, /* data_create */
- data_destroy_hangul, /* data_destroy */
+ data_create_hangul,
+ data_destroy_hangul,
preprocess_text_hangul,
+ NULL, /* postprocess_glyphs */
HB_OT_SHAPE_NORMALIZATION_MODE_NONE,
NULL, /* decompose */
NULL, /* compose */
- setup_masks_hangul, /* setup_masks */
+ setup_masks_hangul,
+ NULL, /* disable_otl */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
false, /* fallback_position */
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-hebrew.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-hebrew.cc
index c7b7a5eba6..96f2494616 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-hebrew.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-hebrew.cc
@@ -68,7 +68,7 @@ compose_hebrew (const hb_ot_shape_normalize_context_t *c,
0xFB4Au /* TAV */
};
- bool found = c->unicode->compose (a, b, ab);
+ bool found = (bool) c->unicode->compose (a, b, ab);
if (!found && !c->plan->has_mark)
{
@@ -154,6 +154,18 @@ compose_hebrew (const hb_ot_shape_normalize_context_t *c,
return found;
}
+static bool
+disable_otl_hebrew (const hb_ot_shape_plan_t *plan)
+{
+ /* For Hebrew shaper, use fallback if GPOS does not have 'hebr'
+ * script. This matches Uniscribe better, and makes fonts like
+ * Arial that have GSUB/GPOS/GDEF but no data for Hebrew work.
+ * See:
+ * https://github.com/behdad/harfbuzz/issues/347#issuecomment-267838368
+ */
+ return plan->map.chosen_script[1] != HB_TAG ('h','e','b','r');
+}
+
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hebrew =
{
@@ -163,10 +175,12 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hebrew =
NULL, /* data_create */
NULL, /* data_destroy */
NULL, /* preprocess_text */
+ NULL, /* postprocess_glyphs */
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
NULL, /* decompose */
compose_hebrew,
NULL, /* setup_masks */
+ disable_otl_hebrew,
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
true, /* fallback_position */
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-machine.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-machine.hh
index f652d4fda7..5a7a265c87 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-machine.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-machine.hh
@@ -56,52 +56,52 @@ static const unsigned char _indic_syllable_machine_trans_keys[] = {
5u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u,
5u, 7u, 7u, 7u, 8u, 8u, 1u, 16u, 8u, 13u, 4u, 8u, 6u, 6u, 16u, 16u,
4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u,
- 16u, 16u, 8u, 8u, 1u, 31u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u,
- 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u,
- 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 5u, 14u, 5u, 14u,
+ 16u, 16u, 8u, 8u, 1u, 18u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u,
+ 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u,
+ 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u,
5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u,
3u, 10u, 5u, 10u, 3u, 10u, 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u,
3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u,
- 5u, 14u, 3u, 14u, 1u, 16u, 4u, 31u, 4u, 14u, 3u, 31u, 3u, 31u, 1u, 16u,
- 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u,
- 1u, 16u, 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u,
- 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
- 1u, 16u, 3u, 31u, 3u, 31u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u,
- 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u,
- 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 5u, 14u, 5u, 14u,
- 5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u,
- 3u, 10u, 5u, 10u, 3u, 10u, 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u,
- 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u,
- 5u, 14u, 3u, 14u, 1u, 16u, 4u, 31u, 4u, 14u, 3u, 31u, 3u, 31u, 1u, 16u,
- 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u,
- 1u, 16u, 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u,
- 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
- 4u, 14u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u,
- 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u,
- 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 5u, 14u, 5u, 14u, 5u, 10u,
+ 5u, 14u, 3u, 14u, 1u, 16u, 4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u,
+ 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u,
+ 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
+ 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
+ 3u, 17u, 3u, 17u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u,
+ 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u,
+ 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u, 5u, 10u,
9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u, 3u, 10u,
5u, 10u, 3u, 10u, 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u,
4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u,
- 3u, 14u, 1u, 16u, 4u, 31u, 4u, 14u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u,
- 1u, 16u, 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u,
- 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
- 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
- 4u, 14u, 3u, 31u, 4u, 14u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u,
- 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u,
- 3u, 31u, 4u, 31u, 1u, 16u, 3u, 31u, 3u, 31u, 4u, 31u, 5u, 14u, 5u, 14u,
- 5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u,
- 3u, 10u, 5u, 10u, 3u, 10u, 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u,
+ 3u, 14u, 1u, 16u, 4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u,
+ 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
+ 1u, 16u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
+ 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 4u, 14u, 1u, 16u,
+ 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u,
+ 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u,
+ 3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u, 5u, 10u, 9u, 10u, 9u, 9u,
+ 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u, 3u, 10u, 5u, 10u, 3u, 10u,
+ 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u,
+ 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 1u, 16u,
+ 4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
+ 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u,
+ 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u,
+ 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 4u, 14u, 3u, 17u, 4u, 14u,
+ 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u,
+ 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u,
+ 3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u, 5u, 10u, 9u, 10u, 9u, 9u,
+ 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u, 3u, 10u, 5u, 10u, 3u, 10u,
+ 3u, 13u, 3u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u,
+ 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 1u, 16u,
+ 4u, 14u, 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
+ 3u, 17u, 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u,
+ 3u, 17u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 3u, 17u,
+ 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 17u, 1u, 17u, 3u, 17u,
+ 1u, 17u, 4u, 14u, 5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u,
+ 5u, 10u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 3u, 17u, 3u, 17u, 1u, 16u,
3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u,
- 5u, 14u, 3u, 14u, 1u, 16u, 4u, 31u, 4u, 14u, 3u, 31u, 3u, 31u, 1u, 16u,
- 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u,
- 1u, 16u, 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u,
- 1u, 16u, 1u, 16u, 3u, 31u, 3u, 31u, 1u, 16u, 1u, 16u, 1u, 16u, 1u, 16u,
- 1u, 16u, 3u, 31u, 1u, 31u, 3u, 31u, 1u, 31u, 4u, 14u, 5u, 10u, 9u, 10u,
- 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 1u, 16u, 3u, 31u, 3u, 31u,
- 4u, 31u, 3u, 31u, 3u, 31u, 1u, 16u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u,
- 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u,
- 3u, 13u, 3u, 10u, 5u, 10u, 3u, 10u, 3u, 13u, 1u, 16u, 3u, 10u, 5u, 10u,
- 5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 0
+ 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 13u, 3u, 10u, 5u, 10u, 3u, 10u,
+ 3u, 13u, 1u, 16u, 3u, 10u, 5u, 10u, 5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u,
+ 9u, 10u, 9u, 9u, 5u, 10u, 0
};
static const char _indic_syllable_machine_key_spans[] = {
@@ -127,52 +127,52 @@ static const char _indic_syllable_machine_key_spans[] = {
3, 4, 3, 1, 4, 3, 1, 4,
3, 1, 1, 16, 6, 5, 1, 1,
5, 1, 1, 5, 1, 1, 5, 1,
- 1, 1, 31, 29, 29, 28, 16, 29,
- 29, 28, 16, 29, 29, 28, 16, 29,
- 29, 28, 16, 29, 29, 28, 10, 10,
+ 1, 1, 18, 15, 15, 14, 16, 15,
+ 15, 14, 16, 15, 15, 14, 16, 15,
+ 15, 14, 16, 15, 15, 14, 10, 10,
6, 2, 1, 2, 2, 1, 6, 11,
8, 6, 8, 11, 12, 12, 11, 10,
12, 11, 10, 12, 11, 10, 12, 11,
- 10, 12, 16, 28, 11, 29, 29, 16,
- 16, 16, 16, 16, 29, 29, 16, 16,
- 16, 16, 16, 29, 29, 16, 16, 16,
- 16, 16, 29, 29, 16, 16, 16, 16,
- 16, 29, 29, 29, 29, 28, 16, 29,
- 29, 28, 16, 29, 29, 28, 16, 29,
- 29, 28, 16, 29, 29, 28, 10, 10,
- 6, 2, 1, 2, 2, 1, 6, 11,
- 8, 6, 8, 11, 12, 12, 11, 10,
- 12, 11, 10, 12, 11, 10, 12, 11,
- 10, 12, 16, 28, 11, 29, 29, 16,
- 16, 16, 16, 16, 29, 29, 16, 16,
- 16, 16, 16, 29, 29, 16, 16, 16,
- 16, 16, 29, 29, 16, 16, 16, 16,
- 11, 16, 29, 29, 28, 16, 29, 29,
- 28, 16, 29, 29, 28, 16, 29, 29,
- 28, 16, 29, 29, 28, 10, 10, 6,
+ 10, 12, 16, 11, 15, 15, 16, 16,
+ 16, 16, 16, 15, 15, 16, 16, 16,
+ 16, 16, 15, 15, 16, 16, 16, 16,
+ 16, 15, 15, 16, 16, 16, 16, 16,
+ 15, 15, 15, 15, 14, 16, 15, 15,
+ 14, 16, 15, 15, 14, 16, 15, 15,
+ 14, 16, 15, 15, 14, 10, 10, 6,
2, 1, 2, 2, 1, 6, 11, 8,
6, 8, 11, 12, 12, 11, 10, 12,
11, 10, 12, 11, 10, 12, 11, 10,
- 12, 16, 28, 11, 29, 29, 16, 16,
- 16, 16, 16, 29, 29, 16, 16, 16,
- 16, 16, 29, 29, 16, 16, 16, 16,
- 16, 29, 29, 16, 16, 16, 16, 16,
- 11, 29, 11, 29, 29, 28, 16, 29,
- 29, 28, 16, 29, 29, 28, 16, 29,
- 29, 28, 16, 29, 29, 28, 10, 10,
- 6, 2, 1, 2, 2, 1, 6, 11,
- 8, 6, 8, 11, 12, 12, 11, 10,
+ 12, 16, 11, 15, 15, 16, 16, 16,
+ 16, 16, 15, 15, 16, 16, 16, 16,
+ 16, 15, 15, 16, 16, 16, 16, 16,
+ 15, 15, 16, 16, 16, 16, 11, 16,
+ 15, 15, 14, 16, 15, 15, 14, 16,
+ 15, 15, 14, 16, 15, 15, 14, 16,
+ 15, 15, 14, 10, 10, 6, 2, 1,
+ 2, 2, 1, 6, 11, 8, 6, 8,
+ 11, 12, 12, 11, 10, 12, 11, 10,
+ 12, 11, 10, 12, 11, 10, 12, 16,
+ 11, 15, 15, 16, 16, 16, 16, 16,
+ 15, 15, 16, 16, 16, 16, 16, 15,
+ 15, 16, 16, 16, 16, 16, 15, 15,
+ 16, 16, 16, 16, 16, 11, 15, 11,
+ 15, 15, 14, 16, 15, 15, 14, 16,
+ 15, 15, 14, 16, 15, 15, 14, 16,
+ 15, 15, 14, 10, 10, 6, 2, 1,
+ 2, 2, 1, 6, 11, 8, 6, 8,
+ 11, 12, 12, 11, 10, 12, 11, 10,
+ 12, 11, 10, 12, 11, 10, 12, 16,
+ 11, 15, 15, 16, 16, 16, 16, 16,
+ 15, 15, 16, 16, 16, 16, 16, 15,
+ 15, 16, 16, 16, 16, 16, 15, 15,
+ 16, 16, 16, 16, 16, 15, 17, 15,
+ 17, 11, 6, 2, 1, 2, 2, 1,
+ 6, 16, 15, 15, 14, 15, 15, 16,
12, 11, 10, 12, 11, 10, 12, 11,
- 10, 12, 16, 28, 11, 29, 29, 16,
- 16, 16, 16, 16, 29, 29, 16, 16,
- 16, 16, 16, 29, 29, 16, 16, 16,
- 16, 16, 29, 29, 16, 16, 16, 16,
- 16, 29, 31, 29, 31, 11, 6, 2,
- 1, 2, 2, 1, 6, 16, 29, 29,
- 28, 29, 29, 16, 12, 11, 10, 12,
- 11, 10, 12, 11, 10, 12, 11, 10,
- 11, 8, 6, 8, 11, 16, 8, 6,
- 6, 2, 1, 2, 2, 1, 6
+ 10, 12, 11, 10, 11, 8, 6, 8,
+ 11, 16, 8, 6, 6, 2, 1, 2,
+ 2, 1, 6
};
static const short _indic_syllable_machine_index_offsets[] = {
@@ -198,52 +198,52 @@ static const short _indic_syllable_machine_index_offsets[] = {
954, 958, 963, 967, 969, 974, 978, 980,
985, 989, 991, 993, 1010, 1017, 1023, 1025,
1027, 1033, 1035, 1037, 1043, 1045, 1047, 1053,
- 1055, 1057, 1059, 1091, 1121, 1151, 1180, 1197,
- 1227, 1257, 1286, 1303, 1333, 1363, 1392, 1409,
- 1439, 1469, 1498, 1515, 1545, 1575, 1604, 1615,
- 1626, 1633, 1636, 1638, 1641, 1644, 1646, 1653,
- 1665, 1674, 1681, 1690, 1702, 1715, 1728, 1740,
- 1751, 1764, 1776, 1787, 1800, 1812, 1823, 1836,
- 1848, 1859, 1872, 1889, 1918, 1930, 1960, 1990,
- 2007, 2024, 2041, 2058, 2075, 2105, 2135, 2152,
- 2169, 2186, 2203, 2220, 2250, 2280, 2297, 2314,
- 2331, 2348, 2365, 2395, 2425, 2442, 2459, 2476,
- 2493, 2510, 2540, 2570, 2600, 2630, 2659, 2676,
- 2706, 2736, 2765, 2782, 2812, 2842, 2871, 2888,
- 2918, 2948, 2977, 2994, 3024, 3054, 3083, 3094,
- 3105, 3112, 3115, 3117, 3120, 3123, 3125, 3132,
- 3144, 3153, 3160, 3169, 3181, 3194, 3207, 3219,
- 3230, 3243, 3255, 3266, 3279, 3291, 3302, 3315,
- 3327, 3338, 3351, 3368, 3397, 3409, 3439, 3469,
- 3486, 3503, 3520, 3537, 3554, 3584, 3614, 3631,
- 3648, 3665, 3682, 3699, 3729, 3759, 3776, 3793,
- 3810, 3827, 3844, 3874, 3904, 3921, 3938, 3955,
- 3972, 3984, 4001, 4031, 4061, 4090, 4107, 4137,
- 4167, 4196, 4213, 4243, 4273, 4302, 4319, 4349,
- 4379, 4408, 4425, 4455, 4485, 4514, 4525, 4536,
- 4543, 4546, 4548, 4551, 4554, 4556, 4563, 4575,
- 4584, 4591, 4600, 4612, 4625, 4638, 4650, 4661,
- 4674, 4686, 4697, 4710, 4722, 4733, 4746, 4758,
- 4769, 4782, 4799, 4828, 4840, 4870, 4900, 4917,
- 4934, 4951, 4968, 4985, 5015, 5045, 5062, 5079,
- 5096, 5113, 5130, 5160, 5190, 5207, 5224, 5241,
- 5258, 5275, 5305, 5335, 5352, 5369, 5386, 5403,
- 5420, 5432, 5462, 5474, 5504, 5534, 5563, 5580,
- 5610, 5640, 5669, 5686, 5716, 5746, 5775, 5792,
- 5822, 5852, 5881, 5898, 5928, 5958, 5987, 5998,
- 6009, 6016, 6019, 6021, 6024, 6027, 6029, 6036,
- 6048, 6057, 6064, 6073, 6085, 6098, 6111, 6123,
- 6134, 6147, 6159, 6170, 6183, 6195, 6206, 6219,
- 6231, 6242, 6255, 6272, 6301, 6313, 6343, 6373,
- 6390, 6407, 6424, 6441, 6458, 6488, 6518, 6535,
- 6552, 6569, 6586, 6603, 6633, 6663, 6680, 6697,
- 6714, 6731, 6748, 6778, 6808, 6825, 6842, 6859,
- 6876, 6893, 6923, 6955, 6985, 7017, 7029, 7036,
- 7039, 7041, 7044, 7047, 7049, 7056, 7073, 7103,
- 7133, 7162, 7192, 7222, 7239, 7252, 7264, 7275,
- 7288, 7300, 7311, 7324, 7336, 7347, 7360, 7372,
- 7383, 7395, 7404, 7411, 7420, 7432, 7449, 7458,
- 7465, 7472, 7475, 7477, 7480, 7483, 7485
+ 1055, 1057, 1059, 1078, 1094, 1110, 1125, 1142,
+ 1158, 1174, 1189, 1206, 1222, 1238, 1253, 1270,
+ 1286, 1302, 1317, 1334, 1350, 1366, 1381, 1392,
+ 1403, 1410, 1413, 1415, 1418, 1421, 1423, 1430,
+ 1442, 1451, 1458, 1467, 1479, 1492, 1505, 1517,
+ 1528, 1541, 1553, 1564, 1577, 1589, 1600, 1613,
+ 1625, 1636, 1649, 1666, 1678, 1694, 1710, 1727,
+ 1744, 1761, 1778, 1795, 1811, 1827, 1844, 1861,
+ 1878, 1895, 1912, 1928, 1944, 1961, 1978, 1995,
+ 2012, 2029, 2045, 2061, 2078, 2095, 2112, 2129,
+ 2146, 2162, 2178, 2194, 2210, 2225, 2242, 2258,
+ 2274, 2289, 2306, 2322, 2338, 2353, 2370, 2386,
+ 2402, 2417, 2434, 2450, 2466, 2481, 2492, 2503,
+ 2510, 2513, 2515, 2518, 2521, 2523, 2530, 2542,
+ 2551, 2558, 2567, 2579, 2592, 2605, 2617, 2628,
+ 2641, 2653, 2664, 2677, 2689, 2700, 2713, 2725,
+ 2736, 2749, 2766, 2778, 2794, 2810, 2827, 2844,
+ 2861, 2878, 2895, 2911, 2927, 2944, 2961, 2978,
+ 2995, 3012, 3028, 3044, 3061, 3078, 3095, 3112,
+ 3129, 3145, 3161, 3178, 3195, 3212, 3229, 3241,
+ 3258, 3274, 3290, 3305, 3322, 3338, 3354, 3369,
+ 3386, 3402, 3418, 3433, 3450, 3466, 3482, 3497,
+ 3514, 3530, 3546, 3561, 3572, 3583, 3590, 3593,
+ 3595, 3598, 3601, 3603, 3610, 3622, 3631, 3638,
+ 3647, 3659, 3672, 3685, 3697, 3708, 3721, 3733,
+ 3744, 3757, 3769, 3780, 3793, 3805, 3816, 3829,
+ 3846, 3858, 3874, 3890, 3907, 3924, 3941, 3958,
+ 3975, 3991, 4007, 4024, 4041, 4058, 4075, 4092,
+ 4108, 4124, 4141, 4158, 4175, 4192, 4209, 4225,
+ 4241, 4258, 4275, 4292, 4309, 4326, 4338, 4354,
+ 4366, 4382, 4398, 4413, 4430, 4446, 4462, 4477,
+ 4494, 4510, 4526, 4541, 4558, 4574, 4590, 4605,
+ 4622, 4638, 4654, 4669, 4680, 4691, 4698, 4701,
+ 4703, 4706, 4709, 4711, 4718, 4730, 4739, 4746,
+ 4755, 4767, 4780, 4793, 4805, 4816, 4829, 4841,
+ 4852, 4865, 4877, 4888, 4901, 4913, 4924, 4937,
+ 4954, 4966, 4982, 4998, 5015, 5032, 5049, 5066,
+ 5083, 5099, 5115, 5132, 5149, 5166, 5183, 5200,
+ 5216, 5232, 5249, 5266, 5283, 5300, 5317, 5333,
+ 5349, 5366, 5383, 5400, 5417, 5434, 5450, 5468,
+ 5484, 5502, 5514, 5521, 5524, 5526, 5529, 5532,
+ 5534, 5541, 5558, 5574, 5590, 5605, 5621, 5637,
+ 5654, 5667, 5679, 5690, 5703, 5715, 5726, 5739,
+ 5751, 5762, 5775, 5787, 5798, 5810, 5819, 5826,
+ 5835, 5847, 5864, 5873, 5880, 5887, 5890, 5892,
+ 5895, 5898, 5900
};
static const short _indic_syllable_machine_indicies[] = {
@@ -381,882 +381,684 @@ static const short _indic_syllable_machine_indicies[] = {
161, 161, 162, 157, 0, 183, 0, 184,
0, 186, 185, 188, 189, 190, 191, 192,
193, 84, 79, 194, 195, 196, 196, 156,
- 197, 198, 199, 200, 201, 187, 187, 187,
- 187, 187, 187, 187, 187, 187, 187, 187,
- 187, 202, 187, 204, 205, 206, 207, 6,
- 1, 208, 209, 203, 203, 38, 210, 203,
- 203, 211, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 212,
- 203, 213, 205, 214, 214, 6, 1, 208,
- 209, 203, 203, 203, 210, 203, 203, 211,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 212, 203, 205,
- 214, 214, 6, 1, 208, 209, 203, 203,
- 203, 210, 203, 203, 211, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 212, 203, 215, 203, 203, 203,
- 19, 216, 203, 1, 208, 209, 203, 203,
- 203, 217, 203, 215, 203, 218, 219, 220,
- 221, 6, 1, 208, 209, 203, 203, 36,
- 222, 203, 203, 211, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 212, 203, 223, 219, 224, 224, 6,
- 1, 208, 209, 203, 203, 203, 222, 203,
- 203, 211, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 212,
- 203, 219, 224, 224, 6, 1, 208, 209,
- 203, 203, 203, 222, 203, 203, 211, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 212, 203, 225, 203,
- 203, 203, 19, 226, 203, 1, 208, 209,
- 203, 203, 203, 217, 203, 225, 203, 227,
- 228, 229, 230, 6, 1, 208, 209, 203,
- 203, 34, 231, 203, 203, 211, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 212, 203, 232, 228, 233,
- 233, 6, 1, 208, 209, 203, 203, 203,
- 231, 203, 203, 211, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 212, 203, 228, 233, 233, 6, 1,
- 208, 209, 203, 203, 203, 231, 203, 203,
- 211, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 212, 203,
- 234, 203, 203, 203, 19, 235, 203, 1,
- 208, 209, 203, 203, 203, 217, 203, 234,
- 203, 236, 237, 238, 239, 6, 1, 208,
- 209, 203, 203, 32, 240, 203, 203, 211,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 212, 203, 241,
- 237, 242, 242, 6, 1, 208, 209, 203,
- 203, 203, 240, 203, 203, 211, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 212, 203, 237, 242, 242,
- 6, 1, 208, 209, 203, 203, 203, 240,
- 203, 203, 211, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 212, 203, 243, 203, 203, 203, 19, 244,
- 203, 1, 208, 209, 203, 203, 203, 217,
- 203, 243, 203, 245, 246, 247, 248, 6,
- 1, 208, 209, 203, 203, 30, 249, 203,
- 203, 211, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 212,
- 203, 250, 246, 251, 251, 6, 1, 208,
- 209, 203, 203, 203, 249, 203, 203, 211,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 212, 203, 246,
- 251, 251, 6, 1, 208, 209, 203, 203,
- 203, 249, 203, 203, 211, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 212, 203, 19, 252, 203, 1,
- 208, 209, 203, 203, 203, 217, 203, 253,
- 253, 203, 1, 208, 209, 203, 203, 203,
- 217, 203, 254, 203, 203, 255, 208, 209,
- 203, 208, 209, 203, 256, 203, 208, 257,
- 203, 208, 258, 203, 208, 203, 254, 203,
- 203, 203, 208, 209, 203, 259, 203, 260,
- 261, 203, 1, 208, 209, 203, 203, 4,
- 203, 3, 203, 253, 253, 203, 1, 208,
- 209, 203, 253, 253, 203, 1, 208, 209,
- 203, 259, 203, 253, 253, 203, 1, 208,
- 209, 203, 259, 203, 260, 253, 203, 1,
- 208, 209, 203, 203, 4, 203, 19, 203,
- 262, 262, 6, 1, 208, 209, 203, 203,
- 203, 217, 203, 263, 28, 264, 265, 9,
- 1, 208, 209, 203, 203, 203, 217, 203,
- 28, 264, 265, 9, 1, 208, 209, 203,
- 203, 203, 217, 203, 264, 264, 9, 1,
- 208, 209, 203, 203, 203, 217, 203, 266,
- 25, 267, 268, 12, 1, 208, 209, 203,
- 203, 203, 217, 203, 25, 267, 268, 12,
- 1, 208, 209, 203, 203, 203, 217, 203,
- 267, 267, 12, 1, 208, 209, 203, 203,
- 203, 217, 203, 269, 22, 270, 271, 15,
- 1, 208, 209, 203, 203, 203, 217, 203,
- 22, 270, 271, 15, 1, 208, 209, 203,
- 203, 203, 217, 203, 270, 270, 15, 1,
- 208, 209, 203, 203, 203, 217, 203, 272,
- 19, 253, 273, 203, 1, 208, 209, 203,
- 203, 203, 217, 203, 19, 253, 273, 203,
- 1, 208, 209, 203, 203, 203, 217, 203,
- 253, 274, 203, 1, 208, 209, 203, 203,
- 203, 217, 203, 19, 203, 253, 253, 203,
- 1, 208, 209, 203, 203, 203, 217, 203,
- 2, 3, 203, 203, 19, 252, 203, 1,
- 208, 209, 203, 203, 203, 217, 203, 2,
- 203, 246, 251, 251, 6, 1, 208, 209,
- 203, 203, 203, 249, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 212, 203, 246, 251,
- 251, 6, 1, 208, 209, 203, 203, 203,
- 249, 203, 245, 246, 251, 251, 6, 1,
- 208, 209, 203, 203, 203, 249, 203, 203,
- 211, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 212, 203,
- 245, 246, 247, 251, 6, 1, 208, 209,
- 203, 203, 30, 249, 203, 203, 211, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 212, 203, 243, 203,
- 275, 203, 262, 262, 6, 1, 208, 209,
- 203, 203, 203, 217, 203, 243, 203, 243,
- 203, 203, 203, 253, 253, 203, 1, 208,
- 209, 203, 203, 203, 217, 203, 243, 203,
- 243, 203, 203, 203, 253, 276, 203, 1,
- 208, 209, 203, 203, 203, 217, 203, 243,
- 203, 243, 203, 275, 203, 253, 253, 203,
- 1, 208, 209, 203, 203, 203, 217, 203,
- 243, 203, 243, 3, 203, 203, 19, 244,
- 203, 1, 208, 209, 203, 203, 203, 217,
- 203, 243, 203, 236, 237, 242, 242, 6,
- 1, 208, 209, 203, 203, 203, 240, 203,
- 203, 211, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 212,
- 203, 236, 237, 238, 242, 6, 1, 208,
- 209, 203, 203, 32, 240, 203, 203, 211,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 212, 203, 234,
- 203, 277, 203, 262, 262, 6, 1, 208,
- 209, 203, 203, 203, 217, 203, 234, 203,
- 234, 203, 203, 203, 253, 253, 203, 1,
- 208, 209, 203, 203, 203, 217, 203, 234,
- 203, 234, 203, 203, 203, 253, 278, 203,
- 1, 208, 209, 203, 203, 203, 217, 203,
- 234, 203, 234, 203, 277, 203, 253, 253,
- 203, 1, 208, 209, 203, 203, 203, 217,
- 203, 234, 203, 234, 3, 203, 203, 19,
- 235, 203, 1, 208, 209, 203, 203, 203,
- 217, 203, 234, 203, 227, 228, 233, 233,
- 6, 1, 208, 209, 203, 203, 203, 231,
- 203, 203, 211, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 212, 203, 227, 228, 229, 233, 6, 1,
- 208, 209, 203, 203, 34, 231, 203, 203,
- 211, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 212, 203,
- 225, 203, 279, 203, 262, 262, 6, 1,
- 208, 209, 203, 203, 203, 217, 203, 225,
- 203, 225, 203, 203, 203, 253, 253, 203,
- 1, 208, 209, 203, 203, 203, 217, 203,
- 225, 203, 225, 203, 203, 203, 253, 280,
- 203, 1, 208, 209, 203, 203, 203, 217,
- 203, 225, 203, 225, 203, 279, 203, 253,
- 253, 203, 1, 208, 209, 203, 203, 203,
- 217, 203, 225, 203, 225, 3, 203, 203,
- 19, 226, 203, 1, 208, 209, 203, 203,
- 203, 217, 203, 225, 203, 218, 219, 224,
- 224, 6, 1, 208, 209, 203, 203, 203,
- 222, 203, 203, 211, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 212, 203, 218, 219, 220, 224, 6,
- 1, 208, 209, 203, 203, 36, 222, 203,
- 203, 211, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 212,
- 203, 215, 203, 281, 203, 262, 262, 6,
- 1, 208, 209, 203, 203, 203, 217, 203,
- 215, 203, 215, 203, 203, 203, 253, 253,
- 203, 1, 208, 209, 203, 203, 203, 217,
- 203, 215, 203, 215, 203, 203, 203, 253,
- 282, 203, 1, 208, 209, 203, 203, 203,
- 217, 203, 215, 203, 215, 203, 281, 203,
- 253, 253, 203, 1, 208, 209, 203, 203,
- 203, 217, 203, 215, 203, 215, 3, 203,
- 203, 19, 216, 203, 1, 208, 209, 203,
- 203, 203, 217, 203, 215, 203, 204, 205,
- 214, 214, 6, 1, 208, 209, 203, 203,
- 203, 210, 203, 203, 211, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 212, 203, 204, 205, 206, 214,
- 6, 1, 208, 209, 203, 203, 38, 210,
- 203, 203, 211, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 212, 203, 284, 285, 286, 287, 45, 40,
- 288, 289, 283, 283, 77, 290, 283, 283,
- 291, 283, 283, 283, 283, 283, 283, 283,
- 283, 283, 283, 283, 283, 283, 292, 283,
- 293, 285, 294, 287, 45, 40, 288, 289,
- 283, 283, 283, 290, 283, 283, 291, 283,
- 283, 283, 283, 283, 283, 283, 283, 283,
- 283, 283, 283, 283, 292, 283, 285, 294,
- 287, 45, 40, 288, 289, 283, 283, 283,
- 290, 283, 283, 291, 283, 283, 283, 283,
- 283, 283, 283, 283, 283, 283, 283, 283,
- 283, 292, 283, 295, 283, 283, 283, 58,
- 296, 283, 40, 288, 289, 283, 283, 283,
- 297, 283, 295, 283, 298, 299, 300, 301,
- 45, 40, 288, 289, 283, 283, 75, 302,
- 283, 283, 291, 283, 283, 283, 283, 283,
- 283, 283, 283, 283, 283, 283, 283, 283,
- 292, 283, 303, 299, 304, 304, 45, 40,
- 288, 289, 283, 283, 283, 302, 283, 283,
- 291, 283, 283, 283, 283, 283, 283, 283,
- 283, 283, 283, 283, 283, 283, 292, 283,
- 299, 304, 304, 45, 40, 288, 289, 283,
- 283, 283, 302, 283, 283, 291, 283, 283,
- 283, 283, 283, 283, 283, 283, 283, 283,
- 283, 283, 283, 292, 283, 305, 283, 283,
- 283, 58, 306, 283, 40, 288, 289, 283,
- 283, 283, 297, 283, 305, 283, 307, 308,
- 309, 310, 45, 40, 288, 289, 283, 283,
- 73, 311, 283, 283, 291, 283, 283, 283,
- 283, 283, 283, 283, 283, 283, 283, 283,
- 283, 283, 292, 283, 312, 308, 313, 313,
- 45, 40, 288, 289, 283, 283, 283, 311,
- 283, 283, 291, 283, 283, 283, 283, 283,
- 283, 283, 283, 283, 283, 283, 283, 283,
- 292, 283, 308, 313, 313, 45, 40, 288,
- 289, 283, 283, 283, 311, 283, 283, 291,
- 283, 283, 283, 283, 283, 283, 283, 283,
- 283, 283, 283, 283, 283, 292, 283, 314,
- 283, 283, 283, 58, 315, 283, 40, 288,
- 289, 283, 283, 283, 297, 283, 314, 283,
- 316, 317, 318, 319, 45, 40, 288, 289,
- 283, 283, 71, 320, 283, 283, 291, 283,
- 283, 283, 283, 283, 283, 283, 283, 283,
- 283, 283, 283, 283, 292, 283, 321, 317,
- 322, 322, 45, 40, 288, 289, 283, 283,
- 283, 320, 283, 283, 291, 283, 283, 283,
- 283, 283, 283, 283, 283, 283, 283, 283,
- 283, 283, 292, 283, 317, 322, 322, 45,
- 40, 288, 289, 283, 283, 283, 320, 283,
- 283, 291, 283, 283, 283, 283, 283, 283,
- 283, 283, 283, 283, 283, 283, 283, 292,
- 283, 323, 283, 283, 283, 58, 324, 283,
- 40, 288, 289, 283, 283, 283, 297, 283,
- 323, 283, 325, 326, 327, 328, 45, 40,
- 288, 289, 283, 283, 69, 329, 283, 283,
- 291, 283, 283, 283, 283, 283, 283, 283,
- 283, 283, 283, 283, 283, 283, 292, 283,
- 330, 326, 331, 331, 45, 40, 288, 289,
- 283, 283, 283, 329, 283, 283, 291, 283,
- 283, 283, 283, 283, 283, 283, 283, 283,
- 283, 283, 283, 283, 292, 283, 326, 331,
- 331, 45, 40, 288, 289, 283, 283, 283,
- 329, 283, 283, 291, 283, 283, 283, 283,
- 283, 283, 283, 283, 283, 283, 283, 283,
- 283, 292, 283, 58, 332, 283, 40, 288,
- 289, 283, 283, 283, 297, 283, 333, 333,
- 283, 40, 288, 289, 283, 283, 283, 297,
- 283, 334, 283, 283, 335, 288, 289, 283,
- 288, 289, 283, 336, 283, 288, 337, 283,
- 288, 338, 283, 288, 283, 334, 283, 283,
- 283, 288, 289, 283, 339, 283, 340, 341,
- 283, 40, 288, 289, 283, 283, 43, 283,
- 42, 283, 333, 333, 283, 40, 288, 289,
- 283, 333, 333, 283, 40, 288, 289, 283,
- 339, 283, 333, 333, 283, 40, 288, 289,
- 283, 339, 283, 340, 333, 283, 40, 288,
- 289, 283, 283, 43, 283, 58, 283, 342,
- 342, 45, 40, 288, 289, 283, 283, 283,
- 297, 283, 343, 67, 344, 345, 48, 40,
- 288, 289, 283, 283, 283, 297, 283, 67,
- 344, 345, 48, 40, 288, 289, 283, 283,
- 283, 297, 283, 344, 344, 48, 40, 288,
- 289, 283, 283, 283, 297, 283, 346, 64,
- 347, 348, 51, 40, 288, 289, 283, 283,
- 283, 297, 283, 64, 347, 348, 51, 40,
- 288, 289, 283, 283, 283, 297, 283, 347,
- 347, 51, 40, 288, 289, 283, 283, 283,
- 297, 283, 349, 61, 350, 351, 54, 40,
- 288, 289, 283, 283, 283, 297, 283, 61,
- 350, 351, 54, 40, 288, 289, 283, 283,
- 283, 297, 283, 350, 350, 54, 40, 288,
- 289, 283, 283, 283, 297, 283, 352, 58,
- 333, 353, 283, 40, 288, 289, 283, 283,
- 283, 297, 283, 58, 333, 353, 283, 40,
- 288, 289, 283, 283, 283, 297, 283, 333,
- 354, 283, 40, 288, 289, 283, 283, 283,
- 297, 283, 58, 283, 333, 333, 283, 40,
- 288, 289, 283, 283, 283, 297, 283, 41,
- 42, 283, 283, 58, 332, 283, 40, 288,
- 289, 283, 283, 283, 297, 283, 41, 283,
- 326, 331, 331, 45, 40, 288, 289, 283,
- 283, 283, 329, 283, 283, 283, 283, 283,
- 283, 283, 283, 283, 283, 283, 283, 283,
- 283, 283, 283, 292, 283, 326, 331, 331,
- 45, 40, 288, 289, 283, 283, 283, 329,
- 283, 325, 326, 331, 331, 45, 40, 288,
- 289, 283, 283, 283, 329, 283, 283, 291,
- 283, 283, 283, 283, 283, 283, 283, 283,
- 283, 283, 283, 283, 283, 292, 283, 325,
- 326, 327, 331, 45, 40, 288, 289, 283,
- 283, 69, 329, 283, 283, 291, 283, 283,
- 283, 283, 283, 283, 283, 283, 283, 283,
- 283, 283, 283, 292, 283, 323, 283, 355,
- 283, 342, 342, 45, 40, 288, 289, 283,
- 283, 283, 297, 283, 323, 283, 323, 283,
- 283, 283, 333, 333, 283, 40, 288, 289,
- 283, 283, 283, 297, 283, 323, 283, 323,
- 283, 283, 283, 333, 356, 283, 40, 288,
- 289, 283, 283, 283, 297, 283, 323, 283,
- 323, 283, 355, 283, 333, 333, 283, 40,
- 288, 289, 283, 283, 283, 297, 283, 323,
- 283, 323, 42, 283, 283, 58, 324, 283,
- 40, 288, 289, 283, 283, 283, 297, 283,
- 323, 283, 316, 317, 322, 322, 45, 40,
- 288, 289, 283, 283, 283, 320, 283, 283,
- 291, 283, 283, 283, 283, 283, 283, 283,
- 283, 283, 283, 283, 283, 283, 292, 283,
- 316, 317, 318, 322, 45, 40, 288, 289,
- 283, 283, 71, 320, 283, 283, 291, 283,
- 283, 283, 283, 283, 283, 283, 283, 283,
- 283, 283, 283, 283, 292, 283, 314, 283,
- 357, 283, 342, 342, 45, 40, 288, 289,
- 283, 283, 283, 297, 283, 314, 283, 314,
- 283, 283, 283, 333, 333, 283, 40, 288,
- 289, 283, 283, 283, 297, 283, 314, 283,
- 314, 283, 283, 283, 333, 358, 283, 40,
- 288, 289, 283, 283, 283, 297, 283, 314,
- 283, 314, 283, 357, 283, 333, 333, 283,
- 40, 288, 289, 283, 283, 283, 297, 283,
- 314, 283, 314, 42, 283, 283, 58, 315,
- 283, 40, 288, 289, 283, 283, 283, 297,
- 283, 314, 283, 307, 308, 313, 313, 45,
- 40, 288, 289, 283, 283, 283, 311, 283,
- 283, 291, 283, 283, 283, 283, 283, 283,
- 283, 283, 283, 283, 283, 283, 283, 292,
- 283, 307, 308, 309, 313, 45, 40, 288,
- 289, 283, 283, 73, 311, 283, 283, 291,
- 283, 283, 283, 283, 283, 283, 283, 283,
- 283, 283, 283, 283, 283, 292, 283, 305,
- 283, 359, 283, 342, 342, 45, 40, 288,
- 289, 283, 283, 283, 297, 283, 305, 283,
- 305, 283, 283, 283, 333, 333, 283, 40,
- 288, 289, 283, 283, 283, 297, 283, 305,
- 283, 305, 283, 283, 283, 333, 360, 283,
- 40, 288, 289, 283, 283, 283, 297, 283,
- 305, 283, 305, 283, 359, 283, 333, 333,
- 283, 40, 288, 289, 283, 283, 283, 297,
- 283, 305, 283, 305, 42, 283, 283, 58,
- 306, 283, 40, 288, 289, 283, 283, 283,
- 297, 283, 305, 283, 298, 299, 304, 304,
- 45, 40, 288, 289, 283, 283, 283, 302,
- 283, 283, 291, 283, 283, 283, 283, 283,
- 283, 283, 283, 283, 283, 283, 283, 283,
- 292, 283, 298, 299, 300, 304, 45, 40,
- 288, 289, 283, 283, 75, 302, 283, 283,
- 291, 283, 283, 283, 283, 283, 283, 283,
- 283, 283, 283, 283, 283, 283, 292, 283,
- 295, 283, 361, 283, 342, 342, 45, 40,
- 288, 289, 283, 283, 283, 297, 283, 295,
- 283, 295, 283, 283, 283, 333, 333, 283,
- 40, 288, 289, 283, 283, 283, 297, 283,
- 295, 283, 295, 283, 283, 283, 333, 362,
- 283, 40, 288, 289, 283, 283, 283, 297,
- 283, 295, 283, 295, 283, 361, 283, 333,
- 333, 283, 40, 288, 289, 283, 283, 283,
- 297, 283, 295, 283, 76, 44, 44, 45,
- 40, 283, 283, 283, 283, 283, 76, 283,
- 295, 42, 283, 283, 58, 296, 283, 40,
- 288, 289, 283, 283, 283, 297, 283, 295,
- 283, 284, 285, 294, 287, 45, 40, 288,
- 289, 283, 283, 283, 290, 283, 283, 291,
- 283, 283, 283, 283, 283, 283, 283, 283,
- 283, 283, 283, 283, 283, 292, 283, 364,
- 191, 365, 365, 84, 79, 194, 195, 363,
- 363, 363, 197, 363, 363, 200, 363, 363,
- 363, 363, 363, 363, 363, 363, 363, 363,
- 363, 363, 363, 202, 363, 191, 365, 365,
- 84, 79, 194, 195, 363, 363, 363, 197,
- 363, 363, 200, 363, 363, 363, 363, 363,
- 363, 363, 363, 363, 363, 363, 363, 363,
- 202, 363, 366, 363, 363, 363, 98, 367,
- 363, 79, 194, 195, 363, 363, 363, 368,
- 363, 366, 363, 369, 370, 371, 372, 84,
- 79, 194, 195, 363, 363, 115, 373, 363,
- 363, 200, 363, 363, 363, 363, 363, 363,
- 363, 363, 363, 363, 363, 363, 363, 202,
- 363, 374, 370, 375, 375, 84, 79, 194,
- 195, 363, 363, 363, 373, 363, 363, 200,
- 363, 363, 363, 363, 363, 363, 363, 363,
- 363, 363, 363, 363, 363, 202, 363, 370,
- 375, 375, 84, 79, 194, 195, 363, 363,
- 363, 373, 363, 363, 200, 363, 363, 363,
- 363, 363, 363, 363, 363, 363, 363, 363,
- 363, 363, 202, 363, 376, 363, 363, 363,
- 98, 377, 363, 79, 194, 195, 363, 363,
- 363, 368, 363, 376, 363, 378, 379, 380,
- 381, 84, 79, 194, 195, 363, 363, 113,
- 382, 363, 363, 200, 363, 363, 363, 363,
- 363, 363, 363, 363, 363, 363, 363, 363,
- 363, 202, 363, 383, 379, 384, 384, 84,
- 79, 194, 195, 363, 363, 363, 382, 363,
- 363, 200, 363, 363, 363, 363, 363, 363,
- 363, 363, 363, 363, 363, 363, 363, 202,
- 363, 379, 384, 384, 84, 79, 194, 195,
- 363, 363, 363, 382, 363, 363, 200, 363,
- 363, 363, 363, 363, 363, 363, 363, 363,
- 363, 363, 363, 363, 202, 363, 385, 363,
- 363, 363, 98, 386, 363, 79, 194, 195,
- 363, 363, 363, 368, 363, 385, 363, 387,
- 388, 389, 390, 84, 79, 194, 195, 363,
- 363, 111, 391, 363, 363, 200, 363, 363,
- 363, 363, 363, 363, 363, 363, 363, 363,
- 363, 363, 363, 202, 363, 392, 388, 393,
- 393, 84, 79, 194, 195, 363, 363, 363,
- 391, 363, 363, 200, 363, 363, 363, 363,
- 363, 363, 363, 363, 363, 363, 363, 363,
- 363, 202, 363, 388, 393, 393, 84, 79,
- 194, 195, 363, 363, 363, 391, 363, 363,
- 200, 363, 363, 363, 363, 363, 363, 363,
- 363, 363, 363, 363, 363, 363, 202, 363,
- 394, 363, 363, 363, 98, 395, 363, 79,
- 194, 195, 363, 363, 363, 368, 363, 394,
- 363, 396, 397, 398, 399, 84, 79, 194,
- 195, 363, 363, 109, 400, 363, 363, 200,
- 363, 363, 363, 363, 363, 363, 363, 363,
- 363, 363, 363, 363, 363, 202, 363, 401,
- 397, 402, 402, 84, 79, 194, 195, 363,
- 363, 363, 400, 363, 363, 200, 363, 363,
- 363, 363, 363, 363, 363, 363, 363, 363,
- 363, 363, 363, 202, 363, 397, 402, 402,
- 84, 79, 194, 195, 363, 363, 363, 400,
- 363, 363, 200, 363, 363, 363, 363, 363,
- 363, 363, 363, 363, 363, 363, 363, 363,
- 202, 363, 98, 403, 363, 79, 194, 195,
- 363, 363, 363, 368, 363, 404, 404, 363,
- 79, 194, 195, 363, 363, 363, 368, 363,
- 405, 363, 363, 406, 194, 195, 363, 194,
- 195, 363, 407, 363, 194, 408, 363, 194,
- 409, 363, 194, 363, 405, 363, 363, 363,
- 194, 195, 363, 410, 363, 411, 412, 363,
- 79, 194, 195, 363, 363, 82, 363, 81,
- 363, 404, 404, 363, 79, 194, 195, 363,
- 404, 404, 363, 79, 194, 195, 363, 410,
- 363, 404, 404, 363, 79, 194, 195, 363,
- 410, 363, 411, 404, 363, 79, 194, 195,
- 363, 363, 82, 363, 98, 363, 413, 413,
- 84, 79, 194, 195, 363, 363, 363, 368,
- 363, 414, 107, 415, 416, 88, 79, 194,
- 195, 363, 363, 363, 368, 363, 107, 415,
- 416, 88, 79, 194, 195, 363, 363, 363,
- 368, 363, 415, 415, 88, 79, 194, 195,
- 363, 363, 363, 368, 363, 417, 104, 418,
- 419, 91, 79, 194, 195, 363, 363, 363,
- 368, 363, 104, 418, 419, 91, 79, 194,
- 195, 363, 363, 363, 368, 363, 418, 418,
- 91, 79, 194, 195, 363, 363, 363, 368,
- 363, 420, 101, 421, 422, 94, 79, 194,
- 195, 363, 363, 363, 368, 363, 101, 421,
- 422, 94, 79, 194, 195, 363, 363, 363,
- 368, 363, 421, 421, 94, 79, 194, 195,
- 363, 363, 363, 368, 363, 423, 98, 404,
- 424, 363, 79, 194, 195, 363, 363, 363,
- 368, 363, 98, 404, 424, 363, 79, 194,
- 195, 363, 363, 363, 368, 363, 404, 425,
- 363, 79, 194, 195, 363, 363, 363, 368,
- 363, 98, 363, 404, 404, 363, 79, 194,
- 195, 363, 363, 363, 368, 363, 80, 81,
- 363, 363, 98, 403, 363, 79, 194, 195,
- 363, 363, 363, 368, 363, 80, 363, 397,
- 402, 402, 84, 79, 194, 195, 363, 363,
- 363, 400, 363, 363, 363, 363, 363, 363,
- 363, 363, 363, 363, 363, 363, 363, 363,
- 363, 363, 202, 363, 397, 402, 402, 84,
- 79, 194, 195, 363, 363, 363, 400, 363,
- 396, 397, 402, 402, 84, 79, 194, 195,
- 363, 363, 363, 400, 363, 363, 200, 363,
- 363, 363, 363, 363, 363, 363, 363, 363,
- 363, 363, 363, 363, 202, 363, 396, 397,
- 398, 402, 84, 79, 194, 195, 363, 363,
- 109, 400, 363, 363, 200, 363, 363, 363,
- 363, 363, 363, 363, 363, 363, 363, 363,
- 363, 363, 202, 363, 394, 363, 426, 363,
- 413, 413, 84, 79, 194, 195, 363, 363,
- 363, 368, 363, 394, 363, 394, 363, 363,
- 363, 404, 404, 363, 79, 194, 195, 363,
- 363, 363, 368, 363, 394, 363, 394, 363,
- 363, 363, 404, 427, 363, 79, 194, 195,
- 363, 363, 363, 368, 363, 394, 363, 394,
- 363, 426, 363, 404, 404, 363, 79, 194,
- 195, 363, 363, 363, 368, 363, 394, 363,
- 394, 81, 363, 363, 98, 395, 363, 79,
- 194, 195, 363, 363, 363, 368, 363, 394,
- 363, 387, 388, 393, 393, 84, 79, 194,
- 195, 363, 363, 363, 391, 363, 363, 200,
- 363, 363, 363, 363, 363, 363, 363, 363,
- 363, 363, 363, 363, 363, 202, 363, 387,
- 388, 389, 393, 84, 79, 194, 195, 363,
- 363, 111, 391, 363, 363, 200, 363, 363,
- 363, 363, 363, 363, 363, 363, 363, 363,
- 363, 363, 363, 202, 363, 385, 363, 428,
- 363, 413, 413, 84, 79, 194, 195, 363,
- 363, 363, 368, 363, 385, 363, 385, 363,
- 363, 363, 404, 404, 363, 79, 194, 195,
- 363, 363, 363, 368, 363, 385, 363, 385,
- 363, 363, 363, 404, 429, 363, 79, 194,
- 195, 363, 363, 363, 368, 363, 385, 363,
- 385, 363, 428, 363, 404, 404, 363, 79,
- 194, 195, 363, 363, 363, 368, 363, 385,
- 363, 385, 81, 363, 363, 98, 386, 363,
- 79, 194, 195, 363, 363, 363, 368, 363,
- 385, 363, 378, 379, 384, 384, 84, 79,
- 194, 195, 363, 363, 363, 382, 363, 363,
- 200, 363, 363, 363, 363, 363, 363, 363,
- 363, 363, 363, 363, 363, 363, 202, 363,
- 378, 379, 380, 384, 84, 79, 194, 195,
- 363, 363, 113, 382, 363, 363, 200, 363,
- 363, 363, 363, 363, 363, 363, 363, 363,
- 363, 363, 363, 363, 202, 363, 376, 363,
- 430, 363, 413, 413, 84, 79, 194, 195,
- 363, 363, 363, 368, 363, 376, 363, 376,
- 363, 363, 363, 404, 404, 363, 79, 194,
- 195, 363, 363, 363, 368, 363, 376, 363,
- 376, 363, 363, 363, 404, 431, 363, 79,
- 194, 195, 363, 363, 363, 368, 363, 376,
- 363, 376, 363, 430, 363, 404, 404, 363,
- 79, 194, 195, 363, 363, 363, 368, 363,
- 376, 363, 376, 81, 363, 363, 98, 377,
- 363, 79, 194, 195, 363, 363, 363, 368,
- 363, 376, 363, 369, 370, 375, 375, 84,
- 79, 194, 195, 363, 363, 363, 373, 363,
- 363, 200, 363, 363, 363, 363, 363, 363,
- 363, 363, 363, 363, 363, 363, 363, 202,
- 363, 369, 370, 371, 375, 84, 79, 194,
- 195, 363, 363, 115, 373, 363, 363, 200,
- 363, 363, 363, 363, 363, 363, 363, 363,
- 363, 363, 363, 363, 363, 202, 363, 366,
- 363, 432, 363, 413, 413, 84, 79, 194,
- 195, 363, 363, 363, 368, 363, 366, 363,
- 366, 363, 363, 363, 404, 404, 363, 79,
- 194, 195, 363, 363, 363, 368, 363, 366,
- 363, 366, 363, 363, 363, 404, 433, 363,
- 79, 194, 195, 363, 363, 363, 368, 363,
- 366, 363, 366, 363, 432, 363, 404, 404,
- 363, 79, 194, 195, 363, 363, 363, 368,
- 363, 366, 363, 366, 81, 363, 363, 98,
- 367, 363, 79, 194, 195, 363, 363, 363,
- 368, 363, 366, 363, 116, 83, 83, 84,
- 79, 434, 434, 434, 434, 156, 116, 434,
- 190, 191, 365, 365, 84, 79, 194, 195,
- 363, 363, 363, 197, 363, 363, 200, 363,
- 363, 363, 363, 363, 363, 363, 363, 363,
- 363, 363, 363, 363, 202, 363, 116, 83,
- 83, 84, 79, 434, 434, 434, 434, 434,
- 116, 434, 436, 437, 438, 439, 123, 118,
- 440, 441, 435, 435, 155, 442, 435, 435,
- 443, 435, 435, 435, 435, 435, 435, 435,
- 435, 435, 435, 435, 435, 435, 444, 435,
- 445, 437, 439, 439, 123, 118, 440, 441,
- 435, 435, 435, 442, 435, 435, 443, 435,
- 435, 435, 435, 435, 435, 435, 435, 435,
- 435, 435, 435, 435, 444, 435, 437, 439,
- 439, 123, 118, 440, 441, 435, 435, 435,
- 442, 435, 435, 443, 435, 435, 435, 435,
- 435, 435, 435, 435, 435, 435, 435, 435,
- 435, 444, 435, 446, 435, 435, 435, 136,
- 447, 435, 118, 440, 441, 435, 435, 435,
- 448, 435, 446, 435, 449, 450, 451, 452,
- 123, 118, 440, 441, 435, 435, 153, 453,
- 435, 435, 443, 435, 435, 435, 435, 435,
- 435, 435, 435, 435, 435, 435, 435, 435,
- 444, 435, 454, 450, 455, 455, 123, 118,
- 440, 441, 435, 435, 435, 453, 435, 435,
- 443, 435, 435, 435, 435, 435, 435, 435,
- 435, 435, 435, 435, 435, 435, 444, 435,
- 450, 455, 455, 123, 118, 440, 441, 435,
- 435, 435, 453, 435, 435, 443, 435, 435,
- 435, 435, 435, 435, 435, 435, 435, 435,
- 435, 435, 435, 444, 435, 456, 435, 435,
- 435, 136, 457, 435, 118, 440, 441, 435,
- 435, 435, 448, 435, 456, 435, 458, 459,
- 460, 461, 123, 118, 440, 441, 435, 435,
- 151, 462, 435, 435, 443, 435, 435, 435,
- 435, 435, 435, 435, 435, 435, 435, 435,
- 435, 435, 444, 435, 463, 459, 464, 464,
- 123, 118, 440, 441, 435, 435, 435, 462,
- 435, 435, 443, 435, 435, 435, 435, 435,
- 435, 435, 435, 435, 435, 435, 435, 435,
- 444, 435, 459, 464, 464, 123, 118, 440,
- 441, 435, 435, 435, 462, 435, 435, 443,
- 435, 435, 435, 435, 435, 435, 435, 435,
- 435, 435, 435, 435, 435, 444, 435, 465,
- 435, 435, 435, 136, 466, 435, 118, 440,
- 441, 435, 435, 435, 448, 435, 465, 435,
- 467, 468, 469, 470, 123, 118, 440, 441,
- 435, 435, 149, 471, 435, 435, 443, 435,
- 435, 435, 435, 435, 435, 435, 435, 435,
- 435, 435, 435, 435, 444, 435, 472, 468,
- 473, 473, 123, 118, 440, 441, 435, 435,
- 435, 471, 435, 435, 443, 435, 435, 435,
- 435, 435, 435, 435, 435, 435, 435, 435,
- 435, 435, 444, 435, 468, 473, 473, 123,
- 118, 440, 441, 435, 435, 435, 471, 435,
- 435, 443, 435, 435, 435, 435, 435, 435,
- 435, 435, 435, 435, 435, 435, 435, 444,
- 435, 474, 435, 435, 435, 136, 475, 435,
- 118, 440, 441, 435, 435, 435, 448, 435,
- 474, 435, 476, 477, 478, 479, 123, 118,
- 440, 441, 435, 435, 147, 480, 435, 435,
- 443, 435, 435, 435, 435, 435, 435, 435,
- 435, 435, 435, 435, 435, 435, 444, 435,
- 481, 477, 482, 482, 123, 118, 440, 441,
- 435, 435, 435, 480, 435, 435, 443, 435,
- 435, 435, 435, 435, 435, 435, 435, 435,
- 435, 435, 435, 435, 444, 435, 477, 482,
- 482, 123, 118, 440, 441, 435, 435, 435,
- 480, 435, 435, 443, 435, 435, 435, 435,
- 435, 435, 435, 435, 435, 435, 435, 435,
- 435, 444, 435, 136, 483, 435, 118, 440,
- 441, 435, 435, 435, 448, 435, 484, 484,
- 435, 118, 440, 441, 435, 435, 435, 448,
- 435, 485, 435, 435, 486, 440, 441, 435,
- 440, 441, 435, 487, 435, 440, 488, 435,
- 440, 489, 435, 440, 435, 485, 435, 435,
- 435, 440, 441, 435, 490, 435, 491, 492,
- 435, 118, 440, 441, 435, 435, 121, 435,
- 120, 435, 484, 484, 435, 118, 440, 441,
- 435, 484, 484, 435, 118, 440, 441, 435,
- 490, 435, 484, 484, 435, 118, 440, 441,
- 435, 490, 435, 491, 484, 435, 118, 440,
- 441, 435, 435, 121, 435, 136, 435, 493,
- 493, 123, 118, 440, 441, 435, 435, 435,
- 448, 435, 494, 145, 495, 496, 126, 118,
- 440, 441, 435, 435, 435, 448, 435, 145,
- 495, 496, 126, 118, 440, 441, 435, 435,
- 435, 448, 435, 495, 495, 126, 118, 440,
- 441, 435, 435, 435, 448, 435, 497, 142,
- 498, 499, 129, 118, 440, 441, 435, 435,
- 435, 448, 435, 142, 498, 499, 129, 118,
- 440, 441, 435, 435, 435, 448, 435, 498,
- 498, 129, 118, 440, 441, 435, 435, 435,
- 448, 435, 500, 139, 501, 502, 132, 118,
- 440, 441, 435, 435, 435, 448, 435, 139,
- 501, 502, 132, 118, 440, 441, 435, 435,
- 435, 448, 435, 501, 501, 132, 118, 440,
- 441, 435, 435, 435, 448, 435, 503, 136,
- 484, 504, 435, 118, 440, 441, 435, 435,
- 435, 448, 435, 136, 484, 504, 435, 118,
- 440, 441, 435, 435, 435, 448, 435, 484,
- 505, 435, 118, 440, 441, 435, 435, 435,
- 448, 435, 136, 435, 484, 484, 435, 118,
- 440, 441, 435, 435, 435, 448, 435, 119,
- 120, 435, 435, 136, 483, 435, 118, 440,
- 441, 435, 435, 435, 448, 435, 119, 435,
- 477, 482, 482, 123, 118, 440, 441, 435,
- 435, 435, 480, 435, 435, 435, 435, 435,
- 435, 435, 435, 435, 435, 435, 435, 435,
- 435, 435, 435, 444, 435, 477, 482, 482,
- 123, 118, 440, 441, 435, 435, 435, 480,
- 435, 476, 477, 482, 482, 123, 118, 440,
- 441, 435, 435, 435, 480, 435, 435, 443,
- 435, 435, 435, 435, 435, 435, 435, 435,
- 435, 435, 435, 435, 435, 444, 435, 476,
- 477, 478, 482, 123, 118, 440, 441, 435,
- 435, 147, 480, 435, 435, 443, 435, 435,
- 435, 435, 435, 435, 435, 435, 435, 435,
- 435, 435, 435, 444, 435, 474, 435, 506,
- 435, 493, 493, 123, 118, 440, 441, 435,
- 435, 435, 448, 435, 474, 435, 474, 435,
- 435, 435, 484, 484, 435, 118, 440, 441,
- 435, 435, 435, 448, 435, 474, 435, 474,
- 435, 435, 435, 484, 507, 435, 118, 440,
- 441, 435, 435, 435, 448, 435, 474, 435,
- 474, 435, 506, 435, 484, 484, 435, 118,
- 440, 441, 435, 435, 435, 448, 435, 474,
- 435, 474, 120, 435, 435, 136, 475, 435,
- 118, 440, 441, 435, 435, 435, 448, 435,
- 474, 435, 467, 468, 473, 473, 123, 118,
- 440, 441, 435, 435, 435, 471, 435, 435,
- 443, 435, 435, 435, 435, 435, 435, 435,
- 435, 435, 435, 435, 435, 435, 444, 435,
- 467, 468, 469, 473, 123, 118, 440, 441,
- 435, 435, 149, 471, 435, 435, 443, 435,
- 435, 435, 435, 435, 435, 435, 435, 435,
- 435, 435, 435, 435, 444, 435, 465, 435,
- 508, 435, 493, 493, 123, 118, 440, 441,
- 435, 435, 435, 448, 435, 465, 435, 465,
- 435, 435, 435, 484, 484, 435, 118, 440,
- 441, 435, 435, 435, 448, 435, 465, 435,
- 465, 435, 435, 435, 484, 509, 435, 118,
- 440, 441, 435, 435, 435, 448, 435, 465,
- 435, 465, 435, 508, 435, 484, 484, 435,
- 118, 440, 441, 435, 435, 435, 448, 435,
- 465, 435, 465, 120, 435, 435, 136, 466,
- 435, 118, 440, 441, 435, 435, 435, 448,
- 435, 465, 435, 458, 459, 464, 464, 123,
- 118, 440, 441, 435, 435, 435, 462, 435,
- 435, 443, 435, 435, 435, 435, 435, 435,
- 435, 435, 435, 435, 435, 435, 435, 444,
- 435, 458, 459, 460, 464, 123, 118, 440,
- 441, 435, 435, 151, 462, 435, 435, 443,
- 435, 435, 435, 435, 435, 435, 435, 435,
- 435, 435, 435, 435, 435, 444, 435, 456,
- 435, 510, 435, 493, 493, 123, 118, 440,
- 441, 435, 435, 435, 448, 435, 456, 435,
- 456, 435, 435, 435, 484, 484, 435, 118,
- 440, 441, 435, 435, 435, 448, 435, 456,
- 435, 456, 435, 435, 435, 484, 511, 435,
- 118, 440, 441, 435, 435, 435, 448, 435,
- 456, 435, 456, 435, 510, 435, 484, 484,
- 435, 118, 440, 441, 435, 435, 435, 448,
- 435, 456, 435, 456, 120, 435, 435, 136,
- 457, 435, 118, 440, 441, 435, 435, 435,
- 448, 435, 456, 435, 449, 450, 455, 455,
- 123, 118, 440, 441, 435, 435, 435, 453,
- 435, 435, 443, 435, 435, 435, 435, 435,
- 435, 435, 435, 435, 435, 435, 435, 435,
- 444, 435, 449, 450, 451, 455, 123, 118,
- 440, 441, 435, 435, 153, 453, 435, 435,
- 443, 435, 435, 435, 435, 435, 435, 435,
- 435, 435, 435, 435, 435, 435, 444, 435,
- 446, 435, 512, 435, 493, 493, 123, 118,
- 440, 441, 435, 435, 435, 448, 435, 446,
- 435, 446, 435, 435, 435, 484, 484, 435,
- 118, 440, 441, 435, 435, 435, 448, 435,
- 446, 435, 446, 435, 435, 435, 484, 513,
- 435, 118, 440, 441, 435, 435, 435, 448,
- 435, 446, 435, 446, 435, 512, 435, 484,
- 484, 435, 118, 440, 441, 435, 435, 435,
- 448, 435, 446, 435, 446, 120, 435, 435,
- 136, 447, 435, 118, 440, 441, 435, 435,
- 435, 448, 435, 446, 435, 436, 437, 439,
- 439, 123, 118, 440, 441, 435, 435, 435,
- 442, 435, 435, 443, 435, 435, 435, 435,
- 435, 435, 435, 435, 435, 435, 435, 435,
- 435, 444, 435, 188, 189, 190, 191, 514,
- 365, 84, 79, 194, 195, 196, 196, 156,
- 197, 363, 188, 200, 363, 363, 363, 363,
- 363, 363, 363, 363, 363, 363, 363, 363,
- 363, 202, 363, 204, 515, 206, 207, 6,
- 1, 208, 209, 203, 203, 38, 210, 203,
- 203, 211, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 212,
- 203, 215, 189, 190, 191, 516, 517, 84,
- 157, 518, 519, 203, 196, 156, 520, 203,
- 215, 200, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 202,
- 203, 116, 521, 521, 84, 157, 208, 209,
- 203, 203, 156, 522, 203, 523, 203, 203,
- 524, 518, 519, 203, 518, 519, 203, 256,
- 203, 518, 525, 203, 518, 526, 203, 518,
- 203, 523, 203, 203, 203, 518, 519, 203,
- 527, 3, 363, 363, 404, 433, 363, 79,
- 194, 195, 363, 363, 363, 368, 363, 527,
- 363, 528, 370, 529, 530, 84, 157, 518,
- 519, 203, 203, 158, 373, 203, 203, 200,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 202, 203, 531,
- 370, 532, 532, 84, 157, 518, 519, 203,
- 203, 203, 373, 203, 203, 200, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 202, 203, 370, 532, 532,
- 84, 157, 518, 519, 203, 203, 203, 373,
- 203, 203, 200, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 202, 203, 528, 370, 532, 532, 84, 157,
- 518, 519, 203, 203, 203, 373, 203, 203,
- 200, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 202, 203,
- 528, 370, 529, 532, 84, 157, 518, 519,
- 203, 203, 158, 373, 203, 203, 200, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 202, 203, 215, 203,
- 281, 116, 533, 533, 160, 157, 208, 209,
- 203, 203, 203, 522, 203, 215, 203, 534,
- 184, 535, 536, 162, 157, 518, 519, 203,
- 203, 203, 537, 203, 184, 535, 536, 162,
- 157, 518, 519, 203, 203, 203, 537, 203,
- 535, 535, 162, 157, 518, 519, 203, 203,
- 203, 537, 203, 538, 181, 539, 540, 165,
- 157, 518, 519, 203, 203, 203, 537, 203,
- 181, 539, 540, 165, 157, 518, 519, 203,
- 203, 203, 537, 203, 539, 539, 165, 157,
- 518, 519, 203, 203, 203, 537, 203, 541,
- 178, 542, 543, 168, 157, 518, 519, 203,
- 203, 203, 537, 203, 178, 542, 543, 168,
- 157, 518, 519, 203, 203, 203, 537, 203,
- 542, 542, 168, 157, 518, 519, 203, 203,
- 203, 537, 203, 544, 175, 545, 546, 203,
- 157, 518, 519, 203, 203, 203, 537, 203,
- 175, 545, 546, 203, 157, 518, 519, 203,
- 203, 203, 537, 203, 545, 545, 203, 157,
- 518, 519, 203, 203, 203, 537, 203, 547,
- 203, 548, 549, 203, 157, 518, 519, 203,
- 203, 172, 203, 171, 203, 545, 545, 203,
- 157, 518, 519, 203, 545, 545, 203, 157,
- 518, 519, 203, 547, 203, 545, 545, 203,
- 157, 518, 519, 203, 547, 203, 548, 545,
- 203, 157, 518, 519, 203, 203, 172, 203,
- 527, 171, 363, 363, 98, 367, 363, 79,
- 194, 195, 363, 363, 363, 368, 363, 527,
- 363, 551, 550, 552, 552, 550, 186, 553,
- 554, 550, 552, 552, 550, 186, 553, 554,
- 550, 555, 550, 550, 556, 553, 554, 550,
- 553, 554, 550, 557, 550, 553, 558, 550,
- 553, 559, 550, 553, 550, 555, 550, 550,
- 550, 553, 554, 550, 0
+ 197, 198, 199, 200, 201, 187, 203, 204,
+ 205, 206, 6, 1, 207, 208, 202, 202,
+ 38, 209, 202, 202, 210, 202, 211, 204,
+ 212, 212, 6, 1, 207, 208, 202, 202,
+ 202, 209, 202, 202, 210, 202, 204, 212,
+ 212, 6, 1, 207, 208, 202, 202, 202,
+ 209, 202, 202, 210, 202, 213, 202, 202,
+ 202, 19, 214, 202, 1, 207, 208, 202,
+ 202, 202, 215, 202, 213, 202, 216, 217,
+ 218, 219, 6, 1, 207, 208, 202, 202,
+ 36, 220, 202, 202, 210, 202, 221, 217,
+ 222, 222, 6, 1, 207, 208, 202, 202,
+ 202, 220, 202, 202, 210, 202, 217, 222,
+ 222, 6, 1, 207, 208, 202, 202, 202,
+ 220, 202, 202, 210, 202, 223, 202, 202,
+ 202, 19, 224, 202, 1, 207, 208, 202,
+ 202, 202, 215, 202, 223, 202, 225, 226,
+ 227, 228, 6, 1, 207, 208, 202, 202,
+ 34, 229, 202, 202, 210, 202, 230, 226,
+ 231, 231, 6, 1, 207, 208, 202, 202,
+ 202, 229, 202, 202, 210, 202, 226, 231,
+ 231, 6, 1, 207, 208, 202, 202, 202,
+ 229, 202, 202, 210, 202, 232, 202, 202,
+ 202, 19, 233, 202, 1, 207, 208, 202,
+ 202, 202, 215, 202, 232, 202, 234, 235,
+ 236, 237, 6, 1, 207, 208, 202, 202,
+ 32, 238, 202, 202, 210, 202, 239, 235,
+ 240, 240, 6, 1, 207, 208, 202, 202,
+ 202, 238, 202, 202, 210, 202, 235, 240,
+ 240, 6, 1, 207, 208, 202, 202, 202,
+ 238, 202, 202, 210, 202, 241, 202, 202,
+ 202, 19, 242, 202, 1, 207, 208, 202,
+ 202, 202, 215, 202, 241, 202, 243, 244,
+ 245, 246, 6, 1, 207, 208, 202, 202,
+ 30, 247, 202, 202, 210, 202, 248, 244,
+ 249, 249, 6, 1, 207, 208, 202, 202,
+ 202, 247, 202, 202, 210, 202, 244, 249,
+ 249, 6, 1, 207, 208, 202, 202, 202,
+ 247, 202, 202, 210, 202, 19, 250, 202,
+ 1, 207, 208, 202, 202, 202, 215, 202,
+ 251, 251, 202, 1, 207, 208, 202, 202,
+ 202, 215, 202, 252, 202, 202, 253, 207,
+ 208, 202, 207, 208, 202, 254, 202, 207,
+ 255, 202, 207, 256, 202, 207, 202, 252,
+ 202, 202, 202, 207, 208, 202, 257, 202,
+ 258, 259, 202, 1, 207, 208, 202, 202,
+ 4, 202, 3, 202, 251, 251, 202, 1,
+ 207, 208, 202, 251, 251, 202, 1, 207,
+ 208, 202, 257, 202, 251, 251, 202, 1,
+ 207, 208, 202, 257, 202, 258, 251, 202,
+ 1, 207, 208, 202, 202, 4, 202, 19,
+ 202, 260, 260, 6, 1, 207, 208, 202,
+ 202, 202, 215, 202, 261, 28, 262, 263,
+ 9, 1, 207, 208, 202, 202, 202, 215,
+ 202, 28, 262, 263, 9, 1, 207, 208,
+ 202, 202, 202, 215, 202, 262, 262, 9,
+ 1, 207, 208, 202, 202, 202, 215, 202,
+ 264, 25, 265, 266, 12, 1, 207, 208,
+ 202, 202, 202, 215, 202, 25, 265, 266,
+ 12, 1, 207, 208, 202, 202, 202, 215,
+ 202, 265, 265, 12, 1, 207, 208, 202,
+ 202, 202, 215, 202, 267, 22, 268, 269,
+ 15, 1, 207, 208, 202, 202, 202, 215,
+ 202, 22, 268, 269, 15, 1, 207, 208,
+ 202, 202, 202, 215, 202, 268, 268, 15,
+ 1, 207, 208, 202, 202, 202, 215, 202,
+ 270, 19, 251, 271, 202, 1, 207, 208,
+ 202, 202, 202, 215, 202, 19, 251, 271,
+ 202, 1, 207, 208, 202, 202, 202, 215,
+ 202, 251, 272, 202, 1, 207, 208, 202,
+ 202, 202, 215, 202, 19, 202, 251, 251,
+ 202, 1, 207, 208, 202, 202, 202, 215,
+ 202, 2, 3, 202, 202, 19, 250, 202,
+ 1, 207, 208, 202, 202, 202, 215, 202,
+ 2, 202, 244, 249, 249, 6, 1, 207,
+ 208, 202, 202, 202, 247, 202, 243, 244,
+ 249, 249, 6, 1, 207, 208, 202, 202,
+ 202, 247, 202, 202, 210, 202, 243, 244,
+ 245, 249, 6, 1, 207, 208, 202, 202,
+ 30, 247, 202, 202, 210, 202, 241, 202,
+ 273, 202, 260, 260, 6, 1, 207, 208,
+ 202, 202, 202, 215, 202, 241, 202, 241,
+ 202, 202, 202, 251, 251, 202, 1, 207,
+ 208, 202, 202, 202, 215, 202, 241, 202,
+ 241, 202, 202, 202, 251, 274, 202, 1,
+ 207, 208, 202, 202, 202, 215, 202, 241,
+ 202, 241, 202, 273, 202, 251, 251, 202,
+ 1, 207, 208, 202, 202, 202, 215, 202,
+ 241, 202, 241, 3, 202, 202, 19, 242,
+ 202, 1, 207, 208, 202, 202, 202, 215,
+ 202, 241, 202, 234, 235, 240, 240, 6,
+ 1, 207, 208, 202, 202, 202, 238, 202,
+ 202, 210, 202, 234, 235, 236, 240, 6,
+ 1, 207, 208, 202, 202, 32, 238, 202,
+ 202, 210, 202, 232, 202, 275, 202, 260,
+ 260, 6, 1, 207, 208, 202, 202, 202,
+ 215, 202, 232, 202, 232, 202, 202, 202,
+ 251, 251, 202, 1, 207, 208, 202, 202,
+ 202, 215, 202, 232, 202, 232, 202, 202,
+ 202, 251, 276, 202, 1, 207, 208, 202,
+ 202, 202, 215, 202, 232, 202, 232, 202,
+ 275, 202, 251, 251, 202, 1, 207, 208,
+ 202, 202, 202, 215, 202, 232, 202, 232,
+ 3, 202, 202, 19, 233, 202, 1, 207,
+ 208, 202, 202, 202, 215, 202, 232, 202,
+ 225, 226, 231, 231, 6, 1, 207, 208,
+ 202, 202, 202, 229, 202, 202, 210, 202,
+ 225, 226, 227, 231, 6, 1, 207, 208,
+ 202, 202, 34, 229, 202, 202, 210, 202,
+ 223, 202, 277, 202, 260, 260, 6, 1,
+ 207, 208, 202, 202, 202, 215, 202, 223,
+ 202, 223, 202, 202, 202, 251, 251, 202,
+ 1, 207, 208, 202, 202, 202, 215, 202,
+ 223, 202, 223, 202, 202, 202, 251, 278,
+ 202, 1, 207, 208, 202, 202, 202, 215,
+ 202, 223, 202, 223, 202, 277, 202, 251,
+ 251, 202, 1, 207, 208, 202, 202, 202,
+ 215, 202, 223, 202, 223, 3, 202, 202,
+ 19, 224, 202, 1, 207, 208, 202, 202,
+ 202, 215, 202, 223, 202, 216, 217, 222,
+ 222, 6, 1, 207, 208, 202, 202, 202,
+ 220, 202, 202, 210, 202, 216, 217, 218,
+ 222, 6, 1, 207, 208, 202, 202, 36,
+ 220, 202, 202, 210, 202, 213, 202, 279,
+ 202, 260, 260, 6, 1, 207, 208, 202,
+ 202, 202, 215, 202, 213, 202, 213, 202,
+ 202, 202, 251, 251, 202, 1, 207, 208,
+ 202, 202, 202, 215, 202, 213, 202, 213,
+ 202, 202, 202, 251, 280, 202, 1, 207,
+ 208, 202, 202, 202, 215, 202, 213, 202,
+ 213, 202, 279, 202, 251, 251, 202, 1,
+ 207, 208, 202, 202, 202, 215, 202, 213,
+ 202, 213, 3, 202, 202, 19, 214, 202,
+ 1, 207, 208, 202, 202, 202, 215, 202,
+ 213, 202, 203, 204, 212, 212, 6, 1,
+ 207, 208, 202, 202, 202, 209, 202, 202,
+ 210, 202, 203, 204, 205, 212, 6, 1,
+ 207, 208, 202, 202, 38, 209, 202, 202,
+ 210, 202, 282, 283, 284, 285, 45, 40,
+ 286, 287, 281, 281, 77, 288, 281, 281,
+ 289, 281, 290, 283, 291, 285, 45, 40,
+ 286, 287, 281, 281, 281, 288, 281, 281,
+ 289, 281, 283, 291, 285, 45, 40, 286,
+ 287, 281, 281, 281, 288, 281, 281, 289,
+ 281, 292, 281, 281, 281, 58, 293, 281,
+ 40, 286, 287, 281, 281, 281, 294, 281,
+ 292, 281, 295, 296, 297, 298, 45, 40,
+ 286, 287, 281, 281, 75, 299, 281, 281,
+ 289, 281, 300, 296, 301, 301, 45, 40,
+ 286, 287, 281, 281, 281, 299, 281, 281,
+ 289, 281, 296, 301, 301, 45, 40, 286,
+ 287, 281, 281, 281, 299, 281, 281, 289,
+ 281, 302, 281, 281, 281, 58, 303, 281,
+ 40, 286, 287, 281, 281, 281, 294, 281,
+ 302, 281, 304, 305, 306, 307, 45, 40,
+ 286, 287, 281, 281, 73, 308, 281, 281,
+ 289, 281, 309, 305, 310, 310, 45, 40,
+ 286, 287, 281, 281, 281, 308, 281, 281,
+ 289, 281, 305, 310, 310, 45, 40, 286,
+ 287, 281, 281, 281, 308, 281, 281, 289,
+ 281, 311, 281, 281, 281, 58, 312, 281,
+ 40, 286, 287, 281, 281, 281, 294, 281,
+ 311, 281, 313, 314, 315, 316, 45, 40,
+ 286, 287, 281, 281, 71, 317, 281, 281,
+ 289, 281, 318, 314, 319, 319, 45, 40,
+ 286, 287, 281, 281, 281, 317, 281, 281,
+ 289, 281, 314, 319, 319, 45, 40, 286,
+ 287, 281, 281, 281, 317, 281, 281, 289,
+ 281, 320, 281, 281, 281, 58, 321, 281,
+ 40, 286, 287, 281, 281, 281, 294, 281,
+ 320, 281, 322, 323, 324, 325, 45, 40,
+ 286, 287, 281, 281, 69, 326, 281, 281,
+ 289, 281, 327, 323, 328, 328, 45, 40,
+ 286, 287, 281, 281, 281, 326, 281, 281,
+ 289, 281, 323, 328, 328, 45, 40, 286,
+ 287, 281, 281, 281, 326, 281, 281, 289,
+ 281, 58, 329, 281, 40, 286, 287, 281,
+ 281, 281, 294, 281, 330, 330, 281, 40,
+ 286, 287, 281, 281, 281, 294, 281, 331,
+ 281, 281, 332, 286, 287, 281, 286, 287,
+ 281, 333, 281, 286, 334, 281, 286, 335,
+ 281, 286, 281, 331, 281, 281, 281, 286,
+ 287, 281, 336, 281, 337, 338, 281, 40,
+ 286, 287, 281, 281, 43, 281, 42, 281,
+ 330, 330, 281, 40, 286, 287, 281, 330,
+ 330, 281, 40, 286, 287, 281, 336, 281,
+ 330, 330, 281, 40, 286, 287, 281, 336,
+ 281, 337, 330, 281, 40, 286, 287, 281,
+ 281, 43, 281, 58, 281, 339, 339, 45,
+ 40, 286, 287, 281, 281, 281, 294, 281,
+ 340, 67, 341, 342, 48, 40, 286, 287,
+ 281, 281, 281, 294, 281, 67, 341, 342,
+ 48, 40, 286, 287, 281, 281, 281, 294,
+ 281, 341, 341, 48, 40, 286, 287, 281,
+ 281, 281, 294, 281, 343, 64, 344, 345,
+ 51, 40, 286, 287, 281, 281, 281, 294,
+ 281, 64, 344, 345, 51, 40, 286, 287,
+ 281, 281, 281, 294, 281, 344, 344, 51,
+ 40, 286, 287, 281, 281, 281, 294, 281,
+ 346, 61, 347, 348, 54, 40, 286, 287,
+ 281, 281, 281, 294, 281, 61, 347, 348,
+ 54, 40, 286, 287, 281, 281, 281, 294,
+ 281, 347, 347, 54, 40, 286, 287, 281,
+ 281, 281, 294, 281, 349, 58, 330, 350,
+ 281, 40, 286, 287, 281, 281, 281, 294,
+ 281, 58, 330, 350, 281, 40, 286, 287,
+ 281, 281, 281, 294, 281, 330, 351, 281,
+ 40, 286, 287, 281, 281, 281, 294, 281,
+ 58, 281, 330, 330, 281, 40, 286, 287,
+ 281, 281, 281, 294, 281, 41, 42, 281,
+ 281, 58, 329, 281, 40, 286, 287, 281,
+ 281, 281, 294, 281, 41, 281, 323, 328,
+ 328, 45, 40, 286, 287, 281, 281, 281,
+ 326, 281, 322, 323, 328, 328, 45, 40,
+ 286, 287, 281, 281, 281, 326, 281, 281,
+ 289, 281, 322, 323, 324, 328, 45, 40,
+ 286, 287, 281, 281, 69, 326, 281, 281,
+ 289, 281, 320, 281, 352, 281, 339, 339,
+ 45, 40, 286, 287, 281, 281, 281, 294,
+ 281, 320, 281, 320, 281, 281, 281, 330,
+ 330, 281, 40, 286, 287, 281, 281, 281,
+ 294, 281, 320, 281, 320, 281, 281, 281,
+ 330, 353, 281, 40, 286, 287, 281, 281,
+ 281, 294, 281, 320, 281, 320, 281, 352,
+ 281, 330, 330, 281, 40, 286, 287, 281,
+ 281, 281, 294, 281, 320, 281, 320, 42,
+ 281, 281, 58, 321, 281, 40, 286, 287,
+ 281, 281, 281, 294, 281, 320, 281, 313,
+ 314, 319, 319, 45, 40, 286, 287, 281,
+ 281, 281, 317, 281, 281, 289, 281, 313,
+ 314, 315, 319, 45, 40, 286, 287, 281,
+ 281, 71, 317, 281, 281, 289, 281, 311,
+ 281, 354, 281, 339, 339, 45, 40, 286,
+ 287, 281, 281, 281, 294, 281, 311, 281,
+ 311, 281, 281, 281, 330, 330, 281, 40,
+ 286, 287, 281, 281, 281, 294, 281, 311,
+ 281, 311, 281, 281, 281, 330, 355, 281,
+ 40, 286, 287, 281, 281, 281, 294, 281,
+ 311, 281, 311, 281, 354, 281, 330, 330,
+ 281, 40, 286, 287, 281, 281, 281, 294,
+ 281, 311, 281, 311, 42, 281, 281, 58,
+ 312, 281, 40, 286, 287, 281, 281, 281,
+ 294, 281, 311, 281, 304, 305, 310, 310,
+ 45, 40, 286, 287, 281, 281, 281, 308,
+ 281, 281, 289, 281, 304, 305, 306, 310,
+ 45, 40, 286, 287, 281, 281, 73, 308,
+ 281, 281, 289, 281, 302, 281, 356, 281,
+ 339, 339, 45, 40, 286, 287, 281, 281,
+ 281, 294, 281, 302, 281, 302, 281, 281,
+ 281, 330, 330, 281, 40, 286, 287, 281,
+ 281, 281, 294, 281, 302, 281, 302, 281,
+ 281, 281, 330, 357, 281, 40, 286, 287,
+ 281, 281, 281, 294, 281, 302, 281, 302,
+ 281, 356, 281, 330, 330, 281, 40, 286,
+ 287, 281, 281, 281, 294, 281, 302, 281,
+ 302, 42, 281, 281, 58, 303, 281, 40,
+ 286, 287, 281, 281, 281, 294, 281, 302,
+ 281, 295, 296, 301, 301, 45, 40, 286,
+ 287, 281, 281, 281, 299, 281, 281, 289,
+ 281, 295, 296, 297, 301, 45, 40, 286,
+ 287, 281, 281, 75, 299, 281, 281, 289,
+ 281, 292, 281, 358, 281, 339, 339, 45,
+ 40, 286, 287, 281, 281, 281, 294, 281,
+ 292, 281, 292, 281, 281, 281, 330, 330,
+ 281, 40, 286, 287, 281, 281, 281, 294,
+ 281, 292, 281, 292, 281, 281, 281, 330,
+ 359, 281, 40, 286, 287, 281, 281, 281,
+ 294, 281, 292, 281, 292, 281, 358, 281,
+ 330, 330, 281, 40, 286, 287, 281, 281,
+ 281, 294, 281, 292, 281, 76, 44, 44,
+ 45, 40, 281, 281, 281, 281, 281, 76,
+ 281, 292, 42, 281, 281, 58, 293, 281,
+ 40, 286, 287, 281, 281, 281, 294, 281,
+ 292, 281, 282, 283, 291, 285, 45, 40,
+ 286, 287, 281, 281, 281, 288, 281, 281,
+ 289, 281, 361, 191, 362, 362, 84, 79,
+ 194, 195, 360, 360, 360, 197, 360, 360,
+ 200, 360, 191, 362, 362, 84, 79, 194,
+ 195, 360, 360, 360, 197, 360, 360, 200,
+ 360, 363, 360, 360, 360, 98, 364, 360,
+ 79, 194, 195, 360, 360, 360, 365, 360,
+ 363, 360, 366, 367, 368, 369, 84, 79,
+ 194, 195, 360, 360, 115, 370, 360, 360,
+ 200, 360, 371, 367, 372, 372, 84, 79,
+ 194, 195, 360, 360, 360, 370, 360, 360,
+ 200, 360, 367, 372, 372, 84, 79, 194,
+ 195, 360, 360, 360, 370, 360, 360, 200,
+ 360, 373, 360, 360, 360, 98, 374, 360,
+ 79, 194, 195, 360, 360, 360, 365, 360,
+ 373, 360, 375, 376, 377, 378, 84, 79,
+ 194, 195, 360, 360, 113, 379, 360, 360,
+ 200, 360, 380, 376, 381, 381, 84, 79,
+ 194, 195, 360, 360, 360, 379, 360, 360,
+ 200, 360, 376, 381, 381, 84, 79, 194,
+ 195, 360, 360, 360, 379, 360, 360, 200,
+ 360, 382, 360, 360, 360, 98, 383, 360,
+ 79, 194, 195, 360, 360, 360, 365, 360,
+ 382, 360, 384, 385, 386, 387, 84, 79,
+ 194, 195, 360, 360, 111, 388, 360, 360,
+ 200, 360, 389, 385, 390, 390, 84, 79,
+ 194, 195, 360, 360, 360, 388, 360, 360,
+ 200, 360, 385, 390, 390, 84, 79, 194,
+ 195, 360, 360, 360, 388, 360, 360, 200,
+ 360, 391, 360, 360, 360, 98, 392, 360,
+ 79, 194, 195, 360, 360, 360, 365, 360,
+ 391, 360, 393, 394, 395, 396, 84, 79,
+ 194, 195, 360, 360, 109, 397, 360, 360,
+ 200, 360, 398, 394, 399, 399, 84, 79,
+ 194, 195, 360, 360, 360, 397, 360, 360,
+ 200, 360, 394, 399, 399, 84, 79, 194,
+ 195, 360, 360, 360, 397, 360, 360, 200,
+ 360, 98, 400, 360, 79, 194, 195, 360,
+ 360, 360, 365, 360, 401, 401, 360, 79,
+ 194, 195, 360, 360, 360, 365, 360, 402,
+ 360, 360, 403, 194, 195, 360, 194, 195,
+ 360, 404, 360, 194, 405, 360, 194, 406,
+ 360, 194, 360, 402, 360, 360, 360, 194,
+ 195, 360, 407, 360, 408, 409, 360, 79,
+ 194, 195, 360, 360, 82, 360, 81, 360,
+ 401, 401, 360, 79, 194, 195, 360, 401,
+ 401, 360, 79, 194, 195, 360, 407, 360,
+ 401, 401, 360, 79, 194, 195, 360, 407,
+ 360, 408, 401, 360, 79, 194, 195, 360,
+ 360, 82, 360, 98, 360, 410, 410, 84,
+ 79, 194, 195, 360, 360, 360, 365, 360,
+ 411, 107, 412, 413, 88, 79, 194, 195,
+ 360, 360, 360, 365, 360, 107, 412, 413,
+ 88, 79, 194, 195, 360, 360, 360, 365,
+ 360, 412, 412, 88, 79, 194, 195, 360,
+ 360, 360, 365, 360, 414, 104, 415, 416,
+ 91, 79, 194, 195, 360, 360, 360, 365,
+ 360, 104, 415, 416, 91, 79, 194, 195,
+ 360, 360, 360, 365, 360, 415, 415, 91,
+ 79, 194, 195, 360, 360, 360, 365, 360,
+ 417, 101, 418, 419, 94, 79, 194, 195,
+ 360, 360, 360, 365, 360, 101, 418, 419,
+ 94, 79, 194, 195, 360, 360, 360, 365,
+ 360, 418, 418, 94, 79, 194, 195, 360,
+ 360, 360, 365, 360, 420, 98, 401, 421,
+ 360, 79, 194, 195, 360, 360, 360, 365,
+ 360, 98, 401, 421, 360, 79, 194, 195,
+ 360, 360, 360, 365, 360, 401, 422, 360,
+ 79, 194, 195, 360, 360, 360, 365, 360,
+ 98, 360, 401, 401, 360, 79, 194, 195,
+ 360, 360, 360, 365, 360, 80, 81, 360,
+ 360, 98, 400, 360, 79, 194, 195, 360,
+ 360, 360, 365, 360, 80, 360, 394, 399,
+ 399, 84, 79, 194, 195, 360, 360, 360,
+ 397, 360, 393, 394, 399, 399, 84, 79,
+ 194, 195, 360, 360, 360, 397, 360, 360,
+ 200, 360, 393, 394, 395, 399, 84, 79,
+ 194, 195, 360, 360, 109, 397, 360, 360,
+ 200, 360, 391, 360, 423, 360, 410, 410,
+ 84, 79, 194, 195, 360, 360, 360, 365,
+ 360, 391, 360, 391, 360, 360, 360, 401,
+ 401, 360, 79, 194, 195, 360, 360, 360,
+ 365, 360, 391, 360, 391, 360, 360, 360,
+ 401, 424, 360, 79, 194, 195, 360, 360,
+ 360, 365, 360, 391, 360, 391, 360, 423,
+ 360, 401, 401, 360, 79, 194, 195, 360,
+ 360, 360, 365, 360, 391, 360, 391, 81,
+ 360, 360, 98, 392, 360, 79, 194, 195,
+ 360, 360, 360, 365, 360, 391, 360, 384,
+ 385, 390, 390, 84, 79, 194, 195, 360,
+ 360, 360, 388, 360, 360, 200, 360, 384,
+ 385, 386, 390, 84, 79, 194, 195, 360,
+ 360, 111, 388, 360, 360, 200, 360, 382,
+ 360, 425, 360, 410, 410, 84, 79, 194,
+ 195, 360, 360, 360, 365, 360, 382, 360,
+ 382, 360, 360, 360, 401, 401, 360, 79,
+ 194, 195, 360, 360, 360, 365, 360, 382,
+ 360, 382, 360, 360, 360, 401, 426, 360,
+ 79, 194, 195, 360, 360, 360, 365, 360,
+ 382, 360, 382, 360, 425, 360, 401, 401,
+ 360, 79, 194, 195, 360, 360, 360, 365,
+ 360, 382, 360, 382, 81, 360, 360, 98,
+ 383, 360, 79, 194, 195, 360, 360, 360,
+ 365, 360, 382, 360, 375, 376, 381, 381,
+ 84, 79, 194, 195, 360, 360, 360, 379,
+ 360, 360, 200, 360, 375, 376, 377, 381,
+ 84, 79, 194, 195, 360, 360, 113, 379,
+ 360, 360, 200, 360, 373, 360, 427, 360,
+ 410, 410, 84, 79, 194, 195, 360, 360,
+ 360, 365, 360, 373, 360, 373, 360, 360,
+ 360, 401, 401, 360, 79, 194, 195, 360,
+ 360, 360, 365, 360, 373, 360, 373, 360,
+ 360, 360, 401, 428, 360, 79, 194, 195,
+ 360, 360, 360, 365, 360, 373, 360, 373,
+ 360, 427, 360, 401, 401, 360, 79, 194,
+ 195, 360, 360, 360, 365, 360, 373, 360,
+ 373, 81, 360, 360, 98, 374, 360, 79,
+ 194, 195, 360, 360, 360, 365, 360, 373,
+ 360, 366, 367, 372, 372, 84, 79, 194,
+ 195, 360, 360, 360, 370, 360, 360, 200,
+ 360, 366, 367, 368, 372, 84, 79, 194,
+ 195, 360, 360, 115, 370, 360, 360, 200,
+ 360, 363, 360, 429, 360, 410, 410, 84,
+ 79, 194, 195, 360, 360, 360, 365, 360,
+ 363, 360, 363, 360, 360, 360, 401, 401,
+ 360, 79, 194, 195, 360, 360, 360, 365,
+ 360, 363, 360, 363, 360, 360, 360, 401,
+ 430, 360, 79, 194, 195, 360, 360, 360,
+ 365, 360, 363, 360, 363, 360, 429, 360,
+ 401, 401, 360, 79, 194, 195, 360, 360,
+ 360, 365, 360, 363, 360, 363, 81, 360,
+ 360, 98, 364, 360, 79, 194, 195, 360,
+ 360, 360, 365, 360, 363, 360, 116, 83,
+ 83, 84, 79, 431, 431, 431, 431, 156,
+ 116, 431, 190, 191, 362, 362, 84, 79,
+ 194, 195, 360, 360, 360, 197, 360, 360,
+ 200, 360, 116, 83, 83, 84, 79, 431,
+ 431, 431, 431, 431, 116, 431, 433, 434,
+ 435, 436, 123, 118, 437, 438, 432, 432,
+ 155, 439, 432, 432, 440, 432, 441, 434,
+ 436, 436, 123, 118, 437, 438, 432, 432,
+ 432, 439, 432, 432, 440, 432, 434, 436,
+ 436, 123, 118, 437, 438, 432, 432, 432,
+ 439, 432, 432, 440, 432, 442, 432, 432,
+ 432, 136, 443, 432, 118, 437, 438, 432,
+ 432, 432, 444, 432, 442, 432, 445, 446,
+ 447, 448, 123, 118, 437, 438, 432, 432,
+ 153, 449, 432, 432, 440, 432, 450, 446,
+ 451, 451, 123, 118, 437, 438, 432, 432,
+ 432, 449, 432, 432, 440, 432, 446, 451,
+ 451, 123, 118, 437, 438, 432, 432, 432,
+ 449, 432, 432, 440, 432, 452, 432, 432,
+ 432, 136, 453, 432, 118, 437, 438, 432,
+ 432, 432, 444, 432, 452, 432, 454, 455,
+ 456, 457, 123, 118, 437, 438, 432, 432,
+ 151, 458, 432, 432, 440, 432, 459, 455,
+ 460, 460, 123, 118, 437, 438, 432, 432,
+ 432, 458, 432, 432, 440, 432, 455, 460,
+ 460, 123, 118, 437, 438, 432, 432, 432,
+ 458, 432, 432, 440, 432, 461, 432, 432,
+ 432, 136, 462, 432, 118, 437, 438, 432,
+ 432, 432, 444, 432, 461, 432, 463, 464,
+ 465, 466, 123, 118, 437, 438, 432, 432,
+ 149, 467, 432, 432, 440, 432, 468, 464,
+ 469, 469, 123, 118, 437, 438, 432, 432,
+ 432, 467, 432, 432, 440, 432, 464, 469,
+ 469, 123, 118, 437, 438, 432, 432, 432,
+ 467, 432, 432, 440, 432, 470, 432, 432,
+ 432, 136, 471, 432, 118, 437, 438, 432,
+ 432, 432, 444, 432, 470, 432, 472, 473,
+ 474, 475, 123, 118, 437, 438, 432, 432,
+ 147, 476, 432, 432, 440, 432, 477, 473,
+ 478, 478, 123, 118, 437, 438, 432, 432,
+ 432, 476, 432, 432, 440, 432, 473, 478,
+ 478, 123, 118, 437, 438, 432, 432, 432,
+ 476, 432, 432, 440, 432, 136, 479, 432,
+ 118, 437, 438, 432, 432, 432, 444, 432,
+ 480, 480, 432, 118, 437, 438, 432, 432,
+ 432, 444, 432, 481, 432, 432, 482, 437,
+ 438, 432, 437, 438, 432, 483, 432, 437,
+ 484, 432, 437, 485, 432, 437, 432, 481,
+ 432, 432, 432, 437, 438, 432, 486, 432,
+ 487, 488, 432, 118, 437, 438, 432, 432,
+ 121, 432, 120, 432, 480, 480, 432, 118,
+ 437, 438, 432, 480, 480, 432, 118, 437,
+ 438, 432, 486, 432, 480, 480, 432, 118,
+ 437, 438, 432, 486, 432, 487, 480, 432,
+ 118, 437, 438, 432, 432, 121, 432, 136,
+ 432, 489, 489, 123, 118, 437, 438, 432,
+ 432, 432, 444, 432, 490, 145, 491, 492,
+ 126, 118, 437, 438, 432, 432, 432, 444,
+ 432, 145, 491, 492, 126, 118, 437, 438,
+ 432, 432, 432, 444, 432, 491, 491, 126,
+ 118, 437, 438, 432, 432, 432, 444, 432,
+ 493, 142, 494, 495, 129, 118, 437, 438,
+ 432, 432, 432, 444, 432, 142, 494, 495,
+ 129, 118, 437, 438, 432, 432, 432, 444,
+ 432, 494, 494, 129, 118, 437, 438, 432,
+ 432, 432, 444, 432, 496, 139, 497, 498,
+ 132, 118, 437, 438, 432, 432, 432, 444,
+ 432, 139, 497, 498, 132, 118, 437, 438,
+ 432, 432, 432, 444, 432, 497, 497, 132,
+ 118, 437, 438, 432, 432, 432, 444, 432,
+ 499, 136, 480, 500, 432, 118, 437, 438,
+ 432, 432, 432, 444, 432, 136, 480, 500,
+ 432, 118, 437, 438, 432, 432, 432, 444,
+ 432, 480, 501, 432, 118, 437, 438, 432,
+ 432, 432, 444, 432, 136, 432, 480, 480,
+ 432, 118, 437, 438, 432, 432, 432, 444,
+ 432, 119, 120, 432, 432, 136, 479, 432,
+ 118, 437, 438, 432, 432, 432, 444, 432,
+ 119, 432, 473, 478, 478, 123, 118, 437,
+ 438, 432, 432, 432, 476, 432, 472, 473,
+ 478, 478, 123, 118, 437, 438, 432, 432,
+ 432, 476, 432, 432, 440, 432, 472, 473,
+ 474, 478, 123, 118, 437, 438, 432, 432,
+ 147, 476, 432, 432, 440, 432, 470, 432,
+ 502, 432, 489, 489, 123, 118, 437, 438,
+ 432, 432, 432, 444, 432, 470, 432, 470,
+ 432, 432, 432, 480, 480, 432, 118, 437,
+ 438, 432, 432, 432, 444, 432, 470, 432,
+ 470, 432, 432, 432, 480, 503, 432, 118,
+ 437, 438, 432, 432, 432, 444, 432, 470,
+ 432, 470, 432, 502, 432, 480, 480, 432,
+ 118, 437, 438, 432, 432, 432, 444, 432,
+ 470, 432, 470, 120, 432, 432, 136, 471,
+ 432, 118, 437, 438, 432, 432, 432, 444,
+ 432, 470, 432, 463, 464, 469, 469, 123,
+ 118, 437, 438, 432, 432, 432, 467, 432,
+ 432, 440, 432, 463, 464, 465, 469, 123,
+ 118, 437, 438, 432, 432, 149, 467, 432,
+ 432, 440, 432, 461, 432, 504, 432, 489,
+ 489, 123, 118, 437, 438, 432, 432, 432,
+ 444, 432, 461, 432, 461, 432, 432, 432,
+ 480, 480, 432, 118, 437, 438, 432, 432,
+ 432, 444, 432, 461, 432, 461, 432, 432,
+ 432, 480, 505, 432, 118, 437, 438, 432,
+ 432, 432, 444, 432, 461, 432, 461, 432,
+ 504, 432, 480, 480, 432, 118, 437, 438,
+ 432, 432, 432, 444, 432, 461, 432, 461,
+ 120, 432, 432, 136, 462, 432, 118, 437,
+ 438, 432, 432, 432, 444, 432, 461, 432,
+ 454, 455, 460, 460, 123, 118, 437, 438,
+ 432, 432, 432, 458, 432, 432, 440, 432,
+ 454, 455, 456, 460, 123, 118, 437, 438,
+ 432, 432, 151, 458, 432, 432, 440, 432,
+ 452, 432, 506, 432, 489, 489, 123, 118,
+ 437, 438, 432, 432, 432, 444, 432, 452,
+ 432, 452, 432, 432, 432, 480, 480, 432,
+ 118, 437, 438, 432, 432, 432, 444, 432,
+ 452, 432, 452, 432, 432, 432, 480, 507,
+ 432, 118, 437, 438, 432, 432, 432, 444,
+ 432, 452, 432, 452, 432, 506, 432, 480,
+ 480, 432, 118, 437, 438, 432, 432, 432,
+ 444, 432, 452, 432, 452, 120, 432, 432,
+ 136, 453, 432, 118, 437, 438, 432, 432,
+ 432, 444, 432, 452, 432, 445, 446, 451,
+ 451, 123, 118, 437, 438, 432, 432, 432,
+ 449, 432, 432, 440, 432, 445, 446, 447,
+ 451, 123, 118, 437, 438, 432, 432, 153,
+ 449, 432, 432, 440, 432, 442, 432, 508,
+ 432, 489, 489, 123, 118, 437, 438, 432,
+ 432, 432, 444, 432, 442, 432, 442, 432,
+ 432, 432, 480, 480, 432, 118, 437, 438,
+ 432, 432, 432, 444, 432, 442, 432, 442,
+ 432, 432, 432, 480, 509, 432, 118, 437,
+ 438, 432, 432, 432, 444, 432, 442, 432,
+ 442, 432, 508, 432, 480, 480, 432, 118,
+ 437, 438, 432, 432, 432, 444, 432, 442,
+ 432, 442, 120, 432, 432, 136, 443, 432,
+ 118, 437, 438, 432, 432, 432, 444, 432,
+ 442, 432, 433, 434, 436, 436, 123, 118,
+ 437, 438, 432, 432, 432, 439, 432, 432,
+ 440, 432, 188, 189, 190, 191, 510, 362,
+ 84, 79, 194, 195, 196, 196, 156, 197,
+ 360, 188, 200, 360, 203, 511, 205, 206,
+ 6, 1, 207, 208, 202, 202, 38, 209,
+ 202, 202, 210, 202, 213, 189, 190, 191,
+ 512, 513, 84, 157, 514, 515, 202, 196,
+ 156, 516, 202, 213, 200, 202, 116, 517,
+ 517, 84, 157, 207, 208, 202, 202, 156,
+ 518, 202, 519, 202, 202, 520, 514, 515,
+ 202, 514, 515, 202, 254, 202, 514, 521,
+ 202, 514, 522, 202, 514, 202, 519, 202,
+ 202, 202, 514, 515, 202, 523, 3, 360,
+ 360, 401, 430, 360, 79, 194, 195, 360,
+ 360, 360, 365, 360, 523, 360, 524, 367,
+ 525, 526, 84, 157, 514, 515, 202, 202,
+ 158, 370, 202, 202, 200, 202, 527, 367,
+ 528, 528, 84, 157, 514, 515, 202, 202,
+ 202, 370, 202, 202, 200, 202, 367, 528,
+ 528, 84, 157, 514, 515, 202, 202, 202,
+ 370, 202, 202, 200, 202, 524, 367, 528,
+ 528, 84, 157, 514, 515, 202, 202, 202,
+ 370, 202, 202, 200, 202, 524, 367, 525,
+ 528, 84, 157, 514, 515, 202, 202, 158,
+ 370, 202, 202, 200, 202, 213, 202, 279,
+ 116, 529, 529, 160, 157, 207, 208, 202,
+ 202, 202, 518, 202, 213, 202, 530, 184,
+ 531, 532, 162, 157, 514, 515, 202, 202,
+ 202, 533, 202, 184, 531, 532, 162, 157,
+ 514, 515, 202, 202, 202, 533, 202, 531,
+ 531, 162, 157, 514, 515, 202, 202, 202,
+ 533, 202, 534, 181, 535, 536, 165, 157,
+ 514, 515, 202, 202, 202, 533, 202, 181,
+ 535, 536, 165, 157, 514, 515, 202, 202,
+ 202, 533, 202, 535, 535, 165, 157, 514,
+ 515, 202, 202, 202, 533, 202, 537, 178,
+ 538, 539, 168, 157, 514, 515, 202, 202,
+ 202, 533, 202, 178, 538, 539, 168, 157,
+ 514, 515, 202, 202, 202, 533, 202, 538,
+ 538, 168, 157, 514, 515, 202, 202, 202,
+ 533, 202, 540, 175, 541, 542, 202, 157,
+ 514, 515, 202, 202, 202, 533, 202, 175,
+ 541, 542, 202, 157, 514, 515, 202, 202,
+ 202, 533, 202, 541, 541, 202, 157, 514,
+ 515, 202, 202, 202, 533, 202, 543, 202,
+ 544, 545, 202, 157, 514, 515, 202, 202,
+ 172, 202, 171, 202, 541, 541, 202, 157,
+ 514, 515, 202, 541, 541, 202, 157, 514,
+ 515, 202, 543, 202, 541, 541, 202, 157,
+ 514, 515, 202, 543, 202, 544, 541, 202,
+ 157, 514, 515, 202, 202, 172, 202, 523,
+ 171, 360, 360, 98, 364, 360, 79, 194,
+ 195, 360, 360, 360, 365, 360, 523, 360,
+ 547, 546, 548, 548, 546, 186, 549, 550,
+ 546, 548, 548, 546, 186, 549, 550, 546,
+ 551, 546, 546, 552, 549, 550, 546, 549,
+ 550, 546, 553, 546, 549, 554, 546, 549,
+ 555, 546, 549, 546, 551, 546, 546, 546,
+ 549, 550, 546, 0
};
static const short _indic_syllable_machine_trans_targs[] = {
178, 200, 207, 209, 210, 4, 213, 5,
7, 216, 8, 10, 219, 11, 13, 222,
14, 16, 17, 199, 19, 20, 221, 22,
- 23, 218, 25, 26, 215, 224, 229, 233,
- 236, 240, 243, 247, 250, 254, 257, 178,
- 280, 287, 289, 290, 41, 293, 42, 44,
- 296, 45, 47, 299, 48, 50, 302, 51,
- 53, 54, 279, 56, 57, 301, 59, 60,
- 298, 62, 63, 295, 304, 309, 313, 316,
- 320, 323, 327, 330, 334, 338, 178, 359,
- 366, 368, 369, 78, 372, 178, 79, 81,
- 375, 82, 84, 378, 85, 87, 381, 88,
- 90, 91, 358, 93, 94, 380, 96, 97,
- 377, 99, 100, 374, 383, 388, 392, 395,
- 399, 402, 406, 409, 413, 178, 440, 447,
- 449, 450, 114, 453, 115, 117, 456, 118,
- 120, 459, 121, 123, 462, 124, 126, 127,
- 439, 129, 130, 461, 132, 133, 458, 135,
- 136, 455, 464, 469, 473, 476, 480, 483,
- 487, 490, 494, 497, 417, 502, 513, 152,
- 516, 154, 519, 155, 157, 522, 158, 160,
- 525, 161, 528, 530, 531, 166, 167, 527,
- 169, 170, 524, 172, 173, 521, 175, 176,
- 518, 178, 536, 178, 179, 259, 339, 341,
- 416, 418, 361, 362, 419, 415, 498, 499,
- 386, 534, 387, 178, 180, 182, 36, 258,
- 202, 203, 256, 227, 228, 181, 35, 183,
- 252, 1, 184, 186, 34, 251, 249, 185,
- 33, 187, 245, 188, 190, 32, 244, 242,
- 189, 31, 191, 238, 192, 194, 30, 237,
- 235, 193, 29, 195, 231, 196, 198, 28,
- 230, 226, 197, 27, 212, 0, 201, 206,
- 178, 204, 205, 208, 2, 211, 3, 214,
- 6, 24, 217, 9, 21, 220, 12, 18,
- 223, 15, 225, 232, 234, 239, 241, 246,
- 248, 253, 255, 178, 260, 262, 73, 336,
- 282, 283, 337, 307, 308, 261, 72, 263,
- 332, 38, 264, 266, 71, 331, 329, 265,
- 70, 267, 325, 268, 270, 69, 324, 322,
- 269, 68, 271, 318, 272, 274, 67, 317,
- 315, 273, 66, 275, 311, 276, 278, 65,
- 310, 306, 277, 64, 292, 37, 281, 286,
- 178, 284, 285, 288, 39, 291, 40, 294,
- 43, 61, 297, 46, 58, 300, 49, 55,
- 303, 52, 305, 312, 314, 319, 321, 326,
- 328, 333, 335, 178, 340, 109, 342, 411,
- 75, 343, 345, 108, 410, 408, 344, 107,
- 346, 404, 347, 349, 106, 403, 401, 348,
- 105, 350, 397, 351, 353, 104, 396, 394,
- 352, 103, 354, 390, 355, 357, 102, 389,
- 385, 356, 101, 371, 74, 360, 365, 178,
- 363, 364, 367, 76, 370, 77, 373, 80,
- 98, 376, 83, 95, 379, 86, 92, 382,
- 89, 384, 391, 393, 398, 400, 405, 407,
- 412, 414, 178, 178, 420, 422, 146, 145,
- 442, 443, 496, 467, 468, 421, 423, 492,
- 111, 424, 426, 144, 491, 489, 425, 143,
- 427, 485, 428, 430, 142, 484, 482, 429,
- 141, 431, 478, 432, 434, 140, 477, 475,
- 433, 139, 435, 471, 436, 438, 138, 470,
- 466, 437, 137, 452, 110, 441, 446, 178,
- 444, 445, 448, 112, 451, 113, 454, 116,
- 134, 457, 119, 131, 460, 122, 128, 463,
- 125, 465, 472, 474, 479, 481, 486, 488,
- 493, 495, 147, 500, 501, 515, 504, 505,
- 533, 148, 509, 503, 508, 506, 507, 510,
- 511, 150, 514, 512, 149, 151, 517, 153,
- 174, 163, 520, 156, 171, 523, 159, 168,
- 526, 162, 165, 529, 164, 532, 178, 535,
- 177, 538, 539, 537, 542, 178, 540, 541
+ 23, 218, 25, 26, 215, 224, 228, 232,
+ 235, 239, 242, 246, 249, 253, 256, 178,
+ 279, 286, 288, 289, 41, 292, 42, 44,
+ 295, 45, 47, 298, 48, 50, 301, 51,
+ 53, 54, 278, 56, 57, 300, 59, 60,
+ 297, 62, 63, 294, 303, 307, 311, 314,
+ 318, 321, 325, 328, 332, 336, 178, 357,
+ 364, 366, 367, 78, 370, 178, 79, 81,
+ 373, 82, 84, 376, 85, 87, 379, 88,
+ 90, 91, 356, 93, 94, 378, 96, 97,
+ 375, 99, 100, 372, 381, 385, 389, 392,
+ 396, 399, 403, 406, 410, 178, 437, 444,
+ 446, 447, 114, 450, 115, 117, 453, 118,
+ 120, 456, 121, 123, 459, 124, 126, 127,
+ 436, 129, 130, 458, 132, 133, 455, 135,
+ 136, 452, 461, 465, 469, 472, 476, 479,
+ 483, 486, 490, 493, 414, 498, 509, 152,
+ 512, 154, 515, 155, 157, 518, 158, 160,
+ 521, 161, 524, 526, 527, 166, 167, 523,
+ 169, 170, 520, 172, 173, 517, 175, 176,
+ 514, 178, 532, 178, 179, 258, 337, 339,
+ 413, 415, 359, 360, 416, 412, 494, 495,
+ 384, 530, 178, 180, 182, 36, 257, 202,
+ 203, 255, 227, 181, 35, 183, 251, 1,
+ 184, 186, 34, 250, 248, 185, 33, 187,
+ 244, 188, 190, 32, 243, 241, 189, 31,
+ 191, 237, 192, 194, 30, 236, 234, 193,
+ 29, 195, 230, 196, 198, 28, 229, 226,
+ 197, 27, 212, 0, 201, 206, 178, 204,
+ 205, 208, 2, 211, 3, 214, 6, 24,
+ 217, 9, 21, 220, 12, 18, 223, 15,
+ 225, 231, 233, 238, 240, 245, 247, 252,
+ 254, 178, 259, 261, 73, 334, 281, 282,
+ 335, 306, 260, 72, 262, 330, 38, 263,
+ 265, 71, 329, 327, 264, 70, 266, 323,
+ 267, 269, 69, 322, 320, 268, 68, 270,
+ 316, 271, 273, 67, 315, 313, 272, 66,
+ 274, 309, 275, 277, 65, 308, 305, 276,
+ 64, 291, 37, 280, 285, 178, 283, 284,
+ 287, 39, 290, 40, 293, 43, 61, 296,
+ 46, 58, 299, 49, 55, 302, 52, 304,
+ 310, 312, 317, 319, 324, 326, 331, 333,
+ 178, 338, 109, 340, 408, 75, 341, 343,
+ 108, 407, 405, 342, 107, 344, 401, 345,
+ 347, 106, 400, 398, 346, 105, 348, 394,
+ 349, 351, 104, 393, 391, 350, 103, 352,
+ 387, 353, 355, 102, 386, 383, 354, 101,
+ 369, 74, 358, 363, 178, 361, 362, 365,
+ 76, 368, 77, 371, 80, 98, 374, 83,
+ 95, 377, 86, 92, 380, 89, 382, 388,
+ 390, 395, 397, 402, 404, 409, 411, 178,
+ 178, 417, 419, 146, 145, 439, 440, 492,
+ 464, 418, 420, 488, 111, 421, 423, 144,
+ 487, 485, 422, 143, 424, 481, 425, 427,
+ 142, 480, 478, 426, 141, 428, 474, 429,
+ 431, 140, 473, 471, 430, 139, 432, 467,
+ 433, 435, 138, 466, 463, 434, 137, 449,
+ 110, 438, 443, 178, 441, 442, 445, 112,
+ 448, 113, 451, 116, 134, 454, 119, 131,
+ 457, 122, 128, 460, 125, 462, 468, 470,
+ 475, 477, 482, 484, 489, 491, 147, 496,
+ 497, 511, 500, 501, 529, 148, 505, 499,
+ 504, 502, 503, 506, 507, 150, 510, 508,
+ 149, 151, 513, 153, 174, 163, 516, 156,
+ 171, 519, 159, 168, 522, 162, 165, 525,
+ 164, 528, 178, 531, 177, 534, 535, 533,
+ 538, 178, 536, 537
};
static const char _indic_syllable_machine_trans_actions[] = {
@@ -1285,51 +1087,51 @@ static const char _indic_syllable_machine_trans_actions[] = {
0, 0, 2, 0, 0, 2, 0, 0,
2, 9, 0, 12, 2, 2, 6, 2,
13, 13, 0, 0, 2, 2, 6, 2,
- 6, 2, 6, 14, 2, 2, 0, 2,
- 0, 0, 2, 2, 2, 2, 0, 2,
- 2, 0, 2, 2, 0, 2, 2, 2,
- 0, 2, 2, 2, 2, 0, 2, 2,
- 2, 0, 2, 2, 2, 2, 0, 2,
- 2, 2, 0, 2, 2, 2, 2, 0,
- 2, 2, 2, 0, 2, 0, 0, 0,
- 15, 0, 0, 2, 0, 2, 0, 2,
- 0, 0, 2, 0, 0, 2, 0, 0,
- 2, 0, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 16, 2, 2, 0, 2,
- 0, 0, 2, 2, 2, 2, 0, 2,
- 2, 0, 2, 2, 0, 2, 2, 2,
- 0, 2, 2, 2, 2, 0, 2, 2,
- 2, 0, 2, 2, 2, 2, 0, 2,
- 2, 2, 0, 2, 2, 2, 2, 0,
- 2, 2, 2, 0, 2, 0, 0, 0,
- 17, 0, 0, 2, 0, 2, 0, 2,
- 0, 0, 2, 0, 0, 2, 0, 0,
- 2, 0, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 18, 6, 0, 6, 6,
- 0, 6, 2, 0, 6, 2, 6, 0,
- 6, 6, 6, 2, 0, 6, 2, 6,
- 0, 6, 6, 6, 2, 0, 6, 2,
- 6, 0, 6, 6, 6, 2, 0, 6,
- 2, 6, 0, 6, 0, 0, 0, 19,
- 0, 0, 2, 0, 2, 0, 2, 0,
- 0, 2, 0, 0, 2, 0, 0, 2,
- 0, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 20, 21, 2, 2, 0, 0,
- 0, 0, 2, 2, 2, 2, 2, 2,
- 0, 2, 2, 0, 2, 2, 2, 0,
+ 6, 2, 14, 2, 2, 0, 2, 0,
+ 0, 2, 2, 2, 0, 2, 2, 0,
+ 2, 2, 0, 2, 2, 2, 0, 2,
+ 2, 2, 2, 0, 2, 2, 2, 0,
2, 2, 2, 2, 0, 2, 2, 2,
0, 2, 2, 2, 2, 0, 2, 2,
- 2, 0, 2, 2, 2, 2, 0, 2,
- 2, 2, 0, 2, 0, 0, 0, 22,
- 0, 0, 2, 0, 2, 0, 2, 0,
+ 2, 0, 2, 0, 0, 0, 15, 0,
+ 0, 2, 0, 2, 0, 2, 0, 0,
+ 2, 0, 0, 2, 0, 0, 2, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 16, 2, 2, 0, 2, 0, 0,
+ 2, 2, 2, 0, 2, 2, 0, 2,
+ 2, 0, 2, 2, 2, 0, 2, 2,
+ 2, 2, 0, 2, 2, 2, 0, 2,
+ 2, 2, 2, 0, 2, 2, 2, 0,
+ 2, 2, 2, 2, 0, 2, 2, 2,
+ 0, 2, 0, 0, 0, 17, 0, 0,
+ 2, 0, 2, 0, 2, 0, 0, 2,
+ 0, 0, 2, 0, 0, 2, 0, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2,
+ 18, 6, 0, 6, 6, 0, 6, 2,
+ 0, 6, 2, 6, 0, 6, 6, 6,
+ 2, 0, 6, 2, 6, 0, 6, 6,
+ 6, 2, 0, 6, 2, 6, 0, 6,
+ 6, 6, 2, 0, 6, 2, 6, 0,
+ 6, 0, 0, 0, 19, 0, 0, 2,
+ 0, 2, 0, 2, 0, 0, 2, 0,
+ 0, 2, 0, 0, 2, 0, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 20,
+ 21, 2, 2, 0, 0, 0, 0, 2,
+ 2, 2, 2, 2, 0, 2, 2, 0,
+ 2, 2, 2, 0, 2, 2, 2, 2,
+ 0, 2, 2, 2, 0, 2, 2, 2,
+ 2, 0, 2, 2, 2, 0, 2, 2,
+ 2, 2, 0, 2, 2, 2, 0, 2,
+ 0, 0, 0, 22, 0, 0, 2, 0,
+ 2, 0, 2, 0, 0, 2, 0, 0,
+ 2, 0, 0, 2, 0, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 0, 0,
+ 8, 2, 0, 0, 2, 0, 2, 0,
+ 0, 0, 0, 8, 8, 0, 8, 8,
+ 0, 0, 2, 0, 0, 0, 2, 0,
0, 2, 0, 0, 2, 0, 0, 2,
- 0, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 0, 0, 8, 2, 0, 0,
- 2, 0, 2, 0, 0, 0, 0, 8,
- 8, 0, 8, 8, 0, 0, 2, 0,
- 0, 0, 2, 0, 0, 2, 0, 0,
- 2, 0, 0, 2, 0, 2, 23, 2,
- 0, 0, 0, 0, 0, 24, 0, 0
+ 0, 2, 23, 2, 0, 0, 0, 0,
+ 0, 24, 0, 0
};
static const char _indic_syllable_machine_to_state_actions[] = {
@@ -1400,7 +1202,7 @@ static const char _indic_syllable_machine_to_state_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0
+ 0, 0, 0
};
static const char _indic_syllable_machine_from_state_actions[] = {
@@ -1471,7 +1273,7 @@ static const char _indic_syllable_machine_from_state_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0
+ 0, 0, 0
};
static const short _indic_syllable_machine_eof_trans[] = {
@@ -1497,52 +1299,52 @@ static const short _indic_syllable_machine_eof_trans[] = {
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
- 1, 186, 0, 204, 204, 204, 204, 204,
- 204, 204, 204, 204, 204, 204, 204, 204,
- 204, 204, 204, 204, 204, 204, 204, 204,
- 204, 204, 204, 204, 204, 204, 204, 204,
- 204, 204, 204, 204, 204, 204, 204, 204,
- 204, 204, 204, 204, 204, 204, 204, 204,
- 204, 204, 204, 204, 204, 204, 204, 204,
- 204, 204, 204, 204, 204, 204, 204, 204,
- 204, 204, 204, 204, 204, 204, 204, 204,
- 204, 204, 204, 204, 204, 204, 204, 204,
- 204, 204, 204, 284, 284, 284, 284, 284,
- 284, 284, 284, 284, 284, 284, 284, 284,
- 284, 284, 284, 284, 284, 284, 284, 284,
- 284, 284, 284, 284, 284, 284, 284, 284,
- 284, 284, 284, 284, 284, 284, 284, 284,
- 284, 284, 284, 284, 284, 284, 284, 284,
- 284, 284, 284, 284, 284, 284, 284, 284,
- 284, 284, 284, 284, 284, 284, 284, 284,
- 284, 284, 284, 284, 284, 284, 284, 284,
- 284, 284, 284, 284, 284, 284, 284, 284,
- 284, 284, 284, 364, 364, 364, 364, 364,
- 364, 364, 364, 364, 364, 364, 364, 364,
- 364, 364, 364, 364, 364, 364, 364, 364,
- 364, 364, 364, 364, 364, 364, 364, 364,
- 364, 364, 364, 364, 364, 364, 364, 364,
- 364, 364, 364, 364, 364, 364, 364, 364,
- 364, 364, 364, 364, 364, 364, 364, 364,
- 364, 364, 364, 364, 364, 364, 364, 364,
- 364, 364, 364, 364, 364, 364, 364, 364,
- 364, 364, 364, 364, 364, 364, 364, 364,
- 435, 364, 435, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 436, 436, 436, 436, 436, 436,
- 436, 436, 364, 204, 204, 204, 204, 204,
- 204, 204, 204, 204, 204, 364, 204, 204,
- 204, 204, 204, 204, 204, 204, 204, 204,
- 204, 204, 204, 204, 204, 204, 204, 204,
- 204, 204, 204, 204, 204, 364, 551, 551,
- 551, 551, 551, 551, 551, 551, 551
+ 1, 186, 0, 203, 203, 203, 203, 203,
+ 203, 203, 203, 203, 203, 203, 203, 203,
+ 203, 203, 203, 203, 203, 203, 203, 203,
+ 203, 203, 203, 203, 203, 203, 203, 203,
+ 203, 203, 203, 203, 203, 203, 203, 203,
+ 203, 203, 203, 203, 203, 203, 203, 203,
+ 203, 203, 203, 203, 203, 203, 203, 203,
+ 203, 203, 203, 203, 203, 203, 203, 203,
+ 203, 203, 203, 203, 203, 203, 203, 203,
+ 203, 203, 203, 203, 203, 203, 203, 203,
+ 203, 203, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 282, 282, 282, 282, 282, 282, 282,
+ 282, 361, 361, 361, 361, 361, 361, 361,
+ 361, 361, 361, 361, 361, 361, 361, 361,
+ 361, 361, 361, 361, 361, 361, 361, 361,
+ 361, 361, 361, 361, 361, 361, 361, 361,
+ 361, 361, 361, 361, 361, 361, 361, 361,
+ 361, 361, 361, 361, 361, 361, 361, 361,
+ 361, 361, 361, 361, 361, 361, 361, 361,
+ 361, 361, 361, 361, 361, 361, 361, 361,
+ 361, 361, 361, 361, 361, 361, 361, 361,
+ 361, 361, 361, 361, 361, 432, 361, 432,
+ 433, 433, 433, 433, 433, 433, 433, 433,
+ 433, 433, 433, 433, 433, 433, 433, 433,
+ 433, 433, 433, 433, 433, 433, 433, 433,
+ 433, 433, 433, 433, 433, 433, 433, 433,
+ 433, 433, 433, 433, 433, 433, 433, 433,
+ 433, 433, 433, 433, 433, 433, 433, 433,
+ 433, 433, 433, 433, 433, 433, 433, 433,
+ 433, 433, 433, 433, 433, 433, 433, 433,
+ 433, 433, 433, 433, 433, 433, 433, 433,
+ 433, 433, 433, 433, 433, 433, 361, 203,
+ 203, 203, 203, 203, 203, 203, 203, 203,
+ 203, 361, 203, 203, 203, 203, 203, 203,
+ 203, 203, 203, 203, 203, 203, 203, 203,
+ 203, 203, 203, 203, 203, 203, 203, 203,
+ 203, 361, 547, 547, 547, 547, 547, 547,
+ 547, 547, 547
};
static const int indic_syllable_machine_start = 178;
@@ -1556,7 +1358,7 @@ static const int indic_syllable_machine_en_main = 178;
-#line 97 "hb-ot-shape-complex-indic-machine.rl"
+#line 96 "hb-ot-shape-complex-indic-machine.rl"
#define found_syllable(syllable_type) \
@@ -1576,7 +1378,7 @@ find_syllables (hb_buffer_t *buffer)
int cs;
hb_glyph_info_t *info = buffer->info;
-#line 1580 "hb-ot-shape-complex-indic-machine.hh"
+#line 1382 "hb-ot-shape-complex-indic-machine.hh"
{
cs = indic_syllable_machine_start;
ts = 0;
@@ -1584,7 +1386,7 @@ find_syllables (hb_buffer_t *buffer)
act = 0;
}
-#line 118 "hb-ot-shape-complex-indic-machine.rl"
+#line 117 "hb-ot-shape-complex-indic-machine.rl"
p = 0;
@@ -1593,7 +1395,7 @@ find_syllables (hb_buffer_t *buffer)
unsigned int last = 0;
unsigned int syllable_serial = 1;
-#line 1597 "hb-ot-shape-complex-indic-machine.hh"
+#line 1399 "hb-ot-shape-complex-indic-machine.hh"
{
int _slen;
int _trans;
@@ -1607,7 +1409,7 @@ _resume:
#line 1 "NONE"
{ts = p;}
break;
-#line 1611 "hb-ot-shape-complex-indic-machine.hh"
+#line 1413 "hb-ot-shape-complex-indic-machine.hh"
}
_keys = _indic_syllable_machine_trans_keys + (cs<<1);
@@ -1630,71 +1432,71 @@ _eof_trans:
{te = p+1;}
break;
case 15:
-#line 88 "hb-ot-shape-complex-indic-machine.rl"
+#line 87 "hb-ot-shape-complex-indic-machine.rl"
{te = p+1;{ found_syllable (consonant_syllable); }}
break;
case 17:
-#line 89 "hb-ot-shape-complex-indic-machine.rl"
+#line 88 "hb-ot-shape-complex-indic-machine.rl"
{te = p+1;{ found_syllable (vowel_syllable); }}
break;
case 22:
-#line 90 "hb-ot-shape-complex-indic-machine.rl"
+#line 89 "hb-ot-shape-complex-indic-machine.rl"
{te = p+1;{ found_syllable (standalone_cluster); }}
break;
case 24:
-#line 91 "hb-ot-shape-complex-indic-machine.rl"
+#line 90 "hb-ot-shape-complex-indic-machine.rl"
{te = p+1;{ found_syllable (symbol_cluster); }}
break;
case 19:
-#line 92 "hb-ot-shape-complex-indic-machine.rl"
+#line 91 "hb-ot-shape-complex-indic-machine.rl"
{te = p+1;{ found_syllable (broken_cluster); }}
break;
case 12:
-#line 93 "hb-ot-shape-complex-indic-machine.rl"
+#line 92 "hb-ot-shape-complex-indic-machine.rl"
{te = p+1;{ found_syllable (non_indic_cluster); }}
break;
case 14:
-#line 88 "hb-ot-shape-complex-indic-machine.rl"
+#line 87 "hb-ot-shape-complex-indic-machine.rl"
{te = p;p--;{ found_syllable (consonant_syllable); }}
break;
case 16:
-#line 89 "hb-ot-shape-complex-indic-machine.rl"
+#line 88 "hb-ot-shape-complex-indic-machine.rl"
{te = p;p--;{ found_syllable (vowel_syllable); }}
break;
case 21:
-#line 90 "hb-ot-shape-complex-indic-machine.rl"
+#line 89 "hb-ot-shape-complex-indic-machine.rl"
{te = p;p--;{ found_syllable (standalone_cluster); }}
break;
case 23:
-#line 91 "hb-ot-shape-complex-indic-machine.rl"
+#line 90 "hb-ot-shape-complex-indic-machine.rl"
{te = p;p--;{ found_syllable (symbol_cluster); }}
break;
case 18:
-#line 92 "hb-ot-shape-complex-indic-machine.rl"
+#line 91 "hb-ot-shape-complex-indic-machine.rl"
{te = p;p--;{ found_syllable (broken_cluster); }}
break;
case 20:
-#line 93 "hb-ot-shape-complex-indic-machine.rl"
+#line 92 "hb-ot-shape-complex-indic-machine.rl"
{te = p;p--;{ found_syllable (non_indic_cluster); }}
break;
case 1:
-#line 88 "hb-ot-shape-complex-indic-machine.rl"
+#line 87 "hb-ot-shape-complex-indic-machine.rl"
{{p = ((te))-1;}{ found_syllable (consonant_syllable); }}
break;
case 3:
-#line 89 "hb-ot-shape-complex-indic-machine.rl"
+#line 88 "hb-ot-shape-complex-indic-machine.rl"
{{p = ((te))-1;}{ found_syllable (vowel_syllable); }}
break;
case 7:
-#line 90 "hb-ot-shape-complex-indic-machine.rl"
+#line 89 "hb-ot-shape-complex-indic-machine.rl"
{{p = ((te))-1;}{ found_syllable (standalone_cluster); }}
break;
case 9:
-#line 91 "hb-ot-shape-complex-indic-machine.rl"
+#line 90 "hb-ot-shape-complex-indic-machine.rl"
{{p = ((te))-1;}{ found_syllable (symbol_cluster); }}
break;
case 4:
-#line 92 "hb-ot-shape-complex-indic-machine.rl"
+#line 91 "hb-ot-shape-complex-indic-machine.rl"
{{p = ((te))-1;}{ found_syllable (broken_cluster); }}
break;
case 5:
@@ -1715,22 +1517,22 @@ _eof_trans:
case 8:
#line 1 "NONE"
{te = p+1;}
-#line 88 "hb-ot-shape-complex-indic-machine.rl"
+#line 87 "hb-ot-shape-complex-indic-machine.rl"
{act = 1;}
break;
case 6:
#line 1 "NONE"
{te = p+1;}
-#line 92 "hb-ot-shape-complex-indic-machine.rl"
+#line 91 "hb-ot-shape-complex-indic-machine.rl"
{act = 5;}
break;
case 13:
#line 1 "NONE"
{te = p+1;}
-#line 93 "hb-ot-shape-complex-indic-machine.rl"
+#line 92 "hb-ot-shape-complex-indic-machine.rl"
{act = 6;}
break;
-#line 1734 "hb-ot-shape-complex-indic-machine.hh"
+#line 1536 "hb-ot-shape-complex-indic-machine.hh"
}
_again:
@@ -1739,7 +1541,7 @@ _again:
#line 1 "NONE"
{ts = 0;}
break;
-#line 1743 "hb-ot-shape-complex-indic-machine.hh"
+#line 1545 "hb-ot-shape-complex-indic-machine.hh"
}
if ( ++p != pe )
@@ -1755,7 +1557,7 @@ _again:
}
-#line 127 "hb-ot-shape-complex-indic-machine.rl"
+#line 126 "hb-ot-shape-complex-indic-machine.rl"
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-private.hh
index 559ebe4986..5879c3e491 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-private.hh
@@ -60,11 +60,10 @@ enum indic_category_t {
OT_Repha = 15, /* Atomically-encoded logical or visual repha. */
OT_Ra = 16,
OT_CM = 17, /* Consonant-Medial. */
- OT_Symbol = 18, /* Avagraha, etc that take marks (SM,A,VD). */
- OT_CM2 = 31 /* Consonant-Medial, second slot. */
+ OT_Symbol = 18 /* Avagraha, etc that take marks (SM,A,VD). */
};
-#define MEDIAL_FLAGS (FLAG (OT_CM) | FLAG (OT_CM2))
+#define MEDIAL_FLAGS (FLAG (OT_CM))
/* Note:
*
@@ -109,27 +108,31 @@ enum indic_syllabic_category_t {
INDIC_SYLLABIC_CATEGORY_AVAGRAHA = OT_Symbol,
INDIC_SYLLABIC_CATEGORY_BINDU = OT_SM,
- INDIC_SYLLABIC_CATEGORY_BRAHMI_JOINING_NUMBER = OT_PLACEHOLDER, /* TODO */
+ INDIC_SYLLABIC_CATEGORY_BRAHMI_JOINING_NUMBER = OT_PLACEHOLDER, /* Don't care. */
INDIC_SYLLABIC_CATEGORY_CANTILLATION_MARK = OT_A,
INDIC_SYLLABIC_CATEGORY_CONSONANT = OT_C,
INDIC_SYLLABIC_CATEGORY_CONSONANT_DEAD = OT_C,
INDIC_SYLLABIC_CATEGORY_CONSONANT_FINAL = OT_CM,
INDIC_SYLLABIC_CATEGORY_CONSONANT_HEAD_LETTER = OT_C,
+ INDIC_SYLLABIC_CATEGORY_CONSONANT_KILLER = OT_M, /* U+17CD only. */
INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL = OT_CM,
INDIC_SYLLABIC_CATEGORY_CONSONANT_PLACEHOLDER = OT_PLACEHOLDER,
INDIC_SYLLABIC_CATEGORY_CONSONANT_PRECEDING_REPHA = OT_Repha,
+ INDIC_SYLLABIC_CATEGORY_CONSONANT_PREFIXED = OT_X, /* Don't care. */
INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED = OT_CM,
INDIC_SYLLABIC_CATEGORY_CONSONANT_SUCCEEDING_REPHA = OT_N,
+ INDIC_SYLLABIC_CATEGORY_CONSONANT_WITH_STACKER = OT_Repha, /* TODO */
INDIC_SYLLABIC_CATEGORY_GEMINATION_MARK = OT_SM,
- INDIC_SYLLABIC_CATEGORY_INVISIBLE_STACKER = OT_H, /* TODO */
+ INDIC_SYLLABIC_CATEGORY_INVISIBLE_STACKER = OT_Coeng,
INDIC_SYLLABIC_CATEGORY_JOINER = OT_ZWJ,
INDIC_SYLLABIC_CATEGORY_MODIFYING_LETTER = OT_X,
INDIC_SYLLABIC_CATEGORY_NON_JOINER = OT_ZWNJ,
INDIC_SYLLABIC_CATEGORY_NUKTA = OT_N,
INDIC_SYLLABIC_CATEGORY_NUMBER = OT_PLACEHOLDER,
- INDIC_SYLLABIC_CATEGORY_NUMBER_JOINER = OT_PLACEHOLDER, /* TODO */
- INDIC_SYLLABIC_CATEGORY_PURE_KILLER = OT_H, /* TODO */
+ INDIC_SYLLABIC_CATEGORY_NUMBER_JOINER = OT_PLACEHOLDER, /* Don't care. */
+ INDIC_SYLLABIC_CATEGORY_PURE_KILLER = OT_M, /* Is like a vowel matra. */
INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER = OT_RS,
+ INDIC_SYLLABIC_CATEGORY_SYLLABLE_MODIFIER = OT_M, /* Misc Khmer signs. */
INDIC_SYLLABIC_CATEGORY_TONE_LETTER = OT_X,
INDIC_SYLLABIC_CATEGORY_TONE_MARK = OT_N,
INDIC_SYLLABIC_CATEGORY_VIRAMA = OT_H,
@@ -162,17 +165,23 @@ enum indic_matra_category_t {
};
#define INDIC_COMBINE_CATEGORIES(S,M) \
- (ASSERT_STATIC_EXPR_ZERO (M == INDIC_MATRA_CATEGORY_NOT_APPLICABLE || \
- ( \
- S == INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL || \
- S == INDIC_SYLLABIC_CATEGORY_GEMINATION_MARK || \
- S == INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER || \
- S == INDIC_SYLLABIC_CATEGORY_CONSONANT_SUCCEEDING_REPHA || \
- S == INDIC_SYLLABIC_CATEGORY_VIRAMA || \
- S == INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT || \
- false)) + \
- ASSERT_STATIC_EXPR_ZERO (S < 255 && M < 255) + \
- ((M << 8) | S))
+ ( \
+ ASSERT_STATIC_EXPR_ZERO (S < 255 && M < 255) + \
+ ( S | \
+ ( \
+ ( \
+ S == INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL || \
+ S == INDIC_SYLLABIC_CATEGORY_GEMINATION_MARK || \
+ S == INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER || \
+ S == INDIC_SYLLABIC_CATEGORY_CONSONANT_SUCCEEDING_REPHA || \
+ S == INDIC_SYLLABIC_CATEGORY_VIRAMA || \
+ S == INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT || \
+ false \
+ ? M : INDIC_MATRA_CATEGORY_NOT_APPLICABLE \
+ ) << 8 \
+ ) \
+ ) \
+ )
HB_INTERNAL INDIC_TABLE_ELEMENT_TYPE
hb_indic_get_categories (hb_codepoint_t u);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-table.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-table.cc
index 2e159a12b0..80a6b25e3b 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-table.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-table.cc
@@ -2,67 +2,71 @@
/*
* The following table is generated by running:
*
- * ./gen-indic-table.py IndicSyllabicCategory.txt IndicMatraCategory.txt Blocks.txt
+ * ./gen-indic-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt Blocks.txt
*
* on files with these headers:
*
- * # IndicSyllabicCategory-7.0.0.txt
- * # Date: 2014-06-03, 07:00:00 GMT [KW, LI, AG, RP]
- * # IndicMatraCategory-7.0.0.txt
- * # Date: 2014-06-03, 07:00:00 GMT [KW, LI, AG, RP]
- * # Blocks-7.0.0.txt
- * # Date: 2014-04-03, 23:23:00 GMT [RP, KW]
+ * # IndicSyllabicCategory-9.0.0.txt
+ * # Date: 2016-05-21, 02:46:00 GMT [RP]
+ * # IndicPositionalCategory-9.0.0.txt
+ * # Date: 2016-02-25, 00:48:00 GMT [RP]
+ * # Blocks-9.0.0.txt
+ * # Date: 2016-02-05, 23:48:00 GMT [KW]
*/
#include "hb-ot-shape-complex-indic-private.hh"
-#define ISC_A INDIC_SYLLABIC_CATEGORY_AVAGRAHA /* 13 chars; Avagraha */
-#define ISC_Bi INDIC_SYLLABIC_CATEGORY_BINDU /* 59 chars; Bindu */
+#define ISC_A INDIC_SYLLABIC_CATEGORY_AVAGRAHA /* 15 chars; Avagraha */
+#define ISC_Bi INDIC_SYLLABIC_CATEGORY_BINDU /* 67 chars; Bindu */
#define ISC_BJN INDIC_SYLLABIC_CATEGORY_BRAHMI_JOINING_NUMBER /* 20 chars; Brahmi_Joining_Number */
-#define ISC_Ca INDIC_SYLLABIC_CATEGORY_CANTILLATION_MARK /* 30 chars; Cantillation_Mark */
-#define ISC_C INDIC_SYLLABIC_CATEGORY_CONSONANT /* 1744 chars; Consonant */
-#define ISC_CD INDIC_SYLLABIC_CATEGORY_CONSONANT_DEAD /* 7 chars; Consonant_Dead */
-#define ISC_CF INDIC_SYLLABIC_CATEGORY_CONSONANT_FINAL /* 61 chars; Consonant_Final */
+#define ISC_Ca INDIC_SYLLABIC_CATEGORY_CANTILLATION_MARK /* 53 chars; Cantillation_Mark */
+#define ISC_C INDIC_SYLLABIC_CATEGORY_CONSONANT /* 1907 chars; Consonant */
+#define ISC_CD INDIC_SYLLABIC_CATEGORY_CONSONANT_DEAD /* 10 chars; Consonant_Dead */
+#define ISC_CF INDIC_SYLLABIC_CATEGORY_CONSONANT_FINAL /* 62 chars; Consonant_Final */
#define ISC_CHL INDIC_SYLLABIC_CATEGORY_CONSONANT_HEAD_LETTER /* 5 chars; Consonant_Head_Letter */
-#define ISC_CM INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL /* 19 chars; Consonant_Medial */
-#define ISC_CP INDIC_SYLLABIC_CATEGORY_CONSONANT_PLACEHOLDER /* 11 chars; Consonant_Placeholder */
+#define ISC_CK INDIC_SYLLABIC_CATEGORY_CONSONANT_KILLER /* 2 chars; Consonant_Killer */
+#define ISC_CM INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL /* 22 chars; Consonant_Medial */
+#define ISC_CP INDIC_SYLLABIC_CATEGORY_CONSONANT_PLACEHOLDER /* 16 chars; Consonant_Placeholder */
#define ISC_CPR INDIC_SYLLABIC_CATEGORY_CONSONANT_PRECEDING_REPHA /* 1 chars; Consonant_Preceding_Repha */
-#define ISC_CS INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED /* 61 chars; Consonant_Subjoined */
+#define ISC_CPrf INDIC_SYLLABIC_CATEGORY_CONSONANT_PREFIXED /* 2 chars; Consonant_Prefixed */
+#define ISC_CS INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED /* 90 chars; Consonant_Subjoined */
#define ISC_CSR INDIC_SYLLABIC_CATEGORY_CONSONANT_SUCCEEDING_REPHA /* 4 chars; Consonant_Succeeding_Repha */
+#define ISC_CWS INDIC_SYLLABIC_CATEGORY_CONSONANT_WITH_STACKER /* 4 chars; Consonant_With_Stacker */
#define ISC_GM INDIC_SYLLABIC_CATEGORY_GEMINATION_MARK /* 2 chars; Gemination_Mark */
#define ISC_IS INDIC_SYLLABIC_CATEGORY_INVISIBLE_STACKER /* 7 chars; Invisible_Stacker */
#define ISC_ZWJ INDIC_SYLLABIC_CATEGORY_JOINER /* 1 chars; Joiner */
#define ISC_ML INDIC_SYLLABIC_CATEGORY_MODIFYING_LETTER /* 1 chars; Modifying_Letter */
#define ISC_ZWNJ INDIC_SYLLABIC_CATEGORY_NON_JOINER /* 1 chars; Non_Joiner */
-#define ISC_N INDIC_SYLLABIC_CATEGORY_NUKTA /* 18 chars; Nukta */
-#define ISC_Nd INDIC_SYLLABIC_CATEGORY_NUMBER /* 408 chars; Number */
+#define ISC_N INDIC_SYLLABIC_CATEGORY_NUKTA /* 24 chars; Nukta */
+#define ISC_Nd INDIC_SYLLABIC_CATEGORY_NUMBER /* 459 chars; Number */
#define ISC_NJ INDIC_SYLLABIC_CATEGORY_NUMBER_JOINER /* 1 chars; Number_Joiner */
#define ISC_x INDIC_SYLLABIC_CATEGORY_OTHER /* 1 chars; Other */
-#define ISC_PK INDIC_SYLLABIC_CATEGORY_PURE_KILLER /* 15 chars; Pure_Killer */
-#define ISC_RS INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER /* 3 chars; Register_Shifter */
+#define ISC_PK INDIC_SYLLABIC_CATEGORY_PURE_KILLER /* 16 chars; Pure_Killer */
+#define ISC_RS INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER /* 2 chars; Register_Shifter */
+#define ISC_SM INDIC_SYLLABIC_CATEGORY_SYLLABLE_MODIFIER /* 22 chars; Syllable_Modifier */
#define ISC_TL INDIC_SYLLABIC_CATEGORY_TONE_LETTER /* 7 chars; Tone_Letter */
-#define ISC_TM INDIC_SYLLABIC_CATEGORY_TONE_MARK /* 62 chars; Tone_Mark */
-#define ISC_V INDIC_SYLLABIC_CATEGORY_VIRAMA /* 22 chars; Virama */
-#define ISC_Vs INDIC_SYLLABIC_CATEGORY_VISARGA /* 29 chars; Visarga */
+#define ISC_TM INDIC_SYLLABIC_CATEGORY_TONE_MARK /* 42 chars; Tone_Mark */
+#define ISC_V INDIC_SYLLABIC_CATEGORY_VIRAMA /* 24 chars; Virama */
+#define ISC_Vs INDIC_SYLLABIC_CATEGORY_VISARGA /* 31 chars; Visarga */
#define ISC_Vo INDIC_SYLLABIC_CATEGORY_VOWEL /* 30 chars; Vowel */
-#define ISC_M INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT /* 553 chars; Vowel_Dependent */
-#define ISC_VI INDIC_SYLLABIC_CATEGORY_VOWEL_INDEPENDENT /* 395 chars; Vowel_Independent */
+#define ISC_M INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT /* 602 chars; Vowel_Dependent */
+#define ISC_VI INDIC_SYLLABIC_CATEGORY_VOWEL_INDEPENDENT /* 431 chars; Vowel_Independent */
-#define IMC_B INDIC_MATRA_CATEGORY_BOTTOM /* 142 chars; Bottom */
+#define IMC_B INDIC_MATRA_CATEGORY_BOTTOM /* 300 chars; Bottom */
#define IMC_BR INDIC_MATRA_CATEGORY_BOTTOM_AND_RIGHT /* 2 chars; Bottom_And_Right */
#define IMC_L INDIC_MATRA_CATEGORY_LEFT /* 57 chars; Left */
#define IMC_LR INDIC_MATRA_CATEGORY_LEFT_AND_RIGHT /* 21 chars; Left_And_Right */
#define IMC_x INDIC_MATRA_CATEGORY_NOT_APPLICABLE /* 1 chars; Not_Applicable */
-#define IMC_O INDIC_MATRA_CATEGORY_OVERSTRUCK /* 2 chars; Overstruck */
-#define IMC_R INDIC_MATRA_CATEGORY_RIGHT /* 163 chars; Right */
-#define IMC_T INDIC_MATRA_CATEGORY_TOP /* 169 chars; Top */
+#define IMC_O INDIC_MATRA_CATEGORY_OVERSTRUCK /* 10 chars; Overstruck */
+#define IMC_R INDIC_MATRA_CATEGORY_RIGHT /* 258 chars; Right */
+#define IMC_T INDIC_MATRA_CATEGORY_TOP /* 342 chars; Top */
#define IMC_TB INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM /* 10 chars; Top_And_Bottom */
#define IMC_TBR INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM_AND_RIGHT /* 1 chars; Top_And_Bottom_And_Right */
#define IMC_TL INDIC_MATRA_CATEGORY_TOP_AND_LEFT /* 6 chars; Top_And_Left */
#define IMC_TLR INDIC_MATRA_CATEGORY_TOP_AND_LEFT_AND_RIGHT /* 4 chars; Top_And_Left_And_Right */
#define IMC_TR INDIC_MATRA_CATEGORY_TOP_AND_RIGHT /* 13 chars; Top_And_Right */
-#define IMC_VOL INDIC_MATRA_CATEGORY_VISUAL_ORDER_LEFT /* 15 chars; Visual_Order_Left */
+#define IMC_VOL INDIC_MATRA_CATEGORY_VISUAL_ORDER_LEFT /* 19 chars; Visual_Order_Left */
#define _(S,M) INDIC_COMBINE_CATEGORIES (ISC_##S, IMC_##M)
@@ -79,29 +83,33 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
/* 0030 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
/* 0038 */ _(Nd,x), _(Nd,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-#define indic_offset_0x00d0u 24
+#define indic_offset_0x00b0u 24
/* Latin-1 Supplement */
+ /* 00B0 */ _(x,x), _(x,x), _(SM,x), _(SM,x), _(x,x), _(x,x), _(x,x), _(x,x),
+ /* 00B8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
+ /* 00C0 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
+ /* 00C8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
/* 00D0 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(CP,x),
-#define indic_offset_0x0900u 32
+#define indic_offset_0x0900u 64
/* Devanagari */
- /* 0900 */ _(Bi,x), _(Bi,x), _(Bi,x), _(Vs,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
+ /* 0900 */ _(Bi,T), _(Bi,T), _(Bi,T), _(Vs,R), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
/* 0908 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
/* 0910 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(C,x), _(C,x), _(C,x),
/* 0918 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 0920 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 0928 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 0930 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 0938 */ _(C,x), _(C,x), _(M,T), _(M,R), _(N,x), _(A,x), _(M,R), _(M,L),
+ /* 0938 */ _(C,x), _(C,x), _(M,T), _(M,R), _(N,B), _(A,x), _(M,R), _(M,L),
/* 0940 */ _(M,R), _(M,B), _(M,B), _(M,B), _(M,B), _(M,T), _(M,T), _(M,T),
/* 0948 */ _(M,T), _(M,R), _(M,R), _(M,R), _(M,R), _(V,B), _(M,L), _(M,R),
- /* 0950 */ _(x,x), _(TM,x), _(TM,x), _(x,x), _(x,x), _(M,T), _(M,B), _(M,B),
+ /* 0950 */ _(x,x), _(Ca,T), _(Ca,B), _(x,T), _(x,T), _(M,T), _(M,B), _(M,B),
/* 0958 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 0960 */ _(VI,x), _(VI,x), _(M,B), _(M,B), _(x,x), _(x,x), _(Nd,x), _(Nd,x),
/* 0968 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
@@ -110,14 +118,14 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
/* Bengali */
- /* 0980 */ _(x,x), _(Bi,x), _(Bi,x), _(Vs,x), _(x,x), _(VI,x), _(VI,x), _(VI,x),
+ /* 0980 */ _(x,x), _(Bi,T), _(Bi,R), _(Vs,R), _(x,x), _(VI,x), _(VI,x), _(VI,x),
/* 0988 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(x,x), _(x,x), _(VI,x),
/* 0990 */ _(VI,x), _(x,x), _(x,x), _(VI,x), _(VI,x), _(C,x), _(C,x), _(C,x),
/* 0998 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 09A0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 09A8 */ _(C,x), _(x,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 09B0 */ _(C,x), _(x,x), _(C,x), _(x,x), _(x,x), _(x,x), _(C,x), _(C,x),
- /* 09B8 */ _(C,x), _(C,x), _(x,x), _(x,x), _(N,x), _(A,x), _(M,R), _(M,L),
+ /* 09B8 */ _(C,x), _(C,x), _(x,x), _(x,x), _(N,B), _(A,x), _(M,R), _(M,L),
/* 09C0 */ _(M,R), _(M,B), _(M,B), _(M,B), _(M,B), _(x,x), _(x,x), _(M,L),
/* 09C8 */ _(M,L), _(x,x), _(x,x), _(M,LR), _(M,LR), _(V,B), _(CD,x), _(x,x),
/* 09D0 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(M,R),
@@ -129,33 +137,33 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
/* Gurmukhi */
- /* 0A00 */ _(x,x), _(Bi,x), _(Bi,x), _(Vs,x), _(x,x), _(VI,x), _(VI,x), _(VI,x),
+ /* 0A00 */ _(x,x), _(Bi,T), _(Bi,T), _(Vs,R), _(x,x), _(VI,x), _(VI,x), _(VI,x),
/* 0A08 */ _(VI,x), _(VI,x), _(VI,x), _(x,x), _(x,x), _(x,x), _(x,x), _(VI,x),
/* 0A10 */ _(VI,x), _(x,x), _(x,x), _(VI,x), _(VI,x), _(C,x), _(C,x), _(C,x),
/* 0A18 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 0A20 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 0A28 */ _(C,x), _(x,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 0A30 */ _(C,x), _(x,x), _(C,x), _(C,x), _(x,x), _(C,x), _(C,x), _(x,x),
- /* 0A38 */ _(C,x), _(C,x), _(x,x), _(x,x), _(N,x), _(x,x), _(M,R), _(M,L),
+ /* 0A38 */ _(C,x), _(C,x), _(x,x), _(x,x), _(N,B), _(x,x), _(M,R), _(M,L),
/* 0A40 */ _(M,R), _(M,B), _(M,B), _(x,x), _(x,x), _(x,x), _(x,x), _(M,T),
/* 0A48 */ _(M,T), _(x,x), _(x,x), _(M,T), _(M,T), _(V,B), _(x,x), _(x,x),
/* 0A50 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
/* 0A58 */ _(x,x), _(C,x), _(C,x), _(C,x), _(C,x), _(x,x), _(C,x), _(x,x),
/* 0A60 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(Nd,x), _(Nd,x),
/* 0A68 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* 0A70 */ _(Bi,x), _(GM,T), _(CP,x), _(CP,x), _(x,x), _(CM,x), _(x,x), _(x,x),
+ /* 0A70 */ _(Bi,T), _(GM,T), _(CP,x), _(CP,x), _(x,x), _(CM,B), _(x,x), _(x,x),
/* 0A78 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
/* Gujarati */
- /* 0A80 */ _(x,x), _(Bi,x), _(Bi,x), _(Vs,x), _(x,x), _(VI,x), _(VI,x), _(VI,x),
+ /* 0A80 */ _(x,x), _(Bi,T), _(Bi,T), _(Vs,R), _(x,x), _(VI,x), _(VI,x), _(VI,x),
/* 0A88 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(x,x), _(VI,x),
/* 0A90 */ _(VI,x), _(VI,x), _(x,x), _(VI,x), _(VI,x), _(C,x), _(C,x), _(C,x),
/* 0A98 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 0AA0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 0AA8 */ _(C,x), _(x,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 0AB0 */ _(C,x), _(x,x), _(C,x), _(C,x), _(x,x), _(C,x), _(C,x), _(C,x),
- /* 0AB8 */ _(C,x), _(C,x), _(x,x), _(x,x), _(N,x), _(A,x), _(M,R), _(M,L),
+ /* 0AB8 */ _(C,x), _(C,x), _(x,x), _(x,x), _(N,B), _(A,x), _(M,R), _(M,L),
/* 0AC0 */ _(M,R), _(M,B), _(M,B), _(M,B), _(M,B), _(M,T), _(x,x), _(M,T),
/* 0AC8 */ _(M,T), _(M,TR), _(x,x), _(M,R), _(M,R), _(V,B), _(x,x), _(x,x),
/* 0AD0 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
@@ -163,18 +171,18 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
/* 0AE0 */ _(VI,x), _(VI,x), _(M,B), _(M,B), _(x,x), _(x,x), _(Nd,x), _(Nd,x),
/* 0AE8 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
/* 0AF0 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 0AF8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
+ /* 0AF8 */ _(x,x), _(C,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
/* Oriya */
- /* 0B00 */ _(x,x), _(Bi,x), _(Bi,x), _(Vs,x), _(x,x), _(VI,x), _(VI,x), _(VI,x),
+ /* 0B00 */ _(x,x), _(Bi,T), _(Bi,R), _(Vs,R), _(x,x), _(VI,x), _(VI,x), _(VI,x),
/* 0B08 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(x,x), _(x,x), _(VI,x),
/* 0B10 */ _(VI,x), _(x,x), _(x,x), _(VI,x), _(VI,x), _(C,x), _(C,x), _(C,x),
/* 0B18 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 0B20 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 0B28 */ _(C,x), _(x,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 0B30 */ _(C,x), _(x,x), _(C,x), _(C,x), _(x,x), _(C,x), _(C,x), _(C,x),
- /* 0B38 */ _(C,x), _(C,x), _(x,x), _(x,x), _(N,x), _(A,x), _(M,R), _(M,T),
+ /* 0B38 */ _(C,x), _(C,x), _(x,x), _(x,x), _(N,B), _(A,x), _(M,R), _(M,T),
/* 0B40 */ _(M,R), _(M,B), _(M,B), _(M,B), _(M,B), _(x,x), _(x,x), _(M,L),
/* 0B48 */ _(M,TL), _(x,x), _(x,x), _(M,LR),_(M,TLR), _(V,B), _(x,x), _(x,x),
/* 0B50 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(M,T), _(M,TR),
@@ -186,7 +194,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
/* Tamil */
- /* 0B80 */ _(x,x), _(x,x), _(Bi,x), _(ML,x), _(x,x), _(VI,x), _(VI,x), _(VI,x),
+ /* 0B80 */ _(x,x), _(x,x), _(Bi,T), _(ML,x), _(x,x), _(VI,x), _(VI,x), _(VI,x),
/* 0B88 */ _(VI,x), _(VI,x), _(VI,x), _(x,x), _(x,x), _(x,x), _(VI,x), _(VI,x),
/* 0B90 */ _(VI,x), _(x,x), _(VI,x), _(VI,x), _(VI,x), _(C,x), _(x,x), _(x,x),
/* 0B98 */ _(x,x), _(C,x), _(C,x), _(x,x), _(C,x), _(x,x), _(C,x), _(C,x),
@@ -194,7 +202,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
/* 0BA8 */ _(C,x), _(C,x), _(C,x), _(x,x), _(x,x), _(x,x), _(C,x), _(C,x),
/* 0BB0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 0BB8 */ _(C,x), _(C,x), _(x,x), _(x,x), _(x,x), _(x,x), _(M,R), _(M,R),
- /* 0BC0 */ _(M,T), _(M,B), _(M,B), _(x,x), _(x,x), _(x,x), _(M,L), _(M,L),
+ /* 0BC0 */ _(M,T), _(M,R), _(M,R), _(x,x), _(x,x), _(x,x), _(M,L), _(M,L),
/* 0BC8 */ _(M,L), _(x,x), _(M,LR), _(M,LR), _(M,LR), _(V,T), _(x,x), _(x,x),
/* 0BD0 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(M,R),
/* 0BD8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
@@ -205,7 +213,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
/* Telugu */
- /* 0C00 */ _(Bi,x), _(Bi,x), _(Bi,x), _(Vs,x), _(x,x), _(VI,x), _(VI,x), _(VI,x),
+ /* 0C00 */ _(Bi,T), _(Bi,R), _(Bi,R), _(Vs,R), _(x,x), _(VI,x), _(VI,x), _(VI,x),
/* 0C08 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(x,x), _(VI,x), _(VI,x),
/* 0C10 */ _(VI,x), _(x,x), _(VI,x), _(VI,x), _(VI,x), _(C,x), _(C,x), _(C,x),
/* 0C18 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
@@ -216,7 +224,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
/* 0C40 */ _(M,T), _(M,R), _(M,R), _(M,R), _(M,R), _(x,x), _(M,T), _(M,T),
/* 0C48 */ _(M,TB), _(x,x), _(M,T), _(M,T), _(M,T), _(V,T), _(x,x), _(x,x),
/* 0C50 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(M,T), _(M,B), _(x,x),
- /* 0C58 */ _(C,x), _(C,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
+ /* 0C58 */ _(C,x), _(C,x), _(C,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
/* 0C60 */ _(VI,x), _(VI,x), _(M,B), _(M,B), _(x,x), _(x,x), _(Nd,x), _(Nd,x),
/* 0C68 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
/* 0C70 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
@@ -224,26 +232,26 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
/* Kannada */
- /* 0C80 */ _(x,x), _(Bi,x), _(Bi,x), _(Vs,x), _(x,x), _(VI,x), _(VI,x), _(VI,x),
+ /* 0C80 */ _(x,x), _(Bi,T), _(Bi,R), _(Vs,R), _(x,x), _(VI,x), _(VI,x), _(VI,x),
/* 0C88 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(x,x), _(VI,x), _(VI,x),
/* 0C90 */ _(VI,x), _(x,x), _(VI,x), _(VI,x), _(VI,x), _(C,x), _(C,x), _(C,x),
/* 0C98 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 0CA0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 0CA8 */ _(C,x), _(x,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 0CB0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(x,x), _(C,x), _(C,x), _(C,x),
- /* 0CB8 */ _(C,x), _(C,x), _(x,x), _(x,x), _(N,x), _(A,x), _(M,R), _(M,T),
+ /* 0CB8 */ _(C,x), _(C,x), _(x,x), _(x,x), _(N,B), _(A,x), _(M,R), _(M,T),
/* 0CC0 */ _(M,TR), _(M,R), _(M,R), _(M,R), _(M,R), _(x,x), _(M,T), _(M,TR),
/* 0CC8 */ _(M,TR), _(x,x), _(M,TR), _(M,TR), _(M,T), _(V,T), _(x,x), _(x,x),
/* 0CD0 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(M,R), _(M,R), _(x,x),
/* 0CD8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(C,x), _(x,x),
/* 0CE0 */ _(VI,x), _(VI,x), _(M,B), _(M,B), _(x,x), _(x,x), _(Nd,x), _(Nd,x),
/* 0CE8 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* 0CF0 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
+ /* 0CF0 */ _(x,x),_(CWS,x),_(CWS,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
/* 0CF8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
/* Malayalam */
- /* 0D00 */ _(x,x), _(Bi,x), _(Bi,x), _(Vs,x), _(x,x), _(VI,x), _(VI,x), _(VI,x),
+ /* 0D00 */ _(x,x), _(Bi,T), _(Bi,R), _(Vs,R), _(x,x), _(VI,x), _(VI,x), _(VI,x),
/* 0D08 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(x,x), _(VI,x), _(VI,x),
/* 0D10 */ _(VI,x), _(x,x), _(VI,x), _(VI,x), _(VI,x), _(C,x), _(C,x), _(C,x),
/* 0D18 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
@@ -253,8 +261,8 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
/* 0D38 */ _(C,x), _(C,x), _(C,x), _(x,x), _(x,x), _(A,x), _(M,R), _(M,R),
/* 0D40 */ _(M,R), _(M,R), _(M,R), _(M,B), _(M,B), _(x,x), _(M,L), _(M,L),
/* 0D48 */ _(M,L), _(x,x), _(M,LR), _(M,LR), _(M,LR), _(V,T),_(CPR,x), _(x,x),
- /* 0D50 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(M,R),
- /* 0D58 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
+ /* 0D50 */ _(x,x), _(x,x), _(x,x), _(x,x), _(CD,x), _(CD,x), _(CD,x), _(M,R),
+ /* 0D58 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(VI,x),
/* 0D60 */ _(VI,x), _(VI,x), _(M,B), _(M,B), _(x,x), _(x,x), _(Nd,x), _(Nd,x),
/* 0D68 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
/* 0D70 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
@@ -262,7 +270,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
/* Sinhala */
- /* 0D80 */ _(x,x), _(x,x), _(Bi,x), _(Vs,x), _(x,x), _(VI,x), _(VI,x), _(VI,x),
+ /* 0D80 */ _(x,x), _(x,x), _(Bi,R), _(Vs,R), _(x,x), _(VI,x), _(VI,x), _(VI,x),
/* 0D88 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
/* 0D90 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(x,x),
/* 0D98 */ _(x,x), _(x,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
@@ -278,7 +286,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
/* 0DE8 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
/* 0DF0 */ _(x,x), _(x,x), _(M,R), _(M,R), _(x,x), _(x,x), _(x,x), _(x,x),
-#define indic_offset_0x1000u 1304
+#define indic_offset_0x1000u 1336
/* Myanmar */
@@ -289,52 +297,24 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
/* 1018 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 1020 */ _(C,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
/* 1028 */ _(VI,x), _(VI,x), _(VI,x), _(M,R), _(M,R), _(M,T), _(M,T), _(M,B),
- /* 1030 */ _(M,B), _(M,L), _(M,T), _(M,T), _(M,T), _(M,T), _(Bi,x), _(TM,x),
- /* 1038 */ _(Vs,x), _(IS,x), _(PK,T), _(CM,x), _(CM,x), _(CM,x), _(CM,x), _(C,x),
+ /* 1030 */ _(M,B), _(M,L), _(M,T), _(M,T), _(M,T), _(M,T), _(Bi,T), _(TM,B),
+ /* 1038 */ _(Vs,R), _(IS,x), _(PK,T), _(CM,R), _(CM,x), _(CM,B), _(CM,B), _(C,x),
/* 1040 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
/* 1048 */ _(Nd,x), _(Nd,x), _(x,x), _(x,x), _(x,x), _(x,x), _(CP,x), _(x,x),
/* 1050 */ _(C,x), _(C,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(M,R), _(M,R),
- /* 1058 */ _(M,B), _(M,B), _(C,x), _(C,x), _(C,x), _(C,x), _(CM,x), _(CM,x),
- /* 1060 */ _(CM,x), _(C,x), _(M,R), _(TM,x), _(TM,x), _(C,x), _(C,x), _(M,R),
- /* 1068 */ _(M,R), _(TM,x), _(TM,x), _(TM,x), _(TM,x), _(TM,x), _(C,x), _(C,x),
+ /* 1058 */ _(M,B), _(M,B), _(C,x), _(C,x), _(C,x), _(C,x), _(CM,B), _(CM,B),
+ /* 1060 */ _(CM,B), _(C,x), _(M,R), _(TM,R), _(TM,R), _(C,x), _(C,x), _(M,R),
+ /* 1068 */ _(M,R), _(TM,R), _(TM,R), _(TM,R), _(TM,R), _(TM,R), _(C,x), _(C,x),
/* 1070 */ _(C,x), _(M,T), _(M,T), _(M,T), _(M,T), _(C,x), _(C,x), _(C,x),
/* 1078 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1080 */ _(C,x), _(C,x), _(CM,x), _(M,R), _(M,L), _(M,T), _(M,T), _(TM,x),
- /* 1088 */ _(TM,x), _(TM,x), _(TM,x), _(TM,x), _(TM,x), _(TM,x), _(C,x), _(TM,x),
+ /* 1080 */ _(C,x), _(C,x), _(CM,B), _(M,R), _(M,L), _(M,T), _(M,T), _(TM,R),
+ /* 1088 */ _(TM,R), _(TM,R), _(TM,R), _(TM,R), _(TM,R), _(TM,B), _(C,x), _(TM,R),
/* 1090 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* 1098 */ _(Nd,x), _(Nd,x), _(TM,x), _(TM,x), _(M,R), _(M,T), _(x,x), _(x,x),
+ /* 1098 */ _(Nd,x), _(Nd,x), _(TM,R), _(TM,R), _(M,R), _(M,T), _(x,x), _(x,x),
-#define indic_offset_0x1700u 1464
+#define indic_offset_0x1780u 1496
- /* Tagalog */
-
- /* 1700 */ _(VI,x), _(VI,x), _(VI,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1708 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(x,x), _(C,x), _(C,x),
- /* 1710 */ _(C,x), _(C,x), _(M,T), _(M,B), _(PK,B), _(x,x), _(x,x), _(x,x),
- /* 1718 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
- /* Hanunoo */
-
- /* 1720 */ _(VI,x), _(VI,x), _(VI,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1728 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1730 */ _(C,x), _(C,x), _(M,T), _(M,B), _(PK,B), _(x,x), _(x,x), _(x,x),
- /* 1738 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
- /* Buhid */
-
- /* 1740 */ _(VI,x), _(VI,x), _(VI,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1748 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1750 */ _(C,x), _(C,x), _(M,T), _(M,B), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 1758 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
- /* Tagbanwa */
-
- /* 1760 */ _(VI,x), _(VI,x), _(VI,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1768 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(x,x), _(C,x), _(C,x),
- /* 1770 */ _(C,x), _(x,x), _(M,T), _(M,B), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 1778 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
/* Khmer */
/* 1780 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
@@ -345,515 +325,72 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
/* 17A8 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
/* 17B0 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(x,x), _(x,x), _(M,R), _(M,T),
/* 17B8 */ _(M,T), _(M,T), _(M,T), _(M,B), _(M,B), _(M,B), _(M,TL),_(M,TLR),
- /* 17C0 */ _(M,LR), _(M,L), _(M,L), _(M,L), _(M,LR), _(M,LR), _(Bi,x), _(Vs,x),
- /* 17C8 */ _(M,R), _(RS,T), _(RS,T), _(RS,T),_(CSR,T), _(M,T), _(M,T), _(M,T),
- /* 17D0 */ _(M,T), _(PK,T), _(IS,x), _(M,T), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 17D8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(A,x), _(x,x), _(x,x), _(x,x),
+ /* 17C0 */ _(M,LR), _(M,L), _(M,L), _(M,L), _(M,LR), _(M,LR), _(Bi,T), _(Vs,R),
+ /* 17C8 */ _(M,R), _(RS,T), _(RS,T), _(SM,T),_(CSR,T), _(CK,T), _(SM,T), _(SM,T),
+ /* 17D0 */ _(SM,T), _(PK,T), _(IS,x), _(SM,T), _(x,x), _(x,x), _(x,x), _(x,x),
+ /* 17D8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(A,x), _(SM,T), _(x,x), _(x,x),
/* 17E0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
/* 17E8 */ _(Nd,x), _(Nd,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-#define indic_offset_0x1900u 1704
-
-
- /* Limbu */
-
- /* 1900 */ _(CP,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1908 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1910 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1918 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(x,x),
- /* 1920 */ _(M,T), _(M,T), _(M,B), _(M,R), _(M,R), _(M,TR), _(M,TR), _(M,T),
- /* 1928 */ _(M,T), _(CS,x), _(CS,x), _(CS,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 1930 */ _(CF,x), _(CF,x), _(Bi,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x),
- /* 1938 */ _(CF,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 1940 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(Nd,x), _(Nd,x),
- /* 1948 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-
- /* Tai Le */
-
- /* 1950 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1958 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1960 */ _(C,x), _(C,x), _(C,x), _(Vo,x), _(Vo,x), _(Vo,x), _(Vo,x), _(Vo,x),
- /* 1968 */ _(Vo,x), _(Vo,x), _(Vo,x), _(Vo,x), _(Vo,x), _(Vo,x), _(x,x), _(x,x),
- /* 1970 */ _(TL,x), _(TL,x), _(TL,x), _(TL,x), _(TL,x), _(x,x), _(x,x), _(x,x),
- /* 1978 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
- /* New Tai Lue */
-
- /* 1980 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1988 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1990 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1998 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 19A0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 19A8 */ _(C,x), _(C,x), _(C,x), _(C,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 19B0 */ _(M,R), _(M,R), _(M,R), _(M,R), _(M,R), _(M,L), _(M,L), _(M,L),
- /* 19B8 */ _(M,R), _(M,R), _(M,L), _(M,R), _(M,R), _(M,R), _(M,R), _(M,R),
- /* 19C0 */ _(M,R), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x),
- /* 19C8 */ _(TM,x), _(TM,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 19D0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* 19D8 */ _(Nd,x), _(Nd,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 19E0 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 19E8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 19F0 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 19F8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
- /* Buginese */
-
- /* 1A00 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1A08 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1A10 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(M,T),
- /* 1A18 */ _(M,B), _(M,L), _(M,R), _(M,T), _(x,x), _(x,x), _(x,x), _(x,x),
-
- /* Tai Tham */
-
- /* 1A20 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1A28 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1A30 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1A38 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1A40 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1A48 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(VI,x), _(VI,x), _(VI,x),
- /* 1A50 */ _(VI,x), _(VI,x), _(VI,x), _(C,x), _(C,x), _(CM,L), _(CM,x), _(CF,x),
- /* 1A58 */ _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(x,x),
- /* 1A60 */ _(IS,x), _(M,R), _(M,T), _(M,R), _(M,R), _(M,T), _(M,T), _(M,T),
- /* 1A68 */ _(M,T), _(M,B), _(M,B), _(M,T), _(M,B), _(M,R), _(M,L), _(M,L),
- /* 1A70 */ _(M,L), _(M,L), _(M,L), _(M,T), _(M,T), _(TM,x), _(TM,x), _(TM,x),
- /* 1A78 */ _(TM,x), _(TM,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 1A80 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* 1A88 */ _(Nd,x), _(Nd,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 1A90 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* 1A98 */ _(Nd,x), _(Nd,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
-#define indic_offset_0x1b00u 2120
-
-
- /* Balinese */
-
- /* 1B00 */ _(Bi,x), _(Bi,x), _(Bi,x),_(CSR,x), _(Vs,x), _(VI,x), _(VI,x), _(VI,x),
- /* 1B08 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
- /* 1B10 */ _(VI,x), _(VI,x), _(VI,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1B18 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1B20 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1B28 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1B30 */ _(C,x), _(C,x), _(C,x), _(C,x), _(N,x), _(M,R), _(M,T), _(M,T),
- /* 1B38 */ _(M,B), _(M,B), _(M,B), _(M,BR), _(M,TB),_(M,TBR), _(M,L), _(M,L),
- /* 1B40 */ _(M,LR), _(M,LR), _(M,T), _(M,TR), _(V,R), _(C,x), _(C,x), _(C,x),
- /* 1B48 */ _(C,x), _(C,x), _(C,x), _(C,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 1B50 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* 1B58 */ _(Nd,x), _(Nd,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 1B60 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 1B68 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 1B70 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 1B78 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
- /* Sundanese */
-
- /* 1B80 */ _(Bi,x),_(CSR,x), _(Vs,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
- /* 1B88 */ _(VI,x), _(VI,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1B90 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1B98 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1BA0 */ _(C,x), _(CS,x), _(CS,x), _(CS,x), _(M,T), _(M,B), _(M,L), _(M,R),
- /* 1BA8 */ _(M,T), _(M,T), _(PK,R), _(IS,x), _(CS,x), _(CS,x), _(C,x), _(C,x),
- /* 1BB0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* 1BB8 */ _(Nd,x), _(Nd,x), _(A,x), _(C,x), _(C,x), _(C,x), _(CF,x), _(CF,x),
-
- /* Batak */
-
- /* 1BC0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1BC8 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1BD0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1BD8 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1BE0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(VI,x), _(VI,x), _(N,x), _(M,R),
- /* 1BE8 */ _(M,T), _(M,T), _(M,R), _(M,R), _(M,R), _(M,T), _(M,R), _(M,T),
- /* 1BF0 */ _(CF,x), _(CF,x), _(PK,R), _(PK,R), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 1BF8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
- /* Lepcha */
-
- /* 1C00 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1C08 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1C10 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1C18 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 1C20 */ _(C,x), _(C,x), _(C,x), _(C,x), _(CS,x), _(CS,x), _(M,R), _(M,L),
- /* 1C28 */ _(M,L), _(M,TL), _(M,R), _(M,R), _(M,B), _(CF,x), _(CF,x), _(CF,x),
- /* 1C30 */ _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(Bi,L), _(Bi,L), _(x,x), _(N,x),
- /* 1C38 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 1C40 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* 1C48 */ _(Nd,x), _(Nd,x), _(x,x), _(x,x), _(x,x), _(C,x), _(C,x), _(C,x),
-
-#define indic_offset_0x1cd0u 2456
+#define indic_offset_0x1cd0u 1608
/* Vedic Extensions */
- /* 1CD0 */ _(TM,x), _(TM,x), _(TM,x), _(x,x), _(TM,x), _(TM,x), _(TM,x), _(TM,x),
- /* 1CD8 */ _(TM,x), _(TM,x), _(TM,x), _(TM,x), _(TM,x), _(TM,x), _(TM,x), _(TM,x),
- /* 1CE0 */ _(TM,x), _(TM,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 1CE8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 1CF0 */ _(x,x), _(x,x), _(Vs,x), _(Vs,x), _(TM,x), _(x,x), _(x,x), _(x,x),
+ /* 1CD0 */ _(Ca,T), _(Ca,T), _(Ca,T), _(x,x), _(Ca,O), _(Ca,B), _(Ca,B), _(Ca,B),
+ /* 1CD8 */ _(Ca,B), _(Ca,B), _(Ca,T), _(Ca,T), _(Ca,B), _(Ca,B), _(Ca,B), _(Ca,B),
+ /* 1CE0 */ _(Ca,T), _(Ca,R), _(x,O), _(x,O), _(x,O), _(x,O), _(x,O), _(x,O),
+ /* 1CE8 */ _(x,O), _(x,x), _(x,x), _(x,x), _(x,x), _(x,B), _(x,x), _(x,x),
+ /* 1CF0 */ _(x,x), _(x,x), _(Vs,x), _(Vs,x), _(Ca,T), _(x,x), _(x,x), _(x,x),
+ /* 1CF8 */ _(Ca,x), _(Ca,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-#define indic_offset_0x2008u 2496
+#define indic_offset_0x2008u 1656
/* General Punctuation */
/* 2008 */ _(x,x), _(x,x), _(x,x), _(x,x),_(ZWNJ,x),_(ZWJ,x), _(x,x), _(x,x),
- /* 2010 */ _(x,x), _(x,x), _(CP,x), _(CP,x), _(CP,x), _(x,x), _(x,x), _(x,x),
-
-#define indic_offset_0xa800u 2512
-
-
- /* Syloti Nagri */
-
- /* A800 */ _(VI,x), _(VI,x), _(x,x), _(VI,x), _(VI,x), _(VI,x), _(PK,T), _(C,x),
- /* A808 */ _(C,x), _(C,x), _(C,x), _(Bi,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* A810 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* A818 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* A820 */ _(C,x), _(C,x), _(C,x), _(M,R), _(M,R), _(M,B), _(M,T), _(M,R),
- /* A828 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* A830 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* A838 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
- /* Phags-pa */
-
- /* A840 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* A848 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* A850 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* A858 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(Vo,x), _(Vo,x),
- /* A860 */ _(Vo,x), _(Vo,x), _(C,x), _(C,x), _(C,x), _(C,x), _(Vo,x), _(CS,x),
- /* A868 */ _(CS,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* A870 */ _(C,x), _(CS,x), _(C,x), _(Bi,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* A878 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
- /* Saurashtra */
-
- /* A880 */ _(Bi,x), _(Vs,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
- /* A888 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
- /* A890 */ _(VI,x), _(VI,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* A898 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* A8A0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* A8A8 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* A8B0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(CF,x), _(M,R), _(M,R), _(M,R),
- /* A8B8 */ _(M,R), _(M,R), _(M,R), _(M,R), _(M,R), _(M,R), _(M,R), _(M,R),
- /* A8C0 */ _(M,R), _(M,R), _(M,R), _(M,R), _(V,B), _(x,x), _(x,x), _(x,x),
- /* A8C8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* A8D0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* A8D8 */ _(Nd,x), _(Nd,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
+ /* 2010 */ _(CP,x), _(CP,x), _(CP,x), _(CP,x), _(CP,x), _(x,x), _(x,x), _(x,x),
+
+#define indic_offset_0x2070u 1672
+
+
+ /* Superscripts and Subscripts */
+
+ /* 2070 */ _(x,x), _(x,x), _(x,x), _(x,x), _(SM,x), _(x,x), _(x,x), _(x,x),
+ /* 2078 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
+ /* 2080 */ _(x,x), _(x,x), _(SM,x), _(SM,x), _(SM,x), _(x,x), _(x,x), _(x,x),
+
+#define indic_offset_0xa8e0u 1696
+
/* Devanagari Extended */
- /* A8E0 */ _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x),
- /* A8E8 */ _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x),
- /* A8F0 */ _(Ca,x), _(Ca,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* A8F8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
- /* Kayah Li */
-
- /* A900 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* A908 */ _(Nd,x), _(Nd,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* A910 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* A918 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* A920 */ _(C,x), _(C,x), _(Vo,x), _(Vo,x), _(Vo,x), _(Vo,x), _(Vo,x), _(Vo,x),
- /* A928 */ _(Vo,x), _(Vo,x), _(Vo,x), _(TM,x), _(TM,x), _(TM,x), _(x,x), _(x,x),
-
- /* Rejang */
-
- /* A930 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* A938 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* A940 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(M,B),
- /* A948 */ _(M,B), _(M,B), _(M,T), _(M,B), _(M,B), _(M,B), _(M,B), _(CF,x),
- /* A950 */ _(CF,x), _(CF,x), _(CF,x), _(PK,R), _(x,x), _(x,x), _(x,x), _(x,x),
- /* A958 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* A960 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* A968 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* A970 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* A978 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
- /* Javanese */
-
- /* A980 */ _(Bi,x), _(Bi,x),_(CSR,x), _(Vs,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
- /* A988 */ _(VI,x), _(C,x), _(C,x), _(C,x), _(VI,x), _(VI,x), _(VI,x), _(C,x),
- /* A990 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* A998 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* A9A0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* A9A8 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* A9B0 */ _(C,x), _(C,x), _(C,x), _(N,x), _(M,R), _(M,R), _(M,T), _(M,T),
- /* A9B8 */ _(M,B), _(M,B), _(M,L), _(M,L), _(M,T), _(CS,x), _(CM,x), _(CM,x),
- /* A9C0 */ _(V,BR), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* A9C8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* A9D0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* A9D8 */ _(Nd,x), _(Nd,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
+ /* A8E0 */ _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T),
+ /* A8E8 */ _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T),
+ /* A8F0 */ _(Ca,T), _(Ca,T), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
+
+#define indic_offset_0xa9e0u 1720
+
/* Myanmar Extended-B */
- /* A9E0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(x,x), _(x,x), _(C,x),
+ /* A9E0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(M,T), _(x,x), _(C,x),
/* A9E8 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* A9F0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
/* A9F8 */ _(Nd,x), _(Nd,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(x,x),
- /* Cham */
-
- /* AA00 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(C,x), _(C,x),
- /* AA08 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* AA10 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* AA18 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* AA20 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* AA28 */ _(C,x), _(M,T), _(M,T), _(M,T), _(M,T), _(M,B), _(M,T), _(M,L),
- /* AA30 */ _(M,L), _(M,T), _(M,B), _(CM,x), _(CM,L), _(CM,x), _(CM,x), _(x,x),
- /* AA38 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* AA40 */ _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x),
- /* AA48 */ _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(x,x), _(x,x),
- /* AA50 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* AA58 */ _(Nd,x), _(Nd,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
+#define indic_offset_0xaa60u 1752
+
/* Myanmar Extended-A */
/* AA60 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* AA68 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* AA70 */ _(x,x), _(C,x), _(C,x), _(C,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* AA78 */ _(x,x), _(x,x), _(C,x), _(TM,x), _(TM,x), _(TM,x), _(C,x), _(C,x),
-
- /* Tai Viet */
-
- /* AA80 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* AA88 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* AA90 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* AA98 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* AAA0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* AAA8 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* AAB0 */ _(M,T), _(M,R), _(M,T), _(M,T), _(M,B),_(M,VOL),_(M,VOL), _(M,T),
- /* AAB8 */ _(M,T),_(M,VOL), _(M,R),_(M,VOL),_(M,VOL), _(M,R), _(M,T), _(TM,x),
- /* AAC0 */ _(TL,x), _(TM,x), _(TL,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* AAC8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* AAD0 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* AAD8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
- /* Meetei Mayek Extensions */
-
- /* AAE0 */ _(VI,x), _(VI,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* AAE8 */ _(C,x), _(C,x), _(C,x), _(M,L), _(M,B), _(M,T), _(M,L), _(M,R),
- /* AAF0 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(Vs,x), _(IS,x), _(x,x),
-
-#define indic_offset_0xabc0u 3272
-
-
- /* Meetei Mayek */
-
- /* ABC0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* ABC8 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(VI,x), _(VI,x),
- /* ABD0 */ _(C,x), _(VI,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* ABD8 */ _(C,x), _(C,x), _(C,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x), _(CF,x),
- /* ABE0 */ _(CF,x), _(CF,x), _(CF,x), _(M,R), _(M,R), _(M,T), _(M,R), _(M,R),
- /* ABE8 */ _(M,B), _(M,R), _(M,R), _(x,x), _(TM,x), _(PK,B), _(x,x), _(x,x),
- /* ABF0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* ABF8 */ _(Nd,x), _(Nd,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
-#define indic_offset_0x10a00u 3336
-
-
- /* Kharoshthi */
-
- /* 10A00 */ _(C,x), _(M,O), _(M,B), _(M,B), _(x,x), _(M,T), _(M,O), _(x,x),
- /* 10A08 */ _(x,x), _(x,x), _(x,x), _(x,x), _(M,B), _(x,x), _(Bi,x), _(Vs,x),
- /* 10A10 */ _(C,x), _(C,x), _(C,x), _(C,x), _(x,x), _(C,x), _(C,x), _(C,x),
- /* 10A18 */ _(x,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 10A20 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 10A28 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 10A30 */ _(C,x), _(C,x), _(C,x), _(C,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 10A38 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(IS,x),
- /* 10A40 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
-
-#define indic_offset_0x11000u 3408
-
-
- /* Brahmi */
-
- /* 11000 */ _(Bi,x), _(Bi,x), _(Vs,x), _(x,x), _(x,x), _(VI,x), _(VI,x), _(VI,x),
- /* 11008 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
- /* 11010 */ _(VI,x), _(VI,x), _(VI,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11018 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11020 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11028 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11030 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11038 */ _(M,T), _(M,T), _(M,T), _(M,T), _(M,B), _(M,B), _(M,B), _(M,B),
- /* 11040 */ _(M,B), _(M,B), _(M,T), _(M,T), _(M,T), _(M,T), _(V,T), _(x,x),
- /* 11048 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 11050 */ _(x,x), _(x,x),_(BJN,x),_(BJN,x),_(BJN,x),_(BJN,x),_(BJN,x),_(BJN,x),
- /* 11058 */_(BJN,x),_(BJN,x),_(BJN,x),_(BJN,x),_(BJN,x),_(BJN,x),_(BJN,x),_(BJN,x),
- /* 11060 */_(BJN,x),_(BJN,x),_(BJN,x),_(BJN,x),_(BJN,x),_(BJN,x), _(Nd,x), _(Nd,x),
- /* 11068 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* 11070 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 11078 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(NJ,x),
-
- /* Kaithi */
-
- /* 11080 */ _(Bi,x), _(Bi,x), _(Vs,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
- /* 11088 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(C,x), _(C,x), _(C,x),
- /* 11090 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11098 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 110A0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 110A8 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 110B0 */ _(M,R), _(M,L), _(M,R), _(M,B), _(M,B), _(M,T), _(M,T), _(M,R),
- /* 110B8 */ _(M,R), _(V,B), _(N,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
-#define indic_offset_0x11100u 3600
-
-
- /* Chakma */
-
- /* 11100 */ _(Bi,x), _(Bi,x), _(Vs,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(C,x),
- /* 11108 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11110 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11118 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11120 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(M,T),
- /* 11128 */ _(M,T), _(M,T), _(M,B), _(M,B), _(M,L), _(M,T), _(M,TB), _(M,TB),
- /* 11130 */ _(M,T), _(M,B), _(M,B), _(IS,x), _(PK,T), _(x,x), _(Nd,x), _(Nd,x),
- /* 11138 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* 11140 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 11148 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
- /* Mahajani */
-
- /* 11150 */ _(Vo,x), _(Vo,x), _(Vo,x), _(Vo,x), _(Vo,x), _(C,x), _(C,x), _(C,x),
- /* 11158 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11160 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11168 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11170 */ _(C,x), _(C,x), _(C,x), _(N,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 11178 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
- /* Sharada */
-
- /* 11180 */ _(Bi,x), _(Bi,x), _(Vs,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
- /* 11188 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
- /* 11190 */ _(VI,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11198 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 111A0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 111A8 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 111B0 */ _(C,x), _(C,x), _(C,x), _(M,R), _(M,L), _(M,R), _(M,B), _(M,B),
- /* 111B8 */ _(M,B), _(M,B), _(M,B), _(M,B), _(M,T), _(M,T), _(M,T), _(M,TR),
- /* 111C0 */ _(V,R), _(A,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 111C8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 111D0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* 111D8 */ _(Nd,x), _(Nd,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
- /* Sinhala Archaic Numbers */
-
- /* 111E0 */ _(x,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* 111E8 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* 111F0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(x,x), _(x,x), _(x,x),
- /* 111F8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
- /* Khojki */
-
- /* 11200 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
- /* 11208 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11210 */ _(C,x), _(C,x), _(x,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11218 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11220 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11228 */ _(C,x), _(C,x), _(C,x), _(C,x), _(M,R), _(M,R), _(M,R), _(M,B),
- /* 11230 */ _(M,T), _(M,T), _(M,TR), _(M,TR), _(Bi,x), _(V,R), _(N,x), _(GM,T),
-
-#define indic_offset_0x112b0u 3912
-
-
- /* Khudawadi */
-
- /* 112B0 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
- /* 112B8 */ _(VI,x), _(VI,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 112C0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 112C8 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 112D0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 112D8 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(Bi,x),
- /* 112E0 */ _(M,R), _(M,L), _(M,R), _(M,B), _(M,B), _(M,T), _(M,T), _(M,T),
- /* 112E8 */ _(M,T), _(N,x), _(PK,B), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 112F0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* 112F8 */ _(Nd,x), _(Nd,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
- /* Grantha */
-
- /* 11300 */ _(x,x), _(Bi,x), _(Bi,x), _(Vs,x), _(x,x), _(VI,x), _(VI,x), _(VI,x),
- /* 11308 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(x,x), _(x,x), _(VI,x),
- /* 11310 */ _(VI,x), _(x,x), _(x,x), _(VI,x), _(VI,x), _(C,x), _(C,x), _(C,x),
- /* 11318 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11320 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11328 */ _(C,x), _(x,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11330 */ _(C,x), _(x,x), _(C,x), _(C,x), _(x,x), _(C,x), _(C,x), _(C,x),
- /* 11338 */ _(C,x), _(C,x), _(x,x), _(x,x), _(N,x), _(A,x), _(M,R), _(M,R),
- /* 11340 */ _(M,T), _(M,R), _(M,R), _(M,R), _(M,R), _(x,x), _(x,x), _(M,L),
- /* 11348 */ _(M,L), _(x,x), _(x,x), _(M,LR), _(M,LR), _(V,R), _(x,x), _(x,x),
- /* 11350 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(M,R),
- /* 11358 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 11360 */ _(VI,x), _(VI,x), _(M,R), _(M,R), _(x,x), _(x,x), _(Ca,x), _(Ca,x),
- /* 11368 */ _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(x,x), _(x,x), _(x,x),
- /* 11370 */ _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(x,x), _(x,x), _(x,x),
-
-#define indic_offset_0x11480u 4112
-
-
- /* Tirhuta */
-
- /* 11480 */ _(x,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
- /* 11488 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(C,x),
- /* 11490 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11498 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 114A0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 114A8 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 114B0 */ _(M,R), _(M,L), _(M,R), _(M,B), _(M,B), _(M,B), _(M,B), _(M,B),
- /* 114B8 */ _(M,B), _(M,L), _(M,T), _(M,TL), _(M,LR), _(M,R), _(M,LR), _(Bi,x),
- /* 114C0 */ _(Bi,x), _(Vs,x), _(V,B), _(N,x), _(A,x), _(x,x), _(x,x), _(x,x),
- /* 114C8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 114D0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* 114D8 */ _(Nd,x), _(Nd,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
-#define indic_offset_0x11580u 4208
-
-
- /* Siddham */
-
- /* 11580 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
- /* 11588 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(C,x), _(C,x),
- /* 11590 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11598 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 115A0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 115A8 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(M,R),
- /* 115B0 */ _(M,L), _(M,R), _(M,B), _(M,B), _(M,B), _(M,B), _(x,x), _(x,x),
- /* 115B8 */ _(M,L), _(M,TL), _(M,LR),_(M,TLR), _(Bi,x), _(Bi,x), _(Vs,x), _(V,B),
- /* 115C0 */ _(N,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
-#define indic_offset_0x11600u 4280
-
-
- /* Modi */
-
- /* 11600 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
- /* 11608 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(C,x), _(C,x),
- /* 11610 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11618 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11620 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11628 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11630 */ _(M,R), _(M,R), _(M,R), _(M,B), _(M,B), _(M,B), _(M,B), _(M,B),
- /* 11638 */ _(M,B), _(M,T), _(M,T), _(M,R), _(M,R), _(Bi,x), _(Vs,x), _(V,B),
- /* 11640 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 11648 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 11650 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* 11658 */ _(Nd,x), _(Nd,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 11660 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 11668 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 11670 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 11678 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
- /* Takri */
-
- /* 11680 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x),
- /* 11688 */ _(VI,x), _(VI,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11690 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 11698 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 116A0 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 116A8 */ _(C,x), _(C,x), _(C,x), _(Bi,x), _(Vs,x), _(M,T), _(M,L), _(M,R),
- /* 116B0 */ _(M,B), _(M,B), _(M,T), _(M,T), _(M,T), _(M,T), _(V,T), _(N,x),
- /* 116B8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 116C0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
- /* 116C8 */ _(Nd,x), _(Nd,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
-
-}; /* Table items: 4488; occupancy: 73% */
+ /* AA70 */ _(x,x), _(C,x), _(C,x), _(C,x), _(CP,x), _(CP,x), _(CP,x), _(x,x),
+ /* AA78 */ _(x,x), _(x,x), _(C,x), _(TM,R), _(TM,T), _(TM,R), _(C,x), _(C,x),
+
+}; /* Table items: 1784; occupancy: 69% */
INDIC_TABLE_ELEMENT_TYPE
hb_indic_get_categories (hb_codepoint_t u)
@@ -862,40 +399,27 @@ hb_indic_get_categories (hb_codepoint_t u)
{
case 0x0u:
if (hb_in_range (u, 0x0028u, 0x003Fu)) return indic_table[u - 0x0028u + indic_offset_0x0028u];
- if (hb_in_range (u, 0x00D0u, 0x00D7u)) return indic_table[u - 0x00D0u + indic_offset_0x00d0u];
+ if (hb_in_range (u, 0x00B0u, 0x00D7u)) return indic_table[u - 0x00B0u + indic_offset_0x00b0u];
if (hb_in_range (u, 0x0900u, 0x0DF7u)) return indic_table[u - 0x0900u + indic_offset_0x0900u];
if (unlikely (u == 0x00A0u)) return _(CP,x);
break;
case 0x1u:
if (hb_in_range (u, 0x1000u, 0x109Fu)) return indic_table[u - 0x1000u + indic_offset_0x1000u];
- if (hb_in_range (u, 0x1700u, 0x17EFu)) return indic_table[u - 0x1700u + indic_offset_0x1700u];
- if (hb_in_range (u, 0x1900u, 0x1A9Fu)) return indic_table[u - 0x1900u + indic_offset_0x1900u];
- if (hb_in_range (u, 0x1B00u, 0x1C4Fu)) return indic_table[u - 0x1B00u + indic_offset_0x1b00u];
- if (hb_in_range (u, 0x1CD0u, 0x1CF7u)) return indic_table[u - 0x1CD0u + indic_offset_0x1cd0u];
+ if (hb_in_range (u, 0x1780u, 0x17EFu)) return indic_table[u - 0x1780u + indic_offset_0x1780u];
+ if (hb_in_range (u, 0x1CD0u, 0x1CFFu)) return indic_table[u - 0x1CD0u + indic_offset_0x1cd0u];
break;
case 0x2u:
if (hb_in_range (u, 0x2008u, 0x2017u)) return indic_table[u - 0x2008u + indic_offset_0x2008u];
+ if (hb_in_range (u, 0x2070u, 0x2087u)) return indic_table[u - 0x2070u + indic_offset_0x2070u];
if (unlikely (u == 0x25CCu)) return _(CP,x);
break;
case 0xAu:
- if (hb_in_range (u, 0xA800u, 0xAAF7u)) return indic_table[u - 0xA800u + indic_offset_0xa800u];
- if (hb_in_range (u, 0xABC0u, 0xABFFu)) return indic_table[u - 0xABC0u + indic_offset_0xabc0u];
- break;
-
- case 0x10u:
- if (hb_in_range (u, 0x10A00u, 0x10A47u)) return indic_table[u - 0x10A00u + indic_offset_0x10a00u];
- break;
-
- case 0x11u:
- if (hb_in_range (u, 0x11000u, 0x110BFu)) return indic_table[u - 0x11000u + indic_offset_0x11000u];
- if (hb_in_range (u, 0x11100u, 0x11237u)) return indic_table[u - 0x11100u + indic_offset_0x11100u];
- if (hb_in_range (u, 0x112B0u, 0x11377u)) return indic_table[u - 0x112B0u + indic_offset_0x112b0u];
- if (hb_in_range (u, 0x11480u, 0x114DFu)) return indic_table[u - 0x11480u + indic_offset_0x11480u];
- if (hb_in_range (u, 0x11580u, 0x115C7u)) return indic_table[u - 0x11580u + indic_offset_0x11580u];
- if (hb_in_range (u, 0x11600u, 0x116CFu)) return indic_table[u - 0x11600u + indic_offset_0x11600u];
+ if (hb_in_range (u, 0xA8E0u, 0xA8F7u)) return indic_table[u - 0xA8E0u + indic_offset_0xa8e0u];
+ if (hb_in_range (u, 0xA9E0u, 0xA9FFu)) return indic_table[u - 0xA9E0u + indic_offset_0xa9e0u];
+ if (hb_in_range (u, 0xAA60u, 0xAA7Fu)) return indic_table[u - 0xAA60u + indic_offset_0xaa60u];
break;
default:
@@ -914,11 +438,14 @@ hb_indic_get_categories (hb_codepoint_t u)
#undef ISC_CD
#undef ISC_CF
#undef ISC_CHL
+#undef ISC_CK
#undef ISC_CM
#undef ISC_CP
#undef ISC_CPR
+#undef ISC_CPrf
#undef ISC_CS
#undef ISC_CSR
+#undef ISC_CWS
#undef ISC_GM
#undef ISC_IS
#undef ISC_ZWJ
@@ -930,6 +457,7 @@ hb_indic_get_categories (hb_codepoint_t u)
#undef ISC_x
#undef ISC_PK
#undef ISC_RS
+#undef ISC_SM
#undef ISC_TL
#undef ISC_TM
#undef ISC_V
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic.cc
index 44481dbb4c..b48fb561c3 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic.cc
@@ -176,24 +176,8 @@ set_indic_properties (hb_glyph_info_t &info)
* Re-assign category
*/
-
- /* The spec says U+0952 is OT_A. However, testing shows that Uniscribe
- * treats a whole bunch of characters similarly.
- * TESTS: For example, for U+0951:
- * U+092E,U+0947,U+0952
- * U+092E,U+0952,U+0947
- * U+092E,U+0947,U+0951
- * U+092E,U+0951,U+0947
- * U+092E,U+0951,U+0952
- * U+092E,U+0952,U+0951
- */
- if (unlikely (hb_in_ranges (u, 0x0951u, 0x0952u,
- 0x1CD0u, 0x1CD2u,
- 0x1CD4u, 0x1CE1u) ||
- u == 0x1CF4u))
- cat = OT_A;
/* The following act more like the Bindus. */
- else if (unlikely (hb_in_range (u, 0x0953u, 0x0954u)))
+ if (unlikely (hb_in_range (u, 0x0953u, 0x0954u)))
cat = OT_SM;
/* The following act like consonants. */
else if (unlikely (hb_in_ranges (u, 0x0A72u, 0x0A73u,
@@ -216,21 +200,10 @@ set_indic_properties (hb_glyph_info_t &info)
cat = OT_Symbol;
ASSERT_STATIC ((int) INDIC_SYLLABIC_CATEGORY_AVAGRAHA == OT_Symbol);
}
- else if (unlikely (hb_in_range (u, 0x17CDu, 0x17D1u) ||
- u == 0x17CBu || u == 0x17D3u || u == 0x17DDu)) /* Khmer Various signs */
- {
- /* These are like Top Matras. */
- cat = OT_M;
- pos = POS_ABOVE_C;
- }
else if (unlikely (u == 0x17C6u)) cat = OT_N; /* Khmer Bindu doesn't like to be repositioned. */
- else if (unlikely (u == 0x17D2u)) cat = OT_Coeng; /* Khmer coeng */
else if (unlikely (hb_in_range (u, 0x2010u, 0x2011u)))
cat = OT_PLACEHOLDER;
else if (unlikely (u == 0x25CCu)) cat = OT_DOTTEDCIRCLE;
- else if (unlikely (u == 0xA982u)) cat = OT_SM; /* Javanese repha. */
- else if (unlikely (u == 0xA9BEu)) cat = OT_CM2; /* Javanese medial ya. */
- else if (unlikely (u == 0xA9BDu)) { cat = OT_M; pos = POS_POST_C; } /* Javanese vocalic r. */
/*
@@ -296,11 +269,6 @@ enum blwf_mode_t {
BLWF_MODE_PRE_AND_POST, /* Below-forms feature applied to pre-base and post-base. */
BLWF_MODE_POST_ONLY /* Below-forms feature applied to post-base only. */
};
-enum pref_len_t {
- PREF_LEN_1 = 1,
- PREF_LEN_2 = 2,
- PREF_LEN_DONT_CARE = PREF_LEN_2
-};
struct indic_config_t
{
hb_script_t script;
@@ -310,26 +278,24 @@ struct indic_config_t
reph_position_t reph_pos;
reph_mode_t reph_mode;
blwf_mode_t blwf_mode;
- pref_len_t pref_len;
};
static const indic_config_t indic_configs[] =
{
/* Default. Should be first. */
- {HB_SCRIPT_INVALID, false, 0,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_1},
- {HB_SCRIPT_DEVANAGARI,true, 0x094Du,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
- {HB_SCRIPT_BENGALI, true, 0x09CDu,BASE_POS_LAST, REPH_POS_AFTER_SUB, REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
- {HB_SCRIPT_GURMUKHI, true, 0x0A4Du,BASE_POS_LAST, REPH_POS_BEFORE_SUB, REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
- {HB_SCRIPT_GUJARATI, true, 0x0ACDu,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
- {HB_SCRIPT_ORIYA, true, 0x0B4Du,BASE_POS_LAST, REPH_POS_AFTER_MAIN, REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
- {HB_SCRIPT_TAMIL, true, 0x0BCDu,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_2},
- {HB_SCRIPT_TELUGU, true, 0x0C4Du,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_MODE_EXPLICIT, BLWF_MODE_POST_ONLY, PREF_LEN_2},
- {HB_SCRIPT_KANNADA, true, 0x0CCDu,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_MODE_IMPLICIT, BLWF_MODE_POST_ONLY, PREF_LEN_2},
- {HB_SCRIPT_MALAYALAM, true, 0x0D4Du,BASE_POS_LAST, REPH_POS_AFTER_MAIN, REPH_MODE_LOG_REPHA,BLWF_MODE_PRE_AND_POST, PREF_LEN_2},
+ {HB_SCRIPT_INVALID, false, 0,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST},
+ {HB_SCRIPT_DEVANAGARI,true, 0x094Du,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST},
+ {HB_SCRIPT_BENGALI, true, 0x09CDu,BASE_POS_LAST, REPH_POS_AFTER_SUB, REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST},
+ {HB_SCRIPT_GURMUKHI, true, 0x0A4Du,BASE_POS_LAST, REPH_POS_BEFORE_SUB, REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST},
+ {HB_SCRIPT_GUJARATI, true, 0x0ACDu,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST},
+ {HB_SCRIPT_ORIYA, true, 0x0B4Du,BASE_POS_LAST, REPH_POS_AFTER_MAIN, REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST},
+ {HB_SCRIPT_TAMIL, true, 0x0BCDu,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST},
+ {HB_SCRIPT_TELUGU, true, 0x0C4Du,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_MODE_EXPLICIT, BLWF_MODE_POST_ONLY},
+ {HB_SCRIPT_KANNADA, true, 0x0CCDu,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_MODE_IMPLICIT, BLWF_MODE_POST_ONLY},
+ {HB_SCRIPT_MALAYALAM, true, 0x0D4Du,BASE_POS_LAST, REPH_POS_AFTER_MAIN, REPH_MODE_LOG_REPHA,BLWF_MODE_PRE_AND_POST},
{HB_SCRIPT_SINHALA, false,0x0DCAu,BASE_POS_LAST_SINHALA,
- REPH_POS_AFTER_MAIN, REPH_MODE_EXPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
- {HB_SCRIPT_KHMER, false,0x17D2u,BASE_POS_FIRST,REPH_POS_DONT_CARE, REPH_MODE_VIS_REPHA,BLWF_MODE_PRE_AND_POST, PREF_LEN_2},
- {HB_SCRIPT_JAVANESE, false,0xA9C0u,BASE_POS_FIRST,REPH_POS_DONT_CARE, REPH_MODE_VIS_REPHA,BLWF_MODE_PRE_AND_POST, PREF_LEN_1},
+ REPH_POS_AFTER_MAIN, REPH_MODE_EXPLICIT, BLWF_MODE_PRE_AND_POST},
+ {HB_SCRIPT_KHMER, false,0x17D2u,BASE_POS_FIRST,REPH_POS_DONT_CARE, REPH_MODE_VIS_REPHA,BLWF_MODE_PRE_AND_POST},
};
@@ -512,12 +478,12 @@ struct indic_shape_plan_t
hb_codepoint_t glyph = virama_glyph;
if (unlikely (virama_glyph == (hb_codepoint_t) -1))
{
- if (!config->virama || !font->get_glyph (config->virama, 0, &glyph))
+ if (!config->virama || !font->get_nominal_glyph (config->virama, &glyph))
glyph = 0;
/* Technically speaking, the spec says we should apply 'locl' to virama too.
* Maybe one day... */
- /* Our get_glyph() function needs a font, so we can't get the virama glyph
+ /* Our get_nominal_glyph() function needs a font, so we can't get the virama glyph
* during shape planning... Instead, overwrite it here. It's safe. Don't worry! */
(const_cast<indic_shape_plan_t *> (this))->virama_glyph = glyph;
}
@@ -557,8 +523,15 @@ data_create_indic (const hb_ot_shape_plan_t *plan)
indic_plan->virama_glyph = (hb_codepoint_t) -1;
/* Use zero-context would_substitute() matching for new-spec of the main
- * Indic scripts, and scripts with one spec only, but not for old-specs. */
- bool zero_context = !indic_plan->is_old_spec;
+ * Indic scripts, and scripts with one spec only, but not for old-specs.
+ * The new-spec for all dual-spec scripts says zero-context matching happens.
+ *
+ * However, testing with Malayalam shows that old and new spec both allow
+ * context. Testing with Bengali new-spec however shows that it doesn't.
+ * So, the heuristic here is the way it is. It should *only* be changed,
+ * as we discover more cases of what Windows does. DON'T TOUCH OTHERWISE.
+ */
+ bool zero_context = !indic_plan->is_old_spec && plan->props.script != HB_SCRIPT_MALAYALAM;
indic_plan->rphf.init (&plan->map, HB_TAG('r','p','h','f'), zero_context);
indic_plan->pref.init (&plan->map, HB_TAG('p','r','e','f'), zero_context);
indic_plan->blwf.init (&plan->map, HB_TAG('b','l','w','f'), zero_context);
@@ -600,12 +573,8 @@ consonant_position_from_face (const indic_shape_plan_t *indic_plan,
if (indic_plan->pstf.would_substitute (glyphs , 2, face) ||
indic_plan->pstf.would_substitute (glyphs+1, 2, face))
return POS_POST_C;
- unsigned int pref_len = indic_plan->config->pref_len;
- if ((pref_len == PREF_LEN_2 &&
- (indic_plan->pref.would_substitute (glyphs , 2, face) ||
- indic_plan->pref.would_substitute (glyphs+1, 2, face)))
- || (pref_len == PREF_LEN_1 &&
- indic_plan->pref.would_substitute (glyphs+1, 1, face)))
+ if (indic_plan->pref.would_substitute (glyphs , 2, face) ||
+ indic_plan->pref.would_substitute (glyphs+1, 2, face))
return POS_POST_C;
return POS_BASE_C;
}
@@ -754,10 +723,6 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
switch (indic_plan->config->base_pos)
{
- default:
- assert (false);
- HB_FALLTHROUGH;
-
case BASE_POS_LAST:
{
/* -> starting from the end of the syllable, move backwards */
@@ -1115,10 +1080,9 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
}
}
- unsigned int pref_len = indic_plan->config->pref_len;
+ unsigned int pref_len = 2;
if (indic_plan->mask_array[PREF] && base + pref_len < end)
{
- assert (1 <= pref_len && pref_len <= 2);
/* Find a Halant,Ra sequence and mark it for pre-base reordering processing. */
for (unsigned int i = base + 1; i + pref_len - 1 < end; i++) {
hb_codepoint_t glyphs[2];
@@ -1231,7 +1195,7 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED,
hb_codepoint_t dottedcircle_glyph;
- if (!font->get_glyph (0x25CCu, 0, &dottedcircle_glyph))
+ if (!font->get_nominal_glyph (0x25CCu, &dottedcircle_glyph))
return;
hb_glyph_info_t dottedcircle = {0};
@@ -1243,7 +1207,7 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED,
buffer->idx = 0;
unsigned int last_syllable = 0;
- while (buffer->idx < buffer->len)
+ while (buffer->idx < buffer->len && !buffer->in_error)
{
unsigned int syllable = buffer->cur().syllable();
syllable_type_t syllable_type = (syllable_type_t) (syllable & 0x0F);
@@ -1258,7 +1222,7 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED,
/* TODO Set glyph_props? */
/* Insert dottedcircle after possible Repha. */
- while (buffer->idx < buffer->len &&
+ while (buffer->idx < buffer->len && !buffer->in_error &&
last_syllable == buffer->cur().syllable() &&
buffer->cur().indic_category() == OT_Repha)
buffer->next_glyph ();
@@ -1328,7 +1292,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
for (base = start; base < end; base++)
if (info[base].indic_position() >= POS_BASE_C)
{
- if (try_pref && base + 1 < end && indic_plan->config->pref_len == 2)
+ if (try_pref && base + 1 < end)
{
for (unsigned int i = base + 1; i < end; i++)
if ((info[i].mask & indic_plan->mask_array[PREF]) != 0)
@@ -1348,6 +1312,25 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
break;
}
}
+ /* For Malayalam, skip over unformed below- (but NOT post-) forms. */
+ if (buffer->props.script == HB_SCRIPT_MALAYALAM)
+ {
+ for (unsigned int i = base + 1; i < end; i++)
+ {
+ while (i < end && is_joiner (info[i]))
+ i++;
+ if (i == end || !is_halant_or_coeng (info[i]))
+ break;
+ i++; /* Skip halant. */
+ while (i < end && is_joiner (info[i]))
+ i++;
+ if (i < end && is_consonant (info[i]) && info[i].indic_position() == POS_BELOW_C)
+ {
+ base = i;
+ info[base].indic_position() = POS_BASE_C;
+ }
+ }
+ }
if (start < base && info[base].indic_position() > POS_BASE_C)
base--;
@@ -1591,7 +1574,6 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
if (try_pref && base + 1 < end) /* Otherwise there can't be any pre-base reordering Ra. */
{
- unsigned int pref_len = indic_plan->config->pref_len;
for (unsigned int i = base + 1; i < end; i++)
if ((info[i].mask & indic_plan->mask_array[PREF]) != 0)
{
@@ -1602,10 +1584,8 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
/* Note: We just check that something got substituted. We don't check that
* the <pref> feature actually did it...
*
- * If pref len is longer than one, then only reorder if it ligated. If
- * pref len is one, only reorder if it didn't ligate with other things. */
- if (_hb_glyph_info_substituted (&info[i]) &&
- ((pref_len == 1) ^ _hb_glyph_info_ligated_and_didnt_multiply (&info[i])))
+ * Reorder pref only if it ligated. */
+ if (_hb_glyph_info_ligated_and_didnt_multiply (&info[i]))
{
/*
* 2. Try to find a target position the same way as for pre-base matra.
@@ -1733,33 +1713,28 @@ decompose_indic (const hb_ot_shape_normalize_context_t *c,
switch (ab)
{
/* Don't decompose these. */
- case 0x0931u : return false;
- case 0x0B94u : return false;
+ case 0x0931u : return false; /* DEVANAGARI LETTER RRA */
+ case 0x0B94u : return false; /* TAMIL LETTER AU */
/*
* Decompose split matras that don't have Unicode decompositions.
*/
- case 0x0F77u : *a = 0x0FB2u; *b= 0x0F81u; return true;
- case 0x0F79u : *a = 0x0FB3u; *b= 0x0F81u; return true;
+ /* Khmer */
case 0x17BEu : *a = 0x17C1u; *b= 0x17BEu; return true;
case 0x17BFu : *a = 0x17C1u; *b= 0x17BFu; return true;
case 0x17C0u : *a = 0x17C1u; *b= 0x17C0u; return true;
case 0x17C4u : *a = 0x17C1u; *b= 0x17C4u; return true;
case 0x17C5u : *a = 0x17C1u; *b= 0x17C5u; return true;
- case 0x1925u : *a = 0x1920u; *b= 0x1923u; return true;
- case 0x1926u : *a = 0x1920u; *b= 0x1924u; return true;
- case 0x1B3Cu : *a = 0x1B42u; *b= 0x1B3Cu; return true;
- case 0x1112Eu : *a = 0x11127u; *b= 0x11131u; return true;
- case 0x1112Fu : *a = 0x11127u; *b= 0x11132u; return true;
+
#if 0
+ /* Gujarati */
/* This one has no decomposition in Unicode, but needs no decomposition either. */
/* case 0x0AC9u : return false; */
+
+ /* Oriya */
case 0x0B57u : *a = no decomp, -> RIGHT; return true;
- case 0x1C29u : *a = no decomp, -> LEFT; return true;
- case 0xA9C0u : *a = no decomp, -> RIGHT; return true;
- case 0x111BuF : *a = no decomp, -> ABOVE; return true;
#endif
}
@@ -1796,7 +1771,7 @@ decompose_indic (const hb_ot_shape_normalize_context_t *c,
hb_codepoint_t glyph;
if (hb_options ().uniscribe_bug_compatible ||
- (c->font->get_glyph (ab, 0, &glyph) &&
+ (c->font->get_nominal_glyph (ab, &glyph) &&
indic_plan->pstf.would_substitute (&glyph, 1, c->font->face)))
{
/* Ok, safe to use Uniscribe-style decomposition. */
@@ -1806,7 +1781,7 @@ decompose_indic (const hb_ot_shape_normalize_context_t *c,
}
}
- return c->unicode->decompose (ab, a, b);
+ return (bool) c->unicode->decompose (ab, a, b);
}
static bool
@@ -1822,7 +1797,7 @@ compose_indic (const hb_ot_shape_normalize_context_t *c,
/* Composition-exclusion exceptions that we want to recompose. */
if (a == 0x09AFu && b == 0x09BCu) { *ab = 0x09DFu; return true; }
- return c->unicode->compose (a, b, ab);
+ return (bool) c->unicode->compose (a, b, ab);
}
@@ -1834,10 +1809,12 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_indic =
data_create_indic,
data_destroy_indic,
NULL, /* preprocess_text */
+ NULL, /* postprocess_glyphs */
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT,
decompose_indic,
compose_indic,
setup_masks_indic,
+ NULL, /* disable_otl */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
false, /* fallback_position */
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-myanmar.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-myanmar.cc
index 7f74f2df82..bb68622e2a 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-myanmar.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-myanmar.cc
@@ -199,6 +199,10 @@ set_myanmar_properties (hb_glyph_info_t &info)
cat = (indic_category_t) OT_A;
break;
+ case 0x1039u:
+ cat = (indic_category_t) OT_H;
+ break;
+
case 0x103Au:
cat = (indic_category_t) OT_As;
break;
@@ -245,6 +249,11 @@ set_myanmar_properties (hb_glyph_info_t &info)
case 0x104Au: case 0x104Bu:
cat = (indic_category_t) OT_P;
break;
+
+ case 0xAA74u: case 0xAA75u: case 0xAA76u:
+ /* https://github.com/roozbehp/unicode-data/issues/3 */
+ cat = (indic_category_t) OT_C;
+ break;
}
if (cat == OT_M)
@@ -435,7 +444,7 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED,
hb_codepoint_t dottedcircle_glyph;
- if (!font->get_glyph (0x25CCu, 0, &dottedcircle_glyph))
+ if (!font->get_nominal_glyph (0x25CCu, &dottedcircle_glyph))
return;
hb_glyph_info_t dottedcircle = {0};
@@ -447,7 +456,7 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED,
buffer->idx = 0;
unsigned int last_syllable = 0;
- while (buffer->idx < buffer->len)
+ while (buffer->idx < buffer->len && !buffer->in_error)
{
unsigned int syllable = buffer->cur().syllable();
syllable_type_t syllable_type = (syllable_type_t) (syllable & 0x0F);
@@ -507,10 +516,12 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar_old =
NULL, /* data_create */
NULL, /* data_destroy */
NULL, /* preprocess_text */
+ NULL, /* postprocess_glyphs */
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
NULL, /* decompose */
NULL, /* compose */
NULL, /* setup_masks */
+ NULL, /* disable_otl */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
true, /* fallback_position */
};
@@ -523,10 +534,12 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar =
NULL, /* data_create */
NULL, /* data_destroy */
NULL, /* preprocess_text */
+ NULL, /* postprocess_glyphs */
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT,
NULL, /* decompose */
NULL, /* compose */
setup_masks_myanmar,
+ NULL, /* disable_otl */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
false, /* fallback_position */
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-private.hh
index 8d03dee51f..39572dfe00 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-private.hh
@@ -41,12 +41,8 @@
enum hb_ot_shape_zero_width_marks_type_t {
HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
-// HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_EARLY,
- HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE,
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
- HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
-
- HB_OT_SHAPE_ZERO_WIDTH_MARKS_DEFAULT = HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE
+ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE
};
@@ -110,6 +106,15 @@ struct hb_ot_complex_shaper_t
hb_buffer_t *buffer,
hb_font_t *font);
+ /* postprocess_glyphs()
+ * Called during shape().
+ * Shapers can use to modify glyphs after shaping ends.
+ * May be NULL.
+ */
+ void (*postprocess_glyphs) (const hb_ot_shape_plan_t *plan,
+ hb_buffer_t *buffer,
+ hb_font_t *font);
+
hb_ot_shape_normalization_mode_t normalization_preference;
@@ -141,6 +146,14 @@ struct hb_ot_complex_shaper_t
hb_buffer_t *buffer,
hb_font_t *font);
+ /* disable_otl()
+ * Called during shape().
+ * If set and returns true, GDEF/GSUB/GPOS of the font are ignored
+ * and fallback operations used.
+ * May be NULL.
+ */
+ bool (*disable_otl) (const hb_ot_shape_plan_t *plan);
+
hb_ot_shape_zero_width_marks_type_t zero_width_marks;
bool fallback_position;
@@ -236,9 +249,6 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner)
/* Unicode-3.0 additions */
case HB_SCRIPT_SINHALA:
- /* Unicode-5.2 additions */
- case HB_SCRIPT_JAVANESE:
-
/* If the designer designed the font for the 'DFLT' script,
* use the default shaper. Otherwise, use the specific shaper.
* Note that for some simple scripts, there may not be *any*
@@ -311,7 +321,7 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner)
/* Unicode-5.2 additions */
case HB_SCRIPT_EGYPTIAN_HIEROGLYPHS:
- //case HB_SCRIPT_JAVANESE:
+ case HB_SCRIPT_JAVANESE:
case HB_SCRIPT_KAITHI:
case HB_SCRIPT_MEETEI_MAYEK:
case HB_SCRIPT_TAI_THAM:
@@ -340,6 +350,15 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner)
case HB_SCRIPT_SIDDHAM:
case HB_SCRIPT_TIRHUTA:
+ /* Unicode-8.0 additions */
+ case HB_SCRIPT_AHOM:
+ //case HB_SCRIPT_MULTANI:
+
+ /* Unicode-9.0 additions */
+ case HB_SCRIPT_BHAIKSUKI:
+ case HB_SCRIPT_MARCHEN:
+ case HB_SCRIPT_NEWA:
+
/* If the designer designed the font for the 'DFLT' script,
* use the default shaper. Otherwise, use the specific shaper.
* Note that for some simple scripts, there may not be *any*
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-thai.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-thai.cc
index 8a8f2f7991..e6f80f59e7 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-thai.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-thai.cc
@@ -139,7 +139,6 @@ thai_pua_shape (hb_codepoint_t u, thai_action_t action, hb_font_t *font)
};
switch (action) {
- default: assert (false); HB_FALLTHROUGH;
case NOP: return u;
case SD: pua_mappings = SD_mappings; break;
case SDL: pua_mappings = SDL_mappings; break;
@@ -315,7 +314,7 @@ preprocess_text_thai (const hb_ot_shape_plan_t *plan,
buffer->clear_output ();
unsigned int count = buffer->len;
- for (buffer->idx = 0; buffer->idx < count;)
+ for (buffer->idx = 0; buffer->idx < count && !buffer->in_error;)
{
hb_codepoint_t u = buffer->cur().codepoint;
if (likely (!IS_SARA_AM (u))) {
@@ -330,7 +329,7 @@ preprocess_text_thai (const hb_ot_shape_plan_t *plan,
if (unlikely (buffer->in_error))
return;
- /* Make Nikhahit be recognized as a mark when zeroing widths. */
+ /* Make Nikhahit be recognized as a ccc=0 mark when zeroing widths. */
unsigned int end = buffer->out_len;
_hb_glyph_info_set_general_category (&buffer->out_info[end - 2], HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK);
@@ -372,10 +371,12 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_thai =
NULL, /* data_create */
NULL, /* data_destroy */
preprocess_text_thai,
+ NULL, /* postprocess_glyphs */
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
NULL, /* decompose */
NULL, /* compose */
NULL, /* setup_masks */
- HB_OT_SHAPE_ZERO_WIDTH_MARKS_DEFAULT,
+ NULL, /* disable_otl */
+ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
false,/* fallback_position */
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-tibetan.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-tibetan.cc
index 01465a426f..aadf59f5ad 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-tibetan.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-tibetan.cc
@@ -52,10 +52,12 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_tibetan =
NULL, /* data_create */
NULL, /* data_destroy */
NULL, /* preprocess_text */
+ NULL, /* postprocess_glyphs */
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
NULL, /* decompose */
NULL, /* compose */
NULL, /* setup_masks */
- HB_OT_SHAPE_ZERO_WIDTH_MARKS_DEFAULT,
+ NULL, /* disable_otl */
+ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
true, /* fallback_position */
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-machine.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-machine.hh
index ced9d97f28..44e5d0d56b 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-machine.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-machine.hh
@@ -36,291 +36,222 @@
#line 38 "hb-ot-shape-complex-use-machine.hh"
static const unsigned char _use_syllable_machine_trans_keys[] = {
- 0u, 0u, 4u, 4u, 1u, 1u, 0u, 39u, 21u, 21u, 8u, 39u, 8u, 39u, 1u, 1u,
- 8u, 39u, 8u, 39u, 8u, 39u, 8u, 26u, 8u, 26u, 8u, 26u, 8u, 39u, 8u, 39u,
- 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u,
- 8u, 39u, 8u, 39u, 8u, 39u, 1u, 1u, 8u, 39u, 8u, 39u, 8u, 26u, 8u, 26u,
+ 1u, 1u, 0u, 39u, 21u, 21u, 8u, 39u, 8u, 39u, 1u, 1u, 8u, 39u, 8u, 39u,
+ 8u, 39u, 8u, 26u, 8u, 26u, 8u, 26u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u,
+ 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 13u, 21u,
+ 4u, 4u, 13u, 13u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 26u, 8u, 26u,
8u, 26u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u,
- 8u, 39u, 12u, 21u, 12u, 13u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 26u,
- 8u, 26u, 8u, 26u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u,
- 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 1u, 39u, 8u, 39u, 21u, 42u, 41u, 42u,
+ 8u, 39u, 8u, 39u, 8u, 39u, 1u, 1u, 1u, 39u, 8u, 39u, 21u, 42u, 41u, 42u,
42u, 42u, 0
};
static const char _use_syllable_machine_key_spans[] = {
- 0, 1, 1, 40, 1, 32, 32, 1,
- 32, 32, 32, 19, 19, 19, 32, 32,
- 32, 32, 32, 32, 32, 32, 32, 32,
- 32, 32, 32, 1, 32, 32, 19, 19,
+ 1, 40, 1, 32, 32, 1, 32, 32,
+ 32, 19, 19, 19, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 9,
+ 1, 1, 32, 32, 32, 32, 19, 19,
19, 32, 32, 32, 32, 32, 32, 32,
- 32, 10, 2, 32, 32, 32, 32, 19,
- 19, 19, 32, 32, 32, 32, 32, 32,
- 32, 32, 32, 32, 39, 32, 22, 2,
+ 32, 32, 32, 1, 39, 32, 22, 2,
1
};
static const short _use_syllable_machine_index_offsets[] = {
- 0, 0, 2, 4, 45, 47, 80, 113,
- 115, 148, 181, 214, 234, 254, 274, 307,
- 340, 373, 406, 439, 472, 505, 538, 571,
- 604, 637, 670, 703, 705, 738, 771, 791,
- 811, 831, 864, 897, 930, 963, 996, 1029,
- 1062, 1095, 1106, 1109, 1142, 1175, 1208, 1241,
- 1261, 1281, 1301, 1334, 1367, 1400, 1433, 1466,
- 1499, 1532, 1565, 1598, 1631, 1671, 1704, 1727,
- 1730
+ 0, 2, 43, 45, 78, 111, 113, 146,
+ 179, 212, 232, 252, 272, 305, 338, 371,
+ 404, 437, 470, 503, 536, 569, 602, 635,
+ 645, 647, 649, 682, 715, 748, 781, 801,
+ 821, 841, 874, 907, 940, 973, 1006, 1039,
+ 1072, 1105, 1138, 1171, 1173, 1213, 1246, 1269,
+ 1272
};
static const char _use_syllable_machine_indicies[] = {
- 1, 0, 3, 2, 4, 5, 6,
- 4, 1, 5, 8, 8, 7, 8, 8,
- 3, 9, 8, 8, 8, 4, 4, 10,
- 11, 8, 8, 12, 13, 14, 15, 16,
- 17, 18, 12, 19, 20, 21, 22, 23,
- 24, 8, 25, 26, 27, 8, 29, 28,
- 31, 30, 30, 32, 33, 30, 30, 30,
- 30, 30, 30, 30, 30, 34, 35, 36,
- 37, 38, 39, 40, 41, 35, 42, 34,
- 43, 44, 45, 46, 30, 47, 48, 49,
- 30, 31, 30, 30, 32, 33, 30, 30,
- 30, 30, 30, 30, 30, 30, 50, 35,
- 36, 37, 38, 39, 40, 41, 35, 42,
- 43, 43, 44, 45, 46, 30, 47, 48,
- 49, 30, 32, 51, 31, 30, 30, 32,
- 33, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 35, 36, 37, 38, 39, 40,
- 41, 35, 42, 43, 43, 44, 45, 46,
- 30, 47, 48, 49, 30, 31, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 35, 36, 37, 38, 39,
- 30, 30, 30, 30, 30, 30, 44, 45,
- 46, 30, 47, 48, 49, 30, 31, 30,
- 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 36, 37, 38,
- 39, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 47, 48, 49, 30, 31,
- 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 37,
- 38, 39, 30, 31, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 38, 39, 30, 31,
- 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 39, 30, 31, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 37, 38, 39, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30,
- 47, 48, 49, 30, 31, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 37, 38, 39, 30,
- 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 48, 49, 30, 31, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 37, 38, 39,
- 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 49, 30, 31, 30,
- 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 36, 37, 38,
- 39, 30, 30, 30, 30, 30, 30, 44,
- 45, 46, 30, 47, 48, 49, 30, 31,
- 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 36, 37,
- 38, 39, 30, 30, 30, 30, 30, 30,
- 30, 45, 46, 30, 47, 48, 49, 30,
- 31, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 36,
- 37, 38, 39, 30, 30, 30, 30, 30,
- 30, 30, 30, 46, 30, 47, 48, 49,
- 30, 31, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 35,
- 36, 37, 38, 39, 30, 41, 35, 30,
- 30, 30, 44, 45, 46, 30, 47, 48,
- 49, 30, 31, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30,
- 35, 36, 37, 38, 39, 30, 30, 35,
- 30, 30, 30, 44, 45, 46, 30, 47,
- 48, 49, 30, 31, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 35, 36, 37, 38, 39, 40, 41,
- 35, 30, 30, 30, 44, 45, 46, 30,
- 47, 48, 49, 30, 31, 30, 30, 32,
- 33, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 35, 36, 37, 38, 39, 40,
- 41, 35, 42, 30, 43, 44, 45, 46,
- 30, 47, 48, 49, 30, 31, 30, 30,
- 32, 33, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 35, 36, 37, 38, 39,
- 40, 41, 35, 42, 34, 43, 44, 45,
- 46, 30, 47, 48, 49, 30, 53, 52,
- 52, 54, 55, 52, 52, 52, 52, 52,
- 52, 52, 52, 56, 52, 57, 58, 59,
- 60, 61, 62, 57, 63, 56, 64, 52,
- 52, 52, 52, 65, 66, 67, 52, 53,
- 52, 52, 54, 55, 52, 52, 52, 52,
- 52, 52, 52, 52, 68, 52, 57, 58,
- 59, 60, 61, 62, 57, 63, 64, 64,
- 52, 52, 52, 52, 65, 66, 67, 52,
- 54, 51, 53, 52, 52, 54, 55, 52,
- 52, 52, 52, 52, 52, 52, 52, 52,
- 52, 57, 58, 59, 60, 61, 62, 57,
- 63, 64, 64, 52, 52, 52, 52, 65,
- 66, 67, 52, 53, 52, 52, 52, 52,
- 52, 52, 52, 52, 52, 52, 52, 52,
- 52, 52, 57, 58, 59, 60, 52, 52,
- 52, 52, 52, 52, 52, 52, 52, 52,
- 65, 66, 67, 52, 53, 52, 52, 52,
- 52, 52, 52, 52, 52, 52, 52, 52,
- 52, 52, 52, 52, 58, 59, 60, 52,
- 53, 52, 52, 52, 52, 52, 52, 52,
- 52, 52, 52, 52, 52, 52, 52, 52,
- 52, 59, 60, 52, 53, 52, 52, 52,
- 52, 52, 52, 52, 52, 52, 52, 52,
- 52, 52, 52, 52, 52, 52, 60, 52,
- 53, 52, 52, 52, 52, 52, 52, 52,
- 52, 52, 52, 52, 52, 52, 52, 52,
- 58, 59, 60, 52, 52, 52, 52, 52,
- 52, 52, 52, 52, 52, 65, 66, 67,
- 52, 53, 52, 52, 52, 52, 52, 52,
- 52, 52, 52, 52, 52, 52, 52, 52,
- 52, 58, 59, 60, 52, 52, 52, 52,
- 52, 52, 52, 52, 52, 52, 52, 66,
- 67, 52, 53, 52, 52, 52, 52, 52,
- 52, 52, 52, 52, 52, 52, 52, 52,
- 52, 52, 58, 59, 60, 52, 52, 52,
- 52, 52, 52, 52, 52, 52, 52, 52,
- 52, 67, 52, 53, 52, 52, 52, 52,
- 52, 52, 52, 52, 52, 52, 52, 52,
- 52, 52, 57, 58, 59, 60, 52, 62,
- 57, 52, 52, 52, 52, 52, 52, 52,
- 65, 66, 67, 52, 53, 52, 52, 52,
- 52, 52, 52, 52, 52, 52, 52, 52,
- 52, 52, 52, 57, 58, 59, 60, 52,
- 52, 57, 52, 52, 52, 52, 52, 52,
- 52, 65, 66, 67, 52, 53, 52, 52,
- 52, 52, 52, 52, 52, 52, 52, 52,
- 52, 52, 52, 52, 57, 58, 59, 60,
- 61, 62, 57, 52, 52, 52, 52, 52,
- 52, 52, 65, 66, 67, 52, 53, 52,
- 52, 54, 55, 52, 52, 52, 52, 52,
- 52, 52, 52, 52, 52, 57, 58, 59,
- 60, 61, 62, 57, 63, 52, 64, 52,
- 52, 52, 52, 65, 66, 67, 52, 53,
- 52, 52, 54, 55, 52, 52, 52, 52,
- 52, 52, 52, 52, 52, 52, 57, 58,
- 59, 60, 61, 62, 57, 63, 56, 64,
- 52, 52, 52, 52, 65, 66, 67, 52,
- 70, 71, 69, 69, 69, 69, 69, 69,
- 69, 72, 69, 70, 71, 69, 7, 73,
- 73, 3, 9, 73, 73, 73, 73, 73,
- 73, 73, 73, 74, 12, 13, 14, 15,
- 16, 17, 18, 12, 19, 21, 21, 22,
- 23, 24, 73, 25, 26, 27, 73, 7,
- 73, 73, 3, 9, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 12, 13, 14,
- 15, 16, 17, 18, 12, 19, 21, 21,
- 22, 23, 24, 73, 25, 26, 27, 73,
- 7, 73, 73, 73, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 73, 12, 13,
- 14, 15, 16, 73, 73, 73, 73, 73,
- 73, 22, 23, 24, 73, 25, 26, 27,
- 73, 7, 73, 73, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 73, 73, 73,
- 13, 14, 15, 16, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 73, 25, 26,
- 27, 73, 7, 73, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 73, 73, 73,
- 73, 73, 14, 15, 16, 73, 7, 73,
- 73, 73, 73, 73, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 73, 73, 15,
- 16, 73, 7, 73, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 73, 73, 73,
- 73, 73, 73, 73, 16, 73, 7, 73,
- 73, 73, 73, 73, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 73, 14, 15,
- 16, 73, 73, 73, 73, 73, 73, 73,
- 73, 73, 73, 25, 26, 27, 73, 7,
- 73, 73, 73, 73, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 73, 73, 14,
- 15, 16, 73, 73, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 26, 27, 73,
- 7, 73, 73, 73, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 73, 73, 73,
- 14, 15, 16, 73, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 73, 73, 27,
- 73, 7, 73, 73, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 73, 73, 73,
- 13, 14, 15, 16, 73, 73, 73, 73,
- 73, 73, 22, 23, 24, 73, 25, 26,
- 27, 73, 7, 73, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 73, 73, 73,
- 73, 13, 14, 15, 16, 73, 73, 73,
- 73, 73, 73, 73, 23, 24, 73, 25,
- 26, 27, 73, 7, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 73, 73, 73,
- 73, 73, 13, 14, 15, 16, 73, 73,
- 73, 73, 73, 73, 73, 73, 24, 73,
- 25, 26, 27, 73, 7, 73, 73, 73,
- 73, 73, 73, 73, 73, 73, 73, 73,
- 73, 73, 12, 13, 14, 15, 16, 73,
- 18, 12, 73, 73, 73, 22, 23, 24,
- 73, 25, 26, 27, 73, 7, 73, 73,
- 73, 73, 73, 73, 73, 73, 73, 73,
- 73, 73, 73, 12, 13, 14, 15, 16,
- 73, 73, 12, 73, 73, 73, 22, 23,
- 24, 73, 25, 26, 27, 73, 7, 73,
- 73, 73, 73, 73, 73, 73, 73, 73,
- 73, 73, 73, 73, 12, 13, 14, 15,
- 16, 17, 18, 12, 73, 73, 73, 22,
- 23, 24, 73, 25, 26, 27, 73, 7,
- 73, 73, 3, 9, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 12, 13, 14,
- 15, 16, 17, 18, 12, 19, 73, 21,
- 22, 23, 24, 73, 25, 26, 27, 73,
- 5, 6, 73, 73, 5, 73, 73, 7,
- 73, 73, 3, 9, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 12, 13, 14,
- 15, 16, 17, 18, 12, 19, 20, 21,
- 22, 23, 24, 73, 25, 26, 27, 73,
- 7, 73, 73, 3, 9, 73, 73, 73,
- 73, 73, 73, 73, 73, 73, 12, 13,
- 14, 15, 16, 17, 18, 12, 19, 20,
- 21, 22, 23, 24, 73, 25, 26, 27,
- 73, 76, 75, 75, 75, 75, 75, 75,
- 75, 75, 75, 75, 75, 75, 75, 75,
- 75, 75, 75, 75, 75, 76, 77, 75,
- 76, 77, 75, 77, 75, 0
+ 1, 0, 2, 3, 4, 2, 5, 3,
+ 4, 4, 6, 4, 4, 1, 7, 4,
+ 4, 4, 2, 2, 8, 9, 4, 4,
+ 10, 11, 12, 13, 14, 15, 16, 10,
+ 17, 18, 19, 20, 21, 22, 4, 23,
+ 24, 25, 4, 27, 26, 29, 28, 28,
+ 30, 31, 28, 28, 28, 28, 28, 28,
+ 28, 28, 32, 33, 34, 35, 36, 37,
+ 38, 39, 33, 40, 32, 41, 42, 43,
+ 44, 28, 45, 46, 47, 28, 29, 28,
+ 28, 30, 31, 28, 28, 28, 28, 28,
+ 28, 28, 28, 48, 33, 34, 35, 36,
+ 37, 38, 39, 33, 40, 41, 41, 42,
+ 43, 44, 28, 45, 46, 47, 28, 30,
+ 49, 29, 28, 28, 30, 31, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 33,
+ 34, 35, 36, 37, 38, 39, 33, 40,
+ 41, 41, 42, 43, 44, 28, 45, 46,
+ 47, 28, 29, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28,
+ 33, 34, 35, 36, 37, 28, 28, 28,
+ 28, 28, 28, 42, 43, 44, 28, 45,
+ 46, 47, 28, 29, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 34, 35, 36, 37, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28,
+ 45, 46, 47, 28, 29, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 35, 36, 37, 28,
+ 29, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 36, 37, 28, 29, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 37, 28,
+ 29, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28,
+ 35, 36, 37, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 45, 46, 47,
+ 28, 29, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 35, 36, 37, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 46,
+ 47, 28, 29, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 35, 36, 37, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 47, 28, 29, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 34, 35, 36, 37, 28, 28,
+ 28, 28, 28, 28, 42, 43, 44, 28,
+ 45, 46, 47, 28, 29, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 34, 35, 36, 37, 28,
+ 28, 28, 28, 28, 28, 28, 43, 44,
+ 28, 45, 46, 47, 28, 29, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 34, 35, 36, 37,
+ 28, 28, 28, 28, 28, 28, 28, 28,
+ 44, 28, 45, 46, 47, 28, 29, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 33, 34, 35, 36,
+ 37, 28, 39, 33, 28, 28, 28, 42,
+ 43, 44, 28, 45, 46, 47, 28, 29,
+ 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 33, 34, 35,
+ 36, 37, 28, 28, 33, 28, 28, 28,
+ 42, 43, 44, 28, 45, 46, 47, 28,
+ 29, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 33, 34,
+ 35, 36, 37, 38, 39, 33, 28, 28,
+ 28, 42, 43, 44, 28, 45, 46, 47,
+ 28, 29, 28, 28, 30, 31, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 33,
+ 34, 35, 36, 37, 38, 39, 33, 40,
+ 28, 41, 42, 43, 44, 28, 45, 46,
+ 47, 28, 29, 28, 28, 30, 31, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28,
+ 33, 34, 35, 36, 37, 38, 39, 33,
+ 40, 32, 41, 42, 43, 44, 28, 45,
+ 46, 47, 28, 51, 50, 50, 50, 50,
+ 50, 50, 50, 52, 50, 5, 53, 51,
+ 50, 6, 54, 54, 1, 55, 54, 54,
+ 54, 54, 54, 54, 54, 54, 56, 10,
+ 11, 12, 13, 14, 15, 16, 10, 17,
+ 19, 19, 20, 21, 22, 54, 23, 24,
+ 25, 54, 6, 54, 54, 1, 55, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54,
+ 10, 11, 12, 13, 14, 15, 16, 10,
+ 17, 19, 19, 20, 21, 22, 54, 23,
+ 24, 25, 54, 6, 54, 54, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 10, 11, 12, 13, 14, 54, 54,
+ 54, 54, 54, 54, 20, 21, 22, 54,
+ 23, 24, 25, 54, 6, 54, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 54, 54, 11, 12, 13, 14, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 23, 24, 25, 54, 6, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 54, 54, 54, 54, 12, 13, 14,
+ 54, 6, 54, 54, 54, 54, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 54, 13, 14, 54, 6, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 14,
+ 54, 6, 54, 54, 54, 54, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 12, 13, 14, 54, 54, 54, 54,
+ 54, 54, 54, 54, 54, 54, 23, 24,
+ 25, 54, 6, 54, 54, 54, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 54, 12, 13, 14, 54, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54,
+ 24, 25, 54, 6, 54, 54, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 54, 54, 12, 13, 14, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 54, 25, 54, 6, 54, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 54, 54, 11, 12, 13, 14, 54,
+ 54, 54, 54, 54, 54, 20, 21, 22,
+ 54, 23, 24, 25, 54, 6, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 54, 54, 54, 11, 12, 13, 14,
+ 54, 54, 54, 54, 54, 54, 54, 21,
+ 22, 54, 23, 24, 25, 54, 6, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 54, 54, 54, 54, 11, 12, 13,
+ 14, 54, 54, 54, 54, 54, 54, 54,
+ 54, 22, 54, 23, 24, 25, 54, 6,
+ 54, 54, 54, 54, 54, 54, 54, 54,
+ 54, 54, 54, 54, 54, 10, 11, 12,
+ 13, 14, 54, 16, 10, 54, 54, 54,
+ 20, 21, 22, 54, 23, 24, 25, 54,
+ 6, 54, 54, 54, 54, 54, 54, 54,
+ 54, 54, 54, 54, 54, 54, 10, 11,
+ 12, 13, 14, 54, 54, 10, 54, 54,
+ 54, 20, 21, 22, 54, 23, 24, 25,
+ 54, 6, 54, 54, 54, 54, 54, 54,
+ 54, 54, 54, 54, 54, 54, 54, 10,
+ 11, 12, 13, 14, 15, 16, 10, 54,
+ 54, 54, 20, 21, 22, 54, 23, 24,
+ 25, 54, 6, 54, 54, 1, 55, 54,
+ 54, 54, 54, 54, 54, 54, 54, 54,
+ 10, 11, 12, 13, 14, 15, 16, 10,
+ 17, 54, 19, 20, 21, 22, 54, 23,
+ 24, 25, 54, 1, 57, 3, 54, 54,
+ 54, 3, 54, 54, 6, 54, 54, 1,
+ 55, 54, 54, 54, 54, 54, 54, 54,
+ 54, 54, 10, 11, 12, 13, 14, 15,
+ 16, 10, 17, 18, 19, 20, 21, 22,
+ 54, 23, 24, 25, 54, 6, 54, 54,
+ 1, 55, 54, 54, 54, 54, 54, 54,
+ 54, 54, 54, 10, 11, 12, 13, 14,
+ 15, 16, 10, 17, 18, 19, 20, 21,
+ 22, 54, 23, 24, 25, 54, 59, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58, 59, 60, 58, 59, 60, 58,
+ 60, 58, 0
};
static const char _use_syllable_machine_trans_targs[] = {
- 3, 41, 3, 43, 4, 5, 25, 3,
- 0, 2, 60, 62, 45, 46, 47, 48,
- 49, 56, 57, 58, 61, 59, 53, 54,
- 55, 50, 51, 52, 3, 3, 3, 3,
- 6, 7, 24, 9, 10, 11, 12, 13,
- 20, 21, 22, 23, 17, 18, 19, 14,
- 15, 16, 8, 3, 3, 3, 26, 27,
- 40, 29, 30, 31, 32, 36, 37, 38,
- 39, 33, 34, 35, 28, 3, 3, 1,
- 42, 3, 44, 3, 63, 64
+ 1, 26, 2, 3, 1, 23, 1, 43,
+ 44, 46, 28, 29, 30, 31, 32, 39,
+ 40, 41, 45, 42, 36, 37, 38, 33,
+ 34, 35, 1, 1, 1, 1, 4, 5,
+ 22, 7, 8, 9, 10, 11, 18, 19,
+ 20, 21, 15, 16, 17, 12, 13, 14,
+ 6, 1, 1, 24, 25, 1, 1, 0,
+ 27, 1, 1, 47, 48
};
static const char _use_syllable_machine_trans_actions[] = {
- 1, 2, 3, 4, 0, 0, 0, 7,
- 0, 0, 4, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 4, 4, 0, 0,
- 0, 0, 0, 0, 8, 9, 10, 11,
+ 1, 2, 0, 0, 5, 0, 6, 0,
+ 2, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 2, 2, 0, 0, 0, 0,
+ 0, 0, 7, 8, 9, 10, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 12, 13, 14, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 15, 16, 0,
- 2, 17, 4, 18, 0, 0
+ 0, 11, 12, 0, 0, 13, 14, 0,
+ 2, 15, 16, 0, 0
};
static const char _use_syllable_machine_to_state_actions[] = {
- 0, 0, 0, 5, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -330,9 +261,7 @@ static const char _use_syllable_machine_to_state_actions[] = {
};
static const char _use_syllable_machine_from_state_actions[] = {
- 0, 0, 0, 6, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 4, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@@ -342,29 +271,27 @@ static const char _use_syllable_machine_from_state_actions[] = {
};
static const short _use_syllable_machine_eof_trans[] = {
- 0, 1, 3, 0, 29, 31, 31, 52,
- 31, 31, 31, 31, 31, 31, 31, 31,
- 31, 31, 31, 31, 31, 31, 31, 31,
- 31, 53, 53, 52, 53, 53, 53, 53,
- 53, 53, 53, 53, 53, 53, 53, 53,
- 53, 70, 70, 74, 74, 74, 74, 74,
- 74, 74, 74, 74, 74, 74, 74, 74,
- 74, 74, 74, 74, 74, 74, 76, 76,
- 76
+ 1, 0, 27, 29, 29, 50, 29, 29,
+ 29, 29, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 29, 29, 29, 29, 51,
+ 54, 51, 55, 55, 55, 55, 55, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55,
+ 55, 55, 55, 58, 55, 55, 59, 59,
+ 59
};
-static const int use_syllable_machine_start = 3;
-static const int use_syllable_machine_first_final = 3;
-static const int use_syllable_machine_error = 0;
+static const int use_syllable_machine_start = 1;
+static const int use_syllable_machine_first_final = 1;
+static const int use_syllable_machine_error = -1;
-static const int use_syllable_machine_en_main = 3;
+static const int use_syllable_machine_en_main = 1;
#line 38 "hb-ot-shape-complex-use-machine.rl"
-#line 145 "hb-ot-shape-complex-use-machine.rl"
+#line 138 "hb-ot-shape-complex-use-machine.rl"
#define found_syllable(syllable_type) \
@@ -384,7 +311,7 @@ find_syllables (hb_buffer_t *buffer)
int cs;
hb_glyph_info_t *info = buffer->info;
-#line 388 "hb-ot-shape-complex-use-machine.hh"
+#line 315 "hb-ot-shape-complex-use-machine.hh"
{
cs = use_syllable_machine_start;
ts = 0;
@@ -392,7 +319,7 @@ find_syllables (hb_buffer_t *buffer)
act = 0;
}
-#line 166 "hb-ot-shape-complex-use-machine.rl"
+#line 159 "hb-ot-shape-complex-use-machine.rl"
p = 0;
@@ -401,7 +328,7 @@ find_syllables (hb_buffer_t *buffer)
unsigned int last = 0;
unsigned int syllable_serial = 1;
-#line 405 "hb-ot-shape-complex-use-machine.hh"
+#line 332 "hb-ot-shape-complex-use-machine.hh"
{
int _slen;
int _trans;
@@ -409,15 +336,13 @@ find_syllables (hb_buffer_t *buffer)
const char *_inds;
if ( p == pe )
goto _test_eof;
- if ( cs == 0 )
- goto _out;
_resume:
switch ( _use_syllable_machine_from_state_actions[cs] ) {
- case 6:
+ case 4:
#line 1 "NONE"
{ts = p;}
break;
-#line 421 "hb-ot-shape-complex-use-machine.hh"
+#line 346 "hb-ot-shape-complex-use-machine.hh"
}
_keys = _use_syllable_machine_trans_keys + (cs<<1);
@@ -439,92 +364,70 @@ _eof_trans:
#line 1 "NONE"
{te = p+1;}
break;
- case 9:
-#line 134 "hb-ot-shape-complex-use-machine.rl"
+ case 8:
+#line 127 "hb-ot-shape-complex-use-machine.rl"
{te = p+1;{ found_syllable (independent_cluster); }}
break;
- case 11:
-#line 136 "hb-ot-shape-complex-use-machine.rl"
- {te = p+1;{ found_syllable (consonant_cluster); }}
- break;
- case 14:
-#line 137 "hb-ot-shape-complex-use-machine.rl"
- {te = p+1;{ found_syllable (vowel_cluster); }}
- break;
- case 16:
-#line 138 "hb-ot-shape-complex-use-machine.rl"
- {te = p+1;{ found_syllable (number_joiner_terminated_cluster); }}
+ case 10:
+#line 129 "hb-ot-shape-complex-use-machine.rl"
+ {te = p+1;{ found_syllable (standard_cluster); }}
break;
- case 7:
-#line 141 "hb-ot-shape-complex-use-machine.rl"
+ case 6:
+#line 133 "hb-ot-shape-complex-use-machine.rl"
{te = p+1;{ found_syllable (broken_cluster); }}
break;
- case 8:
+ case 5:
#line 134 "hb-ot-shape-complex-use-machine.rl"
+ {te = p+1;{ found_syllable (non_cluster); }}
+ break;
+ case 7:
+#line 127 "hb-ot-shape-complex-use-machine.rl"
{te = p;p--;{ found_syllable (independent_cluster); }}
break;
- case 12:
-#line 135 "hb-ot-shape-complex-use-machine.rl"
+ case 11:
+#line 128 "hb-ot-shape-complex-use-machine.rl"
{te = p;p--;{ found_syllable (virama_terminated_cluster); }}
break;
- case 10:
-#line 136 "hb-ot-shape-complex-use-machine.rl"
- {te = p;p--;{ found_syllable (consonant_cluster); }}
+ case 9:
+#line 129 "hb-ot-shape-complex-use-machine.rl"
+ {te = p;p--;{ found_syllable (standard_cluster); }}
break;
case 13:
-#line 137 "hb-ot-shape-complex-use-machine.rl"
- {te = p;p--;{ found_syllable (vowel_cluster); }}
+#line 130 "hb-ot-shape-complex-use-machine.rl"
+ {te = p;p--;{ found_syllable (number_joiner_terminated_cluster); }}
break;
- case 15:
-#line 139 "hb-ot-shape-complex-use-machine.rl"
+ case 12:
+#line 131 "hb-ot-shape-complex-use-machine.rl"
{te = p;p--;{ found_syllable (numeral_cluster); }}
break;
- case 18:
-#line 140 "hb-ot-shape-complex-use-machine.rl"
+ case 16:
+#line 132 "hb-ot-shape-complex-use-machine.rl"
{te = p;p--;{ found_syllable (symbol_cluster); }}
break;
- case 17:
-#line 141 "hb-ot-shape-complex-use-machine.rl"
+ case 14:
+#line 133 "hb-ot-shape-complex-use-machine.rl"
{te = p;p--;{ found_syllable (broken_cluster); }}
break;
- case 1:
-#line 139 "hb-ot-shape-complex-use-machine.rl"
- {{p = ((te))-1;}{ found_syllable (numeral_cluster); }}
- break;
- case 3:
-#line 1 "NONE"
- { switch( act ) {
- case 0:
- {{cs = 0; goto _again;}}
- break;
- case 8:
- {{p = ((te))-1;} found_syllable (broken_cluster); }
- break;
- }
- }
+ case 15:
+#line 134 "hb-ot-shape-complex-use-machine.rl"
+ {te = p;p--;{ found_syllable (non_cluster); }}
break;
- case 4:
-#line 1 "NONE"
- {te = p+1;}
-#line 141 "hb-ot-shape-complex-use-machine.rl"
- {act = 8;}
+ case 1:
+#line 133 "hb-ot-shape-complex-use-machine.rl"
+ {{p = ((te))-1;}{ found_syllable (broken_cluster); }}
break;
-#line 513 "hb-ot-shape-complex-use-machine.hh"
+#line 420 "hb-ot-shape-complex-use-machine.hh"
}
_again:
switch ( _use_syllable_machine_to_state_actions[cs] ) {
- case 5:
+ case 3:
#line 1 "NONE"
{ts = 0;}
-#line 1 "NONE"
- {act = 0;}
break;
-#line 524 "hb-ot-shape-complex-use-machine.hh"
+#line 429 "hb-ot-shape-complex-use-machine.hh"
}
- if ( cs == 0 )
- goto _out;
if ( ++p != pe )
goto _resume;
_test_eof: {}
@@ -536,10 +439,9 @@ _again:
}
}
- _out: {}
}
-#line 175 "hb-ot-shape-complex-use-machine.rl"
+#line 168 "hb-ot-shape-complex-use-machine.rl"
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-private.hh
index a143736211..ae428cb5eb 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-private.hh
@@ -46,7 +46,6 @@ enum use_category_t {
USE_O = 0, /* OTHER */
USE_B = 1, /* BASE */
- USE_IV = 2, /* BASE_VOWEL */
USE_IND = 3, /* BASE_IND */
USE_N = 4, /* BASE_NUM */
USE_GB = 5, /* BASE_OTHER */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-table.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-table.cc
index 6cd1c5db75..38c46d002d 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-table.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-table.cc
@@ -6,12 +6,12 @@
*
* on files with these headers:
*
- * # IndicSyllabicCategory-8.0.0.txt
- * # Date: 2015-05-12, 10:00:00 GMT [RP, KW, LI]
- * # IndicPositionalCategory-8.0.0.txt
- * # Date: 2015-05-12, 10:00:00 GMT [RP, KW, LI]
- * # Blocks-8.0.0.txt
- * # Date: 2014-11-10, 23:04:00 GMT [KW]
+ * # IndicSyllabicCategory-9.0.0.txt
+ * # Date: 2016-05-21, 02:46:00 GMT [RP]
+ * # IndicPositionalCategory-9.0.0.txt
+ * # Date: 2016-02-25, 00:48:00 GMT [RP]
+ * # Blocks-9.0.0.txt
+ * # Date: 2016-02-05, 23:48:00 GMT [KW]
* UnicodeData.txt does not have a header.
*/
@@ -24,7 +24,6 @@
#define H USE_H /* HALANT */
#define HN USE_HN /* HALANT_NUM */
#define IND USE_IND /* BASE_IND */
-#define IV USE_IV /* BASE_VOWEL */
#define N USE_N /* BASE_NUM */
#define O USE_O /* OTHER */
#define R USE_R /* REPHA */
@@ -80,30 +79,30 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* Devanagari */
- /* 0900 */ VMAbv, VMAbv, VMAbv, VMPst, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV,
- /* 0910 */ IV, IV, IV, IV, IV, B, B, B, B, B, B, B, B, B, B, B,
+ /* 0900 */ VMAbv, VMAbv, VMAbv, VMPst, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* 0910 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 0920 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 0930 */ B, B, B, B, B, B, B, B, B, B, VAbv, VPst, CMBlw, B, VPst, VPre,
/* 0940 */ VPst, VBlw, VBlw, VBlw, VBlw, VAbv, VAbv, VAbv, VAbv, VPst, VPst, VPst, VPst, H, VPre, VPst,
/* 0950 */ O, VMAbv, VMBlw, O, O, VAbv, VBlw, VBlw, B, B, B, B, B, B, B, B,
- /* 0960 */ IV, IV, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B,
- /* 0970 */ O, O, IV, IV, IV, IV, IV, IV, B, B, B, B, B, B, B, B,
+ /* 0960 */ B, B, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B,
+ /* 0970 */ O, O, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* Bengali */
- /* 0980 */ O, VMAbv, VMPst, VMPst, O, IV, IV, IV, IV, IV, IV, IV, IV, O, O, IV,
- /* 0990 */ IV, O, O, IV, IV, B, B, B, B, B, B, B, B, B, B, B,
+ /* 0980 */ O, VMAbv, VMPst, VMPst, O, B, B, B, B, B, B, B, B, O, O, B,
+ /* 0990 */ B, O, O, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 09A0 */ B, B, B, B, B, B, B, B, B, O, B, B, B, B, B, B,
/* 09B0 */ B, O, B, O, O, O, B, B, B, B, O, O, CMBlw, B, VPst, VPre,
/* 09C0 */ VPst, VBlw, VBlw, VBlw, VBlw, O, O, VPre, VPre, O, O, VPre, VPre, H, IND, O,
/* 09D0 */ O, O, O, O, O, O, O, VPst, O, O, O, O, B, B, O, B,
- /* 09E0 */ IV, IV, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B,
+ /* 09E0 */ B, B, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B,
/* 09F0 */ B, B, O, O, O, O, O, O, O, O, O, O, O, O, O, O,
/* Gurmukhi */
- /* 0A00 */ O, VMAbv, VMAbv, VMPst, O, IV, IV, IV, IV, IV, IV, O, O, O, O, IV,
- /* 0A10 */ IV, O, O, IV, IV, B, B, B, B, B, B, B, B, B, B, B,
+ /* 0A00 */ O, VMAbv, VMAbv, VMPst, O, B, B, B, B, B, B, O, O, O, O, B,
+ /* 0A10 */ B, O, O, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 0A20 */ B, B, B, B, B, B, B, B, B, O, B, B, B, B, B, B,
/* 0A30 */ B, O, B, B, O, B, B, O, B, B, O, O, CMBlw, O, VPst, VPre,
/* 0A40 */ VPst, VBlw, VBlw, O, O, O, O, VAbv, VAbv, O, O, VAbv, VAbv, H, O, O,
@@ -113,30 +112,30 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* Gujarati */
- /* 0A80 */ O, VMAbv, VMAbv, VMPst, O, IV, IV, IV, IV, IV, IV, IV, IV, IV, O, IV,
- /* 0A90 */ IV, IV, O, IV, IV, B, B, B, B, B, B, B, B, B, B, B,
+ /* 0A80 */ O, VMAbv, VMAbv, VMPst, O, B, B, B, B, B, B, B, B, B, O, B,
+ /* 0A90 */ B, B, O, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 0AA0 */ B, B, B, B, B, B, B, B, B, O, B, B, B, B, B, B,
/* 0AB0 */ B, O, B, B, O, B, B, B, B, B, O, O, CMBlw, B, VPst, VPre,
/* 0AC0 */ VPst, VBlw, VBlw, VBlw, VBlw, VAbv, O, VAbv, VAbv, VAbv, O, VPst, VPst, H, O, O,
/* 0AD0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O,
- /* 0AE0 */ IV, IV, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B,
+ /* 0AE0 */ B, B, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B,
/* 0AF0 */ O, O, O, O, O, O, O, O, O, B, O, O, O, O, O, O,
/* Oriya */
- /* 0B00 */ O, VMAbv, VMPst, VMPst, O, IV, IV, IV, IV, IV, IV, IV, IV, O, O, IV,
- /* 0B10 */ IV, O, O, IV, IV, B, B, B, B, B, B, B, B, B, B, B,
+ /* 0B00 */ O, VMAbv, VMPst, VMPst, O, B, B, B, B, B, B, B, B, O, O, B,
+ /* 0B10 */ B, O, O, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 0B20 */ B, B, B, B, B, B, B, B, B, O, B, B, B, B, B, B,
/* 0B30 */ B, O, B, B, O, B, B, B, B, B, O, O, CMBlw, B, VPst, VAbv,
/* 0B40 */ VPst, VBlw, VBlw, VBlw, VBlw, O, O, VPre, VPre, O, O, VPre, VPre, H, O, O,
/* 0B50 */ O, O, O, O, O, O, VAbv, VAbv, O, O, O, O, B, B, O, B,
- /* 0B60 */ IV, IV, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B,
+ /* 0B60 */ B, B, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B,
/* 0B70 */ O, B, O, O, O, O, O, O, O, O, O, O, O, O, O, O,
/* Tamil */
- /* 0B80 */ O, O, VMAbv, IND, O, IV, IV, IV, IV, IV, IV, O, O, O, IV, IV,
- /* 0B90 */ IV, O, IV, IV, IV, B, O, O, O, B, B, O, B, O, B, B,
+ /* 0B80 */ O, O, VMAbv, IND, O, B, B, B, B, B, B, O, O, O, B, B,
+ /* 0B90 */ B, O, B, B, B, B, O, O, O, B, B, O, B, O, B, B,
/* 0BA0 */ O, O, O, B, B, O, O, O, B, B, B, O, O, O, B, B,
/* 0BB0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, VPst, VPst,
/* 0BC0 */ VAbv, VPst, VPst, O, O, O, VPre, VPre, VPre, O, VPre, VPre, VPre, H, O, O,
@@ -146,41 +145,41 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* Telugu */
- /* 0C00 */ VMAbv, VMPst, VMPst, VMPst, O, IV, IV, IV, IV, IV, IV, IV, IV, O, IV, IV,
- /* 0C10 */ IV, O, IV, IV, IV, B, B, B, B, B, B, B, B, B, B, B,
+ /* 0C00 */ VMAbv, VMPst, VMPst, VMPst, O, B, B, B, B, B, B, B, B, O, B, B,
+ /* 0C10 */ B, O, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 0C20 */ B, B, B, B, B, B, B, B, B, O, B, B, B, B, B, B,
/* 0C30 */ B, B, B, B, B, B, B, B, B, B, O, O, O, B, VAbv, VAbv,
/* 0C40 */ VAbv, VPst, VPst, VPst, VPst, O, VAbv, VAbv, VAbv, O, VAbv, VAbv, VAbv, H, O, O,
/* 0C50 */ O, O, O, O, O, VAbv, VBlw, O, B, B, B, O, O, O, O, O,
- /* 0C60 */ IV, IV, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B,
+ /* 0C60 */ B, B, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B,
/* 0C70 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O,
/* Kannada */
- /* 0C80 */ O, VMAbv, VMPst, VMPst, O, IV, IV, IV, IV, IV, IV, IV, IV, O, IV, IV,
- /* 0C90 */ IV, O, IV, IV, IV, B, B, B, B, B, B, B, B, B, B, B,
+ /* 0C80 */ O, VMAbv, VMPst, VMPst, O, B, B, B, B, B, B, B, B, O, B, B,
+ /* 0C90 */ B, O, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 0CA0 */ B, B, B, B, B, B, B, B, B, O, B, B, B, B, B, B,
/* 0CB0 */ B, B, B, B, O, B, B, B, B, B, O, O, CMBlw, B, VPst, VAbv,
/* 0CC0 */ VAbv, VPst, VPst, VPst, VPst, O, VAbv, VAbv, VAbv, O, VAbv, VAbv, VAbv, H, O, O,
/* 0CD0 */ O, O, O, O, O, VPst, VPst, O, O, O, O, O, O, O, B, O,
- /* 0CE0 */ IV, IV, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B,
+ /* 0CE0 */ B, B, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B,
/* 0CF0 */ O, R, R, O, O, O, O, O, O, O, O, O, O, O, O, O,
/* Malayalam */
- /* 0D00 */ O, VMAbv, VMPst, VMPst, O, IV, IV, IV, IV, IV, IV, IV, IV, O, IV, IV,
- /* 0D10 */ IV, O, IV, IV, IV, B, B, B, B, B, B, B, B, B, B, B,
+ /* 0D00 */ O, VMAbv, VMPst, VMPst, O, B, B, B, B, B, B, B, B, O, B, B,
+ /* 0D10 */ B, O, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 0D20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 0D30 */ B, B, B, B, B, B, B, B, B, B, B, O, O, B, VPst, VPst,
/* 0D40 */ VPst, VPst, VPst, VBlw, VBlw, O, VPre, VPre, VPre, O, VPre, VPre, VPre, H, R, O,
- /* 0D50 */ O, O, O, O, O, O, O, VPst, O, O, O, O, O, O, O, IV,
- /* 0D60 */ IV, IV, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B,
+ /* 0D50 */ O, O, O, O, IND, IND, IND, VPst, O, O, O, O, O, O, O, B,
+ /* 0D60 */ B, B, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B,
/* 0D70 */ O, O, O, O, O, O, O, O, O, O, IND, IND, IND, IND, IND, IND,
/* Sinhala */
- /* 0D80 */ O, O, VMPst, VMPst, O, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV,
- /* 0D90 */ IV, IV, IV, IV, IV, IV, IV, O, O, O, B, B, B, B, B, B,
+ /* 0D80 */ O, O, VMPst, VMPst, O, B, B, B, B, B, B, B, B, B, B, B,
+ /* 0D90 */ B, B, B, B, B, B, B, O, O, O, B, B, B, B, B, B,
/* 0DA0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 0DB0 */ B, B, O, B, B, B, B, B, B, B, B, B, O, B, O, O,
/* 0DC0 */ B, B, B, B, B, B, B, O, O, O, H, O, O, O, O, VPst,
@@ -195,10 +194,10 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* 1000 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 1010 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
- /* 1020 */ B, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, VPst, VPst, VAbv, VAbv, VBlw,
+ /* 1020 */ B, B, B, B, B, B, B, B, B, B, B, VPst, VPst, VAbv, VAbv, VBlw,
/* 1030 */ VBlw, VPre, VAbv, VAbv, VAbv, VAbv, VMAbv, VMBlw, VMPst, H, VAbv, MPst, MPre, MBlw, MBlw, B,
/* 1040 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, GB, O,
- /* 1050 */ B, B, IV, IV, IV, IV, VPst, VPst, VBlw, VBlw, B, B, B, B, MBlw, MBlw,
+ /* 1050 */ B, B, B, B, B, B, VPst, VPst, VBlw, VBlw, B, B, B, B, MBlw, MBlw,
/* 1060 */ MBlw, B, VPst, VMPst, VMPst, B, B, VPst, VPst, VMPst, VMPst, VMPst, VMPst, VMPst, B, B,
/* 1070 */ B, VAbv, VAbv, VAbv, VAbv, B, B, B, B, B, B, B, B, B, B, B,
/* 1080 */ B, B, MBlw, VPst, VPre, VAbv, VAbv, VMPst, VMPst, VMPst, VMPst, VMPst, VMPst, VMBlw, B, VMPst,
@@ -209,30 +208,30 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* Tagalog */
- /* 1700 */ IV, IV, IV, B, B, B, B, B, B, B, B, B, B, O, B, B,
+ /* 1700 */ B, B, B, B, B, B, B, B, B, B, B, B, B, O, B, B,
/* 1710 */ B, B, VAbv, VBlw, VBlw, O, O, O, O, O, O, O, O, O, O, O,
/* Hanunoo */
- /* 1720 */ IV, IV, IV, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* 1720 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 1730 */ B, B, VAbv, VBlw, VBlw, O, O, O, O, O, O, O, O, O, O, O,
/* Buhid */
- /* 1740 */ IV, IV, IV, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* 1740 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 1750 */ B, B, VAbv, VBlw, O, O, O, O, O, O, O, O, O, O, O, O,
/* Tagbanwa */
- /* 1760 */ IV, IV, IV, B, B, B, B, B, B, B, B, B, B, O, B, B,
+ /* 1760 */ B, B, B, B, B, B, B, B, B, B, B, B, B, O, B, B,
/* 1770 */ B, O, VAbv, VBlw, O, O, O, O, O, O, O, O, O, O, O, O,
/* Khmer */
/* 1780 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 1790 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
- /* 17A0 */ B, B, B, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV,
- /* 17B0 */ IV, IV, IV, IV, O, O, VPst, VAbv, VAbv, VAbv, VAbv, VBlw, VBlw, VBlw, VPre, VPre,
+ /* 17A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* 17B0 */ B, B, B, B, O, O, VPst, VAbv, VAbv, VAbv, VAbv, VBlw, VBlw, VBlw, VPre, VPre,
/* 17C0 */ VPre, VPre, VPre, VPre, VPre, VPre, VMAbv, VMPst, VPst, VMAbv, VMAbv, FM, FAbv, CMAbv, FM, FM,
/* 17D0 */ FM, VAbv, H, FM, O, O, O, O, O, O, O, O, B, VAbv, O, O,
/* 17E0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O,
@@ -274,8 +273,8 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* 1A20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 1A30 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
- /* 1A40 */ B, B, B, B, B, B, B, B, B, B, B, B, B, IV, IV, IV,
- /* 1A50 */ IV, IV, IV, B, B, MPre, MBlw, FPst, FAbv, FAbv, FAbv, FBlw, FBlw, FBlw, FBlw, O,
+ /* 1A40 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* 1A50 */ B, B, B, B, B, MPre, MBlw, FPst, FAbv, FAbv, FAbv, FBlw, FBlw, FBlw, FBlw, O,
/* 1A60 */ H, VPst, VAbv, VPst, VPst, VAbv, VAbv, VAbv, VAbv, VBlw, VBlw, VAbv, VBlw, VPst, VPre, VPre,
/* 1A70 */ VPre, VPre, VPre, VAbv, VAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, FM, FM, FM, O, O, FM,
/* 1A80 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O,
@@ -286,8 +285,8 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* Balinese */
- /* 1B00 */ VMAbv, VMAbv, VMAbv, FAbv, VMPst, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV,
- /* 1B10 */ IV, IV, IV, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* 1B00 */ VMAbv, VMAbv, VMAbv, FAbv, VMPst, B, B, B, B, B, B, B, B, B, B, B,
+ /* 1B10 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 1B20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 1B30 */ B, B, B, B, CMAbv, VPst, VAbv, VAbv, VBlw, VBlw, VBlw, VBlw, VAbv, VAbv, VPre, VPre,
/* 1B40 */ VPre, VPre, VAbv, VAbv, H, B, B, B, B, B, B, B, O, O, O, O,
@@ -297,7 +296,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* Sundanese */
- /* 1B80 */ VMAbv, FAbv, VMPst, IV, IV, IV, IV, IV, IV, IV, B, B, B, B, B, B,
+ /* 1B80 */ VMAbv, FAbv, VMPst, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 1B90 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 1BA0 */ B, SUB, SUB, SUB, VAbv, VBlw, VPre, VPst, VAbv, VAbv, VPst, H, SUB, SUB, B, B,
/* 1BB0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
@@ -306,7 +305,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* 1BC0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 1BD0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
- /* 1BE0 */ B, B, B, B, IV, IV, CMAbv, VPst, VAbv, VAbv, VPst, VPst, VPst, VAbv, VPst, VAbv,
+ /* 1BE0 */ B, B, B, B, B, B, CMAbv, VPst, VAbv, VAbv, VPst, VPst, VPst, VAbv, VPst, VAbv,
/* 1BF0 */ FAbv, FAbv, VPst, VPst, O, O, O, O, O, O, O, O, O, O, O, O,
/* Lepcha */
@@ -326,14 +325,20 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* 1CE0 */ VMAbv, VMPst, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, O, O, O, O, VMBlw, O, O,
/* 1CF0 */ O, O, VMPst, VMPst, VMAbv, O, O, O, VMAbv, VMAbv, O, O, O, O, O, O,
-#define use_offset_0x2008u 2552
+#define use_offset_0x1df8u 2552
+
+
+ /* Combining Diacritical Marks Supplement */
+ O, O, O, FM, O, O, O, O,
+
+#define use_offset_0x2008u 2560
/* General Punctuation */
O, O, O, O, ZWNJ, ZWJ, O, O,
/* 2010 */ GB, GB, GB, GB, GB, O, O, O,
-#define use_offset_0x2060u 2568
+#define use_offset_0x2060u 2576
/* 2060 */ WJ, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O,
@@ -342,12 +347,12 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* 2070 */ O, O, O, O, FM, O, O, O, O, O, O, O, O, O, O, O,
/* 2080 */ O, O, FM, FM, FM, O, O, O,
-#define use_offset_0xa800u 2608
+#define use_offset_0xa800u 2616
/* Syloti Nagri */
- /* A800 */ IV, IV, O, IV, IV, IV, VAbv, B, B, B, B, VMAbv, B, B, B, B,
+ /* A800 */ B, B, O, B, B, B, VAbv, B, B, B, B, VMAbv, B, B, B, B,
/* A810 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* A820 */ B, B, B, VPst, VPst, VBlw, VAbv, VPst, O, O, O, O, O, O, O, O,
/* A830 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O,
@@ -361,11 +366,11 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* Saurashtra */
- /* A880 */ VMPst, VMPst, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV,
- /* A890 */ IV, IV, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* A880 */ VMPst, VMPst, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* A890 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* A8A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* A8B0 */ B, B, B, B, FPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst,
- /* A8C0 */ VPst, VPst, VPst, VPst, H, O, O, O, O, O, O, O, O, O, O, O,
+ /* A8C0 */ VPst, VPst, VPst, VPst, H, VMAbv, O, O, O, O, O, O, O, O, O, O,
/* A8D0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O,
/* Devanagari Extended */
@@ -389,7 +394,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* Javanese */
- /* A980 */ VMAbv, VMAbv, FAbv, VMPst, IV, IV, IV, IV, IV, B, B, B, IV, IV, IV, B,
+ /* A980 */ VMAbv, VMAbv, FAbv, VMPst, B, B, B, B, B, B, B, B, B, B, B, B,
/* A990 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* A9A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* A9B0 */ B, B, B, CMAbv, VPst, VPst, VAbv, VAbv, VBlw, VBlw, VPre, VPre, VAbv, SUB, MPst, MPst,
@@ -403,7 +408,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* Cham */
- /* AA00 */ IV, IV, IV, IV, IV, IV, B, B, B, B, B, B, B, B, B, B,
+ /* AA00 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* AA10 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* AA20 */ B, B, B, B, B, B, B, B, B, VAbv, VAbv, VAbv, VAbv, VBlw, VAbv, VPre,
/* AA30 */ VPre, VAbv, VBlw, MPst, MPre, MBlw, MBlw, O, O, O, O, O, O, O, O, O,
@@ -413,7 +418,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* Myanmar Extended-A */
/* AA60 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
- /* AA70 */ O, B, B, B, O, O, O, O, O, O, B, VMPst, VMAbv, VMPst, B, B,
+ /* AA70 */ O, B, B, B, GB, GB, GB, O, O, O, B, VMPst, VMAbv, VMPst, B, B,
/* Tai Viet */
@@ -426,27 +431,27 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* Meetei Mayek Extensions */
- /* AAE0 */ IV, IV, B, B, B, B, B, B, B, B, B, VPre, VBlw, VAbv, VPre, VPst,
+ /* AAE0 */ B, B, B, B, B, B, B, B, B, B, B, VPre, VBlw, VAbv, VPre, VPst,
/* AAF0 */ O, O, O, O, O, VMPst, H, O,
-#define use_offset_0xabc0u 3368
+#define use_offset_0xabc0u 3376
/* Meetei Mayek */
- /* ABC0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, IV, IV,
- /* ABD0 */ B, IV, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* ABC0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* ABD0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* ABE0 */ B, B, B, VPst, VPst, VAbv, VPst, VPst, VBlw, VPst, VPst, O, VMPst, VBlw, O, O,
/* ABF0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O,
-#define use_offset_0xfe00u 3432
+#define use_offset_0xfe00u 3440
/* Variation Selectors */
/* FE00 */ VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS,
-#define use_offset_0x10a00u 3448
+#define use_offset_0x10a00u 3456
/* Kharoshthi */
@@ -457,13 +462,13 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* 10A30 */ B, B, B, B, O, O, O, O, CMAbv, CMBlw, CMBlw, O, O, O, O, H,
/* 10A40 */ B, B, B, B, B, B, B, B,
-#define use_offset_0x11000u 3520
+#define use_offset_0x11000u 3528
/* Brahmi */
- /* 11000 */ VMPst, VMAbv, VMPst, R, R, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV,
- /* 11010 */ IV, IV, IV, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* 11000 */ VMPst, VMAbv, VMPst, R, R, B, B, B, B, B, B, B, B, B, B, B,
+ /* 11010 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 11020 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 11030 */ B, B, B, B, B, B, B, B, VAbv, VAbv, VAbv, VAbv, VBlw, VBlw, VBlw, VBlw,
/* 11040 */ VBlw, VBlw, VAbv, VAbv, VAbv, VAbv, H, O, O, O, O, O, O, O, O, O,
@@ -473,17 +478,17 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* Kaithi */
- /* 11080 */ VMAbv, VMAbv, VMPst, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, B, B, B,
+ /* 11080 */ VMAbv, VMAbv, VMPst, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 11090 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 110A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 110B0 */ VPst, VPre, VPst, VBlw, VBlw, VAbv, VAbv, VPst, VPst, H, CMBlw, O, O, O, O, O,
-#define use_offset_0x11100u 3712
+#define use_offset_0x11100u 3720
/* Chakma */
- /* 11100 */ VMAbv, VMAbv, VMAbv, IV, IV, IV, IV, B, B, B, B, B, B, B, B, B,
+ /* 11100 */ VMAbv, VMAbv, VMAbv, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 11110 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 11120 */ B, B, B, B, B, B, B, VAbv, VAbv, VAbv, VBlw, VBlw, VPre, VAbv, VAbv, VAbv,
/* 11130 */ VAbv, VBlw, VBlw, H, VAbv, O, B, B, B, B, B, B, B, B, B, B,
@@ -497,8 +502,8 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* Sharada */
- /* 11180 */ VMAbv, VMAbv, VMPst, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV,
- /* 11190 */ IV, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* 11180 */ VMAbv, VMAbv, VMPst, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* 11190 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 111A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 111B0 */ B, B, B, VPst, VPre, VPst, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VAbv, VAbv, VAbv, VAbv,
/* 111C0 */ H, B, R, R, O, O, O, O, O, O, CMBlw, VAbv, VBlw, O, O, O,
@@ -511,23 +516,23 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* Khojki */
- /* 11200 */ IV, IV, IV, IV, IV, IV, IV, IV, B, B, B, B, B, B, B, B,
+ /* 11200 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 11210 */ B, B, O, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 11220 */ B, B, B, B, B, B, B, B, B, B, B, B, VPst, VPst, VPst, VBlw,
- /* 11230 */ VAbv, VAbv, VAbv, VAbv, VMAbv, H, CMAbv, CMAbv,
+ /* 11230 */ VAbv, VAbv, VAbv, VAbv, VMAbv, H, CMAbv, CMAbv, O, O, O, O, O, O, VMAbv, O,
-#define use_offset_0x11280u 4024
+#define use_offset_0x11280u 4040
/* Multani */
- /* 11280 */ IV, IV, IV, IV, B, B, B, O, B, O, B, B, B, B, O, B,
+ /* 11280 */ B, B, B, B, B, B, B, O, B, O, B, B, B, B, O, B,
/* 11290 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, O, B,
/* 112A0 */ B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, O,
/* Khudawadi */
- /* 112B0 */ IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, B, B, B, B, B, B,
+ /* 112B0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 112C0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 112D0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, VMAbv,
/* 112E0 */ VPst, VPre, VPst, VBlw, VBlw, VAbv, VAbv, VAbv, VAbv, CMBlw, VBlw, O, O, O, O, O,
@@ -535,44 +540,55 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* Grantha */
- /* 11300 */ VMAbv, VMAbv, VMPst, VMPst, O, IV, IV, IV, IV, IV, IV, IV, IV, O, O, IV,
- /* 11310 */ IV, O, O, IV, IV, B, B, B, B, B, B, B, B, B, B, B,
+ /* 11300 */ VMAbv, VMAbv, VMPst, VMPst, O, B, B, B, B, B, B, B, B, O, O, B,
+ /* 11310 */ B, O, O, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 11320 */ B, B, B, B, B, B, B, B, B, O, B, B, B, B, B, B,
/* 11330 */ B, O, B, B, O, B, B, B, B, B, O, O, CMBlw, B, VPst, VPst,
/* 11340 */ VAbv, VPst, VPst, VPst, VPst, O, O, VPre, VPre, O, O, VPre, VPre, H, O, O,
/* 11350 */ O, O, O, O, O, O, O, VPst, O, O, O, O, O, O, O, O,
- /* 11360 */ IV, IV, VPst, VPst, O, O, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, O, O,
+ /* 11360 */ B, B, VPst, VPst, O, O, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, O, O,
/* 11370 */ VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, O, O,
-#define use_offset_0x11480u 4272
+#define use_offset_0x11400u 4288
+ /* Newa */
+
+ /* 11400 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* 11410 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* 11420 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* 11430 */ B, B, B, B, B, VPst, VPre, VPst, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VAbv, VAbv,
+ /* 11440 */ VPst, VPst, H, VMAbv, VMAbv, VMPst, CMBlw, B, O, O, O, O, O, O, O, O,
+ /* 11450 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O,
+ /* 11460 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O,
+ /* 11470 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O,
+
/* Tirhuta */
- /* 11480 */ O, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, B,
+ /* 11480 */ O, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 11490 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 114A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 114B0 */ VPst, VPre, VPst, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VPre, VAbv, VPre, VPre, VPst, VPre, VMAbv,
/* 114C0 */ VMAbv, VMPst, H, CMBlw, B, O, O, O, O, O, O, O, O, O, O, O,
/* 114D0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O,
-#define use_offset_0x11580u 4368
+#define use_offset_0x11580u 4512
/* Siddham */
- /* 11580 */ IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, B, B,
+ /* 11580 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 11590 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 115A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, VPst,
/* 115B0 */ VPre, VPst, VBlw, VBlw, VBlw, VBlw, O, O, VPre, VPre, VPre, VPre, VMAbv, VMAbv, VMPst, H,
/* 115C0 */ CMBlw, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O,
- /* 115D0 */ O, O, O, O, O, O, O, O, IV, IV, IV, IV, VBlw, VBlw, O, O,
+ /* 115D0 */ O, O, O, O, O, O, O, O, B, B, B, B, VBlw, VBlw, O, O,
/* 115E0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O,
/* 115F0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O,
/* Modi */
- /* 11600 */ IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, B, B,
+ /* 11600 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 11610 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 11620 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 11630 */ VPst, VPst, VPst, VBlw, VBlw, VBlw, VBlw, VBlw, VBlw, VAbv, VAbv, VPst, VPst, VMAbv, VMPst, H,
@@ -583,7 +599,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* Takri */
- /* 11680 */ IV, IV, IV, IV, IV, IV, IV, IV, IV, IV, B, B, B, B, B, B,
+ /* 11680 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 11690 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 116A0 */ B, B, B, B, B, B, B, B, B, B, B, VMAbv, VMPst, VAbv, VPre, VPst,
/* 116B0 */ VBlw, VBlw, VAbv, VAbv, VAbv, VAbv, H, CMBlw, O, O, O, O, O, O, O, O,
@@ -599,7 +615,28 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* 11720 */ VPst, VPst, VAbv, VAbv, VBlw, VBlw, VPre, VAbv, VBlw, VAbv, VAbv, VAbv, O, O, O, O,
/* 11730 */ B, B, B, B, B, B, B, B, B, B, B, B, O, O, O, O,
-}; /* Table items: 4816; occupancy: 72% */
+#define use_offset_0x11c00u 4960
+
+
+ /* Bhaiksuki */
+
+ /* 11C00 */ B, B, B, B, B, B, B, B, B, O, B, B, B, B, B, B,
+ /* 11C10 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* 11C20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, VPst,
+ /* 11C30 */ VAbv, VAbv, VBlw, VBlw, VBlw, VBlw, VBlw, O, VAbv, VAbv, VAbv, VAbv, VMAbv, VMAbv, VMPst, H,
+ /* 11C40 */ B, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O,
+ /* 11C50 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* 11C60 */ B, B, B, B, B, B, B, B, B, B, B, B, B, O, O, O,
+
+ /* Marchen */
+
+ /* 11C70 */ O, O, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* 11C80 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* 11C90 */ O, O, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB,
+ /* 11CA0 */ SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, O, SUB, SUB, SUB, SUB, SUB, SUB, SUB,
+ /* 11CB0 */ VBlw, VPre, VBlw, VAbv, VPst, VMAbv, VMAbv, O,
+
+}; /* Table items: 5144; occupancy: 72% */
USE_TABLE_ELEMENT_TYPE
hb_use_get_categories (hb_codepoint_t u)
@@ -619,6 +656,7 @@ hb_use_get_categories (hb_codepoint_t u)
if (hb_in_range (u, 0x1900u, 0x1A9Fu)) return use_table[u - 0x1900u + use_offset_0x1900u];
if (hb_in_range (u, 0x1B00u, 0x1C4Fu)) return use_table[u - 0x1B00u + use_offset_0x1b00u];
if (hb_in_range (u, 0x1CD0u, 0x1CFFu)) return use_table[u - 0x1CD0u + use_offset_0x1cd0u];
+ if (hb_in_range (u, 0x1DF8u, 0x1DFFu)) return use_table[u - 0x1DF8u + use_offset_0x1df8u];
break;
case 0x2u:
@@ -642,10 +680,11 @@ hb_use_get_categories (hb_codepoint_t u)
case 0x11u:
if (hb_in_range (u, 0x11000u, 0x110BFu)) return use_table[u - 0x11000u + use_offset_0x11000u];
- if (hb_in_range (u, 0x11100u, 0x11237u)) return use_table[u - 0x11100u + use_offset_0x11100u];
+ if (hb_in_range (u, 0x11100u, 0x1123Fu)) return use_table[u - 0x11100u + use_offset_0x11100u];
if (hb_in_range (u, 0x11280u, 0x11377u)) return use_table[u - 0x11280u + use_offset_0x11280u];
- if (hb_in_range (u, 0x11480u, 0x114DFu)) return use_table[u - 0x11480u + use_offset_0x11480u];
+ if (hb_in_range (u, 0x11400u, 0x114DFu)) return use_table[u - 0x11400u + use_offset_0x11400u];
if (hb_in_range (u, 0x11580u, 0x1173Fu)) return use_table[u - 0x11580u + use_offset_0x11580u];
+ if (hb_in_range (u, 0x11C00u, 0x11CB7u)) return use_table[u - 0x11C00u + use_offset_0x11c00u];
if (unlikely (u == 0x1107Fu)) return HN;
break;
@@ -662,7 +701,6 @@ hb_use_get_categories (hb_codepoint_t u)
#undef H
#undef HN
#undef IND
-#undef IV
#undef N
#undef O
#undef R
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use.cc
index 779a9cb1d0..5b19d5d74a 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use.cc
@@ -184,6 +184,9 @@ has_arabic_joining (hb_script_t script)
case HB_SCRIPT_MANICHAEAN:
case HB_SCRIPT_PSALTER_PAHLAVI:
+ /* Unicode-9.0 additions */
+ case HB_SCRIPT_ADLAM:
+
return true;
default:
@@ -227,12 +230,12 @@ data_destroy_use (void *data)
enum syllable_type_t {
independent_cluster,
virama_terminated_cluster,
- consonant_cluster,
- vowel_cluster,
+ standard_cluster,
number_joiner_terminated_cluster,
numeral_cluster,
symbol_cluster,
broken_cluster,
+ non_cluster,
};
#include "hb-ot-shape-complex-use-machine.hh"
@@ -285,6 +288,9 @@ static void
setup_topographical_masks (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer)
{
+ const use_shape_plan_t *use_plan = (const use_shape_plan_t *) plan->data;
+ if (use_plan->arabic_plan)
+ return;
ASSERT_STATIC (INIT < 4 && ISOL < 4 && MEDI < 4 && FINA < 4);
hb_mask_t masks[4], all_masks = 0;
@@ -309,13 +315,13 @@ setup_topographical_masks (const hb_ot_shape_plan_t *plan,
{
case independent_cluster:
case symbol_cluster:
+ case non_cluster:
/* These don't join. Nothing to do. */
last_form = _NONE;
break;
case virama_terminated_cluster:
- case consonant_cluster:
- case vowel_cluster:
+ case standard_cluster:
case number_joiner_terminated_cluster:
case numeral_cluster:
case broken_cluster:
@@ -360,7 +366,7 @@ clear_substitution_flags (const hb_ot_shape_plan_t *plan,
hb_glyph_info_t *info = buffer->info;
unsigned int count = buffer->len;
for (unsigned int i = 0; i < count; i++)
- _hb_glyph_info_clear_substituted_and_ligated_and_multiplied (&info[i]);
+ _hb_glyph_info_clear_substituted (&info[i]);
}
static void
@@ -405,6 +411,12 @@ record_pref (const hb_ot_shape_plan_t *plan,
}
}
+static inline bool
+is_halant (const hb_glyph_info_t &info)
+{
+ return info.use_category() == USE_H && !_hb_glyph_info_ligated (&info);
+}
+
static void
reorder_syllable (hb_buffer_t *buffer, unsigned int start, unsigned int end)
{
@@ -412,28 +424,26 @@ reorder_syllable (hb_buffer_t *buffer, unsigned int start, unsigned int end)
/* Only a few syllable types need reordering. */
if (unlikely (!(FLAG_SAFE (syllable_type) &
(FLAG (virama_terminated_cluster) |
- FLAG (consonant_cluster) |
- FLAG (vowel_cluster) |
+ FLAG (standard_cluster) |
FLAG (broken_cluster) |
0))))
return;
hb_glyph_info_t *info = buffer->info;
-#define HALANT_FLAGS FLAG(USE_H)
-#define BASE_FLAGS (FLAG (USE_B) | FLAG (USE_GB) | FLAG (USE_IV))
+#define BASE_FLAGS (FLAG (USE_B) | FLAG (USE_GB))
/* Move things forward. */
if (info[start].use_category() == USE_R && end - start > 1)
{
/* Got a repha. Reorder it to after first base, before first halant. */
for (unsigned int i = start + 1; i < end; i++)
- if (FLAG_UNSAFE (info[i].use_category()) & (HALANT_FLAGS | BASE_FLAGS))
+ if ((FLAG_UNSAFE (info[i].use_category()) & (BASE_FLAGS)) || is_halant (info[i]))
{
/* If we hit a halant, move before it; otherwise it's a base: move to it's
* place, and shift things in between backward. */
- if (info[i].use_category() == USE_H)
+ if (is_halant (info[i]))
i--;
buffer->merge_clusters (start, i + 1);
@@ -450,11 +460,11 @@ reorder_syllable (hb_buffer_t *buffer, unsigned int start, unsigned int end)
for (unsigned int i = start; i < end; i++)
{
uint32_t flag = FLAG_UNSAFE (info[i].use_category());
- if (flag & (HALANT_FLAGS | BASE_FLAGS))
+ if ((flag & (BASE_FLAGS)) || is_halant (info[i]))
{
- /* If we hit a halant, move before it; otherwise it's a base: move to it's
+ /* If we hit a halant, move after it; otherwise it's a base: move to it's
* place, and shift things in between backward. */
- if (info[i].use_category() == USE_H)
+ if (is_halant (info[i]))
j = i + 1;
else
j = i;
@@ -490,22 +500,16 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED,
if (likely (!has_broken_syllables))
return;
-
- hb_codepoint_t dottedcircle_glyph;
- if (!font->get_glyph (0x25CCu, 0, &dottedcircle_glyph))
- return;
-
hb_glyph_info_t dottedcircle = {0};
- if (!font->get_glyph (0x25CCu, 0, &dottedcircle.codepoint))
+ if (!font->get_nominal_glyph (0x25CCu, &dottedcircle.codepoint))
return;
dottedcircle.use_category() = hb_use_get_categories (0x25CC);
buffer->clear_output ();
buffer->idx = 0;
-
unsigned int last_syllable = 0;
- while (buffer->idx < buffer->len)
+ while (buffer->idx < buffer->len && !buffer->in_error)
{
unsigned int syllable = buffer->cur().syllable();
syllable_type_t syllable_type = (syllable_type_t) (syllable & 0x0F);
@@ -520,7 +524,7 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED,
/* TODO Set glyph_props? */
/* Insert dottedcircle after possible Repha. */
- while (buffer->idx < buffer->len &&
+ while (buffer->idx < buffer->len && !buffer->in_error &&
last_syllable == buffer->cur().syllable() &&
buffer->cur().use_category() == USE_R)
buffer->next_glyph ();
@@ -555,6 +559,47 @@ reorder (const hb_ot_shape_plan_t *plan,
}
static bool
+decompose_use (const hb_ot_shape_normalize_context_t *c,
+ hb_codepoint_t ab,
+ hb_codepoint_t *a,
+ hb_codepoint_t *b)
+{
+ switch (ab)
+ {
+ /* Chakma:
+ * Special case where the Unicode decomp gives matras in the wrong order
+ * for cluster validation.
+ */
+ case 0x1112Eu : *a = 0x11127u; *b= 0x11131u; return true;
+ case 0x1112Fu : *a = 0x11127u; *b= 0x11132u; return true;
+
+ /*
+ * Decompose split matras that don't have Unicode decompositions.
+ */
+
+ /* Limbu */
+ case 0x1925u : *a = 0x1920u; *b= 0x1923u; return true;
+ case 0x1926u : *a = 0x1920u; *b= 0x1924u; return true;
+
+ /* Balinese */
+ case 0x1B3Cu : *a = 0x1B42u; *b= 0x1B3Cu; return true;
+
+#if 0
+ /* Lepcha */
+ case 0x1C29u : *a = no decomp, -> LEFT; return true;
+
+ /* Javanese */
+ case 0xA9C0u : *a = no decomp, -> RIGHT; return true;
+
+ /* Sharada */
+ case 0x111BFu : *a = no decomp, -> ABOVE; return true;
+#endif
+ }
+
+ return (bool) c->unicode->decompose (ab, a, b);
+}
+
+static bool
compose_use (const hb_ot_shape_normalize_context_t *c,
hb_codepoint_t a,
hb_codepoint_t b,
@@ -564,7 +609,7 @@ compose_use (const hb_ot_shape_normalize_context_t *c,
if (HB_UNICODE_GENERAL_CATEGORY_IS_MARK (c->unicode->general_category (a)))
return false;
- return c->unicode->compose (a, b, ab);
+ return (bool)c->unicode->compose (a, b, ab);
}
@@ -576,10 +621,12 @@ const hb_ot_complex_shaper_t _hb_ot_complex_shaper_use =
data_create_use,
data_destroy_use,
NULL, /* preprocess_text */
+ NULL, /* postprocess_glyphs */
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT,
- NULL, /* decompose */
+ decompose_use,
compose_use,
setup_masks_use,
- HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
+ NULL, /* disable_otl */
+ HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
false, /* fallback_position */
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-fallback-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-fallback-private.hh
index ec653513f1..e134224df9 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-fallback-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-fallback-private.hh
@@ -45,5 +45,9 @@ HB_INTERNAL void _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan,
hb_font_t *font,
hb_buffer_t *buffer);
+HB_INTERNAL void _hb_ot_shape_fallback_spaces (const hb_ot_shape_plan_t *plan,
+ hb_font_t *font,
+ hb_buffer_t *buffer);
+
#endif /* HB_OT_SHAPE_FALLBACK_PRIVATE_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-fallback.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-fallback.cc
index 3cb3456f1a..ea8312b223 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-fallback.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-fallback.cc
@@ -484,3 +484,70 @@ _hb_ot_shape_fallback_kern (const hb_ot_shape_plan_t *plan,
idx = skippy_iter.idx;
}
}
+
+
+/* Adjusts width of various spaces. */
+void
+_hb_ot_shape_fallback_spaces (const hb_ot_shape_plan_t *plan,
+ hb_font_t *font,
+ hb_buffer_t *buffer)
+{
+ if (!HB_DIRECTION_IS_HORIZONTAL (buffer->props.direction))
+ return;
+
+ hb_glyph_info_t *info = buffer->info;
+ hb_glyph_position_t *pos = buffer->pos;
+ unsigned int count = buffer->len;
+ for (unsigned int i = 0; i < count; i++)
+ if (_hb_glyph_info_is_unicode_space (&info[i]) && !_hb_glyph_info_ligated (&info[i]))
+ {
+ hb_unicode_funcs_t::space_t space_type = _hb_glyph_info_get_unicode_space_fallback_type (&info[i]);
+ hb_codepoint_t glyph;
+ typedef hb_unicode_funcs_t t;
+ switch (space_type)
+ {
+ case t::NOT_SPACE: /* Shouldn't happen. */
+ case t::SPACE:
+ break;
+
+ case t::SPACE_EM:
+ case t::SPACE_EM_2:
+ case t::SPACE_EM_3:
+ case t::SPACE_EM_4:
+ case t::SPACE_EM_5:
+ case t::SPACE_EM_6:
+ case t::SPACE_EM_16:
+ pos[i].x_advance = (font->x_scale + ((int) space_type)/2) / (int) space_type;
+ break;
+
+ case t::SPACE_4_EM_18:
+ pos[i].x_advance = font->x_scale * 4 / 18;
+ break;
+
+ case t::SPACE_FIGURE:
+ for (char u = '0'; u <= '9'; u++)
+ if (font->get_nominal_glyph (u, &glyph))
+ {
+ pos[i].x_advance = font->get_glyph_h_advance (glyph);
+ break;
+ }
+ break;
+
+ case t::SPACE_PUNCTUATION:
+ if (font->get_nominal_glyph ('.', &glyph))
+ pos[i].x_advance = font->get_glyph_h_advance (glyph);
+ else if (font->get_nominal_glyph (',', &glyph))
+ pos[i].x_advance = font->get_glyph_h_advance (glyph);
+ break;
+
+ case t::SPACE_NARROW:
+ /* Half-space?
+ * Unicode doc http://www.unicode.org/charts/PDF/U2000.pdf says ~1/4 or 1/5 of EM.
+ * However, in my testing, many fonts have their regular space being about that
+ * size. To me, a percentage of the space width makes more sense. Half is as
+ * good as any. */
+ pos[i].x_advance /= 2;
+ break;
+ }
+ }
+}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-normalize.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-normalize.cc
index 0a4d40499f..107617e81c 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-normalize.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-normalize.cc
@@ -76,7 +76,7 @@ decompose_unicode (const hb_ot_shape_normalize_context_t *c,
hb_codepoint_t *a,
hb_codepoint_t *b)
{
- return c->unicode->decompose (ab, a, b);
+ return (bool) c->unicode->decompose (ab, a, b);
}
static bool
@@ -85,21 +85,21 @@ compose_unicode (const hb_ot_shape_normalize_context_t *c,
hb_codepoint_t b,
hb_codepoint_t *ab)
{
- return c->unicode->compose (a, b, ab);
+ return (bool) c->unicode->compose (a, b, ab);
}
static inline void
set_glyph (hb_glyph_info_t &info, hb_font_t *font)
{
- font->get_glyph (info.codepoint, 0, &info.glyph_index());
+ font->get_nominal_glyph (info.codepoint, &info.glyph_index());
}
static inline void
output_char (hb_buffer_t *buffer, hb_codepoint_t unichar, hb_codepoint_t glyph)
{
buffer->cur().glyph_index() = glyph;
- buffer->output_glyph (unichar);
- _hb_glyph_info_set_unicode_props (&buffer->prev(), buffer->unicode);
+ buffer->output_glyph (unichar); /* This is very confusing indeed. */
+ _hb_glyph_info_set_unicode_props (&buffer->prev(), buffer);
}
static inline void
@@ -124,10 +124,10 @@ decompose (const hb_ot_shape_normalize_context_t *c, bool shortest, hb_codepoint
hb_font_t * const font = c->font;
if (!c->decompose (c, ab, &a, &b) ||
- (b && !font->get_glyph (b, 0, &b_glyph)))
+ (b && !font->get_nominal_glyph (b, &b_glyph)))
return 0;
- bool has_a = font->get_glyph (a, 0, &a_glyph);
+ bool has_a = (bool) font->get_nominal_glyph (a, &a_glyph);
if (shortest && has_a) {
/* Output a and b */
output_char (buffer, a, a_glyph);
@@ -166,15 +166,50 @@ decompose_current_character (const hb_ot_shape_normalize_context_t *c, bool shor
hb_codepoint_t u = buffer->cur().codepoint;
hb_codepoint_t glyph;
- /* Kind of a cute waterfall here... */
- if (shortest && c->font->get_glyph (u, 0, &glyph))
+ if (shortest && c->font->get_nominal_glyph (u, &glyph))
+ {
next_char (buffer, glyph);
- else if (decompose (c, shortest, u))
+ return;
+ }
+
+ if (decompose (c, shortest, u))
+ {
skip_char (buffer);
- else if (!shortest && c->font->get_glyph (u, 0, &glyph))
+ return;
+ }
+
+ if (!shortest && c->font->get_nominal_glyph (u, &glyph))
+ {
next_char (buffer, glyph);
- else
- next_char (buffer, glyph); /* glyph is initialized in earlier branches. */
+ return;
+ }
+
+ if (_hb_glyph_info_is_unicode_space (&buffer->cur()))
+ {
+ hb_codepoint_t space_glyph;
+ hb_unicode_funcs_t::space_t space_type = buffer->unicode->space_fallback_type (u);
+ if (space_type != hb_unicode_funcs_t::NOT_SPACE && c->font->get_nominal_glyph (0x0020u, &space_glyph))
+ {
+ _hb_glyph_info_set_unicode_space_fallback_type (&buffer->cur(), space_type);
+ next_char (buffer, space_glyph);
+ buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK;
+ return;
+ }
+ }
+
+ if (u == 0x2011u)
+ {
+ /* U+2011 is the only sensible character that is a no-break version of another character
+ * and not a space. The space ones are handled already. Handle this lone one. */
+ hb_codepoint_t other_glyph;
+ if (c->font->get_nominal_glyph (0x2010u, &other_glyph))
+ {
+ next_char (buffer, other_glyph);
+ return;
+ }
+ }
+
+ next_char (buffer, glyph); /* glyph is initialized in earlier branches. */
}
static inline void
@@ -183,10 +218,10 @@ handle_variation_selector_cluster (const hb_ot_shape_normalize_context_t *c, uns
/* TODO Currently if there's a variation-selector we give-up, it's just too hard. */
hb_buffer_t * const buffer = c->buffer;
hb_font_t * const font = c->font;
- for (; buffer->idx < end - 1;) {
+ for (; buffer->idx < end - 1 && !buffer->in_error;) {
if (unlikely (buffer->unicode->is_variation_selector (buffer->cur(+1).codepoint))) {
/* The next two lines are some ugly lines... But work. */
- if (font->get_glyph (buffer->cur().codepoint, buffer->cur(+1).codepoint, &buffer->cur().glyph_index()))
+ if (font->get_variation_glyph (buffer->cur().codepoint, buffer->cur(+1).codepoint, &buffer->cur().glyph_index()))
{
buffer->replace_glyphs (2, 1, &buffer->cur().codepoint);
}
@@ -219,13 +254,13 @@ static inline void
decompose_multi_char_cluster (const hb_ot_shape_normalize_context_t *c, unsigned int end, bool short_circuit)
{
hb_buffer_t * const buffer = c->buffer;
- for (unsigned int i = buffer->idx; i < end; i++)
+ for (unsigned int i = buffer->idx; i < end && !buffer->in_error; i++)
if (unlikely (buffer->unicode->is_variation_selector (buffer->info[i].codepoint))) {
handle_variation_selector_cluster (c, end, short_circuit);
return;
}
- while (buffer->idx < end)
+ while (buffer->idx < end && !buffer->in_error)
decompose_current_character (c, short_circuit);
}
@@ -285,7 +320,7 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
buffer->clear_output ();
count = buffer->len;
- for (buffer->idx = 0; buffer->idx < count;)
+ for (buffer->idx = 0; buffer->idx < count && !buffer->in_error;)
{
unsigned int end;
for (end = buffer->idx + 1; end < count; end++)
@@ -335,7 +370,7 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
count = buffer->len;
unsigned int starter = 0;
buffer->next_glyph ();
- while (buffer->idx < count)
+ while (buffer->idx < count && !buffer->in_error)
{
hb_codepoint_t composed, glyph;
if (/* We don't try to compose a non-mark character with it's preceding starter.
@@ -353,7 +388,7 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
buffer->cur().codepoint,
&composed) &&
/* And the font has glyph for the composite. */
- font->get_glyph (composed, 0, &glyph))
+ font->get_nominal_glyph (composed, &glyph))
{
/* Composes. */
buffer->next_glyph (); /* Copy to out-buffer. */
@@ -364,7 +399,7 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
/* Modify starter and carry on. */
buffer->out_info[starter].codepoint = composed;
buffer->out_info[starter].glyph_index() = glyph;
- _hb_glyph_info_set_unicode_props (&buffer->out_info[starter], buffer->unicode);
+ _hb_glyph_info_set_unicode_props (&buffer->out_info[starter], buffer);
continue;
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-private.hh
index 54ac2c3cf7..594e54c026 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-private.hh
@@ -77,11 +77,13 @@ struct hb_ot_shape_planner_t
map (face, &props) {}
~hb_ot_shape_planner_t (void) { map.finish (); }
- inline void compile (hb_ot_shape_plan_t &plan)
+ inline void compile (hb_ot_shape_plan_t &plan,
+ const int *coords,
+ unsigned int num_coords)
{
plan.props = props;
plan.shaper = shaper;
- map.compile (plan.map);
+ map.compile (plan.map, coords, num_coords);
plan.rtlm_mask = plan.map.get_1_mask (HB_TAG ('r','t','l','m'));
plan.frac_mask = plan.map.get_1_mask (HB_TAG ('f','r','a','c'));
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape.cc
index 40332d69f1..ddd6662e84 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape.cc
@@ -69,6 +69,9 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
{
hb_ot_map_builder_t *map = &planner->map;
+ map->add_global_bool_feature (HB_TAG('r','v','r','n'));
+ map->add_gsub_pause (NULL);
+
switch (props->direction) {
case HB_DIRECTION_LTR:
map->add_global_bool_feature (HB_TAG ('l','t','r','a'));
@@ -145,7 +148,7 @@ _hb_ot_shaper_face_data_destroy (hb_ot_shaper_face_data_t *data)
struct hb_ot_shaper_font_data_t {};
hb_ot_shaper_font_data_t *
-_hb_ot_shaper_font_data_create (hb_font_t *font)
+_hb_ot_shaper_font_data_create (hb_font_t *font HB_UNUSED)
{
return (hb_ot_shaper_font_data_t *) HB_SHAPER_DATA_SUCCEEDED;
}
@@ -163,7 +166,9 @@ _hb_ot_shaper_font_data_destroy (hb_ot_shaper_font_data_t *data)
hb_ot_shaper_shape_plan_data_t *
_hb_ot_shaper_shape_plan_data_create (hb_shape_plan_t *shape_plan,
const hb_feature_t *user_features,
- unsigned int num_user_features)
+ unsigned int num_user_features,
+ const int *coords,
+ unsigned int num_coords)
{
hb_ot_shape_plan_t *plan = (hb_ot_shape_plan_t *) calloc (1, sizeof (hb_ot_shape_plan_t));
if (unlikely (!plan))
@@ -173,9 +178,10 @@ _hb_ot_shaper_shape_plan_data_create (hb_shape_plan_t *shape_plan,
planner.shaper = hb_ot_shape_complex_categorize (&planner);
- hb_ot_shape_collect_features (&planner, &shape_plan->props, user_features, num_user_features);
+ hb_ot_shape_collect_features (&planner, &shape_plan->props,
+ user_features, num_user_features);
- planner.compile (*plan);
+ planner.compile (*plan, coords, num_coords);
if (plan->shaper->data_create) {
plan->data = plan->shaper->data_create (plan);
@@ -212,6 +218,8 @@ struct hb_ot_shape_context_t
unsigned int num_user_features;
/* Transient stuff */
+ bool fallback_positioning;
+ bool fallback_glyph_classes;
hb_direction_t target_direction;
};
@@ -228,7 +236,7 @@ hb_set_unicode_props (hb_buffer_t *buffer)
unsigned int count = buffer->len;
hb_glyph_info_t *info = buffer->info;
for (unsigned int i = 0; i < count; i++)
- _hb_glyph_info_set_unicode_props (&info[i], buffer->unicode);
+ _hb_glyph_info_set_unicode_props (&info[i], buffer);
}
static void
@@ -245,7 +253,7 @@ hb_insert_dotted_circle (hb_buffer_t *buffer, hb_font_t *font)
hb_glyph_info_t dottedcircle = {0};
dottedcircle.codepoint = 0x25CCu;
- _hb_glyph_info_set_unicode_props (&dottedcircle, buffer->unicode);
+ _hb_glyph_info_set_unicode_props (&dottedcircle, buffer);
buffer->clear_output ();
@@ -254,7 +262,7 @@ hb_insert_dotted_circle (hb_buffer_t *buffer, hb_font_t *font)
info.cluster = buffer->cur().cluster;
info.mask = buffer->cur().mask;
buffer->output_info (info);
- while (buffer->idx < buffer->len)
+ while (buffer->idx < buffer->len && !buffer->in_error)
buffer->next_glyph ();
buffer->swap_buffers ();
@@ -263,16 +271,18 @@ hb_insert_dotted_circle (hb_buffer_t *buffer, hb_font_t *font)
static void
hb_form_clusters (hb_buffer_t *buffer)
{
- if (buffer->cluster_level != HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES)
+ if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII) ||
+ buffer->cluster_level != HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES)
return;
- /* Loop duplicated in hb_ensure_native_direction(). */
+ /* Loop duplicated in hb_ensure_native_direction(), and in _hb-coretext.cc */
unsigned int base = 0;
unsigned int count = buffer->len;
hb_glyph_info_t *info = buffer->info;
for (unsigned int i = 1; i < count; i++)
{
- if (likely (!HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&info[i]))))
+ if (likely (!HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&info[i])) &&
+ !_hb_glyph_info_is_joiner (&info[i])))
{
buffer->merge_clusters (base, i);
base = i;
@@ -346,7 +356,8 @@ hb_ot_mirror_chars (hb_ot_shape_context_t *c)
static inline void
hb_ot_shape_setup_masks_fraction (hb_ot_shape_context_t *c)
{
- if (!c->plan->has_frac)
+ if (!(c->buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII) ||
+ !c->plan->has_frac)
return;
hb_buffer_t *buffer = c->buffer;
@@ -416,7 +427,8 @@ hb_ot_zero_width_default_ignorables (hb_ot_shape_context_t *c)
{
hb_buffer_t *buffer = c->buffer;
- if (buffer->flags & HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES)
+ if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES) ||
+ (buffer->flags & HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES))
return;
unsigned int count = buffer->len;
@@ -433,7 +445,8 @@ hb_ot_hide_default_ignorables (hb_ot_shape_context_t *c)
{
hb_buffer_t *buffer = c->buffer;
- if (buffer->flags & HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES)
+ if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES) ||
+ (buffer->flags & HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES))
return;
unsigned int count = buffer->len;
@@ -451,7 +464,7 @@ hb_ot_hide_default_ignorables (hb_ot_shape_context_t *c)
return;
hb_codepoint_t space;
- if (c->font->get_glyph (' ', 0, &space))
+ if (c->font->get_nominal_glyph (' ', &space))
{
/* Replace default-ignorables with a zero-advance space glyph. */
for (/*continue*/; i < count; i++)
@@ -525,7 +538,7 @@ hb_synthesize_glyph_classes (hb_ot_shape_context_t *c)
hb_glyph_info_t *info = c->buffer->info;
for (unsigned int i = 0; i < count; i++)
{
- hb_ot_layout_glyph_class_mask_t klass;
+ hb_ot_layout_glyph_props_flags_t klass;
/* Never mark default-ignorables as marks.
* They won't get in the way of lookups anyway,
@@ -549,9 +562,6 @@ hb_ot_substitute_default (hb_ot_shape_context_t *c)
{
hb_buffer_t *buffer = c->buffer;
- if (c->plan->shaper->preprocess_text)
- c->plan->shaper->preprocess_text (c->plan, buffer, c->font);
-
hb_ot_shape_initialize_masks (c);
hb_ot_mirror_chars (c);
@@ -563,7 +573,7 @@ hb_ot_substitute_default (hb_ot_shape_context_t *c)
hb_ot_shape_setup_masks (c);
/* This is unfortunate to go here, but necessary... */
- if (!hb_ot_layout_has_positioning (c->face))
+ if (c->fallback_positioning)
_hb_ot_shape_fallback_position_recategorize_marks (c->plan, c->font, buffer);
hb_ot_map_glyphs_fast (buffer);
@@ -576,7 +586,6 @@ hb_ot_substitute_complex (hb_ot_shape_context_t *c)
{
hb_buffer_t *buffer = c->buffer;
- _hb_buffer_allocate_gsubgpos_vars (buffer);
hb_ot_layout_substitute_start (c->font, buffer);
if (!hb_ot_layout_has_glyph_classes (c->face))
@@ -584,8 +593,6 @@ hb_ot_substitute_complex (hb_ot_shape_context_t *c)
c->plan->substitute (c->font, buffer);
- hb_ot_layout_substitute_finish (c->font, buffer);
-
return;
}
@@ -593,6 +600,9 @@ static inline void
hb_ot_substitute (hb_ot_shape_context_t *c)
{
hb_ot_substitute_default (c);
+
+ _hb_buffer_allocate_gsubgpos_vars (c->buffer);
+
hb_ot_substitute_complex (c);
}
@@ -613,20 +623,6 @@ zero_mark_width (hb_glyph_position_t *pos)
}
static inline void
-zero_mark_widths_by_unicode (hb_buffer_t *buffer, bool adjust_offsets)
-{
- unsigned int count = buffer->len;
- hb_glyph_info_t *info = buffer->info;
- for (unsigned int i = 0; i < count; i++)
- if (_hb_glyph_info_get_general_category (&info[i]) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
- {
- if (adjust_offsets)
- adjust_mark_offsets (&buffer->pos[i]);
- zero_mark_width (&buffer->pos[i]);
- }
-}
-
-static inline void
zero_mark_widths_by_gdef (hb_buffer_t *buffer, bool adjust_offsets)
{
unsigned int count = buffer->len;
@@ -647,26 +643,39 @@ hb_ot_position_default (hb_ot_shape_context_t *c)
unsigned int count = c->buffer->len;
hb_glyph_info_t *info = c->buffer->info;
hb_glyph_position_t *pos = c->buffer->pos;
- for (unsigned int i = 0; i < count; i++)
- {
- c->font->get_glyph_advance_for_direction (info[i].codepoint,
- direction,
- &pos[i].x_advance,
- &pos[i].y_advance);
- c->font->subtract_glyph_origin_for_direction (info[i].codepoint,
- direction,
- &pos[i].x_offset,
- &pos[i].y_offset);
+ if (HB_DIRECTION_IS_HORIZONTAL (direction))
+ {
+ for (unsigned int i = 0; i < count; i++)
+ pos[i].x_advance = c->font->get_glyph_h_advance (info[i].codepoint);
+ /* The nil glyph_h_origin() func returns 0, so no need to apply it. */
+ if (c->font->has_glyph_h_origin_func ())
+ for (unsigned int i = 0; i < count; i++)
+ c->font->subtract_glyph_h_origin (info[i].codepoint,
+ &pos[i].x_offset,
+ &pos[i].y_offset);
}
+ else
+ {
+ for (unsigned int i = 0; i < count; i++)
+ {
+ pos[i].y_advance = c->font->get_glyph_v_advance (info[i].codepoint);
+ c->font->subtract_glyph_v_origin (info[i].codepoint,
+ &pos[i].x_offset,
+ &pos[i].y_offset);
+ }
+ }
+ if (c->buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK)
+ _hb_ot_shape_fallback_spaces (c->plan, c->font, c->buffer);
}
-static inline bool
+static inline void
hb_ot_position_complex (hb_ot_shape_context_t *c)
{
- bool ret = false;
+ hb_ot_layout_position_start (c->font, c->buffer);
+
unsigned int count = c->buffer->len;
- bool has_positioning = hb_ot_layout_has_positioning (c->face);
+
/* If the font has no GPOS, AND, no fallback positioning will
* happen, AND, direction is forward, then when zeroing mark
* widths, we shift the mark with it, such that the mark
@@ -676,8 +685,9 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
* If fallback positinoing happens or GPOS is present, we don't
* care.
*/
- bool adjust_offsets_when_zeroing = !(has_positioning || c->plan->shaper->fallback_position ||
- HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction));
+ bool adjust_offsets_when_zeroing = c->fallback_positioning &&
+ !c->plan->shaper->fallback_position &&
+ HB_DIRECTION_IS_FORWARD (c->buffer->props.direction);
switch (c->plan->shaper->zero_width_marks)
{
@@ -685,79 +695,65 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
zero_mark_widths_by_gdef (c->buffer, adjust_offsets_when_zeroing);
break;
- /* Not currently used for any shaper:
- case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_EARLY:
- zero_mark_widths_by_unicode (c->buffer, adjust_offsets_when_zeroing);
- break;
- */
-
default:
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE:
- case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE:
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE:
break;
}
- if (has_positioning)
+ if (likely (!c->fallback_positioning))
{
hb_glyph_info_t *info = c->buffer->info;
hb_glyph_position_t *pos = c->buffer->pos;
- /* Change glyph origin to what GPOS expects, apply GPOS, change it back. */
+ /* Change glyph origin to what GPOS expects (horizontal), apply GPOS, change it back. */
- for (unsigned int i = 0; i < count; i++) {
- c->font->add_glyph_origin_for_direction (info[i].codepoint,
- HB_DIRECTION_LTR,
- &pos[i].x_offset,
- &pos[i].y_offset);
- }
+ /* The nil glyph_h_origin() func returns 0, so no need to apply it. */
+ if (c->font->has_glyph_h_origin_func ())
+ for (unsigned int i = 0; i < count; i++)
+ c->font->add_glyph_h_origin (info[i].codepoint,
+ &pos[i].x_offset,
+ &pos[i].y_offset);
c->plan->position (c->font, c->buffer);
- for (unsigned int i = 0; i < count; i++) {
- c->font->subtract_glyph_origin_for_direction (info[i].codepoint,
- HB_DIRECTION_LTR,
- &pos[i].x_offset,
- &pos[i].y_offset);
- }
+ /* The nil glyph_h_origin() func returns 0, so no need to apply it. */
+ if (c->font->has_glyph_h_origin_func ())
+ for (unsigned int i = 0; i < count; i++)
+ c->font->subtract_glyph_h_origin (info[i].codepoint,
+ &pos[i].x_offset,
+ &pos[i].y_offset);
- ret = true;
}
switch (c->plan->shaper->zero_width_marks)
{
- case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE:
- zero_mark_widths_by_unicode (c->buffer, adjust_offsets_when_zeroing);
- break;
-
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE:
zero_mark_widths_by_gdef (c->buffer, adjust_offsets_when_zeroing);
break;
default:
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE:
- //case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_EARLY:
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY:
break;
}
- return ret;
+ /* Finishing off GPOS has to follow a certain order. */
+ hb_ot_layout_position_finish_advances (c->font, c->buffer);
+ hb_ot_zero_width_default_ignorables (c);
+ hb_ot_layout_position_finish_offsets (c->font, c->buffer);
}
static inline void
hb_ot_position (hb_ot_shape_context_t *c)
{
- hb_ot_layout_position_start (c->font, c->buffer);
+ c->buffer->clear_positions ();
hb_ot_position_default (c);
- hb_bool_t fallback = !hb_ot_position_complex (c);
-
- hb_ot_zero_width_default_ignorables (c);
-
- hb_ot_layout_position_finish (c->font, c->buffer);
+ hb_ot_position_complex (c);
- if (fallback && c->plan->shaper->fallback_position)
+ if (c->fallback_positioning && c->plan->shaper->fallback_position)
_hb_ot_shape_fallback_position (c->plan, c->font, c->buffer);
if (HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction))
@@ -765,7 +761,7 @@ hb_ot_position (hb_ot_shape_context_t *c)
/* Visual fallback goes here. */
- if (fallback)
+ if (c->fallback_positioning)
_hb_ot_shape_fallback_kern (c->plan, c->font, c->buffer);
_hb_buffer_deallocate_gsubgpos_vars (c->buffer);
@@ -778,6 +774,17 @@ static void
hb_ot_shape_internal (hb_ot_shape_context_t *c)
{
c->buffer->deallocate_var_all ();
+ c->buffer->scratch_flags = HB_BUFFER_SCRATCH_FLAG_DEFAULT;
+ if (likely (!_hb_unsigned_int_mul_overflows (c->buffer->len, HB_BUFFER_MAX_EXPANSION_FACTOR)))
+ {
+ c->buffer->max_len = MAX (c->buffer->len * HB_BUFFER_MAX_EXPANSION_FACTOR,
+ (unsigned) HB_BUFFER_MAX_LEN_MIN);
+ }
+
+ bool disable_otl = c->plan->shaper->disable_otl && c->plan->shaper->disable_otl (c->plan);
+ //c->fallback_substitute = disable_otl || !hb_ot_layout_has_substitution (c->face);
+ c->fallback_positioning = disable_otl || !hb_ot_layout_has_positioning (c->face);
+ c->fallback_glyph_classes = disable_otl || !hb_ot_layout_has_glyph_classes (c->face);
/* Save the original direction, we use it later. */
c->target_direction = c->buffer->props.direction;
@@ -792,15 +799,22 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c)
hb_ensure_native_direction (c->buffer);
+ if (c->plan->shaper->preprocess_text)
+ c->plan->shaper->preprocess_text (c->plan, c->buffer, c->font);
+
hb_ot_substitute (c);
hb_ot_position (c);
hb_ot_hide_default_ignorables (c);
+ if (c->plan->shaper->postprocess_glyphs)
+ c->plan->shaper->postprocess_glyphs (c->plan, c->buffer, c->font);
+
_hb_buffer_deallocate_unicode_vars (c->buffer);
c->buffer->props.direction = c->target_direction;
+ c->buffer->max_len = HB_BUFFER_MAX_LEN_DEFAULT;
c->buffer->deallocate_var_all ();
}
@@ -820,6 +834,8 @@ _hb_ot_shape (hb_shape_plan_t *shape_plan,
/**
+ * hb_ot_shape_plan_collect_lookups:
+ *
* Since: 0.9.7
**/
void
@@ -841,18 +857,20 @@ add_char (hb_font_t *font,
hb_set_t *glyphs)
{
hb_codepoint_t glyph;
- if (font->get_glyph (u, 0, &glyph))
+ if (font->get_nominal_glyph (u, &glyph))
glyphs->add (glyph);
if (mirror)
{
hb_codepoint_t m = unicode->mirroring (u);
- if (m != u && font->get_glyph (m, 0, &glyph))
+ if (m != u && font->get_nominal_glyph (m, &glyph))
glyphs->add (glyph);
}
}
/**
+ * hb_ot_shape_glyphs_closure:
+ *
* Since: 0.9.2
**/
void
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape.h b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape.h
index 1402f54acc..7b1bcc0637 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape.h
@@ -36,14 +36,14 @@
HB_BEGIN_DECLS
/* TODO port to shape-plan / set. */
-void
+HB_EXTERN void
hb_ot_shape_glyphs_closure (hb_font_t *font,
hb_buffer_t *buffer,
const hb_feature_t *features,
unsigned int num_features,
hb_set_t *glyphs);
-void
+HB_EXTERN void
hb_ot_shape_plan_collect_lookups (hb_shape_plan_t *shape_plan,
hb_tag_t table_tag,
hb_set_t *lookup_indexes /* OUT */);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-tag.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-tag.cc
index a2e5728fcd..5f21ac0967 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-tag.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-tag.cc
@@ -186,14 +186,18 @@ static const LangTag ot_languages[] = {
{"aa", HB_TAG('A','F','R',' ')}, /* Afar */
{"ab", HB_TAG('A','B','K',' ')}, /* Abkhazian */
{"abq", HB_TAG('A','B','A',' ')}, /* Abaza */
+ {"acf", HB_TAG('F','A','N',' ')}, /* French Antillean */
{"ach", HB_TAG('A','C','H',' ')}, /* Acoli */
+ {"acr", HB_TAG('A','C','R',' ')}, /* Achi */
{"ada", HB_TAG('D','N','G',' ')}, /* Dangme */
{"ady", HB_TAG('A','D','Y',' ')}, /* Adyghe */
{"af", HB_TAG('A','F','K',' ')}, /* Afrikaans */
+ {"ahg", HB_TAG('A','G','W',' ')}, /* Agaw */
{"aii", HB_TAG('S','W','A',' ')}, /* Swadaya Aramaic */
{"aio", HB_TAG('A','I','O',' ')}, /* Aiton */
{"aiw", HB_TAG('A','R','I',' ')}, /* Aari */
{"ak", HB_TAG('T','W','I',' ')}, /* Akan [macrolanguage] */
+ {"aka", HB_TAG('A','K','A',' ')}, /* Akan */
{"alt", HB_TAG('A','L','T',' ')}, /* [Southern] Altai */
{"am", HB_TAG('A','M','H',' ')}, /* Amharic */
{"amf", HB_TAG('H','B','N',' ')}, /* Hammer-Banna */
@@ -206,6 +210,7 @@ static const LangTag ot_languages[] = {
{"as", HB_TAG('A','S','M',' ')}, /* Assamese */
{"ast", HB_TAG('A','S','T',' ')}, /* Asturian/Asturleonese/Bable/Leonese */
{"ath", HB_TAG('A','T','H',' ')}, /* Athapaskan [family] */
+ {"atj", HB_TAG('R','C','R',' ')}, /* R-Cree */
{"atv", HB_TAG('A','L','T',' ')}, /* [Northern] Altai */
{"av", HB_TAG('A','V','R',' ')}, /* Avaric */
{"awa", HB_TAG('A','W','A',' ')}, /* Awadhi */
@@ -214,6 +219,7 @@ static const LangTag ot_languages[] = {
{"azb", HB_TAG('A','Z','B',' ')}, /* South Azerbaijani */
{"azj", HB_TAG('A','Z','E',' ')}, /* North Azerbaijani */
{"ba", HB_TAG('B','S','H',' ')}, /* Bashkir */
+ {"bad", HB_TAG('B','A','D','0')}, /* Banda */
{"bai", HB_TAG('B','M','L',' ')}, /* Bamileke [family] */
{"bal", HB_TAG('B','L','I',' ')}, /* Baluchi [macrolangauge] */
{"ban", HB_TAG('B','A','N',' ')}, /* Balinese */
@@ -222,11 +228,13 @@ static const LangTag ot_languages[] = {
{"bci", HB_TAG('B','A','U',' ')}, /* Baoulé */
{"bcl", HB_TAG('B','I','K',' ')}, /* Central Bikol */
{"bcq", HB_TAG('B','C','H',' ')}, /* Bench */
+ {"bdy", HB_TAG('B','D','Y',' ')}, /* Bandjalang */
{"be", HB_TAG('B','E','L',' ')}, /* Belarusian */
{"bem", HB_TAG('B','E','M',' ')}, /* Bemba (Zambia) */
{"ber", HB_TAG('B','E','R',' ')}, /* Berber [family] */
{"bfq", HB_TAG('B','A','D',' ')}, /* Badaga */
{"bft", HB_TAG('B','L','T',' ')}, /* Balti */
+ {"bfu", HB_TAG('L','A','H',' ')}, /* Lahuli */
{"bfy", HB_TAG('B','A','G',' ')}, /* Baghelkhandi */
{"bg", HB_TAG('B','G','R',' ')}, /* Bulgarian */
{"bgc", HB_TAG('B','G','C',' ')}, /* Haryanvi */
@@ -260,11 +268,13 @@ static const LangTag ot_languages[] = {
{"bxr", HB_TAG('R','B','U',' ')}, /* Russian Buriat */
{"byn", HB_TAG('B','I','L',' ')}, /* Bilen */
{"ca", HB_TAG('C','A','T',' ')}, /* Catalan */
+ {"cak", HB_TAG('C','A','K',' ')}, /* Kaqchikel */
{"cbk", HB_TAG('C','B','K',' ')}, /* Chavacano */
{"ce", HB_TAG('C','H','E',' ')}, /* Chechen */
{"ceb", HB_TAG('C','E','B',' ')}, /* Cebuano */
{"cgg", HB_TAG('C','G','G',' ')}, /* Chiga */
{"ch", HB_TAG('C','H','A',' ')}, /* Chamorro */
+ {"chk", HB_TAG('C','H','K','0')}, /* Chuukese */
{"cho", HB_TAG('C','H','O',' ')}, /* Choctaw */
{"chp", HB_TAG('C','H','P',' ')}, /* Chipewyan */
{"chr", HB_TAG('C','H','R',' ')}, /* Cherokee */
@@ -272,9 +282,12 @@ static const LangTag ot_languages[] = {
{"ckb", HB_TAG('K','U','R',' ')}, /* Central Kurdish (Sorani) */
{"ckt", HB_TAG('C','H','K',' ')}, /* Chukchi */
{"cop", HB_TAG('C','O','P',' ')}, /* Coptic */
+ {"cpp", HB_TAG('C','P','P',' ')}, /* Creoles */
{"cr", HB_TAG('C','R','E',' ')}, /* Cree */
+ {"cre", HB_TAG('Y','C','R',' ')}, /* Y-Cree */
{"crh", HB_TAG('C','R','T',' ')}, /* Crimean Tatar */
{"crj", HB_TAG('E','C','R',' ')}, /* [Southern] East Cree */
+ {"crk", HB_TAG('W','C','R',' ')}, /* West-Cree */
{"crl", HB_TAG('E','C','R',' ')}, /* [Northern] East Cree */
{"crm", HB_TAG('M','C','R',' ')}, /* Moose Cree */
{"crx", HB_TAG('C','R','R',' ')}, /* Carrier */
@@ -283,21 +296,27 @@ static const LangTag ot_languages[] = {
{"ctg", HB_TAG('C','T','G',' ')}, /* Chittagonian */
{"cts", HB_TAG('B','I','K',' ')}, /* Northern Catanduanes Bikol */
{"cu", HB_TAG('C','S','L',' ')}, /* Church Slavic */
+ {"cuk", HB_TAG('C','U','K',' ')}, /* San Blas Kuna */
{"cv", HB_TAG('C','H','U',' ')}, /* Chuvash */
{"cwd", HB_TAG('D','C','R',' ')}, /* Woods Cree */
{"cy", HB_TAG('W','E','L',' ')}, /* Welsh */
{"da", HB_TAG('D','A','N',' ')}, /* Danish */
{"dap", HB_TAG('N','I','S',' ')}, /* Nisi (India) */
{"dar", HB_TAG('D','A','R',' ')}, /* Dargwa */
+ {"dax", HB_TAG('D','A','X',' ')}, /* Dayi */
{"de", HB_TAG('D','E','U',' ')}, /* German */
{"dgo", HB_TAG('D','G','O',' ')}, /* Dogri */
{"dhd", HB_TAG('M','A','W',' ')}, /* Dhundari */
+ {"dhg", HB_TAG('D','H','G',' ')}, /* Dhangu */
{"din", HB_TAG('D','N','K',' ')}, /* Dinka [macrolanguage] */
{"diq", HB_TAG('D','I','Q',' ')}, /* Dimli */
{"dje", HB_TAG('D','J','R',' ')}, /* Zarma */
+ {"djr", HB_TAG('D','J','R','0')}, /* Djambarrpuyngu */
{"dng", HB_TAG('D','U','N',' ')}, /* Dungan */
+ {"dnj", HB_TAG('D','N','J',' ')}, /* Dan */
{"doi", HB_TAG('D','G','R',' ')}, /* Dogri [macrolanguage] */
{"dsb", HB_TAG('L','S','B',' ')}, /* Lower Sorbian */
+ {"duj", HB_TAG('D','U','J',' ')}, /* Dhuwal */
{"dv", HB_TAG('D','I','V',' ')}, /* Dhivehi/Divehi/Maldivian */
{"dyu", HB_TAG('J','U','L',' ')}, /* Jula */
{"dz", HB_TAG('D','Z','N',' ')}, /* Dzongkha */
@@ -307,23 +326,30 @@ static const LangTag ot_languages[] = {
{"el", HB_TAG('E','L','L',' ')}, /* Modern Greek (1453-) */
{"emk", HB_TAG('M','N','K',' ')}, /* Eastern Maninkakan */
{"en", HB_TAG('E','N','G',' ')}, /* English */
+ {"enf", HB_TAG('F','N','E',' ')}, /* Forest Nenets */
+ {"enh", HB_TAG('T','N','E',' ')}, /* Tundra Nenets */
{"eo", HB_TAG('N','T','O',' ')}, /* Esperanto */
{"eot", HB_TAG('B','T','I',' ')}, /* Beti (Côte d'Ivoire) */
{"es", HB_TAG('E','S','P',' ')}, /* Spanish */
+ {"esu", HB_TAG('E','S','U',' ')}, /* Central Yupik */
{"et", HB_TAG('E','T','I',' ')}, /* Estonian [macrolanguage] */
{"eu", HB_TAG('E','U','Q',' ')}, /* Basque */
{"eve", HB_TAG('E','V','N',' ')}, /* Even */
{"evn", HB_TAG('E','V','K',' ')}, /* Evenki */
{"fa", HB_TAG('F','A','R',' ')}, /* Persian [macrolanguage] */
+ {"fan", HB_TAG('F','A','N','0')}, /* Fang */
+ {"fat", HB_TAG('F','A','T',' ')}, /* Fanti */
{"ff", HB_TAG('F','U','L',' ')}, /* Fulah [macrolanguage] */
{"fi", HB_TAG('F','I','N',' ')}, /* Finnish */
{"fil", HB_TAG('P','I','L',' ')}, /* Filipino */
{"fj", HB_TAG('F','J','I',' ')}, /* Fijian */
+ {"flm", HB_TAG('H','A','L',' ')}, /* Halam */
{"fo", HB_TAG('F','O','S',' ')}, /* Faroese */
{"fon", HB_TAG('F','O','N',' ')}, /* Fon */
{"fr", HB_TAG('F','R','A',' ')}, /* French */
{"frc", HB_TAG('F','R','C',' ')}, /* Cajun French */
{"frp", HB_TAG('F','R','P',' ')}, /* Arpitan/Francoprovençal */
+ {"fuf", HB_TAG('F','T','A',' ')}, /* Futa */
{"fur", HB_TAG('F','R','L',' ')}, /* Friulian */
{"fuv", HB_TAG('F','U','V',' ')}, /* Nigerian Fulfulde */
{"fy", HB_TAG('F','R','I',' ')}, /* Western Frisian */
@@ -334,17 +360,24 @@ static const LangTag ot_languages[] = {
{"gd", HB_TAG('G','A','E',' ')}, /* Scottish Gaelic */
{"gez", HB_TAG('G','E','Z',' ')}, /* Ge'ez */
{"ggo", HB_TAG('G','O','N',' ')}, /* Southern Gondi */
+ {"gih", HB_TAG('G','I','H',' ')}, /* Githabul */
+ {"gil", HB_TAG('G','I','L','0')}, /* Kiribati (Gilbertese) */
+ {"gkp", HB_TAG('G','K','P',' ')}, /* Kpelle (Guinea) */
{"gl", HB_TAG('G','A','L',' ')}, /* Galician */
{"gld", HB_TAG('N','A','N',' ')}, /* Nanai */
+ {"gle", HB_TAG('I','R','T',' ')}, /* Irish Traditional */
{"glk", HB_TAG('G','L','K',' ')}, /* Gilaki */
{"gn", HB_TAG('G','U','A',' ')}, /* Guarani [macrolanguage] */
+ {"gnn", HB_TAG('G','N','N',' ')}, /* Gumatj */
{"gno", HB_TAG('G','O','N',' ')}, /* Northern Gondi */
{"gog", HB_TAG('G','O','G',' ')}, /* Gogo */
{"gon", HB_TAG('G','O','N',' ')}, /* Gondi [macrolanguage] */
{"grt", HB_TAG('G','R','O',' ')}, /* Garo */
{"gru", HB_TAG('S','O','G',' ')}, /* Sodo Gurage */
+ {"gsw", HB_TAG('A','L','S',' ')}, /* Alsatian */
{"gu", HB_TAG('G','U','J',' ')}, /* Gujarati */
{"guc", HB_TAG('G','U','C',' ')}, /* Wayuu */
+ {"guf", HB_TAG('G','U','F',' ')}, /* Gupapuyngu */
{"guk", HB_TAG('G','M','Z',' ')}, /* Gumuz */
/*{"guk", HB_TAG('G','U','K',' ')},*/ /* Gumuz (in SIL fonts) */
{"guz", HB_TAG('G','U','Z',' ')}, /* Ekegusii/Gusii */
@@ -355,9 +388,9 @@ static const LangTag ot_languages[] = {
{"hay", HB_TAG('H','A','Y',' ')}, /* Haya */
{"haz", HB_TAG('H','A','Z',' ')}, /* Hazaragi */
{"he", HB_TAG('I','W','R',' ')}, /* Hebrew */
- {"hz", HB_TAG('H','E','R',' ')}, /* Herero */
{"hi", HB_TAG('H','I','N',' ')}, /* Hindi */
{"hil", HB_TAG('H','I','L',' ')}, /* Hiligaynon */
+ {"hmn", HB_TAG('H','M','N',' ')}, /* Hmong */
{"hnd", HB_TAG('H','N','D',' ')}, /* [Southern] Hindko */
{"hne", HB_TAG('C','H','H',' ')}, /* Chattisgarhi */
{"hno", HB_TAG('H','N','D',' ')}, /* [Northern] Hindko */
@@ -371,11 +404,13 @@ static const LangTag ot_languages[] = {
{"hy", HB_TAG('H','Y','E',' ')}, /* Armenian */
{"hz", HB_TAG('H','E','R',' ')}, /* Herero */
{"ia", HB_TAG('I','N','A',' ')}, /* Interlingua (International Auxiliary Language Association) */
+ {"iba", HB_TAG('I','B','A',' ')}, /* Iban */
{"ibb", HB_TAG('I','B','B',' ')}, /* Ibibio */
{"id", HB_TAG('I','N','D',' ')}, /* Indonesian */
{"ie", HB_TAG('I','L','E',' ')}, /* Interlingue/Occidental */
{"ig", HB_TAG('I','B','O',' ')}, /* Igbo */
{"igb", HB_TAG('E','B','I',' ')}, /* Ebira */
+ {"ii", HB_TAG('Y','I','M',' ')}, /* Yi Modern */
{"ijc", HB_TAG('I','J','O',' ')}, /* Izon */
{"ijo", HB_TAG('I','J','O',' ')}, /* Ijo [family] */
{"ik", HB_TAG('I','P','K',' ')}, /* Inupiaq [macrolanguage] */
@@ -391,15 +426,20 @@ static const LangTag ot_languages[] = {
{"jv", HB_TAG('J','A','V',' ')}, /* Javanese */
{"ka", HB_TAG('K','A','T',' ')}, /* Georgian */
{"kaa", HB_TAG('K','R','K',' ')}, /* Karakalpak */
- {"kab", HB_TAG('K','A','B',' ')}, /* Kabyle */
+ {"kab", HB_TAG('K','A','B','0')}, /* Kabyle */
{"kam", HB_TAG('K','M','B',' ')}, /* Kamba (Kenya) */
{"kar", HB_TAG('K','R','N',' ')}, /* Karen [family] */
+ {"kat", HB_TAG('K','G','E',' ')}, /* Khutsuri Georgian */
{"kbd", HB_TAG('K','A','B',' ')}, /* Kabardian */
{"kde", HB_TAG('K','D','E',' ')}, /* Makonde */
{"kdr", HB_TAG('K','R','M',' ')}, /* Karaim */
{"kdt", HB_TAG('K','U','Y',' ')}, /* Kuy */
+ {"kea", HB_TAG('K','E','A',' ')}, /* Kabuverdianu (Crioulo) */
+ {"kek", HB_TAG('K','E','K',' ')}, /* Kekchi */
{"kex", HB_TAG('K','K','N',' ')}, /* Kokni */
+ {"kfa", HB_TAG('K','O','D',' ')}, /* Kodagu */
{"kfr", HB_TAG('K','A','C',' ')}, /* Kachchi */
+ {"kfx", HB_TAG('K','U','L',' ')}, /* Kulvi */
{"kfy", HB_TAG('K','M','N',' ')}, /* Kumaoni */
{"kg", HB_TAG('K','O','N',' ')}, /* Kongo [macrolanguage] */
{"kha", HB_TAG('K','S','I',' ')}, /* Khasi */
@@ -408,7 +448,9 @@ static const LangTag ot_languages[] = {
/*{"kht", HB_TAG('K','H','T',' ')},*/ /* Khamti (OpenType spec and SIL fonts) */
{"khw", HB_TAG('K','H','W',' ')}, /* Khowar */
{"ki", HB_TAG('K','I','K',' ')}, /* Gikuyu/Kikuyu */
+ {"kiu", HB_TAG('K','I','U',' ')}, /* Kirmanjki */
{"kj", HB_TAG('K','U','A',' ')}, /* Kuanyama/Kwanyama */
+ {"kjd", HB_TAG('K','J','D',' ')}, /* Southern Kiwai */
{"kjh", HB_TAG('K','H','A',' ')}, /* Khakass */
{"kjp", HB_TAG('K','J','P',' ')}, /* Pwo Eastern Karen */
{"kk", HB_TAG('K','A','Z',' ')}, /* Kazakh */
@@ -422,6 +464,8 @@ static const LangTag ot_languages[] = {
{"ko", HB_TAG('K','O','R',' ')}, /* Korean */
{"koi", HB_TAG('K','O','P',' ')}, /* Komi-Permyak */
{"kok", HB_TAG('K','O','K',' ')}, /* Konkani [macrolanguage] */
+ {"kon", HB_TAG('K','O','N','0')}, /* Kongo */
+ {"kos", HB_TAG('K','O','S',' ')}, /* Kosraean */
{"kpe", HB_TAG('K','P','L',' ')}, /* Kpelle [macrolanguage] */
{"kpv", HB_TAG('K','O','Z',' ')}, /* Komi-Zyrian */
{"kpy", HB_TAG('K','Y','K',' ')}, /* Koryak */
@@ -431,9 +475,11 @@ static const LangTag ot_languages[] = {
{"krl", HB_TAG('K','R','L',' ')}, /* Karelian */
{"kru", HB_TAG('K','U','U',' ')}, /* Kurukh */
{"ks", HB_TAG('K','S','H',' ')}, /* Kashmiri */
- {"ksh", HB_TAG('K','S','H',' ')}, /* Kölsch */
+ {"ksh", HB_TAG('K','S','H','0')}, /* Ripuarian, Kölsch */
/*{"ksw", HB_TAG('K','R','N',' ')},*/ /* S'gaw Karen (Microsoft fonts?) */
{"ksw", HB_TAG('K','S','W',' ')}, /* S'gaw Karen (OpenType spec and SIL fonts) */
+ {"ktb", HB_TAG('K','E','B',' ')}, /* Kebena */
+ {"ktu", HB_TAG('K','O','N',' ')}, /* Kikongo */
{"ku", HB_TAG('K','U','R',' ')}, /* Kurdish [macrolanguage] */
{"kum", HB_TAG('K','U','M',' ')}, /* Kumyk */
{"kv", HB_TAG('K','O','M',' ')}, /* Komi [macrolanguage] */
@@ -461,6 +507,7 @@ static const LangTag ot_languages[] = {
{"lmo", HB_TAG('L','M','O',' ')}, /* Lombard */
{"ln", HB_TAG('L','I','N',' ')}, /* Lingala */
{"lo", HB_TAG('L','A','O',' ')}, /* Lao */
+ {"lom", HB_TAG('L','O','M',' ')}, /* Loma */
{"lrc", HB_TAG('L','R','C',' ')}, /* Northern Luri */
{"lt", HB_TAG('L','T','H',' ')}, /* Lithuanian */
{"lu", HB_TAG('L','U','B',' ')}, /* Luba-Katanga */
@@ -475,6 +522,8 @@ static const LangTag ot_languages[] = {
{"mag", HB_TAG('M','A','G',' ')}, /* Magahi */
{"mai", HB_TAG('M','T','H',' ')}, /* Maithili */
{"mak", HB_TAG('M','K','R',' ')}, /* Makasar */
+ {"mal", HB_TAG('M','A','L',' ')}, /* Malayalam */
+ {"mam", HB_TAG('M','A','M',' ')}, /* Mam */
{"man", HB_TAG('M','N','K',' ')}, /* Manding/Mandingo [macrolanguage] */
{"mdc", HB_TAG('M','L','E',' ')}, /* Male (Papua New Guinea) */
{"mdf", HB_TAG('M','O','K',' ')}, /* Moksha */
@@ -517,6 +566,7 @@ static const LangTag ot_languages[] = {
{"mww", HB_TAG('M','W','W',' ')}, /* Hmong Daw */
{"my", HB_TAG('B','R','M',' ')}, /* Burmese */
{"mym", HB_TAG('M','E','N',' ')}, /* Me'en */
+ {"myn", HB_TAG('M','Y','N',' ')}, /* Mayan */
{"myq", HB_TAG('M','N','K',' ')}, /* Forest Maninka (retired code) */
{"myv", HB_TAG('E','R','Z',' ')}, /* Erzya */
{"mzn", HB_TAG('M','Z','N',' ')}, /* Mazanderani */
@@ -534,6 +584,7 @@ static const LangTag ot_languages[] = {
{"ng", HB_TAG('N','D','G',' ')}, /* Ndonga */
{"nga", HB_TAG('N','G','A',' ')}, /* Ngabaka */
{"ngl", HB_TAG('L','M','W',' ')}, /* Lomwe */
+ {"ngo", HB_TAG('S','X','T',' ')}, /* Sutu */
{"niu", HB_TAG('N','I','U',' ')}, /* Niuean */
{"niv", HB_TAG('G','I','L',' ')}, /* Gilyak */
{"nl", HB_TAG('N','L','D',' ')}, /* Dutch */
@@ -554,13 +605,15 @@ static const LangTag ot_languages[] = {
{"oc", HB_TAG('O','C','I',' ')}, /* Occitan (post 1500) */
{"oj", HB_TAG('O','J','B',' ')}, /* Ojibwa [macrolanguage] */
{"ojs", HB_TAG('O','C','R',' ')}, /* Oji-Cree */
+ {"okm", HB_TAG('K','O','H',' ')}, /* Korean Old Hangul */
{"om", HB_TAG('O','R','O',' ')}, /* Oromo [macrolanguage] */
{"or", HB_TAG('O','R','I',' ')}, /* Oriya */
{"os", HB_TAG('O','S','S',' ')}, /* Ossetian */
{"pa", HB_TAG('P','A','N',' ')}, /* Panjabi */
{"pag", HB_TAG('P','A','G',' ')}, /* Pangasinan */
{"pam", HB_TAG('P','A','M',' ')}, /* Kapampangan/Pampanga */
- {"pap", HB_TAG('P','A','P',' ')}, /* Papiamento */
+ {"pap", HB_TAG('P','A','P','0')}, /* Papiamento */
+ {"pau", HB_TAG('P','A','U',' ')}, /* Palauan */
{"pcc", HB_TAG('P','C','C',' ')}, /* Bouyei */
{"pcd", HB_TAG('P','C','D',' ')}, /* Picard */
{"pce", HB_TAG('P','L','G',' ')}, /* [Ruching] Palaung */
@@ -574,24 +627,34 @@ static const LangTag ot_languages[] = {
{"plp", HB_TAG('P','A','P',' ')}, /* Palpa */
{"pms", HB_TAG('P','M','S',' ')}, /* Piemontese */
{"pnb", HB_TAG('P','N','B',' ')}, /* Western Panjabi */
+ {"poh", HB_TAG('P','O','H',' ')}, /* Pocomchi */
+ {"pon", HB_TAG('P','O','N',' ')}, /* Pohnpeian */
{"prs", HB_TAG('D','R','I',' ')}, /* Afghan Persian/Dari */
{"ps", HB_TAG('P','A','S',' ')}, /* Pashto/Pushto [macrolanguage] */
{"pt", HB_TAG('P','T','G',' ')}, /* Portuguese */
{"pwo", HB_TAG('P','W','O',' ')}, /* Pwo Western Karen */
{"qu", HB_TAG('Q','U','Z',' ')}, /* Quechua [macrolanguage] */
{"quc", HB_TAG('Q','U','C',' ')}, /* K'iche'/Quiché */
+ {"quh", HB_TAG('Q','U','H',' ')}, /* Quechua (Bolivia) */
{"quz", HB_TAG('Q','U','Z',' ')}, /* Cusco Quechua */
+ {"qvi", HB_TAG('Q','V','I',' ')}, /* Quechua (Ecuador) */
+ {"qwh", HB_TAG('Q','W','H',' ')}, /* Quechua (Peru) */
{"raj", HB_TAG('R','A','J',' ')}, /* Rajasthani [macrolanguage] */
+ {"rar", HB_TAG('R','A','R',' ')}, /* Rarotongan */
{"rbb", HB_TAG('P','L','G',' ')}, /* Rumai Palaung */
{"rej", HB_TAG('R','E','J',' ')}, /* Rejang */
{"ria", HB_TAG('R','I','A',' ')}, /* Riang (India) */
+ {"rif", HB_TAG('R','I','F',' ')}, /* Tarifit */
{"ril", HB_TAG('R','I','A',' ')}, /* Riang (Myanmar) */
+ {"rit", HB_TAG('R','I','T',' ')}, /* Ritarungo */
{"rki", HB_TAG('A','R','K',' ')}, /* Rakhine */
+ {"rkw", HB_TAG('R','K','W',' ')}, /* Arakwal */
{"rm", HB_TAG('R','M','S',' ')}, /* Romansh */
{"rmy", HB_TAG('R','M','Y',' ')}, /* Vlax Romani */
{"rn", HB_TAG('R','U','N',' ')}, /* Rundi */
{"ro", HB_TAG('R','O','M',' ')}, /* Romanian */
{"rom", HB_TAG('R','O','Y',' ')}, /* Romany [macrolanguage] */
+ {"rtm", HB_TAG('R','T','M',' ')}, /* Rotuman */
{"ru", HB_TAG('R','U','S',' ')}, /* Russian */
{"rue", HB_TAG('R','S','Y',' ')}, /* Rusyn */
{"rup", HB_TAG('R','U','P',' ')}, /* Aromanian/Arumanian/Macedo-Romanian */
@@ -599,10 +662,11 @@ static const LangTag ot_languages[] = {
{"rwr", HB_TAG('M','A','W',' ')}, /* Marwari (India) */
{"sa", HB_TAG('S','A','N',' ')}, /* Sanskrit */
{"sah", HB_TAG('Y','A','K',' ')}, /* Yakut */
+ {"sam", HB_TAG('P','A','A',' ')}, /* Palestinian Aramaic */
{"sas", HB_TAG('S','A','S',' ')}, /* Sasak */
{"sat", HB_TAG('S','A','T',' ')}, /* Santali */
- {"sck", HB_TAG('S','A','D',' ')}, /* Sadri */
{"sc", HB_TAG('S','R','D',' ')}, /* Sardinian [macrolanguage] */
+ {"sck", HB_TAG('S','A','D',' ')}, /* Sadri */
{"scn", HB_TAG('S','C','N',' ')}, /* Sicilian */
{"sco", HB_TAG('S','C','O',' ')}, /* Scots */
{"scs", HB_TAG('S','L','A',' ')}, /* [North] Slavey */
@@ -615,6 +679,7 @@ static const LangTag ot_languages[] = {
{"sgs", HB_TAG('S','G','S',' ')}, /* Samogitian */
{"sgw", HB_TAG('C','H','G',' ')}, /* Sebat Bet Gurage */
/*{"sgw", HB_TAG('S','G','W',' ')},*/ /* Sebat Bet Gurage (in SIL fonts) */
+ {"shi", HB_TAG('S','H','I',' ')}, /* Tachelhit */
{"shn", HB_TAG('S','H','N',' ')}, /* Shan */
{"si", HB_TAG('S','N','H',' ')}, /* Sinhala */
{"sid", HB_TAG('S','I','D',' ')}, /* Sidamo */
@@ -627,7 +692,7 @@ static const LangTag ot_languages[] = {
{"smj", HB_TAG('L','S','M',' ')}, /* Lule Sami */
{"smn", HB_TAG('I','S','M',' ')}, /* Inari Sami */
{"sms", HB_TAG('S','K','S',' ')}, /* Skolt Sami */
- {"sn", HB_TAG('S','N','A',' ')}, /* Shona */
+ {"sn", HB_TAG('S','N','A','0')}, /* Shona */
{"snk", HB_TAG('S','N','K',' ')}, /* Soninke */
{"so", HB_TAG('S','M','L',' ')}, /* Somali */
{"sop", HB_TAG('S','O','P',' ')}, /* Songe */
@@ -665,20 +730,24 @@ static const LangTag ot_languages[] = {
{"tiv", HB_TAG('T','I','V',' ')}, /* Tiv */
{"tk", HB_TAG('T','K','M',' ')}, /* Turkmen */
{"tl", HB_TAG('T','G','L',' ')}, /* Tagalog */
- {"tmh", HB_TAG('t','m','h',' ')}, /* Tamashek [macrolanguage] */
+ {"tmh", HB_TAG('T','M','H',' ')}, /* Tamashek */
{"tn", HB_TAG('T','N','A',' ')}, /* Tswana */
{"to", HB_TAG('T','G','N',' ')}, /* Tonga (Tonga Islands) */
+ {"tod", HB_TAG('T','O','D','0')}, /* Toma */
+ {"toi", HB_TAG('T','N','G',' ')}, /* Tonga */
{"tpi", HB_TAG('T','P','I',' ')}, /* Tok Pisin */
{"tr", HB_TAG('T','R','K',' ')}, /* Turkish */
{"tru", HB_TAG('T','U','A',' ')}, /* Turoyo Aramaic */
{"ts", HB_TAG('T','S','G',' ')}, /* Tsonga */
{"tt", HB_TAG('T','A','T',' ')}, /* Tatar */
{"tum", HB_TAG('T','U','M',' ')}, /* Tumbuka */
+ {"tvl", HB_TAG('T','V','L',' ')}, /* Tuvalu */
{"tw", HB_TAG('T','W','I',' ')}, /* Twi */
{"ty", HB_TAG('T','H','T',' ')}, /* Tahitian */
{"tyv", HB_TAG('T','U','V',' ')}, /* Tuvin */
{"tyz", HB_TAG('T','Y','Z',' ')}, /* Tày */
{"tzm", HB_TAG('T','Z','M',' ')}, /* Central Atlas Tamazight */
+ {"tzo", HB_TAG('T','Z','O',' ')}, /* Tzotzil */
{"udm", HB_TAG('U','D','M',' ')}, /* Udmurt */
{"ug", HB_TAG('U','Y','G',' ')}, /* Uighur */
{"uk", HB_TAG('U','K','R',' ')}, /* Ukrainian */
@@ -690,8 +759,8 @@ static const LangTag ot_languages[] = {
{"uzs", HB_TAG('U','Z','B',' ')}, /* Southern Uzbek */
{"ve", HB_TAG('V','E','N',' ')}, /* Venda */
{"vec", HB_TAG('V','E','C',' ')}, /* Venetian */
- {"vls", HB_TAG('F','L','E',' ')}, /* Vlaams */
{"vi", HB_TAG('V','I','T',' ')}, /* Vietnamese */
+ {"vls", HB_TAG('F','L','E',' ')}, /* Vlaams */
{"vmw", HB_TAG('M','A','K',' ')}, /* Makhuwa */
{"vo", HB_TAG('V','O','L',' ')}, /* Volapük */
{"vro", HB_TAG('V','R','O',' ')}, /* Võro */
@@ -700,85 +769,76 @@ static const LangTag ot_languages[] = {
{"wbm", HB_TAG('W','A',' ',' ')}, /* Wa */
{"wbr", HB_TAG('W','A','G',' ')}, /* Wagdi */
{"wle", HB_TAG('S','I','G',' ')}, /* Wolane */
+ {"wo", HB_TAG('W','L','F',' ')}, /* Wolof */
{"wry", HB_TAG('M','A','W',' ')}, /* Merwari */
{"wtm", HB_TAG('W','T','M',' ')}, /* Mewati */
- {"wo", HB_TAG('W','L','F',' ')}, /* Wolof */
{"xal", HB_TAG('K','L','M',' ')}, /* Kalmyk */
+ {"xan", HB_TAG('S','E','K',' ')}, /* Sekota */
{"xh", HB_TAG('X','H','S',' ')}, /* Xhosa */
+ {"xjb", HB_TAG('X','J','B',' ')}, /* Minjangbal */
{"xog", HB_TAG('X','O','G',' ')}, /* Soga */
{"xom", HB_TAG('K','M','O',' ')}, /* Komo (Sudan) */
+ {"xpe", HB_TAG('X','P','E',' ')}, /* Kpelle (Liberia) */
{"xsl", HB_TAG('S','S','L',' ')}, /* South Slavey */
{"xst", HB_TAG('S','I','G',' ')}, /* Silt'e (retired code) */
{"xwo", HB_TAG('T','O','D',' ')}, /* Written Oirat (Todo) */
{"yao", HB_TAG('Y','A','O',' ')}, /* Yao */
+ {"yap", HB_TAG('Y','A','P',' ')}, /* Yapese */
{"yi", HB_TAG('J','I','I',' ')}, /* Yiddish [macrolanguage] */
{"yo", HB_TAG('Y','B','A',' ')}, /* Yoruba */
{"yso", HB_TAG('N','I','S',' ')}, /* Nisi (China) */
{"za", HB_TAG('Z','H','A',' ')}, /* Chuang/Zhuang [macrolanguage] */
{"zea", HB_TAG('Z','E','A',' ')}, /* Zeeuws */
+ {"zgh", HB_TAG('Z','G','H',' ')}, /* Standard Morrocan Tamazigh */
{"zne", HB_TAG('Z','N','D',' ')}, /* Zande */
{"zu", HB_TAG('Z','U','L',' ')}, /* Zulu */
- {"zum", HB_TAG('L','R','C',' ')} /* Kumzari */
+ {"zum", HB_TAG('L','R','C',' ')}, /* Kumzari */
+ {"zza", HB_TAG('Z','Z','A',' ')}, /* Zazaki */
/* The corresponding languages IDs for the following IDs are unclear,
* overlap, or are architecturally weird. Needs more research. */
-/*{"ahg/awn/xan?", HB_TAG('A','G','W',' ')},*/ /* Agaw */
-/*{"gsw?/gsw-FR?", HB_TAG('A','L','S',' ')},*/ /* Alsatian */
+/*{"chp", HB_TAG('S','A','Y',' ')},*/ /* Sayisi */
+/*{"cwd", HB_TAG('T','C','R',' ')},*/ /* TH-Cree */
+/*{"emk", HB_TAG('E','M','K',' ')},*/ /* Eastern Maninkakan */
/*{"krc", HB_TAG('B','A','L',' ')},*/ /* Balkar */
/*{"??", HB_TAG('B','C','R',' ')},*/ /* Bible Cree */
/*{"zh?", HB_TAG('C','H','N',' ')},*/ /* Chinese (seen in Microsoft fonts) */
-/*{"acf/gcf?", HB_TAG('F','A','N',' ')},*/ /* French Antillean */
-/*{"enf?/yrk?", HB_TAG('F','N','E',' ')},*/ /* Forest Nenets */
-/*{"fuf?", HB_TAG('F','T','A',' ')},*/ /* Futa */
/*{"ar-Syrc?", HB_TAG('G','A','R',' ')},*/ /* Garshuni */
-/*{"cfm/rnl?", HB_TAG('H','A','L',' ')},*/ /* Halam */
-/*{"ga-Latg?/Latg?", HB_TAG('I','R','T',' ')},*/ /* Irish Traditional */
+/*{"hy?", HB_TAG('H','Y','E','0')},*/ /* Armenian East (ISO 639-3 hye according to Microsoft, but that’s equivalent to ISO 639-1 hy) */
+/*{"ga-Latg?/" HB_TAG('I','R','T',' ')},*/ /* Irish Traditional */
/*{"krc", HB_TAG('K','A','R',' ')},*/ /* Karachay */
-/*{"alw?/ktb?", HB_TAG('K','E','B',' ')},*/ /* Kebena */
-/*{"Geok", HB_TAG('K','G','E',' ')},*/ /* Khutsuri Georgian */
+/*{"ka-Geok?", HB_TAG('K','G','E',' ')},*/ /* Khutsuri Georgian */
/*{"kca", HB_TAG('K','H','K',' ')},*/ /* Khanty-Kazim */
/*{"kca", HB_TAG('K','H','S',' ')},*/ /* Khanty-Shurishkar */
/*{"kca", HB_TAG('K','H','V',' ')},*/ /* Khanty-Vakhi */
-/*{"guz?/kqs?/kss?", HB_TAG('K','I','S',' ')},*/ /* Kisii */
-/*{"kfa/kfi?/kpb?/xua?/xuj?", HB_TAG('K','O','D',' ')},*/ /* Kodagu */
-/*{"okm?/oko?", HB_TAG('K','O','H',' ')},*/ /* Korean Old Hangul */
-/*{"kon?/ktu?/...", HB_TAG('K','O','N',' ')},*/ /* Kikongo */
-/*{"kfx?", HB_TAG('K','U','L',' ')},*/ /* Kulvi */
-/*{"??", HB_TAG('L','A','H',' ')},*/ /* Lahuli */
-/*{"??", HB_TAG('L','C','R',' ')},*/ /* L-Cree */
+/*{"kqs, kss", HB_TAG('K','I','S',' ')},*/ /* Kisii */
+/*{"lua", HB_TAG('L','U','A',' ')},*/ /* Luba-Lulua */
+/*{"mlq", HB_TAG('M','L','N',' ')},*/ /* Malinke */
+/*{"nso", HB_TAG('N','S','O',' ')},*/ /* Sotho, Northern */
/*{"??", HB_TAG('M','A','L',' ')},*/ /* Malayalam Traditional */
-/*{"mnk?/mlq?/...", HB_TAG('M','L','N',' ')},*/ /* Malinke */
-/*{"??", HB_TAG('N','C','R',' ')},*/ /* N-Cree */
-/*{"??", HB_TAG('N','H','C',' ')},*/ /* Norway House Cree */
-/*{"jpa?/sam?", HB_TAG('P','A','A',' ')},*/ /* Palestinian Aramaic */
-/*{"polyton", HB_TAG('P','G','R',' ')},*/ /* Polytonic Greek */
-/*{"??", HB_TAG('Q','I','N',' ')},*/ /* Asho Chin */
-/*{"??", HB_TAG('R','C','R',' ')},*/ /* R-Cree */
-/*{"chp?", HB_TAG('S','A','Y',' ')},*/ /* Sayisi */
-/*{"xan?", HB_TAG('S','E','K',' ')},*/ /* Sekota */
-/*{"ngo?", HB_TAG('S','X','T',' ')},*/ /* Sutu */
-/*{"??", HB_TAG('T','C','R',' ')},*/ /* TH-Cree */
-/*{"tnz?/tog?/toi?", HB_TAG('T','N','G',' ')},*/ /* Tonga */
-/*{"enh?/yrk?", HB_TAG('T','N','E',' ')},*/ /* Tundra Nenets */
-/*{"??", HB_TAG('W','C','R',' ')},*/ /* West-Cree */
-/*{"cre?", HB_TAG('Y','C','R',' ')},*/ /* Y-Cree */
+/*{"csw", HB_TAG('N','C','R',' ')},*/ /* N-Cree */
+/*{"csw", HB_TAG('N','H','C',' ')},*/ /* Norway House Cree */
+/*{"el-polyton", HB_TAG('P','G','R',' ')},*/ /* Polytonic Greek */
+/*{"bgr, cnh, cnw, czt, sez, tcp, csy, ctd, flm, pck, tcz, zom, cmr, dao, hlt, cka, cnk, mrh, mwg, cbl, cnb, csh", HB_TAG('Q','I','N',' ')},*/ /* Chin */
/*{"??", HB_TAG('Y','I','C',' ')},*/ /* Yi Classic */
-/*{"ii?/Yiii?", HB_TAG('Y','I','M',' ')},*/ /* Yi Modern */
-/*{"??", HB_TAG('Z','H','P',' ')},*/ /* Chinese Phonetic */
+/*{"zh-Latn-pinyin", HB_TAG('Z','H','P',' ')},*/ /* Chinese Phonetic */
};
typedef struct {
- char language[8];
+ char language[11];
hb_tag_t tag;
} LangTagLong;
static const LangTagLong ot_languages_zh[] = {
+ /* Store longest-first, if one is a prefix of another. */
{"zh-cn", HB_TAG('Z','H','S',' ')}, /* Chinese (China) */
{"zh-hk", HB_TAG('Z','H','H',' ')}, /* Chinese (Hong Kong) */
- {"zh-mo", HB_TAG('Z','H','T',' ')}, /* Chinese (Macao) */
+ {"zh-mo", HB_TAG('Z','H','H',' ')}, /* Chinese (Macao) */
{"zh-sg", HB_TAG('Z','H','S',' ')}, /* Chinese (Singapore) */
{"zh-tw", HB_TAG('Z','H','T',' ')}, /* Chinese (Taiwan) */
{"zh-hans", HB_TAG('Z','H','S',' ')}, /* Chinese (Simplified) */
+ {"zh-hant-hk",HB_TAG('Z','H','H',' ')}, /* Chinese (Hong Kong) */
+ {"zh-hant-mo",HB_TAG('Z','H','H',' ')}, /* Chinese (Macao) */
{"zh-hant", HB_TAG('Z','H','T',' ')}, /* Chinese (Traditional) */
};
@@ -832,13 +892,21 @@ hb_ot_tag_from_language (hb_language_t language)
}
/*
- * The International Phonetic Alphabet is a variant tag in BCP-47,
- * which can be applied to any language.
+ * "fonipa" is a variant tag in BCP-47, meaning the International Phonetic Alphabet.
+ * It can be applied to any language.
*/
if (strstr (lang_str, "-fonipa")) {
return HB_TAG('I','P','P','H'); /* Phonetic transcription—IPA conventions */
}
+ /*
+ * "fonnapa" is a variant tag in BCP-47, meaning the North American Phonetic Alphabet
+ * also known as Americanist Phonetic Notation. It can be applied to any language.
+ */
+ if (strstr (lang_str, "-fonnapa")) {
+ return HB_TAG('A','P','P','H'); /* Phonetic transcription—Americanist conventions */
+ }
+
/* Find a language matching in the first component */
{
const LangTag *lang_tag;
@@ -910,6 +978,8 @@ hb_ot_tag_to_language (hb_tag_t tag)
/* struct LangTag has only room for 3-letter language tags. */
switch (tag) {
+ case HB_TAG('A','P','P','H'): /* Phonetic transcription—Americanist conventions */
+ return hb_language_from_string ("und-fonnapa", -1);
case HB_TAG('I','P','P','H'): /* Phonetic transcription—IPA conventions */
return hb_language_from_string ("und-fonipa", -1);
}
@@ -928,4 +998,27 @@ hb_ot_tag_to_language (hb_tag_t tag)
}
}
+#ifdef MAIN
+static inline void
+test_langs_sorted (void)
+{
+ for (unsigned int i = 1; i < ARRAY_LENGTH (ot_languages); i++)
+ {
+ int c = lang_compare_first_component (ot_languages[i-1].language, ot_languages[i].language);
+ if (c >= 0)
+ {
+ fprintf (stderr, "ot_languages not sorted at index %d: %s %d %s\n",
+ i, ot_languages[i-1].language, c, ot_languages[i].language);
+ abort();
+ }
+ }
+}
+
+int
+main (void)
+{
+ test_langs_sorted ();
+ return 0;
+}
+#endif
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-tag.h b/src/3rdparty/harfbuzz-ng/src/hb-ot-tag.h
index 1bf12ab3c0..54fb747f58 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-tag.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-tag.h
@@ -39,18 +39,18 @@ HB_BEGIN_DECLS
#define HB_OT_TAG_DEFAULT_SCRIPT HB_TAG ('D', 'F', 'L', 'T')
#define HB_OT_TAG_DEFAULT_LANGUAGE HB_TAG ('d', 'f', 'l', 't')
-void
+HB_EXTERN void
hb_ot_tags_from_script (hb_script_t script,
hb_tag_t *script_tag_1,
hb_tag_t *script_tag_2);
-hb_script_t
+HB_EXTERN hb_script_t
hb_ot_tag_to_script (hb_tag_t tag);
-hb_tag_t
+HB_EXTERN hb_tag_t
hb_ot_tag_from_language (hb_language_t language);
-hb_language_t
+HB_EXTERN hb_language_t
hb_ot_tag_to_language (hb_tag_t tag);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot.h b/src/3rdparty/harfbuzz-ng/src/hb-ot.h
index 47c92a58e4..113e37b08a 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot.h
@@ -32,6 +32,7 @@
#include "hb-ot-font.h"
#include "hb-ot-layout.h"
+#include "hb-ot-math.h"
#include "hb-ot-tag.h"
#include "hb-ot-shape.h"
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-private.hh
index 53e0510a92..666af6260b 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-private.hh
@@ -83,7 +83,7 @@ extern "C" void hb_free_impl(void *ptr);
#define unlikely(expr) (expr)
#endif
-#ifndef __GNUC__
+#if !defined(__GNUC__) && !defined(__clang__)
#undef __attribute__
#define __attribute__(x)
#endif
@@ -169,6 +169,7 @@ extern "C" void hb_free_impl(void *ptr);
# if defined(_WIN32_WCE)
/* Some things not defined on Windows CE. */
# define strdup _strdup
+# define vsnprintf _vsnprintf
# define getenv(Name) NULL
# if _WIN32_WCE < 0x800
# define setlocale(Category, Locale) "C"
@@ -179,6 +180,9 @@ static int errno = 0; /* Use something better? */
# endif
# if defined(_MSC_VER) && _MSC_VER < 1900
# define snprintf _snprintf
+# elif defined(_MSC_VER) && _MSC_VER >= 1900
+# /* Covers VC++ Error for strdup being a deprecated POSIX name and to instead use _strdup instead */
+# define strdup _strdup
# endif
#endif
@@ -608,6 +612,15 @@ static inline unsigned char TOLOWER (unsigned char c)
/* Debug */
+/* HB_NDEBUG disables some sanity checks that are very safe to disable and
+ * should be disabled in production systems. If NDEBUG is defined, enable
+ * HB_NDEBUG; but if it's desirable that normal assert()s (which are very
+ * light-weight) to be enabled, then HB_DEBUG can be defined to disable
+ * the costlier checks. */
+#ifdef NDEBUG
+#define HB_NDEBUG
+#endif
+
#ifndef HB_DEBUG
#define HB_DEBUG 0
#endif
@@ -676,17 +689,20 @@ _hb_debug_msg_va (const char *what,
fprintf (stderr, " %*s ", (unsigned int) (2 * sizeof (void *)), "");
if (indented) {
-/* One may want to add ASCII version of these. See:
- * https://bugs.freedesktop.org/show_bug.cgi?id=50970 */
#define VBAR "\342\224\202" /* U+2502 BOX DRAWINGS LIGHT VERTICAL */
#define VRBAR "\342\224\234" /* U+251C BOX DRAWINGS LIGHT VERTICAL AND RIGHT */
#define DLBAR "\342\225\256" /* U+256E BOX DRAWINGS LIGHT ARC DOWN AND LEFT */
#define ULBAR "\342\225\257" /* U+256F BOX DRAWINGS LIGHT ARC UP AND LEFT */
#define LBAR "\342\225\264" /* U+2574 BOX DRAWINGS LIGHT LEFT */
- static const char bars[] = VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR;
+ static const char bars[] =
+ VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR
+ VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR
+ VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR
+ VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR
+ VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR;
fprintf (stderr, "%2u %s" VRBAR "%s",
level,
- bars + sizeof (bars) - 1 - MIN ((unsigned int) sizeof (bars), (unsigned int) (sizeof (VBAR) - 1) * level),
+ bars + sizeof (bars) - 1 - MIN ((unsigned int) sizeof (bars) - 1, (unsigned int) (sizeof (VBAR) - 1) * level),
level_dir ? (level_dir > 0 ? DLBAR : ULBAR) : LBAR);
} else
fprintf (stderr, " " VRBAR LBAR);
@@ -891,6 +907,29 @@ hb_in_ranges (T u, T lo1, T hi1, T lo2, T hi2, T lo3, T hi3)
}
+/* Enable bitwise ops on enums marked as flags_t */
+/* To my surprise, looks like the function resolver is happy to silently cast
+ * one enum to another... So this doesn't provide the type-checking that I
+ * originally had in mind... :(.
+ *
+ * For MSVC warnings, see: https://github.com/behdad/harfbuzz/pull/163
+ */
+#ifdef _MSC_VER
+# pragma warning(disable:4200)
+# pragma warning(disable:4800)
+#endif
+#define HB_MARK_AS_FLAG_T(T) \
+ extern "C++" { \
+ static inline T operator | (T l, T r) { return T ((unsigned) l | (unsigned) r); } \
+ static inline T operator & (T l, T r) { return T ((unsigned) l & (unsigned) r); } \
+ static inline T operator ^ (T l, T r) { return T ((unsigned) l ^ (unsigned) r); } \
+ static inline T operator ~ (T r) { return T (~(unsigned int) r); } \
+ static inline T& operator |= (T &l, T r) { l = l | r; return l; } \
+ static inline T& operator &= (T& l, T r) { l = l & r; return l; } \
+ static inline T& operator ^= (T& l, T r) { l = l ^ r; return l; } \
+ }
+
+
/* Useful for set-operations on small enums.
* For example, for testing "x ∈ {x1, x2, x3}" use:
* (FLAG_SAFE(x) & (FLAG(x1) | FLAG(x2) | FLAG(x3)))
@@ -979,5 +1018,7 @@ hb_options (void)
return _hb_options.opts;
}
+/* Size signifying variable-sized array */
+#define VAR 1
#endif /* HB_PRIVATE_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-set-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-set-private.hh
index 3c302b1daf..e2010d7626 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-set-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-set-private.hh
@@ -313,7 +313,7 @@ struct hb_set_t
for (unsigned int i = 0; i < ELTS; i++)
if (elts[i])
for (unsigned int j = 0; j < BITS; j++)
- if (elts[i] & (1 << j))
+ if (elts[i] & (1u << j))
return i * BITS + j;
return INVALID;
}
@@ -322,7 +322,7 @@ struct hb_set_t
for (unsigned int i = ELTS; i; i--)
if (elts[i - 1])
for (unsigned int j = BITS; j; j--)
- if (elts[i - 1] & (1 << (j - 1)))
+ if (elts[i - 1] & (1u << (j - 1)))
return (i - 1) * BITS + (j - 1);
return INVALID;
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-set.h b/src/3rdparty/harfbuzz-ng/src/hb-set.h
index 29bf6556ab..2164c1a654 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-set.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-set.h
@@ -44,109 +44,109 @@ HB_BEGIN_DECLS
typedef struct hb_set_t hb_set_t;
-hb_set_t *
+HB_EXTERN hb_set_t *
hb_set_create (void);
-hb_set_t *
+HB_EXTERN hb_set_t *
hb_set_get_empty (void);
-hb_set_t *
+HB_EXTERN hb_set_t *
hb_set_reference (hb_set_t *set);
-void
+HB_EXTERN void
hb_set_destroy (hb_set_t *set);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_set_set_user_data (hb_set_t *set,
hb_user_data_key_t *key,
void * data,
hb_destroy_func_t destroy,
hb_bool_t replace);
-void *
+HB_EXTERN void *
hb_set_get_user_data (hb_set_t *set,
hb_user_data_key_t *key);
/* Returns false if allocation has failed before */
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_set_allocation_successful (const hb_set_t *set);
-void
+HB_EXTERN void
hb_set_clear (hb_set_t *set);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_set_is_empty (const hb_set_t *set);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_set_has (const hb_set_t *set,
hb_codepoint_t codepoint);
/* Right now limited to 16-bit integers. Eventually will do full codepoint range, sans -1
* which we will use as a sentinel. */
-void
+HB_EXTERN void
hb_set_add (hb_set_t *set,
hb_codepoint_t codepoint);
-void
+HB_EXTERN void
hb_set_add_range (hb_set_t *set,
hb_codepoint_t first,
hb_codepoint_t last);
-void
+HB_EXTERN void
hb_set_del (hb_set_t *set,
hb_codepoint_t codepoint);
-void
+HB_EXTERN void
hb_set_del_range (hb_set_t *set,
hb_codepoint_t first,
hb_codepoint_t last);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_set_is_equal (const hb_set_t *set,
const hb_set_t *other);
-void
+HB_EXTERN void
hb_set_set (hb_set_t *set,
const hb_set_t *other);
-void
+HB_EXTERN void
hb_set_union (hb_set_t *set,
const hb_set_t *other);
-void
+HB_EXTERN void
hb_set_intersect (hb_set_t *set,
const hb_set_t *other);
-void
+HB_EXTERN void
hb_set_subtract (hb_set_t *set,
const hb_set_t *other);
-void
+HB_EXTERN void
hb_set_symmetric_difference (hb_set_t *set,
const hb_set_t *other);
-void
+HB_EXTERN void
hb_set_invert (hb_set_t *set);
-unsigned int
+HB_EXTERN unsigned int
hb_set_get_population (const hb_set_t *set);
/* Returns -1 if set empty. */
-hb_codepoint_t
+HB_EXTERN hb_codepoint_t
hb_set_get_min (const hb_set_t *set);
/* Returns -1 if set empty. */
-hb_codepoint_t
+HB_EXTERN hb_codepoint_t
hb_set_get_max (const hb_set_t *set);
/* Pass -1 in to get started. */
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_set_next (const hb_set_t *set,
hb_codepoint_t *codepoint);
/* Pass -1 for first and last to get started. */
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_set_next_range (const hb_set_t *set,
hb_codepoint_t *first,
hb_codepoint_t *last);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-shape-plan-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-shape-plan-private.hh
index 607da5e779..aa0413a272 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-shape-plan-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-shape-plan-private.hh
@@ -47,12 +47,17 @@ struct hb_shape_plan_t
hb_feature_t *user_features;
unsigned int num_user_features;
+ int *coords;
+ unsigned int num_coords;
+
struct hb_shaper_data_t shaper_data;
};
#define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS \
- , const hb_feature_t *user_features \
- , unsigned int num_user_features
+ , const hb_feature_t *user_features \
+ , unsigned int num_user_features \
+ , const int *coords \
+ , unsigned int num_coords
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_PROTOTYPE(shaper, shape_plan);
#include "hb-shaper-list.hh"
#undef HB_SHAPER_IMPLEMENT
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc b/src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc
index 56e2ea5c19..600faaeb18 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc
@@ -46,11 +46,14 @@ static void
hb_shape_plan_plan (hb_shape_plan_t *shape_plan,
const hb_feature_t *user_features,
unsigned int num_user_features,
+ const int *coords,
+ unsigned int num_coords,
const char * const *shaper_list)
{
DEBUG_MSG_FUNC (SHAPE_PLAN, shape_plan,
- "num_features=%d shaper_list=%p",
+ "num_features=%d num_coords=%d shaper_list=%p",
num_user_features,
+ num_coords,
shaper_list);
const hb_shaper_pair_t *shapers = _hb_shapers_get ();
@@ -59,7 +62,9 @@ hb_shape_plan_plan (hb_shape_plan_t *shape_plan,
HB_STMT_START { \
if (hb_##shaper##_shaper_face_data_ensure (shape_plan->face_unsafe)) { \
HB_SHAPER_DATA (shaper, shape_plan) = \
- HB_SHAPER_DATA_CREATE_FUNC (shaper, shape_plan) (shape_plan, user_features, num_user_features); \
+ HB_SHAPER_DATA_CREATE_FUNC (shaper, shape_plan) (shape_plan, \
+ user_features, num_user_features, \
+ coords, num_coords); \
shape_plan->shaper_func = _hb_##shaper##_shape; \
shape_plan->shaper_name = #shaper; \
return; \
@@ -115,14 +120,31 @@ hb_shape_plan_create (hb_face_t *face,
unsigned int num_user_features,
const char * const *shaper_list)
{
+ return hb_shape_plan_create2 (face, props,
+ user_features, num_user_features,
+ NULL, 0,
+ shaper_list);
+}
+
+hb_shape_plan_t *
+hb_shape_plan_create2 (hb_face_t *face,
+ const hb_segment_properties_t *props,
+ const hb_feature_t *user_features,
+ unsigned int num_user_features,
+ const int *orig_coords,
+ unsigned int num_coords,
+ const char * const *shaper_list)
+{
DEBUG_MSG_FUNC (SHAPE_PLAN, NULL,
- "face=%p num_features=%d shaper_list=%p",
+ "face=%p num_features=%d num_coords=%d shaper_list=%p",
face,
num_user_features,
+ num_coords,
shaper_list);
hb_shape_plan_t *shape_plan;
hb_feature_t *features = NULL;
+ int *coords = NULL;
if (unlikely (!face))
face = hb_face_get_empty ();
@@ -130,7 +152,14 @@ hb_shape_plan_create (hb_face_t *face,
return hb_shape_plan_get_empty ();
if (num_user_features && !(features = (hb_feature_t *) calloc (num_user_features, sizeof (hb_feature_t))))
return hb_shape_plan_get_empty ();
- if (!(shape_plan = hb_object_create<hb_shape_plan_t> ())) {
+ if (num_coords && !(coords = (int *) calloc (num_coords, sizeof (int))))
+ {
+ free (features);
+ return hb_shape_plan_get_empty ();
+ }
+ if (!(shape_plan = hb_object_create<hb_shape_plan_t> ()))
+ {
+ free (coords);
free (features);
return hb_shape_plan_get_empty ();
}
@@ -145,8 +174,15 @@ hb_shape_plan_create (hb_face_t *face,
shape_plan->user_features = features;
if (num_user_features)
memcpy (features, user_features, num_user_features * sizeof (hb_feature_t));
+ shape_plan->num_coords = num_coords;
+ shape_plan->coords = coords;
+ if (num_coords)
+ memcpy (coords, orig_coords, num_coords * sizeof (int));
- hb_shape_plan_plan (shape_plan, user_features, num_user_features, shaper_list);
+ hb_shape_plan_plan (shape_plan,
+ user_features, num_user_features,
+ coords, num_coords,
+ shaper_list);
return shape_plan;
}
@@ -176,6 +212,9 @@ hb_shape_plan_get_empty (void)
NULL, /* user_features */
0, /* num_user_featurs */
+ NULL, /* coords */
+ 0, /* num_coords */
+
{
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
#include "hb-shaper-list.hh"
@@ -220,6 +259,7 @@ hb_shape_plan_destroy (hb_shape_plan_t *shape_plan)
#undef HB_SHAPER_IMPLEMENT
free (shape_plan->user_features);
+ free (shape_plan->coords);
free (shape_plan);
}
@@ -289,9 +329,10 @@ hb_shape_plan_execute (hb_shape_plan_t *shape_plan,
unsigned int num_features)
{
DEBUG_MSG_FUNC (SHAPE_PLAN, shape_plan,
- "num_features=%d shaper_func=%p",
+ "num_features=%d shaper_func=%p, shaper_name=%s",
num_features,
- shape_plan->shaper_func);
+ shape_plan->shaper_func,
+ shape_plan->shaper_name);
if (unlikely (!buffer->len))
return true;
@@ -350,6 +391,8 @@ struct hb_shape_plan_proposal_t
const char * const *shaper_list;
const hb_feature_t *user_features;
unsigned int num_user_features;
+ const int *coords;
+ unsigned int num_coords;
hb_shape_func_t *shaper_func;
};
@@ -357,12 +400,26 @@ static inline hb_bool_t
hb_shape_plan_user_features_match (const hb_shape_plan_t *shape_plan,
const hb_shape_plan_proposal_t *proposal)
{
- if (proposal->num_user_features != shape_plan->num_user_features) return false;
+ if (proposal->num_user_features != shape_plan->num_user_features)
+ return false;
for (unsigned int i = 0, n = proposal->num_user_features; i < n; i++)
if (proposal->user_features[i].tag != shape_plan->user_features[i].tag ||
proposal->user_features[i].value != shape_plan->user_features[i].value ||
proposal->user_features[i].start != shape_plan->user_features[i].start ||
- proposal->user_features[i].end != shape_plan->user_features[i].end) return false;
+ proposal->user_features[i].end != shape_plan->user_features[i].end)
+ return false;
+ return true;
+}
+
+static inline hb_bool_t
+hb_shape_plan_coords_match (const hb_shape_plan_t *shape_plan,
+ const hb_shape_plan_proposal_t *proposal)
+{
+ if (proposal->num_coords != shape_plan->num_coords)
+ return false;
+ for (unsigned int i = 0, n = proposal->num_coords; i < n; i++)
+ if (proposal->coords[i] != shape_plan->coords[i])
+ return false;
return true;
}
@@ -372,6 +429,7 @@ hb_shape_plan_matches (const hb_shape_plan_t *shape_plan,
{
return hb_segment_properties_equal (&shape_plan->props, &proposal->props) &&
hb_shape_plan_user_features_match (shape_plan, proposal) &&
+ hb_shape_plan_coords_match (shape_plan, proposal) &&
((shape_plan->default_shaper_list && proposal->shaper_list == NULL) ||
(shape_plan->shaper_func == proposal->shaper_func));
}
@@ -388,6 +446,13 @@ hb_non_global_user_features_present (const hb_feature_t *user_features,
return false;
}
+static inline hb_bool_t
+hb_coords_present (const int *coords,
+ unsigned int num_coords)
+{
+ return num_coords != 0;
+}
+
/**
* hb_shape_plan_create_cached:
* @face:
@@ -409,6 +474,21 @@ hb_shape_plan_create_cached (hb_face_t *face,
unsigned int num_user_features,
const char * const *shaper_list)
{
+ return hb_shape_plan_create_cached2 (face, props,
+ user_features, num_user_features,
+ NULL, 0,
+ shaper_list);
+}
+
+hb_shape_plan_t *
+hb_shape_plan_create_cached2 (hb_face_t *face,
+ const hb_segment_properties_t *props,
+ const hb_feature_t *user_features,
+ unsigned int num_user_features,
+ const int *coords,
+ unsigned int num_coords,
+ const char * const *shaper_list)
+{
DEBUG_MSG_FUNC (SHAPE_PLAN, NULL,
"face=%p num_features=%d shaper_list=%p",
face,
@@ -455,16 +535,21 @@ retry:
/* Not found. */
- hb_shape_plan_t *shape_plan = hb_shape_plan_create (face, props, user_features, num_user_features, shaper_list);
+ hb_shape_plan_t *shape_plan = hb_shape_plan_create2 (face, props,
+ user_features, num_user_features,
+ coords, num_coords,
+ shaper_list);
/* Don't add to the cache if face is inert. */
if (unlikely (hb_object_is_inert (face)))
return shape_plan;
/* Don't add the plan to the cache if there were user features with non-global ranges */
-
if (hb_non_global_user_features_present (user_features, num_user_features))
return shape_plan;
+ /* Don't add the plan to the cache if there were variation coordinates XXX Fix me. */
+ if (hb_coords_present (coords, num_coords))
+ return shape_plan;
hb_face_t::plan_node_t *node = (hb_face_t::plan_node_t *) calloc (1, sizeof (hb_face_t::plan_node_t));
if (unlikely (!node))
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-shape-plan.h b/src/3rdparty/harfbuzz-ng/src/hb-shape-plan.h
index 8f54552f90..b62ae7ca35 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-shape-plan.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-shape-plan.h
@@ -38,49 +38,68 @@ HB_BEGIN_DECLS
typedef struct hb_shape_plan_t hb_shape_plan_t;
-hb_shape_plan_t *
+HB_EXTERN hb_shape_plan_t *
hb_shape_plan_create (hb_face_t *face,
const hb_segment_properties_t *props,
const hb_feature_t *user_features,
unsigned int num_user_features,
const char * const *shaper_list);
-hb_shape_plan_t *
+HB_EXTERN hb_shape_plan_t *
hb_shape_plan_create_cached (hb_face_t *face,
const hb_segment_properties_t *props,
const hb_feature_t *user_features,
unsigned int num_user_features,
const char * const *shaper_list);
-hb_shape_plan_t *
+HB_EXTERN hb_shape_plan_t *
+hb_shape_plan_create2 (hb_face_t *face,
+ const hb_segment_properties_t *props,
+ const hb_feature_t *user_features,
+ unsigned int num_user_features,
+ const int *coords,
+ unsigned int num_coords,
+ const char * const *shaper_list);
+
+HB_EXTERN hb_shape_plan_t *
+hb_shape_plan_create_cached2 (hb_face_t *face,
+ const hb_segment_properties_t *props,
+ const hb_feature_t *user_features,
+ unsigned int num_user_features,
+ const int *coords,
+ unsigned int num_coords,
+ const char * const *shaper_list);
+
+
+HB_EXTERN hb_shape_plan_t *
hb_shape_plan_get_empty (void);
-hb_shape_plan_t *
+HB_EXTERN hb_shape_plan_t *
hb_shape_plan_reference (hb_shape_plan_t *shape_plan);
-void
+HB_EXTERN void
hb_shape_plan_destroy (hb_shape_plan_t *shape_plan);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_shape_plan_set_user_data (hb_shape_plan_t *shape_plan,
hb_user_data_key_t *key,
void * data,
hb_destroy_func_t destroy,
hb_bool_t replace);
-void *
+HB_EXTERN void *
hb_shape_plan_get_user_data (hb_shape_plan_t *shape_plan,
hb_user_data_key_t *key);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_shape_plan_execute (hb_shape_plan_t *shape_plan,
hb_font_t *font,
hb_buffer_t *buffer,
const hb_feature_t *features,
unsigned int num_features);
-const char *
+HB_EXTERN const char *
hb_shape_plan_get_shaper (hb_shape_plan_t *shape_plan);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-shape.cc b/src/3rdparty/harfbuzz-ng/src/hb-shape.cc
index 8a98583989..706f14420d 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-shape.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-shape.cc
@@ -210,13 +210,15 @@ parse_one_feature (const char **pp, const char *end, hb_feature_t *feature)
/**
* hb_feature_from_string:
* @str: (array length=len) (element-type uint8_t): a string to parse
- * @len: length of @str, or -1 if string is nul-terminated
+ * @len: length of @str, or -1 if string is %NULL terminated
* @feature: (out): the #hb_feature_t to initialize with the parsed values
*
- * Parses a string into a #hb_feature_t. If @len is -1 then @str is
- * %NULL-terminated.
+ * Parses a string into a #hb_feature_t.
*
- * Return value: %TRUE if @str is successfully parsed, %FALSE otherwise
+ * TODO: document the syntax here.
+ *
+ * Return value:
+ * %true if @str is successfully parsed, %false otherwise.
*
* Since: 0.9.5
**/
@@ -371,7 +373,10 @@ hb_shape_full (hb_font_t *font,
unsigned int num_features,
const char * const *shaper_list)
{
- hb_shape_plan_t *shape_plan = hb_shape_plan_create_cached (font->face, &buffer->props, features, num_features, shaper_list);
+ hb_shape_plan_t *shape_plan = hb_shape_plan_create_cached2 (font->face, &buffer->props,
+ features, num_features,
+ font->coords, font->num_coords,
+ shaper_list);
hb_bool_t res = hb_shape_plan_execute (shape_plan, font, buffer, features, num_features);
hb_shape_plan_destroy (shape_plan);
@@ -392,8 +397,6 @@ hb_shape_full (hb_font_t *font,
* positioned glyphs. If @features is not %NULL, it will be used to control the
* features applied during shaping.
*
- * Return value: %FALSE if all shapers failed, %TRUE otherwise
- *
* Since: 0.9.2
**/
void
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-shape.h b/src/3rdparty/harfbuzz-ng/src/hb-shape.h
index b665509a0d..53bb845bf4 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-shape.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-shape.h
@@ -47,29 +47,29 @@ typedef struct hb_feature_t {
unsigned int end;
} hb_feature_t;
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_feature_from_string (const char *str, int len,
hb_feature_t *feature);
-void
+HB_EXTERN void
hb_feature_to_string (hb_feature_t *feature,
char *buf, unsigned int size);
-void
+HB_EXTERN void
hb_shape (hb_font_t *font,
hb_buffer_t *buffer,
const hb_feature_t *features,
unsigned int num_features);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_shape_full (hb_font_t *font,
hb_buffer_t *buffer,
const hb_feature_t *features,
unsigned int num_features,
const char * const *shaper_list);
-const char **
+HB_EXTERN const char **
hb_shape_list_shapers (void);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-shaper-list.hh b/src/3rdparty/harfbuzz-ng/src/hb-shaper-list.hh
index 6c537d4921..b0835d31ab 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-shaper-list.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-shaper-list.hh
@@ -46,6 +46,9 @@ HB_SHAPER_IMPLEMENT (ot) /* <--- This is our main OpenType shaper. */
#ifdef HAVE_UNISCRIBE
HB_SHAPER_IMPLEMENT (uniscribe)
#endif
+#ifdef HAVE_DIRECTWRITE
+HB_SHAPER_IMPLEMENT (directwrite)
+#endif
#ifdef HAVE_CORETEXT
HB_SHAPER_IMPLEMENT (coretext)
#endif
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-unicode-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-unicode-private.hh
index 968bca5567..a4d118b6dc 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-unicode-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-unicode-private.hh
@@ -115,6 +115,8 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
/* XXX This hack belongs to the Tibetan shaper:
* Reorder PADMA to ensure it comes after any vowel marks. */
if (unlikely (unicode == 0x0FC6u)) return 254;
+ /* Reorder TSA -PHRU to reorder before U+0F74 */
+ if (unlikely (unicode == 0x0F39u)) return 127;
return _hb_modified_combining_class[combining_class (unicode)];
}
@@ -180,8 +182,8 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
case 0x17: return hb_in_range (ch, 0x17B4u, 0x17B5u);
case 0x18: return hb_in_range (ch, 0x180Bu, 0x180Eu);
case 0x20: return hb_in_ranges (ch, 0x200Bu, 0x200Fu,
- 0x202Au, 0x202Eu,
- 0x2060u, 0x206Fu);
+ 0x202Au, 0x202Eu,
+ 0x2060u, 0x206Fu);
case 0xFE: return hb_in_range (ch, 0xFE00u, 0xFE0Fu) || ch == 0xFEFFu;
case 0xFF: return hb_in_range (ch, 0xFFF0u, 0xFFF8u);
default: return false;
@@ -199,6 +201,50 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
}
}
+ /* Space estimates based on:
+ * http://www.unicode.org/charts/PDF/U2000.pdf
+ * https://www.microsoft.com/typography/developers/fdsspec/spaces.aspx
+ */
+ enum space_t {
+ NOT_SPACE = 0,
+ SPACE_EM = 1,
+ SPACE_EM_2 = 2,
+ SPACE_EM_3 = 3,
+ SPACE_EM_4 = 4,
+ SPACE_EM_5 = 5,
+ SPACE_EM_6 = 6,
+ SPACE_EM_16 = 16,
+ SPACE_4_EM_18, /* 4/18th of an EM! */
+ SPACE,
+ SPACE_FIGURE,
+ SPACE_PUNCTUATION,
+ SPACE_NARROW,
+ };
+ static inline space_t
+ space_fallback_type (hb_codepoint_t u)
+ {
+ switch (u)
+ {
+ /* All GC=Zs chars that can use a fallback. */
+ default: return NOT_SPACE; /* U+1680 OGHAM SPACE MARK */
+ case 0x0020u: return SPACE; /* U+0020 SPACE */
+ case 0x00A0u: return SPACE; /* U+00A0 NO-BREAK SPACE */
+ case 0x2000u: return SPACE_EM_2; /* U+2000 EN QUAD */
+ case 0x2001u: return SPACE_EM; /* U+2001 EM QUAD */
+ case 0x2002u: return SPACE_EM_2; /* U+2002 EN SPACE */
+ case 0x2003u: return SPACE_EM; /* U+2003 EM SPACE */
+ case 0x2004u: return SPACE_EM_3; /* U+2004 THREE-PER-EM SPACE */
+ case 0x2005u: return SPACE_EM_4; /* U+2005 FOUR-PER-EM SPACE */
+ case 0x2006u: return SPACE_EM_6; /* U+2006 SIX-PER-EM SPACE */
+ case 0x2007u: return SPACE_FIGURE; /* U+2007 FIGURE SPACE */
+ case 0x2008u: return SPACE_PUNCTUATION; /* U+2008 PUNCTUATION SPACE */
+ case 0x2009u: return SPACE_EM_5; /* U+2009 THIN SPACE */
+ case 0x200Au: return SPACE_EM_16; /* U+200A HAIR SPACE */
+ case 0x202Fu: return SPACE_NARROW; /* U+202F NARROW NO-BREAK SPACE */
+ case 0x205Fu: return SPACE_4_EM_18; /* U+205F MEDIUM MATHEMATICAL SPACE */
+ case 0x3000u: return SPACE_EM; /* U+3000 IDEOGRAPHIC SPACE */
+ }
+ }
struct {
#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_unicode_##name##_func_t name;
@@ -299,10 +345,12 @@ extern HB_INTERNAL const hb_unicode_funcs_t _hb_unicode_funcs_nil;
#define HB_MODIFIED_COMBINING_CLASS_CCC118 118 /* sign u / sign uu */
#define HB_MODIFIED_COMBINING_CLASS_CCC122 122 /* mai * */
-/* Tibetan */
+/* Tibetan
+ * Modify U+0F74 (ccc=132) to reorder before ccc=130 marks.
+ */
#define HB_MODIFIED_COMBINING_CLASS_CCC129 129 /* sign aa */
#define HB_MODIFIED_COMBINING_CLASS_CCC130 130 /* sign i */
-#define HB_MODIFIED_COMBINING_CLASS_CCC132 132 /* sign u */
+#define HB_MODIFIED_COMBINING_CLASS_CCC132 128 /* sign u */
/* Misc */
@@ -313,5 +361,10 @@ extern HB_INTERNAL const hb_unicode_funcs_t _hb_unicode_funcs_nil;
FLAG (HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) | \
FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)))
+#define HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK_OR_MODIFIER_SYMBOL(gen_cat) \
+ (FLAG_SAFE (gen_cat) & \
+ (FLAG (HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) | \
+ FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) | \
+ FLAG (HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL)))
#endif /* HB_UNICODE_PRIVATE_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-unicode.cc b/src/3rdparty/harfbuzz-ng/src/hb-unicode.cc
index 487d10b939..d553a7172f 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-unicode.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-unicode.cc
@@ -131,12 +131,12 @@ hb_unicode_funcs_get_default (void)
#define HB_UNICODE_FUNCS_IMPLEMENT(set) \
return hb_##set##_get_unicode_funcs ();
-#ifdef HAVE_GLIB
+#if defined(HAVE_UCDN)
+ HB_UNICODE_FUNCS_IMPLEMENT(ucdn)
+#elif defined(HAVE_GLIB)
HB_UNICODE_FUNCS_IMPLEMENT(glib)
#elif defined(HAVE_ICU) && defined(HAVE_ICU_BUILTIN)
HB_UNICODE_FUNCS_IMPLEMENT(icu)
-#elif defined(HAVE_UCDN)
- HB_UNICODE_FUNCS_IMPLEMENT(ucdn)
#else
#define HB_UNICODE_FUNCS_NIL 1
HB_UNICODE_FUNCS_IMPLEMENT(nil)
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-unicode.h b/src/3rdparty/harfbuzz-ng/src/hb-unicode.h
index 3a12e2f9a2..2657f48130 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-unicode.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-unicode.h
@@ -174,23 +174,23 @@ typedef struct hb_unicode_funcs_t hb_unicode_funcs_t;
/*
* just give me the best implementation you've got there.
*/
-hb_unicode_funcs_t *
+HB_EXTERN hb_unicode_funcs_t *
hb_unicode_funcs_get_default (void);
-hb_unicode_funcs_t *
+HB_EXTERN hb_unicode_funcs_t *
hb_unicode_funcs_create (hb_unicode_funcs_t *parent);
-hb_unicode_funcs_t *
+HB_EXTERN hb_unicode_funcs_t *
hb_unicode_funcs_get_empty (void);
-hb_unicode_funcs_t *
+HB_EXTERN hb_unicode_funcs_t *
hb_unicode_funcs_reference (hb_unicode_funcs_t *ufuncs);
-void
+HB_EXTERN void
hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_unicode_funcs_set_user_data (hb_unicode_funcs_t *ufuncs,
hb_user_data_key_t *key,
void * data,
@@ -198,18 +198,18 @@ hb_unicode_funcs_set_user_data (hb_unicode_funcs_t *ufuncs,
hb_bool_t replace);
-void *
+HB_EXTERN void *
hb_unicode_funcs_get_user_data (hb_unicode_funcs_t *ufuncs,
hb_user_data_key_t *key);
-void
+HB_EXTERN void
hb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_unicode_funcs_is_immutable (hb_unicode_funcs_t *ufuncs);
-hb_unicode_funcs_t *
+HB_EXTERN hb_unicode_funcs_t *
hb_unicode_funcs_get_parent (hb_unicode_funcs_t *ufuncs);
@@ -285,7 +285,7 @@ typedef unsigned int (*hb_unicode_decompose_compatibility_func_t) (hb_unicode_
*
* Since: 0.9.2
**/
-void
+HB_EXTERN void
hb_unicode_funcs_set_combining_class_func (hb_unicode_funcs_t *ufuncs,
hb_unicode_combining_class_func_t func,
void *user_data, hb_destroy_func_t destroy);
@@ -301,7 +301,7 @@ hb_unicode_funcs_set_combining_class_func (hb_unicode_funcs_t *ufuncs,
*
* Since: 0.9.2
**/
-void
+HB_EXTERN void
hb_unicode_funcs_set_eastasian_width_func (hb_unicode_funcs_t *ufuncs,
hb_unicode_eastasian_width_func_t func,
void *user_data, hb_destroy_func_t destroy);
@@ -317,7 +317,7 @@ hb_unicode_funcs_set_eastasian_width_func (hb_unicode_funcs_t *ufuncs,
*
* Since: 0.9.2
**/
-void
+HB_EXTERN void
hb_unicode_funcs_set_general_category_func (hb_unicode_funcs_t *ufuncs,
hb_unicode_general_category_func_t func,
void *user_data, hb_destroy_func_t destroy);
@@ -333,7 +333,7 @@ hb_unicode_funcs_set_general_category_func (hb_unicode_funcs_t *ufuncs,
*
* Since: 0.9.2
**/
-void
+HB_EXTERN void
hb_unicode_funcs_set_mirroring_func (hb_unicode_funcs_t *ufuncs,
hb_unicode_mirroring_func_t func,
void *user_data, hb_destroy_func_t destroy);
@@ -349,7 +349,7 @@ hb_unicode_funcs_set_mirroring_func (hb_unicode_funcs_t *ufuncs,
*
* Since: 0.9.2
**/
-void
+HB_EXTERN void
hb_unicode_funcs_set_script_func (hb_unicode_funcs_t *ufuncs,
hb_unicode_script_func_t func,
void *user_data, hb_destroy_func_t destroy);
@@ -365,7 +365,7 @@ hb_unicode_funcs_set_script_func (hb_unicode_funcs_t *ufuncs,
*
* Since: 0.9.2
**/
-void
+HB_EXTERN void
hb_unicode_funcs_set_compose_func (hb_unicode_funcs_t *ufuncs,
hb_unicode_compose_func_t func,
void *user_data, hb_destroy_func_t destroy);
@@ -381,7 +381,7 @@ hb_unicode_funcs_set_compose_func (hb_unicode_funcs_t *ufuncs,
*
* Since: 0.9.2
**/
-void
+HB_EXTERN void
hb_unicode_funcs_set_decompose_func (hb_unicode_funcs_t *ufuncs,
hb_unicode_decompose_func_t func,
void *user_data, hb_destroy_func_t destroy);
@@ -397,7 +397,7 @@ hb_unicode_funcs_set_decompose_func (hb_unicode_funcs_t *ufuncs,
*
* Since: 0.9.2
**/
-void
+HB_EXTERN void
hb_unicode_funcs_set_decompose_compatibility_func (hb_unicode_funcs_t *ufuncs,
hb_unicode_decompose_compatibility_func_t func,
void *user_data, hb_destroy_func_t destroy);
@@ -405,62 +405,63 @@ hb_unicode_funcs_set_decompose_compatibility_func (hb_unicode_funcs_t *ufuncs,
/* accessors */
/**
+ * hb_unicode_combining_class:
+ *
* Since: 0.9.2
**/
-hb_unicode_combining_class_t
+HB_EXTERN hb_unicode_combining_class_t
hb_unicode_combining_class (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t unicode);
/**
+ * hb_unicode_eastasian_width:
+ *
* Since: 0.9.2
**/
-unsigned int
+HB_EXTERN unsigned int
hb_unicode_eastasian_width (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t unicode);
/**
+ * hb_unicode_general_category:
+ *
* Since: 0.9.2
**/
-hb_unicode_general_category_t
+HB_EXTERN hb_unicode_general_category_t
hb_unicode_general_category (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t unicode);
/**
+ * hb_unicode_mirroring:
+ *
* Since: 0.9.2
**/
-hb_codepoint_t
+HB_EXTERN hb_codepoint_t
hb_unicode_mirroring (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t unicode);
/**
+ * hb_unicode_script:
+ *
* Since: 0.9.2
**/
-hb_script_t
+HB_EXTERN hb_script_t
hb_unicode_script (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t unicode);
-/**
- * Since: 0.9.2
- **/
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_unicode_compose (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t a,
hb_codepoint_t b,
hb_codepoint_t *ab);
-/**
- * Since: 0.9.2
- **/
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_unicode_decompose (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t ab,
hb_codepoint_t *a,
hb_codepoint_t *b);
-/**
- * Since: 0.9.2
- **/
-unsigned int
+HB_EXTERN unsigned int
hb_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs,
hb_codepoint_t u,
hb_codepoint_t *decomposed);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-utf-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-utf-private.hh
index 14d3c2e369..74cf5d66a2 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-utf-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-utf-private.hh
@@ -146,11 +146,11 @@ struct hb_utf16_t
return text;
}
- if (likely (hb_in_range (c, 0xD800u, 0xDBFFu)))
+ if (likely (c <= 0xDBFFu && text < end))
{
/* High-surrogate in c */
- hb_codepoint_t l;
- if (text < end && ((l = *text), likely (hb_in_range (l, 0xDC00u, 0xDFFFu))))
+ hb_codepoint_t l = *text;
+ if (likely (hb_in_range (l, 0xDC00u, 0xDFFFu)))
{
/* Low-surrogate in l */
*unicode = (c << 10) + l - ((0xD800u << 10) - 0x10000u + 0xDC00u);
@@ -170,8 +170,7 @@ struct hb_utf16_t
hb_codepoint_t *unicode,
hb_codepoint_t replacement)
{
- const uint16_t *end = text--;
- hb_codepoint_t c = *text;
+ hb_codepoint_t c = *--text;
if (likely (!hb_in_range (c, 0xD800u, 0xDFFFu)))
{
@@ -179,14 +178,22 @@ struct hb_utf16_t
return text;
}
- if (likely (start < text && hb_in_range (c, 0xDC00u, 0xDFFFu)))
- text--;
-
- if (likely (next (text, end, unicode, replacement) == end))
- return text;
+ if (likely (c >= 0xDC00u && start < text))
+ {
+ /* Low-surrogate in c */
+ hb_codepoint_t h = text[-1];
+ if (likely (hb_in_range (h, 0xD800u, 0xDBFFu)))
+ {
+ /* High-surrogate in h */
+ *unicode = (h << 10) + c - ((0xD800u << 10) - 0x10000u + 0xDC00u);
+ text--;
+ return text;
+ }
+ }
+ /* Lonely / out-of-order surrogate. */
*unicode = replacement;
- return end - 1;
+ return text;
}
@@ -211,14 +218,9 @@ struct hb_utf32_t
hb_codepoint_t *unicode,
hb_codepoint_t replacement)
{
- hb_codepoint_t c = *text++;
- if (validate && unlikely (c > 0x10FFFFu || hb_in_range (c, 0xD800u, 0xDFFFu)))
- goto error;
- *unicode = c;
- return text;
-
- error:
- *unicode = replacement;
+ hb_codepoint_t c = *unicode = *text++;
+ if (validate && unlikely (c >= 0xD800u && (c <= 0xDFFFu || c > 0x10FFFFu)))
+ *unicode = replacement;
return text;
}
@@ -228,8 +230,10 @@ struct hb_utf32_t
hb_codepoint_t *unicode,
hb_codepoint_t replacement)
{
- next (text - 1, text, unicode, replacement);
- return text - 1;
+ hb_codepoint_t c = *unicode = *--text;
+ if (validate && unlikely (c >= 0xD800u && (c <= 0xDFFFu || c > 0x10FFFFu)))
+ *unicode = replacement;
+ return text;
}
static inline unsigned int
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-version.h b/src/3rdparty/harfbuzz-ng/src/hb-version.h
index bd9ac3d1fc..0cbe947062 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-version.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-version.h
@@ -37,25 +37,25 @@ HB_BEGIN_DECLS
#define HB_VERSION_MAJOR 1
-#define HB_VERSION_MINOR 0
-#define HB_VERSION_MICRO 6
+#define HB_VERSION_MINOR 4
+#define HB_VERSION_MICRO 1
-#define HB_VERSION_STRING "1.0.6"
+#define HB_VERSION_STRING "1.4.1"
#define HB_VERSION_ATLEAST(major,minor,micro) \
((major)*10000+(minor)*100+(micro) <= \
HB_VERSION_MAJOR*10000+HB_VERSION_MINOR*100+HB_VERSION_MICRO)
-void
+HB_EXTERN void
hb_version (unsigned int *major,
unsigned int *minor,
unsigned int *micro);
-const char *
+HB_EXTERN const char *
hb_version_string (void);
-hb_bool_t
+HB_EXTERN hb_bool_t
hb_version_atleast (unsigned int major,
unsigned int minor,
unsigned int micro);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb.h b/src/3rdparty/harfbuzz-ng/src/hb.h
index c5a938a381..7402034f43 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb.h
@@ -28,6 +28,10 @@
#define HB_H
#define HB_H_IN
+#ifndef HB_EXTERN
+#define HB_EXTERN extern
+#endif
+
#include "hb-blob.h"
#include "hb-buffer.h"
#include "hb-common.h"
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-thai.c b/src/3rdparty/harfbuzz/src/harfbuzz-thai.c
index 2d4627e4f7..fe3296e887 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-thai.c
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-thai.c
@@ -277,7 +277,7 @@ static HB_Bool HB_ThaiConvertStringToGlyphIndices (HB_ShaperItem *item)
}
}
- /* Special case to handle U+0E33 (SARA AM, ำ): SARA AM is normally written at the end of a
+ /* Special case to handle U+0E33 (SARA AM): SARA AM is normally written at the end of a
* word with a base character and an optional top character before it. For example, U+0E0B
* (base), U+0E49 (top), U+0E33 (SARA AM). The sequence should be converted to 4 glyphs:
* base, hilo (the little circle in the top left part of SARA AM, NIKHAHIT), top, then the
diff --git a/src/3rdparty/libpng/ANNOUNCE b/src/3rdparty/libpng/ANNOUNCE
index 4dae783b55..70a71e3b0e 100644
--- a/src/3rdparty/libpng/ANNOUNCE
+++ b/src/3rdparty/libpng/ANNOUNCE
@@ -1,4 +1,4 @@
-Libpng 1.6.20 - December 3, 2015
+Libpng 1.6.28 - January 5, 2017
This is a public release of libpng, intended for use in production codes.
@@ -7,41 +7,28 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a
"configure" script
- libpng-1.6.20.tar.xz (LZMA-compressed, recommended)
- libpng-1.6.20.tar.gz
+ libpng-1.6.28.tar.xz (LZMA-compressed, recommended)
+ libpng-1.6.28.tar.gz
Source files with CRLF line endings (for Windows), without the
"configure" script
- /scratch/glennrp/Libpng16/lpng1620.7z (LZMA-compressed, recommended)
- /scratch/glennrp/Libpng16/lpng1620.zip
+ lpng1628.7z (LZMA-compressed, recommended)
+ lpng1628.zip
Other information:
- libpng-1.6.20-README.txt
- libpng-1.6.20-LICENSE.txt
- libpng-1.6.20-*.asc (armored detached GPG signatures)
-
-Changes since the last public release (1.6.19):
- Avoid potential pointer overflow/underflow in png_handle_sPLT() and
- png_handle_pCAL() (Bug report by John Regehr).
- Fixed incorrect implementation of png_set_PLTE() that uses png_ptr
- not info_ptr, that left png_set_PLTE() open to the CVE-2015-8126
- vulnerability.
- Backported tests from libpng-1.7.0beta69.
- Fixed an error in handling of bad zlib CMINFO field in pngfix, found by
- American Fuzzy Lop, reported by Brian Carpenter. inflate() doesn't
- immediately fault a bad CMINFO field; instead a 'too far back' error
- happens later (at least some times). pngfix failed to limit CMINFO to
- the allowed values but then assumed that window_bits was in range,
- triggering an assert. The bug is mostly harmless; the PNG file cannot
- be fixed.
- In libpng 1.6 zlib initialization was changed to use the window size
- in the zlib stream, not a fixed value. This causes some invalid images,
- where CINFO is too large, to display 'correctly' if the rest of the
- data is valid. This provides a workaround for zlib versions where the
- error arises (ones that support the API change to use the window size
- in the stream).
+ libpng-1.6.28-README.txt
+ libpng-1.6.28-LICENSE.txt
+ libpng-1.6.28-*.asc (armored detached GPG signatures)
+
+Changes since the last public release (1.6.27):
+ Fixed arm/aarch64 detection in CMakeLists.txt (Gianfranco Costamagna).
+ Added option to Cmake build allowing a custom location of zlib to be
+ specified in a scenario where libpng is being built as a subproject
+ alongside zlib by another project (Sam Serrels).
+ Changed png_ptr->options from a png_byte to png_uint_32, to accomodate
+ up to 16 options.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
diff --git a/src/3rdparty/libpng/CHANGES b/src/3rdparty/libpng/CHANGES
index 28094fd26c..0b5e944ee3 100644
--- a/src/3rdparty/libpng/CHANGES
+++ b/src/3rdparty/libpng/CHANGES
@@ -593,7 +593,7 @@ Version 1.0.5e [November 30, 1999]
with trailing compressed parts easier in the future, and added new functions
png_free_iCCP, png_free_pCAL, png_free_sPLT, png_free_text, png_get_iCCP,
png_get_spalettes, png_set_iCCP, png_set_spalettes (Eric S. Raymond).
- NOTE: Applications that write text chunks MUST define png_text->lang
+ NOTE: Applications that write text chunks MUST define png_text->lang
before calling png_set_text(). It must be set to NULL if you want to
write tEXt or zTXt chunks. If you want your application to be able to
run with older versions of libpng, use
@@ -5063,7 +5063,8 @@ Version 1.6.15beta04 [November 4, 2014]
Version 1.6.15beta05 [November 5, 2014]
Use png_get_libpng_ver(NULL) instead of PNG_LIBPNG_VER_STRING in
example.c, pngtest.c, and applications in the contrib directory.
- Avoid out-of-bounds memory access in png_user_version_check().
+ Fixed an out-of-range read in png_user_version_check() (Bug report from
+ Qixue Xiao, CVE-2015-8540).
Simplified and future-proofed png_user_version_check().
Fixed GCC unsigned int->float warnings. Various versions of GCC
seem to generate warnings when an unsigned value is implicitly
@@ -5421,7 +5422,7 @@ Version 1.6.20beta01 [November 20, 2015]
Version 1.6.20beta02 [November 23, 2015]
Fixed incorrect implementation of png_set_PLTE() that uses png_ptr
not info_ptr, that left png_set_PLTE() open to the CVE-2015-8126
- vulnerability.
+ vulnerability. Fixes CVE-2015-8472.
Version 1.6.20beta03 [November 24, 2015]
Backported tests from libpng-1.7.0beta69.
@@ -5446,6 +5447,353 @@ Version 1.6.20rc02 [November 29, 2015]
Version 1.6.20 [December 3, 2015]
No changes.
+Version 1.6.21beta01 [December 11, 2015]
+ Fixed syntax "$(command)" in tests/pngstest that some shells other than
+ bash could not parse (Bug report by Nelson Beebe). Use `command` instead.
+
+Version 1.6.21beta02 [December 14, 2015]
+ Moved png_check_keyword() from pngwutil.c to pngset.c
+ Removed LE/BE dependencies in pngvalid, to 'fix' the current problem
+ in the BigEndian tests by not testing it, making the BE code the same
+ as the LE version.
+ Fixes to pngvalid for various reduced build configurations (eliminate unused
+ statics) and a fix for the case in rgb_to_gray when the digitize option
+ reduces graylo to 0, producing a large error.
+
+Version 1.6.21beta03 [December 18, 2015]
+ Widened the 'limit' check on the internally calculated error limits in
+ the 'DIGITIZE' case (the code used prior to 1.7 for rgb_to_gray error
+ checks) and changed the check to only operate in non-release builds
+ (base build type not RC or RELEASE.)
+ Fixed undefined behavior in pngvalid.c, undefined because
+ (png_byte) << shift is undefined if it changes the signed bit
+ (because png_byte is promoted to int). The libpng exported functions
+ png_get_uint_32 and png_get_uint_16 handle this. (Bug reported by
+ David Drysdale as a result of reports from UBSAN in clang 3.8).
+ This changes pngvalid to use BE random numbers; this used to produce
+ errors but these should not be fixed as a result of the previous changes.
+
+Version 1.6.21rc01 [January 4, 2016]
+ In projects/vstudio, combined readme.txt and WARNING into README.txt
+
+Version 1.6.21rc02 [January 7, 2016]
+ Relocated assert() in contrib/tools/pngfix.c, bug found by American
+ Fuzzy Lop, reported by Brian Carpenter.
+ Marked 'limit' UNUSED in transform_range_check(). This only affects
+ release builds.
+
+Version 1.6.21 [January 15, 2016]
+ Worked around a false-positive Coverity issue in pngvalid.c.
+
+Version 1.6.22beta01 [January 23, 2016]
+ Changed PNG_USE_MKSTEMP to __COVERITY__ to select alternate
+ "tmpfile()" implementation in contrib/libtests/pngstest.c
+ Fixed NO_STDIO build of pngunknown.c to skip calling png_init_io()
+ if there is no stdio.h support.
+ Added a png_image_write_to_memory() API and a number of assist macros
+ to allow an application that uses the simplified API write to bypass
+ stdio and write directly to memory.
+ Added some warnings (png.h) and some check code to detect *possible*
+ overflow in the ROW_STRIDE and simplified image SIZE macros. This
+ disallows image width/height/format that *might* overflow. This is
+ a quiet API change that limits in-memory image size (uncompressed) to
+ less than 4GByte and image row size (stride) to less than 2GByte.
+ Revised workaround for false-positive Coverity issue in pngvalid.c.
+
+Version 1.6.22beta02 [February 8, 2016]
+ Only use exit(77) in configure builds.
+ Corrected error in PNG_IMAGE_PNG_SIZE_MAX. This new macro underreported
+ the palette size because it failed to take into account that the memory
+ palette has to be expanded to full RGB when it is written to PNG.
+ Updated CMakeLists.txt, added supporting scripts/gen*.cmake.in
+ and test.cmake.in (Roger Leigh).
+ Relaxed limit checks on gamma values in pngrtran.c. As suggested in
+ the comments gamma values outside the range currently permitted
+ by png_set_alpha_mode are useful for HDR data encoding. These values
+ are already permitted by png_set_gamma so it is reasonable caution to
+ extend the png_set_alpha_mode range as HDR imaging systems are starting
+ to emerge.
+
+Version 1.6.22beta03 [March 9, 2016]
+ Added a common-law trademark notice and export control information
+ to the LICENSE file, png.h, and the man page.
+ Restored "& 0xff" in png_save_uint_16() and png_save_uint_32() that
+ were accidentally removed from libpng-1.6.17.
+ Changed PNG_INFO_cHNK and PNG_FREE_cHNK from 0xnnnn to 0xnnnnU in png.h
+ (Robert C. Seacord).
+ Removed dubious "#if INT_MAX" test from png.h that was added to
+ libpng-1.6.19beta02 (John Bowler).
+ Add ${INCLUDES} in scripts/genout.cmake.in (Bug report by Nixon Kwok).
+ Updated LICENSE to say files in the contrib directory are not
+ necessarily under the libpng license, and that some makefiles have
+ other copyright owners.
+ Added INTEL-SSE2 support (Mike Klein and Matt Sarett, Google, Inc.).
+ Made contrib/libtests/timepng more robust. The code no longer gives
+ up/fails on invalid PNG data, it just skips it (with error messages).
+ The code no longer fails on PNG files with data beyond IEND. Options
+ exist to use png_read_png (reading the whole image, not by row) and, in
+ that case, to apply any of the supported transforms. This makes for
+ more realistic testing; the decoded data actually gets used in a
+ meaningful fashion (John Bowler).
+ Fixed some misleading indentation (Krishnaraj Bhat).
+
+Version 1.6.22beta04 [April 5, 2016]
+ Force GCC compilation to C89 if needed (Dagobert Michelsen).
+ SSE filter speed improvements for bpp=3:
+ memcpy-free implementations of load3() / store3().
+ call load3() only when needed at the end of a scanline.
+
+Version 1.6.22beta05 [April 27, 2016]
+ Added PNG_FAST_FILTERS macro (defined as
+ PNG_FILTER_NONE|PNG_FILTER_SUB|PNG_FILTER_UP).
+ Various fixes for contrib/libtests/timepng.c
+ Moved INTEL-SSE code from pngpriv.h into contrib/intel/intel_sse.patch.
+ Fixed typo (missing underscore) in #define PNG_READ_16_TO_8_SUPPORTED
+ (Bug report by Y.Ohashik).
+
+Version 1.6.22beta06 [May 5, 2016]
+ Rebased contrib/intel_sse.patch.
+ Quieted two Coverity issues in contrib/libtests/timepng.c.
+ Fixed issues with scripts/genout.cmake.in (David Capello, Nixon Kwok):
+ Added support to use multiple directories in ZLIBINCDIR variable,
+ Fixed CMAKE_C_FLAGS with multiple values when genout is compiled on MSVC,
+ Fixed pnglibconf.c compilation on OS X including the sysroot path.
+
+Version 1.6.22rc01 [May 14, 2016]
+ No changes.
+
+Version 1.6.22rc02 [May 16, 2016]
+ Removed contrib/timepng from default build; it does not build on platforms
+ that don't supply clock_gettime().
+
+Version 1.6.22rc03 [May 17, 2016]
+ Restored contrib/timepng to default build but check for the presence
+ of clock_gettime() in configure.ac and Makefile.am.
+
+Version 1.6.22 [May 26, 2016]
+ No changes.
+
+Version 1.6.23beta01 [May 29, 2016]
+ Stop a potential memory leak in png_set_tRNS() (Bug report by Ted Ying).
+ Fixed the progressive reader to handle empty first IDAT chunk properly
+ (patch by Timothy Nikkel). This bug was introduced in libpng-1.6.0 and
+ only affected the libpng16 branch.
+ Added tests in pngvalid.c to check zero-length IDAT chunks in various
+ positions. Fixed the sequential reader to handle these more robustly
+ (John Bowler).
+
+Version 1.6.23rc01 [June 2, 2016]
+ Corrected progressive read input buffer in pngvalid.c. The previous version
+ the code invariably passed just one byte at a time to libpng. The intent
+ was to pass a random number of bytes in the range 0..511.
+ Moved sse2 prototype from pngpriv.h to contrib/intel/intel_sse.patch.
+ Added missing ")" in pngerror.c (Matt Sarrett).
+
+Version 1.6.23rc02 [June 4, 2016]
+ Fixed undefined behavior in png_push_save_buffer(). Do not call
+ memcpy() with a null source, even if count is zero (Leon Scroggins III).
+
+Version 1.6.23 [June 9, 2016]
+ Fixed bad link to RFC2083 in png.5 (Nikola Forro).
+
+Version 1.6.24beta01 [June 11, 2016]
+ Avoid potential overflow of the PNG_IMAGE_SIZE macro. This macro
+ is not used within libpng, but is used in some of the examples.
+
+Version 1.6.24beta02 [June 23, 2016]
+ Correct filter heuristic overflow handling. This was broken when the
+ write filter code was moved out-of-line; if there is a single filter and
+ the heuristic sum overflows the calculation of the filtered line is not
+ completed. In versions prior to 1.6 the code was duplicated in-line
+ and the check not performed, so the filter operation completed; however,
+ in the multi-filter case where the sum is performed the 'none' filter would
+ be selected if all the sums overflowed, even if it wasn't in the filter
+ list. The fix to the first problem is simply to provide PNG_SIZE_MAX as
+ the current lmins sum value; this means the sum can never exceed it and
+ overflows silently. A reasonable compiler that does choose to inline
+ the code will simply eliminate the sum check.
+ The fix to the second problem is to use high precision arithmetic (this is
+ implemented in 1.7), however a simple safe fix here is to chose the lowest
+ numbered filter in the list from png_set_filter (this only works if the
+ first problem is also fixed) (John Bowler).
+ Use a more efficient absolute value calculation on SSE2 (Matthieu Darbois).
+ Fixed the case where PNG_IMAGE_BUFFER_SIZE can overflow in the application
+ as a result of the application using an increased 'row_stride'; previously
+ png_image_finish_read only checked for overflow on the base calculation of
+ components. (I.e. it checked for overflow of a 32-bit number on the total
+ number of pixel components in the output format, not the possibly padded row
+ length and not the number of bytes, which for linear formats is twice the
+ number of components.)
+ MSVC does not like '-(unsigned)', so replaced it with 0U-(unsigned)
+ MSVC does not like (uInt) = -(unsigned) (i.e. as an initializer), unless
+ the conversion is explicitly invoked by a cast.
+ Put the SKIP definition in the correct place. It needs to come after the
+ png.h include (see all the other .c files in contrib/libtests) because it
+ depends on PNG_LIBPNG_VER.
+ Removed the three compile warning options from the individual project
+ files into the zlib.props globals. It increases the warning level from 4
+ to All and adds a list of the warnings that need to be turned off. This is
+ semi-documentary; the intent is to tell libpng users which warnings have
+ been examined and judged non-fixable at present. The warning about
+ structure padding is fixable, but it would be a signficant change (moving
+ structure members around).
+
+Version 1.6.24beta03 [July 4, 2016]
+ Optimized absolute value calculation in filter selection, similar to
+ code in the PAETH decoder in pngrutil.c. Build with PNG_USE_ABS to
+ use this.
+ Added pngcp to the build together with a pngcp.dfa configuration test.
+ Added high resolution timing to pngcp.
+ Added "Common linking failures" section to INSTALL.
+ Relocated misplaced #endif in png.c sRGB profile checking.
+ Fixed two Coverity issues in pngcp.c.
+
+Version 1.6.24beta04 [July 8, 2016]
+ Avoid filter-selection heuristic sum calculations in cases where only one
+ filter is a candidate for selection. This trades off code size (added
+ private png_setup_*_row_only() functions) for speed.
+
+Version 1.6.24beta05 [July 13, 2016]
+ Fixed some indentation to comply with our coding style.
+ Added contrib/tools/reindent.
+
+Version 1.6.24beta06 [July 18, 2016]
+ Fixed more indentation to comply with our coding style.
+ Eliminated unnecessary tests of boolean png_isaligned() vs 0.
+
+Version 1.6.24rc01 [July 25, 2016]
+ No changes.
+
+Version 1.6.24rc02 [August 1, 2016]
+ Conditionally compile SSE2 headers in contrib/intel/intel_sse.patch
+ Conditionally compile png_decompress_chunk().
+
+Version 1.6.24rc03 [August 2, 2016]
+ Conditionally compile ARM_NEON headers in pngpriv.h
+ Updated contrib/intel/intel_sse.patch
+
+Version 1.6.24[August 4, 2016]
+ No changes.
+
+Version 1.6.25beta01 [August 12, 2016]
+ Reject oversized iCCP profile immediately.
+ Cleaned up PNG_DEBUG compile of pngtest.c.
+ Conditionally compile png_inflate().
+
+Version 1.6.25beta02 [August 18, 2016]
+ Don't install pngcp; it conflicts with pngcp in the pngtools package.
+ Minor editing of INSTALL, (whitespace, added copyright line)
+
+Version 1.6.25rc01 [August 24, 2016]
+ No changes.
+
+Version 1.6.25rc02 [August 29, 2016]
+ Added MIPS support (Mandar Sahastrabuddhe <Mandar.Sahastrabuddhe@imgtec.com>).
+ Only the UP filter is currently implemented.
+
+Version 1.6.25rc03 [August 29, 2016]
+ Rebased contrib/intel/intel_sse.patch after the MIPS implementation.
+
+Version 1.6.25rc04 [August 30, 2016]
+ Added MIPS support for SUB, AVG, and PAETH filters (Mandar Sahastrabuddhe).
+
+Version 1.6.25rc05 [August 30, 2016]
+ Rebased contrib/intel/intel_sse.patch after the MIPS implementation update..
+
+Version 1.6.25 [September 1, 2016]
+ No changes.
+
+Version 1.6.26beta01 [September 26, 2016]
+ Fixed handling zero length IDAT in pngfix (bug report by Agostino Sarubbo,
+ bugfix by John Bowler).
+ Do not issue a png_error() on read in png_set_pCAL() because png_handle_pCAL
+ has allocated memory that libpng needs to free.
+ Conditionally compile png_set_benign_errors() in pngread.c and pngtest.c
+ Issue a png_benign_error instead of a png_error on ADLER32 mismatch
+ while decoding compressed data chunks.
+ Changed PNG_ZLIB_VERNUM to ZLIB_VERNUM in pngpriv.h, pngstruct.h, and
+ pngrutil.c.
+ If CRC handling of critical chunks has been set to PNG_CRC_QUIET_USE,
+ ignore the ADLER32 checksum in the IDAT chunk as well as the chunk CRCs.
+ Issue png_benign_error() on ADLER32 checksum mismatch instead of png_error().
+ Add tests/badcrc.png and tests/badadler.png to tests/pngtest.
+ Merged pngtest.c with libpng-1.7.0beta84/pngtest.c
+
+Version 1.6.26beta02 [October 1, 2016]
+ Updated the documentation about CRC and ADLER32 handling.
+ Quieted 117 warnings from clang-3.8 in pngtrans.c, pngread.c,
+ pngwrite.c, pngunknown.c, and pngvalid.c.
+ Quieted 58 (out of 144) -Wconversion compiler warnings by changing
+ flag definitions in pngpriv.h from 0xnnnn to 0xnnnnU and trivial changes
+ in png.c, pngread.c, and pngwutil.c.
+
+Version 1.6.26beta03 [October 2, 2016]
+ Removed contrib/libtests/*.orig and *.rej that slipped into the tarballs.
+ Quieted the 86 remaining -Wconversion compiler warnings by
+ revising the png_isaligned() macro and trivial changes in png.c,
+ pngerror.c, pngget.c, pngmem.c, pngset.c, pngrtran.c, pngrutil.c,
+ pngwtran.c, pngwrite.c, and pngwutil.c.
+
+Version 1.6.26beta04 [October 3, 2016]
+ Quieted (bogus?) clang warnings about "absolute value has no effect"
+ when PNG_USE_ABS is defined.
+ Fixed offsets in contrib/intel/intel_sse.patch
+
+Version 1.6.26beta05 [October 6, 2016]
+ Changed integer constant 4294967294 to unsigned 4294967294U in pngconf.h
+ to avoid a signed/unsigned compare in the preprocessor.
+
+Version 1.6.26beta06 [October 7, 2016]
+ Use zlib-1.2.8.1 inflateValidate() instead of inflateReset2() to
+ optionally avoid ADLER32 evaluation.
+
+Version 1.6.26rc01 [October 12, 2016]
+ No changes.
+
+Version 1.6.26 [October 20, 2016]
+ Cosmetic change, "ptr != 0" to "ptr != NULL" in png.c and pngrutil.c
+ Despammed email addresses (replaced "@" with " at ").
+
+Version 1.6.27beta01 [November 2, 2016]
+ Restrict the new ADLER32-skipping to IDAT chunks. It broke iCCP chunk
+ handling: an erroneous iCCP chunk would throw a png_error and reject the
+ entire PNG image instead of rejecting just the iCCP chunk with a warning,
+ if built with zlib-1.2.8.1.
+
+Version 1.6.27rc01 [December 27, 2016]
+ Control ADLER32 checking with new PNG_IGNORE_ADLER32 option.
+ Removed the use of a macro containing the pre-processor 'defined'
+ operator. It is unclear whether this is valid; a macro that
+ "generates" 'defined' is not permitted, but the use of the word
+ "generates" within the C90 standard seems to imply more than simple
+ substitution of an expression itself containing a well-formed defined
+ operation.
+ Added ARM support to CMakeLists.txt (Andreas Franek).
+
+Version 1.6.27 [December 29, 2016]
+ Fixed a potential null pointer dereference in png_set_text_2() (bug report
+ and patch by Patrick Keshishian, CVE-2016-10087).
+
+Version 1.6.28rc01 [January 3, 2017]
+ Fixed arm/aarch64 detection in CMakeLists.txt (Gianfranco Costamagna).
+ Added option to Cmake build allowing a custom location of zlib to be
+ specified in a scenario where libpng is being built as a subproject
+ alongside zlib by another project (Sam Serrels).
+ Changed png_ptr->options from a png_byte to png_uint_32, to accomodate
+ up to 16 options.
+
+Version 1.6.28rc02 [January 4, 2017]
+ Added "include(GNUInstallDirs)" to CMakeLists.txt (Gianfranco Costamagna).
+ Moved SSE2 optimization code into the main libpng source directory.
+ Configure libpng with "configure --enable-intel-sse" or compile
+ libpng with "-DPNG_INTEL_SSE" in CPPFLAGS to enable it.
+
+Version 1.6.28rc03 [January 4, 2017]
+ Backed out the SSE optimization and last CMakeLists.txt to allow time for QA.
+
+Version 1.6.28 [January 5, 2017]
+ No changes.
+
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
diff --git a/src/3rdparty/libpng/INSTALL b/src/3rdparty/libpng/INSTALL
index 531652abe0..58ec0b60a7 100644
--- a/src/3rdparty/libpng/INSTALL
+++ b/src/3rdparty/libpng/INSTALL
@@ -1,24 +1,25 @@
-Installing libpng
+ Installing libpng
Contents
- I. Simple installation
- II. Rebuilding the configure scripts
- III. Using scripts/makefile*
- IV. Using cmake
- V. Directory structure
- VI. Building with project files
- VII. Building with makefiles
-VIII. Configuring libpng for 16-bit platforms
- IX. Configuring for DOS
- X. Configuring for Medium Model
- XI. Prepending a prefix to exported symbols
- XII. Configuring for compiler xxx:
-XIII. Removing unwanted object code
- XIV. Changes to the build and configuration of libpng in libpng-1.5.x
- XV. Setjmp/longjmp issues
- XVI. Other sources of information about libpng
+ I. Simple installation
+ II. Rebuilding the configure scripts
+ III. Using scripts/makefile*
+ IV. Using cmake
+ V. Directory structure
+ VI. Building with project files
+ VII. Building with makefiles
+ VIII. Configuring libpng for 16-bit platforms
+ IX. Configuring for DOS
+ X. Configuring for Medium Model
+ XI. Prepending a prefix to exported symbols
+ XII. Configuring for compiler xxx:
+ XIII. Removing unwanted object code
+ XIV. Changes to the build and configuration of libpng in libpng-1.5.x
+ XV. Setjmp/longjmp issues
+ XVI. Common linking failures
+ XVII. Other sources of information about libpng
I. Simple installation
@@ -47,7 +48,9 @@ If configure does not work on your system, or if you have a need to
change configure.ac or Makefile.am, and you have a reasonably
up-to-date set of tools, running ./autogen.sh in a git clone before
running ./configure may fix the problem. To be really sure that you
-aren't using any of the included pre-built scripts, you can do this:
+aren't using any of the included pre-built scripts, especially if you
+are building from a tar distribution instead of a git distribution,
+do this:
./configure --enable-maintainer-mode
make maintainer-clean
@@ -76,7 +79,7 @@ Or you can use one of the "projects" in the "projects" directory.
Before installing libpng, you must first install zlib, if it
is not already on your system. zlib can usually be found
wherever you got libpng; otherwise go to http://zlib.net. You can place
-zlib in in the same directory as libpng or in another directory.
+zlib in the same directory as libpng or in another directory.
If your system already has a preinstalled zlib you will still need
to have access to the zlib.h and zconf.h include files that
@@ -87,22 +90,24 @@ standard library search path, put ZLIBLIB, ZLIBINC, CPPFLAGS, LDFLAGS,
and LD_LIBRARY_PATH in your environment before running "make test"
or "make distcheck":
-ZLIBLIB=/path/to/lib export ZLIBLIB
-ZLIBINC=/path/to/include export ZLIBINC
-CPPFLAGS="-I$ZLIBINC" export CPPFLAGS
-LDFLAGS="-L$ZLIBLIB" export LDFLAGS
-LD_LIBRARY_PATH="$ZLIBLIB:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH
+ ZLIBLIB=/path/to/lib export ZLIBLIB
+ ZLIBINC=/path/to/include export ZLIBINC
+ CPPFLAGS="-I$ZLIBINC" export CPPFLAGS
+ LDFLAGS="-L$ZLIBLIB" export LDFLAGS
+ LD_LIBRARY_PATH="$ZLIBLIB:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH
If you are using one of the makefile scripts, put ZLIBLIB and ZLIBINC
-in your environment and type "make ZLIBLIB=$ZLIBLIB ZLIBINC=$ZLIBINC test".
+in your environment and type
+
+ make ZLIBLIB=$ZLIBLIB ZLIBINC=$ZLIBINC test
IV. Using cmake
If you want to use "cmake" (see www.cmake.org), type
- cmake . -DCMAKE_INSTALL_PREFIX=/path
- make
- make install
+ cmake . -DCMAKE_INSTALL_PREFIX=/path
+ make
+ make install
As when using the simple configure method described above, "/path" points to
the installation directory where you want to put the libpng "lib", "include",
@@ -116,8 +121,8 @@ or "zlib128") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this:
- .. (the parent directory)
- libpng (this directory)
+ .. (the parent directory)
+ libpng (this directory)
INSTALL (this file)
README
*.h, *.c => libpng source files
@@ -160,10 +165,15 @@ VII. Building with makefiles
Copy the file (or files) that you need from the
scripts directory into this directory, for example
- MSDOS example: copy scripts\makefile.msc makefile
- copy scripts\pnglibconf.h.prebuilt pnglibconf.h
- UNIX example: cp scripts/makefile.std makefile
- cp scripts/pnglibconf.h.prebuilt pnglibconf.h
+MSDOS example:
+
+ copy scripts\makefile.msc makefile
+ copy scripts\pnglibconf.h.prebuilt pnglibconf.h
+
+UNIX example:
+
+ cp scripts/makefile.std makefile
+ cp scripts/pnglibconf.h.prebuilt pnglibconf.h
Read the makefile to see if you need to change any source or
target directories to match your preferences.
@@ -239,7 +249,7 @@ libpng are compiled. All the defines end in _SUPPORTED. If you are
never going to use a capability, you can change the #define to #undef
before recompiling libpng and save yourself code and data space, or
you can turn off individual capabilities with defines that begin with
-PNG_NO_.
+"PNG_NO_".
In libpng-1.5.0 and later, the #define's are in pnglibconf.h instead.
@@ -307,7 +317,7 @@ only png_longjmp_ptr, which must match the C longjmp function.) The new
approach is documented in pngconf.h
Despite these changes, libpng 1.5.0 only supports the native C function
-calling standard on those platforms tested so far (__cdecl on Microsoft
+calling standard on those platforms tested so far ("__cdecl" on Microsoft
Windows). This is because the support requirements for alternative
calling conventions seem to no longer exist. Developers who find it
necessary to set PNG_API_RULE to 1 should advise the mailing list
@@ -371,7 +381,7 @@ your application is going to be using multiple threads, you should
configure libpng with PNG_NO_SETJMP in your pngusr.dfa file, with
-DPNG_NO_SETJMP on your compile line, or with
- #undef PNG_SETJMP_SUPPORTED
+ #undef PNG_SETJMP_SUPPORTED
in your pnglibconf.h or pngusr.h.
@@ -380,8 +390,25 @@ This requires setjmp/longjmp, so you must either build the library
with PNG_SETJMP_SUPPORTED defined, or with PNG_SIMPLIFIED_READ_SUPPORTED
and PNG_SIMPLIFIED_WRITE_SUPPORTED undefined.
-XVI. Other sources of information about libpng:
+XVI. Common linking failures
+
+If your application fails to find libpng or zlib entries while linking:
+
+ Be sure "-lz" appears after "-lpng" on your linking command.
+
+ Be sure you have built libpng, zlib, and your application for the
+ same platform (e.g., 32-bit or 64-bit).
+
+ If you are using the vstudio project, observe the WARNING in
+ project/vstudio/README.txt.
+
+XVII. Other sources of information about libpng:
Further information can be found in the README and libpng-manual.txt
files, in the individual makefiles, in png.h, and the manual pages
libpng.3 and png.5.
+
+Copyright (c) 1998-2002,2006-2016 Glenn Randers-Pehrson
+This document is released under the libpng license.
+For conditions of distribution and use, see the disclaimer
+and license in png.h.
diff --git a/src/3rdparty/libpng/LICENSE b/src/3rdparty/libpng/LICENSE
index 82dbe117f6..912552e2af 100644
--- a/src/3rdparty/libpng/LICENSE
+++ b/src/3rdparty/libpng/LICENSE
@@ -10,8 +10,8 @@ this sentence.
This code is released under the libpng license.
-libpng versions 1.0.7, July 1, 2000, through 1.6.20, December 3, 2015, are
-Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, are
+libpng versions 1.0.7, July 1, 2000 through 1.6.28, January 5, 2017 are
+Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
derived from libpng-1.0.6, and are distributed according to the same
disclaimer and license as libpng-1.0.6 with the following individuals
added to the list of Contributing Authors:
@@ -22,6 +22,7 @@ added to the list of Contributing Authors:
Cosmin Truta
Gilles Vollant
James Yu
+ Mandar Sahastrabuddhe
and with the following additions to the disclaimer:
@@ -32,6 +33,10 @@ and with the following additions to the disclaimer:
risk of satisfactory quality, performance, accuracy, and effort is with
the user.
+Some files in the "contrib" directory and some configure-generated
+files that are distributed with libpng have other copyright owners and
+are released under other open source licenses.
+
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
libpng-0.96, and are distributed according to the same disclaimer and
@@ -55,6 +60,9 @@ Contributing Authors:
Greg Roelofs
Tom Tanner
+Some files in the "scripts" directory have other copyright owners
+but are released under this license.
+
libpng versions 0.5, May 1995, through 0.88, January 1996, are
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -95,18 +103,29 @@ appreciated.
END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
-A "png_get_copyright" function is available, for convenient use in "about"
-boxes and the like:
+TRADEMARK:
- printf("%s", png_get_copyright(NULL));
+The name "libpng" has not been registered by the Copyright owner
+as a trademark in any jurisdiction. However, because libpng has
+been distributed and maintained world-wide, continually since 1995,
+the Copyright owner claims "common-law trademark protection" in any
+jurisdiction where common-law trademark is recognized.
-Also, the PNG logo (in PNG format, of course) is supplied in the
-files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
+OSI CERTIFICATION:
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
a certification mark of the Open Source Initiative. OSI has not addressed
the additional disclaimers inserted at version 1.0.7.
+EXPORT CONTROL:
+
+The Copyright owner believes that the Export Control Classification
+Number (ECCN) for libpng is EAR99, which means not subject to export
+controls or International Traffic in Arms Regulations (ITAR) because
+it is open source, publicly available software, that does not contain
+any encryption software. See the EAR, paragraphs 734.3(b)(3) and
+734.7(b).
+
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
-December 3, 2015
+January 5, 2017
diff --git a/src/3rdparty/libpng/README b/src/3rdparty/libpng/README
index 59f1f918ae..67b579d13c 100644
--- a/src/3rdparty/libpng/README
+++ b/src/3rdparty/libpng/README
@@ -1,4 +1,4 @@
-README for libpng version 1.6.20 - December 3, 2015 (shared library 16.0)
+README for libpng version 1.6.28 - January 5, 2017 (shared library 16.0)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.
@@ -180,15 +180,18 @@ Files in this distribution:
pngwutil.c => Write utility functions
arm => Contains optimized code for the ARM platform
contrib => Contributions
+ arm-neon => Optimized code for ARM-NEON platform
examples => Example programs
gregbook => source code for PNG reading and writing, from
Greg Roelofs' "PNG: The Definitive Guide",
O'Reilly, 1999
+ intel => Optimized code for INTEL-SSE2 platform
libtests => Test programs
pngminim => Minimal decoder, encoder, and progressive decoder
programs demonstrating use of pngusr.dfa
pngminus => Simple pnm2png and png2pnm programs
pngsuite => Test images
+ testpngs
tools => Various tools
visupng => Contains a MSVC workspace for VisualPng
projects => Contains project files and workspaces for
diff --git a/src/3rdparty/libpng/libpng-manual.txt b/src/3rdparty/libpng/libpng-manual.txt
index 87eeb2b583..048ba31c06 100644
--- a/src/3rdparty/libpng/libpng-manual.txt
+++ b/src/3rdparty/libpng/libpng-manual.txt
@@ -1,9 +1,9 @@
libpng-manual.txt - A description on how to use and modify libpng
- libpng version 1.6.20 - December 3, 2015
+ libpng version 1.6.28 - January 5, 2017
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
- Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ Copyright (c) 1998-2016 Glenn Randers-Pehrson
This document is released under the libpng license.
For conditions of distribution and use, see the disclaimer
@@ -11,9 +11,9 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on:
- libpng versions 0.97, January 1998, through 1.6.20 - December 3, 2015
+ libpng versions 0.97, January 1998, through 1.6.28 - January 5, 2017
Updated and distributed by Glenn Randers-Pehrson
- Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ Copyright (c) 1998-2016 Glenn Randers-Pehrson
libpng 1.0 beta 6 - version 0.96 - May 28, 1997
Updated and distributed by Andreas Dilger
@@ -467,8 +467,9 @@ the default, use
The values for png_set_crc_action() say how libpng is to handle CRC errors in
ancillary and critical chunks, and whether to use the data contained
-therein. Note that it is impossible to "discard" data in a critical
-chunk.
+therein. Starting with libpng-1.6.26, this also governs how an ADLER32 error
+is handled while reading the IDAT chunk. Note that it is impossible to
+"discard" data in a critical chunk.
Choices for (int) crit_action are
PNG_CRC_DEFAULT 0 error/quit
@@ -485,6 +486,9 @@ Choices for (int) ancil_action are
PNG_CRC_QUIET_USE 4 quiet/use data
PNG_CRC_NO_CHANGE 5 use the current value
+When the setting for crit_action is PNG_CRC_QUIET_USE, the CRC and ADLER32
+checksums are not only ignored, but they are not evaluated.
+
Setting up callback code
You can set up a callback function to handle any unknown chunks in the
@@ -559,7 +563,7 @@ non-interlaced case the row that was just handled is simply one less than the
passed in row number, and pass will always be 0. For the interlaced case the
same applies unless the row value is 0, in which case the row just handled was
the last one from one of the preceding passes. Because interlacing may skip a
-pass you cannot be sure that the preceding pass is just 'pass-1', if you really
+pass you cannot be sure that the preceding pass is just 'pass-1'; if you really
need to know what the last pass is record (row,pass) from the callback and use
the last recorded value each time.
@@ -2230,7 +2234,8 @@ is exactly the same. If you are planning on displaying the image
after each pass, the "rectangle" effect is generally considered the
better looking one.
-If you only want the "sparkle" effect, just call png_read_rows() as
+If you only want the "sparkle" effect, just call png_read_row() or
+png_read_rows() as
normal, with the third parameter NULL. Make sure you make pass over
the image number_of_passes times, and you don't change the data in the
rows between calls. You can change the locations of the data, just
@@ -2239,6 +2244,8 @@ pass, and assumes the data from previous passes is still valid.
png_read_rows(png_ptr, row_pointers, NULL,
number_of_rows);
+ or
+ png_read_row(png_ptr, row_pointers, NULL);
If you only want the first effect (the rectangles), do the same as
before except pass the row buffer in the third parameter, and leave
@@ -2246,6 +2253,8 @@ the second parameter NULL.
png_read_rows(png_ptr, NULL, row_pointers,
number_of_rows);
+ or
+ png_read_row(png_ptr, NULL, row_pointers);
If you don't want libpng to handle the interlacing details, just call
png_read_rows() PNG_INTERLACE_ADAM7_PASSES times to read in all the images.
@@ -2842,7 +2851,7 @@ filter types.
PNG_FILTER_UP | PNG_FILTER_VALUE_UP |
PNG_FILTER_AVG | PNG_FILTER_VALUE_AVG |
PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH|
- PNG_ALL_FILTERS);
+ PNG_ALL_FILTERS | PNG_FAST_FILTERS);
If an application wants to start and stop using particular filters during
compression, it should start out with all of the filters (to ensure that
@@ -4103,6 +4112,13 @@ be written:
Write the image to the named file.
+ int png_image_write_to_memory (png_imagep image, void *memory,
+ png_alloc_size_t * PNG_RESTRICT memory_bytes,
+ int convert_to_8_bit, const void *buffer, ptrdiff_t row_stride,
+ const void *colormap));
+
+ Write the image to memory.
+
int png_image_write_to_stdio(png_imagep image, FILE *file,
int convert_to_8_bit, const void *buffer,
png_int_32 row_stride, const void *colormap)
@@ -4380,8 +4396,9 @@ for any images with bit depths less than 8 bits/pixel.
The 'method' parameter sets the main filtering method, which is
currently only '0' in the PNG 1.2 specification. The 'filters'
parameter sets which filter(s), if any, should be used for each
-scanline. Possible values are PNG_ALL_FILTERS and PNG_NO_FILTERS
-to turn filtering on and off, respectively.
+scanline. Possible values are PNG_ALL_FILTERS, PNG_NO_FILTERS,
+or PNG_FAST_FILTERS to turn filtering on and off, or to turn on
+just the fast-decoding subset of filters, respectively.
Individual filter types are PNG_FILTER_NONE, PNG_FILTER_SUB,
PNG_FILTER_UP, PNG_FILTER_AVG, PNG_FILTER_PAETH, which can be bitwise
@@ -4395,12 +4412,19 @@ means the first row must always be adaptively filtered, because libpng
currently does not allocate the filter buffers until png_write_row()
is called for the first time.)
- filters = PNG_FILTER_NONE | PNG_FILTER_SUB
+ filters = PNG_NO_FILTERS;
+ filters = PNG_ALL_FILTERS;
+ filters = PNG_FAST_FILTERS;
+
+ or
+
+ filters = PNG_FILTER_NONE | PNG_FILTER_SUB |
PNG_FILTER_UP | PNG_FILTER_AVG |
- PNG_FILTER_PAETH | PNG_ALL_FILTERS;
+ PNG_FILTER_PAETH;
png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE,
filters);
+
The second parameter can also be
PNG_INTRAPIXEL_DIFFERENCING if you are
writing a PNG to be embedded in a MNG
@@ -4775,7 +4799,8 @@ There are no substantial API changes between the non-deprecated parts of
the 1.4.5 API and the 1.5.0 API; however, the ability to directly access
members of the main libpng control structures, png_struct and png_info,
deprecated in earlier versions of libpng, has been completely removed from
-libpng 1.5.
+libpng 1.5, and new private "pngstruct.h", "pnginfo.h", and "pngdebug.h"
+header files were created.
We no longer include zlib.h in png.h. The include statement has been moved
to pngstruct.h, where it is not accessible by applications. Applications that
@@ -5015,6 +5040,7 @@ includes the following:
png_image_free()
write functions
png_image_write_to_file()
+ png_image_write_to_memory()
png_image_write_to_stdio()
Starting with libpng-1.6.0, you can configure libpng to prefix all exported
@@ -5078,6 +5104,10 @@ enforced. The sRGB chunk is allowed to appear in images with any color type
and is interpreted by libpng to convey a one-tracer-curve gray profile or a
three-tracer-curve RGB profile as appropriate.
+Libpng 1.5.x erroneously used /MD for Debug DLL builds; if you used the debug
+builds in your app and you changed your app to use /MD you will need to
+change it back to /MDd for libpng 1.6.x.
+
Prior to libpng-1.6.0 a warning would be issued if the iTXt chunk contained
an empty language field or an empty translated keyword. Both of these
are allowed by the PNG specification, so these warnings are no longer issued.
@@ -5309,8 +5339,9 @@ with an even number of lower-case hex digits, and to make them unsigned
We prefer to use underscores rather than camelCase in names, except
for a few type names that we inherit from zlib.h.
-We prefer "if (something != 0)" and "if (something == 0)"
-over "if (something)" and if "(!something)", respectively.
+We prefer "if (something != 0)" and "if (something == 0)" over
+"if (something)" and if "(!something)", respectively, and for pointers
+we prefer "if (some_pointer != NULL)" or "if (some_pointer == NULL)".
We do not use the TAB character for indentation in the C sources.
@@ -5324,7 +5355,7 @@ Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
-upward through 1.6.20 are Y2K compliant. It is my belief that earlier
+upward through 1.6.28 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has two year fields. One is a 2-byte unsigned integer
diff --git a/src/3rdparty/libpng/png.c b/src/3rdparty/libpng/png.c
index c183e3f8fa..78ce39f46d 100644
--- a/src/3rdparty/libpng/png.c
+++ b/src/3rdparty/libpng/png.c
@@ -1,8 +1,8 @@
/* png.c - location for general purpose libpng functions
*
- * Last changed in libpng 1.6.19 [November 12, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.28 [January 5, 2017]
+ * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -14,7 +14,7 @@
#include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_20 Your_png_h_is_not_version_1_6_20;
+typedef png_libpng_version_1_6_28 Your_png_h_is_not_version_1_6_28;
/* Tells libpng that we have already handled the first "num_bytes" bytes
* of the PNG file signature. If the PNG data is embedded into another
@@ -85,7 +85,7 @@ png_zalloc,(voidpf png_ptr, uInt items, uInt size),PNG_ALLOCATED)
if (items >= (~(png_alloc_size_t)0)/size)
{
png_warning (png_voidcast(png_structrp, png_ptr),
- "Potential overflow in png_zalloc()");
+ "Potential overflow in png_zalloc()");
return NULL;
}
@@ -172,10 +172,10 @@ png_calculate_crc(png_structrp png_ptr, png_const_bytep ptr, png_size_t length)
int
png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver)
{
- /* Libpng versions 1.0.0 and later are binary compatible if the version
- * string matches through the second '.'; we must recompile any
- * applications that use any older library version.
- */
+ /* Libpng versions 1.0.0 and later are binary compatible if the version
+ * string matches through the second '.'; we must recompile any
+ * applications that use any older library version.
+ */
if (user_png_ver != NULL)
{
@@ -297,7 +297,7 @@ png_create_png_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
if (png_user_version_check(&create_struct, user_png_ver) != 0)
{
png_structrp png_ptr = png_voidcast(png_structrp,
- png_malloc_warn(&create_struct, (sizeof *png_ptr)));
+ png_malloc_warn(&create_struct, (sizeof *png_ptr)));
if (png_ptr != NULL)
{
@@ -346,7 +346,7 @@ png_create_info_struct,(png_const_structrp png_ptr),PNG_ALLOCATED)
* has always been done in 'example.c'.
*/
info_ptr = png_voidcast(png_inforp, png_malloc_base(png_ptr,
- (sizeof *info_ptr)));
+ (sizeof *info_ptr)));
if (info_ptr != NULL)
memset(info_ptr, 0, (sizeof *info_ptr));
@@ -402,7 +402,7 @@ png_destroy_info_struct(png_const_structrp png_ptr, png_infopp info_ptr_ptr)
*/
PNG_FUNCTION(void,PNGAPI
png_info_init_3,(png_infopp ptr_ptr, png_size_t png_info_struct_size),
- PNG_DEPRECATED)
+ PNG_DEPRECATED)
{
png_inforp info_ptr = *ptr_ptr;
@@ -417,7 +417,7 @@ png_info_init_3,(png_infopp ptr_ptr, png_size_t png_info_struct_size),
/* The following line is why this API should not be used: */
free(info_ptr);
info_ptr = png_voidcast(png_inforp, png_malloc_base(NULL,
- (sizeof *info_ptr)));
+ (sizeof *info_ptr)));
if (info_ptr == NULL)
return;
*ptr_ptr = info_ptr;
@@ -430,7 +430,7 @@ png_info_init_3,(png_infopp ptr_ptr, png_size_t png_info_struct_size),
/* The following API is not called internally */
void PNGAPI
png_data_freer(png_const_structrp png_ptr, png_inforp info_ptr,
- int freer, png_uint_32 mask)
+ int freer, png_uint_32 mask)
{
png_debug(1, "in png_data_freer");
@@ -449,7 +449,7 @@ png_data_freer(png_const_structrp png_ptr, png_inforp info_ptr,
void PNGAPI
png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
- int num)
+ int num)
{
png_debug(1, "in png_free_data");
@@ -458,7 +458,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
#ifdef PNG_TEXT_SUPPORTED
/* Free text item num or (if num == -1) all text items */
- if (info_ptr->text != 0 &&
+ if (info_ptr->text != NULL &&
((mask & PNG_FREE_TEXT) & info_ptr->free_me) != 0)
{
if (num != -1)
@@ -477,6 +477,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
png_free(png_ptr, info_ptr->text);
info_ptr->text = NULL;
info_ptr->num_text = 0;
+ info_ptr->max_text = 0;
}
}
#endif
@@ -541,7 +542,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
#ifdef PNG_sPLT_SUPPORTED
/* Free a given sPLT entry, or (if num == -1) all sPLT entries */
- if (info_ptr->splt_palettes != 0 &&
+ if (info_ptr->splt_palettes != NULL &&
((mask & PNG_FREE_SPLT) & info_ptr->free_me) != 0)
{
if (num != -1)
@@ -571,7 +572,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
#endif
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
- if (info_ptr->unknown_chunks != 0 &&
+ if (info_ptr->unknown_chunks != NULL &&
((mask & PNG_FREE_UNKN) & info_ptr->free_me) != 0)
{
if (num != -1)
@@ -617,7 +618,7 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
/* Free any image bits attached to the info structure */
if (((mask & PNG_FREE_ROWS) & info_ptr->free_me) != 0)
{
- if (info_ptr->row_pointers != 0)
+ if (info_ptr->row_pointers != NULL)
{
png_uint_32 row;
for (row = 0; row < info_ptr->height; row++)
@@ -684,7 +685,7 @@ png_init_io(png_structrp png_ptr, png_FILE_p fp)
void PNGAPI
png_save_int_32(png_bytep buf, png_int_32 i)
{
- png_save_uint_32(buf, i);
+ png_save_uint_32(buf, (png_uint_32)i);
}
# endif
@@ -775,14 +776,15 @@ png_get_copyright(png_const_structrp png_ptr)
#else
# ifdef __STDC__
return PNG_STRING_NEWLINE \
- "libpng version 1.6.20 - December 3, 2015" PNG_STRING_NEWLINE \
- "Copyright (c) 1998-2015 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
+ "libpng version 1.6.28 - January 5, 2017" PNG_STRING_NEWLINE \
+ "Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \
+ PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE;
# else
- return "libpng version 1.6.20 - December 3, 2015\
- Copyright (c) 1998-2015 Glenn Randers-Pehrson\
+ return "libpng version 1.6.28 - January 5, 2017\
+ Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
# endif
@@ -1032,7 +1034,7 @@ png_zstream_error(png_structrp png_ptr, int ret)
#ifdef PNG_GAMMA_SUPPORTED /* always set if COLORSPACE */
static int
png_colorspace_check_gamma(png_const_structrp png_ptr,
- png_colorspacerp colorspace, png_fixed_point gAMA, int from)
+ png_colorspacerp colorspace, png_fixed_point gAMA, int from)
/* This is called to check a new gamma value against an existing one. The
* routine returns false if the new gamma value should not be written.
*
@@ -1046,7 +1048,7 @@ png_colorspace_check_gamma(png_const_structrp png_ptr,
png_fixed_point gtest;
if ((colorspace->flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 &&
- (png_muldiv(&gtest, colorspace->gamma, PNG_FP_1, gAMA) == 0 ||
+ (png_muldiv(&gtest, colorspace->gamma, PNG_FP_1, gAMA) == 0 ||
png_gamma_significant(gtest) != 0))
{
/* Either this is an sRGB image, in which case the calculated gamma
@@ -1058,7 +1060,7 @@ png_colorspace_check_gamma(png_const_structrp png_ptr,
if ((colorspace->flags & PNG_COLORSPACE_FROM_sRGB) != 0 || from == 2)
{
png_chunk_report(png_ptr, "gamma value does not match sRGB",
- PNG_CHUNK_ERROR);
+ PNG_CHUNK_ERROR);
/* Do not overwrite an sRGB value */
return from == 2;
}
@@ -1066,7 +1068,7 @@ png_colorspace_check_gamma(png_const_structrp png_ptr,
else /* sRGB tag not involved */
{
png_chunk_report(png_ptr, "gamma value does not match libpng estimate",
- PNG_CHUNK_WARNING);
+ PNG_CHUNK_WARNING);
return from == 1;
}
}
@@ -1076,7 +1078,7 @@ png_colorspace_check_gamma(png_const_structrp png_ptr,
void /* PRIVATE */
png_colorspace_set_gamma(png_const_structrp png_ptr,
- png_colorspacerp colorspace, png_fixed_point gAMA)
+ png_colorspacerp colorspace, png_fixed_point gAMA)
{
/* Changed in libpng-1.5.4 to limit the values to ensure overflow can't
* occur. Since the fixed point representation is asymetrical it is
@@ -1634,8 +1636,8 @@ static const png_xy sRGB_xy = /* From ITU-R BT.709-3 */
static int
png_colorspace_set_xy_and_XYZ(png_const_structrp png_ptr,
- png_colorspacerp colorspace, const png_xy *xy, const png_XYZ *XYZ,
- int preferred)
+ png_colorspacerp colorspace, const png_xy *xy, const png_XYZ *XYZ,
+ int preferred)
{
if ((colorspace->flags & PNG_COLORSPACE_INVALID) != 0)
return 0;
@@ -1682,7 +1684,7 @@ png_colorspace_set_xy_and_XYZ(png_const_structrp png_ptr,
int /* PRIVATE */
png_colorspace_set_chromaticities(png_const_structrp png_ptr,
- png_colorspacerp colorspace, const png_xy *xy, int preferred)
+ png_colorspacerp colorspace, const png_xy *xy, int preferred)
{
/* We must check the end points to ensure they are reasonable - in the past
* color management systems have crashed as a result of getting bogus
@@ -1696,7 +1698,7 @@ png_colorspace_set_chromaticities(png_const_structrp png_ptr,
{
case 0: /* success */
return png_colorspace_set_xy_and_XYZ(png_ptr, colorspace, xy, &XYZ,
- preferred);
+ preferred);
case 1:
/* We can't invert the chromaticities so we can't produce value XYZ
@@ -1719,7 +1721,7 @@ png_colorspace_set_chromaticities(png_const_structrp png_ptr,
int /* PRIVATE */
png_colorspace_set_endpoints(png_const_structrp png_ptr,
- png_colorspacerp colorspace, const png_XYZ *XYZ_in, int preferred)
+ png_colorspacerp colorspace, const png_XYZ *XYZ_in, int preferred)
{
png_XYZ XYZ = *XYZ_in;
png_xy xy;
@@ -1728,7 +1730,7 @@ png_colorspace_set_endpoints(png_const_structrp png_ptr,
{
case 0:
return png_colorspace_set_xy_and_XYZ(png_ptr, colorspace, &xy, &XYZ,
- preferred);
+ preferred);
case 1:
/* End points are invalid. */
@@ -1785,7 +1787,7 @@ is_ICC_signature(png_alloc_size_t it)
static int
png_icc_profile_error(png_const_structrp png_ptr, png_colorspacerp colorspace,
- png_const_charp name, png_alloc_size_t value, png_const_charp reason)
+ png_const_charp name, png_alloc_size_t value, png_const_charp reason)
{
size_t pos;
char message[196]; /* see below for calculation */
@@ -1810,8 +1812,8 @@ png_icc_profile_error(png_const_structrp png_ptr, png_colorspacerp colorspace,
char number[PNG_NUMBER_BUFFER_SIZE]; /* +24 = 114*/
pos = png_safecat(message, (sizeof message), pos,
- png_format_number(number, number+(sizeof number),
- PNG_NUMBER_FORMAT_x, value));
+ png_format_number(number, number+(sizeof number),
+ PNG_NUMBER_FORMAT_x, value));
pos = png_safecat(message, (sizeof message), pos, "h: "); /*+2 = 116*/
}
# endif
@@ -1825,7 +1827,7 @@ png_icc_profile_error(png_const_structrp png_ptr, png_colorspacerp colorspace,
* application errors the PNG won't be written.)
*/
png_chunk_report(png_ptr, message,
- (colorspace != NULL) ? PNG_CHUNK_ERROR : PNG_CHUNK_WRITE_ERROR);
+ (colorspace != NULL) ? PNG_CHUNK_ERROR : PNG_CHUNK_WRITE_ERROR);
return 0;
}
@@ -1834,7 +1836,7 @@ png_icc_profile_error(png_const_structrp png_ptr, png_colorspacerp colorspace,
#ifdef PNG_sRGB_SUPPORTED
int /* PRIVATE */
png_colorspace_set_sRGB(png_const_structrp png_ptr, png_colorspacerp colorspace,
- int intent)
+ int intent)
{
/* sRGB sets known gamma, end points and (from the chunk) intent. */
/* IMPORTANT: these are not necessarily the values found in an ICC profile
@@ -1871,10 +1873,10 @@ png_colorspace_set_sRGB(png_const_structrp png_ptr, png_colorspacerp colorspace,
*/
if (intent < 0 || intent >= PNG_sRGB_INTENT_LAST)
return png_icc_profile_error(png_ptr, colorspace, "sRGB",
- (unsigned)intent, "invalid sRGB rendering intent");
+ (unsigned)intent, "invalid sRGB rendering intent");
if ((colorspace->flags & PNG_COLORSPACE_HAVE_INTENT) != 0 &&
- colorspace->rendering_intent != intent)
+ colorspace->rendering_intent != intent)
return png_icc_profile_error(png_ptr, colorspace, "sRGB",
(unsigned)intent, "inconsistent rendering intents");
@@ -1888,8 +1890,8 @@ png_colorspace_set_sRGB(png_const_structrp png_ptr, png_colorspacerp colorspace,
* warn but overwrite the value with the correct one.
*/
if ((colorspace->flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0 &&
- !png_colorspace_endpoints_match(&sRGB_xy, &colorspace->end_points_xy,
- 100))
+ !png_colorspace_endpoints_match(&sRGB_xy, &colorspace->end_points_xy,
+ 100))
png_chunk_report(png_ptr, "cHRM chunk does not match sRGB",
PNG_CHUNK_ERROR);
@@ -1897,7 +1899,7 @@ png_colorspace_set_sRGB(png_const_structrp png_ptr, png_colorspacerp colorspace,
* returns true when the 'from' argument corresponds to sRGB (2).
*/
(void)png_colorspace_check_gamma(png_ptr, colorspace, PNG_GAMMA_sRGB_INVERSE,
- 2/*from sRGB*/);
+ 2/*from sRGB*/);
/* intent: bugs in GCC force 'int' to be used as the parameter type. */
colorspace->rendering_intent = (png_uint_16)intent;
@@ -1930,21 +1932,55 @@ png_colorspace_set_sRGB(png_const_structrp png_ptr, png_colorspacerp colorspace,
static const png_byte D50_nCIEXYZ[12] =
{ 0x00, 0x00, 0xf6, 0xd6, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xd3, 0x2d };
-int /* PRIVATE */
-png_icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace,
- png_const_charp name, png_uint_32 profile_length)
+static int /* bool */
+icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace,
+ png_const_charp name, png_uint_32 profile_length)
{
if (profile_length < 132)
return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
- "too short");
+ "too short");
return 1;
}
+#ifdef PNG_READ_iCCP_SUPPORTED
+int /* PRIVATE */
+png_icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace,
+ png_const_charp name, png_uint_32 profile_length)
+{
+ if (!icc_check_length(png_ptr, colorspace, name, profile_length))
+ return 0;
+
+ /* This needs to be here because the 'normal' check is in
+ * png_decompress_chunk, yet this happens after the attempt to
+ * png_malloc_base the required data. We only need this on read; on write
+ * the caller supplies the profile buffer so libpng doesn't allocate it. See
+ * the call to icc_check_length below (the write case).
+ */
+# ifdef PNG_SET_USER_LIMITS_SUPPORTED
+ else if (png_ptr->user_chunk_malloc_max > 0 &&
+ png_ptr->user_chunk_malloc_max < profile_length)
+ return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
+ "exceeds application limits");
+# elif PNG_USER_CHUNK_MALLOC_MAX > 0
+ else if (PNG_USER_CHUNK_MALLOC_MAX < profile_length)
+ return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
+ "exceeds libpng limits");
+# else /* !SET_USER_LIMITS */
+ /* This will get compiled out on all 32-bit and better systems. */
+ else if (PNG_SIZE_MAX < profile_length)
+ return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
+ "exceeds system limits");
+# endif /* !SET_USER_LIMITS */
+
+ return 1;
+}
+#endif /* READ_iCCP */
+
int /* PRIVATE */
png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
- png_const_charp name, png_uint_32 profile_length,
- png_const_bytep profile/* first 132 bytes only */, int color_type)
+ png_const_charp name, png_uint_32 profile_length,
+ png_const_bytep profile/* first 132 bytes only */, int color_type)
{
png_uint_32 temp;
@@ -1956,18 +1992,18 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
temp = png_get_uint_32(profile);
if (temp != profile_length)
return png_icc_profile_error(png_ptr, colorspace, name, temp,
- "length does not match profile");
+ "length does not match profile");
temp = (png_uint_32) (*(profile+8));
if (temp > 3 && (profile_length & 3))
return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
- "invalid length");
+ "invalid length");
temp = png_get_uint_32(profile+128); /* tag count: 12 bytes/tag */
if (temp > 357913930 || /* (2^32-4-132)/12: maximum possible tag count */
profile_length < 132+12*temp) /* truncated tag table */
return png_icc_profile_error(png_ptr, colorspace, name, temp,
- "tag count too large");
+ "tag count too large");
/* The 'intent' must be valid or we can't store it, ICC limits the intent to
* 16 bits.
@@ -1975,14 +2011,14 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
temp = png_get_uint_32(profile+64);
if (temp >= 0xffff) /* The ICC limit */
return png_icc_profile_error(png_ptr, colorspace, name, temp,
- "invalid rendering intent");
+ "invalid rendering intent");
/* This is just a warning because the profile may be valid in future
* versions.
*/
if (temp >= PNG_sRGB_INTENT_LAST)
(void)png_icc_profile_error(png_ptr, NULL, name, temp,
- "intent outside defined range");
+ "intent outside defined range");
/* At this point the tag table can't be checked because it hasn't necessarily
* been loaded; however, various header fields can be checked. These checks
@@ -1999,7 +2035,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
temp = png_get_uint_32(profile+36); /* signature 'ascp' */
if (temp != 0x61637370)
return png_icc_profile_error(png_ptr, colorspace, name, temp,
- "invalid signature");
+ "invalid signature");
/* Currently the PCS illuminant/adopted white point (the computational
* white point) are required to be D50,
@@ -2010,7 +2046,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
*/
if (memcmp(profile+68, D50_nCIEXYZ, 12) != 0)
(void)png_icc_profile_error(png_ptr, NULL, name, 0/*no tag value*/,
- "PCS illuminant is not D50");
+ "PCS illuminant is not D50");
/* The PNG spec requires this:
* "If the iCCP chunk is present, the image samples conform to the colour
@@ -2038,18 +2074,18 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
case 0x52474220: /* 'RGB ' */
if ((color_type & PNG_COLOR_MASK_COLOR) == 0)
return png_icc_profile_error(png_ptr, colorspace, name, temp,
- "RGB color space not permitted on grayscale PNG");
+ "RGB color space not permitted on grayscale PNG");
break;
case 0x47524159: /* 'GRAY' */
if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
return png_icc_profile_error(png_ptr, colorspace, name, temp,
- "Gray color space not permitted on RGB PNG");
+ "Gray color space not permitted on RGB PNG");
break;
default:
return png_icc_profile_error(png_ptr, colorspace, name, temp,
- "invalid ICC profile color space");
+ "invalid ICC profile color space");
}
/* It is up to the application to check that the profile class matches the
@@ -2074,7 +2110,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
case 0x61627374: /* 'abst' */
/* May not be embedded in an image */
return png_icc_profile_error(png_ptr, colorspace, name, temp,
- "invalid embedded Abstract ICC profile");
+ "invalid embedded Abstract ICC profile");
case 0x6c696e6b: /* 'link' */
/* DeviceLink profiles cannot be interpreted in a non-device specific
@@ -2084,7 +2120,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
* PNG.
*/
return png_icc_profile_error(png_ptr, colorspace, name, temp,
- "unexpected DeviceLink ICC profile class");
+ "unexpected DeviceLink ICC profile class");
case 0x6e6d636c: /* 'nmcl' */
/* A NamedColor profile is also device specific, however it doesn't
@@ -2092,7 +2128,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
* certainly it will fail the tests below.
*/
(void)png_icc_profile_error(png_ptr, NULL, name, temp,
- "unexpected NamedColor ICC profile class");
+ "unexpected NamedColor ICC profile class");
break;
default:
@@ -2102,7 +2138,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
* understood profiles.
*/
(void)png_icc_profile_error(png_ptr, NULL, name, temp,
- "unrecognized ICC profile class");
+ "unrecognized ICC profile class");
break;
}
@@ -2118,7 +2154,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
default:
return png_icc_profile_error(png_ptr, colorspace, name, temp,
- "unexpected ICC PCS encoding");
+ "unexpected ICC PCS encoding");
}
return 1;
@@ -2126,8 +2162,8 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
int /* PRIVATE */
png_icc_check_tag_table(png_const_structrp png_ptr, png_colorspacerp colorspace,
- png_const_charp name, png_uint_32 profile_length,
- png_const_bytep profile /* header plus whole tag table */)
+ png_const_charp name, png_uint_32 profile_length,
+ png_const_bytep profile /* header plus whole tag table */)
{
png_uint_32 tag_count = png_get_uint_32(profile+128);
png_uint_32 itag;
@@ -2155,7 +2191,7 @@ png_icc_check_tag_table(png_const_structrp png_ptr, png_colorspacerp colorspace,
* alignment.
*/
(void)png_icc_profile_error(png_ptr, NULL, name, tag_id,
- "ICC profile tag start not a multiple of 4");
+ "ICC profile tag start not a multiple of 4");
}
/* This is a hard error; potentially it can cause read outside the
@@ -2163,7 +2199,7 @@ png_icc_check_tag_table(png_const_structrp png_ptr, png_colorspacerp colorspace,
*/
if (tag_start > profile_length || tag_length > profile_length - tag_start)
return png_icc_profile_error(png_ptr, colorspace, name, tag_id,
- "ICC profile tag outside profile");
+ "ICC profile tag outside profile");
}
return 1; /* success, maybe with warnings */
@@ -2191,22 +2227,22 @@ static const struct
*/
/* adler32, crc32, MD5[4], intent, date, length, file-name */
PNG_ICC_CHECKSUM(0x0a3fd9f6, 0x3b8772b9,
- PNG_MD5(0x29f83dde, 0xaff255ae, 0x7842fae4, 0xca83390d), 0, 0,
- "2009/03/27 21:36:31", 3048, "sRGB_IEC61966-2-1_black_scaled.icc")
+ PNG_MD5(0x29f83dde, 0xaff255ae, 0x7842fae4, 0xca83390d), 0, 0,
+ "2009/03/27 21:36:31", 3048, "sRGB_IEC61966-2-1_black_scaled.icc")
/* ICC sRGB v2 perceptual no black-compensation: */
PNG_ICC_CHECKSUM(0x4909e5e1, 0x427ebb21,
- PNG_MD5(0xc95bd637, 0xe95d8a3b, 0x0df38f99, 0xc1320389), 1, 0,
- "2009/03/27 21:37:45", 3052, "sRGB_IEC61966-2-1_no_black_scaling.icc")
+ PNG_MD5(0xc95bd637, 0xe95d8a3b, 0x0df38f99, 0xc1320389), 1, 0,
+ "2009/03/27 21:37:45", 3052, "sRGB_IEC61966-2-1_no_black_scaling.icc")
PNG_ICC_CHECKSUM(0xfd2144a1, 0x306fd8ae,
- PNG_MD5(0xfc663378, 0x37e2886b, 0xfd72e983, 0x8228f1b8), 0, 0,
- "2009/08/10 17:28:01", 60988, "sRGB_v4_ICC_preference_displayclass.icc")
+ PNG_MD5(0xfc663378, 0x37e2886b, 0xfd72e983, 0x8228f1b8), 0, 0,
+ "2009/08/10 17:28:01", 60988, "sRGB_v4_ICC_preference_displayclass.icc")
/* ICC sRGB v4 perceptual */
PNG_ICC_CHECKSUM(0x209c35d2, 0xbbef7812,
- PNG_MD5(0x34562abf, 0x994ccd06, 0x6d2c5721, 0xd0d68c5d), 0, 0,
- "2007/07/25 00:05:37", 60960, "sRGB_v4_ICC_preference.icc")
+ PNG_MD5(0x34562abf, 0x994ccd06, 0x6d2c5721, 0xd0d68c5d), 0, 0,
+ "2007/07/25 00:05:37", 60960, "sRGB_v4_ICC_preference.icc")
/* The following profiles have no known MD5 checksum. If there is a match
* on the (empty) MD5 the other fields are used to attempt a match and
@@ -2214,8 +2250,8 @@ static const struct
* which suggests that they were also made by Hewlett Packard.
*/
PNG_ICC_CHECKSUM(0xa054d762, 0x5d5129ce,
- PNG_MD5(0x00000000, 0x00000000, 0x00000000, 0x00000000), 1, 0,
- "2004/07/21 18:57:42", 3024, "sRGB_IEC61966-2-1_noBPC.icc")
+ PNG_MD5(0x00000000, 0x00000000, 0x00000000, 0x00000000), 1, 0,
+ "2004/07/21 18:57:42", 3024, "sRGB_IEC61966-2-1_noBPC.icc")
/* This is a 'mntr' (display) profile with a mediaWhitePointTag that does not
* match the D50 PCS illuminant in the header (it is in fact the D65 values,
@@ -2225,17 +2261,17 @@ static const struct
* chromaticAdaptationTag.
*/
PNG_ICC_CHECKSUM(0xf784f3fb, 0x182ea552,
- PNG_MD5(0x00000000, 0x00000000, 0x00000000, 0x00000000), 0, 1/*broken*/,
- "1998/02/09 06:49:00", 3144, "HP-Microsoft sRGB v2 perceptual")
+ PNG_MD5(0x00000000, 0x00000000, 0x00000000, 0x00000000), 0, 1/*broken*/,
+ "1998/02/09 06:49:00", 3144, "HP-Microsoft sRGB v2 perceptual")
PNG_ICC_CHECKSUM(0x0398f3fc, 0xf29e526d,
- PNG_MD5(0x00000000, 0x00000000, 0x00000000, 0x00000000), 1, 1/*broken*/,
- "1998/02/09 06:49:00", 3144, "HP-Microsoft sRGB v2 media-relative")
+ PNG_MD5(0x00000000, 0x00000000, 0x00000000, 0x00000000), 1, 1/*broken*/,
+ "1998/02/09 06:49:00", 3144, "HP-Microsoft sRGB v2 media-relative")
};
static int
png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr,
- png_const_bytep profile, uLong adler)
+ png_const_bytep profile, uLong adler)
{
/* The quick check is to verify just the MD5 signature and trust the
* rest of the data. Because the profile has already been verified for
@@ -2319,7 +2355,7 @@ png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr,
* which is made irrelevant by this error.
*/
png_chunk_report(png_ptr, "known incorrect sRGB profile",
- PNG_CHUNK_ERROR);
+ PNG_CHUNK_ERROR);
}
/* Warn that this being done; this isn't even an error since
@@ -2329,8 +2365,8 @@ png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr,
else if (png_sRGB_checks[i].have_md5 == 0)
{
png_chunk_report(png_ptr,
- "out-of-date sRGB profile with no signature",
- PNG_CHUNK_WARNING);
+ "out-of-date sRGB profile with no signature",
+ PNG_CHUNK_WARNING);
}
return 1+png_sRGB_checks[i].is_broken;
@@ -2353,38 +2389,36 @@ png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr,
return 0; /* no match */
}
-#endif /* PNG_sRGB_PROFILE_CHECKS >= 0 */
void /* PRIVATE */
png_icc_set_sRGB(png_const_structrp png_ptr,
- png_colorspacerp colorspace, png_const_bytep profile, uLong adler)
+ png_colorspacerp colorspace, png_const_bytep profile, uLong adler)
{
/* Is this profile one of the known ICC sRGB profiles? If it is, just set
* the sRGB information.
*/
-#if PNG_sRGB_PROFILE_CHECKS >= 0
if (png_compare_ICC_profile_with_sRGB(png_ptr, profile, adler) != 0)
-#endif
(void)png_colorspace_set_sRGB(png_ptr, colorspace,
(int)/*already checked*/png_get_uint_32(profile+64));
}
+#endif /* PNG_sRGB_PROFILE_CHECKS >= 0 */
#endif /* sRGB */
int /* PRIVATE */
png_colorspace_set_ICC(png_const_structrp png_ptr, png_colorspacerp colorspace,
- png_const_charp name, png_uint_32 profile_length, png_const_bytep profile,
- int color_type)
+ png_const_charp name, png_uint_32 profile_length, png_const_bytep profile,
+ int color_type)
{
if ((colorspace->flags & PNG_COLORSPACE_INVALID) != 0)
return 0;
- if (png_icc_check_length(png_ptr, colorspace, name, profile_length) != 0 &&
+ if (icc_check_length(png_ptr, colorspace, name, profile_length) != 0 &&
png_icc_check_header(png_ptr, colorspace, name, profile_length, profile,
- color_type) != 0 &&
+ color_type) != 0 &&
png_icc_check_tag_table(png_ptr, colorspace, name, profile_length,
- profile) != 0)
+ profile) != 0)
{
-# ifdef PNG_sRGB_SUPPORTED
+# if defined(PNG_sRGB_SUPPORTED) && PNG_sRGB_PROFILE_CHECKS >= 0
/* If no sRGB support, don't try storing sRGB information */
png_icc_set_sRGB(png_ptr, colorspace, profile, 0);
# endif
@@ -2443,7 +2477,7 @@ png_colorspace_set_rgb_coefficients(png_structrp png_ptr)
/* Check for an internal error. */
if (r+g+b != 32768)
png_error(png_ptr,
- "internal error handling cHRM coefficients");
+ "internal error handling cHRM coefficients");
else
{
@@ -2469,7 +2503,7 @@ png_colorspace_set_rgb_coefficients(png_structrp png_ptr)
static int /* PRIVATE */
png_gt(size_t a, size_t b)
{
- return a > b;
+ return a > b;
}
#else
# define png_gt(a,b) ((a) > (b))
@@ -2477,9 +2511,9 @@ png_gt(size_t a, size_t b)
void /* PRIVATE */
png_check_IHDR(png_const_structrp png_ptr,
- png_uint_32 width, png_uint_32 height, int bit_depth,
- int color_type, int interlace_type, int compression_type,
- int filter_type)
+ png_uint_32 width, png_uint_32 height, int bit_depth,
+ int color_type, int interlace_type, int compression_type,
+ int filter_type)
{
int error = 0;
@@ -2496,7 +2530,7 @@ png_check_IHDR(png_const_structrp png_ptr,
error = 1;
}
- if (png_gt(((width + 7) & (~7)),
+ if (png_gt(((width + 7) & (~7U)),
((PNG_SIZE_MAX
- 48 /* big_row_buf hack */
- 1) /* filter byte */
@@ -2642,7 +2676,7 @@ png_check_IHDR(png_const_structrp png_ptr,
int /* PRIVATE */
png_check_fp_number(png_const_charp string, png_size_t size, int *statep,
- png_size_tp whereami)
+ png_size_tp whereami)
{
int state = *statep;
png_size_t i = *whereami;
@@ -2907,7 +2941,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
*/
if (exp_b10 < 0 && exp_b10 > -3) /* PLUS 3 TOTAL 4 */
{
- czero = -exp_b10; /* PLUS 2 digits: TOTAL 3 */
+ czero = (unsigned int)(-exp_b10); /* PLUS 2 digits: TOTAL 3 */
exp_b10 = 0; /* Dot added below before first output. */
}
else
@@ -3085,11 +3119,11 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
if (exp_b10 < 0)
{
*ascii++ = 45, --size; /* '-': PLUS 1 TOTAL 3+precision */
- uexp_b10 = -exp_b10;
+ uexp_b10 = (unsigned int)(-exp_b10);
}
else
- uexp_b10 = exp_b10;
+ uexp_b10 = (unsigned int)exp_b10;
cdigits = 0;
@@ -3151,9 +3185,9 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
/* Avoid overflow here on the minimum integer. */
if (fp < 0)
- *ascii++ = 45, num = -fp;
+ *ascii++ = 45, num = (png_uint_32)(-fp);
else
- num = fp;
+ num = (png_uint_32)fp;
if (num <= 0x80000000) /* else overflowed */
{
@@ -3805,25 +3839,25 @@ png_gamma_16bit_correct(unsigned int value, png_fixed_point gamma_val)
{
if (value > 0 && value < 65535)
{
-# ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
- /* The same (unsigned int)->(double) constraints apply here as above,
- * however in this case the (unsigned int) to (int) conversion can
- * overflow on an ANSI-C90 compliant system so the cast needs to ensure
- * that this is not possible.
- */
- double r = floor(65535*pow((png_int_32)value/65535.,
- gamma_val*.00001)+.5);
- return (png_uint_16)r;
-# else
- png_int_32 lg2 = png_log16bit(value);
- png_fixed_point res;
-
- if (png_muldiv(&res, gamma_val, lg2, PNG_FP_1) != 0)
- return png_exp16bit(res);
-
- /* Overflow. */
- value = 0;
-# endif
+# ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
+ /* The same (unsigned int)->(double) constraints apply here as above,
+ * however in this case the (unsigned int) to (int) conversion can
+ * overflow on an ANSI-C90 compliant system so the cast needs to ensure
+ * that this is not possible.
+ */
+ double r = floor(65535*pow((png_int_32)value/65535.,
+ gamma_val*.00001)+.5);
+ return (png_uint_16)r;
+# else
+ png_int_32 lg2 = png_log16bit(value);
+ png_fixed_point res;
+
+ if (png_muldiv(&res, gamma_val, lg2, PNG_FP_1) != 0)
+ return png_exp16bit(res);
+
+ /* Overflow. */
+ value = 0;
+# endif
}
return (png_uint_16)value;
@@ -3862,7 +3896,7 @@ png_gamma_correct(png_structrp png_ptr, unsigned int value,
*/
static void
png_build_16bit_table(png_structrp png_ptr, png_uint_16pp *ptable,
- PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma_val)
+ PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma_val)
{
/* Various values derived from 'shift': */
PNG_CONST unsigned int num = 1U << (8U - shift);
@@ -3939,7 +3973,7 @@ png_build_16bit_table(png_structrp png_ptr, png_uint_16pp *ptable,
*/
static void
png_build_16to8_table(png_structrp png_ptr, png_uint_16pp *ptable,
- PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma_val)
+ PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma_val)
{
PNG_CONST unsigned int num = 1U << (8U - shift);
PNG_CONST unsigned int max = (1U << (16U - shift))-1U;
@@ -4007,7 +4041,7 @@ png_build_16to8_table(png_structrp png_ptr, png_uint_16pp *ptable,
*/
static void
png_build_8bit_table(png_structrp png_ptr, png_bytepp ptable,
- PNG_CONST png_fixed_point gamma_val)
+ PNG_CONST png_fixed_point gamma_val)
{
unsigned int i;
png_bytep table = *ptable = (png_bytep)png_malloc(png_ptr, 256);
@@ -4087,131 +4121,133 @@ png_destroy_gamma_table(png_structrp png_ptr)
void /* PRIVATE */
png_build_gamma_table(png_structrp png_ptr, int bit_depth)
{
- png_debug(1, "in png_build_gamma_table");
-
- /* Remove any existing table; this copes with multiple calls to
- * png_read_update_info. The warning is because building the gamma tables
- * multiple times is a performance hit - it's harmless but the ability to call
- * png_read_update_info() multiple times is new in 1.5.6 so it seems sensible
- * to warn if the app introduces such a hit.
- */
- if (png_ptr->gamma_table != NULL || png_ptr->gamma_16_table != NULL)
- {
- png_warning(png_ptr, "gamma table being rebuilt");
- png_destroy_gamma_table(png_ptr);
- }
-
- if (bit_depth <= 8)
- {
- png_build_8bit_table(png_ptr, &png_ptr->gamma_table,
- png_ptr->screen_gamma > 0 ? png_reciprocal2(png_ptr->colorspace.gamma,
- png_ptr->screen_gamma) : PNG_FP_1);
+ png_debug(1, "in png_build_gamma_table");
+
+ /* Remove any existing table; this copes with multiple calls to
+ * png_read_update_info. The warning is because building the gamma tables
+ * multiple times is a performance hit - it's harmless but the ability to
+ * call png_read_update_info() multiple times is new in 1.5.6 so it seems
+ * sensible to warn if the app introduces such a hit.
+ */
+ if (png_ptr->gamma_table != NULL || png_ptr->gamma_16_table != NULL)
+ {
+ png_warning(png_ptr, "gamma table being rebuilt");
+ png_destroy_gamma_table(png_ptr);
+ }
+
+ if (bit_depth <= 8)
+ {
+ png_build_8bit_table(png_ptr, &png_ptr->gamma_table,
+ png_ptr->screen_gamma > 0 ?
+ png_reciprocal2(png_ptr->colorspace.gamma,
+ png_ptr->screen_gamma) : PNG_FP_1);
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
defined(PNG_READ_ALPHA_MODE_SUPPORTED) || \
defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
- if ((png_ptr->transformations & (PNG_COMPOSE | PNG_RGB_TO_GRAY)) != 0)
- {
- png_build_8bit_table(png_ptr, &png_ptr->gamma_to_1,
- png_reciprocal(png_ptr->colorspace.gamma));
-
- png_build_8bit_table(png_ptr, &png_ptr->gamma_from_1,
- png_ptr->screen_gamma > 0 ? png_reciprocal(png_ptr->screen_gamma) :
- png_ptr->colorspace.gamma/* Probably doing rgb_to_gray */);
- }
+ if ((png_ptr->transformations & (PNG_COMPOSE | PNG_RGB_TO_GRAY)) != 0)
+ {
+ png_build_8bit_table(png_ptr, &png_ptr->gamma_to_1,
+ png_reciprocal(png_ptr->colorspace.gamma));
+
+ png_build_8bit_table(png_ptr, &png_ptr->gamma_from_1,
+ png_ptr->screen_gamma > 0 ?
+ png_reciprocal(png_ptr->screen_gamma) :
+ png_ptr->colorspace.gamma/* Probably doing rgb_to_gray */);
+ }
#endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
- }
+ }
#ifdef PNG_16BIT_SUPPORTED
- else
- {
- png_byte shift, sig_bit;
-
- if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) != 0)
- {
- sig_bit = png_ptr->sig_bit.red;
-
- if (png_ptr->sig_bit.green > sig_bit)
- sig_bit = png_ptr->sig_bit.green;
-
- if (png_ptr->sig_bit.blue > sig_bit)
- sig_bit = png_ptr->sig_bit.blue;
- }
- else
- sig_bit = png_ptr->sig_bit.gray;
-
- /* 16-bit gamma code uses this equation:
- *
- * ov = table[(iv & 0xff) >> gamma_shift][iv >> 8]
- *
- * Where 'iv' is the input color value and 'ov' is the output value -
- * pow(iv, gamma).
- *
- * Thus the gamma table consists of up to 256 256-entry tables. The table
- * is selected by the (8-gamma_shift) most significant of the low 8 bits of
- * the color value then indexed by the upper 8 bits:
- *
- * table[low bits][high 8 bits]
- *
- * So the table 'n' corresponds to all those 'iv' of:
- *
- * <all high 8-bit values><n << gamma_shift>..<(n+1 << gamma_shift)-1>
- *
- */
- if (sig_bit > 0 && sig_bit < 16U)
- /* shift == insignificant bits */
- shift = (png_byte)((16U - sig_bit) & 0xff);
-
- else
- shift = 0; /* keep all 16 bits */
-
- if ((png_ptr->transformations & (PNG_16_TO_8 | PNG_SCALE_16_TO_8)) != 0)
- {
- /* PNG_MAX_GAMMA_8 is the number of bits to keep - effectively
- * the significant bits in the *input* when the output will
- * eventually be 8 bits. By default it is 11.
- */
- if (shift < (16U - PNG_MAX_GAMMA_8))
- shift = (16U - PNG_MAX_GAMMA_8);
- }
-
- if (shift > 8U)
- shift = 8U; /* Guarantees at least one table! */
-
- png_ptr->gamma_shift = shift;
-
- /* NOTE: prior to 1.5.4 this test used to include PNG_BACKGROUND (now
- * PNG_COMPOSE). This effectively smashed the background calculation for
- * 16-bit output because the 8-bit table assumes the result will be reduced
- * to 8 bits.
- */
- if ((png_ptr->transformations & (PNG_16_TO_8 | PNG_SCALE_16_TO_8)) != 0)
- png_build_16to8_table(png_ptr, &png_ptr->gamma_16_table, shift,
- png_ptr->screen_gamma > 0 ? png_product2(png_ptr->colorspace.gamma,
- png_ptr->screen_gamma) : PNG_FP_1);
-
- else
- png_build_16bit_table(png_ptr, &png_ptr->gamma_16_table, shift,
- png_ptr->screen_gamma > 0 ? png_reciprocal2(png_ptr->colorspace.gamma,
- png_ptr->screen_gamma) : PNG_FP_1);
+ else
+ {
+ png_byte shift, sig_bit;
+
+ if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) != 0)
+ {
+ sig_bit = png_ptr->sig_bit.red;
+
+ if (png_ptr->sig_bit.green > sig_bit)
+ sig_bit = png_ptr->sig_bit.green;
+
+ if (png_ptr->sig_bit.blue > sig_bit)
+ sig_bit = png_ptr->sig_bit.blue;
+ }
+ else
+ sig_bit = png_ptr->sig_bit.gray;
+
+ /* 16-bit gamma code uses this equation:
+ *
+ * ov = table[(iv & 0xff) >> gamma_shift][iv >> 8]
+ *
+ * Where 'iv' is the input color value and 'ov' is the output value -
+ * pow(iv, gamma).
+ *
+ * Thus the gamma table consists of up to 256 256-entry tables. The table
+ * is selected by the (8-gamma_shift) most significant of the low 8 bits
+ * of the color value then indexed by the upper 8 bits:
+ *
+ * table[low bits][high 8 bits]
+ *
+ * So the table 'n' corresponds to all those 'iv' of:
+ *
+ * <all high 8-bit values><n << gamma_shift>..<(n+1 << gamma_shift)-1>
+ *
+ */
+ if (sig_bit > 0 && sig_bit < 16U)
+ /* shift == insignificant bits */
+ shift = (png_byte)((16U - sig_bit) & 0xff);
+
+ else
+ shift = 0; /* keep all 16 bits */
+
+ if ((png_ptr->transformations & (PNG_16_TO_8 | PNG_SCALE_16_TO_8)) != 0)
+ {
+ /* PNG_MAX_GAMMA_8 is the number of bits to keep - effectively
+ * the significant bits in the *input* when the output will
+ * eventually be 8 bits. By default it is 11.
+ */
+ if (shift < (16U - PNG_MAX_GAMMA_8))
+ shift = (16U - PNG_MAX_GAMMA_8);
+ }
+
+ if (shift > 8U)
+ shift = 8U; /* Guarantees at least one table! */
+
+ png_ptr->gamma_shift = shift;
+
+ /* NOTE: prior to 1.5.4 this test used to include PNG_BACKGROUND (now
+ * PNG_COMPOSE). This effectively smashed the background calculation for
+ * 16-bit output because the 8-bit table assumes the result will be
+ * reduced to 8 bits.
+ */
+ if ((png_ptr->transformations & (PNG_16_TO_8 | PNG_SCALE_16_TO_8)) != 0)
+ png_build_16to8_table(png_ptr, &png_ptr->gamma_16_table, shift,
+ png_ptr->screen_gamma > 0 ? png_product2(png_ptr->colorspace.gamma,
+ png_ptr->screen_gamma) : PNG_FP_1);
+
+ else
+ png_build_16bit_table(png_ptr, &png_ptr->gamma_16_table, shift,
+ png_ptr->screen_gamma > 0 ? png_reciprocal2(png_ptr->colorspace.gamma,
+ png_ptr->screen_gamma) : PNG_FP_1);
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
defined(PNG_READ_ALPHA_MODE_SUPPORTED) || \
defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
- if ((png_ptr->transformations & (PNG_COMPOSE | PNG_RGB_TO_GRAY)) != 0)
- {
- png_build_16bit_table(png_ptr, &png_ptr->gamma_16_to_1, shift,
- png_reciprocal(png_ptr->colorspace.gamma));
-
- /* Notice that the '16 from 1' table should be full precision, however
- * the lookup on this table still uses gamma_shift, so it can't be.
- * TODO: fix this.
- */
- png_build_16bit_table(png_ptr, &png_ptr->gamma_16_from_1, shift,
- png_ptr->screen_gamma > 0 ? png_reciprocal(png_ptr->screen_gamma) :
- png_ptr->colorspace.gamma/* Probably doing rgb_to_gray */);
- }
+ if ((png_ptr->transformations & (PNG_COMPOSE | PNG_RGB_TO_GRAY)) != 0)
+ {
+ png_build_16bit_table(png_ptr, &png_ptr->gamma_16_to_1, shift,
+ png_reciprocal(png_ptr->colorspace.gamma));
+
+ /* Notice that the '16 from 1' table should be full precision, however
+ * the lookup on this table still uses gamma_shift, so it can't be.
+ * TODO: fix this.
+ */
+ png_build_16bit_table(png_ptr, &png_ptr->gamma_16_from_1, shift,
+ png_ptr->screen_gamma > 0 ? png_reciprocal(png_ptr->screen_gamma) :
+ png_ptr->colorspace.gamma/* Probably doing rgb_to_gray */);
+ }
#endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
- }
+ }
#endif /* 16BIT */
}
#endif /* READ_GAMMA */
@@ -4224,11 +4260,11 @@ png_set_option(png_structrp png_ptr, int option, int onoff)
if (png_ptr != NULL && option >= 0 && option < PNG_OPTION_NEXT &&
(option & 1) == 0)
{
- int mask = 3 << option;
- int setting = (2 + (onoff != 0)) << option;
- int current = png_ptr->options;
+ png_uint_32 mask = 3 << option;
+ png_uint_32 setting = (2 + (onoff != 0)) << option;
+ png_uint_32 current = png_ptr->options;
- png_ptr->options = (png_byte)(((current & ~mask) | setting) & 0xff);
+ png_ptr->options = (png_uint_32)(((current & ~mask) | setting) & 0xff);
return (current & mask) >> option;
}
diff --git a/src/3rdparty/libpng/png.h b/src/3rdparty/libpng/png.h
index 4d03dfc136..e4cf032816 100644
--- a/src/3rdparty/libpng/png.h
+++ b/src/3rdparty/libpng/png.h
@@ -1,9 +1,9 @@
/* png.h - header file for PNG reference library
*
- * libpng version 1.6.20, December 3, 2015
+ * libpng version 1.6.28, January 5, 2017
*
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -12,7 +12,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
- * libpng versions 0.97, January 1998, through 1.6.20, December 3, 2015:
+ * libpng versions 0.97, January 1998, through 1.6.28, January 5, 2017:
* Glenn Randers-Pehrson.
* See also "Contributing Authors", below.
*/
@@ -25,8 +25,8 @@
*
* This code is released under the libpng license.
*
- * libpng versions 1.0.7, July 1, 2000, through 1.6.20, December 3, 2015, are
- * Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, are
+ * libpng versions 1.0.7, July 1, 2000 through 1.6.28, January 5, 2017 are
+ * Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
* derived from libpng-1.0.6, and are distributed according to the same
* disclaimer and license as libpng-1.0.6 with the following individuals
* added to the list of Contributing Authors:
@@ -37,6 +37,7 @@
* Cosmin Truta
* Gilles Vollant
* James Yu
+ * Mandar Sahastrabuddhe
*
* and with the following additions to the disclaimer:
*
@@ -47,6 +48,10 @@
* risk of satisfactory quality, performance, accuracy, and effort is with
* the user.
*
+ * Some files in the "contrib" directory and some configure-generated
+ * files that are distributed with libpng have other copyright owners and
+ * are released under other open source licenses.
+ *
* libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
* Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
* libpng-0.96, and are distributed according to the same disclaimer and
@@ -70,6 +75,9 @@
* Greg Roelofs
* Tom Tanner
*
+ * Some files in the "scripts" directory have other copyright owners
+ * but are released under this license.
+ *
* libpng versions 0.5, May 1995, through 0.88, January 1996, are
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
*
@@ -109,6 +117,29 @@
* appreciated.
*
* END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
+ *
+ * TRADEMARK:
+ *
+ * The name "libpng" has not been registered by the Copyright owner
+ * as a trademark in any jurisdiction. However, because libpng has
+ * been distributed and maintained world-wide, continually since 1995,
+ * the Copyright owner claims "common-law trademark protection" in any
+ * jurisdiction where common-law trademark is recognized.
+ *
+ * OSI CERTIFICATION:
+ *
+ * Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
+ * a certification mark of the Open Source Initiative. OSI has not addressed
+ * the additional disclaimers inserted at version 1.0.7.
+ *
+ * EXPORT CONTROL:
+ *
+ * The Copyright owner believes that the Export Control Classification
+ * Number (ECCN) for libpng is EAR99, which means not subject to export
+ * controls or International Traffic in Arms Regulations (ITAR) because
+ * it is open source, publicly available software, that does not contain
+ * any encryption software. See the EAR, paragraphs 734.3(b)(3) and
+ * 734.7(b).
*/
/*
@@ -122,12 +153,6 @@
*/
/*
- * Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
- * a certification mark of the Open Source Initiative. OSI has not addressed
- * the additional disclaimers inserted at version 1.0.7.
- */
-
-/*
* The contributing authors would like to thank all those who helped
* with testing, bug fixes, and patience. This wouldn't have been
* possible without all of you.
@@ -182,11 +207,11 @@
* ...
* 1.0.19 10 10019 10.so.0.19[.0]
* ...
- * 1.2.53 13 10253 12.so.0.53[.0]
+ * 1.2.57 13 10257 12.so.0.57[.0]
* ...
- * 1.5.23 15 10523 15.so.15.23[.0]
+ * 1.5.28 15 10527 15.so.15.28[.0]
* ...
- * 1.6.20 16 10620 16.so.16.20[.0]
+ * 1.6.28 16 10628 16.so.16.28[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@@ -214,13 +239,13 @@
* Y2K compliance in libpng:
* =========================
*
- * December 3, 2015
+ * January 5, 2017
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
*
* This is your unofficial assurance that libpng from version 0.71 and
- * upward through 1.6.20 are Y2K compliant. It is my belief that
+ * upward through 1.6.28 are Y2K compliant. It is my belief that
* earlier versions were also Y2K compliant.
*
* Libpng only has two year fields. One is a 2-byte unsigned integer
@@ -282,9 +307,8 @@
*/
/* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.6.20"
-#define PNG_HEADER_VERSION_STRING \
- " libpng version 1.6.20 - December 3, 2015\n"
+#define PNG_LIBPNG_VER_STRING "1.6.28"
+#define PNG_HEADER_VERSION_STRING " libpng version 1.6.28 - January 5, 2017\n"
#define PNG_LIBPNG_VER_SONUM 16
#define PNG_LIBPNG_VER_DLLNUM 16
@@ -292,7 +316,7 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 6
-#define PNG_LIBPNG_VER_RELEASE 20
+#define PNG_LIBPNG_VER_RELEASE 28
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
@@ -323,20 +347,20 @@
* version 1.0.0 was mis-numbered 100 instead of 10000). From
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
*/
-#define PNG_LIBPNG_VER 10620 /* 1.6.20 */
+#define PNG_LIBPNG_VER 10628 /* 1.6.28 */
/* Library configuration: these options cannot be changed after
* the library has been built.
*/
#ifndef PNGLCONF_H
- /* If pnglibconf.h is missing, you can
- * copy scripts/pnglibconf.h.prebuilt to pnglibconf.h
- */
+/* If pnglibconf.h is missing, you can
+ * copy scripts/pnglibconf.h.prebuilt to pnglibconf.h
+ */
# include "pnglibconf.h"
#endif
#ifndef PNG_VERSION_INFO_ONLY
- /* Machine specific configuration. */
+/* Machine specific configuration. */
# include "pngconf.h"
#endif
@@ -433,7 +457,7 @@ extern "C" {
/* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number.
*/
-typedef char* png_libpng_version_1_6_20;
+typedef char* png_libpng_version_1_6_28;
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
*
@@ -626,17 +650,17 @@ typedef png_time * * png_timepp;
*/
typedef struct png_unknown_chunk_t
{
- png_byte name[5]; /* Textual chunk name with '\0' terminator */
- png_byte *data; /* Data, should not be modified on read! */
- png_size_t size;
-
- /* On write 'location' must be set using the flag values listed below.
- * Notice that on read it is set by libpng however the values stored have
- * more bits set than are listed below. Always treat the value as a
- * bitmask. On write set only one bit - setting multiple bits may cause the
- * chunk to be written in multiple places.
- */
- png_byte location; /* mode of operation at read time */
+ png_byte name[5]; /* Textual chunk name with '\0' terminator */
+ png_byte *data; /* Data, should not be modified on read! */
+ png_size_t size;
+
+ /* On write 'location' must be set using the flag values listed below.
+ * Notice that on read it is set by libpng however the values stored have
+ * more bits set than are listed below. Always treat the value as a
+ * bitmask. On write set only one bit - setting multiple bits may cause the
+ * chunk to be written in multiple places.
+ */
+ png_byte location; /* mode of operation at read time */
}
png_unknown_chunk;
@@ -734,24 +758,22 @@ typedef png_unknown_chunk * * png_unknown_chunkpp;
* data in the info_struct to be written into the output file. The values
* of the PNG_INFO_<chunk> defines should NOT be changed.
*/
-#define PNG_INFO_gAMA 0x0001
-#define PNG_INFO_sBIT 0x0002
-#define PNG_INFO_cHRM 0x0004
-#define PNG_INFO_PLTE 0x0008
-#define PNG_INFO_tRNS 0x0010
-#define PNG_INFO_bKGD 0x0020
-#define PNG_INFO_hIST 0x0040
-#define PNG_INFO_pHYs 0x0080
-#define PNG_INFO_oFFs 0x0100
-#define PNG_INFO_tIME 0x0200
-#define PNG_INFO_pCAL 0x0400
-#define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */
-#define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */
-#define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */
-#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */
-#if INT_MAX >= 0x8000 /* else this might break */
-#define PNG_INFO_IDAT 0x8000 /* ESR, 1.0.6 */
-#endif
+#define PNG_INFO_gAMA 0x0001U
+#define PNG_INFO_sBIT 0x0002U
+#define PNG_INFO_cHRM 0x0004U
+#define PNG_INFO_PLTE 0x0008U
+#define PNG_INFO_tRNS 0x0010U
+#define PNG_INFO_bKGD 0x0020U
+#define PNG_INFO_hIST 0x0040U
+#define PNG_INFO_pHYs 0x0080U
+#define PNG_INFO_oFFs 0x0100U
+#define PNG_INFO_tIME 0x0200U
+#define PNG_INFO_pCAL 0x0400U
+#define PNG_INFO_sRGB 0x0800U /* GR-P, 0.96a */
+#define PNG_INFO_iCCP 0x1000U /* ESR, 1.0.6 */
+#define PNG_INFO_sPLT 0x2000U /* ESR, 1.0.6 */
+#define PNG_INFO_sCAL 0x4000U /* ESR, 1.0.6 */
+#define PNG_INFO_IDAT 0x8000U /* ESR, 1.0.6 */
/* This is used for the transformation routines, as some of them
* change these values for the row. It also should enable using
@@ -1322,7 +1344,7 @@ PNG_EXPORT(229, void, png_set_scale_16, (png_structrp png_ptr));
#endif
#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
-#define PNG_READ_16_TO_8 SUPPORTED /* Name prior to 1.5.4 */
+#define PNG_READ_16_TO_8_SUPPORTED /* Name prior to 1.5.4 */
/* Strip the second byte of information from a 16-bit depth file. */
PNG_EXPORT(48, void, png_set_strip_16, (png_structrp png_ptr));
#endif
@@ -1473,8 +1495,8 @@ PNG_EXPORT(67, void, png_set_filter, (png_structrp png_ptr, int method,
#define PNG_FILTER_UP 0x20
#define PNG_FILTER_AVG 0x40
#define PNG_FILTER_PAETH 0x80
-#define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \
- PNG_FILTER_AVG | PNG_FILTER_PAETH)
+#define PNG_FAST_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP)
+#define PNG_ALL_FILTERS (PNG_FAST_FILTERS | PNG_FILTER_AVG | PNG_FILTER_PAETH)
/* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now.
* These defines should NOT be changed.
@@ -1751,21 +1773,21 @@ PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr,
#define PNG_SET_WILL_FREE_DATA 1
#define PNG_USER_WILL_FREE_DATA 2
/* Flags for png_ptr->free_me and info_ptr->free_me */
-#define PNG_FREE_HIST 0x0008
-#define PNG_FREE_ICCP 0x0010
-#define PNG_FREE_SPLT 0x0020
-#define PNG_FREE_ROWS 0x0040
-#define PNG_FREE_PCAL 0x0080
-#define PNG_FREE_SCAL 0x0100
+#define PNG_FREE_HIST 0x0008U
+#define PNG_FREE_ICCP 0x0010U
+#define PNG_FREE_SPLT 0x0020U
+#define PNG_FREE_ROWS 0x0040U
+#define PNG_FREE_PCAL 0x0080U
+#define PNG_FREE_SCAL 0x0100U
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
-# define PNG_FREE_UNKN 0x0200
+# define PNG_FREE_UNKN 0x0200U
#endif
-/* PNG_FREE_LIST 0x0400 removed in 1.6.0 because it is ignored */
-#define PNG_FREE_PLTE 0x1000
-#define PNG_FREE_TRNS 0x2000
-#define PNG_FREE_TEXT 0x4000
-#define PNG_FREE_ALL 0x7fff
-#define PNG_FREE_MUL 0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
+/* PNG_FREE_LIST 0x0400U removed in 1.6.0 because it is ignored */
+#define PNG_FREE_PLTE 0x1000U
+#define PNG_FREE_TRNS 0x2000U
+#define PNG_FREE_TEXT 0x4000U
+#define PNG_FREE_ALL 0x7fffU
+#define PNG_FREE_MUL 0x4220U /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
#ifdef PNG_USER_MEM_SUPPORTED
PNG_EXPORTA(100, png_voidp, png_malloc_default, (png_const_structrp png_ptr,
@@ -2271,8 +2293,10 @@ PNG_EXPORT(171, void, png_set_sCAL_s, (png_const_structrp png_ptr,
* except for the IHDR, PLTE, tRNS, IDAT, and IEND chunks (which continue to
* be processed by libpng.
*/
+#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
PNG_EXPORT(172, void, png_set_keep_unknown_chunks, (png_structrp png_ptr,
int keep, png_const_bytep chunk_list, int num_chunks));
+#endif /* HANDLE_AS_UNKNOWN */
/* The "keep" PNG_HANDLE_CHUNK_ parameter for the specified chunk is returned;
* the result is therefore true (non-zero) if special handling is required,
@@ -2280,7 +2304,7 @@ PNG_EXPORT(172, void, png_set_keep_unknown_chunks, (png_structrp png_ptr,
*/
PNG_EXPORT(173, int, png_handle_as_unknown, (png_const_structrp png_ptr,
png_const_bytep chunk_name));
-#endif
+#endif /* SET_UNKNOWN_CHUNKS */
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
PNG_EXPORT(174, void, png_set_unknown_chunks, (png_const_structrp png_ptr,
@@ -2501,33 +2525,37 @@ PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type,
/* fg and bg should be in `gamma 1.0' space; alpha is the opacity */
-# define png_composite(composite, fg, alpha, bg) \
- { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \
- * (png_uint_16)(alpha) \
- + (png_uint_16)(bg)*(png_uint_16)(255 \
- - (png_uint_16)(alpha)) + 128); \
- (composite) = (png_byte)(((temp + (temp >> 8)) >> 8) & 0xff); }
-
-# define png_composite_16(composite, fg, alpha, bg) \
- { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) \
- * (png_uint_32)(alpha) \
- + (png_uint_32)(bg)*(65535 \
- - (png_uint_32)(alpha)) + 32768); \
- (composite) = (png_uint_16)(0xffff & ((temp + (temp >> 16)) >> 16)); }
+# define png_composite(composite, fg, alpha, bg) \
+ { \
+ png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \
+ * (png_uint_16)(alpha) \
+ + (png_uint_16)(bg)*(png_uint_16)(255 \
+ - (png_uint_16)(alpha)) + 128); \
+ (composite) = (png_byte)(((temp + (temp >> 8)) >> 8) & 0xff); \
+ }
+
+# define png_composite_16(composite, fg, alpha, bg) \
+ { \
+ png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) \
+ * (png_uint_32)(alpha) \
+ + (png_uint_32)(bg)*(65535 \
+ - (png_uint_32)(alpha)) + 32768); \
+ (composite) = (png_uint_16)(0xffff & ((temp + (temp >> 16)) >> 16)); \
+ }
#else /* Standard method using integer division */
-# define png_composite(composite, fg, alpha, bg) \
- (composite) = \
- (png_byte)(0xff & (((png_uint_16)(fg) * (png_uint_16)(alpha) + \
- (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \
- 127) / 255))
-
-# define png_composite_16(composite, fg, alpha, bg) \
- (composite) = \
- (png_uint_16)(0xffff & (((png_uint_32)(fg) * (png_uint_32)(alpha) + \
- (png_uint_32)(bg)*(png_uint_32)(65535 - (png_uint_32)(alpha)) + \
- 32767) / 65535))
+# define png_composite(composite, fg, alpha, bg) \
+ (composite) = \
+ (png_byte)(0xff & (((png_uint_16)(fg) * (png_uint_16)(alpha) + \
+ (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \
+ 127) / 255))
+
+# define png_composite_16(composite, fg, alpha, bg) \
+ (composite) = \
+ (png_uint_16)(0xffff & (((png_uint_32)(fg) * (png_uint_32)(alpha) + \
+ (png_uint_32)(bg)*(png_uint_32)(65535 - (png_uint_32)(alpha)) + \
+ 32767) / 65535))
#endif /* READ_COMPOSITE_NODIV */
#ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED
@@ -2563,38 +2591,38 @@ PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i));
* format for negative values, which is almost certainly true.
*/
# define PNG_get_uint_32(buf) \
- (((png_uint_32)(*(buf)) << 24) + \
- ((png_uint_32)(*((buf) + 1)) << 16) + \
- ((png_uint_32)(*((buf) + 2)) << 8) + \
- ((png_uint_32)(*((buf) + 3))))
+ (((png_uint_32)(*(buf)) << 24) + \
+ ((png_uint_32)(*((buf) + 1)) << 16) + \
+ ((png_uint_32)(*((buf) + 2)) << 8) + \
+ ((png_uint_32)(*((buf) + 3))))
/* From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the
* function) incorrectly returned a value of type png_uint_32.
*/
# define PNG_get_uint_16(buf) \
- ((png_uint_16) \
- (((unsigned int)(*(buf)) << 8) + \
- ((unsigned int)(*((buf) + 1)))))
+ ((png_uint_16) \
+ (((unsigned int)(*(buf)) << 8) + \
+ ((unsigned int)(*((buf) + 1)))))
# define PNG_get_int_32(buf) \
- ((png_int_32)((*(buf) & 0x80) \
- ? -((png_int_32)(((png_get_uint_32(buf)^0xffffffffU)+1U)&0x7fffffffU)) \
- : (png_int_32)png_get_uint_32(buf)))
+ ((png_int_32)((*(buf) & 0x80) \
+ ? -((png_int_32)(((png_get_uint_32(buf)^0xffffffffU)+1U)&0x7fffffffU)) \
+ : (png_int_32)png_get_uint_32(buf)))
- /* If PNG_PREFIX is defined the same thing as below happens in pnglibconf.h,
- * but defining a macro name prefixed with PNG_PREFIX.
- */
+/* If PNG_PREFIX is defined the same thing as below happens in pnglibconf.h,
+ * but defining a macro name prefixed with PNG_PREFIX.
+ */
# ifndef PNG_PREFIX
-# define png_get_uint_32(buf) PNG_get_uint_32(buf)
-# define png_get_uint_16(buf) PNG_get_uint_16(buf)
-# define png_get_int_32(buf) PNG_get_int_32(buf)
+# define png_get_uint_32(buf) PNG_get_uint_32(buf)
+# define png_get_uint_16(buf) PNG_get_uint_16(buf)
+# define png_get_int_32(buf) PNG_get_int_32(buf)
# endif
#else
# ifdef PNG_PREFIX
- /* No macros; revert to the (redefined) function */
-# define PNG_get_uint_32 (png_get_uint_32)
-# define PNG_get_uint_16 (png_get_uint_16)
-# define PNG_get_int_32 (png_get_int_32)
+ /* No macros; revert to the (redefined) function */
+# define PNG_get_uint_32 (png_get_uint_32)
+# define PNG_get_uint_16 (png_get_uint_16)
+# define PNG_get_int_32 (png_get_int_32)
# endif
#endif
@@ -2889,12 +2917,19 @@ typedef struct
* is the minimum 'row stride', the minimum count of components between each
* row. For a color-mapped image this is the minimum number of bytes in a
* row.
+ *
+ * WARNING: this macro overflows for some images with more than one component
+ * and very large image widths. libpng will refuse to process an image where
+ * this macro would overflow.
*/
#define PNG_IMAGE_BUFFER_SIZE(image, row_stride)\
(PNG_IMAGE_PIXEL_COMPONENT_SIZE((image).format)*(image).height*(row_stride))
/* Return the size, in bytes, of an image buffer given a png_image and a row
* stride - the number of components to leave space for in each row.
+ *
+ * WARNING: this macro overflows a 32-bit integer for some large PNG images,
+ * libpng will refuse to process an image where such an overflow would occur.
*/
#define PNG_IMAGE_SIZE(image)\
@@ -3015,7 +3050,6 @@ PNG_EXPORT(238, void, png_image_free, (png_imagep image));
#endif /* SIMPLIFIED_READ */
#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
-#ifdef PNG_STDIO_SUPPORTED
/* WRITE APIS
* ----------
* For write you must initialize a png_image structure to describe the image to
@@ -3032,6 +3066,7 @@ PNG_EXPORT(238, void, png_image_free, (png_imagep image));
* values do not correspond to the colors in sRGB.
* colormap_entries: set to the number of entries in the color-map (0 to 256)
*/
+#ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
PNG_EXPORT(239, int, png_image_write_to_file, (png_imagep image,
const char *file, int convert_to_8bit, const void *buffer,
png_int_32 row_stride, const void *colormap));
@@ -3041,8 +3076,9 @@ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
int convert_to_8_bit, const void *buffer, png_int_32 row_stride,
const void *colormap));
/* Write the image to the given (FILE*). */
+#endif /* SIMPLIFIED_WRITE_STDIO */
-/* With both write APIs if image is in one of the linear formats with 16-bit
+/* With all write APIs if image is in one of the linear formats with 16-bit
* data then setting convert_to_8_bit will cause the output to be an 8-bit PNG
* gamma encoded according to the sRGB specification, otherwise a 16-bit linear
* encoded PNG file is written.
@@ -3054,13 +3090,103 @@ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
*
* With all APIs row_stride is handled as in the read APIs - it is the spacing
* from one row to the next in component sized units (1 or 2 bytes) and if
- * negative indicates a bottom-up row layout in the buffer. If row_stride is zero,
- * libpng will calculate it for you from the image width and number of channels.
+ * negative indicates a bottom-up row layout in the buffer. If row_stride is
+ * zero, libpng will calculate it for you from the image width and number of
+ * channels.
*
- * Note that the write API does not support interlacing, sub-8-bit pixels, indexed
- * PNG (color_type 3) or most ancillary chunks.
+ * Note that the write API does not support interlacing, sub-8-bit pixels or
+ * most ancillary chunks. If you need to write text chunks (e.g. for copyright
+ * notices) you need to use one of the other APIs.
*/
-#endif /* STDIO */
+
+PNG_EXPORT(245, int, png_image_write_to_memory, (png_imagep image, void *memory,
+ png_alloc_size_t * PNG_RESTRICT memory_bytes, int convert_to_8_bit,
+ const void *buffer, png_int_32 row_stride, const void *colormap));
+ /* Write the image to the given memory buffer. The function both writes the
+ * whole PNG data stream to *memory and updates *memory_bytes with the count
+ * of bytes written.
+ *
+ * 'memory' may be NULL. In this case *memory_bytes is not read however on
+ * success the number of bytes which would have been written will still be
+ * stored in *memory_bytes. On failure *memory_bytes will contain 0.
+ *
+ * If 'memory' is not NULL it must point to memory[*memory_bytes] of
+ * writeable memory.
+ *
+ * If the function returns success memory[*memory_bytes] (if 'memory' is not
+ * NULL) contains the written PNG data. *memory_bytes will always be less
+ * than or equal to the original value.
+ *
+ * If the function returns false and *memory_bytes was not changed an error
+ * occured during write. If *memory_bytes was changed, or is not 0 if
+ * 'memory' was NULL, the write would have succeeded but for the memory
+ * buffer being too small. *memory_bytes contains the required number of
+ * bytes and will be bigger that the original value.
+ */
+
+#define png_image_write_get_memory_size(image, size, convert_to_8_bit, buffer,\
+ row_stride, colormap)\
+ png_image_write_to_memory(&(image), 0, &(size), convert_to_8_bit, buffer,\
+ row_stride, colormap)
+ /* Return the amount of memory in 'size' required to compress this image.
+ * The png_image structure 'image' must be filled in as in the above
+ * function and must not be changed before the actual write call, the buffer
+ * and all other parameters must also be identical to that in the final
+ * write call. The 'size' variable need not be initialized.
+ *
+ * NOTE: the macro returns true/false, if false is returned 'size' will be
+ * set to zero and the write failed and probably will fail if tried again.
+ */
+
+/* You can pre-allocate the buffer by making sure it is of sufficient size
+ * regardless of the amount of compression achieved. The buffer size will
+ * always be bigger than the original image and it will never be filled. The
+ * following macros are provided to assist in allocating the buffer.
+ */
+#define PNG_IMAGE_DATA_SIZE(image) (PNG_IMAGE_SIZE(image)+(image).height)
+ /* The number of uncompressed bytes in the PNG byte encoding of the image;
+ * uncompressing the PNG IDAT data will give this number of bytes.
+ *
+ * NOTE: while PNG_IMAGE_SIZE cannot overflow for an image in memory this
+ * macro can because of the extra bytes used in the PNG byte encoding. You
+ * need to avoid this macro if your image size approaches 2^30 in width or
+ * height. The same goes for the remainder of these macros; they all produce
+ * bigger numbers than the actual in-memory image size.
+ */
+#ifndef PNG_ZLIB_MAX_SIZE
+# define PNG_ZLIB_MAX_SIZE(b) ((b)+(((b)+7U)>>3)+(((b)+63U)>>6)+11U)
+ /* An upper bound on the number of compressed bytes given 'b' uncompressed
+ * bytes. This is based on deflateBounds() in zlib; different
+ * implementations of zlib compression may conceivably produce more data so
+ * if your zlib implementation is not zlib itself redefine this macro
+ * appropriately.
+ */
+#endif
+
+#define PNG_IMAGE_COMPRESSED_SIZE_MAX(image)\
+ PNG_ZLIB_MAX_SIZE((png_alloc_size_t)PNG_IMAGE_DATA_SIZE(image))
+ /* An upper bound on the size of the data in the PNG IDAT chunks. */
+
+#define PNG_IMAGE_PNG_SIZE_MAX_(image, image_size)\
+ ((8U/*sig*/+25U/*IHDR*/+16U/*gAMA*/+44U/*cHRM*/+12U/*IEND*/+\
+ (((image).format&PNG_FORMAT_FLAG_COLORMAP)?/*colormap: PLTE, tRNS*/\
+ 12U+3U*(image).colormap_entries/*PLTE data*/+\
+ (((image).format&PNG_FORMAT_FLAG_ALPHA)?\
+ 12U/*tRNS*/+(image).colormap_entries:0U):0U)+\
+ 12U)+(12U*((image_size)/PNG_ZBUF_SIZE))/*IDAT*/+(image_size))
+ /* A helper for the following macro; if your compiler cannot handle the
+ * following macro use this one with the result of
+ * PNG_IMAGE_COMPRESSED_SIZE_MAX(image) as the second argument (most
+ * compilers should handle this just fine.)
+ */
+
+#define PNG_IMAGE_PNG_SIZE_MAX(image)\
+ PNG_IMAGE_PNG_SIZE_MAX_(image, PNG_IMAGE_COMPRESSED_SIZE_MAX(image))
+ /* An upper bound on the total length of the PNG data stream for 'image'.
+ * The result is of type png_alloc_size_t, on 32-bit systems this may
+ * overflow even though PNG_IMAGE_DATA_SIZE does not overflow; the write will
+ * run out of buffer space but return a corrected size which should work.
+ */
#endif /* SIMPLIFIED_WRITE */
/*******************************************************************************
* END OF SIMPLIFIED API
@@ -3094,7 +3220,11 @@ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
#endif
#define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */
#define PNG_SKIP_sRGB_CHECK_PROFILE 4 /* SOFTWARE: Check ICC profile for sRGB */
-#define PNG_OPTION_NEXT 6 /* Next option - numbers must be even */
+#ifdef PNG_MIPS_MSA_API_SUPPORTED
+# define PNG_MIPS_MSA 6 /* HARDWARE: MIPS Msa SIMD instructions supported */
+#endif
+#define PNG_IGNORE_ADLER32 8
+#define PNG_OPTION_NEXT 10 /* Next option - numbers must be even */
/* Return values: NOTE: there are four values and 'off' is *not* zero */
#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
@@ -3118,7 +3248,7 @@ PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
* one to use is one more than this.)
*/
#ifdef PNG_EXPORT_LAST_ORDINAL
- PNG_EXPORT_LAST_ORDINAL(244);
+ PNG_EXPORT_LAST_ORDINAL(245);
#endif
#ifdef __cplusplus
diff --git a/src/3rdparty/libpng/pngconf.h b/src/3rdparty/libpng/pngconf.h
index 92f250000c..5e8b40bcfb 100644
--- a/src/3rdparty/libpng/pngconf.h
+++ b/src/3rdparty/libpng/pngconf.h
@@ -1,9 +1,9 @@
/* pngconf.h - machine configurable file for libpng
*
- * libpng version 1.6.20, December 3, 2015
+ * libpng version 1.6.28, January 5, 2017
*
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -188,27 +188,27 @@
* compatible with GCC or Visual C because of different calling conventions.
*/
# if PNG_API_RULE == 2
- /* If this line results in an error, either because __watcall is not
- * understood or because of a redefine just below you cannot use *this*
- * build of the library with the compiler you are using. *This* build was
- * build using Watcom and applications must also be built using Watcom!
- */
+ /* If this line results in an error, either because __watcall is not
+ * understood or because of a redefine just below you cannot use *this*
+ * build of the library with the compiler you are using. *This* build was
+ * build using Watcom and applications must also be built using Watcom!
+ */
# define PNGCAPI __watcall
# endif
# if defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 800))
# define PNGCAPI __cdecl
# if PNG_API_RULE == 1
- /* If this line results in an error __stdcall is not understood and
- * PNG_API_RULE should not have been set to '1'.
- */
+ /* If this line results in an error __stdcall is not understood and
+ * PNG_API_RULE should not have been set to '1'.
+ */
# define PNGAPI __stdcall
# endif
# else
- /* An older compiler, or one not detected (erroneously) above,
- * if necessary override on the command line to get the correct
- * variants for the compiler.
- */
+ /* An older compiler, or one not detected (erroneously) above,
+ * if necessary override on the command line to get the correct
+ * variants for the compiler.
+ */
# ifndef PNGCAPI
# define PNGCAPI _cdecl
# endif
@@ -225,10 +225,10 @@
# if (defined(_MSC_VER) && _MSC_VER < 800) ||\
(defined(__BORLANDC__) && __BORLANDC__ < 0x500)
- /* older Borland and MSC
- * compilers used '__export' and required this to be after
- * the type.
- */
+ /* older Borland and MSC
+ * compilers used '__export' and required this to be after
+ * the type.
+ */
# ifndef PNG_EXPORT_TYPE
# define PNG_EXPORT_TYPE(type) type PNG_IMPEXP
# endif
@@ -244,9 +244,9 @@
# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
# define PNGAPI _System
# else /* !Windows/x86 && !OS/2 */
- /* Use the defaults, or define PNG*API on the command line (but
- * this will have to be done for every compile!)
- */
+ /* Use the defaults, or define PNG*API on the command line (but
+ * this will have to be done for every compile!)
+ */
# endif /* other system, !OS/2 */
#endif /* !Windows/x86 */
@@ -267,7 +267,7 @@
*/
#ifndef PNG_IMPEXP
# if defined(PNG_USE_DLL) && defined(PNG_DLL_IMPORT)
- /* This forces use of a DLL, disallowing static linking */
+ /* This forces use of a DLL, disallowing static linking */
# define PNG_IMPEXP PNG_DLL_IMPORT
# endif
@@ -340,7 +340,7 @@
* less efficient code.
*/
# if defined(__clang__) && defined(__has_attribute)
- /* Clang defines both __clang__ and __GNUC__. Check __clang__ first. */
+ /* Clang defines both __clang__ and __GNUC__. Check __clang__ first. */
# if !defined(PNG_USE_RESULT) && __has_attribute(__warn_unused_result__)
# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
# endif
@@ -507,9 +507,9 @@
# error "libpng requires a signed 32-bit (or more) type"
#endif
-#if UINT_MAX > 4294967294
+#if UINT_MAX > 4294967294U
typedef unsigned int png_uint_32;
-#elif ULONG_MAX > 4294967294
+#elif ULONG_MAX > 4294967294U
typedef unsigned long int png_uint_32;
#else
# error "libpng requires an unsigned 32-bit (or more) type"
diff --git a/src/3rdparty/libpng/pngdebug.h b/src/3rdparty/libpng/pngdebug.h
index 6a01b106ed..15a7ed0c95 100644
--- a/src/3rdparty/libpng/pngdebug.h
+++ b/src/3rdparty/libpng/pngdebug.h
@@ -2,7 +2,7 @@
/* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
*
* Last changed in libpng 1.6.8 [December 19, 2013]
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
diff --git a/src/3rdparty/libpng/pngerror.c b/src/3rdparty/libpng/pngerror.c
index bdb959ee51..00d76f7c05 100644
--- a/src/3rdparty/libpng/pngerror.c
+++ b/src/3rdparty/libpng/pngerror.c
@@ -1,8 +1,8 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.26 [October 20, 2016]
+ * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -26,7 +26,7 @@ static PNG_FUNCTION(void, png_default_error,PNGARG((png_const_structrp png_ptr,
#ifdef PNG_WARNINGS_SUPPORTED
static void /* PRIVATE */
png_default_warning PNGARG((png_const_structrp png_ptr,
- png_const_charp warning_message));
+ png_const_charp warning_message));
#endif /* WARNINGS */
/* This function is called whenever there is a fatal error. This function
@@ -37,14 +37,14 @@ png_default_warning PNGARG((png_const_structrp png_ptr,
#ifdef PNG_ERROR_TEXT_SUPPORTED
PNG_FUNCTION(void,PNGAPI
png_error,(png_const_structrp png_ptr, png_const_charp error_message),
- PNG_NORETURN)
+ PNG_NORETURN)
{
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
char msg[16];
if (png_ptr != NULL)
{
if ((png_ptr->flags &
- (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0
+ (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0)
{
if (*error_message == PNG_LITERAL_SHARP)
{
@@ -65,18 +65,18 @@ png_error,(png_const_structrp png_ptr, png_const_charp error_message),
else
error_message += offset;
- }
+ }
- else
- {
- if ((png_ptr->flags & PNG_FLAG_STRIP_ERROR_TEXT) != 0)
+ else
{
- msg[0] = '0';
- msg[1] = '\0';
- error_message = msg;
+ if ((png_ptr->flags & PNG_FLAG_STRIP_ERROR_TEXT) != 0)
+ {
+ msg[0] = '0';
+ msg[1] = '\0';
+ error_message = msg;
+ }
}
- }
- }
+ }
}
#endif
if (png_ptr != NULL && png_ptr->error_fn != NULL)
@@ -110,7 +110,7 @@ png_err,(png_const_structrp png_ptr),PNG_NORETURN)
*/
size_t
png_safecat(png_charp buffer, size_t bufsize, size_t pos,
- png_const_charp string)
+ png_const_charp string)
{
if (buffer != NULL && pos < bufsize)
{
@@ -131,7 +131,7 @@ png_safecat(png_charp buffer, size_t bufsize, size_t pos,
*/
png_charp
png_format_number(png_const_charp start, png_charp end, int format,
- png_alloc_size_t number)
+ png_alloc_size_t number)
{
int count = 0; /* number of digits output */
int mincount = 1; /* minimum number required */
@@ -233,7 +233,7 @@ png_warning(png_const_structrp png_ptr, png_const_charp warning_message)
}
if (png_ptr != NULL && png_ptr->warning_fn != NULL)
(*(png_ptr->warning_fn))(png_constcast(png_structrp,png_ptr),
- warning_message + offset);
+ warning_message + offset);
else
png_default_warning(png_ptr, warning_message + offset);
}
@@ -245,7 +245,7 @@ png_warning(png_const_structrp png_ptr, png_const_charp warning_message)
*/
void
png_warning_parameter(png_warning_parameters p, int number,
- png_const_charp string)
+ png_const_charp string)
{
if (number > 0 && number <= PNG_WARNING_PARAMETER_COUNT)
(void)png_safecat(p[number-1], (sizeof p[number-1]), 0, string);
@@ -253,7 +253,7 @@ png_warning_parameter(png_warning_parameters p, int number,
void
png_warning_parameter_unsigned(png_warning_parameters p, int number, int format,
- png_alloc_size_t value)
+ png_alloc_size_t value)
{
char buffer[PNG_NUMBER_BUFFER_SIZE];
png_warning_parameter(p, number, PNG_FORMAT_NUMBER(buffer, format, value));
@@ -261,7 +261,7 @@ png_warning_parameter_unsigned(png_warning_parameters p, int number, int format,
void
png_warning_parameter_signed(png_warning_parameters p, int number, int format,
- png_int_32 value)
+ png_int_32 value)
{
png_alloc_size_t u;
png_charp str;
@@ -282,7 +282,7 @@ png_warning_parameter_signed(png_warning_parameters p, int number, int format,
void
png_formatted_warning(png_const_structrp png_ptr, png_warning_parameters p,
- png_const_charp message)
+ png_const_charp message)
{
/* The internal buffer is just 192 bytes - enough for all our messages,
* overflow doesn't happen because this code checks! If someone figures
@@ -391,10 +391,10 @@ png_benign_error(png_const_structrp png_ptr, png_const_charp error_message)
void /* PRIVATE */
png_app_warning(png_const_structrp png_ptr, png_const_charp error_message)
{
- if ((png_ptr->flags & PNG_FLAG_APP_WARNINGS_WARN) != 0)
- png_warning(png_ptr, error_message);
- else
- png_error(png_ptr, error_message);
+ if ((png_ptr->flags & PNG_FLAG_APP_WARNINGS_WARN) != 0)
+ png_warning(png_ptr, error_message);
+ else
+ png_error(png_ptr, error_message);
# ifndef PNG_ERROR_TEXT_SUPPORTED
PNG_UNUSED(error_message)
@@ -404,10 +404,10 @@ png_app_warning(png_const_structrp png_ptr, png_const_charp error_message)
void /* PRIVATE */
png_app_error(png_const_structrp png_ptr, png_const_charp error_message)
{
- if ((png_ptr->flags & PNG_FLAG_APP_ERRORS_WARN) != 0)
- png_warning(png_ptr, error_message);
- else
- png_error(png_ptr, error_message);
+ if ((png_ptr->flags & PNG_FLAG_APP_ERRORS_WARN) != 0)
+ png_warning(png_ptr, error_message);
+ else
+ png_error(png_ptr, error_message);
# ifndef PNG_ERROR_TEXT_SUPPORTED
PNG_UNUSED(error_message)
@@ -478,7 +478,7 @@ png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
#if defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
PNG_FUNCTION(void,PNGAPI
png_chunk_error,(png_const_structrp png_ptr, png_const_charp error_message),
- PNG_NORETURN)
+ PNG_NORETURN)
{
char msg[18+PNG_MAX_ERROR_TEXT];
if (png_ptr == NULL)
@@ -573,7 +573,7 @@ png_fixed_error,(png_const_structrp png_ptr, png_const_charp name),PNG_NORETURN)
{
# define fixed_message "fixed point overflow in "
# define fixed_message_ln ((sizeof fixed_message)-1)
- int iin;
+ unsigned int iin;
char msg[fixed_message_ln+PNG_MAX_ERROR_TEXT];
memcpy(msg, fixed_message, fixed_message_ln);
iin = 0;
@@ -620,7 +620,7 @@ png_set_longjmp_fn(png_structrp png_ptr, png_longjmp_ptr longjmp_fn,
else
{
png_ptr->jmp_buf_ptr = png_voidcast(jmp_buf *,
- png_malloc_warn(png_ptr, jmp_buf_size));
+ png_malloc_warn(png_ptr, jmp_buf_size));
if (png_ptr->jmp_buf_ptr == NULL)
return NULL; /* new NULL return on OOM */
@@ -709,7 +709,7 @@ png_free_jmpbuf(png_structrp png_ptr)
*/
static PNG_FUNCTION(void /* PRIVATE */,
png_default_error,(png_const_structrp png_ptr, png_const_charp error_message),
- PNG_NORETURN)
+ PNG_NORETURN)
{
#ifdef PNG_CONSOLE_IO_SUPPORTED
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
@@ -883,7 +883,7 @@ png_set_strip_error_numbers(png_structrp png_ptr, png_uint_32 strip_mode)
*/
PNG_FUNCTION(void /* PRIVATE */, (PNGCBAPI
png_safe_error),(png_structp png_nonconst_ptr, png_const_charp error_message),
- PNG_NORETURN)
+ PNG_NORETURN)
{
const png_const_structrp png_ptr = png_nonconst_ptr;
png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr);
@@ -906,7 +906,7 @@ png_safe_error),(png_structp png_nonconst_ptr, png_const_charp error_message),
/* Missing longjmp buffer, the following is to help debugging: */
{
size_t pos = png_safecat(image->message, (sizeof image->message), 0,
- "bad longjmp: ");
+ "bad longjmp: ");
png_safecat(image->message, (sizeof image->message), pos,
error_message);
}
diff --git a/src/3rdparty/libpng/pngget.c b/src/3rdparty/libpng/pngget.c
index 743a6a9bbc..141c393330 100644
--- a/src/3rdparty/libpng/pngget.c
+++ b/src/3rdparty/libpng/pngget.c
@@ -1,8 +1,8 @@
/* pngget.c - retrieval of values from info struct
*
- * Last changed in libpng 1.6.17 [March 26, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.26 [October 20, 2016]
+ * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -338,7 +338,7 @@ ppi_from_ppm(png_uint_32 ppm)
png_fixed_point result;
if (ppm <= PNG_UINT_31_MAX && png_muldiv(&result, (png_int_32)ppm, 127,
5000) != 0)
- return result;
+ return (png_uint_32)result;
/* Overflow. */
return 0;
@@ -456,11 +456,11 @@ png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr,
return (retval);
}
#endif /* pHYs */
-#endif /* INCH_CONVERSIONS */
+#endif /* INCH_CONVERSIONS */
/* png_get_channels really belongs in here, too, but it's been around longer */
-#endif /* EASY_ACCESS */
+#endif /* EASY_ACCESS */
png_byte PNGAPI
@@ -486,7 +486,7 @@ png_get_signature(png_const_structrp png_ptr, png_const_inforp info_ptr)
#ifdef PNG_bKGD_SUPPORTED
png_uint_32 PNGAPI
png_get_bKGD(png_const_structrp png_ptr, png_inforp info_ptr,
- png_color_16p *background)
+ png_color_16p *background)
{
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_bKGD) != 0 &&
@@ -526,28 +526,28 @@ png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr,
if (white_x != NULL)
*white_x = png_float(png_ptr,
- info_ptr->colorspace.end_points_xy.whitex, "cHRM white X");
+ info_ptr->colorspace.end_points_xy.whitex, "cHRM white X");
if (white_y != NULL)
*white_y = png_float(png_ptr,
- info_ptr->colorspace.end_points_xy.whitey, "cHRM white Y");
+ info_ptr->colorspace.end_points_xy.whitey, "cHRM white Y");
if (red_x != NULL)
*red_x = png_float(png_ptr, info_ptr->colorspace.end_points_xy.redx,
- "cHRM red X");
+ "cHRM red X");
if (red_y != NULL)
*red_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.redy,
- "cHRM red Y");
+ "cHRM red Y");
if (green_x != NULL)
*green_x = png_float(png_ptr,
- info_ptr->colorspace.end_points_xy.greenx, "cHRM green X");
+ info_ptr->colorspace.end_points_xy.greenx, "cHRM green X");
if (green_y != NULL)
*green_y = png_float(png_ptr,
- info_ptr->colorspace.end_points_xy.greeny, "cHRM green Y");
+ info_ptr->colorspace.end_points_xy.greeny, "cHRM green Y");
if (blue_x != NULL)
*blue_x = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluex,
- "cHRM blue X");
+ "cHRM blue X");
if (blue_y != NULL)
*blue_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluey,
- "cHRM blue Y");
+ "cHRM blue Y");
return (PNG_INFO_cHRM);
}
@@ -556,42 +556,42 @@ png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_uint_32 PNGAPI
png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr,
- double *red_X, double *red_Y, double *red_Z, double *green_X,
- double *green_Y, double *green_Z, double *blue_X, double *blue_Y,
- double *blue_Z)
+ double *red_X, double *red_Y, double *red_Z, double *green_X,
+ double *green_Y, double *green_Z, double *blue_X, double *blue_Y,
+ double *blue_Z)
{
if (png_ptr != NULL && info_ptr != NULL &&
- (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
+ (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
{
png_debug1(1, "in %s retrieval function", "cHRM_XYZ(float)");
if (red_X != NULL)
*red_X = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_X,
- "cHRM red X");
+ "cHRM red X");
if (red_Y != NULL)
*red_Y = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_Y,
- "cHRM red Y");
+ "cHRM red Y");
if (red_Z != NULL)
*red_Z = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_Z,
- "cHRM red Z");
+ "cHRM red Z");
if (green_X != NULL)
*green_X = png_float(png_ptr,
- info_ptr->colorspace.end_points_XYZ.green_X, "cHRM green X");
+ info_ptr->colorspace.end_points_XYZ.green_X, "cHRM green X");
if (green_Y != NULL)
*green_Y = png_float(png_ptr,
- info_ptr->colorspace.end_points_XYZ.green_Y, "cHRM green Y");
+ info_ptr->colorspace.end_points_XYZ.green_Y, "cHRM green Y");
if (green_Z != NULL)
*green_Z = png_float(png_ptr,
- info_ptr->colorspace.end_points_XYZ.green_Z, "cHRM green Z");
+ info_ptr->colorspace.end_points_XYZ.green_Z, "cHRM green Z");
if (blue_X != NULL)
*blue_X = png_float(png_ptr,
- info_ptr->colorspace.end_points_XYZ.blue_X, "cHRM blue X");
+ info_ptr->colorspace.end_points_XYZ.blue_X, "cHRM blue X");
if (blue_Y != NULL)
*blue_Y = png_float(png_ptr,
- info_ptr->colorspace.end_points_XYZ.blue_Y, "cHRM blue Y");
+ info_ptr->colorspace.end_points_XYZ.blue_Y, "cHRM blue Y");
if (blue_Z != NULL)
*blue_Z = png_float(png_ptr,
- info_ptr->colorspace.end_points_XYZ.blue_Z, "cHRM blue Z");
+ info_ptr->colorspace.end_points_XYZ.blue_Z, "cHRM blue Z");
return (PNG_INFO_cHRM);
}
@@ -681,8 +681,8 @@ png_get_gAMA_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_debug1(1, "in %s retrieval function", "gAMA");
if (png_ptr != NULL && info_ptr != NULL &&
- (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 &&
- file_gamma != NULL)
+ (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 &&
+ file_gamma != NULL)
{
*file_gamma = info_ptr->colorspace.gamma;
return (PNG_INFO_gAMA);
@@ -704,7 +704,7 @@ png_get_gAMA(png_const_structrp png_ptr, png_const_inforp info_ptr,
file_gamma != NULL)
{
*file_gamma = png_float(png_ptr, info_ptr->colorspace.gamma,
- "png_get_gAMA");
+ "png_get_gAMA");
return (PNG_INFO_gAMA);
}
@@ -901,7 +901,7 @@ png_get_sCAL_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
*/
*width = png_fixed(png_ptr, atof(info_ptr->scal_s_width), "sCAL width");
*height = png_fixed(png_ptr, atof(info_ptr->scal_s_height),
- "sCAL height");
+ "sCAL height");
return (PNG_INFO_sCAL);
}
@@ -1142,19 +1142,19 @@ png_get_compression_buffer_size(png_const_structrp png_ptr)
return 0;
#ifdef PNG_WRITE_SUPPORTED
- if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
+ if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
#endif
{
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
- return png_ptr->IDAT_read_size;
+ return png_ptr->IDAT_read_size;
#else
- return PNG_IDAT_READ_SIZE;
+ return PNG_IDAT_READ_SIZE;
#endif
}
#ifdef PNG_WRITE_SUPPORTED
- else
- return png_ptr->zbuffer_size;
+ else
+ return png_ptr->zbuffer_size;
#endif
}
diff --git a/src/3rdparty/libpng/pnginfo.h b/src/3rdparty/libpng/pnginfo.h
index 4bd264b869..361ed8be70 100644
--- a/src/3rdparty/libpng/pnginfo.h
+++ b/src/3rdparty/libpng/pnginfo.h
@@ -2,7 +2,7 @@
/* pnginfo.h - header file for PNG reference library
*
* Last changed in libpng 1.6.1 [March 28, 2013]
- * Copyright (c) 1998-2013 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
diff --git a/src/3rdparty/libpng/pngmem.c b/src/3rdparty/libpng/pngmem.c
index 45ac5579b2..ff3ef7e88c 100644
--- a/src/3rdparty/libpng/pngmem.c
+++ b/src/3rdparty/libpng/pngmem.c
@@ -1,8 +1,8 @@
/* pngmem.c - stub functions for memory allocation
*
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.26 [October 20, 2016]
+ * Copyright (c) 1998-2002,2004,2006-2014,2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -66,7 +66,7 @@ png_calloc,(png_const_structrp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
*/
PNG_FUNCTION(png_voidp /* PRIVATE */,
png_malloc_base,(png_const_structrp png_ptr, png_alloc_size_t size),
- PNG_ALLOCATED)
+ PNG_ALLOCATED)
{
/* Moved to png_malloc_base from png_malloc_default in 1.6.0; the DOS
* allocators have also been removed in 1.6.0, so any 16-bit system now has
@@ -107,9 +107,9 @@ png_malloc_base,(png_const_structrp png_ptr, png_alloc_size_t size),
*/
static png_voidp
png_malloc_array_checked(png_const_structrp png_ptr, int nelements,
- size_t element_size)
+ size_t element_size)
{
- png_alloc_size_t req = nelements; /* known to be > 0 */
+ png_alloc_size_t req = (png_alloc_size_t)nelements; /* known to be > 0 */
if (req <= PNG_SIZE_MAX/element_size)
return png_malloc_base(png_ptr, req * element_size);
@@ -120,7 +120,7 @@ png_malloc_array_checked(png_const_structrp png_ptr, int nelements,
PNG_FUNCTION(png_voidp /* PRIVATE */,
png_malloc_array,(png_const_structrp png_ptr, int nelements,
- size_t element_size),PNG_ALLOCATED)
+ size_t element_size),PNG_ALLOCATED)
{
if (nelements <= 0 || element_size == 0)
png_error(png_ptr, "internal error: array alloc");
@@ -130,7 +130,7 @@ png_malloc_array,(png_const_structrp png_ptr, int nelements,
PNG_FUNCTION(png_voidp /* PRIVATE */,
png_realloc_array,(png_const_structrp png_ptr, png_const_voidp old_array,
- int old_elements, int add_elements, size_t element_size),PNG_ALLOCATED)
+ int old_elements, int add_elements, size_t element_size),PNG_ALLOCATED)
{
/* These are internal errors: */
if (add_elements <= 0 || element_size == 0 || old_elements < 0 ||
@@ -143,7 +143,7 @@ png_realloc_array,(png_const_structrp png_ptr, png_const_voidp old_array,
if (add_elements <= INT_MAX - old_elements)
{
png_voidp new_array = png_malloc_array_checked(png_ptr,
- old_elements+add_elements, element_size);
+ old_elements+add_elements, element_size);
if (new_array != NULL)
{
@@ -154,7 +154,7 @@ png_realloc_array,(png_const_structrp png_ptr, png_const_voidp old_array,
memcpy(new_array, old_array, element_size*(unsigned)old_elements);
memset((char*)new_array + element_size*(unsigned)old_elements, 0,
- element_size*(unsigned)add_elements);
+ element_size*(unsigned)add_elements);
return new_array;
}
@@ -187,7 +187,7 @@ png_malloc,(png_const_structrp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
#ifdef PNG_USER_MEM_SUPPORTED
PNG_FUNCTION(png_voidp,PNGAPI
png_malloc_default,(png_const_structrp png_ptr, png_alloc_size_t size),
- PNG_ALLOCATED PNG_DEPRECATED)
+ PNG_ALLOCATED PNG_DEPRECATED)
{
png_voidp ret;
@@ -210,7 +210,7 @@ png_malloc_default,(png_const_structrp png_ptr, png_alloc_size_t size),
*/
PNG_FUNCTION(png_voidp,PNGAPI
png_malloc_warn,(png_const_structrp png_ptr, png_alloc_size_t size),
- PNG_ALLOCATED)
+ PNG_ALLOCATED)
{
if (png_ptr != NULL)
{
diff --git a/src/3rdparty/libpng/pngpread.c b/src/3rdparty/libpng/pngpread.c
index 89ffc4018f..650ba1e232 100644
--- a/src/3rdparty/libpng/pngpread.c
+++ b/src/3rdparty/libpng/pngpread.c
@@ -1,8 +1,8 @@
/* pngpread.c - read a png file in push mode
*
- * Last changed in libpng 1.6.18 [July 23, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.24 [August 4, 2016]
+ * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -77,11 +77,11 @@ png_process_data_pause(png_structrp png_ptr, int save)
png_uint_32 PNGAPI
png_process_data_skip(png_structrp png_ptr)
{
- /* TODO: Deprecate and remove this API.
- * Somewhere the implementation of this seems to have been lost,
- * or abandoned. It was only to support some internal back-door access
- * to png_struct) in libpng-1.4.x.
- */
+/* TODO: Deprecate and remove this API.
+ * Somewhere the implementation of this seems to have been lost,
+ * or abandoned. It was only to support some internal back-door access
+ * to png_struct) in libpng-1.4.x.
+ */
png_app_warning(png_ptr,
"png_process_data_skip is not implemented in any current version of libpng");
return 0;
@@ -210,12 +210,14 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
(png_ptr->mode & PNG_HAVE_PLTE) == 0)
png_error(png_ptr, "Missing PLTE before IDAT");
- png_ptr->mode |= PNG_HAVE_IDAT;
png_ptr->process_mode = PNG_READ_IDAT_MODE;
- if ((png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) == 0)
- if (png_ptr->push_length == 0)
- return;
+ if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
+ if ((png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) == 0)
+ if (png_ptr->push_length == 0)
+ return;
+
+ png_ptr->mode |= PNG_HAVE_IDAT;
if ((png_ptr->mode & PNG_AFTER_IDAT) != 0)
png_benign_error(png_ptr, "Too many IDATs found");
@@ -408,7 +410,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
{
PNG_PUSH_SAVE_BUFFER_IF_FULL
png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length,
- PNG_HANDLE_CHUNK_AS_DEFAULT);
+ PNG_HANDLE_CHUNK_AS_DEFAULT);
}
png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
@@ -499,7 +501,10 @@ png_push_save_buffer(png_structrp png_ptr)
png_error(png_ptr, "Insufficient memory for save_buffer");
}
- memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
+ if (old_buffer)
+ memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
+ else if (png_ptr->save_buffer_size)
+ png_error(png_ptr, "save_buffer error");
png_free(png_ptr, old_buffer);
png_ptr->save_buffer_max = new_max;
}
@@ -516,7 +521,7 @@ png_push_save_buffer(png_structrp png_ptr)
void /* PRIVATE */
png_push_restore_buffer(png_structrp png_ptr, png_bytep buffer,
- png_size_t buffer_length)
+ png_size_t buffer_length)
{
png_ptr->current_buffer = buffer;
png_ptr->current_buffer_size = buffer_length;
@@ -619,7 +624,7 @@ png_push_read_IDAT(png_structrp png_ptr)
void /* PRIVATE */
png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer,
- png_size_t buffer_length)
+ png_size_t buffer_length)
{
/* The caller checks for a non-zero buffer length. */
if (!(buffer_length > 0) || buffer == NULL)
@@ -679,7 +684,12 @@ png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer,
png_warning(png_ptr, "Truncated compressed data in IDAT");
else
- png_error(png_ptr, "Decompression error in IDAT");
+ {
+ if (ret == Z_DATA_ERROR)
+ png_benign_error(png_ptr, "IDAT: ADLER32 checksum mismatch");
+ else
+ png_error(png_ptr, "Decompression error in IDAT");
+ }
/* Skip the check on unprocessed input */
return;
@@ -777,7 +787,7 @@ png_push_process_row(png_structrp png_ptr)
{
if (png_ptr->pass < 6)
png_do_read_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass,
- png_ptr->transformations);
+ png_ptr->transformations);
switch (png_ptr->pass)
{
@@ -1039,7 +1049,7 @@ png_push_have_row(png_structrp png_ptr, png_bytep row)
{
if (png_ptr->row_fn != NULL)
(*(png_ptr->row_fn))(png_ptr, row, png_ptr->row_number,
- (int)png_ptr->pass);
+ (int)png_ptr->pass);
}
#ifdef PNG_READ_INTERLACING_SUPPORTED
diff --git a/src/3rdparty/libpng/pngpriv.h b/src/3rdparty/libpng/pngpriv.h
index c06deee68d..0a12fb67bd 100644
--- a/src/3rdparty/libpng/pngpriv.h
+++ b/src/3rdparty/libpng/pngpriv.h
@@ -1,8 +1,8 @@
/* pngpriv.h - private declarations for use inside libpng
*
- * Last changed in libpng 1.6.18 [July 23, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.26 [October 20, 2016]
+ * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -188,6 +188,35 @@
# endif
#endif /* PNG_ARM_NEON_OPT > 0 */
+#ifndef PNG_MIPS_MSA_OPT
+# if defined(__mips_msa) && (__mips_isa_rev >= 5) && defined(PNG_ALIGNED_MEMORY_SUPPORTED)
+# define PNG_MIPS_MSA_OPT 2
+# else
+# define PNG_MIPS_MSA_OPT 0
+# endif
+#endif
+
+#if PNG_MIPS_MSA_OPT > 0
+# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_msa
+# ifndef PNG_MIPS_MSA_IMPLEMENTATION
+# if defined(__mips_msa)
+# if defined(__clang__)
+# elif defined(__GNUC__)
+# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)
+# define PNG_MIPS_MSA_IMPLEMENTATION 2
+# endif /* no GNUC support */
+# endif /* __GNUC__ */
+# else /* !defined __mips_msa */
+# define PNG_MIPS_MSA_IMPLEMENTATION 2
+# endif /* __mips_msa */
+# endif /* !PNG_MIPS_MSA_IMPLEMENTATION */
+
+# ifndef PNG_MIPS_MSA_IMPLEMENTATION
+# define PNG_MIPS_MSA_IMPLEMENTATION 1
+# endif
+#endif /* PNG_MIPS_MSA_OPT > 0 */
+
+
/* Is this a build of a DLL where compilation of the object modules requires
* different preprocessor settings to those required for a simple library? If
* so PNG_BUILD_DLL must be set.
@@ -431,10 +460,10 @@
# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
- /* We need to check that <math.h> hasn't already been included earlier
- * as it seems it doesn't agree with <fp.h>, yet we should really use
- * <fp.h> if possible.
- */
+ /* We need to check that <math.h> hasn't already been included earlier
+ * as it seems it doesn't agree with <fp.h>, yet we should really use
+ * <fp.h> if possible.
+ */
# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
# include <fp.h>
# endif
@@ -442,9 +471,9 @@
# include <math.h>
# endif
# if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
- /* Amiga SAS/C: We must include builtin FPU functions when compiling using
- * MATH=68881
- */
+ /* Amiga SAS/C: We must include builtin FPU functions when compiling using
+ * MATH=68881
+ */
# include <m68881.h>
# endif
#endif
@@ -518,7 +547,8 @@
/* This implicitly assumes alignment is always to a power of 2. */
#ifdef png_alignof
# define png_isaligned(ptr, type)\
- ((((const char*)ptr-(const char*)0) & (png_alignof(type)-1)) == 0)
+ (((type)((const char*)ptr-(const char*)0) & \
+ (type)(png_alignof(type)-1)) == 0)
#else
# define png_isaligned(ptr, type) 0
#endif
@@ -535,92 +565,92 @@
* are defined in png.h because they need to be visible to applications
* that call png_set_unknown_chunk().
*/
-/* #define PNG_HAVE_IHDR 0x01 (defined in png.h) */
-/* #define PNG_HAVE_PLTE 0x02 (defined in png.h) */
-#define PNG_HAVE_IDAT 0x04
-/* #define PNG_AFTER_IDAT 0x08 (defined in png.h) */
-#define PNG_HAVE_IEND 0x10
- /* 0x20 (unused) */
- /* 0x40 (unused) */
- /* 0x80 (unused) */
-#define PNG_HAVE_CHUNK_HEADER 0x100
-#define PNG_WROTE_tIME 0x200
-#define PNG_WROTE_INFO_BEFORE_PLTE 0x400
-#define PNG_BACKGROUND_IS_GRAY 0x800
-#define PNG_HAVE_PNG_SIGNATURE 0x1000
-#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */
- /* 0x4000 (unused) */
-#define PNG_IS_READ_STRUCT 0x8000 /* Else is a write struct */
+/* #define PNG_HAVE_IHDR 0x01U (defined in png.h) */
+/* #define PNG_HAVE_PLTE 0x02U (defined in png.h) */
+#define PNG_HAVE_IDAT 0x04U
+/* #define PNG_AFTER_IDAT 0x08U (defined in png.h) */
+#define PNG_HAVE_IEND 0x10U
+ /* 0x20U (unused) */
+ /* 0x40U (unused) */
+ /* 0x80U (unused) */
+#define PNG_HAVE_CHUNK_HEADER 0x100U
+#define PNG_WROTE_tIME 0x200U
+#define PNG_WROTE_INFO_BEFORE_PLTE 0x400U
+#define PNG_BACKGROUND_IS_GRAY 0x800U
+#define PNG_HAVE_PNG_SIGNATURE 0x1000U
+#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */
+ /* 0x4000U (unused) */
+#define PNG_IS_READ_STRUCT 0x8000U /* Else is a write struct */
/* Flags for the transformations the PNG library does on the image data */
-#define PNG_BGR 0x0001
-#define PNG_INTERLACE 0x0002
-#define PNG_PACK 0x0004
-#define PNG_SHIFT 0x0008
-#define PNG_SWAP_BYTES 0x0010
-#define PNG_INVERT_MONO 0x0020
-#define PNG_QUANTIZE 0x0040
-#define PNG_COMPOSE 0x0080 /* Was PNG_BACKGROUND */
-#define PNG_BACKGROUND_EXPAND 0x0100
-#define PNG_EXPAND_16 0x0200 /* Added to libpng 1.5.2 */
-#define PNG_16_TO_8 0x0400 /* Becomes 'chop' in 1.5.4 */
-#define PNG_RGBA 0x0800
-#define PNG_EXPAND 0x1000
-#define PNG_GAMMA 0x2000
-#define PNG_GRAY_TO_RGB 0x4000
-#define PNG_FILLER 0x8000
-#define PNG_PACKSWAP 0x10000
-#define PNG_SWAP_ALPHA 0x20000
-#define PNG_STRIP_ALPHA 0x40000
-#define PNG_INVERT_ALPHA 0x80000
-#define PNG_USER_TRANSFORM 0x100000
-#define PNG_RGB_TO_GRAY_ERR 0x200000
-#define PNG_RGB_TO_GRAY_WARN 0x400000
-#define PNG_RGB_TO_GRAY 0x600000 /* two bits, RGB_TO_GRAY_ERR|WARN */
-#define PNG_ENCODE_ALPHA 0x800000 /* Added to libpng-1.5.4 */
-#define PNG_ADD_ALPHA 0x1000000 /* Added to libpng-1.2.7 */
-#define PNG_EXPAND_tRNS 0x2000000 /* Added to libpng-1.2.9 */
-#define PNG_SCALE_16_TO_8 0x4000000 /* Added to libpng-1.5.4 */
- /* 0x8000000 unused */
- /* 0x10000000 unused */
- /* 0x20000000 unused */
- /* 0x40000000 unused */
+#define PNG_BGR 0x0001U
+#define PNG_INTERLACE 0x0002U
+#define PNG_PACK 0x0004U
+#define PNG_SHIFT 0x0008U
+#define PNG_SWAP_BYTES 0x0010U
+#define PNG_INVERT_MONO 0x0020U
+#define PNG_QUANTIZE 0x0040U
+#define PNG_COMPOSE 0x0080U /* Was PNG_BACKGROUND */
+#define PNG_BACKGROUND_EXPAND 0x0100U
+#define PNG_EXPAND_16 0x0200U /* Added to libpng 1.5.2 */
+#define PNG_16_TO_8 0x0400U /* Becomes 'chop' in 1.5.4 */
+#define PNG_RGBA 0x0800U
+#define PNG_EXPAND 0x1000U
+#define PNG_GAMMA 0x2000U
+#define PNG_GRAY_TO_RGB 0x4000U
+#define PNG_FILLER 0x8000U
+#define PNG_PACKSWAP 0x10000U
+#define PNG_SWAP_ALPHA 0x20000U
+#define PNG_STRIP_ALPHA 0x40000U
+#define PNG_INVERT_ALPHA 0x80000U
+#define PNG_USER_TRANSFORM 0x100000U
+#define PNG_RGB_TO_GRAY_ERR 0x200000U
+#define PNG_RGB_TO_GRAY_WARN 0x400000U
+#define PNG_RGB_TO_GRAY 0x600000U /* two bits, RGB_TO_GRAY_ERR|WARN */
+#define PNG_ENCODE_ALPHA 0x800000U /* Added to libpng-1.5.4 */
+#define PNG_ADD_ALPHA 0x1000000U /* Added to libpng-1.2.7 */
+#define PNG_EXPAND_tRNS 0x2000000U /* Added to libpng-1.2.9 */
+#define PNG_SCALE_16_TO_8 0x4000000U /* Added to libpng-1.5.4 */
+ /* 0x8000000U unused */
+ /* 0x10000000U unused */
+ /* 0x20000000U unused */
+ /* 0x40000000U unused */
/* Flags for png_create_struct */
-#define PNG_STRUCT_PNG 0x0001
-#define PNG_STRUCT_INFO 0x0002
+#define PNG_STRUCT_PNG 0x0001U
+#define PNG_STRUCT_INFO 0x0002U
/* Flags for the png_ptr->flags rather than declaring a byte for each one */
-#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001
-#define PNG_FLAG_ZSTREAM_INITIALIZED 0x0002 /* Added to libpng-1.6.0 */
- /* 0x0004 unused */
-#define PNG_FLAG_ZSTREAM_ENDED 0x0008 /* Added to libpng-1.6.0 */
- /* 0x0010 unused */
- /* 0x0020 unused */
-#define PNG_FLAG_ROW_INIT 0x0040
-#define PNG_FLAG_FILLER_AFTER 0x0080
-#define PNG_FLAG_CRC_ANCILLARY_USE 0x0100
-#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200
-#define PNG_FLAG_CRC_CRITICAL_USE 0x0400
-#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800
-#define PNG_FLAG_ASSUME_sRGB 0x1000 /* Added to libpng-1.5.4 */
-#define PNG_FLAG_OPTIMIZE_ALPHA 0x2000 /* Added to libpng-1.5.4 */
-#define PNG_FLAG_DETECT_UNINITIALIZED 0x4000 /* Added to libpng-1.5.4 */
-/* #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000 */
-/* #define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000 */
-#define PNG_FLAG_LIBRARY_MISMATCH 0x20000
-#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000
-#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000
-#define PNG_FLAG_BENIGN_ERRORS_WARN 0x100000 /* Added to libpng-1.4.0 */
-#define PNG_FLAG_APP_WARNINGS_WARN 0x200000 /* Added to libpng-1.6.0 */
-#define PNG_FLAG_APP_ERRORS_WARN 0x400000 /* Added to libpng-1.6.0 */
- /* 0x800000 unused */
- /* 0x1000000 unused */
- /* 0x2000000 unused */
- /* 0x4000000 unused */
- /* 0x8000000 unused */
- /* 0x10000000 unused */
- /* 0x20000000 unused */
- /* 0x40000000 unused */
+#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001U
+#define PNG_FLAG_ZSTREAM_INITIALIZED 0x0002U /* Added to libpng-1.6.0 */
+ /* 0x0004U unused */
+#define PNG_FLAG_ZSTREAM_ENDED 0x0008U /* Added to libpng-1.6.0 */
+ /* 0x0010U unused */
+ /* 0x0020U unused */
+#define PNG_FLAG_ROW_INIT 0x0040U
+#define PNG_FLAG_FILLER_AFTER 0x0080U
+#define PNG_FLAG_CRC_ANCILLARY_USE 0x0100U
+#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200U
+#define PNG_FLAG_CRC_CRITICAL_USE 0x0400U
+#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800U
+#define PNG_FLAG_ASSUME_sRGB 0x1000U /* Added to libpng-1.5.4 */
+#define PNG_FLAG_OPTIMIZE_ALPHA 0x2000U /* Added to libpng-1.5.4 */
+#define PNG_FLAG_DETECT_UNINITIALIZED 0x4000U /* Added to libpng-1.5.4 */
+/* #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS 0x8000U */
+/* #define PNG_FLAG_KEEP_UNSAFE_CHUNKS 0x10000U */
+#define PNG_FLAG_LIBRARY_MISMATCH 0x20000U
+#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000U
+#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000U
+#define PNG_FLAG_BENIGN_ERRORS_WARN 0x100000U /* Added to libpng-1.4.0 */
+#define PNG_FLAG_APP_WARNINGS_WARN 0x200000U /* Added to libpng-1.6.0 */
+#define PNG_FLAG_APP_ERRORS_WARN 0x400000U /* Added to libpng-1.6.0 */
+ /* 0x800000U unused */
+ /* 0x1000000U unused */
+ /* 0x2000000U unused */
+ /* 0x4000000U unused */
+ /* 0x8000000U unused */
+ /* 0x10000000U unused */
+ /* 0x20000000U unused */
+ /* 0x40000000U unused */
#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
PNG_FLAG_CRC_ANCILLARY_NOWARN)
@@ -654,6 +684,24 @@
((png_size_t)(width) * (((png_size_t)(pixel_bits)) >> 3)) : \
(( ((png_size_t)(width) * ((png_size_t)(pixel_bits))) + 7) >> 3) )
+/* This returns the number of trailing bits in the last byte of a row, 0 if the
+ * last byte is completely full of pixels. It is, in principle, (pixel_bits x
+ * width) % 8, but that would overflow for large 'width'. The second macro is
+ * the same except that it returns the number of unused bits in the last byte;
+ * (8-TRAILBITS), but 0 when TRAILBITS is 0.
+ *
+ * NOTE: these macros are intended to be self-evidently correct and never
+ * overflow on the assumption that pixel_bits is in the range 0..255. The
+ * arguments are evaluated only once and they can be signed (e.g. as a result of
+ * the integral promotions). The result of the expression always has type
+ * (png_uint_32), however the compiler always knows it is in the range 0..7.
+ */
+#define PNG_TRAILBITS(pixel_bits, width) \
+ (((pixel_bits) * ((width) % (png_uint_32)8)) % 8)
+
+#define PNG_PADBITS(pixel_bits, width) \
+ ((8 - PNG_TRAILBITS(pixel_bits, width)) % 8)
+
/* PNG_OUT_OF_RANGE returns true if value is outside the range
* ideal-delta..ideal+delta. Each argument is evaluated twice.
* "ideal" and "delta" should be constants, normally simple
@@ -1039,7 +1087,7 @@ PNG_INTERNAL_FUNCTION(void,png_write_sBIT,(png_structrp png_ptr,
#ifdef PNG_WRITE_cHRM_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_write_cHRM_fixed,(png_structrp png_ptr,
const png_xy *xy), PNG_EMPTY);
- /* The xy value must have been previously validated */
+ /* The xy value must have been previously validated */
#endif
#ifdef PNG_WRITE_sRGB_SUPPORTED
@@ -1188,6 +1236,7 @@ PNG_INTERNAL_FUNCTION(void,png_do_write_interlace,(png_row_infop row_info,
PNG_INTERNAL_FUNCTION(void,png_read_filter_row,(png_structrp pp, png_row_infop
row_info, png_bytep row, png_const_bytep prev_row, int filter),PNG_EMPTY);
+#if PNG_ARM_NEON_OPT > 0
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_neon,(png_row_infop row_info,
png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_neon,(png_row_infop
@@ -1202,6 +1251,24 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_neon,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_neon,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+#endif
+
+#if PNG_MIPS_MSA_OPT > 0
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_msa,(png_row_infop row_info,
+ png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_msa,(png_row_infop
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_msa,(png_row_infop
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_msa,(png_row_infop
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_msa,(png_row_infop
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_msa,(png_row_infop
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_msa,(png_row_infop
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+#endif
/* Choose the best filter to use and filter the row data */
PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr,
@@ -1229,7 +1296,7 @@ PNG_INTERNAL_FUNCTION(void,png_read_finish_row,(png_structrp png_ptr),
/* Initialize the row buffers, etc. */
PNG_INTERNAL_FUNCTION(void,png_read_start_row,(png_structrp png_ptr),PNG_EMPTY);
-#if PNG_ZLIB_VERNUM >= 0x1240
+#if ZLIB_VERNUM >= 0x1240
PNG_INTERNAL_FUNCTION(int,png_zlib_inflate,(png_structrp png_ptr, int flush),
PNG_EMPTY);
# define PNG_INFLATE(pp, flush) png_zlib_inflate(pp, flush)
@@ -1427,7 +1494,7 @@ PNG_INTERNAL_FUNCTION(void,png_push_have_info,(png_structrp png_ptr,
PNG_INTERNAL_FUNCTION(void,png_push_have_end,(png_structrp png_ptr,
png_inforp info_ptr),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_push_have_row,(png_structrp png_ptr,
- png_bytep row),PNG_EMPTY);
+ png_bytep row),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_push_read_end,(png_structrp png_ptr,
png_inforp info_ptr),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_process_some_data,(png_structrp png_ptr,
@@ -1466,13 +1533,13 @@ PNG_INTERNAL_FUNCTION(void,png_colorspace_set_gamma,(png_const_structrp png_ptr,
PNG_INTERNAL_FUNCTION(void,png_colorspace_sync_info,(png_const_structrp png_ptr,
png_inforp info_ptr), PNG_EMPTY);
- /* Synchronize the info 'valid' flags with the colorspace */
+ /* Synchronize the info 'valid' flags with the colorspace */
PNG_INTERNAL_FUNCTION(void,png_colorspace_sync,(png_const_structrp png_ptr,
png_inforp info_ptr), PNG_EMPTY);
- /* Copy the png_struct colorspace to the info_struct and call the above to
- * synchronize the flags. Checks for NULL info_ptr and does nothing.
- */
+ /* Copy the png_struct colorspace to the info_struct and call the above to
+ * synchronize the flags. Checks for NULL info_ptr and does nothing.
+ */
#endif
/* Added at libpng version 1.4.0 */
@@ -1506,9 +1573,11 @@ PNG_INTERNAL_FUNCTION(int,png_colorspace_set_ICC,(png_const_structrp png_ptr,
/* The 'name' is used for information only */
/* Routines for checking parts of an ICC profile. */
+#ifdef PNG_READ_iCCP_SUPPORTED
PNG_INTERNAL_FUNCTION(int,png_icc_check_length,(png_const_structrp png_ptr,
png_colorspacerp colorspace, png_const_charp name,
png_uint_32 profile_length), PNG_EMPTY);
+#endif /* READ_iCCP */
PNG_INTERNAL_FUNCTION(int,png_icc_check_header,(png_const_structrp png_ptr,
png_colorspacerp colorspace, png_const_charp name,
png_uint_32 profile_length,
@@ -1927,10 +1996,20 @@ PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS, (png_structp png_ptr,
* the builder of libpng passes the definition of PNG_FILTER_OPTIMIZATIONS in
* CFLAGS in place of CPPFLAGS *and* uses symbol prefixing.
*/
+# if PNG_ARM_NEON_OPT > 0
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
#endif
+#if PNG_MIPS_MSA_OPT > 0
+PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa,
+ (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
+#endif
+#endif
+
+PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
+ png_const_charp key, png_bytep new_key), PNG_EMPTY);
+
/* Maintainer: Put new private prototypes here ^ */
#include "pngdebug.h"
diff --git a/src/3rdparty/libpng/pngread.c b/src/3rdparty/libpng/pngread.c
index 9cb4d2e41d..106a80588c 100644
--- a/src/3rdparty/libpng/pngread.c
+++ b/src/3rdparty/libpng/pngread.c
@@ -1,8 +1,8 @@
/* pngread.c - read a PNG file
*
- * Last changed in libpng 1.6.17 [March 26, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.26 [October 20, 2016]
+ * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -28,10 +28,10 @@ png_create_read_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
{
#ifndef PNG_USER_MEM_SUPPORTED
png_structp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
- error_fn, warn_fn, NULL, NULL, NULL);
+ error_fn, warn_fn, NULL, NULL, NULL);
#else
return png_create_read_struct_2(user_png_ver, error_ptr, error_fn,
- warn_fn, NULL, NULL, NULL);
+ warn_fn, NULL, NULL, NULL);
}
/* Alternate create PNG structure for reading, and allocate any memory
@@ -43,7 +43,7 @@ png_create_read_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED)
{
png_structp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
- error_fn, warn_fn, mem_ptr, malloc_fn, free_fn);
+ error_fn, warn_fn, mem_ptr, malloc_fn, free_fn);
#endif /* USER_MEM */
if (png_ptr != NULL)
@@ -127,7 +127,10 @@ png_read_info(png_structrp png_ptr, png_inforp info_ptr)
}
else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
+ {
+ png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
png_ptr->mode |= PNG_AFTER_IDAT;
+ }
/* This should be a binary subdivision search or a hash for
* matching the chunk name rather than a linear search.
@@ -249,7 +252,7 @@ png_read_info(png_structrp png_ptr, png_inforp info_ptr)
else
png_handle_unknown(png_ptr, info_ptr, length,
- PNG_HANDLE_CHUNK_AS_DEFAULT);
+ PNG_HANDLE_CHUNK_AS_DEFAULT);
}
}
#endif /* SEQUENTIAL_READ */
@@ -276,7 +279,7 @@ png_read_update_info(png_structrp png_ptr, png_inforp info_ptr)
/* New in 1.6.0 this avoids the bug of doing the initializations twice */
else
png_app_error(png_ptr,
- "png_read_update_info/png_start_read_image: duplicate call");
+ "png_read_update_info/png_start_read_image: duplicate call");
}
}
@@ -299,7 +302,7 @@ png_start_read_image(png_structrp png_ptr)
/* New in 1.6.0 this avoids the bug of doing the initializations twice */
else
png_app_error(png_ptr,
- "png_start_read_image/png_read_update_info: duplicate call");
+ "png_start_read_image/png_read_update_info: duplicate call");
}
}
#endif /* SEQUENTIAL_READ */
@@ -356,9 +359,9 @@ png_do_read_intrapixel(png_row_infop row_info, png_bytep row)
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
{
- png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
- png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
- png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
+ png_uint_32 s0 = (png_uint_32)(*(rp ) << 8) | *(rp + 1);
+ png_uint_32 s1 = (png_uint_32)(*(rp + 2) << 8) | *(rp + 3);
+ png_uint_32 s2 = (png_uint_32)(*(rp + 4) << 8) | *(rp + 5);
png_uint_32 red = (s0 + s1 + 65536) & 0xffff;
png_uint_32 blue = (s2 + s1 + 65536) & 0xffff;
*(rp ) = (png_byte)((red >> 8) & 0xff);
@@ -537,7 +540,7 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
{
if (png_ptr->row_buf[0] < PNG_FILTER_VALUE_LAST)
png_read_filter_row(png_ptr, &row_info, png_ptr->row_buf + 1,
- png_ptr->prev_row + 1, png_ptr->row_buf[0]);
+ png_ptr->prev_row + 1, png_ptr->row_buf[0]);
else
png_error(png_ptr, "bad adaptive filter value");
}
@@ -581,7 +584,7 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
{
if (png_ptr->pass < 6)
png_do_read_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass,
- png_ptr->transformations);
+ png_ptr->transformations);
if (dsp_row != NULL)
png_combine_row(png_ptr, dsp_row, 1/*display*/);
@@ -716,7 +719,7 @@ png_read_image(png_structrp png_ptr, png_bytepp image)
* but the caller should do it!
*/
png_warning(png_ptr, "Interlace handling should be turned on when "
- "using png_read_image");
+ "using png_read_image");
/* Make sure this is set correctly */
png_ptr->num_rows = png_ptr->height;
}
@@ -776,8 +779,8 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
#ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
/* Report invalid palette index; added at libng-1.5.10 */
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
- png_ptr->num_palette_max > png_ptr->num_palette)
- png_benign_error(png_ptr, "Read palette index exceeding num_palette");
+ png_ptr->num_palette_max > png_ptr->num_palette)
+ png_benign_error(png_ptr, "Read palette index exceeding num_palette");
#endif
do
@@ -785,6 +788,9 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
png_uint_32 length = png_read_chunk_header(png_ptr);
png_uint_32 chunk_name = png_ptr->chunk_name;
+ if (chunk_name != png_IDAT)
+ png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
+
if (chunk_name == png_IEND)
png_handle_IEND(png_ptr, info_ptr, length);
@@ -799,9 +805,9 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
{
if (chunk_name == png_IDAT)
{
- if ((length > 0) ||
- (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) != 0)
- png_benign_error(png_ptr, "Too many IDATs found");
+ if ((length > 0 && !(png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED))
+ || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) != 0)
+ png_benign_error(png_ptr, ".Too many IDATs found");
}
png_handle_unknown(png_ptr, info_ptr, length, keep);
if (chunk_name == png_PLTE)
@@ -812,10 +818,14 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
else if (chunk_name == png_IDAT)
{
/* Zero length IDATs are legal after the last IDAT has been
- * read, but not after other chunks have been read.
+ * read, but not after other chunks have been read. 1.6 does not
+ * always read all the deflate data; specifically it cannot be relied
+ * upon to read the Adler32 at the end. If it doesn't ignore IDAT
+ * chunks which are longer than zero as well:
*/
- if ((length > 0) || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) != 0)
- png_benign_error(png_ptr, "Too many IDATs found");
+ if ((length > 0 && !(png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED))
+ || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) != 0)
+ png_benign_error(png_ptr, "..Too many IDATs found");
png_crc_finish(png_ptr, length);
}
@@ -909,7 +919,7 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
else
png_handle_unknown(png_ptr, info_ptr, length,
- PNG_HANDLE_CHUNK_AS_DEFAULT);
+ PNG_HANDLE_CHUNK_AS_DEFAULT);
} while ((png_ptr->mode & PNG_HAVE_IEND) == 0);
}
#endif /* SEQUENTIAL_READ */
@@ -1020,8 +1030,7 @@ png_set_read_status_fn(png_structrp png_ptr, png_read_status_ptr read_row_fn)
#ifdef PNG_INFO_IMAGE_SUPPORTED
void PNGAPI
png_read_png(png_structrp png_ptr, png_inforp info_ptr,
- int transforms,
- voidp params)
+ int transforms, voidp params)
{
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -1297,7 +1306,7 @@ png_image_read_init(png_imagep image)
if (info_ptr != NULL)
{
png_controlp control = png_voidcast(png_controlp,
- png_malloc_warn(png_ptr, (sizeof *control)));
+ png_malloc_warn(png_ptr, (sizeof *control)));
if (control != NULL)
{
@@ -1384,7 +1393,9 @@ png_image_read_header(png_voidp argument)
png_structrp png_ptr = image->opaque->png_ptr;
png_inforp info_ptr = image->opaque->info_ptr;
+#ifdef PNG_BENIGN_ERRORS_SUPPORTED
png_set_benign_errors(png_ptr, 1/*warn*/);
+#endif
png_read_info(png_ptr, info_ptr);
/* Do this the fast way; just read directly out of png_struct. */
@@ -1422,7 +1433,7 @@ png_image_read_header(png_voidp argument)
break;
case PNG_COLOR_TYPE_PALETTE:
- cmap_entries = png_ptr->num_palette;
+ cmap_entries = (png_uint_32)png_ptr->num_palette;
break;
default:
@@ -1460,12 +1471,12 @@ png_image_begin_read_from_stdio(png_imagep image, FILE* file)
else
return png_image_error(image,
- "png_image_begin_read_from_stdio: invalid argument");
+ "png_image_begin_read_from_stdio: invalid argument");
}
else if (image != NULL)
return png_image_error(image,
- "png_image_begin_read_from_stdio: incorrect PNG_IMAGE_VERSION");
+ "png_image_begin_read_from_stdio: incorrect PNG_IMAGE_VERSION");
return 0;
}
@@ -1498,12 +1509,12 @@ png_image_begin_read_from_file(png_imagep image, const char *file_name)
else
return png_image_error(image,
- "png_image_begin_read_from_file: invalid argument");
+ "png_image_begin_read_from_file: invalid argument");
}
else if (image != NULL)
return png_image_error(image,
- "png_image_begin_read_from_file: incorrect PNG_IMAGE_VERSION");
+ "png_image_begin_read_from_file: incorrect PNG_IMAGE_VERSION");
return 0;
}
@@ -1540,7 +1551,7 @@ png_image_memory_read(png_structp png_ptr, png_bytep out, png_size_t need)
}
int PNGAPI png_image_begin_read_from_memory(png_imagep image,
- png_const_voidp memory, png_size_t size)
+ png_const_voidp memory, png_size_t size)
{
if (image != NULL && image->version == PNG_IMAGE_VERSION)
{
@@ -1563,12 +1574,12 @@ int PNGAPI png_image_begin_read_from_memory(png_imagep image,
else
return png_image_error(image,
- "png_image_begin_read_from_memory: invalid argument");
+ "png_image_begin_read_from_memory: invalid argument");
}
else if (image != NULL)
return png_image_error(image,
- "png_image_begin_read_from_memory: incorrect PNG_IMAGE_VERSION");
+ "png_image_begin_read_from_memory: incorrect PNG_IMAGE_VERSION");
return 0;
}
@@ -1614,12 +1625,12 @@ png_image_skip_unused_chunks(png_structrp png_ptr)
* IHDR, PLTE, tRNS, IDAT, and IEND chunks.
*/
png_set_keep_unknown_chunks(png_ptr, PNG_HANDLE_CHUNK_NEVER,
- NULL, -1);
+ NULL, -1);
/* But do not ignore image data handling chunks */
png_set_keep_unknown_chunks(png_ptr, PNG_HANDLE_CHUNK_AS_DEFAULT,
- chunks_to_process, (int)/*SAFE*/(sizeof chunks_to_process)/5);
- }
+ chunks_to_process, (int)/*SAFE*/(sizeof chunks_to_process)/5);
+ }
}
# define PNG_SKIP_CHUNKS(p) png_image_skip_unused_chunks(p)
@@ -1686,7 +1697,7 @@ decode_gamma(png_image_read_control *display, png_uint_32 value, int encoding)
#ifdef __GNUC__
default:
png_error(display->image->opaque->png_ptr,
- "unexpected encoding (internal error)");
+ "unexpected encoding (internal error)");
#endif
}
@@ -1695,8 +1706,8 @@ decode_gamma(png_image_read_control *display, png_uint_32 value, int encoding)
static png_uint_32
png_colormap_compose(png_image_read_control *display,
- png_uint_32 foreground, int foreground_encoding, png_uint_32 alpha,
- png_uint_32 background, int encoding)
+ png_uint_32 foreground, int foreground_encoding, png_uint_32 alpha,
+ png_uint_32 background, int encoding)
{
/* The file value is composed on the background, the background has the given
* encoding and so does the result, the file is encoded with P_FILE and the
@@ -1732,14 +1743,14 @@ png_colormap_compose(png_image_read_control *display,
*/
static void
png_create_colormap_entry(png_image_read_control *display,
- png_uint_32 ip, png_uint_32 red, png_uint_32 green, png_uint_32 blue,
- png_uint_32 alpha, int encoding)
+ png_uint_32 ip, png_uint_32 red, png_uint_32 green, png_uint_32 blue,
+ png_uint_32 alpha, int encoding)
{
png_imagep image = display->image;
const int output_encoding = (image->format & PNG_FORMAT_FLAG_LINEAR) != 0 ?
- P_LINEAR : P_sRGB;
+ P_LINEAR : P_sRGB;
const int convert_to_Y = (image->format & PNG_FORMAT_FLAG_COLOR) == 0 &&
- (red != green || green != blue);
+ (red != green || green != blue);
if (ip > 255)
png_error(image->opaque->png_ptr, "color-map index out of range");
@@ -1957,7 +1968,7 @@ make_gray_file_colormap(png_image_read_control *display)
for (i=0; i<256; ++i)
png_create_colormap_entry(display, i, i, i, i, 255, P_FILE);
- return i;
+ return (int)i;
}
static int
@@ -1968,7 +1979,7 @@ make_gray_colormap(png_image_read_control *display)
for (i=0; i<256; ++i)
png_create_colormap_entry(display, i, i, i, i, 255, P_sRGB);
- return i;
+ return (int)i;
}
#define PNG_GRAY_COLORMAP_ENTRIES 256
@@ -2019,10 +2030,10 @@ make_ga_colormap(png_image_read_control *display)
for (g=0; g<6; ++g)
png_create_colormap_entry(display, i++, g*51, g*51, g*51, a*51,
- P_sRGB);
+ P_sRGB);
}
- return i;
+ return (int)i;
}
#define PNG_GA_COLORMAP_ENTRIES 256
@@ -2043,11 +2054,11 @@ make_rgb_colormap(png_image_read_control *display)
for (b=0; b<6; ++b)
png_create_colormap_entry(display, i++, r*51, g*51, b*51, 255,
- P_sRGB);
+ P_sRGB);
}
}
- return i;
+ return (int)i;
}
#define PNG_RGB_COLORMAP_ENTRIES 216
@@ -2095,7 +2106,7 @@ png_image_read_colormap(png_voidp argument)
else if (display->background == NULL /* no way to remove it */)
png_error(png_ptr,
- "a background color must be supplied to remove alpha/transparency");
+ "background color must be supplied to remove alpha/transparency");
/* Get a copy of the background color (this avoids repeating the checks
* below.) The encoding is 8-bit sRGB or 16-bit linear, depending on the
@@ -2190,7 +2201,7 @@ png_image_read_colormap(png_voidp argument)
*/
if (i != trans)
png_create_colormap_entry(display, i, val, val, val, 255,
- P_FILE/*8-bit with file gamma*/);
+ P_FILE/*8-bit with file gamma*/);
/* Else this entry is transparent. The colors don't matter if
* there is an alpha channel (back_alpha == 0), but it does no
@@ -2202,7 +2213,7 @@ png_image_read_colormap(png_voidp argument)
*/
else
png_create_colormap_entry(display, i, back_r, back_g, back_b,
- back_alpha, output_encoding);
+ back_alpha, output_encoding);
}
/* We need libpng to preserve the original encoding. */
@@ -2240,7 +2251,7 @@ png_image_read_colormap(png_voidp argument)
if (PNG_GRAY_COLORMAP_ENTRIES > image->colormap_entries)
png_error(png_ptr, "gray[16] color-map: too few entries");
- cmap_entries = make_gray_colormap(display);
+ cmap_entries = (unsigned int)make_gray_colormap(display);
if (png_ptr->num_trans > 0)
{
@@ -2267,7 +2278,7 @@ png_image_read_colormap(png_voidp argument)
* matches.
*/
png_create_colormap_entry(display, gray, back_g, back_g,
- back_g, 65535, P_LINEAR);
+ back_g, 65535, P_LINEAR);
}
/* The background passed to libpng, however, must be the
@@ -2281,8 +2292,8 @@ png_image_read_colormap(png_voidp argument)
* doesn't.
*/
png_set_background_fixed(png_ptr, &c,
- PNG_BACKGROUND_GAMMA_SCREEN, 0/*need_expand*/,
- 0/*gamma: not used*/);
+ PNG_BACKGROUND_GAMMA_SCREEN, 0/*need_expand*/,
+ 0/*gamma: not used*/);
output_processing = PNG_CMAP_NONE;
break;
@@ -2312,7 +2323,7 @@ png_image_read_colormap(png_voidp argument)
* background color at full precision.
*/
png_create_colormap_entry(display, 254, back_r, back_g, back_b,
- back_alpha, output_encoding);
+ back_alpha, output_encoding);
}
else
@@ -2338,7 +2349,7 @@ png_image_read_colormap(png_voidp argument)
if (PNG_GA_COLORMAP_ENTRIES > image->colormap_entries)
png_error(png_ptr, "gray+alpha color-map: too few entries");
- cmap_entries = make_ga_colormap(display);
+ cmap_entries = (unsigned int)make_ga_colormap(display);
background_index = PNG_CMAP_GA_BACKGROUND;
output_processing = PNG_CMAP_GA;
@@ -2372,7 +2383,7 @@ png_image_read_colormap(png_voidp argument)
if (PNG_GRAY_COLORMAP_ENTRIES > image->colormap_entries)
png_error(png_ptr, "gray-alpha color-map: too few entries");
- cmap_entries = make_gray_colormap(display);
+ cmap_entries = (unsigned int)make_gray_colormap(display);
if (output_encoding == P_LINEAR)
{
@@ -2380,7 +2391,7 @@ png_image_read_colormap(png_voidp argument)
/* And make sure the corresponding palette entry matches. */
png_create_colormap_entry(display, gray, back_g, back_g,
- back_g, 65535, P_LINEAR);
+ back_g, 65535, P_LINEAR);
}
/* The background passed to libpng, however, must be the sRGB
@@ -2390,8 +2401,8 @@ png_image_read_colormap(png_voidp argument)
c.gray = c.red = c.green = c.blue = (png_uint_16)gray;
png_set_background_fixed(png_ptr, &c,
- PNG_BACKGROUND_GAMMA_SCREEN, 0/*need_expand*/,
- 0/*gamma: not used*/);
+ PNG_BACKGROUND_GAMMA_SCREEN, 0/*need_expand*/,
+ 0/*gamma: not used*/);
output_processing = PNG_CMAP_NONE;
}
@@ -2411,7 +2422,7 @@ png_image_read_colormap(png_voidp argument)
{
png_uint_32 gray = (i * 256 + 115) / 231;
png_create_colormap_entry(display, i++, gray, gray, gray,
- 255, P_sRGB);
+ 255, P_sRGB);
}
/* NOTE: this preserves the full precision of the application
@@ -2420,13 +2431,13 @@ png_image_read_colormap(png_voidp argument)
background_index = i;
png_create_colormap_entry(display, i++, back_r, back_g, back_b,
#ifdef __COVERITY__
- /* Coverity claims that output_encoding cannot be 2 (P_LINEAR)
- * here.
- */ 255U,
+ /* Coverity claims that output_encoding
+ * cannot be 2 (P_LINEAR) here.
+ */ 255U,
#else
- output_encoding == P_LINEAR ? 65535U : 255U,
+ output_encoding == P_LINEAR ? 65535U : 255U,
#endif
- output_encoding);
+ output_encoding);
/* For non-opaque input composite on the sRGB background - this
* requires inverting the encoding for each component. The input
@@ -2464,9 +2475,9 @@ png_image_read_colormap(png_voidp argument)
png_uint_32 gray = png_sRGB_table[g*51] * alpha;
png_create_colormap_entry(display, i++,
- PNG_sRGB_FROM_LINEAR(gray + back_rx),
- PNG_sRGB_FROM_LINEAR(gray + back_gx),
- PNG_sRGB_FROM_LINEAR(gray + back_bx), 255, P_sRGB);
+ PNG_sRGB_FROM_LINEAR(gray + back_rx),
+ PNG_sRGB_FROM_LINEAR(gray + back_gx),
+ PNG_sRGB_FROM_LINEAR(gray + back_bx), 255, P_sRGB);
}
}
@@ -2492,7 +2503,7 @@ png_image_read_colormap(png_voidp argument)
* png_set_tRNS_to_alpha before png_set_background_fixed.
*/
png_set_rgb_to_gray_fixed(png_ptr, PNG_ERROR_ACTION_NONE, -1,
- -1);
+ -1);
data_encoding = P_sRGB;
/* The output will now be one or two 8-bit gray or gray+alpha
@@ -2511,7 +2522,7 @@ png_image_read_colormap(png_voidp argument)
if (PNG_GA_COLORMAP_ENTRIES > image->colormap_entries)
png_error(png_ptr, "rgb[ga] color-map: too few entries");
- cmap_entries = make_ga_colormap(display);
+ cmap_entries = (unsigned int)make_ga_colormap(display);
background_index = PNG_CMAP_GA_BACKGROUND;
output_processing = PNG_CMAP_GA;
}
@@ -2537,12 +2548,12 @@ png_image_read_colormap(png_voidp argument)
png_ptr->num_trans > 0) &&
png_gamma_not_sRGB(png_ptr->colorspace.gamma) != 0)
{
- cmap_entries = make_gray_file_colormap(display);
+ cmap_entries = (unsigned int)make_gray_file_colormap(display);
data_encoding = P_FILE;
}
else
- cmap_entries = make_gray_colormap(display);
+ cmap_entries = (unsigned int)make_gray_colormap(display);
/* But if the input has alpha or transparency it must be removed
*/
@@ -2568,13 +2579,13 @@ png_image_read_colormap(png_voidp argument)
gray = png_sRGB_table[gray]; /* now P_LINEAR */
gray = PNG_DIV257(png_gamma_16bit_correct(gray,
- png_ptr->colorspace.gamma)); /* now P_FILE */
+ png_ptr->colorspace.gamma)); /* now P_FILE */
/* And make sure the corresponding palette entry contains
* exactly the required sRGB value.
*/
png_create_colormap_entry(display, gray, back_g, back_g,
- back_g, 0/*unused*/, output_encoding);
+ back_g, 0/*unused*/, output_encoding);
}
else if (output_encoding == P_LINEAR)
@@ -2599,8 +2610,8 @@ png_image_read_colormap(png_voidp argument)
*/
expand_tRNS = 1;
png_set_background_fixed(png_ptr, &c,
- PNG_BACKGROUND_GAMMA_SCREEN, 0/*need_expand*/,
- 0/*gamma: not used*/);
+ PNG_BACKGROUND_GAMMA_SCREEN, 0/*need_expand*/,
+ 0/*gamma: not used*/);
}
output_processing = PNG_CMAP_NONE;
@@ -2630,11 +2641,11 @@ png_image_read_colormap(png_voidp argument)
if (PNG_RGB_COLORMAP_ENTRIES+1+27 > image->colormap_entries)
png_error(png_ptr, "rgb+alpha color-map: too few entries");
- cmap_entries = make_rgb_colormap(display);
+ cmap_entries = (unsigned int)make_rgb_colormap(display);
/* Add a transparent entry. */
png_create_colormap_entry(display, cmap_entries, 255, 255,
- 255, 0, P_sRGB);
+ 255, 0, P_sRGB);
/* This is stored as the background index for the processing
* algorithm.
@@ -2655,7 +2666,7 @@ png_image_read_colormap(png_voidp argument)
*/
for (b=0; b<256; b = (b << 1) | 0x7f)
png_create_colormap_entry(display, cmap_entries++,
- r, g, b, 128, P_sRGB);
+ r, g, b, 128, P_sRGB);
}
}
@@ -2679,10 +2690,10 @@ png_image_read_colormap(png_voidp argument)
if (PNG_RGB_COLORMAP_ENTRIES+1+27 > image->colormap_entries)
png_error(png_ptr, "rgb-alpha color-map: too few entries");
- cmap_entries = make_rgb_colormap(display);
+ cmap_entries = (unsigned int)make_rgb_colormap(display);
png_create_colormap_entry(display, cmap_entries, back_r,
- back_g, back_b, 0/*unused*/, output_encoding);
+ back_g, back_b, 0/*unused*/, output_encoding);
if (output_encoding == P_LINEAR)
{
@@ -2704,9 +2715,9 @@ png_image_read_colormap(png_voidp argument)
* index.
*/
if (memcmp((png_const_bytep)display->colormap +
- sample_size * cmap_entries,
- (png_const_bytep)display->colormap +
- sample_size * PNG_RGB_INDEX(r,g,b),
+ sample_size * cmap_entries,
+ (png_const_bytep)display->colormap +
+ sample_size * PNG_RGB_INDEX(r,g,b),
sample_size) != 0)
{
/* The background color must be added. */
@@ -2724,13 +2735,13 @@ png_image_read_colormap(png_voidp argument)
*/
for (b=0; b<256; b = (b << 1) | 0x7f)
png_create_colormap_entry(display, cmap_entries++,
- png_colormap_compose(display, r, P_sRGB, 128,
- back_r, output_encoding),
- png_colormap_compose(display, g, P_sRGB, 128,
- back_g, output_encoding),
- png_colormap_compose(display, b, P_sRGB, 128,
- back_b, output_encoding),
- 0/*unused*/, output_encoding);
+ png_colormap_compose(display, r, P_sRGB, 128,
+ back_r, output_encoding),
+ png_colormap_compose(display, g, P_sRGB, 128,
+ back_g, output_encoding),
+ png_colormap_compose(display, b, P_sRGB, 128,
+ back_b, output_encoding),
+ 0/*unused*/, output_encoding);
}
}
@@ -2748,8 +2759,8 @@ png_image_read_colormap(png_voidp argument)
c.blue = (png_uint_16)back_b;
png_set_background_fixed(png_ptr, &c,
- PNG_BACKGROUND_GAMMA_SCREEN, 0/*need_expand*/,
- 0/*gamma: not used*/);
+ PNG_BACKGROUND_GAMMA_SCREEN, 0/*need_expand*/,
+ 0/*gamma: not used*/);
output_processing = PNG_CMAP_RGB;
}
@@ -2764,7 +2775,7 @@ png_image_read_colormap(png_voidp argument)
if (PNG_RGB_COLORMAP_ENTRIES > image->colormap_entries)
png_error(png_ptr, "rgb color-map: too few entries");
- cmap_entries = make_rgb_colormap(display);
+ cmap_entries = (unsigned int)make_rgb_colormap(display);
output_processing = PNG_CMAP_RGB;
}
}
@@ -2788,11 +2799,11 @@ png_image_read_colormap(png_voidp argument)
output_processing = PNG_CMAP_NONE;
data_encoding = P_FILE; /* Don't change from color-map indices */
- cmap_entries = png_ptr->num_palette;
+ cmap_entries = (unsigned int)png_ptr->num_palette;
if (cmap_entries > 256)
cmap_entries = 256;
- if (cmap_entries > image->colormap_entries)
+ if (cmap_entries > (unsigned int)image->colormap_entries)
png_error(png_ptr, "palette color-map: too few entries");
for (i=0; i < cmap_entries; ++i)
@@ -2801,7 +2812,7 @@ png_image_read_colormap(png_voidp argument)
{
if (trans[i] == 0)
png_create_colormap_entry(display, i, back_r, back_g,
- back_b, 0, output_encoding);
+ back_b, 0, output_encoding);
else
{
@@ -2809,22 +2820,22 @@ png_image_read_colormap(png_voidp argument)
* on the sRGB color in 'back'.
*/
png_create_colormap_entry(display, i,
- png_colormap_compose(display, colormap[i].red, P_FILE,
- trans[i], back_r, output_encoding),
- png_colormap_compose(display, colormap[i].green, P_FILE,
- trans[i], back_g, output_encoding),
- png_colormap_compose(display, colormap[i].blue, P_FILE,
- trans[i], back_b, output_encoding),
- output_encoding == P_LINEAR ? trans[i] * 257U :
- trans[i],
- output_encoding);
+ png_colormap_compose(display, colormap[i].red,
+ P_FILE, trans[i], back_r, output_encoding),
+ png_colormap_compose(display, colormap[i].green,
+ P_FILE, trans[i], back_g, output_encoding),
+ png_colormap_compose(display, colormap[i].blue,
+ P_FILE, trans[i], back_b, output_encoding),
+ output_encoding == P_LINEAR ? trans[i] * 257U :
+ trans[i],
+ output_encoding);
}
}
else
png_create_colormap_entry(display, i, colormap[i].red,
- colormap[i].green, colormap[i].blue,
- i < num_trans ? trans[i] : 255U, P_FILE/*8-bit*/);
+ colormap[i].green, colormap[i].blue,
+ i < num_trans ? trans[i] : 255U, P_FILE/*8-bit*/);
}
/* The PNG data may have indices packed in fewer than 8 bits, it
@@ -2904,7 +2915,7 @@ png_image_read_colormap(png_voidp argument)
png_error(png_ptr, "bad background index (internal error)");
}
- display->colormap_processing = output_processing;
+ display->colormap_processing = (int)output_processing;
return 1/*ok*/;
}
@@ -2914,7 +2925,7 @@ static int
png_image_read_and_map(png_voidp argument)
{
png_image_read_control *display = png_voidcast(png_image_read_control*,
- argument);
+ argument);
png_imagep image = display->image;
png_structrp png_ptr = image->opaque->png_ptr;
int passes;
@@ -3051,7 +3062,7 @@ png_image_read_and_map(png_voidp argument)
if (alpha >= 196)
*outrow = PNG_RGB_INDEX(inrow[0], inrow[1],
- inrow[2]);
+ inrow[2]);
else if (alpha < 64)
*outrow = PNG_CMAP_RGB_ALPHA_BACKGROUND;
@@ -3103,7 +3114,7 @@ static int
png_image_read_colormapped(png_voidp argument)
{
png_image_read_control *display = png_voidcast(png_image_read_control*,
- argument);
+ argument);
png_imagep image = display->image;
png_controlp control = image->opaque;
png_structrp png_ptr = control->png_ptr;
@@ -3213,14 +3224,14 @@ png_image_read_colormapped(png_voidp argument)
else
{
- png_alloc_size_t row_bytes = display->row_bytes;
+ png_alloc_size_t row_bytes = (png_alloc_size_t)display->row_bytes;
while (--passes >= 0)
{
png_uint_32 y = image->height;
png_bytep row = png_voidcast(png_bytep, display->first_row);
- while (y-- > 0)
+ for (; y > 0; --y)
{
png_read_row(png_ptr, row, NULL);
row += row_bytes;
@@ -3236,7 +3247,7 @@ static int
png_image_read_composite(png_voidp argument)
{
png_image_read_control *display = png_voidcast(png_image_read_control*,
- argument);
+ argument);
png_imagep image = display->image;
png_structrp png_ptr = image->opaque->png_ptr;
int passes;
@@ -3363,7 +3374,7 @@ static int
png_image_read_background(png_voidp argument)
{
png_image_read_control *display = png_voidcast(png_image_read_control*,
- argument);
+ argument);
png_imagep image = display->image;
png_structrp png_ptr = image->opaque->png_ptr;
png_inforp info_ptr = image->opaque->info_ptr;
@@ -3423,8 +3434,7 @@ png_image_read_background(png_voidp argument)
for (pass = 0; pass < passes; ++pass)
{
- png_bytep row = png_voidcast(png_bytep,
- display->first_row);
+ png_bytep row = png_voidcast(png_bytep, display->first_row);
unsigned int startx, stepx, stepy;
png_uint_32 y;
@@ -3452,7 +3462,7 @@ png_image_read_background(png_voidp argument)
for (; y<height; y += stepy)
{
png_bytep inrow = png_voidcast(png_bytep,
- display->local_row);
+ display->local_row);
png_bytep outrow = first_row + y * step_row;
png_const_bytep end_row = outrow + width;
@@ -3497,7 +3507,7 @@ png_image_read_background(png_voidp argument)
for (; y<height; y += stepy)
{
png_bytep inrow = png_voidcast(png_bytep,
- display->local_row);
+ display->local_row);
png_bytep outrow = first_row + y * step_row;
png_const_bytep end_row = outrow + width;
@@ -3544,13 +3554,14 @@ png_image_read_background(png_voidp argument)
*/
{
png_uint_16p first_row = png_voidcast(png_uint_16p,
- display->first_row);
+ display->first_row);
/* The division by two is safe because the caller passed in a
* stride which was multiplied by 2 (below) to get row_bytes.
*/
ptrdiff_t step_row = display->row_bytes / 2;
- int preserve_alpha = (image->format & PNG_FORMAT_FLAG_ALPHA) != 0;
- unsigned int outchannels = 1+preserve_alpha;
+ unsigned int preserve_alpha = (image->format &
+ PNG_FORMAT_FLAG_ALPHA) != 0;
+ unsigned int outchannels = 1U+preserve_alpha;
int swap_alpha = 0;
# ifdef PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED
@@ -3594,7 +3605,7 @@ png_image_read_background(png_voidp argument)
/* Read the row, which is packed: */
png_read_row(png_ptr, png_voidcast(png_bytep,
- display->local_row), NULL);
+ display->local_row), NULL);
inrow = png_voidcast(png_const_uint_16p, display->local_row);
/* Now do the pre-multiplication on each pixel in this row.
@@ -3643,7 +3654,7 @@ static int
png_image_read_direct(png_voidp argument)
{
png_image_read_control *display = png_voidcast(png_image_read_control*,
- argument);
+ argument);
png_imagep image = display->image;
png_structrp png_ptr = image->opaque->png_ptr;
png_inforp info_ptr = image->opaque->info_ptr;
@@ -3694,7 +3705,7 @@ png_image_read_direct(png_voidp argument)
do_local_background = 1/*maybe*/;
png_set_rgb_to_gray_fixed(png_ptr, PNG_ERROR_ACTION_NONE,
- PNG_RGB_TO_GRAY_DEFAULT, PNG_RGB_TO_GRAY_DEFAULT);
+ PNG_RGB_TO_GRAY_DEFAULT, PNG_RGB_TO_GRAY_DEFAULT);
}
change &= ~PNG_FORMAT_FLAG_COLOR;
@@ -3753,7 +3764,7 @@ png_image_read_direct(png_voidp argument)
* final value.
*/
if (png_muldiv(&gtest, output_gamma, png_ptr->colorspace.gamma,
- PNG_FP_1) != 0 && png_gamma_significant(gtest) == 0)
+ PNG_FP_1) != 0 && png_gamma_significant(gtest) == 0)
do_local_background = 0;
else if (mode == PNG_ALPHA_STANDARD)
@@ -3816,8 +3827,8 @@ png_image_read_direct(png_voidp argument)
* pixels.
*/
png_set_background_fixed(png_ptr, &c,
- PNG_BACKGROUND_GAMMA_SCREEN, 0/*need_expand*/,
- 0/*gamma: not used*/);
+ PNG_BACKGROUND_GAMMA_SCREEN, 0/*need_expand*/,
+ 0/*gamma: not used*/);
}
else /* compose on row: implemented below. */
@@ -3848,16 +3859,16 @@ png_image_read_direct(png_voidp argument)
else
filler = 255;
-# ifdef PNG_FORMAT_AFIRST_SUPPORTED
- if ((format & PNG_FORMAT_FLAG_AFIRST) != 0)
- {
- where = PNG_FILLER_BEFORE;
- change &= ~PNG_FORMAT_FLAG_AFIRST;
- }
+#ifdef PNG_FORMAT_AFIRST_SUPPORTED
+ if ((format & PNG_FORMAT_FLAG_AFIRST) != 0)
+ {
+ where = PNG_FILLER_BEFORE;
+ change &= ~PNG_FORMAT_FLAG_AFIRST;
+ }
- else
-# endif
- where = PNG_FILLER_AFTER;
+ else
+#endif
+ where = PNG_FILLER_AFTER;
png_set_add_alpha(png_ptr, filler, where);
}
@@ -3965,12 +3976,12 @@ png_image_read_direct(png_voidp argument)
if (info_ptr->bit_depth == 16)
info_format |= PNG_FORMAT_FLAG_LINEAR;
-# ifdef PNG_FORMAT_BGR_SUPPORTED
- if ((png_ptr->transformations & PNG_BGR) != 0)
- info_format |= PNG_FORMAT_FLAG_BGR;
-# endif
+#ifdef PNG_FORMAT_BGR_SUPPORTED
+ if ((png_ptr->transformations & PNG_BGR) != 0)
+ info_format |= PNG_FORMAT_FLAG_BGR;
+#endif
-# ifdef PNG_FORMAT_AFIRST_SUPPORTED
+#ifdef PNG_FORMAT_AFIRST_SUPPORTED
if (do_local_background == 2)
{
if ((format & PNG_FORMAT_FLAG_AFIRST) != 0)
@@ -4047,14 +4058,14 @@ png_image_read_direct(png_voidp argument)
else
{
- png_alloc_size_t row_bytes = display->row_bytes;
+ png_alloc_size_t row_bytes = (png_alloc_size_t)display->row_bytes;
while (--passes >= 0)
{
png_uint_32 y = image->height;
png_bytep row = png_voidcast(png_bytep, display->first_row);
- while (y-- > 0)
+ for (; y > 0; --y)
{
png_read_row(png_ptr, row, NULL);
row += row_bytes;
@@ -4067,67 +4078,117 @@ png_image_read_direct(png_voidp argument)
int PNGAPI
png_image_finish_read(png_imagep image, png_const_colorp background,
- void *buffer, png_int_32 row_stride, void *colormap)
+ void *buffer, png_int_32 row_stride, void *colormap)
{
if (image != NULL && image->version == PNG_IMAGE_VERSION)
{
- png_uint_32 check;
+ /* Check for row_stride overflow. This check is not performed on the
+ * original PNG format because it may not occur in the output PNG format
+ * and libpng deals with the issues of reading the original.
+ */
+ const unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format);
- if (row_stride == 0)
- row_stride = PNG_IMAGE_ROW_STRIDE(*image);
+ /* The following checks just the 'row_stride' calculation to ensure it
+ * fits in a signed 32-bit value. Because channels/components can be
+ * either 1 or 2 bytes in size the length of a row can still overflow 32
+ * bits; this is just to verify that the 'row_stride' argument can be
+ * represented.
+ */
+ if (image->width <= 0x7fffffffU/channels) /* no overflow */
+ {
+ png_uint_32 check;
+ const png_uint_32 png_row_stride = image->width * channels;
- if (row_stride < 0)
- check = -row_stride;
+ if (row_stride == 0)
+ row_stride = (png_int_32)/*SAFE*/png_row_stride;
- else
- check = row_stride;
+ if (row_stride < 0)
+ check = (png_uint_32)(-row_stride);
- if (image->opaque != NULL && buffer != NULL &&
- check >= PNG_IMAGE_ROW_STRIDE(*image))
- {
- if ((image->format & PNG_FORMAT_FLAG_COLORMAP) == 0 ||
- (image->colormap_entries > 0 && colormap != NULL))
+ else
+ check = (png_uint_32)row_stride;
+
+ /* This verifies 'check', the absolute value of the actual stride
+ * passed in and detects overflow in the application calculation (i.e.
+ * if the app did actually pass in a non-zero 'row_stride'.
+ */
+ if (image->opaque != NULL && buffer != NULL && check >= png_row_stride)
{
- int result;
- png_image_read_control display;
-
- memset(&display, 0, (sizeof display));
- display.image = image;
- display.buffer = buffer;
- display.row_stride = row_stride;
- display.colormap = colormap;
- display.background = background;
- display.local_row = NULL;
-
- /* Choose the correct 'end' routine; for the color-map case all the
- * setup has already been done.
+ /* Now check for overflow of the image buffer calculation; this
+ * limits the whole image size to 32 bits for API compatibility with
+ * the current, 32-bit, PNG_IMAGE_BUFFER_SIZE macro.
+ *
+ * The PNG_IMAGE_BUFFER_SIZE macro is:
+ *
+ * (PNG_IMAGE_PIXEL_COMPONENT_SIZE(fmt)*height*(row_stride))
+ *
+ * And the component size is always 1 or 2, so make sure that the
+ * number of *bytes* that the application is saying are available
+ * does actually fit into a 32-bit number.
+ *
+ * NOTE: this will be changed in 1.7 because PNG_IMAGE_BUFFER_SIZE
+ * will be changed to use png_alloc_size_t; bigger images can be
+ * accomodated on 64-bit systems.
*/
- if ((image->format & PNG_FORMAT_FLAG_COLORMAP) != 0)
- result =
- png_safe_execute(image, png_image_read_colormap, &display) &&
- png_safe_execute(image, png_image_read_colormapped, &display);
+ if (image->height <=
+ 0xffffffffU/PNG_IMAGE_PIXEL_COMPONENT_SIZE(image->format)/check)
+ {
+ if ((image->format & PNG_FORMAT_FLAG_COLORMAP) == 0 ||
+ (image->colormap_entries > 0 && colormap != NULL))
+ {
+ int result;
+ png_image_read_control display;
+
+ memset(&display, 0, (sizeof display));
+ display.image = image;
+ display.buffer = buffer;
+ display.row_stride = row_stride;
+ display.colormap = colormap;
+ display.background = background;
+ display.local_row = NULL;
+
+ /* Choose the correct 'end' routine; for the color-map case
+ * all the setup has already been done.
+ */
+ if ((image->format & PNG_FORMAT_FLAG_COLORMAP) != 0)
+ result =
+ png_safe_execute(image,
+ png_image_read_colormap, &display) &&
+ png_safe_execute(image,
+ png_image_read_colormapped, &display);
- else
- result =
- png_safe_execute(image, png_image_read_direct, &display);
+ else
+ result =
+ png_safe_execute(image,
+ png_image_read_direct, &display);
- png_image_free(image);
- return result;
+ png_image_free(image);
+ return result;
+ }
+
+ else
+ return png_image_error(image,
+ "png_image_finish_read[color-map]: no color-map");
+ }
+
+ else
+ return png_image_error(image,
+ "png_image_finish_read: image too large");
}
else
return png_image_error(image,
- "png_image_finish_read[color-map]: no color-map");
+ "png_image_finish_read: invalid argument");
}
else
return png_image_error(image,
- "png_image_finish_read: invalid argument");
+ "png_image_finish_read: row_stride too large");
}
else if (image != NULL)
return png_image_error(image,
- "png_image_finish_read: damaged PNG_IMAGE_VERSION");
+ "png_image_finish_read: damaged PNG_IMAGE_VERSION");
return 0;
}
diff --git a/src/3rdparty/libpng/pngrio.c b/src/3rdparty/libpng/pngrio.c
index 38f7fd49d6..7e26e855ca 100644
--- a/src/3rdparty/libpng/pngrio.c
+++ b/src/3rdparty/libpng/pngrio.c
@@ -1,8 +1,8 @@
/* pngrio.c - functions for data input
*
- * Last changed in libpng 1.6.17 [March 26, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.24 [August 4, 2016]
+ * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -85,7 +85,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
*/
void PNGAPI
png_set_read_fn(png_structrp png_ptr, png_voidp io_ptr,
- png_rw_ptr read_data_fn)
+ png_rw_ptr read_data_fn)
{
if (png_ptr == NULL)
return;
diff --git a/src/3rdparty/libpng/pngrtran.c b/src/3rdparty/libpng/pngrtran.c
index f129ef129c..0b4f4f9068 100644
--- a/src/3rdparty/libpng/pngrtran.c
+++ b/src/3rdparty/libpng/pngrtran.c
@@ -1,8 +1,8 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
- * Last changed in libpng 1.6.19 [November 12, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.24 [August 4, 2016]
+ * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -48,7 +48,7 @@ png_set_crc_action(png_structrp png_ptr, int crit_action, int ancil_action)
case PNG_CRC_WARN_DISCARD: /* Not a valid action for critical data */
png_warning(png_ptr,
- "Can't discard critical data on CRC error");
+ "Can't discard critical data on CRC error");
case PNG_CRC_ERROR_QUIT: /* Error/quit */
case PNG_CRC_DEFAULT:
@@ -101,7 +101,7 @@ png_rtran_ok(png_structrp png_ptr, int need_IHDR)
{
if ((png_ptr->flags & PNG_FLAG_ROW_INIT) != 0)
png_app_error(png_ptr,
- "invalid after png_start_read_image or png_read_update_info");
+ "invalid after png_start_read_image or png_read_update_info");
else if (need_IHDR && (png_ptr->mode & PNG_HAVE_IHDR) == 0)
png_app_error(png_ptr, "invalid before the PNG header has been read");
@@ -159,7 +159,7 @@ png_set_background(png_structrp png_ptr,
png_set_background_fixed(png_ptr, background_color, background_gamma_code,
need_expand, png_fixed(png_ptr, background_gamma, "png_set_background"));
}
-# endif /* FLOATING_POINT */
+# endif /* FLOATING_POINT */
#endif /* READ_BACKGROUND */
/* Scale 16-bit depth files to 8-bit depth. If both of these are set then the
@@ -209,7 +209,7 @@ png_set_strip_alpha(png_structrp png_ptr)
#if defined(PNG_READ_ALPHA_MODE_SUPPORTED) || defined(PNG_READ_GAMMA_SUPPORTED)
static png_fixed_point
translate_gamma_flags(png_structrp png_ptr, png_fixed_point output_gamma,
- int is_screen)
+ int is_screen)
{
/* Check for flag values. The main reason for having the old Mac value as a
* flag is that it is pretty near impossible to work out what the correct
@@ -273,7 +273,7 @@ convert_gamma_value(png_structrp png_ptr, double output_gamma)
#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
void PNGFAPI
png_set_alpha_mode_fixed(png_structrp png_ptr, int mode,
- png_fixed_point output_gamma)
+ png_fixed_point output_gamma)
{
int compose = 0;
png_fixed_point file_gamma;
@@ -289,9 +289,12 @@ png_set_alpha_mode_fixed(png_structrp png_ptr, int mode,
* is expected to be 1 or greater, but this range test allows for some
* viewing correction values. The intent is to weed out users of this API
* who use the inverse of the gamma value accidentally! Since some of these
- * values are reasonable this may have to be changed.
+ * values are reasonable this may have to be changed:
+ *
+ * 1.6.x: changed from 0.07..3 to 0.01..100 (to accomodate the optimal 16-bit
+ * gamma of 36, and its reciprocal.)
*/
- if (output_gamma < 70000 || output_gamma > 300000)
+ if (output_gamma < 1000 || output_gamma > 10000000)
png_error(png_ptr, "output gamma out of expected range");
/* The default file gamma is the inverse of the output gamma; the output
@@ -374,7 +377,7 @@ png_set_alpha_mode_fixed(png_structrp png_ptr, int mode,
if ((png_ptr->transformations & PNG_COMPOSE) != 0)
png_error(png_ptr,
- "conflicting calls to set alpha mode and background");
+ "conflicting calls to set alpha mode and background");
png_ptr->transformations |= PNG_COMPOSE;
}
@@ -385,7 +388,7 @@ void PNGAPI
png_set_alpha_mode(png_structrp png_ptr, int mode, double output_gamma)
{
png_set_alpha_mode_fixed(png_ptr, mode, convert_gamma_value(png_ptr,
- output_gamma));
+ output_gamma));
}
# endif
#endif
@@ -426,7 +429,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
int i;
png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr,
- (png_uint_32)(num_palette * (sizeof (png_byte))));
+ (png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
for (i = 0; i < num_palette; i++)
png_ptr->quantize_index[i] = (png_byte)i;
}
@@ -443,7 +446,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
/* Initialize an array to sort colors */
png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr,
- (png_uint_32)(num_palette * (sizeof (png_byte))));
+ (png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
/* Initialize the quantize_sort array */
for (i = 0; i < num_palette; i++)
@@ -577,9 +580,9 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
/* Initialize palette index arrays */
png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr,
- (png_uint_32)(num_palette * (sizeof (png_byte))));
+ (png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr,
- (png_uint_32)(num_palette * (sizeof (png_byte))));
+ (png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
/* Initialize the sort array */
for (i = 0; i < num_palette; i++)
@@ -799,7 +802,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
#ifdef PNG_READ_GAMMA_SUPPORTED
void PNGFAPI
png_set_gamma_fixed(png_structrp png_ptr, png_fixed_point scrn_gamma,
- png_fixed_point file_gamma)
+ png_fixed_point file_gamma)
{
png_debug(1, "in png_set_gamma_fixed");
@@ -841,7 +844,7 @@ void PNGAPI
png_set_gamma(png_structrp png_ptr, double scrn_gamma, double file_gamma)
{
png_set_gamma_fixed(png_ptr, convert_gamma_value(png_ptr, scrn_gamma),
- convert_gamma_value(png_ptr, file_gamma));
+ convert_gamma_value(png_ptr, file_gamma));
}
# endif /* FLOATING_POINT */
#endif /* READ_GAMMA */
@@ -987,7 +990,7 @@ png_set_rgb_to_gray_fixed(png_structrp png_ptr, int error_action,
* that it just worked and get a memory overwrite.
*/
png_error(png_ptr,
- "Cannot do RGB_TO_GRAY without EXPAND_SUPPORTED");
+ "Cannot do RGB_TO_GRAY without EXPAND_SUPPORTED");
/* png_ptr->transformations &= ~PNG_RGB_TO_GRAY; */
}
@@ -1014,7 +1017,7 @@ png_set_rgb_to_gray_fixed(png_structrp png_ptr, int error_action,
{
if (red >= 0 && green >= 0)
png_app_warning(png_ptr,
- "ignoring out of range rgb_to_gray coefficients");
+ "ignoring out of range rgb_to_gray coefficients");
/* Use the defaults, from the cHRM chunk if set, else the historical
* values which are close to the sRGB/HDTV/ITU-Rec 709 values. See
@@ -1023,7 +1026,7 @@ png_set_rgb_to_gray_fixed(png_structrp png_ptr, int error_action,
* something has already provided a default.
*/
if (png_ptr->rgb_to_gray_red_coeff == 0 &&
- png_ptr->rgb_to_gray_green_coeff == 0)
+ png_ptr->rgb_to_gray_green_coeff == 0)
{
png_ptr->rgb_to_gray_red_coeff = 6968;
png_ptr->rgb_to_gray_green_coeff = 23434;
@@ -1040,10 +1043,10 @@ png_set_rgb_to_gray_fixed(png_structrp png_ptr, int error_action,
void PNGAPI
png_set_rgb_to_gray(png_structrp png_ptr, int error_action, double red,
- double green)
+ double green)
{
png_set_rgb_to_gray_fixed(png_ptr, error_action,
- png_fixed(png_ptr, red, "rgb to gray red coefficient"),
+ png_fixed(png_ptr, red, "rgb to gray red coefficient"),
png_fixed(png_ptr, green, "rgb to gray green coefficient"));
}
#endif /* FLOATING POINT */
@@ -1300,7 +1303,7 @@ png_init_read_transformations(png_structrp png_ptr)
{
if (png_ptr->screen_gamma != 0) /* screen set too */
gamma_correction = png_gamma_threshold(png_ptr->colorspace.gamma,
- png_ptr->screen_gamma);
+ png_ptr->screen_gamma);
else
/* Assume the output matches the input; a long time default behavior
@@ -1581,7 +1584,7 @@ png_init_read_transformations(png_structrp png_ptr)
*/
if ((png_ptr->transformations & PNG_RGB_TO_GRAY) != 0)
png_warning(png_ptr,
- "libpng does not support gamma+background+rgb_to_gray");
+ "libpng does not support gamma+background+rgb_to_gray");
if ((png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) != 0)
{
@@ -1617,13 +1620,13 @@ png_init_read_transformations(png_structrp png_ptr)
case PNG_BACKGROUND_GAMMA_FILE:
g = png_reciprocal(png_ptr->colorspace.gamma);
gs = png_reciprocal2(png_ptr->colorspace.gamma,
- png_ptr->screen_gamma);
+ png_ptr->screen_gamma);
break;
case PNG_BACKGROUND_GAMMA_UNIQUE:
g = png_reciprocal(png_ptr->background_gamma);
gs = png_reciprocal2(png_ptr->background_gamma,
- png_ptr->screen_gamma);
+ png_ptr->screen_gamma);
break;
default:
g = PNG_FP_1; /* back_1 */
@@ -1651,11 +1654,11 @@ png_init_read_transformations(png_structrp png_ptr)
if (png_gamma_significant(g) != 0)
{
back_1.red = png_gamma_8bit_correct(png_ptr->background.red,
- g);
+ g);
back_1.green = png_gamma_8bit_correct(
- png_ptr->background.green, g);
+ png_ptr->background.green, g);
back_1.blue = png_gamma_8bit_correct(png_ptr->background.blue,
- g);
+ g);
}
else
@@ -1726,7 +1729,7 @@ png_init_read_transformations(png_structrp png_ptr)
case PNG_BACKGROUND_GAMMA_FILE:
g = png_reciprocal(png_ptr->colorspace.gamma);
gs = png_reciprocal2(png_ptr->colorspace.gamma,
- png_ptr->screen_gamma);
+ png_ptr->screen_gamma);
break;
case PNG_BACKGROUND_GAMMA_UNIQUE:
@@ -1912,7 +1915,7 @@ png_init_read_transformations(png_structrp png_ptr)
png_ptr->palette[i].blue = (png_byte)component;
}
}
-#endif /* READ_SHIFT */
+#endif /* READ_SHIFT */
}
/* Modify the info structure to reflect the transformations. The
@@ -2147,7 +2150,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
{
png_bytep sp = row + (png_size_t)((row_width - 1) >> 3);
png_bytep dp = row + (png_size_t)row_width - 1;
- png_uint_32 shift = 7 - (int)((row_width + 7) & 0x07);
+ png_uint_32 shift = 7U - ((row_width + 7U) & 0x07);
for (i = 0; i < row_width; i++)
{
*dp = (png_byte)((*sp >> shift) & 0x01);
@@ -2171,7 +2174,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
png_bytep sp = row + (png_size_t)((row_width - 1) >> 2);
png_bytep dp = row + (png_size_t)row_width - 1;
- png_uint_32 shift = (int)((3 - ((row_width + 3) & 0x03)) << 1);
+ png_uint_32 shift = ((3U - ((row_width + 3U) & 0x03)) << 1);
for (i = 0; i < row_width; i++)
{
*dp = (png_byte)((*sp >> shift) & 0x03);
@@ -2194,7 +2197,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
{
png_bytep sp = row + (png_size_t)((row_width - 1) >> 1);
png_bytep dp = row + (png_size_t)row_width - 1;
- png_uint_32 shift = (int)((1 - ((row_width + 1) & 0x01)) << 2);
+ png_uint_32 shift = ((1U - ((row_width + 1U) & 0x01)) << 2);
for (i = 0; i < row_width; i++)
{
*dp = (png_byte)((*sp >> shift) & 0x0f);
@@ -3220,7 +3223,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
== png_ptr->trans_color.gray)
{
unsigned int tmp = *sp & (0x7f7f >> (7 - shift));
- tmp |= png_ptr->background.gray << shift;
+ tmp |=
+ (unsigned int)(png_ptr->background.gray << shift);
*sp = (png_byte)(tmp & 0xff);
}
@@ -3249,7 +3253,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
== png_ptr->trans_color.gray)
{
unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
- tmp |= png_ptr->background.gray << shift;
+ tmp |=
+ (unsigned int)png_ptr->background.gray << shift;
*sp = (png_byte)(tmp & 0xff);
}
@@ -3259,7 +3264,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
unsigned int g = (gamma_table [p | (p << 2) |
(p << 4) | (p << 6)] >> 6) & 0x03;
unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
- tmp |= g << shift;
+ tmp |= (unsigned int)(g << shift);
*sp = (png_byte)(tmp & 0xff);
}
@@ -3285,7 +3290,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
== png_ptr->trans_color.gray)
{
unsigned int tmp = *sp & (0x3f3f >> (6 - shift));
- tmp |= png_ptr->background.gray << shift;
+ tmp |=
+ (unsigned int)png_ptr->background.gray << shift;
*sp = (png_byte)(tmp & 0xff);
}
@@ -3315,7 +3321,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
== png_ptr->trans_color.gray)
{
unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
- tmp |= png_ptr->background.gray << shift;
+ tmp |=
+ (unsigned int)(png_ptr->background.gray << shift);
*sp = (png_byte)(tmp & 0xff);
}
@@ -3325,7 +3332,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
unsigned int g = (gamma_table[p | (p << 4)] >> 4) &
0x0f;
unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
- tmp |= g << shift;
+ tmp |= (unsigned int)(g << shift);
*sp = (png_byte)(tmp & 0xff);
}
@@ -3351,7 +3358,8 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
== png_ptr->trans_color.gray)
{
unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
- tmp |= png_ptr->background.gray << shift;
+ tmp |=
+ (unsigned int)(png_ptr->background.gray << shift);
*sp = (png_byte)(tmp & 0xff);
}
@@ -4192,7 +4200,7 @@ png_do_encode_alpha(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
*/
static void
png_do_expand_palette(png_row_infop row_info, png_bytep row,
- png_const_colorp palette, png_const_bytep trans_alpha, int num_trans)
+ png_const_colorp palette, png_const_bytep trans_alpha, int num_trans)
{
int shift, value;
png_bytep sp, dp;
@@ -4499,7 +4507,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
row_info->channels = 2;
row_info->pixel_depth = (png_byte)(row_info->bit_depth << 1);
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,
- row_width);
+ row_width);
}
}
else if (row_info->color_type == PNG_COLOR_TYPE_RGB &&
@@ -4759,7 +4767,7 @@ png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info)
(row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA))
png_do_strip_channel(row_info, png_ptr->row_buf + 1,
- 0 /* at_start == false, because SWAP_ALPHA happens later */);
+ 0 /* at_start == false, because SWAP_ALPHA happens later */);
#endif
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
diff --git a/src/3rdparty/libpng/pngrutil.c b/src/3rdparty/libpng/pngrutil.c
index 6189251352..bee0ea1158 100644
--- a/src/3rdparty/libpng/pngrutil.c
+++ b/src/3rdparty/libpng/pngrutil.c
@@ -1,8 +1,8 @@
/* pngrutil.c - utilities to read a PNG file
*
- * Last changed in libpng 1.6.20 [December 3, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.27 [January 5, 2017]
+ * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -86,11 +86,11 @@ png_get_int_32)(png_const_bytep buf)
{
png_uint_32 uval = png_get_uint_32(buf);
if ((uval & 0x80000000) == 0) /* non-negative */
- return uval;
+ return (png_int_32)uval;
uval = (uval ^ 0xffffffff) + 1; /* 2's complement: -x = ~x+1 */
if ((uval & 0x80000000) == 0) /* no overflow */
- return -(png_int_32)uval;
+ return -(png_int_32)uval;
/* The following has to be safe; this function only gets called on PNG data
* and if we get here that data is invalid. 0 is the most safe value and
* if not then an attacker would surely just generate a PNG with 0 instead.
@@ -370,11 +370,10 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
*/
{
int ret; /* zlib return code */
-#if PNG_ZLIB_VERNUM >= 0x1240
+#if ZLIB_VERNUM >= 0x1240
+ int window_bits = 0;
# if defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_MAXIMUM_INFLATE_WINDOW)
- int window_bits;
-
if (((png_ptr->options >> PNG_MAXIMUM_INFLATE_WINDOW) & 3) ==
PNG_OPTION_ON)
{
@@ -384,13 +383,11 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
else
{
- window_bits = 0;
png_ptr->zstream_start = 1;
}
-# else
-# define window_bits 0
# endif
-#endif
+
+#endif /* ZLIB_VERNUM >= 0x1240 */
/* Set this for safety, just in case the previous owner left pointers to
* memory allocations.
@@ -402,25 +399,32 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) != 0)
{
-#if PNG_ZLIB_VERNUM < 0x1240
- ret = inflateReset(&png_ptr->zstream);
-#else
+#if ZLIB_VERNUM >= 0x1240
ret = inflateReset2(&png_ptr->zstream, window_bits);
+#else
+ ret = inflateReset(&png_ptr->zstream);
#endif
}
else
{
-#if PNG_ZLIB_VERNUM < 0x1240
- ret = inflateInit(&png_ptr->zstream);
-#else
+#if ZLIB_VERNUM >= 0x1240
ret = inflateInit2(&png_ptr->zstream, window_bits);
+#else
+ ret = inflateInit(&png_ptr->zstream);
#endif
if (ret == Z_OK)
png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED;
}
+#if ZLIB_VERNUM >= 0x1281 && \
+ defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32)
+ if (((png_ptr->options >> PNG_IGNORE_ADLER32) & 3) == PNG_OPTION_ON)
+ /* Turn off validation of the ADLER32 checksum in IDAT chunks */
+ ret = inflateValidate(&png_ptr->zstream, 0);
+#endif
+
if (ret == Z_OK)
png_ptr->zowner = owner;
@@ -435,7 +439,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
#endif
}
-#if PNG_ZLIB_VERNUM >= 0x1240
+#if ZLIB_VERNUM >= 0x1240
/* Handle the start of the inflate stream if we called inflateInit2(strm,0);
* in this case some zlib versions skip validation of the CINFO field and, in
* certain circumstances, libpng may end up displaying an invalid image, in
@@ -461,6 +465,7 @@ png_zlib_inflate(png_structrp png_ptr, int flush)
#endif /* Zlib >= 1.2.4 */
#ifdef PNG_READ_COMPRESSED_TEXT_SUPPORTED
+#if defined(PNG_READ_zTXt_SUPPORTED) || defined (PNG_READ_iTXt_SUPPORTED)
/* png_inflate now returns zlib error codes including Z_OK and Z_STREAM_END to
* allow the caller to do multiple calls if required. If the 'finish' flag is
* set Z_FINISH will be passed to the final inflate() call and Z_STREAM_END must
@@ -599,9 +604,9 @@ png_inflate(png_structrp png_ptr, png_uint_32 owner, int finish,
*/
static int
png_decompress_chunk(png_structrp png_ptr,
- png_uint_32 chunklength, png_uint_32 prefix_size,
- png_alloc_size_t *newlength /* must be initialized to the maximum! */,
- int terminate /*add a '\0' to the end of the uncompressed data*/)
+ png_uint_32 chunklength, png_uint_32 prefix_size,
+ png_alloc_size_t *newlength /* must be initialized to the maximum! */,
+ int terminate /*add a '\0' to the end of the uncompressed data*/)
{
/* TODO: implement different limits for different types of chunk.
*
@@ -638,8 +643,8 @@ png_decompress_chunk(png_structrp png_ptr,
png_uint_32 lzsize = chunklength - prefix_size;
ret = png_inflate(png_ptr, png_ptr->chunk_name, 1/*finish*/,
- /* input: */ png_ptr->read_buffer + prefix_size, &lzsize,
- /* output: */ NULL, newlength);
+ /* input: */ png_ptr->read_buffer + prefix_size, &lzsize,
+ /* output: */ NULL, newlength);
if (ret == Z_STREAM_END)
{
@@ -659,15 +664,15 @@ png_decompress_chunk(png_structrp png_ptr,
*/
png_alloc_size_t new_size = *newlength;
png_alloc_size_t buffer_size = prefix_size + new_size +
- (terminate != 0);
+ (terminate != 0);
png_bytep text = png_voidcast(png_bytep, png_malloc_base(png_ptr,
- buffer_size));
+ buffer_size));
if (text != NULL)
{
ret = png_inflate(png_ptr, png_ptr->chunk_name, 1/*finish*/,
- png_ptr->read_buffer + prefix_size, &lzsize,
- text + prefix_size, newlength);
+ png_ptr->read_buffer + prefix_size, &lzsize,
+ text + prefix_size, newlength);
if (ret == Z_STREAM_END)
{
@@ -712,7 +717,7 @@ png_decompress_chunk(png_structrp png_ptr,
* the extra space may otherwise be used as a Trojan Horse.
*/
if (ret == Z_STREAM_END &&
- chunklength - prefix_size != lzsize)
+ chunklength - prefix_size != lzsize)
png_chunk_benign_error(png_ptr, "extra compressed data");
}
@@ -754,6 +759,7 @@ png_decompress_chunk(png_structrp png_ptr,
return Z_MEM_ERROR;
}
}
+#endif /* READ_zTXt || READ_iTXt */
#endif /* READ_COMPRESSED_TEXT */
#ifdef PNG_READ_iCCP_SUPPORTED
@@ -762,8 +768,8 @@ png_decompress_chunk(png_structrp png_ptr,
*/
static int
png_inflate_read(png_structrp png_ptr, png_bytep read_buffer, uInt read_size,
- png_uint_32p chunk_bytes, png_bytep next_out, png_alloc_size_t *out_size,
- int finish)
+ png_uint_32p chunk_bytes, png_bytep next_out, png_alloc_size_t *out_size,
+ int finish)
{
if (png_ptr->zowner == png_ptr->chunk_name)
{
@@ -802,8 +808,8 @@ png_inflate_read(png_structrp png_ptr, png_bytep read_buffer, uInt read_size,
* the available output is produced; this allows reading of truncated
* streams.
*/
- ret = PNG_INFLATE(png_ptr,
- *chunk_bytes > 0 ? Z_NO_FLUSH : (finish ? Z_FINISH : Z_SYNC_FLUSH));
+ ret = PNG_INFLATE(png_ptr, *chunk_bytes > 0 ?
+ Z_NO_FLUSH : (finish ? Z_FINISH : Z_SYNC_FLUSH));
}
while (ret == Z_OK && (*out_size > 0 || png_ptr->zstream.avail_out > 0));
@@ -821,7 +827,7 @@ png_inflate_read(png_structrp png_ptr, png_bytep read_buffer, uInt read_size,
return Z_STREAM_ERROR;
}
}
-#endif
+#endif /* READ_iCCP */
/* Read and check the IDHR chunk */
@@ -1009,7 +1015,7 @@ png_handle_PLTE(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
#endif
{
- png_crc_finish(png_ptr, (int) length - num * 3);
+ png_crc_finish(png_ptr, (png_uint_32) (length - (unsigned int)num * 3));
}
#ifndef PNG_READ_OPT_PLTE_SUPPORTED
@@ -1292,7 +1298,7 @@ png_handle_cHRM(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
png_ptr->colorspace.flags |= PNG_COLORSPACE_FROM_cHRM;
(void)png_colorspace_set_chromaticities(png_ptr, &png_ptr->colorspace, &xy,
- 1/*prefer cHRM values*/);
+ 1/*prefer cHRM values*/);
png_colorspace_sync(png_ptr, info_ptr);
}
#endif
@@ -1432,8 +1438,8 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
png_ptr->zstream.next_in = (Bytef*)keyword + (keyword_length+2);
png_ptr->zstream.avail_in = read_length;
(void)png_inflate_read(png_ptr, local_buffer,
- (sizeof local_buffer), &length, profile_header, &size,
- 0/*finish: don't, because the output is too small*/);
+ (sizeof local_buffer), &length, profile_header, &size,
+ 0/*finish: don't, because the output is too small*/);
if (size == 0)
{
@@ -1443,14 +1449,14 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
png_get_uint_32(profile_header);
if (png_icc_check_length(png_ptr, &png_ptr->colorspace,
- keyword, profile_length) != 0)
+ keyword, profile_length) != 0)
{
/* The length is apparently ok, so we can check the 132
* byte header.
*/
if (png_icc_check_header(png_ptr, &png_ptr->colorspace,
- keyword, profile_length, profile_header,
- png_ptr->color_type) != 0)
+ keyword, profile_length, profile_header,
+ png_ptr->color_type) != 0)
{
/* Now read the tag table; a variable size buffer is
* needed at this point, allocate one for the whole
@@ -1458,20 +1464,20 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
* that none of these stuff will overflow.
*/
const png_uint_32 tag_count = png_get_uint_32(
- profile_header+128);
+ profile_header+128);
png_bytep profile = png_read_buffer(png_ptr,
- profile_length, 2/*silent*/);
+ profile_length, 2/*silent*/);
if (profile != NULL)
{
memcpy(profile, profile_header,
- (sizeof profile_header));
+ (sizeof profile_header));
size = 12 * tag_count;
(void)png_inflate_read(png_ptr, local_buffer,
- (sizeof local_buffer), &length,
- profile + (sizeof profile_header), &size, 0);
+ (sizeof local_buffer), &length,
+ profile + (sizeof profile_header), &size, 0);
/* Still expect a buffer error because we expect
* there to be some tag data!
@@ -1479,22 +1485,22 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
if (size == 0)
{
if (png_icc_check_tag_table(png_ptr,
- &png_ptr->colorspace, keyword, profile_length,
- profile) != 0)
+ &png_ptr->colorspace, keyword, profile_length,
+ profile) != 0)
{
/* The profile has been validated for basic
* security issues, so read the whole thing in.
*/
size = profile_length - (sizeof profile_header)
- - 12 * tag_count;
+ - 12 * tag_count;
(void)png_inflate_read(png_ptr, local_buffer,
- (sizeof local_buffer), &length,
- profile + (sizeof profile_header) +
- 12 * tag_count, &size, 1/*finish*/);
+ (sizeof local_buffer), &length,
+ profile + (sizeof profile_header) +
+ 12 * tag_count, &size, 1/*finish*/);
if (length > 0 && !(png_ptr->flags &
- PNG_FLAG_BENIGN_ERRORS_WARN))
+ PNG_FLAG_BENIGN_ERRORS_WARN))
errmsg = "extra compressed data";
/* But otherwise allow extra data: */
@@ -1506,34 +1512,34 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
* keep going.
*/
png_chunk_warning(png_ptr,
- "extra compressed data");
+ "extra compressed data");
}
png_crc_finish(png_ptr, length);
finished = 1;
-# ifdef PNG_sRGB_SUPPORTED
+# if defined(PNG_sRGB_SUPPORTED) && PNG_sRGB_PROFILE_CHECKS >= 0
/* Check for a match against sRGB */
png_icc_set_sRGB(png_ptr,
- &png_ptr->colorspace, profile,
- png_ptr->zstream.adler);
-# endif
+ &png_ptr->colorspace, profile,
+ png_ptr->zstream.adler);
+# endif
/* Steal the profile for info_ptr. */
if (info_ptr != NULL)
{
png_free_data(png_ptr, info_ptr,
- PNG_FREE_ICCP, 0);
+ PNG_FREE_ICCP, 0);
info_ptr->iccp_name = png_voidcast(char*,
- png_malloc_base(png_ptr,
- keyword_length+1));
+ png_malloc_base(png_ptr,
+ keyword_length+1));
if (info_ptr->iccp_name != NULL)
{
memcpy(info_ptr->iccp_name, keyword,
- keyword_length+1);
+ keyword_length+1);
info_ptr->iccp_proflen =
- profile_length;
+ profile_length;
info_ptr->iccp_profile = profile;
png_ptr->read_buffer = NULL; /*steal*/
info_ptr->free_me |= PNG_FREE_ICCP;
@@ -1715,13 +1721,13 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
data_length = length - (png_uint_32)(entry_start - buffer);
/* Integrity-check the data length */
- if ((data_length % entry_size) != 0)
+ if ((data_length % (unsigned int)entry_size) != 0)
{
png_warning(png_ptr, "sPLT chunk has bad length");
return;
}
- dl = (png_int_32)(data_length / entry_size);
+ dl = (png_uint_32)(data_length / (unsigned int)entry_size);
max_dl = PNG_SIZE_MAX / (sizeof (png_sPLT_entry));
if (dl > max_dl)
@@ -1730,10 +1736,10 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
return;
}
- new_palette.nentries = (png_int_32)(data_length / entry_size);
+ new_palette.nentries = (png_int_32)(data_length / (unsigned int)entry_size);
- new_palette.entries = (png_sPLT_entryp)png_malloc_warn(
- png_ptr, new_palette.nentries * (sizeof (png_sPLT_entry)));
+ new_palette.entries = (png_sPLT_entryp)png_malloc_warn(png_ptr,
+ (png_alloc_size_t) new_palette.nentries * (sizeof (png_sPLT_entry)));
if (new_palette.entries == NULL)
{
@@ -2270,7 +2276,7 @@ png_handle_pCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
}
png_set_pCAL(png_ptr, info_ptr, (png_charp)buffer, X0, X1, type, nparams,
- (png_charp)units, params);
+ (png_charp)units, params);
png_free(png_ptr, params);
}
@@ -2313,7 +2319,7 @@ png_handle_sCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
}
png_debug1(2, "Allocating and reading sCAL chunk data (%u bytes)",
- length + 1);
+ length + 1);
buffer = png_read_buffer(png_ptr, length+1, 2/*silent*/);
@@ -2365,7 +2371,7 @@ png_handle_sCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
else
/* This is the (only) success case. */
png_set_sCAL_s(png_ptr, info_ptr, buffer[0],
- (png_charp)buffer+1, (png_charp)buffer+heighti);
+ (png_charp)buffer+1, (png_charp)buffer+heighti);
}
}
#endif
@@ -2465,8 +2471,8 @@ png_handle_tEXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
if (buffer == NULL)
{
- png_chunk_benign_error(png_ptr, "out of memory");
- return;
+ png_chunk_benign_error(png_ptr, "out of memory");
+ return;
}
png_crc_read(png_ptr, buffer, length);
@@ -2573,7 +2579,7 @@ png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
* and text chunks.
*/
if (png_decompress_chunk(png_ptr, length, keyword_length+2,
- &uncompressed_length, 1/*terminate*/) == Z_STREAM_END)
+ &uncompressed_length, 1/*terminate*/) == Z_STREAM_END)
{
png_text text;
@@ -2713,7 +2719,7 @@ png_handle_iTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
* iCCP and text chunks.
*/
if (png_decompress_chunk(png_ptr, length, prefix_length,
- &uncompressed_length, 1/*terminate*/) == Z_STREAM_END)
+ &uncompressed_length, 1/*terminate*/) == Z_STREAM_END)
buffer = png_ptr->read_buffer;
else
@@ -2793,7 +2799,7 @@ png_cache_unknown_chunk(png_structrp png_ptr, png_uint_32 length)
{
/* Do a 'warn' here - it is handled below. */
png_ptr->unknown_chunk.data = png_voidcast(png_bytep,
- png_malloc_warn(png_ptr, length));
+ png_malloc_warn(png_ptr, length));
}
}
@@ -2818,7 +2824,7 @@ png_cache_unknown_chunk(png_structrp png_ptr, png_uint_32 length)
/* Handle an unknown, or known but disabled, chunk */
void /* PRIVATE */
png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
- png_uint_32 length, int keep)
+ png_uint_32 length, int keep)
{
int handled = 0; /* the chunk was handled */
@@ -2856,7 +2862,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
{
/* Callback to user unknown chunk handler */
int ret = (*(png_ptr->read_user_chunk_fn))(png_ptr,
- &png_ptr->unknown_chunk);
+ &png_ptr->unknown_chunk);
/* ret is:
* negative: An error occurred; png_chunk_error will be called.
@@ -2890,9 +2896,9 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
{
png_chunk_warning(png_ptr, "Saving unknown chunk:");
png_app_warning(png_ptr,
- "forcing save of an unhandled chunk;"
- " please call png_set_keep_unknown_chunks");
- /* with keep = PNG_HANDLE_CHUNK_IF_SAFE */
+ "forcing save of an unhandled chunk;"
+ " please call png_set_keep_unknown_chunks");
+ /* with keep = PNG_HANDLE_CHUNK_IF_SAFE */
}
# endif
keep = PNG_HANDLE_CHUNK_IF_SAFE;
@@ -2985,7 +2991,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
* out; store the chunk.
*/
png_set_unknown_chunks(png_ptr, info_ptr,
- &png_ptr->unknown_chunk, 1);
+ &png_ptr->unknown_chunk, 1);
handled = 1;
# ifdef PNG_USER_LIMITS_SUPPORTED
break;
@@ -3097,7 +3103,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
# ifdef PNG_READ_PACKSWAP_SUPPORTED
if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
/* little-endian byte */
- end_mask = 0xff << end_mask;
+ end_mask = (unsigned int)(0xff << end_mask);
else /* big-endian byte */
# endif
@@ -3418,8 +3424,8 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
/* Everything is aligned for png_uint_16 copies, but try for
* png_uint_32 first.
*/
- if (png_isaligned(dp, png_uint_32) != 0 &&
- png_isaligned(sp, png_uint_32) != 0 &&
+ if (png_isaligned(dp, png_uint_32) &&
+ png_isaligned(sp, png_uint_32) &&
bytes_to_copy % (sizeof (png_uint_32)) == 0 &&
bytes_to_jump % (sizeof (png_uint_32)) == 0)
{
@@ -3539,11 +3545,11 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
#ifdef PNG_READ_INTERLACING_SUPPORTED
void /* PRIVATE */
png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
- png_uint_32 transformations /* Because these may affect the byte layout */)
+ png_uint_32 transformations /* Because these may affect the byte layout */)
{
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Offset to next interlace block */
- static PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
+ static PNG_CONST unsigned int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
png_debug(1, "in png_do_read_interlace");
if (row != NULL && row_info != NULL)
@@ -3558,9 +3564,10 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
{
png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 3);
png_bytep dp = row + (png_size_t)((final_width - 1) >> 3);
- int sshift, dshift;
- int s_start, s_end, s_inc;
- int jstop = png_pass_inc[pass];
+ unsigned int sshift, dshift;
+ unsigned int s_start, s_end;
+ int s_inc;
+ int jstop = (int)png_pass_inc[pass];
png_byte v;
png_uint_32 i;
int j;
@@ -3568,8 +3575,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
#ifdef PNG_READ_PACKSWAP_SUPPORTED
if ((transformations & PNG_PACKSWAP) != 0)
{
- sshift = (int)((row_info->width + 7) & 0x07);
- dshift = (int)((final_width + 7) & 0x07);
+ sshift = ((row_info->width + 7) & 0x07);
+ dshift = ((final_width + 7) & 0x07);
s_start = 7;
s_end = 0;
s_inc = -1;
@@ -3578,8 +3585,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
else
#endif
{
- sshift = 7 - (int)((row_info->width + 7) & 0x07);
- dshift = 7 - (int)((final_width + 7) & 0x07);
+ sshift = 7 - ((row_info->width + 7) & 0x07);
+ dshift = 7 - ((final_width + 7) & 0x07);
s_start = 0;
s_end = 7;
s_inc = 1;
@@ -3591,7 +3598,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
for (j = 0; j < jstop; j++)
{
unsigned int tmp = *dp & (0x7f7f >> (7 - dshift));
- tmp |= v << dshift;
+ tmp |= (unsigned int)(v << dshift);
*dp = (png_byte)(tmp & 0xff);
if (dshift == s_end)
@@ -3601,7 +3608,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
}
else
- dshift += s_inc;
+ dshift = (unsigned int)((int)dshift + s_inc);
}
if (sshift == s_end)
@@ -3611,7 +3618,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
}
else
- sshift += s_inc;
+ sshift = (unsigned int)((int)sshift + s_inc);
}
break;
}
@@ -3620,16 +3627,17 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
{
png_bytep sp = row + (png_uint_32)((row_info->width - 1) >> 2);
png_bytep dp = row + (png_uint_32)((final_width - 1) >> 2);
- int sshift, dshift;
- int s_start, s_end, s_inc;
- int jstop = png_pass_inc[pass];
+ unsigned int sshift, dshift;
+ unsigned int s_start, s_end;
+ int s_inc;
+ int jstop = (int)png_pass_inc[pass];
png_uint_32 i;
#ifdef PNG_READ_PACKSWAP_SUPPORTED
if ((transformations & PNG_PACKSWAP) != 0)
{
- sshift = (int)(((row_info->width + 3) & 0x03) << 1);
- dshift = (int)(((final_width + 3) & 0x03) << 1);
+ sshift = (((row_info->width + 3) & 0x03) << 1);
+ dshift = (((final_width + 3) & 0x03) << 1);
s_start = 6;
s_end = 0;
s_inc = -2;
@@ -3638,8 +3646,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
else
#endif
{
- sshift = (int)((3 - ((row_info->width + 3) & 0x03)) << 1);
- dshift = (int)((3 - ((final_width + 3) & 0x03)) << 1);
+ sshift = ((3 - ((row_info->width + 3) & 0x03)) << 1);
+ dshift = ((3 - ((final_width + 3) & 0x03)) << 1);
s_start = 0;
s_end = 6;
s_inc = 2;
@@ -3654,7 +3662,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
for (j = 0; j < jstop; j++)
{
unsigned int tmp = *dp & (0x3f3f >> (6 - dshift));
- tmp |= v << dshift;
+ tmp |= (unsigned int)(v << dshift);
*dp = (png_byte)(tmp & 0xff);
if (dshift == s_end)
@@ -3664,7 +3672,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
}
else
- dshift += s_inc;
+ dshift = (unsigned int)((int)dshift + s_inc);
}
if (sshift == s_end)
@@ -3674,7 +3682,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
}
else
- sshift += s_inc;
+ sshift = (unsigned int)((int)sshift + s_inc);
}
break;
}
@@ -3683,16 +3691,17 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
{
png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 1);
png_bytep dp = row + (png_size_t)((final_width - 1) >> 1);
- int sshift, dshift;
- int s_start, s_end, s_inc;
+ unsigned int sshift, dshift;
+ unsigned int s_start, s_end;
+ int s_inc;
png_uint_32 i;
- int jstop = png_pass_inc[pass];
+ int jstop = (int)png_pass_inc[pass];
#ifdef PNG_READ_PACKSWAP_SUPPORTED
if ((transformations & PNG_PACKSWAP) != 0)
{
- sshift = (int)(((row_info->width + 1) & 0x01) << 2);
- dshift = (int)(((final_width + 1) & 0x01) << 2);
+ sshift = (((row_info->width + 1) & 0x01) << 2);
+ dshift = (((final_width + 1) & 0x01) << 2);
s_start = 4;
s_end = 0;
s_inc = -4;
@@ -3701,8 +3710,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
else
#endif
{
- sshift = (int)((1 - ((row_info->width + 1) & 0x01)) << 2);
- dshift = (int)((1 - ((final_width + 1) & 0x01)) << 2);
+ sshift = ((1 - ((row_info->width + 1) & 0x01)) << 2);
+ dshift = ((1 - ((final_width + 1) & 0x01)) << 2);
s_start = 0;
s_end = 4;
s_inc = 4;
@@ -3716,7 +3725,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
for (j = 0; j < jstop; j++)
{
unsigned int tmp = *dp & (0xf0f >> (4 - dshift));
- tmp |= v << dshift;
+ tmp |= (unsigned int)(v << dshift);
*dp = (png_byte)(tmp & 0xff);
if (dshift == s_end)
@@ -3726,7 +3735,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
}
else
- dshift += s_inc;
+ dshift = (unsigned int)((int)dshift + s_inc);
}
if (sshift == s_end)
@@ -3736,7 +3745,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
}
else
- sshift += s_inc;
+ sshift = (unsigned int)((int)sshift + s_inc);
}
break;
}
@@ -3750,7 +3759,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
png_bytep dp = row + (png_size_t)(final_width - 1) * pixel_bytes;
- int jstop = png_pass_inc[pass];
+ int jstop = (int)png_pass_inc[pass];
png_uint_32 i;
for (i = 0; i < row_info->width; i++)
@@ -3783,7 +3792,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
static void
png_read_filter_row_sub(png_row_infop row_info, png_bytep row,
- png_const_bytep prev_row)
+ png_const_bytep prev_row)
{
png_size_t i;
png_size_t istop = row_info->rowbytes;
@@ -3801,7 +3810,7 @@ png_read_filter_row_sub(png_row_infop row_info, png_bytep row,
static void
png_read_filter_row_up(png_row_infop row_info, png_bytep row,
- png_const_bytep prev_row)
+ png_const_bytep prev_row)
{
png_size_t i;
png_size_t istop = row_info->rowbytes;
@@ -3817,7 +3826,7 @@ png_read_filter_row_up(png_row_infop row_info, png_bytep row,
static void
png_read_filter_row_avg(png_row_infop row_info, png_bytep row,
- png_const_bytep prev_row)
+ png_const_bytep prev_row)
{
png_size_t i;
png_bytep rp = row;
@@ -3844,7 +3853,7 @@ png_read_filter_row_avg(png_row_infop row_info, png_bytep row,
static void
png_read_filter_row_paeth_1byte_pixel(png_row_infop row_info, png_bytep row,
- png_const_bytep prev_row)
+ png_const_bytep prev_row)
{
png_bytep rp_end = row + row_info->rowbytes;
int a, c;
@@ -3892,9 +3901,9 @@ png_read_filter_row_paeth_1byte_pixel(png_row_infop row_info, png_bytep row,
static void
png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
- png_const_bytep prev_row)
+ png_const_bytep prev_row)
{
- int bpp = (row_info->pixel_depth + 7) >> 3;
+ unsigned int bpp = (row_info->pixel_depth + 7) >> 3;
png_bytep rp_end = row + bpp;
/* Process the first pixel in the row completely (this is the same as 'up'
@@ -3907,7 +3916,7 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
}
/* Remainder */
- rp_end += row_info->rowbytes - bpp;
+ rp_end = rp_end + (row_info->rowbytes - bpp);
while (row < rp_end)
{
@@ -3977,7 +3986,7 @@ png_init_filter_functions(png_structrp pp)
void /* PRIVATE */
png_read_filter_row(png_structrp pp, png_row_infop row_info, png_bytep row,
- png_const_bytep prev_row, int filter)
+ png_const_bytep prev_row, int filter)
{
/* OPTIMIZATION: DO NOT MODIFY THIS FUNCTION, instead #define
* PNG_FILTER_OPTIMIZATIONS to a function that overrides the generic
@@ -3995,7 +4004,7 @@ png_read_filter_row(png_structrp pp, png_row_infop row_info, png_bytep row,
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
void /* PRIVATE */
png_read_IDAT_data(png_structrp png_ptr, png_bytep output,
- png_alloc_size_t avail_out)
+ png_alloc_size_t avail_out)
{
/* Loop reading IDATs and decompressing the result into output[avail_out] */
png_ptr->zstream.next_out = output;
@@ -4252,7 +4261,7 @@ png_read_start_row(png_structrp png_ptr)
/* Offset to next interlace block in the y direction */
static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
- int max_pixel_depth;
+ unsigned int max_pixel_depth;
png_size_t row_bytes;
png_debug(1, "in png_read_start_row");
@@ -4281,7 +4290,7 @@ png_read_start_row(png_structrp png_ptr)
png_ptr->iwidth = png_ptr->width;
}
- max_pixel_depth = png_ptr->pixel_depth;
+ max_pixel_depth = (unsigned int)png_ptr->pixel_depth;
/* WARNING: * png_read_transform_info (pngrtran.c) performs a simpler set of
* calculations to calculate the final pixel depth, then
@@ -4416,7 +4425,7 @@ png_read_start_row(png_structrp png_ptr)
defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
if ((png_ptr->transformations & PNG_USER_TRANSFORM) != 0)
{
- int user_pixel_depth = png_ptr->user_transform_depth *
+ unsigned int user_pixel_depth = png_ptr->user_transform_depth *
png_ptr->user_transform_channels;
if (user_pixel_depth > max_pixel_depth)
@@ -4438,7 +4447,7 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
* for safety's sake
*/
row_bytes = PNG_ROWBYTES(max_pixel_depth, row_bytes) +
- 1 + ((max_pixel_depth + 7) >> 3);
+ 1 + ((max_pixel_depth + 7) >> 3U);
#ifdef PNG_MAX_MALLOC_64K
if (row_bytes > (png_uint_32)65536L)
@@ -4447,42 +4456,42 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
if (row_bytes + 48 > png_ptr->old_big_row_buf_size)
{
- png_free(png_ptr, png_ptr->big_row_buf);
- png_free(png_ptr, png_ptr->big_prev_row);
+ png_free(png_ptr, png_ptr->big_row_buf);
+ png_free(png_ptr, png_ptr->big_prev_row);
- if (png_ptr->interlaced != 0)
- png_ptr->big_row_buf = (png_bytep)png_calloc(png_ptr,
- row_bytes + 48);
+ if (png_ptr->interlaced != 0)
+ png_ptr->big_row_buf = (png_bytep)png_calloc(png_ptr,
+ row_bytes + 48);
- else
- png_ptr->big_row_buf = (png_bytep)png_malloc(png_ptr, row_bytes + 48);
+ else
+ png_ptr->big_row_buf = (png_bytep)png_malloc(png_ptr, row_bytes + 48);
- png_ptr->big_prev_row = (png_bytep)png_malloc(png_ptr, row_bytes + 48);
+ png_ptr->big_prev_row = (png_bytep)png_malloc(png_ptr, row_bytes + 48);
#ifdef PNG_ALIGNED_MEMORY_SUPPORTED
- /* Use 16-byte aligned memory for row_buf with at least 16 bytes
- * of padding before and after row_buf; treat prev_row similarly.
- * NOTE: the alignment is to the start of the pixels, one beyond the start
- * of the buffer, because of the filter byte. Prior to libpng 1.5.6 this
- * was incorrect; the filter byte was aligned, which had the exact
- * opposite effect of that intended.
- */
- {
- png_bytep temp = png_ptr->big_row_buf + 32;
- int extra = (int)((temp - (png_bytep)0) & 0x0f);
- png_ptr->row_buf = temp - extra - 1/*filter byte*/;
-
- temp = png_ptr->big_prev_row + 32;
- extra = (int)((temp - (png_bytep)0) & 0x0f);
- png_ptr->prev_row = temp - extra - 1/*filter byte*/;
- }
+ /* Use 16-byte aligned memory for row_buf with at least 16 bytes
+ * of padding before and after row_buf; treat prev_row similarly.
+ * NOTE: the alignment is to the start of the pixels, one beyond the start
+ * of the buffer, because of the filter byte. Prior to libpng 1.5.6 this
+ * was incorrect; the filter byte was aligned, which had the exact
+ * opposite effect of that intended.
+ */
+ {
+ png_bytep temp = png_ptr->big_row_buf + 32;
+ int extra = (int)((temp - (png_bytep)0) & 0x0f);
+ png_ptr->row_buf = temp - extra - 1/*filter byte*/;
+
+ temp = png_ptr->big_prev_row + 32;
+ extra = (int)((temp - (png_bytep)0) & 0x0f);
+ png_ptr->prev_row = temp - extra - 1/*filter byte*/;
+ }
#else
- /* Use 31 bytes of padding before and 17 bytes after row_buf. */
- png_ptr->row_buf = png_ptr->big_row_buf + 31;
- png_ptr->prev_row = png_ptr->big_prev_row + 31;
+ /* Use 31 bytes of padding before and 17 bytes after row_buf. */
+ png_ptr->row_buf = png_ptr->big_row_buf + 31;
+ png_ptr->prev_row = png_ptr->big_prev_row + 31;
#endif
- png_ptr->old_big_row_buf_size = row_bytes + 48;
+ png_ptr->old_big_row_buf_size = row_bytes + 48;
}
#ifdef PNG_MAX_MALLOC_64K
@@ -4507,7 +4516,7 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
* does not, so free the read buffer now regardless; the sequential reader
* reallocates it on demand.
*/
- if (png_ptr->read_buffer != 0)
+ if (png_ptr->read_buffer != NULL)
{
png_bytep buffer = png_ptr->read_buffer;
diff --git a/src/3rdparty/libpng/pngset.c b/src/3rdparty/libpng/pngset.c
index 8fd7965fca..28ff3a064d 100644
--- a/src/3rdparty/libpng/pngset.c
+++ b/src/3rdparty/libpng/pngset.c
@@ -1,8 +1,8 @@
/* pngset.c - storage of image information into info struct
*
- * Last changed in libpng 1.6.19 [November 12, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.26 [October 20, 2016]
+ * Copyright (c) 1998-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -104,14 +104,14 @@ png_set_cHRM(png_const_structrp png_ptr, png_inforp info_ptr,
double green_x, double green_y, double blue_x, double blue_y)
{
png_set_cHRM_fixed(png_ptr, info_ptr,
- png_fixed(png_ptr, white_x, "cHRM White X"),
- png_fixed(png_ptr, white_y, "cHRM White Y"),
- png_fixed(png_ptr, red_x, "cHRM Red X"),
- png_fixed(png_ptr, red_y, "cHRM Red Y"),
- png_fixed(png_ptr, green_x, "cHRM Green X"),
- png_fixed(png_ptr, green_y, "cHRM Green Y"),
- png_fixed(png_ptr, blue_x, "cHRM Blue X"),
- png_fixed(png_ptr, blue_y, "cHRM Blue Y"));
+ png_fixed(png_ptr, white_x, "cHRM White X"),
+ png_fixed(png_ptr, white_y, "cHRM White Y"),
+ png_fixed(png_ptr, red_x, "cHRM Red X"),
+ png_fixed(png_ptr, red_y, "cHRM Red Y"),
+ png_fixed(png_ptr, green_x, "cHRM Green X"),
+ png_fixed(png_ptr, green_y, "cHRM Green Y"),
+ png_fixed(png_ptr, blue_x, "cHRM Blue X"),
+ png_fixed(png_ptr, blue_y, "cHRM Blue Y"));
}
void PNGAPI
@@ -120,15 +120,15 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X,
double blue_X, double blue_Y, double blue_Z)
{
png_set_cHRM_XYZ_fixed(png_ptr, info_ptr,
- png_fixed(png_ptr, red_X, "cHRM Red X"),
- png_fixed(png_ptr, red_Y, "cHRM Red Y"),
- png_fixed(png_ptr, red_Z, "cHRM Red Z"),
- png_fixed(png_ptr, green_X, "cHRM Green X"),
- png_fixed(png_ptr, green_Y, "cHRM Green Y"),
- png_fixed(png_ptr, green_Z, "cHRM Green Z"),
- png_fixed(png_ptr, blue_X, "cHRM Blue X"),
- png_fixed(png_ptr, blue_Y, "cHRM Blue Y"),
- png_fixed(png_ptr, blue_Z, "cHRM Blue Z"));
+ png_fixed(png_ptr, red_X, "cHRM Red X"),
+ png_fixed(png_ptr, red_Y, "cHRM Red Y"),
+ png_fixed(png_ptr, red_Z, "cHRM Red Z"),
+ png_fixed(png_ptr, green_X, "cHRM Green X"),
+ png_fixed(png_ptr, green_Y, "cHRM Green Y"),
+ png_fixed(png_ptr, green_Z, "cHRM Green Z"),
+ png_fixed(png_ptr, blue_X, "cHRM Blue X"),
+ png_fixed(png_ptr, blue_Y, "cHRM Blue Y"),
+ png_fixed(png_ptr, blue_Z, "cHRM Blue Z"));
}
# endif /* FLOATING_POINT */
@@ -283,17 +283,29 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
/* Check that the type matches the specification. */
if (type < 0 || type > 3)
- png_error(png_ptr, "Invalid pCAL equation type");
+ {
+ png_chunk_report(png_ptr, "Invalid pCAL equation type",
+ PNG_CHUNK_WRITE_ERROR);
+ return;
+ }
if (nparams < 0 || nparams > 255)
- png_error(png_ptr, "Invalid pCAL parameter count");
+ {
+ png_chunk_report(png_ptr, "Invalid pCAL parameter count",
+ PNG_CHUNK_WRITE_ERROR);
+ return;
+ }
/* Validate params[nparams] */
for (i=0; i<nparams; ++i)
{
if (params[i] == NULL ||
!png_check_fp_string(params[i], strlen(params[i])))
- png_error(png_ptr, "Invalid format for pCAL parameter");
+ {
+ png_chunk_report(png_ptr, "Invalid format for pCAL parameter",
+ PNG_CHUNK_WRITE_ERROR);
+ return;
+ }
}
info_ptr->pcal_purpose = png_voidcast(png_charp,
@@ -301,8 +313,8 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
if (info_ptr->pcal_purpose == NULL)
{
- png_warning(png_ptr, "Insufficient memory for pCAL purpose");
-
+ png_chunk_report(png_ptr, "Insufficient memory for pCAL purpose",
+ PNG_CHUNK_WRITE_ERROR);
return;
}
@@ -316,10 +328,10 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
length = strlen(units) + 1;
png_debug1(3, "allocating units for info (%lu bytes)",
- (unsigned long)length);
+ (unsigned long)length);
info_ptr->pcal_units = png_voidcast(png_charp,
- png_malloc_warn(png_ptr, length));
+ png_malloc_warn(png_ptr, length));
if (info_ptr->pcal_units == NULL)
{
@@ -331,7 +343,7 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
memcpy(info_ptr->pcal_units, units, length);
info_ptr->pcal_params = png_voidcast(png_charpp, png_malloc_warn(png_ptr,
- (png_size_t)((nparams + 1) * (sizeof (png_charp)))));
+ (png_size_t)(((unsigned int)nparams + 1) * (sizeof (png_charp)))));
if (info_ptr->pcal_params == NULL)
{
@@ -340,7 +352,8 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
return;
}
- memset(info_ptr->pcal_params, 0, (nparams + 1) * (sizeof (png_charp)));
+ memset(info_ptr->pcal_params, 0, ((unsigned int)nparams + 1) *
+ (sizeof (png_charp)));
for (i = 0; i < nparams; i++)
{
@@ -398,7 +411,7 @@ png_set_sCAL_s(png_const_structrp png_ptr, png_inforp info_ptr,
png_debug1(3, "allocating unit for info (%u bytes)", (unsigned int)lengthw);
info_ptr->scal_s_width = png_voidcast(png_charp,
- png_malloc_warn(png_ptr, lengthw));
+ png_malloc_warn(png_ptr, lengthw));
if (info_ptr->scal_s_width == NULL)
{
@@ -414,7 +427,7 @@ png_set_sCAL_s(png_const_structrp png_ptr, png_inforp info_ptr,
png_debug1(3, "allocating unit for info (%u bytes)", (unsigned int)lengthh);
info_ptr->scal_s_height = png_voidcast(png_charp,
- png_malloc_warn(png_ptr, lengthh));
+ png_malloc_warn(png_ptr, lengthh));
if (info_ptr->scal_s_height == NULL)
{
@@ -453,9 +466,9 @@ png_set_sCAL(png_const_structrp png_ptr, png_inforp info_ptr, int unit,
char sheight[PNG_sCAL_MAX_DIGITS+1];
png_ascii_from_fp(png_ptr, swidth, (sizeof swidth), width,
- PNG_sCAL_PRECISION);
+ PNG_sCAL_PRECISION);
png_ascii_from_fp(png_ptr, sheight, (sizeof sheight), height,
- PNG_sCAL_PRECISION);
+ PNG_sCAL_PRECISION);
png_set_sCAL_s(png_ptr, info_ptr, unit, swidth, sheight);
}
@@ -563,7 +576,8 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
PNG_MAX_PALETTE_LENGTH * (sizeof (png_color))));
if (num_palette > 0)
- memcpy(png_ptr->palette, palette, num_palette * (sizeof (png_color)));
+ memcpy(png_ptr->palette, palette, (unsigned int)num_palette *
+ (sizeof (png_color)));
info_ptr->palette = png_ptr->palette;
info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
@@ -648,7 +662,7 @@ png_set_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
*/
{
int result = png_colorspace_set_ICC(png_ptr, &info_ptr->colorspace, name,
- proflen, profile, info_ptr->color_type);
+ proflen, profile, info_ptr->color_type);
png_colorspace_sync_info(png_ptr, info_ptr);
@@ -673,7 +687,7 @@ png_set_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
memcpy(new_iccp_name, name, length);
new_iccp_profile = png_voidcast(png_bytep,
- png_malloc_warn(png_ptr, proflen));
+ png_malloc_warn(png_ptr, proflen));
if (new_iccp_profile == NULL)
{
@@ -748,14 +762,14 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
* the overflow checks.
*/
new_text = png_voidcast(png_textp,png_realloc_array(png_ptr,
- info_ptr->text, old_num_text, max_text-old_num_text,
- sizeof *new_text));
+ info_ptr->text, old_num_text, max_text-old_num_text,
+ sizeof *new_text));
}
if (new_text == NULL)
{
png_chunk_report(png_ptr, "too many text chunks",
- PNG_CHUNK_WRITE_ERROR);
+ PNG_CHUNK_WRITE_ERROR);
return 1;
}
@@ -783,7 +797,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
text_ptr[i].compression >= PNG_TEXT_COMPRESSION_LAST)
{
png_chunk_report(png_ptr, "text compression mode is out of range",
- PNG_CHUNK_WRITE_ERROR);
+ PNG_CHUNK_WRITE_ERROR);
continue;
}
@@ -815,7 +829,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
# else /* iTXt */
{
png_chunk_report(png_ptr, "iTXt chunk not supported",
- PNG_CHUNK_WRITE_ERROR);
+ PNG_CHUNK_WRITE_ERROR);
continue;
}
# endif
@@ -844,7 +858,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
if (textp->key == NULL)
{
png_chunk_report(png_ptr, "text chunk: out of memory",
- PNG_CHUNK_WRITE_ERROR);
+ PNG_CHUNK_WRITE_ERROR);
return 1;
}
@@ -952,12 +966,14 @@ png_set_tRNS(png_structrp png_ptr, png_inforp info_ptr,
png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
- /* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */
- png_ptr->trans_alpha = info_ptr->trans_alpha = png_voidcast(png_bytep,
- png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH));
-
if (num_trans > 0 && num_trans <= PNG_MAX_PALETTE_LENGTH)
+ {
+ /* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */
+ info_ptr->trans_alpha = png_voidcast(png_bytep,
+ png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH));
memcpy(info_ptr->trans_alpha, trans_alpha, (png_size_t)num_trans);
+ }
+ png_ptr->trans_alpha = info_ptr->trans_alpha;
}
if (trans_color != NULL)
@@ -974,7 +990,7 @@ png_set_tRNS(png_structrp png_ptr, png_inforp info_ptr,
trans_color->green > sample_max ||
trans_color->blue > sample_max)))
png_warning(png_ptr,
- "tRNS chunk has out-of-range samples for bit_depth");
+ "tRNS chunk has out-of-range samples for bit_depth");
}
#endif
@@ -1016,8 +1032,8 @@ png_set_sPLT(png_const_structrp png_ptr,
* overflows. Notice that the parameters are (int) and (size_t)
*/
np = png_voidcast(png_sPLT_tp,png_realloc_array(png_ptr,
- info_ptr->splt_palettes, info_ptr->splt_palettes_num, nentries,
- sizeof *np));
+ info_ptr->splt_palettes, info_ptr->splt_palettes_num, nentries,
+ sizeof *np));
if (np == NULL)
{
@@ -1078,7 +1094,7 @@ png_set_sPLT(png_const_structrp png_ptr,
* checked it when doing the allocation.
*/
memcpy(np->entries, entries->entries,
- entries->nentries * sizeof (png_sPLT_entry));
+ (unsigned int)entries->nentries * sizeof (png_sPLT_entry));
/* Note that 'continue' skips the advance of the out pointer and out
* count, so an invalid entry is not added.
@@ -1108,10 +1124,10 @@ check_location(png_const_structrp png_ptr, int location)
{
/* Write struct, so unknown chunks come from the app */
png_app_warning(png_ptr,
- "png_set_unknown_chunks now expects a valid location");
+ "png_set_unknown_chunks now expects a valid location");
/* Use the old behavior */
location = (png_byte)(png_ptr->mode &
- (PNG_HAVE_IHDR|PNG_HAVE_PLTE|PNG_AFTER_IDAT));
+ (PNG_HAVE_IHDR|PNG_HAVE_PLTE|PNG_AFTER_IDAT));
}
/* This need not be an internal error - if the app calls
@@ -1134,7 +1150,7 @@ check_location(png_const_structrp png_ptr, int location)
void PNGAPI
png_set_unknown_chunks(png_const_structrp png_ptr,
- png_inforp info_ptr, png_const_unknown_chunkp unknowns, int num_unknowns)
+ png_inforp info_ptr, png_const_unknown_chunkp unknowns, int num_unknowns)
{
png_unknown_chunkp np;
@@ -1173,13 +1189,13 @@ png_set_unknown_chunks(png_const_structrp png_ptr,
* appropriate to read or write.
*/
np = png_voidcast(png_unknown_chunkp, png_realloc_array(png_ptr,
- info_ptr->unknown_chunks, info_ptr->unknown_chunks_num, num_unknowns,
- sizeof *np));
+ info_ptr->unknown_chunks, info_ptr->unknown_chunks_num, num_unknowns,
+ sizeof *np));
if (np == NULL)
{
png_chunk_report(png_ptr, "too many unknown chunks",
- PNG_CHUNK_WRITE_ERROR);
+ PNG_CHUNK_WRITE_ERROR);
return;
}
@@ -1208,12 +1224,12 @@ png_set_unknown_chunks(png_const_structrp png_ptr,
else
{
np->data = png_voidcast(png_bytep,
- png_malloc_base(png_ptr, unknowns->size));
+ png_malloc_base(png_ptr, unknowns->size));
if (np->data == NULL)
{
png_chunk_report(png_ptr, "unknown chunk: out of memory",
- PNG_CHUNK_WRITE_ERROR);
+ PNG_CHUNK_WRITE_ERROR);
/* But just skip storing the unknown chunk */
continue;
}
@@ -1247,7 +1263,7 @@ png_set_unknown_chunk_location(png_const_structrp png_ptr, png_inforp info_ptr,
{
png_app_error(png_ptr, "invalid unknown chunk location");
/* Fake out the pre 1.6.0 behavior: */
- if ((location & PNG_HAVE_IDAT) != 0) /* undocumented! */
+ if (((unsigned int)location & PNG_HAVE_IDAT) != 0) /* undocumented! */
location = PNG_AFTER_IDAT;
else
@@ -1371,7 +1387,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
return;
}
- num_chunks = num_chunks_in;
+ num_chunks = (unsigned int)num_chunks_in;
}
old_num_chunks = png_ptr->num_chunk_list;
@@ -1420,7 +1436,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
for (i=0; i<num_chunks; ++i)
{
old_num_chunks = add_one_chunk(new_list, old_num_chunks,
- chunk_list+5*i, keep);
+ chunk_list+5*i, keep);
}
/* Now remove any spurious 'default' entries. */
@@ -1500,60 +1516,60 @@ png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr,
void PNGAPI
png_set_compression_buffer_size(png_structrp png_ptr, png_size_t size)
{
- if (png_ptr == NULL)
- return;
+ if (png_ptr == NULL)
+ return;
- if (size == 0 || size > PNG_UINT_31_MAX)
- png_error(png_ptr, "invalid compression buffer size");
+ if (size == 0 || size > PNG_UINT_31_MAX)
+ png_error(png_ptr, "invalid compression buffer size");
# ifdef PNG_SEQUENTIAL_READ_SUPPORTED
- if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
- {
- png_ptr->IDAT_read_size = (png_uint_32)size; /* checked above */
- return;
- }
+ if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
+ {
+ png_ptr->IDAT_read_size = (png_uint_32)size; /* checked above */
+ return;
+ }
# endif
# ifdef PNG_WRITE_SUPPORTED
- if ((png_ptr->mode & PNG_IS_READ_STRUCT) == 0)
+ if ((png_ptr->mode & PNG_IS_READ_STRUCT) == 0)
+ {
+ if (png_ptr->zowner != 0)
{
- if (png_ptr->zowner != 0)
- {
- png_warning(png_ptr,
- "Compression buffer size cannot be changed because it is in use");
+ png_warning(png_ptr,
+ "Compression buffer size cannot be changed because it is in use");
- return;
- }
+ return;
+ }
#ifndef __COVERITY__
- /* Some compilers complain that this is always false. However, it
- * can be true when integer overflow happens.
- */
- if (size > ZLIB_IO_MAX)
- {
- png_warning(png_ptr,
- "Compression buffer size limited to system maximum");
- size = ZLIB_IO_MAX; /* must fit */
- }
+ /* Some compilers complain that this is always false. However, it
+ * can be true when integer overflow happens.
+ */
+ if (size > ZLIB_IO_MAX)
+ {
+ png_warning(png_ptr,
+ "Compression buffer size limited to system maximum");
+ size = ZLIB_IO_MAX; /* must fit */
+ }
#endif
- if (size < 6)
- {
- /* Deflate will potentially go into an infinite loop on a SYNC_FLUSH
- * if this is permitted.
- */
- png_warning(png_ptr,
- "Compression buffer size cannot be reduced below 6");
+ if (size < 6)
+ {
+ /* Deflate will potentially go into an infinite loop on a SYNC_FLUSH
+ * if this is permitted.
+ */
+ png_warning(png_ptr,
+ "Compression buffer size cannot be reduced below 6");
- return;
- }
+ return;
+ }
- if (png_ptr->zbuffer_size != size)
- {
- png_free_buffer_list(png_ptr, &png_ptr->zbuffer_list);
- png_ptr->zbuffer_size = (uInt)size;
- }
+ if (png_ptr->zbuffer_size != size)
+ {
+ png_free_buffer_list(png_ptr, &png_ptr->zbuffer_list);
+ png_ptr->zbuffer_size = (uInt)size;
}
+ }
# endif
}
@@ -1561,7 +1577,7 @@ void PNGAPI
png_set_invalid(png_const_structrp png_ptr, png_inforp info_ptr, int mask)
{
if (png_ptr != NULL && info_ptr != NULL)
- info_ptr->valid &= ~mask;
+ info_ptr->valid &= (unsigned int)(~mask);
}
@@ -1644,4 +1660,92 @@ png_set_check_for_invalid_index(png_structrp png_ptr, int allowed)
png_ptr->num_palette_max = -1;
}
#endif
+
+#if defined(PNG_TEXT_SUPPORTED) || defined(PNG_pCAL_SUPPORTED) || \
+ defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)
+/* Check that the tEXt or zTXt keyword is valid per PNG 1.0 specification,
+ * and if invalid, correct the keyword rather than discarding the entire
+ * chunk. The PNG 1.0 specification requires keywords 1-79 characters in
+ * length, forbids leading or trailing whitespace, multiple internal spaces,
+ * and the non-break space (0x80) from ISO 8859-1. Returns keyword length.
+ *
+ * The 'new_key' buffer must be 80 characters in size (for the keyword plus a
+ * trailing '\0'). If this routine returns 0 then there was no keyword, or a
+ * valid one could not be generated, and the caller must png_error.
+ */
+png_uint_32 /* PRIVATE */
+png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
+{
+#ifdef PNG_WARNINGS_SUPPORTED
+ png_const_charp orig_key = key;
+#endif
+ png_uint_32 key_len = 0;
+ int bad_character = 0;
+ int space = 1;
+
+ png_debug(1, "in png_check_keyword");
+
+ if (key == NULL)
+ {
+ *new_key = 0;
+ return 0;
+ }
+
+ while (*key && key_len < 79)
+ {
+ png_byte ch = (png_byte)*key++;
+
+ if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
+ *new_key++ = ch, ++key_len, space = 0;
+
+ else if (space == 0)
+ {
+ /* A space or an invalid character when one wasn't seen immediately
+ * before; output just a space.
+ */
+ *new_key++ = 32, ++key_len, space = 1;
+
+ /* If the character was not a space then it is invalid. */
+ if (ch != 32)
+ bad_character = ch;
+ }
+
+ else if (bad_character == 0)
+ bad_character = ch; /* just skip it, record the first error */
+ }
+
+ if (key_len > 0 && space != 0) /* trailing space */
+ {
+ --key_len, --new_key;
+ if (bad_character == 0)
+ bad_character = 32;
+ }
+
+ /* Terminate the keyword */
+ *new_key = 0;
+
+ if (key_len == 0)
+ return 0;
+
+#ifdef PNG_WARNINGS_SUPPORTED
+ /* Try to only output one warning per keyword: */
+ if (*key != 0) /* keyword too long */
+ png_warning(png_ptr, "keyword truncated");
+
+ else if (bad_character != 0)
+ {
+ PNG_WARNING_PARAMETERS(p)
+
+ png_warning_parameter(p, 1, orig_key);
+ png_warning_parameter_signed(p, 2, PNG_NUMBER_FORMAT_02x, bad_character);
+
+ png_formatted_warning(png_ptr, p, "keyword \"@1\": bad character '0x@2'");
+ }
+#else /* !WARNINGS */
+ PNG_UNUSED(png_ptr)
+#endif /* !WARNINGS */
+
+ return key_len;
+}
+#endif /* TEXT || pCAL || iCCP || sPLT */
#endif /* READ || WRITE */
diff --git a/src/3rdparty/libpng/pngstruct.h b/src/3rdparty/libpng/pngstruct.h
index d0bcc7914a..749d7e35b1 100644
--- a/src/3rdparty/libpng/pngstruct.h
+++ b/src/3rdparty/libpng/pngstruct.h
@@ -1,8 +1,8 @@
/* pngstruct.h - header file for PNG reference library
*
- * Last changed in libpng 1.6.18 [July 23, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.28 [January 5, 2017]
+ * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -249,7 +249,7 @@ struct png_struct_def
png_byte filter; /* file filter type (always 0) */
png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
png_byte pass; /* current interlace pass (0 - 6) */
- png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */
+ png_byte do_filter; /* row filter flags (see PNG_FILTER_ in png.h ) */
png_byte color_type; /* color type of file */
png_byte bit_depth; /* bit depth of file */
png_byte usr_bit_depth; /* bit depth of users row: write only */
@@ -263,7 +263,7 @@ struct png_struct_def
/* pixel depth used for the row buffers */
png_byte transformed_pixel_depth;
/* pixel depth after read/write transforms */
-#if PNG_ZLIB_VERNUM >= 0x1240
+#if ZLIB_VERNUM >= 0x1240
png_byte zstream_start; /* at start of an input zlib stream */
#endif /* Zlib >= 1.2.4 */
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
@@ -353,7 +353,7 @@ struct png_struct_def
/* Options */
#ifdef PNG_SET_OPTION_SUPPORTED
- png_byte options; /* On/off state (up to 4 options) */
+ png_uint_32 options; /* On/off state (up to 16 options) */
#endif
#if PNG_LIBPNG_VER < 10700
diff --git a/src/3rdparty/libpng/pngtrans.c b/src/3rdparty/libpng/pngtrans.c
index 0c0d92d8fd..da7413fb80 100644
--- a/src/3rdparty/libpng/pngtrans.c
+++ b/src/3rdparty/libpng/pngtrans.c
@@ -1,8 +1,8 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
- * Last changed in libpng 1.6.18 [July 23, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.26 [October 20, 2016]
+ * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -172,13 +172,14 @@ png_set_filler(png_structrp png_ptr, png_uint_32 filler, int filler_loc)
* size!
*/
png_app_error(png_ptr,
- "png_set_filler is invalid for low bit depth gray output");
+ "png_set_filler is invalid for"
+ " low bit depth gray output");
return;
}
default:
png_app_error(png_ptr,
- "png_set_filler: inappropriate color type");
+ "png_set_filler: inappropriate color type");
return;
}
# else
@@ -594,7 +595,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
return; /* The filler channel has gone already */
/* Fix the rowbytes value. */
- row_info->rowbytes = dp-row;
+ row_info->rowbytes = (unsigned int)(dp-row);
}
#endif
@@ -692,7 +693,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
* and this calculation is used because it avoids warnings that other
* forms produced on either GCC or MSVC.
*/
- int padding = (-row_info->pixel_depth * row_info->width) & 7;
+ int padding = PNG_PADBITS(row_info->pixel_depth, row_info->width);
png_bytep rp = png_ptr->row_buf + row_info->rowbytes;
switch (row_info->bit_depth)
@@ -797,7 +798,7 @@ png_set_user_transform_info(png_structrp png_ptr, png_voidp
(png_ptr->flags & PNG_FLAG_ROW_INIT) != 0)
{
png_app_error(png_ptr,
- "info change after png_start_read_image or png_read_update_info");
+ "info change after png_start_read_image or png_read_update_info");
return;
}
#endif
diff --git a/src/3rdparty/libpng/pngwio.c b/src/3rdparty/libpng/pngwio.c
index db76e6b8d7..37c7c3a7f0 100644
--- a/src/3rdparty/libpng/pngwio.c
+++ b/src/3rdparty/libpng/pngwio.c
@@ -1,8 +1,8 @@
/* pngwio.c - functions for data output
*
- * Last changed in libpng 1.6.15 [November 20, 2014]
- * Copyright (c) 1998-2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.24 [August 4, 2016]
+ * Copyright (c) 1998-2002,2004,2006-2014,2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -35,7 +35,7 @@ png_write_data(png_structrp png_ptr, png_const_bytep data, png_size_t length)
/* NOTE: write_data_fn must not change the buffer! */
if (png_ptr->write_data_fn != NULL )
(*(png_ptr->write_data_fn))(png_ptr, png_constcast(png_bytep,data),
- length);
+ length);
else
png_error(png_ptr, "Call to NULL write function");
diff --git a/src/3rdparty/libpng/pngwrite.c b/src/3rdparty/libpng/pngwrite.c
index 0d4ee9f7ae..07088ee75e 100644
--- a/src/3rdparty/libpng/pngwrite.c
+++ b/src/3rdparty/libpng/pngwrite.c
@@ -1,8 +1,8 @@
/* pngwrite.c - general routines to write a PNG file
*
- * Last changed in libpng 1.6.19 [November 12, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.26 [October 20, 2016]
+ * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -12,9 +12,9 @@
*/
#include "pngpriv.h"
-#if defined(PNG_SIMPLIFIED_WRITE_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
+#ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
# include <errno.h>
-#endif
+#endif /* SIMPLIFIED_WRITE_STDIO */
#ifdef PNG_WRITE_SUPPORTED
@@ -22,7 +22,7 @@
/* Write out all the unknown chunks for the current given location */
static void
write_unknown_chunks(png_structrp png_ptr, png_const_inforp info_ptr,
- unsigned int where)
+ unsigned int where)
{
if (info_ptr->unknown_chunks_num != 0)
{
@@ -148,11 +148,11 @@ png_write_info_before_PLTE(png_structrp png_ptr, png_const_inforp info_ptr)
# ifdef PNG_WRITE_sRGB_SUPPORTED
if ((info_ptr->valid & PNG_INFO_sRGB) != 0)
png_app_warning(png_ptr,
- "profile matches sRGB but writing iCCP instead");
+ "profile matches sRGB but writing iCCP instead");
# endif
png_write_iCCP(png_ptr, info_ptr->iccp_name,
- info_ptr->iccp_profile);
+ info_ptr->iccp_profile);
}
# ifdef PNG_WRITE_sRGB_SUPPORTED
else
@@ -383,7 +383,7 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr)
for (i = 0; i < info_ptr->num_text; i++)
{
png_debug2(2, "Writing trailer text chunk %d, type %d", i,
- info_ptr->text[i].compression);
+ info_ptr->text[i].compression);
/* An internationalized chunk? */
if (info_ptr->text[i].compression > 0)
{
@@ -666,9 +666,9 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
{
- png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
- png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
- png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
+ png_uint_32 s0 = (png_uint_32)(*(rp ) << 8) | *(rp + 1);
+ png_uint_32 s1 = (png_uint_32)(*(rp + 2) << 8) | *(rp + 3);
+ png_uint_32 s2 = (png_uint_32)(*(rp + 4) << 8) | *(rp + 5);
png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
*(rp ) = (png_byte)(red >> 8);
@@ -693,7 +693,7 @@ png_write_row(png_structrp png_ptr, png_const_bytep row)
return;
png_debug2(1, "in png_write_row (row %u, pass %d)",
- png_ptr->row_number, png_ptr->pass);
+ png_ptr->row_number, png_ptr->pass);
/* Initialize transformations and other stuff if first time */
if (png_ptr->row_number == 0 && png_ptr->pass == 0)
@@ -901,7 +901,7 @@ png_set_flush(png_structrp png_ptr, int nrows)
if (png_ptr == NULL)
return;
- png_ptr->flush_dist = (nrows < 0 ? 0 : nrows);
+ png_ptr->flush_dist = (nrows < 0 ? 0 : (png_uint_32)nrows);
}
/* Flush the current output buffers now */
@@ -1069,7 +1069,7 @@ png_set_filter(png_structrp png_ptr, int method, int filters)
* is not available so the filter can't be used. Just warn here.
*/
png_app_warning(png_ptr,
- "png_set_filter: UP/AVG/PAETH cannot be added after start");
+ "png_set_filter: UP/AVG/PAETH cannot be added after start");
filters &= ~(PNG_FILTER_UP|PNG_FILTER_AVG|PNG_FILTER_PAETH);
}
@@ -1095,13 +1095,13 @@ png_set_filter(png_structrp png_ptr, int method, int filters)
if (png_ptr->try_row == NULL)
png_ptr->try_row = png_voidcast(png_bytep,
- png_malloc(png_ptr, buf_size));
+ png_malloc(png_ptr, buf_size));
if (num_filters > 1)
{
if (png_ptr->tst_row == NULL)
png_ptr->tst_row = png_voidcast(png_bytep,
- png_malloc(png_ptr, buf_size));
+ png_malloc(png_ptr, buf_size));
}
}
png_ptr->do_filter = (png_byte)filters;
@@ -1452,7 +1452,6 @@ png_write_png(png_structrp png_ptr, png_inforp info_ptr,
#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
-# ifdef PNG_STDIO_SUPPORTED /* currently required for png_image_write_* */
/* Initialize the write structure - general purpose utility. */
static int
png_image_write_init(png_imagep image)
@@ -1504,6 +1503,10 @@ typedef struct
png_const_voidp first_row;
ptrdiff_t row_bytes;
png_voidp local_row;
+ /* Byte count for memory writing */
+ png_bytep memory;
+ png_alloc_size_t memory_bytes; /* not used for STDIO */
+ png_alloc_size_t output_bytes; /* running total */
} png_image_write_control;
/* Write png_uint_16 input to a 16-bit PNG; the png_ptr has already been set to
@@ -1522,7 +1525,8 @@ png_write_image_16bit(png_voidp argument)
display->first_row);
png_uint_16p output_row = png_voidcast(png_uint_16p, display->local_row);
png_uint_16p row_end;
- const int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
+ const unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ?
+ 3 : 1;
int aindex = 0;
png_uint_32 y = image->height;
@@ -1536,9 +1540,9 @@ png_write_image_16bit(png_voidp argument)
++output_row;
}
else
- aindex = channels;
+ aindex = (int)channels;
# else
- aindex = channels;
+ aindex = (int)channels;
# endif
}
@@ -1551,7 +1555,7 @@ png_write_image_16bit(png_voidp argument)
*/
row_end = output_row + image->width * (channels+1);
- while (y-- > 0)
+ for (; y > 0; --y)
{
png_const_uint_16p in_ptr = input_row;
png_uint_16p out_ptr = output_row;
@@ -1572,7 +1576,7 @@ png_write_image_16bit(png_voidp argument)
if (alpha > 0 && alpha < 65535)
reciprocal = ((0xffff<<15)+(alpha>>1))/alpha;
- c = channels;
+ c = (int)channels;
do /* always at least one channel */
{
png_uint_16 component = *in_ptr++;
@@ -1607,7 +1611,7 @@ png_write_image_16bit(png_voidp argument)
}
png_write_row(png_ptr, png_voidcast(png_const_bytep, display->local_row));
- input_row += display->row_bytes/(sizeof (png_uint_16));
+ input_row += (png_uint_16)display->row_bytes/(sizeof (png_uint_16));
}
return 1;
@@ -1625,7 +1629,7 @@ png_write_image_16bit(png_voidp argument)
static png_byte
png_unpremultiply(png_uint_32 component, png_uint_32 alpha,
- png_uint_32 reciprocal/*from the above macro*/)
+ png_uint_32 reciprocal/*from the above macro*/)
{
/* The following gives 1.0 for an alpha of 0, which is fine, otherwise if 0/0
* is represented as some other value there is more likely to be a
@@ -1680,7 +1684,8 @@ png_write_image_8bit(png_voidp argument)
display->first_row);
png_bytep output_row = png_voidcast(png_bytep, display->local_row);
png_uint_32 y = image->height;
- const int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ? 3 : 1;
+ const unsigned int channels = (image->format & PNG_FORMAT_FLAG_COLOR) != 0 ?
+ 3 : 1;
if ((image->format & PNG_FORMAT_FLAG_ALPHA) != 0)
{
@@ -1697,12 +1702,12 @@ png_write_image_8bit(png_voidp argument)
else
# endif
- aindex = channels;
+ aindex = (int)channels;
/* Use row_end in place of a loop counter: */
row_end = output_row + image->width * (channels+1);
- while (y-- > 0)
+ for (; y > 0; --y)
{
png_const_uint_16p in_ptr = input_row;
png_bytep out_ptr = output_row;
@@ -1720,7 +1725,7 @@ png_write_image_8bit(png_voidp argument)
if (alphabyte > 0 && alphabyte < 255)
reciprocal = UNP_RECIPROCAL(alpha);
- c = channels;
+ c = (int)channels;
do /* always at least one channel */
*out_ptr++ = png_unpremultiply(*in_ptr++, alpha, reciprocal);
while (--c > 0);
@@ -1732,7 +1737,7 @@ png_write_image_8bit(png_voidp argument)
png_write_row(png_ptr, png_voidcast(png_const_bytep,
display->local_row));
- input_row += display->row_bytes/(sizeof (png_uint_16));
+ input_row += (png_uint_16)display->row_bytes/(sizeof (png_uint_16));
} /* while y */
}
@@ -1743,7 +1748,7 @@ png_write_image_8bit(png_voidp argument)
*/
png_bytep row_end = output_row + image->width * channels;
- while (y-- > 0)
+ for (; y > 0; --y)
{
png_const_uint_16p in_ptr = input_row;
png_bytep out_ptr = output_row;
@@ -1757,7 +1762,7 @@ png_write_image_8bit(png_voidp argument)
}
png_write_row(png_ptr, output_row);
- input_row += display->row_bytes/(sizeof (png_uint_16));
+ input_row += (png_uint_16)display->row_bytes/(sizeof (png_uint_16));
}
}
@@ -1774,7 +1779,7 @@ png_image_set_PLTE(png_image_write_control *display)
/* NOTE: the caller must check for cmap != NULL and entries != 0 */
const png_uint_32 format = image->format;
- const int channels = PNG_IMAGE_SAMPLE_CHANNELS(format);
+ const unsigned int channels = PNG_IMAGE_SAMPLE_CHANNELS(format);
# if defined(PNG_FORMAT_BGR_SUPPORTED) &&\
defined(PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED)
@@ -1806,7 +1811,7 @@ png_image_set_PLTE(png_image_write_control *display)
{
png_const_uint_16p entry = png_voidcast(png_const_uint_16p, cmap);
- entry += i * channels;
+ entry += (unsigned int)i * channels;
if ((channels & 1) != 0) /* no alpha */
{
@@ -1845,16 +1850,16 @@ png_image_set_PLTE(png_image_write_control *display)
if (channels >= 3) /* RGB */
{
palette[i].blue = png_unpremultiply(entry[afirst + (2 ^ bgr)],
- alpha, reciprocal);
+ alpha, reciprocal);
palette[i].green = png_unpremultiply(entry[afirst + 1], alpha,
- reciprocal);
+ reciprocal);
palette[i].red = png_unpremultiply(entry[afirst + bgr], alpha,
- reciprocal);
+ reciprocal);
}
else /* gray */
palette[i].blue = palette[i].red = palette[i].green =
- png_unpremultiply(entry[afirst], alpha, reciprocal);
+ png_unpremultiply(entry[afirst], alpha, reciprocal);
}
}
@@ -1862,7 +1867,7 @@ png_image_set_PLTE(png_image_write_control *display)
{
png_const_bytep entry = png_voidcast(png_const_bytep, cmap);
- entry += i * channels;
+ entry += (unsigned int)i * channels;
switch (channels)
{
@@ -1901,20 +1906,20 @@ png_image_set_PLTE(png_image_write_control *display)
# endif
png_set_PLTE(image->opaque->png_ptr, image->opaque->info_ptr, palette,
- entries);
+ entries);
if (num_trans > 0)
png_set_tRNS(image->opaque->png_ptr, image->opaque->info_ptr, tRNS,
- num_trans, NULL);
+ num_trans, NULL);
- image->colormap_entries = entries;
+ image->colormap_entries = (png_uint_32)entries;
}
static int
png_image_write_main(png_voidp argument)
{
png_image_write_control *display = png_voidcast(png_image_write_control*,
- argument);
+ argument);
png_imagep image = display->image;
png_structrp png_ptr = image->opaque->png_ptr;
png_inforp info_ptr = image->opaque->info_ptr;
@@ -1931,9 +1936,43 @@ png_image_write_main(png_voidp argument)
png_set_benign_errors(png_ptr, 0/*error*/);
# endif
- /* Default the 'row_stride' parameter if required. */
- if (display->row_stride == 0)
- display->row_stride = PNG_IMAGE_ROW_STRIDE(*image);
+ /* Default the 'row_stride' parameter if required, also check the row stride
+ * and total image size to ensure that they are within the system limits.
+ */
+ {
+ const unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format);
+
+ if (image->width <= 0x7fffffffU/channels) /* no overflow */
+ {
+ png_uint_32 check;
+ const png_uint_32 png_row_stride = image->width * channels;
+
+ if (display->row_stride == 0)
+ display->row_stride = (png_int_32)/*SAFE*/png_row_stride;
+
+ if (display->row_stride < 0)
+ check = (png_uint_32)(-display->row_stride);
+
+ else
+ check = (png_uint_32)display->row_stride;
+
+ if (check >= png_row_stride)
+ {
+ /* Now check for overflow of the image buffer calculation; this
+ * limits the whole image size to 32 bits for API compatibility with
+ * the current, 32-bit, PNG_IMAGE_BUFFER_SIZE macro.
+ */
+ if (image->height > 0xffffffffU/png_row_stride)
+ png_error(image->opaque->png_ptr, "memory image too large");
+ }
+
+ else
+ png_error(image->opaque->png_ptr, "supplied row stride too small");
+ }
+
+ else
+ png_error(image->opaque->png_ptr, "image row stride too large");
+ }
/* Set the required transforms then write the rows in the correct order. */
if ((format & PNG_FORMAT_FLAG_COLORMAP) != 0)
@@ -1943,24 +1982,24 @@ png_image_write_main(png_voidp argument)
png_uint_32 entries = image->colormap_entries;
png_set_IHDR(png_ptr, info_ptr, image->width, image->height,
- entries > 16 ? 8 : (entries > 4 ? 4 : (entries > 2 ? 2 : 1)),
- PNG_COLOR_TYPE_PALETTE, PNG_INTERLACE_NONE,
- PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
+ entries > 16 ? 8 : (entries > 4 ? 4 : (entries > 2 ? 2 : 1)),
+ PNG_COLOR_TYPE_PALETTE, PNG_INTERLACE_NONE,
+ PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
png_image_set_PLTE(display);
}
else
png_error(image->opaque->png_ptr,
- "no color-map for color-mapped image");
+ "no color-map for color-mapped image");
}
else
png_set_IHDR(png_ptr, info_ptr, image->width, image->height,
- write_16bit ? 16 : 8,
- ((format & PNG_FORMAT_FLAG_COLOR) ? PNG_COLOR_MASK_COLOR : 0) +
- ((format & PNG_FORMAT_FLAG_ALPHA) ? PNG_COLOR_MASK_ALPHA : 0),
- PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
+ write_16bit ? 16 : 8,
+ ((format & PNG_FORMAT_FLAG_COLOR) ? PNG_COLOR_MASK_COLOR : 0) +
+ ((format & PNG_FORMAT_FLAG_ALPHA) ? PNG_COLOR_MASK_ALPHA : 0),
+ PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
/* Counter-intuitively the data transformations must be called *after*
* png_write_info, not before as in the read code, but the 'set' functions
@@ -1975,11 +2014,11 @@ png_image_write_main(png_voidp argument)
if ((image->flags & PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB) == 0)
png_set_cHRM_fixed(png_ptr, info_ptr,
- /* color x y */
- /* white */ 31270, 32900,
- /* red */ 64000, 33000,
- /* green */ 30000, 60000,
- /* blue */ 15000, 6000
+ /* color x y */
+ /* white */ 31270, 32900,
+ /* red */ 64000, 33000,
+ /* green */ 30000, 60000,
+ /* blue */ 15000, 6000
);
}
@@ -2073,7 +2112,7 @@ png_image_write_main(png_voidp argument)
(colormap == 0 && display->convert_to_8bit != 0))
{
png_bytep row = png_voidcast(png_bytep, png_malloc(png_ptr,
- png_get_rowbytes(png_ptr, info_ptr)));
+ png_get_rowbytes(png_ptr, info_ptr)));
int result;
display->local_row = row;
@@ -2099,7 +2138,7 @@ png_image_write_main(png_voidp argument)
ptrdiff_t row_bytes = display->row_bytes;
png_uint_32 y = image->height;
- while (y-- > 0)
+ for (; y > 0; --y)
{
png_write_row(png_ptr, row);
row += row_bytes;
@@ -2110,14 +2149,130 @@ png_image_write_main(png_voidp argument)
return 1;
}
+
+static void (PNGCBAPI
+image_memory_write)(png_structp png_ptr, png_bytep/*const*/ data,
+ png_size_t size)
+{
+ png_image_write_control *display = png_voidcast(png_image_write_control*,
+ png_ptr->io_ptr/*backdoor: png_get_io_ptr(png_ptr)*/);
+ const png_alloc_size_t ob = display->output_bytes;
+
+ /* Check for overflow; this should never happen: */
+ if (size <= ((png_alloc_size_t)-1) - ob)
+ {
+ /* I don't think libpng ever does this, but just in case: */
+ if (size > 0)
+ {
+ if (display->memory_bytes >= ob+size) /* writing */
+ memcpy(display->memory+ob, data, size);
+
+ /* Always update the size: */
+ display->output_bytes = ob+size;
+ }
+ }
+
+ else
+ png_error(png_ptr, "png_image_write_to_memory: PNG too big");
+}
+
+static void (PNGCBAPI
+image_memory_flush)(png_structp png_ptr)
+{
+ PNG_UNUSED(png_ptr)
+}
+
+static int
+png_image_write_memory(png_voidp argument)
+{
+ png_image_write_control *display = png_voidcast(png_image_write_control*,
+ argument);
+
+ /* The rest of the memory-specific init and write_main in an error protected
+ * environment. This case needs to use callbacks for the write operations
+ * since libpng has no built in support for writing to memory.
+ */
+ png_set_write_fn(display->image->opaque->png_ptr, display/*io_ptr*/,
+ image_memory_write, image_memory_flush);
+
+ return png_image_write_main(display);
+}
+
+int PNGAPI
+png_image_write_to_memory(png_imagep image, void *memory,
+ png_alloc_size_t * PNG_RESTRICT memory_bytes, int convert_to_8bit,
+ const void *buffer, png_int_32 row_stride, const void *colormap)
+{
+ /* Write the image to the given buffer, or count the bytes if it is NULL */
+ if (image != NULL && image->version == PNG_IMAGE_VERSION)
+ {
+ if (memory_bytes != NULL && buffer != NULL)
+ {
+ /* This is to give the caller an easier error detection in the NULL
+ * case and guard against uninitialized variable problems:
+ */
+ if (memory == NULL)
+ *memory_bytes = 0;
+
+ if (png_image_write_init(image) != 0)
+ {
+ png_image_write_control display;
+ int result;
+
+ memset(&display, 0, (sizeof display));
+ display.image = image;
+ display.buffer = buffer;
+ display.row_stride = row_stride;
+ display.colormap = colormap;
+ display.convert_to_8bit = convert_to_8bit;
+ display.memory = png_voidcast(png_bytep, memory);
+ display.memory_bytes = *memory_bytes;
+ display.output_bytes = 0;
+
+ result = png_safe_execute(image, png_image_write_memory, &display);
+ png_image_free(image);
+
+ /* write_memory returns true even if we ran out of buffer. */
+ if (result)
+ {
+ /* On out-of-buffer this function returns '0' but still updates
+ * memory_bytes:
+ */
+ if (memory != NULL && display.output_bytes > *memory_bytes)
+ result = 0;
+
+ *memory_bytes = display.output_bytes;
+ }
+
+ return result;
+ }
+
+ else
+ return 0;
+ }
+
+ else
+ return png_image_error(image,
+ "png_image_write_to_memory: invalid argument");
+ }
+
+ else if (image != NULL)
+ return png_image_error(image,
+ "png_image_write_to_memory: incorrect PNG_IMAGE_VERSION");
+
+ else
+ return 0;
+}
+
+#ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
int PNGAPI
png_image_write_to_stdio(png_imagep image, FILE *file, int convert_to_8bit,
- const void *buffer, png_int_32 row_stride, const void *colormap)
+ const void *buffer, png_int_32 row_stride, const void *colormap)
{
/* Write the image to the given (FILE*). */
if (image != NULL && image->version == PNG_IMAGE_VERSION)
{
- if (file != NULL)
+ if (file != NULL && buffer != NULL)
{
if (png_image_write_init(image) != 0)
{
@@ -2148,12 +2303,12 @@ png_image_write_to_stdio(png_imagep image, FILE *file, int convert_to_8bit,
else
return png_image_error(image,
- "png_image_write_to_stdio: invalid argument");
+ "png_image_write_to_stdio: invalid argument");
}
else if (image != NULL)
return png_image_error(image,
- "png_image_write_to_stdio: incorrect PNG_IMAGE_VERSION");
+ "png_image_write_to_stdio: incorrect PNG_IMAGE_VERSION");
else
return 0;
@@ -2161,20 +2316,20 @@ png_image_write_to_stdio(png_imagep image, FILE *file, int convert_to_8bit,
int PNGAPI
png_image_write_to_file(png_imagep image, const char *file_name,
- int convert_to_8bit, const void *buffer, png_int_32 row_stride,
- const void *colormap)
+ int convert_to_8bit, const void *buffer, png_int_32 row_stride,
+ const void *colormap)
{
/* Write the image to the named file. */
if (image != NULL && image->version == PNG_IMAGE_VERSION)
{
- if (file_name != NULL)
+ if (file_name != NULL && buffer != NULL)
{
FILE *fp = fopen(file_name, "wb");
if (fp != NULL)
{
if (png_image_write_to_stdio(image, fp, convert_to_8bit, buffer,
- row_stride, colormap) != 0)
+ row_stride, colormap) != 0)
{
int error; /* from fflush/fclose */
@@ -2215,16 +2370,16 @@ png_image_write_to_file(png_imagep image, const char *file_name,
else
return png_image_error(image,
- "png_image_write_to_file: invalid argument");
+ "png_image_write_to_file: invalid argument");
}
else if (image != NULL)
return png_image_error(image,
- "png_image_write_to_file: incorrect PNG_IMAGE_VERSION");
+ "png_image_write_to_file: incorrect PNG_IMAGE_VERSION");
else
return 0;
}
-# endif /* STDIO */
+#endif /* SIMPLIFIED_WRITE_STDIO */
#endif /* SIMPLIFIED_WRITE */
#endif /* WRITE */
diff --git a/src/3rdparty/libpng/pngwtran.c b/src/3rdparty/libpng/pngwtran.c
index 5dc949157d..377b43e5ca 100644
--- a/src/3rdparty/libpng/pngwtran.c
+++ b/src/3rdparty/libpng/pngwtran.c
@@ -1,8 +1,8 @@
/* pngwtran.c - transforms the data in a row for PNG writers
*
- * Last changed in libpng 1.6.18 [July 23, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.26 [October 20, 2016]
+ * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -177,7 +177,7 @@ png_do_shift(png_row_infop row_info, png_bytep row,
if (row_info->color_type != PNG_COLOR_TYPE_PALETTE)
{
int shift_start[4], shift_dec[4];
- int channels = 0;
+ unsigned int channels = 0;
if ((row_info->color_type & PNG_COLOR_MASK_COLOR) != 0)
{
@@ -525,7 +525,7 @@ png_do_write_transformations(png_structrp png_ptr, png_row_infop row_info)
#ifdef PNG_WRITE_FILLER_SUPPORTED
if ((png_ptr->transformations & PNG_FILLER) != 0)
png_do_strip_channel(row_info, png_ptr->row_buf + 1,
- !(png_ptr->flags & PNG_FLAG_FILLER_AFTER));
+ !(png_ptr->flags & PNG_FLAG_FILLER_AFTER));
#endif
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
@@ -549,7 +549,7 @@ png_do_write_transformations(png_structrp png_ptr, png_row_infop row_info)
#ifdef PNG_WRITE_SHIFT_SUPPORTED
if ((png_ptr->transformations & PNG_SHIFT) != 0)
png_do_shift(row_info, png_ptr->row_buf + 1,
- &(png_ptr->shift));
+ &(png_ptr->shift));
#endif
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
diff --git a/src/3rdparty/libpng/pngwutil.c b/src/3rdparty/libpng/pngwutil.c
index 0ee102b5fb..d1a82d45e1 100644
--- a/src/3rdparty/libpng/pngwutil.c
+++ b/src/3rdparty/libpng/pngwutil.c
@@ -1,8 +1,8 @@
/* pngwutil.c - utilities to write a PNG file
*
- * Last changed in libpng 1.6.19 [November 12, 2015]
- * Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.26 [October 20, 2016]
+ * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -23,10 +23,10 @@
void PNGAPI
png_save_uint_32(png_bytep buf, png_uint_32 i)
{
- buf[0] = (png_byte)(i >> 24);
- buf[1] = (png_byte)(i >> 16);
- buf[2] = (png_byte)(i >> 8);
- buf[3] = (png_byte)(i );
+ buf[0] = (png_byte)((i >> 24) & 0xffU);
+ buf[1] = (png_byte)((i >> 16) & 0xffU);
+ buf[2] = (png_byte)((i >> 8) & 0xffU);
+ buf[3] = (png_byte)( i & 0xffU);
}
/* Place a 16-bit number into a buffer in PNG byte order.
@@ -36,8 +36,8 @@ png_save_uint_32(png_bytep buf, png_uint_32 i)
void PNGAPI
png_save_uint_16(png_bytep buf, unsigned int i)
{
- buf[0] = (png_byte)(i >> 8);
- buf[1] = (png_byte)(i );
+ buf[0] = (png_byte)((i >> 8) & 0xffU);
+ buf[1] = (png_byte)( i & 0xffU);
}
#endif
@@ -59,7 +59,7 @@ png_write_sig(png_structrp png_ptr)
/* Write the rest of the 8 byte signature */
png_write_data(png_ptr, &png_signature[png_ptr->sig_bytes],
- (png_size_t)(8 - png_ptr->sig_bytes));
+ (png_size_t)(8 - png_ptr->sig_bytes));
if (png_ptr->sig_bytes < 3)
png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE;
@@ -174,7 +174,7 @@ png_write_chunk_end(png_structrp png_ptr)
*/
static void
png_write_complete_chunk(png_structrp png_ptr, png_uint_32 chunk_name,
- png_const_bytep data, png_size_t length)
+ png_const_bytep data, png_size_t length)
{
if (png_ptr == NULL)
return;
@@ -191,10 +191,10 @@ png_write_complete_chunk(png_structrp png_ptr, png_uint_32 chunk_name,
/* This is the API that calls the internal function above. */
void PNGAPI
png_write_chunk(png_structrp png_ptr, png_const_bytep chunk_string,
- png_const_bytep data, png_size_t length)
+ png_const_bytep data, png_size_t length)
{
png_write_complete_chunk(png_ptr, PNG_CHUNK_FROM_STRING(chunk_string), data,
- length);
+ length);
}
/* This is used below to find the size of an image to pass to png_deflate_claim,
@@ -291,7 +291,7 @@ optimize_cmf(png_bytep data, png_alloc_size_t data_size)
/* Initialize the compressor for the appropriate type of compression. */
static int
png_deflate_claim(png_structrp png_ptr, png_uint_32 owner,
- png_alloc_size_t data_size)
+ png_alloc_size_t data_size)
{
if (png_ptr->zowner != 0)
{
@@ -408,7 +408,7 @@ png_deflate_claim(png_structrp png_ptr, png_uint_32 owner,
png_ptr->zstream.avail_out = 0;
/* Now initialize if required, setting the new parameters, otherwise just
- * to a simple reset to the previous parameters.
+ * do a simple reset to the previous parameters.
*/
if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) != 0)
ret = deflateReset(&png_ptr->zstream);
@@ -416,7 +416,7 @@ png_deflate_claim(png_structrp png_ptr, png_uint_32 owner,
else
{
ret = deflateInit2(&png_ptr->zstream, level, method, windowBits,
- memLevel, strategy);
+ memLevel, strategy);
if (ret == Z_OK)
png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED;
@@ -477,7 +477,7 @@ typedef struct
static void
png_text_compress_init(compression_state *comp, png_const_bytep input,
- png_alloc_size_t input_len)
+ png_alloc_size_t input_len)
{
comp->input = input;
comp->input_len = input_len;
@@ -487,7 +487,7 @@ png_text_compress_init(compression_state *comp, png_const_bytep input,
/* Compress the data in the compression state input */
static int
png_text_compress(png_structrp png_ptr, png_uint_32 chunk_name,
- compression_state *comp, png_uint_32 prefix_len)
+ compression_state *comp, png_uint_32 prefix_len)
{
int ret;
@@ -579,7 +579,7 @@ png_text_compress(png_structrp png_ptr, png_uint_32 chunk_name,
/* Compress the data */
ret = deflate(&png_ptr->zstream,
- input_len > 0 ? Z_NO_FLUSH : Z_FINISH);
+ input_len > 0 ? Z_NO_FLUSH : Z_FINISH);
/* Claw back input data that was not consumed (because avail_in is
* reset above every time round the loop).
@@ -665,90 +665,6 @@ png_write_compressed_data_out(png_structrp png_ptr, compression_state *comp)
}
#endif /* WRITE_COMPRESSED_TEXT */
-#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
- defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
-/* Check that the tEXt or zTXt keyword is valid per PNG 1.0 specification,
- * and if invalid, correct the keyword rather than discarding the entire
- * chunk. The PNG 1.0 specification requires keywords 1-79 characters in
- * length, forbids leading or trailing whitespace, multiple internal spaces,
- * and the non-break space (0x80) from ISO 8859-1. Returns keyword length.
- *
- * The 'new_key' buffer must be 80 characters in size (for the keyword plus a
- * trailing '\0'). If this routine returns 0 then there was no keyword, or a
- * valid one could not be generated, and the caller must png_error.
- */
-static png_uint_32
-png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
-{
- png_const_charp orig_key = key;
- png_uint_32 key_len = 0;
- int bad_character = 0;
- int space = 1;
-
- png_debug(1, "in png_check_keyword");
-
- if (key == NULL)
- {
- *new_key = 0;
- return 0;
- }
-
- while (*key && key_len < 79)
- {
- png_byte ch = (png_byte)*key++;
-
- if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
- *new_key++ = ch, ++key_len, space = 0;
-
- else if (space == 0)
- {
- /* A space or an invalid character when one wasn't seen immediately
- * before; output just a space.
- */
- *new_key++ = 32, ++key_len, space = 1;
-
- /* If the character was not a space then it is invalid. */
- if (ch != 32)
- bad_character = ch;
- }
-
- else if (bad_character == 0)
- bad_character = ch; /* just skip it, record the first error */
- }
-
- if (key_len > 0 && space != 0) /* trailing space */
- {
- --key_len, --new_key;
- if (bad_character == 0)
- bad_character = 32;
- }
-
- /* Terminate the keyword */
- *new_key = 0;
-
- if (key_len == 0)
- return 0;
-
-#ifdef PNG_WARNINGS_SUPPORTED
- /* Try to only output one warning per keyword: */
- if (*key != 0) /* keyword too long */
- png_warning(png_ptr, "keyword truncated");
-
- else if (bad_character != 0)
- {
- PNG_WARNING_PARAMETERS(p)
-
- png_warning_parameter(p, 1, orig_key);
- png_warning_parameter_signed(p, 2, PNG_NUMBER_FORMAT_02x, bad_character);
-
- png_formatted_warning(png_ptr, p, "keyword \"@1\": bad character '0x@2'");
- }
-#endif /* WARNINGS */
-
- return key_len;
-}
-#endif /* WRITE_TEXT || WRITE_pCAL || WRITE_iCCP || WRITE_sPLT */
-
/* Write the IHDR chunk, and update the png_struct with the necessary
* information. Note that the rest of this code depends upon this
* information being correct.
@@ -1009,7 +925,7 @@ png_write_PLTE(png_structrp png_ptr, png_const_colorp palette,
*/
void /* PRIVATE */
png_compress_IDAT(png_structrp png_ptr, png_const_bytep input,
- png_alloc_size_t input_len, int flush)
+ png_alloc_size_t input_len, int flush)
{
if (png_ptr->zowner != png_IDAT)
{
@@ -1021,7 +937,7 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input,
if (png_ptr->zbuffer_list == NULL)
{
png_ptr->zbuffer_list = png_voidcast(png_compression_bufferp,
- png_malloc(png_ptr, PNG_COMPRESSION_BUFFER_SIZE(png_ptr)));
+ png_malloc(png_ptr, PNG_COMPRESSION_BUFFER_SIZE(png_ptr)));
png_ptr->zbuffer_list->next = NULL;
}
@@ -1260,7 +1176,7 @@ png_write_sPLT(png_structrp png_ptr, png_const_sPLT_tp spalette)
png_byte new_name[80];
png_byte entrybuf[10];
png_size_t entry_size = (spalette->depth == 8 ? 6 : 10);
- png_size_t palette_size = entry_size * spalette->nentries;
+ png_size_t palette_size = entry_size * (png_size_t)spalette->nentries;
png_sPLT_entryp ep;
#ifndef PNG_POINTER_INDEXING_SUPPORTED
int i;
@@ -1442,7 +1358,7 @@ png_write_tRNS(png_structrp png_ptr, png_const_bytep trans_alpha,
/* Write the chunk out as it is */
png_write_complete_chunk(png_ptr, png_tRNS, trans_alpha,
- (png_size_t)num_trans);
+ (png_size_t)num_trans);
}
else if (color_type == PNG_COLOR_TYPE_GRAY)
@@ -1473,7 +1389,7 @@ png_write_tRNS(png_structrp png_ptr, png_const_bytep trans_alpha,
#endif
{
png_app_warning(png_ptr,
- "Ignoring attempt to write 16-bit tRNS chunk when bit_depth is 8");
+ "Ignoring attempt to write 16-bit tRNS chunk when bit_depth is 8");
return;
}
@@ -1525,7 +1441,8 @@ png_write_bKGD(png_structrp png_ptr, png_const_color_16p back, int color_type)
#endif
{
png_warning(png_ptr,
- "Ignoring attempt to write 16-bit bKGD chunk when bit_depth is 8");
+ "Ignoring attempt to write 16-bit bKGD chunk "
+ "when bit_depth is 8");
return;
}
@@ -1655,7 +1572,7 @@ png_write_zTXt(png_structrp png_ptr, png_const_charp key, png_const_charp text,
/* Compute the compressed data; do it now for the length */
png_text_compress_init(&comp, (png_const_bytep)text,
- text == NULL ? 0 : strlen(text));
+ text == NULL ? 0 : strlen(text));
if (png_text_compress(png_ptr, png_zTXt, &comp, key_len) != Z_OK)
png_error(png_ptr, png_ptr->zstream.msg);
@@ -1826,7 +1743,7 @@ png_write_pCAL(png_structrp png_ptr, png_charp purpose, png_int_32 X0,
total_len = purpose_len + units_len + 10;
params_len = (png_size_tp)png_malloc(png_ptr,
- (png_alloc_size_t)(nparams * (sizeof (png_size_t))));
+ (png_alloc_size_t)((png_alloc_size_t)nparams * (sizeof (png_size_t))));
/* Find the length of each parameter, making sure we don't count the
* null terminator for the last parameter.
@@ -2025,7 +1942,7 @@ png_write_start_row(png_structrp png_ptr)
*/
if ((filters & (PNG_FILTER_AVG | PNG_FILTER_UP | PNG_FILTER_PAETH)) != 0)
png_ptr->prev_row = png_voidcast(png_bytep,
- png_calloc(png_ptr, buf_size));
+ png_calloc(png_ptr, buf_size));
#endif /* WRITE_FILTER */
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
@@ -2328,7 +2245,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
*/
static void /* PRIVATE */
png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
- png_size_t row_bytes);
+ png_size_t row_bytes);
#ifdef PNG_WRITE_FILTER_SUPPORTED
static png_size_t /* PRIVATE */
@@ -2338,7 +2255,7 @@ png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp,
png_bytep rp, dp, lp;
png_size_t i;
png_size_t sum = 0;
- int v;
+ unsigned int v;
png_ptr->try_row[0] = PNG_FILTER_VALUE_SUB;
@@ -2346,14 +2263,22 @@ png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp,
i++, rp++, dp++)
{
v = *dp = *rp;
+#ifdef PNG_USE_ABS
+ sum += 128 - abs((int)v - 128);
+#else
sum += (v < 128) ? v : 256 - v;
+#endif
}
for (lp = png_ptr->row_buf + 1; i < row_bytes;
i++, rp++, lp++, dp++)
{
v = *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff);
+#ifdef PNG_USE_ABS
+ sum += 128 - abs((int)v - 128);
+#else
sum += (v < 128) ? v : 256 - v;
+#endif
if (sum > lmins) /* We are already worse, don't continue. */
break;
@@ -2362,6 +2287,28 @@ png_setup_sub_row(png_structrp png_ptr, const png_uint_32 bpp,
return (sum);
}
+static void /* PRIVATE */
+png_setup_sub_row_only(png_structrp png_ptr, const png_uint_32 bpp,
+ const png_size_t row_bytes)
+{
+ png_bytep rp, dp, lp;
+ png_size_t i;
+
+ png_ptr->try_row[0] = PNG_FILTER_VALUE_SUB;
+
+ for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1; i < bpp;
+ i++, rp++, dp++)
+ {
+ *dp = *rp;
+ }
+
+ for (lp = png_ptr->row_buf + 1; i < row_bytes;
+ i++, rp++, lp++, dp++)
+ {
+ *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff);
+ }
+}
+
static png_size_t /* PRIVATE */
png_setup_up_row(png_structrp png_ptr, const png_size_t row_bytes,
const png_size_t lmins)
@@ -2369,7 +2316,7 @@ png_setup_up_row(png_structrp png_ptr, const png_size_t row_bytes,
png_bytep rp, dp, pp;
png_size_t i;
png_size_t sum = 0;
- int v;
+ unsigned int v;
png_ptr->try_row[0] = PNG_FILTER_VALUE_UP;
@@ -2378,7 +2325,11 @@ png_setup_up_row(png_structrp png_ptr, const png_size_t row_bytes,
i++, rp++, pp++, dp++)
{
v = *dp = (png_byte)(((int)*rp - (int)*pp) & 0xff);
+#ifdef PNG_USE_ABS
+ sum += 128 - abs((int)v - 128);
+#else
sum += (v < 128) ? v : 256 - v;
+#endif
if (sum > lmins) /* We are already worse, don't continue. */
break;
@@ -2386,24 +2337,43 @@ png_setup_up_row(png_structrp png_ptr, const png_size_t row_bytes,
return (sum);
}
+static void /* PRIVATE */
+png_setup_up_row_only(png_structrp png_ptr, const png_size_t row_bytes)
+{
+ png_bytep rp, dp, pp;
+ png_size_t i;
+
+ png_ptr->try_row[0] = PNG_FILTER_VALUE_UP;
+
+ for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1,
+ pp = png_ptr->prev_row + 1; i < row_bytes;
+ i++, rp++, pp++, dp++)
+ {
+ *dp = (png_byte)(((int)*rp - (int)*pp) & 0xff);
+ }
+}
static png_size_t /* PRIVATE */
png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp,
- const png_size_t row_bytes, const png_size_t lmins)
+ const png_size_t row_bytes, const png_size_t lmins)
{
png_bytep rp, dp, pp, lp;
png_uint_32 i;
png_size_t sum = 0;
- int v;
+ unsigned int v;
png_ptr->try_row[0] = PNG_FILTER_VALUE_AVG;
for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1,
- pp = png_ptr->prev_row + 1; i < bpp; i++)
+ pp = png_ptr->prev_row + 1; i < bpp; i++)
{
v = *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff);
+#ifdef PNG_USE_ABS
+ sum += 128 - abs((int)v - 128);
+#else
sum += (v < 128) ? v : 256 - v;
+#endif
}
for (lp = png_ptr->row_buf + 1; i < row_bytes; i++)
@@ -2411,7 +2381,11 @@ png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp,
v = *dp++ = (png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2))
& 0xff);
+#ifdef PNG_USE_ABS
+ sum += 128 - abs((int)v - 128);
+#else
sum += (v < 128) ? v : 256 - v;
+#endif
if (sum > lmins) /* We are already worse, don't continue. */
break;
@@ -2419,6 +2393,27 @@ png_setup_avg_row(png_structrp png_ptr, const png_uint_32 bpp,
return (sum);
}
+static void /* PRIVATE */
+png_setup_avg_row_only(png_structrp png_ptr, const png_uint_32 bpp,
+ const png_size_t row_bytes)
+{
+ png_bytep rp, dp, pp, lp;
+ png_uint_32 i;
+
+ png_ptr->try_row[0] = PNG_FILTER_VALUE_AVG;
+
+ for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1,
+ pp = png_ptr->prev_row + 1; i < bpp; i++)
+ {
+ *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff);
+ }
+
+ for (lp = png_ptr->row_buf + 1; i < row_bytes; i++)
+ {
+ *dp++ = (png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2))
+ & 0xff);
+ }
+}
static png_size_t /* PRIVATE */
png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp,
@@ -2427,7 +2422,7 @@ png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp,
png_bytep rp, dp, pp, cp, lp;
png_size_t i;
png_size_t sum = 0;
- int v;
+ unsigned int v;
png_ptr->try_row[0] = PNG_FILTER_VALUE_PAETH;
@@ -2436,7 +2431,11 @@ png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp,
{
v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
+#ifdef PNG_USE_ABS
+ sum += 128 - abs((int)v - 128);
+#else
sum += (v < 128) ? v : 256 - v;
+#endif
}
for (lp = png_ptr->row_buf + 1, cp = png_ptr->prev_row + 1; i < row_bytes;
@@ -2465,7 +2464,11 @@ png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp,
v = *dp++ = (png_byte)(((int)*rp++ - p) & 0xff);
+#ifdef PNG_USE_ABS
+ sum += 128 - abs((int)v - 128);
+#else
sum += (v < 128) ? v : 256 - v;
+#endif
if (sum > lmins) /* We are already worse, don't continue. */
break;
@@ -2473,6 +2476,48 @@ png_setup_paeth_row(png_structrp png_ptr, const png_uint_32 bpp,
return (sum);
}
+static void /* PRIVATE */
+png_setup_paeth_row_only(png_structrp png_ptr, const png_uint_32 bpp,
+ const png_size_t row_bytes)
+{
+ png_bytep rp, dp, pp, cp, lp;
+ png_size_t i;
+
+ png_ptr->try_row[0] = PNG_FILTER_VALUE_PAETH;
+
+ for (i = 0, rp = png_ptr->row_buf + 1, dp = png_ptr->try_row + 1,
+ pp = png_ptr->prev_row + 1; i < bpp; i++)
+ {
+ *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
+ }
+
+ for (lp = png_ptr->row_buf + 1, cp = png_ptr->prev_row + 1; i < row_bytes;
+ i++)
+ {
+ int a, b, c, pa, pb, pc, p;
+
+ b = *pp++;
+ c = *cp++;
+ a = *lp++;
+
+ p = b - c;
+ pc = a - c;
+
+#ifdef PNG_USE_ABS
+ pa = abs(p);
+ pb = abs(pc);
+ pc = abs(p + pc);
+#else
+ pa = p < 0 ? -p : p;
+ pb = pc < 0 ? -pc : pc;
+ pc = (p + pc) < 0 ? -(p + pc) : p + pc;
+#endif
+
+ p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
+
+ *dp++ = (png_byte)(((int)*rp++ - p) & 0xff);
+ }
+}
#endif /* WRITE_FILTER */
void /* PRIVATE */
@@ -2481,7 +2526,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
#ifndef PNG_WRITE_FILTER_SUPPORTED
png_write_filtered_row(png_ptr, png_ptr->row_buf, row_info->rowbytes+1);
#else
- png_byte filter_to_do = png_ptr->do_filter;
+ unsigned int filter_to_do = png_ptr->do_filter;
png_bytep row_buf;
png_bytep best_row;
png_uint_32 bpp;
@@ -2527,32 +2572,33 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
*/
best_row = png_ptr->row_buf;
-
- if ((filter_to_do & PNG_FILTER_NONE) != 0 && filter_to_do != PNG_FILTER_NONE)
+ if (PNG_SIZE_MAX/128 <= row_bytes)
+ {
+ /* Overflow can occur in the calculation, just select the lowest set
+ * filter.
+ */
+ filter_to_do &= 0U-filter_to_do;
+ }
+ else if ((filter_to_do & PNG_FILTER_NONE) != 0 &&
+ filter_to_do != PNG_FILTER_NONE)
{
+ /* Overflow not possible and multiple filters in the list, including the
+ * 'none' filter.
+ */
png_bytep rp;
png_size_t sum = 0;
png_size_t i;
- int v;
+ unsigned int v;
- if (PNG_SIZE_MAX/128 <= row_bytes)
- {
- for (i = 0, rp = row_buf + 1; i < row_bytes; i++, rp++)
- {
- /* Check for overflow */
- if (sum > PNG_SIZE_MAX/128 - 256)
- break;
-
- v = *rp;
- sum += (v < 128) ? v : 256 - v;
- }
- }
- else /* Overflow is not possible */
{
for (i = 0, rp = row_buf + 1; i < row_bytes; i++, rp++)
{
v = *rp;
+#ifdef PNG_USE_ABS
+ sum += 128 - abs((int)v - 128);
+#else
sum += (v < 128) ? v : 256 - v;
+#endif
}
}
@@ -2563,7 +2609,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
if (filter_to_do == PNG_FILTER_SUB)
/* It's the only filter so no testing is needed */
{
- (void) png_setup_sub_row(png_ptr, bpp, row_bytes, mins);
+ png_setup_sub_row_only(png_ptr, bpp, row_bytes);
best_row = png_ptr->try_row;
}
@@ -2589,7 +2635,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
/* Up filter */
if (filter_to_do == PNG_FILTER_UP)
{
- (void) png_setup_up_row(png_ptr, row_bytes, mins);
+ png_setup_up_row_only(png_ptr, row_bytes);
best_row = png_ptr->try_row;
}
@@ -2615,7 +2661,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
/* Avg filter */
if (filter_to_do == PNG_FILTER_AVG)
{
- (void) png_setup_avg_row(png_ptr, bpp, row_bytes, mins);
+ png_setup_avg_row_only(png_ptr, bpp, row_bytes);
best_row = png_ptr->try_row;
}
@@ -2639,9 +2685,9 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
}
/* Paeth filter */
- if ((filter_to_do == PNG_FILTER_PAETH) != 0)
+ if (filter_to_do == PNG_FILTER_PAETH)
{
- (void) png_setup_paeth_row(png_ptr, bpp, row_bytes, mins);
+ png_setup_paeth_row_only(png_ptr, bpp, row_bytes);
best_row = png_ptr->try_row;
}
@@ -2673,7 +2719,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
/* Do the actual writing of a previously filtered row. */
static void
png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
- png_size_t full_row_length/*includes filter byte*/)
+ png_size_t full_row_length/*includes filter byte*/)
{
png_debug(1, "in png_write_filtered_row");
diff --git a/src/3rdparty/libpng/qt_attribution.json b/src/3rdparty/libpng/qt_attribution.json
index 93e73243af..5affffd298 100644
--- a/src/3rdparty/libpng/qt_attribution.json
+++ b/src/3rdparty/libpng/qt_attribution.json
@@ -6,10 +6,29 @@
"Description": "libpng is the official PNG reference library.",
"Homepage": "http://www.libpng.org/pub/png/libpng.html",
+ "Version": "1.6.28",
"License": "libpng License",
"LicenseId": "Libpng",
"LicenseFile": "LICENSE",
- "Copyright": "Copyright (c) 1998-2015 Glenn Randers-Pehrson
+ "Copyright": "Copyright (c) 1998-2017 Glenn Randers-Pehrson
+Copyright (c) 2000-2017 Simon-Pierre Cadieux
+Copyright (c) 2000-2017 Eric S. Raymond
+Copyright (c) 2000-2017 Mans Rullgard
+Copyright (c) 2000-2017 Cosmin Truta
+Copyright (c) 2000-2017 Gilles Vollant
+Copyright (c) 2000-2017 James Yu
+Copyright (c) 2000-2017 Mandar Sahastrabuddhe
+Copyright (c) 1998-2000 Tom Lane
+Copyright (c) 1998-2000 Willem van Schaik
Copyright (c) 1996-1997 Andreas Dilger
+Copyright (c) 1996-1997 John Bowler
+Copyright (c) 1996-1997 Kevin Bracey
+Copyright (c) 1996-1997 Sam Bushell
+Copyright (c) 1996-1997 Magnus Holmgren
+Copyright (c) 1996-1997 Greg Roelofs
+Copyright (c) 1996-1997 Tom Tanner
+Copyright (c) 1995-1996 Dave Martindale
+Copyright (c) 1995-1996 Paul Schmidt
+Copyright (c) 1995-1996 Tim Wegner
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."
}
diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp
index d09c7658d4..d0deed4cc8 100644
--- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp
+++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp
@@ -141,12 +141,12 @@ QFuture<QImage> collage = QtConcurrent::filteredReduced(images, &QImage::isGrays
//! [9]
-bool QString::contains(const QRegExp &regexp) const;
+bool QString::contains(const QRegularExpression &regexp) const;
//! [9]
//! [10]
-std::bind(&QString::contains, QRegExp("^\\S+$")); // matches strings without whitespace
+std::bind(&QString::contains, QRegularExpression("^\\S+$")); // matches strings without whitespace
//! [10]
@@ -157,7 +157,7 @@ bool contains(const QString &string)
//! [12]
QStringList strings = ...;
-std::bind(static_cast<bool(QString::*)(const QRegExp&)>( &QString::contains ), QRegExp("..." ));
+std::bind(static_cast<bool(QString::*)(const QRegularExpression&)>( &QString::contains ), QRegularExpression("..."));
//! [12]
//! [13]
diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake
index 23909c9f3f..489bc75511 100644
--- a/src/corelib/Qt5CoreMacros.cmake
+++ b/src/corelib/Qt5CoreMacros.cmake
@@ -91,7 +91,7 @@ macro(QT5_GET_MOC_FLAGS _moc_flags)
set(${_moc_flags} ${${_moc_flags}} -DWIN32)
endif()
if (MSVC)
- set(${_moc_flags} --compiler-flavor=msvc)
+ set(${_moc_flags} ${${_moc_flags}} --compiler-flavor=msvc)
endif()
endmacro()
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index a9922bb31d..8a8d781cf8 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -564,7 +564,7 @@
# endif
#endif
-#ifdef Q_CC_INTEL
+#if defined(Q_CC_INTEL) && !defined(Q_CC_MSVC)
# define Q_COMPILER_RESTRICTED_VLA
# define Q_COMPILER_VARIADIC_MACROS // C++11 feature supported as an extension in other modes, too
# define Q_COMPILER_THREADSAFE_STATICS
@@ -653,7 +653,7 @@
# endif
#endif
-#if defined(Q_CC_CLANG) && !defined(Q_CC_INTEL)
+#if defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) && !defined(Q_CC_MSVC)
/* General C++ features */
# define Q_COMPILER_RESTRICTED_VLA
# define Q_COMPILER_THREADSAFE_STATICS
@@ -899,7 +899,7 @@
# endif
#endif
-#if defined(Q_CC_MSVC) && !defined(Q_CC_INTEL)
+#if defined(Q_CC_MSVC)
# if defined(__cplusplus)
# if _MSC_VER >= 1400
/* C++11 features supported in VC8 = VC2005: */
@@ -1045,34 +1045,6 @@
# define __USE_CONSTEXPR 1
# define __USE_NOEXCEPT 1
# endif
-# if defined(Q_CC_MSVC) && defined(Q_CC_CLANG)
-// Clang and the Intel compiler support more C++ features than the Microsoft compiler
-// so make sure we don't enable them if the MS headers aren't properly adapted.
-# ifndef _HAS_CONSTEXPR
-# undef Q_COMPILER_CONSTEXPR
-# endif
-# ifndef _HAS_DECLTYPE
-# undef Q_COMPILER_DECLTYPE
-# endif
-# ifndef _HAS_INITIALIZER_LISTS
-# undef Q_COMPILER_INITIALIZER_LISTS
-# endif
-# ifndef _HAS_NULLPTR_T
-# undef Q_COMPILER_NULLPTR
-# endif
-# ifndef _HAS_RVALUE_REFERENCES
-# undef Q_COMPILER_RVALUE_REFS
-# endif
-# ifndef _HAS_SCOPED_ENUM
-# undef Q_COMPILER_CLASS_ENUM
-# endif
-# ifndef _HAS_TEMPLATE_ALIAS
-# undef Q_COMPILER_TEMPLATE_ALIAS
-# endif
-# ifndef _HAS_VARIADIC_TEMPLATES
-# undef Q_COMPILER_VARIADIC_TEMPLATES
-# endif
-# endif
# if defined(Q_COMPILER_THREADSAFE_STATICS) && defined(Q_OS_MAC)
// Apple's low-level implementation of the C++ support library
// (libc++abi.dylib, shared between libstdc++ and libc++) has deadlocks. The
diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h
index 93dbedc930..feeb488acd 100644
--- a/src/corelib/global/qflags.h
+++ b/src/corelib/global/qflags.h
@@ -48,6 +48,8 @@
QT_BEGIN_NAMESPACE
+class QDataStream;
+
class QFlag
{
int i;
@@ -95,6 +97,8 @@ class QFlags
struct Private;
typedef int (Private::*Zero);
+ template <typename E> friend QDataStream &operator>>(QDataStream &, QFlags<E> &);
+ template <typename E> friend QDataStream &operator<<(QDataStream &, QFlags<E>);
public:
#if defined(Q_CC_MSVC) || defined(Q_QDOC)
// see above for MSVC
diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h
index 5059108fb8..67c062d349 100644
--- a/src/corelib/global/qfloat16.h
+++ b/src/corelib/global/qfloat16.h
@@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE
#if 0
#pragma qt_class(QFloat16)
+#pragma qt_no_master_include
#endif
class qfloat16
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 010f2c18c4..153d7466ed 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -133,7 +133,7 @@ Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined in
/*!
\fn QFlag::QFlag(uint value)
- \since Qt 5.3
+ \since 5.3
Constructs a QFlag object that stores the given \a value.
*/
@@ -147,7 +147,7 @@ Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined in
/*!
\fn QFlag::QFlag(ushort value)
- \since Qt 5.3
+ \since 5.3
Constructs a QFlag object that stores the given \a value.
*/
@@ -160,7 +160,7 @@ Q_STATIC_ASSERT_X(QT_POINTER_SIZE == sizeof(void *), "QT_POINTER_SIZE defined in
/*!
\fn QFlag::operator uint() const
- \since Qt 5.3
+ \since 5.3
Returns the value stored by the QFlag object.
*/
diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h
index 62add95533..2291675501 100644
--- a/src/corelib/global/qnumeric_p.h
+++ b/src/corelib/global/qnumeric_p.h
@@ -66,7 +66,7 @@
#include <float.h>
#endif
-#if !defined(Q_CC_MSVC) && (defined(Q_OS_QNX) || defined(Q_CC_INTEL) || !defined(__cplusplus))
+#if !defined(Q_CC_MSVC) && (defined(Q_OS_QNX) || defined(Q_CC_INTEL))
# include <math.h>
# ifdef isnan
# define QT_MATH_H_DEFINES_MACROS
@@ -92,14 +92,7 @@ QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
namespace qnumeric_std_wrapper {
-#if defined(Q_CC_MSVC) && _MSC_VER < 1800
-static inline bool isnan(double d) { return !!_isnan(d); }
-static inline bool isinf(double d) { return !_finite(d) && !_isnan(d); }
-static inline bool isfinite(double d) { return !!_finite(d); }
-static inline bool isnan(float f) { return !!_isnan(f); }
-static inline bool isinf(float f) { return !_finite(f) && !_isnan(f); }
-static inline bool isfinite(float f) { return !!_finite(f); }
-#elif defined(QT_MATH_H_DEFINES_MACROS)
+#if defined(QT_MATH_H_DEFINES_MACROS)
# undef QT_MATH_H_DEFINES_MACROS
static inline bool isnan(double d) { return math_h_isnan(d); }
static inline bool isinf(double d) { return math_h_isinf(d); }
diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h
index 31507fdf73..993a20fcd3 100644
--- a/src/corelib/io/qdatastream.h
+++ b/src/corelib/io/qdatastream.h
@@ -360,6 +360,14 @@ inline QDataStream &QDataStream::operator<<(quint32 i)
inline QDataStream &QDataStream::operator<<(quint64 i)
{ return *this << qint64(i); }
+template <typename Enum>
+inline QDataStream &operator<<(QDataStream &s, QFlags<Enum> e)
+{ return s << e.i; }
+
+template <typename Enum>
+inline QDataStream &operator>>(QDataStream &s, QFlags<Enum> &e)
+{ return s >> e.i; }
+
template <typename T>
inline QDataStream &operator>>(QDataStream &s, QList<T> &l)
{
diff --git a/src/corelib/io/qfiledevice.cpp b/src/corelib/io/qfiledevice.cpp
index 20cfa5bdaf..ce9c8275ce 100644
--- a/src/corelib/io/qfiledevice.cpp
+++ b/src/corelib/io/qfiledevice.cpp
@@ -328,6 +328,9 @@ void QFileDevice::close()
d->lastWasWrite = false;
d->writeBuffer.clear();
+ // reset cached size
+ d->cachedSize = 0;
+
// keep earlier error from flush
if (d->fileEngine->close() && flushed)
unsetError();
diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp
index eaebbc1ffc..b8d1919ee6 100644
--- a/src/corelib/io/qloggingregistry.cpp
+++ b/src/corelib/io/qloggingregistry.cpp
@@ -365,7 +365,12 @@ void QLoggingRegistry::setApiRules(const QString &content)
*/
void QLoggingRegistry::updateRules()
{
- rules = qtConfigRules + configRules + apiRules + envRules;
+ rules.clear();
+ rules.reserve(qtConfigRules.size() + configRules.size() + apiRules.size() + envRules.size()),
+ rules += qtConfigRules;
+ rules += configRules;
+ rules += apiRules;
+ rules += envRules;
for (auto it = categories.keyBegin(), end = categories.keyEnd(); it != end; ++it)
(*categoryFilter)(*it);
diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp
index dcaefd1613..e4631bad12 100644
--- a/src/corelib/io/qsettings_mac.cpp
+++ b/src/corelib/io/qsettings_mac.cpp
@@ -269,8 +269,10 @@ static QVariant qtValue(CFPropertyListRef cfvalue)
// Fast-path for QByteArray, so that we don't have to go
// though the expensive and lossy conversion via UTF-8.
- if (!byteArray.startsWith('@'))
+ if (!byteArray.startsWith('@')) {
+ byteArray.detach();
return byteArray;
+ }
const QString str = QString::fromUtf8(byteArray.constData(), byteArray.size());
return QSettingsPrivate::stringToVariant(str);
diff --git a/src/corelib/kernel/qcore_foundation.mm b/src/corelib/kernel/qcore_foundation.mm
index 8b6be9b08e..0e69f69a85 100644
--- a/src/corelib/kernel/qcore_foundation.mm
+++ b/src/corelib/kernel/qcore_foundation.mm
@@ -495,7 +495,7 @@ NSTimeZone *QTimeZone::toNSTimeZone() const
Creates a CGRect from a QRect.
- \sa fromCGRect()
+ \sa QRectF::fromCGRect()
*/
CGRect QRect::toCGRect() const Q_DECL_NOTHROW
{
@@ -517,7 +517,7 @@ CGRect QRectF::toCGRect() const Q_DECL_NOTHROW
/*!
\since 5.8
- Creates a QRectF from a CGRect.
+ Creates a QRectF from CGRect \a rect.
\sa toCGRect()
*/
@@ -533,7 +533,7 @@ QRectF QRectF::fromCGRect(CGRect rect) Q_DECL_NOTHROW
Creates a CGPoint from a QPoint.
- \sa fromCGPoint()
+ \sa QPointF::fromCGPoint()
*/
CGPoint QPoint::toCGPoint() const Q_DECL_NOTHROW
{
@@ -555,7 +555,7 @@ CGPoint QPointF::toCGPoint() const Q_DECL_NOTHROW
/*!
\since 5.8
- Creates a QRectF from a CGPoint.
+ Creates a QRectF from CGPoint \a point.
\sa toCGPoint()
*/
@@ -571,7 +571,7 @@ QPointF QPointF::fromCGPoint(CGPoint point) Q_DECL_NOTHROW
Creates a CGSize from a QSize.
- \sa fromCGSize()
+ \sa QSizeF::fromCGSize()
*/
CGSize QSize::toCGSize() const Q_DECL_NOTHROW
{
@@ -593,7 +593,7 @@ CGSize QSizeF::toCGSize() const Q_DECL_NOTHROW
/*!
\since 5.8
- Creates a QRectF from a CGSize.
+ Creates a QRectF from \a size.
\sa toCGSize()
*/
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 152177a926..a936457bce 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -353,10 +353,6 @@ Q_CORE_EXPORT uint qGlobalPostedEventsCount()
QAbstractEventDispatcher *QCoreApplicationPrivate::eventDispatcher = 0;
-#ifdef Q_OS_UNIX
-Qt::HANDLE qt_application_thread_id = 0;
-#endif
-
#endif // QT_NO_QOBJECT
QCoreApplication *QCoreApplication::self = 0;
@@ -468,10 +464,6 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint
qFatal("FATAL: The application binary appears to be running setuid, this is a security hole.");
# endif // Q_OS_UNIX
-# if defined(Q_OS_UNIX)
- qt_application_thread_id = QThread::currentThreadId();
-# endif
-
QThread *cur = QThread::currentThread(); // note: this may end up setting theMainThread!
if (cur != theMainThread)
qWarning("WARNING: QApplication was not created in the main() thread.");
diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp
index 856d2a2101..50888dd0aa 100644
--- a/src/corelib/kernel/qcoreapplication_win.cpp
+++ b/src/corelib/kernel/qcoreapplication_win.cpp
@@ -197,33 +197,6 @@ Q_CORE_EXPORT int qWinAppCmdShow() // get main window sho
}
#endif
-/*****************************************************************************
- qWinMain() - Initializes Windows. Called from WinMain() in qtmain_win.cpp
- *****************************************************************************/
-
-#if !defined(Q_OS_WINRT)
-
-// ### Qt6: FIXME: Consider removing this function. It is here for Active Qt
-// servers and for binary for compatibility to applications built with Qt 5.3
-// using qtmain.lib which calls it In Qt 5.4, qtmain.lib was changed to use
-// CommandLineToArgvW() without calling into Qt5Core.
-Q_CORE_EXPORT
-void qWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParam,
- int cmdShow, int &argc, QVector<char *> &argv)
-{
- Q_UNUSED(instance)
- Q_UNUSED(prevInstance)
- Q_UNUSED(cmdShow)
-
- const QStringList wArgv = qWinCmdArgs(QString::fromLocal8Bit(cmdParam));
- argv.clear();
- argc = wArgv.size();
- for (const QString &wArg : wArgv)
- argv.append(_strdup(wArg.toLocal8Bit().constData()));
-}
-
-#endif // !Q_OS_WINRT
-
#ifndef QT_NO_QOBJECT
#if defined(Q_OS_WIN) && !defined(QT_NO_DEBUG_STREAM)
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 8a4ad8bbf3..c908e7cdbc 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -74,6 +74,7 @@
#include "qline.h"
#endif
+#include <cmath>
#include <float.h>
#include <cstring>
@@ -3472,8 +3473,17 @@ static int numericCompare(const QVariant::Private *d1, const QVariant::Private *
Q_ASSERT(ok);
qreal r2 = qConvertToRealNumber(d2, &ok);
Q_ASSERT(ok);
- if (r1 == r2 || qFuzzyCompare(r1, r2))
+ if (r1 == r2)
return 0;
+
+ // only do fuzzy comparisons for finite, non-zero numbers
+ int c1 = std::fpclassify(r1);
+ int c2 = std::fpclassify(r2);
+ if ((c1 == FP_NORMAL || c1 == FP_SUBNORMAL) && (c2 == FP_NORMAL || c2 == FP_SUBNORMAL)) {
+ if (qFuzzyCompare(r1, r2))
+ return 0;
+ }
+
return r1 < r2 ? -1 : 1;
}
diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp
index 6887fa247b..7e3610f0b3 100644
--- a/src/corelib/thread/qmutex.cpp
+++ b/src/corelib/thread/qmutex.cpp
@@ -271,6 +271,9 @@ bool QMutex::tryLock(int timeout) QT_MUTEX_LOCK_NOEXCEPT
This function is provided for compatibility with the Standard Library
concept \c Lockable. It is equivalent to tryLock().
+
+ The function returns \c true if the lock was obtained; otherwise it
+ returns \c false
*/
/*! \fn bool QMutex::try_lock_for(std::chrono::duration<Rep, Period> duration)
diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h
index fb7031ce71..c0f7709fec 100644
--- a/src/corelib/tools/qalgorithms.h
+++ b/src/corelib/tools/qalgorithms.h
@@ -638,6 +638,17 @@ Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) Q_DECL_NOTHROW
{
return qt_builtin_clz(v) - 16U;
}
+
+// Neither MSVC nor the Intel compiler define a macro for the POPCNT processor
+// feature, so we're using either the SSE4.2 or the AVX macro as a proxy (Clang
+// does define the macro). It's incorrect for two reasons:
+// 1. It's a separate bit in CPUID, so a processor could implement SSE4.2 and
+// not POPCNT, but that's unlikely to happen.
+// 2. There are processors that support POPCNT but not AVX (Intel Nehalem
+// architecture), but unlike the other compilers, MSVC has no option
+// to generate code for those processors.
+// So it's an acceptable compromise.
+#if defined(__AVX__) || defined(__SSE4_2__) || defined(__POPCNT__)
#define QALGORITHMS_USE_BUILTIN_POPCOUNT
Q_ALWAYS_INLINE uint qt_builtin_popcount(quint32 v) Q_DECL_NOTHROW
{
@@ -658,6 +669,8 @@ Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NOTHROW
return __popcnt64(v);
}
#endif // MSVC 64bit
+#endif // __AVX__ || __SSE4_2__ || __POPCNT__
+
#endif // MSVC
#endif // QT_HAS_CONSTEXPR_BUILTINS
diff --git a/src/corelib/tools/qbytearraymatcher.cpp b/src/corelib/tools/qbytearraymatcher.cpp
index fc9d12aba5..76af726ef9 100644
--- a/src/corelib/tools/qbytearraymatcher.cpp
+++ b/src/corelib/tools/qbytearraymatcher.cpp
@@ -370,7 +370,7 @@ int qFindByteArray(
*/
/*!
- \fn QStaticByteArrayMatcher::indexIn(const char *haystack, int hlen, int from)
+ \fn int QStaticByteArrayMatcher::indexIn(const char *haystack, int hlen, int from = 0) const
Searches the char string \a haystack, which has length \a hlen, from
byte position \a from (default 0, i.e. from the first byte), for
@@ -380,7 +380,7 @@ int qFindByteArray(
*/
/*!
- \fn QStaticByteArrayMatcher::indexIn(const QByteArray &haystack, int from)
+ \fn int QStaticByteArrayMatcher::indexIn(const QByteArray &haystack, int from = 0) const
Searches the char string \a haystack, from byte position \a from
(default 0, i.e. from the first byte), for the byte array pattern()
diff --git a/src/corelib/tools/qcollator.h b/src/corelib/tools/qcollator.h
index 5ff74fd69a..d81c7c85e3 100644
--- a/src/corelib/tools/qcollator.h
+++ b/src/corelib/tools/qcollator.h
@@ -69,7 +69,7 @@ public:
protected:
QCollatorSortKey(QCollatorSortKeyPrivate*);
- QSharedDataPointer<QCollatorSortKeyPrivate> d;
+ QExplicitlySharedDataPointer<QCollatorSortKeyPrivate> d;
private:
QCollatorSortKey();
diff --git a/src/corelib/tools/qcollator_icu.cpp b/src/corelib/tools/qcollator_icu.cpp
index 3cde3051b4..26e2121092 100644
--- a/src/corelib/tools/qcollator_icu.cpp
+++ b/src/corelib/tools/qcollator_icu.cpp
@@ -39,6 +39,7 @@
****************************************************************************/
#include "qcollator_p.h"
+#include "qlocale_p.h"
#include "qstringlist.h"
#include "qstring.h"
@@ -56,7 +57,7 @@ void QCollatorPrivate::init()
cleanup();
UErrorCode status = U_ZERO_ERROR;
- QByteArray name = locale.bcp47Name().replace(QLatin1Char('-'), QLatin1Char('_')).toLatin1();
+ QByteArray name = QLocalePrivate::get(locale)->bcp47Name('_');
collator = ucol_open(name.constData(), &status);
if (U_FAILURE(status)) {
qWarning("Could not create collator: %d", status);
@@ -110,7 +111,7 @@ int QCollator::compare(const QChar *s1, int len1, const QChar *s2, int len2) con
if (d->collator)
return ucol_strcoll(d->collator, (const UChar *)s1, len1, (const UChar *)s2, len2);
- return QString::compare(QString(s1, len1), QString(s2, len2), d->caseSensitivity);
+ return QString::compare_helper(s1, len1, s2, len2, d->caseSensitivity);
}
int QCollator::compare(const QString &s1, const QString &s2) const
diff --git a/src/corelib/tools/qcollator_macx.cpp b/src/corelib/tools/qcollator_macx.cpp
index b4d93e58d4..c4eb8e6978 100644
--- a/src/corelib/tools/qcollator_macx.cpp
+++ b/src/corelib/tools/qcollator_macx.cpp
@@ -38,9 +38,12 @@
****************************************************************************/
#include "qcollator_p.h"
+#include "qlocale_p.h"
#include "qstringlist.h"
#include "qstring.h"
+
#include <QtCore/private/qcore_mac_p.h>
+
#include <CoreFoundation/CoreFoundation.h>
#include <CoreFoundation/CFLocale.h>
@@ -53,7 +56,7 @@ void QCollatorPrivate::init()
{
cleanup();
LocaleRef localeRef;
- int rc = LocaleRefFromLocaleString(locale.bcp47Name().toLocal8Bit(), &localeRef);
+ int rc = LocaleRefFromLocaleString(QLocalePrivate::get(locale)->bcp47Name().constData(), &localeRef);
if (rc != 0)
qWarning("couldn't initialize the locale");
diff --git a/src/corelib/tools/qcollator_p.h b/src/corelib/tools/qcollator_p.h
index 423ba0325a..6ac79e820d 100644
--- a/src/corelib/tools/qcollator_p.h
+++ b/src/corelib/tools/qcollator_p.h
@@ -85,7 +85,7 @@ typedef QVector<wchar_t> CollatorKeyType;
typedef int CollatorType;
#endif
-class Q_CORE_EXPORT QCollatorPrivate
+class QCollatorPrivate
{
public:
QAtomicInt ref;
@@ -127,7 +127,7 @@ private:
Q_DISABLE_COPY(QCollatorPrivate)
};
-class Q_CORE_EXPORT QCollatorSortKeyPrivate : public QSharedData
+class QCollatorSortKeyPrivate : public QSharedData
{
friend class QCollator;
public:
diff --git a/src/corelib/tools/qcollator_win.cpp b/src/corelib/tools/qcollator_win.cpp
index fcd8d069eb..44beaeaf75 100644
--- a/src/corelib/tools/qcollator_win.cpp
+++ b/src/corelib/tools/qcollator_win.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "qcollator_p.h"
+#include "qlocale_p.h"
#include "qstringlist.h"
#include "qstring.h"
@@ -61,7 +62,7 @@ void QCollatorPrivate::init()
collator = 0;
#ifndef USE_COMPARESTRINGEX
- localeID = qt_inIsoNametoLCID(locale.bcp47Name().toUtf8().constData());
+ localeID = qt_inIsoNametoLCID(QLocalePrivate::get(locale)->bcp47Name().constData());
#else
localeName = locale.bcp47Name();
#endif
diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp
index 65016933a0..d66416207b 100644
--- a/src/corelib/tools/qdatetimeparser.cpp
+++ b/src/corelib/tools/qdatetimeparser.cpp
@@ -60,6 +60,10 @@ QT_BEGIN_NAMESPACE
#ifndef QT_BOOTSTRAPPED
+QDateTimeParser::~QDateTimeParser()
+{
+}
+
/*!
\internal
Gets the digit from a datetime. E.g.
diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h
index bc088a5f4c..b50c88b4c1 100644
--- a/src/corelib/tools/qdatetimeparser_p.h
+++ b/src/corelib/tools/qdatetimeparser_p.h
@@ -103,7 +103,7 @@ public:
none.count = -1;
none.zeroesAdded = 0;
}
- virtual ~QDateTimeParser() {}
+ virtual ~QDateTimeParser();
enum Section {
NoSection = 0x00000,
diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h
index 7749f66b8e..f7adb021b6 100644
--- a/src/corelib/tools/qlocale_p.h
+++ b/src/corelib/tools/qlocale_p.h
@@ -332,6 +332,9 @@ public:
return retval;
}
+ static QLocalePrivate *get(QLocale &l) { return l.d; }
+ static const QLocalePrivate *get(const QLocale &l) { return l.d; }
+
QChar decimal() const { return QChar(m_data->m_decimal); }
QChar group() const { return QChar(m_data->m_group); }
QChar list() const { return QChar(m_data->m_list); }
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h
index 3b6c85ca8a..be53c51c48 100644
--- a/src/corelib/tools/qsimd_p.h
+++ b/src/corelib/tools/qsimd_p.h
@@ -156,6 +156,15 @@
# if !defined(__ARM_FEATURE_NEON) && defined(__ARM_NEON__)
# define __ARM_FEATURE_NEON // also support QT_COMPILER_SUPPORTS_HERE(NEON)
# endif
+#elif defined(Q_PROCESSOR_MIPS)
+# define QT_COMPILER_SUPPORTS_HERE(x) (__ ## x ## __)
+# define QT_FUNCTION_TARGET(x)
+# if !defined(__MIPS_DSP__) && defined(__mips_dsp) && defined(Q_PROCESSOR_MIPS_32)
+# define __MIPS_DSP__
+# endif
+# if !defined(__MIPS_DSPR2__) && defined(__mips_dspr2) && defined(Q_PROCESSOR_MIPS_32)
+# define __MIPS_DSPR2__
+# endif
#elif (defined(Q_CC_INTEL) || defined(Q_CC_MSVC) \
|| (defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && (__GNUC__-0) * 100 + (__GNUC_MINOR__-0) >= 409)) \
&& !defined(QT_BOOTSTRAPPED)
@@ -172,8 +181,21 @@
# define QT_FUNCTION_TARGET(x)
#endif
+#if defined(Q_CC_MSVC) && (defined(_M_AVX) || defined(__AVX__))
+// Visual Studio defines __AVX__ when /arch:AVX is passed, but not the earlier macros
+// See: https://msdn.microsoft.com/en-us/library/b0084kay.aspx
+// SSE2 is handled by _M_IX86_FP below
+# define __SSE3__ 1
+# define __SSSE3__ 1
+// no Intel CPU supports SSE4a, so don't define it
+# define __SSE4_1__ 1
+# define __SSE4_2__ 1
+# ifndef __AVX__
+# define __AVX__ 1
+# endif
+#endif
+
// SSE intrinsics
-#define QT_FUNCTION_TARGET_STRING_SSE2 "sse2"
#if defined(__SSE2__) || (defined(QT_COMPILER_SUPPORTS_SSE2) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS))
#if defined(QT_LINUXBASE)
/// this is an evil hack - the posix_memalign declaration in LSB
@@ -191,51 +213,38 @@
#endif
// SSE3 intrinsics
-#define QT_FUNCTION_TARGET_STRING_SSE3 "sse3"
#if defined(__SSE3__) || (defined(QT_COMPILER_SUPPORTS_SSE3) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS))
#include <pmmintrin.h>
#endif
// SSSE3 intrinsics
-#define QT_FUNCTION_TARGET_STRING_SSSE3 "ssse3"
#if defined(__SSSE3__) || (defined(QT_COMPILER_SUPPORTS_SSSE3) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS))
#include <tmmintrin.h>
#endif
// SSE4.1 intrinsics
-#define QT_FUNCTION_TARGET_STRING_SSE4_1 "sse4.1"
#if defined(__SSE4_1__) || (defined(QT_COMPILER_SUPPORTS_SSE4_1) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS))
#include <smmintrin.h>
#endif
// SSE4.2 intrinsics
-#define QT_FUNCTION_TARGET_STRING_SSE4_2 "sse4.2"
#if defined(__SSE4_2__) || (defined(QT_COMPILER_SUPPORTS_SSE4_2) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS))
#include <nmmintrin.h>
#endif
// AVX intrinsics
-#define QT_FUNCTION_TARGET_STRING_AVX "avx"
-#define QT_FUNCTION_TARGET_STRING_AVX2 "avx2"
#if defined(__AVX__) || (defined(QT_COMPILER_SUPPORTS_AVX) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS))
// immintrin.h is the ultimate header, we don't need anything else after this
#include <immintrin.h>
-
-# if defined(Q_CC_MSVC) && (defined(_M_AVX) || defined(__AVX__))
-// MS Visual Studio 2010 has no macro pre-defined to identify the use of /arch:AVX
-// MS Visual Studio 2013 adds it: __AVX__
-// See: http://connect.microsoft.com/VisualStudio/feedback/details/605858/arch-avx-should-define-a-predefined-macro-in-x64-and-set-a-unique-value-for-m-ix86-fp-in-win32
-# define __SSE3__ 1
-# define __SSSE3__ 1
-// no Intel CPU supports SSE4a, so don't define it
-# define __SSE4_1__ 1
-# define __SSE4_2__ 1
-# ifndef __AVX__
-# define __AVX__ 1
-# endif
-# endif
#endif
+#define QT_FUNCTION_TARGET_STRING_SSE2 "sse2"
+#define QT_FUNCTION_TARGET_STRING_SSE3 "sse3"
+#define QT_FUNCTION_TARGET_STRING_SSSE3 "ssse3"
+#define QT_FUNCTION_TARGET_STRING_SSE4_1 "sse4.1"
+#define QT_FUNCTION_TARGET_STRING_SSE4_2 "sse4.2"
+#define QT_FUNCTION_TARGET_STRING_AVX "avx"
+#define QT_FUNCTION_TARGET_STRING_AVX2 "avx2"
#define QT_FUNCTION_TARGET_STRING_AVX512F "avx512f"
#define QT_FUNCTION_TARGET_STRING_AVX512CD "avx512cd"
#define QT_FUNCTION_TARGET_STRING_AVX512ER "avx512er"
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 61eccbf1dd..5da45181d9 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -1869,7 +1869,7 @@ QString &QString::operator=(const QString &other) Q_DECL_NOTHROW
*/
QString &QString::operator=(QLatin1String other)
{
- if (isDetached() && other.size() <= capacity()) { // assumes d->alloc == 0 → !isDetached() (sharedNull)
+ if (isDetached() && other.size() <= capacity()) { // assumes d->alloc == 0 -> !isDetached() (sharedNull)
d->size = other.size();
d->data()[other.size()] = 0;
qt_from_latin1(d->data(), other.latin1(), other.size());
@@ -1928,7 +1928,7 @@ QString &QString::operator=(QLatin1String other)
*/
QString &QString::operator=(QChar ch)
{
- if (isDetached() && capacity() >= 1) { // assumes d->alloc == 0 → !isDetached() (sharedNull)
+ if (isDetached() && capacity() >= 1) { // assumes d->alloc == 0 -> !isDetached() (sharedNull)
// re-use existing capacity:
ushort *dat = d->data();
dat[0] = ch.unicode();
@@ -8390,7 +8390,7 @@ QString &QString::setRawData(const QChar *unicode, int size)
Returns the character at position \a pos in this object.
\note This function performs no error checking.
- The behavior is undefined when \a pos < 0 or \a pos ≥ size().
+ The behavior is undefined when \a pos < 0 or \a pos >= size().
\sa operator[]()
*/
@@ -8401,7 +8401,7 @@ QString &QString::setRawData(const QChar *unicode, int size)
Returns the character at position \a pos in this object.
\note This function performs no error checking.
- The behavior is undefined when \a pos < 0 or \a pos ≥ size().
+ The behavior is undefined when \a pos < 0 or \a pos >= size().
\sa at()
*/
@@ -10192,7 +10192,7 @@ bool QStringRef::endsWith(const QStringRef &str, Qt::CaseSensitivity cs) const
*/
/*! \fn bool QStringRef::contains(QLatin1String str, Qt::CaseSensitivity cs) const
- \since 4,8
+ \since 4.8
\overload contains()
Returns \c true if this string reference contains an occurrence of
diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp
index 88ceae20b9..75ff934f15 100644
--- a/src/corelib/tools/qstringlist.cpp
+++ b/src/corelib/tools/qstringlist.cpp
@@ -716,7 +716,7 @@ int QtPrivate::QStringList_lastIndexOf(const QStringList *that, const QRegularEx
/*!
\fn int QStringList::removeDuplicates()
- \since 4.5
+ \since 4.5
This function removes duplicate entries from a list.
The entries do not have to be sorted. They will retain their
diff --git a/src/corelib/tools/qstringmatcher.cpp b/src/corelib/tools/qstringmatcher.cpp
index 67e7ad3825..67d3f0ebc8 100644
--- a/src/corelib/tools/qstringmatcher.cpp
+++ b/src/corelib/tools/qstringmatcher.cpp
@@ -252,7 +252,7 @@ void QStringMatcher::setCaseSensitivity(Qt::CaseSensitivity cs)
{
if (cs == q_cs)
return;
- bm_init_skiptable((const ushort *)q_pattern.unicode(), q_pattern.size(), p.q_skiptable, cs);
+ bm_init_skiptable((const ushort *)p.uc, p.len, p.q_skiptable, cs);
q_cs = cs;
}
diff --git a/src/corelib/tools/qunicodetools.cpp b/src/corelib/tools/qunicodetools.cpp
index be1d88e260..ac19d6b6d1 100644
--- a/src/corelib/tools/qunicodetools.cpp
+++ b/src/corelib/tools/qunicodetools.cpp
@@ -714,7 +714,7 @@ Q_CORE_EXPORT void initScripts(const ushort *string, int length, uchar *scripts)
}
// Never break between a combining mark (gc= Mc, Mn or Me) and its base character.
- // Thus, a combining mark — whatever its script property value is — should inherit
+ // Thus, a combining mark - whatever its script property value is - should inherit
// the script property value of its base character.
static const int test = (FLAG(QChar::Mark_NonSpacing) | FLAG(QChar::Mark_SpacingCombining) | FLAG(QChar::Mark_Enclosing));
if (Q_UNLIKELY(FLAG(prop->category) & test))
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index a63e976f99..875bcd1421 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -107,7 +107,7 @@ public:
// QDBusConnectionPrivate holds the DBusConnection and
// can have many QDBusConnection objects referring to it
-class QDBusConnectionPrivate: public QObject
+class Q_AUTOTEST_EXPORT QDBusConnectionPrivate: public QObject
{
Q_OBJECT
public:
diff --git a/src/dbus/qdbusmetatype.h b/src/dbus/qdbusmetatype.h
index 9f3d9019d7..e241553bb4 100644
--- a/src/dbus/qdbusmetatype.h
+++ b/src/dbus/qdbusmetatype.h
@@ -74,7 +74,7 @@ void qDBusDemarshallHelper(const QDBusArgument &arg, T *t)
template<typename T>
int qDBusRegisterMetaType(
#ifndef Q_QDOC
- T * /* dummy */ = 0
+ T * /* dummy */ = nullptr
#endif
)
{
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index 874b99be4f..2db4d46874 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -52,12 +52,15 @@
#include <qpa/qplatformintegration.h>
#include <QtCore/qdebug.h>
+#include <QtCore/qloggingcategory.h>
#include <QtCore/qmetaobject.h>
#include <QtCore/qhash.h>
#include <private/qfactoryloader_p.h>
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core");
+
/*!
\class QAccessible
\brief The QAccessible class provides enums and static functions
@@ -1370,8 +1373,13 @@ QAccessible::Id QAccessibleEvent::uniqueId() const
QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(m_object);
if (!iface)
return 0;
- if (m_child != -1)
+ if (m_child != -1) {
iface = iface->child(m_child);
+ if (Q_UNLIKELY(!iface)) {
+ qCWarning(lcAccessibilityCore) << "Invalid child in QAccessibleEvent:" << m_object << "child:" << m_child;
+ return 0;
+ }
+ }
return QAccessible::uniqueId(iface);
}
@@ -1769,7 +1777,7 @@ QAccessibleInterface *QAccessibleEvent::accessibleInterface() const
if (child) {
iface = child;
} else {
- qWarning() << "Cannot creat accessible child interface for object: " << m_object << " index: " << m_child;
+ qCWarning(lcAccessibilityCore) << "Cannot create accessible child interface for object: " << m_object << " index: " << m_child;
}
}
return iface;
diff --git a/src/gui/configure.json b/src/gui/configure.json
index 02032dee8f..6d0848c9f0 100644
--- a/src/gui/configure.json
+++ b/src/gui/configure.json
@@ -182,7 +182,7 @@
"label": "Desktop OpenGL",
"test": "unix/opengldesktop",
"sources": [
- { "type": "pkgConfig", "args": "gl" },
+ { "type": "pkgConfig", "args": "gl", "condition": "!config.darwin" },
{ "type": "makeSpec", "spec": "OPENGL" }
]
},
@@ -190,7 +190,7 @@
"label": "OpenGL ES 2.0",
"test": "unix/opengles2",
"sources": [
- { "type": "pkgConfig", "args": "glesv2" },
+ { "type": "pkgConfig", "args": "glesv2", "condition": "!config.darwin" },
{ "type": "makeSpec", "spec": "OPENGL_ES2" }
]
},
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp
index d685d50d49..2a0bdeb7c1 100644
--- a/src/gui/image/qimage_conversions.cpp
+++ b/src/gui/image/qimage_conversions.cpp
@@ -2979,16 +2979,14 @@ static void qInitImageConversions()
qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_neon;
#endif
-#ifdef QT_COMPILER_SUPPORTS_MIPS_DSPR2
- if (qCpuHasFeature(DSPR2)) {
- extern bool convert_ARGB_to_ARGB_PM_inplace_mips_dspr2(QImageData *data, Qt::ImageConversionFlags);
- qimage_inplace_converter_map[QImage::Format_ARGB32][QImage::Format_ARGB32_Premultiplied] = convert_ARGB_to_ARGB_PM_inplace_mips_dspr2;
-
- extern void convert_RGB888_to_RGB32_mips_dspr2(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);
- qimage_converter_map[QImage::Format_RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB32_mips_dspr2;
- qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB32_mips_dspr2;
- qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_mips_dspr2;
- }
+#if defined(__MIPS_DSPR2__)
+ extern bool convert_ARGB_to_ARGB_PM_inplace_mips_dspr2(QImageData *data, Qt::ImageConversionFlags);
+ qimage_inplace_converter_map[QImage::Format_ARGB32][QImage::Format_ARGB32_Premultiplied] = convert_ARGB_to_ARGB_PM_inplace_mips_dspr2;
+
+ extern void convert_RGB888_to_RGB32_mips_dspr2(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);
+ qimage_converter_map[QImage::Format_RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB32_mips_dspr2;
+ qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB32_mips_dspr2;
+ qimage_converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_mips_dspr2;
#endif
}
diff --git a/src/gui/image/qimage_darwin.mm b/src/gui/image/qimage_darwin.mm
index d72733abd3..2d38468cc5 100644
--- a/src/gui/image/qimage_darwin.mm
+++ b/src/gui/image/qimage_darwin.mm
@@ -41,7 +41,7 @@
QT_BEGIN_NAMESPACE
/*!
- Creates a \c CGImage equivalent to the QImage \a image. Returns a
+ Creates a \c CGImage equivalent to this QImage. Returns a
\c CGImageRef handle.
The returned CGImageRef partakes in the QImage implicit sharing,
@@ -85,7 +85,7 @@ QT_BEGIN_NAMESPACE
The CGImageRef color space is set to the sRGB color space.
- \sa toNSImage()
+ \sa QtMac::toNSImage()
*/
CGImageRef QImage::toCGImage() const
{
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 54a5b94840..7eb61adb2d 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -349,8 +349,6 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage sourceImage, Qt::ImageCo
}
is_null = (w <= 0 || h <= 0);
- if (image.d)
- image.d->devicePixelRatio = sourceImage.devicePixelRatio();
//ensure the pixmap and the image resulting from toImage() have the same cacheKey();
setSerialNumber(image.cacheKey() >> 32);
if (image.d)
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index fdf77e162c..d55a26b2a4 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -521,6 +521,12 @@ bool QPngHandlerPrivate::readPngHeader()
png_set_error_fn(png_ptr, 0, 0, qt_png_warning);
+#if defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_MAXIMUM_INFLATE_WINDOW)
+ // Trade off a little bit of memory for better compatibility with existing images
+ // Ref. "invalid distance too far back" explanation in libpng-manual.txt
+ png_set_option(png_ptr, PNG_MAXIMUM_INFLATE_WINDOW, PNG_OPTION_ON);
+#endif
+
info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr) {
png_destroy_read_struct(&png_ptr, 0, 0);
diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp
index 5b36f496f1..0aadac2c62 100644
--- a/src/gui/kernel/qdrag.cpp
+++ b/src/gui/kernel/qdrag.cpp
@@ -393,7 +393,7 @@ Qt::DropAction QDrag::defaultAction() const
\note This is currently implemented on Windows and X11.
- \since 5.6
+ \since 5.7
\sa exec()
*/
void QDrag::cancel()
diff --git a/src/gui/kernel/qplatformdrag.cpp b/src/gui/kernel/qplatformdrag.cpp
index 903f6686a8..3c23406a6b 100644
--- a/src/gui/kernel/qplatformdrag.cpp
+++ b/src/gui/kernel/qplatformdrag.cpp
@@ -166,7 +166,7 @@ Qt::DropAction QPlatformDrag::defaultAction(Qt::DropActions possibleActions,
The default implementation does nothing.
- \since 5.6
+ \since 5.7
*/
void QPlatformDrag::cancelDrag()
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index 6fd2afb1aa..bfb2deff50 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -508,7 +508,7 @@ QPlatformScreen *QPlatformWindow::screenForGeometry(const QRect &newGeometry) co
// QRect::center can return a value outside the rectangle if it's empty.
// Apply mapToGlobal() in case it is a foreign/embedded window.
QPoint center = newGeometry.isEmpty() ? newGeometry.topLeft() : newGeometry.center();
- if (window()->type() == Qt::ForeignWindow)
+ if (isForeignWindow())
center = mapToGlobal(center - newGeometry.topLeft());
if (!parent() && currentScreen && !currentScreen->geometry().contains(center)) {
diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h
index d7fdbb156e..8af8791bb4 100644
--- a/src/gui/kernel/qplatformwindow.h
+++ b/src/gui/kernel/qplatformwindow.h
@@ -104,6 +104,7 @@ public:
virtual bool isActive() const;
virtual bool isAncestorOf(const QPlatformWindow *child) const;
virtual bool isEmbedded() const;
+ virtual bool isForeignWindow() const { return window()->type() == Qt::ForeignWindow; };
virtual QPoint mapToGlobal(const QPoint &pos) const;
virtual QPoint mapFromGlobal(const QPoint &pos) const;
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 5a27b19101..47277abea3 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -208,7 +208,8 @@ QWindow::QWindow(QWindowPrivate &dd, QWindow *parent)
*/
QWindow::~QWindow()
{
- destroy();
+ Q_D(QWindow);
+ d->destroy();
QGuiApplicationPrivate::window_list.removeAll(this);
if (!QGuiApplicationPrivate::is_app_closing)
QGuiApplicationPrivate::instance()->modalWindowList.removeOne(this);
@@ -1762,42 +1763,54 @@ void QWindow::destroy()
if (!d->platformWindow)
return;
- QObjectList childrenWindows = children();
+ if (d->platformWindow->isForeignWindow())
+ return;
+
+ d->destroy();
+}
+
+void QWindowPrivate::destroy()
+{
+ if (!platformWindow)
+ return;
+
+ Q_Q(QWindow);
+ QObjectList childrenWindows = q->children();
for (int i = 0; i < childrenWindows.size(); i++) {
QObject *object = childrenWindows.at(i);
if (object->isWindowType()) {
QWindow *w = static_cast<QWindow*>(object);
- w->destroy();
+ qt_window_private(w)->destroy();
}
}
- if (QGuiApplicationPrivate::focus_window == this)
- QGuiApplicationPrivate::focus_window = parent();
- if (QGuiApplicationPrivate::currentMouseWindow == this)
- QGuiApplicationPrivate::currentMouseWindow = parent();
- if (QGuiApplicationPrivate::currentMousePressWindow == this)
- QGuiApplicationPrivate::currentMousePressWindow = parent();
+ if (QGuiApplicationPrivate::focus_window == q)
+ QGuiApplicationPrivate::focus_window = q->parent();
+ if (QGuiApplicationPrivate::currentMouseWindow == q)
+ QGuiApplicationPrivate::currentMouseWindow = q->parent();
+ if (QGuiApplicationPrivate::currentMousePressWindow == q)
+ QGuiApplicationPrivate::currentMousePressWindow = q->parent();
for (int i = 0; i < QGuiApplicationPrivate::tabletDevicePoints.size(); ++i)
- if (QGuiApplicationPrivate::tabletDevicePoints.at(i).target == this)
- QGuiApplicationPrivate::tabletDevicePoints[i].target = parent();
+ if (QGuiApplicationPrivate::tabletDevicePoints.at(i).target == q)
+ QGuiApplicationPrivate::tabletDevicePoints[i].target = q->parent();
- bool wasVisible = isVisible();
- d->visibilityOnDestroy = wasVisible && d->platformWindow;
+ bool wasVisible = q->isVisible();
+ visibilityOnDestroy = wasVisible && platformWindow;
- setVisible(false);
+ q->setVisible(false);
QPlatformSurfaceEvent e(QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed);
- QGuiApplication::sendEvent(this, &e);
+ QGuiApplication::sendEvent(q, &e);
- delete d->platformWindow;
- d->resizeEventPending = true;
- d->receivedExpose = false;
- d->exposed = false;
- d->platformWindow = 0;
+ delete platformWindow;
+ resizeEventPending = true;
+ receivedExpose = false;
+ exposed = false;
+ platformWindow = 0;
if (wasVisible)
- d->maybeQuitOnLastWindowClosed();
+ maybeQuitOnLastWindowClosed();
}
/*!
@@ -2440,7 +2453,7 @@ QPoint QWindow::mapToGlobal(const QPoint &pos) const
Q_D(const QWindow);
// QTBUG-43252, prefer platform implementation for foreign windows.
if (d->platformWindow
- && (type() == Qt::ForeignWindow || d->platformWindow->isEmbedded())) {
+ && (d->platformWindow->isForeignWindow() || d->platformWindow->isEmbedded())) {
return QHighDpi::fromNativeLocalPosition(d->platformWindow->mapToGlobal(QHighDpi::toNativeLocalPosition(pos, this)), this);
}
return pos + d->globalPosition();
@@ -2460,7 +2473,7 @@ QPoint QWindow::mapFromGlobal(const QPoint &pos) const
Q_D(const QWindow);
// QTBUG-43252, prefer platform implementation for foreign windows.
if (d->platformWindow
- && (type() == Qt::ForeignWindow || d->platformWindow->isEmbedded())) {
+ && (d->platformWindow->isForeignWindow() || d->platformWindow->isEmbedded())) {
return QHighDpi::fromNativeLocalPosition(d->platformWindow->mapFromGlobal(QHighDpi::toNativeLocalPosition(pos, this)), this);
}
return pos - d->globalPosition();
@@ -2471,11 +2484,13 @@ QPoint QWindowPrivate::globalPosition() const
Q_Q(const QWindow);
QPoint offset = q->position();
for (const QWindow *p = q->parent(); p; p = p->parent()) {
- if (p->type() != Qt::ForeignWindow) {
- offset += p->position();
- } else { // Use mapToGlobal() for foreign windows
+ QPlatformWindow *pw = p->handle();
+ if (pw && pw->isForeignWindow()) {
+ // Use mapToGlobal() for foreign windows
offset += p->mapToGlobal(QPoint(0, 0));
break;
+ } else {
+ offset += p->position();
}
}
return offset;
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index 95c6abf428..d1727a1c57 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -137,6 +137,7 @@ public:
bool windowRecreationRequired(QScreen *newScreen) const;
void create(bool recursive);
+ void destroy();
void setTopLevelScreen(QScreen *newScreen, bool recreate);
void connectToScreen(QScreen *topLevelScreen);
void disconnectFromScreen();
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index ad8b19a2bc..e724efab37 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -45,7 +45,6 @@
#include <QtGui/private/qopengl_p.h>
#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatformintegration.h>
-#include <QtCore/qloggingcategory.h>
#ifdef Q_OS_INTEGRITY
#include <EGL/egl.h>
@@ -57,9 +56,6 @@
QT_BEGIN_NAMESPACE
-Q_LOGGING_CATEGORY(lcGLES3, "qt.opengl.es3")
-
-
#define QT_OPENGL_COUNT_FUNCTIONS(ret, name, args) +1
#define QT_OPENGL_FUNCTION_NAMES(ret, name, args) \
"gl"#name"\0"
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 4ea3b37d5f..4671c5cecf 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -1540,12 +1540,8 @@ static const uint *QT_FASTCALL fetchUntransformedRGB16(uint *buffer, const Opera
int length)
{
const quint16 *scanLine = (const quint16 *)data->texture.scanLine(y) + x;
-#ifdef QT_COMPILER_SUPPORTS_MIPS_DSPR2
- qConvertRgb16To32_asm_mips_dspr2(buffer, scanLine, length);
-#else
for (int i = 0; i < length; ++i)
buffer[i] = qConvertRgb16To32(scanLine[i]);
-#endif
return buffer;
}
@@ -5543,32 +5539,160 @@ inline static void qt_bitmapblit_quint16(QRasterBuffer *rasterBuffer,
map, mapWidth, mapHeight, mapStride);
}
-static void qt_alphamapblit_quint16(QRasterBuffer *rasterBuffer,
+static inline void alphamapblend_generic(int coverage, QRgba64 *dest, int x, const QRgba64 &srcLinear, const QRgba64 &src, const QColorProfile *colorProfile)
+{
+ if (coverage == 0) {
+ // nothing
+ } else if (coverage == 255) {
+ dest[x] = src;
+ } else {
+ QRgba64 dstColor = dest[x];
+ if (colorProfile) {
+ if (dstColor.isOpaque())
+ dstColor = colorProfile->toLinear(dstColor);
+ else if (!dstColor.isTransparent())
+ dstColor = colorProfile->toLinear(dstColor.unpremultiplied()).premultiplied();
+ }
+
+ dstColor = interpolate255(srcLinear, coverage, dstColor, 255 - coverage);
+ if (colorProfile) {
+ if (dstColor.isOpaque())
+ dstColor = colorProfile->fromLinear(dstColor);
+ else if (!dstColor.isTransparent())
+ dstColor = colorProfile->fromLinear(dstColor.unpremultiplied()).premultiplied();
+ }
+ dest[x] = dstColor;
+ }
+}
+
+static void qt_alphamapblit_generic(QRasterBuffer *rasterBuffer,
int x, int y, const QRgba64 &color,
const uchar *map,
int mapWidth, int mapHeight, int mapStride,
- const QClipData *, bool /*useGammaCorrection*/)
+ const QClipData *clip, bool useGammaCorrection)
{
- const quint16 c = color.toRgb16();
- quint16 *dest = reinterpret_cast<quint16*>(rasterBuffer->scanLine(y)) + x;
- const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint16);
+ if (color.isTransparent())
+ return;
- while (mapHeight--) {
- for (int i = 0; i < mapWidth; ++i) {
- const int coverage = map[i];
+ const QColorProfile *colorProfile = nullptr;
- if (coverage == 0) {
- // nothing
- } else if (coverage == 255) {
- dest[i] = c;
- } else {
- int ialpha = 255 - coverage;
- dest[i] = BYTE_MUL_RGB16(c, coverage)
- + BYTE_MUL_RGB16(dest[i], ialpha);
+ if (useGammaCorrection)
+ colorProfile = QGuiApplicationPrivate::instance()->colorProfileForA8Text();
+
+ QRgba64 srcColor = color;
+ if (colorProfile) {
+ if (color.isOpaque())
+ srcColor = colorProfile->toLinear(srcColor);
+ else
+ srcColor = colorProfile->toLinear(srcColor.unpremultiplied()).premultiplied();
+ }
+
+ QRgba64 buffer[buffer_size];
+ const DestFetchProc64 destFetch64 = destFetchProc64[rasterBuffer->format];
+ const DestStoreProc64 destStore64 = destStoreProc64[rasterBuffer->format];
+
+ if (!clip) {
+ for (int ly = 0; ly < mapHeight; ++ly) {
+ int i = x;
+ int length = mapWidth;
+ while (length > 0) {
+ int l = qMin(buffer_size, length);
+ QRgba64 *dest = destFetch64(buffer, rasterBuffer, i, y + ly, l);
+ for (int j=0; j < l; ++j) {
+ const int coverage = map[j + (i - x)];
+ alphamapblend_generic(coverage, dest, j, srcColor, color, colorProfile);
+ }
+ destStore64(rasterBuffer, i, y + ly, buffer, l);
+ length -= l;
+ i += l;
}
+ map += mapStride;
}
- dest += destStride;
- map += mapStride;
+ } else {
+ int bottom = qMin(y + mapHeight, rasterBuffer->height());
+
+ int top = qMax(y, 0);
+ map += (top - y) * mapStride;
+
+ const_cast<QClipData *>(clip)->initialize();
+ for (int yp = top; yp<bottom; ++yp) {
+ const QClipData::ClipLine &line = clip->m_clipLines[yp];
+
+ for (int i=0; i<line.count; ++i) {
+ const QSpan &clip = line.spans[i];
+
+ int start = qMax<int>(x, clip.x);
+ int end = qMin<int>(x + mapWidth, clip.x + clip.len);
+ Q_ASSERT(clip.len <= buffer_size);
+ QRgba64 *dest = destFetch64(buffer, rasterBuffer, start, clip.y, clip.len);
+
+ for (int xp=start; xp<end; ++xp) {
+ const int coverage = map[xp - x];
+ alphamapblend_generic(coverage, dest, xp - start, srcColor, color, colorProfile);
+ }
+ destStore64(rasterBuffer, start, clip.y, dest, clip.len);
+ } // for (i -> line.count)
+ map += mapStride;
+ } // for (yp -> bottom)
+ }
+}
+
+static inline void alphamapblend_quint16(int coverage, quint16 *dest, int x, const quint16 srcColor)
+{
+ if (coverage == 0) {
+ // nothing
+ } else if (coverage == 255) {
+ dest[x] = srcColor;
+ } else {
+ dest[x] = BYTE_MUL_RGB16(srcColor, coverage)
+ + BYTE_MUL_RGB16(dest[x], 255 - coverage);
+ }
+}
+
+void qt_alphamapblit_quint16(QRasterBuffer *rasterBuffer,
+ int x, int y, const QRgba64 &color,
+ const uchar *map,
+ int mapWidth, int mapHeight, int mapStride,
+ const QClipData *clip, bool useGammaCorrection)
+{
+ if (useGammaCorrection) {
+ qt_alphamapblit_generic(rasterBuffer, x, y, color, map, mapWidth, mapHeight, mapStride, clip, useGammaCorrection);
+ return;
+ }
+
+ const quint16 c = color.toRgb16();
+
+ if (!clip) {
+ quint16 *dest = reinterpret_cast<quint16*>(rasterBuffer->scanLine(y)) + x;
+ const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint16);
+ while (mapHeight--) {
+ for (int i = 0; i < mapWidth; ++i)
+ alphamapblend_quint16(map[i], dest, i, c);
+ dest += destStride;
+ map += mapStride;
+ }
+ } else {
+ int top = qMax(y, 0);
+ int bottom = qMin(y + mapHeight, rasterBuffer->height());
+ map += (top - y) * mapStride;
+
+ const_cast<QClipData *>(clip)->initialize();
+ for (int yp = top; yp<bottom; ++yp) {
+ const QClipData::ClipLine &line = clip->m_clipLines[yp];
+
+ quint16 *dest = reinterpret_cast<quint16*>(rasterBuffer->scanLine(yp));
+
+ for (int i=0; i<line.count; ++i) {
+ const QSpan &clip = line.spans[i];
+
+ int start = qMax<int>(x, clip.x);
+ int end = qMin<int>(x + mapWidth, clip.x + clip.len);
+
+ for (int xp=start; xp<end; ++xp)
+ alphamapblend_quint16(map[xp - x], dest, xp, c);
+ } // for (i -> line.count)
+ map += mapStride;
+ } // for (yp -> bottom)
}
}
@@ -5694,19 +5818,119 @@ static void qt_alphamapblit_rgba8888(QRasterBuffer *rasterBuffer,
}
#endif
-inline static int qRgbAvg(QRgb rgb)
+static inline int qRgbAvg(QRgb rgb)
{
return (qRed(rgb) * 5 + qGreen(rgb) * 6 + qBlue(rgb) * 5) / 16;
}
+static inline void alphargbblend_generic(uint coverage, QRgba64 *dest, int x, const QRgba64 &srcLinear, const QRgba64 &src, const QColorProfile *colorProfile)
+{
+ if (coverage == 0xff000000) {
+ // nothing
+ } else if (coverage == 0xffffffff) {
+ dest[x] = src;
+ } else {
+ QRgba64 dstColor = dest[x];
+ if (dstColor.isOpaque()) {
+ if (colorProfile)
+ dstColor = colorProfile->toLinear(dstColor);
+ dstColor = rgbBlend(dstColor, srcLinear, coverage);
+ if (colorProfile)
+ dstColor = colorProfile->fromLinear(dstColor);
+ dest[x] = dstColor;
+ } else {
+ // Give up and do a gray alphablend.
+ if (colorProfile && !dstColor.isTransparent())
+ dstColor = colorProfile->toLinear(dstColor.unpremultiplied()).premultiplied();
+ const int a = qRgbAvg(coverage);
+ dstColor = interpolate255(srcLinear, coverage, dstColor, 255 - a);
+ if (colorProfile && !dstColor.isTransparent())
+ dstColor = colorProfile->fromLinear(dstColor.unpremultiplied()).premultiplied();
+ dest[x] = dstColor;
+ }
+ }
+}
+
+static void qt_alphargbblit_generic(QRasterBuffer *rasterBuffer,
+ int x, int y, const QRgba64 &color,
+ const uint *src, int mapWidth, int mapHeight, int srcStride,
+ const QClipData *clip, bool useGammaCorrection)
+{
+ if (color.isTransparent())
+ return;
+
+ const QColorProfile *colorProfile = nullptr;
+
+ if (useGammaCorrection)
+ colorProfile = QGuiApplicationPrivate::instance()->colorProfileForA8Text();
+
+ QRgba64 srcColor = color;
+ if (colorProfile) {
+ if (color.isOpaque())
+ srcColor = colorProfile->toLinear(srcColor);
+ else
+ srcColor = colorProfile->toLinear(srcColor.unpremultiplied()).premultiplied();
+ }
+
+ QRgba64 buffer[buffer_size];
+ const DestFetchProc64 destFetch64 = destFetchProc64[rasterBuffer->format];
+ const DestStoreProc64 destStore64 = destStoreProc64[rasterBuffer->format];
+
+ if (!clip) {
+ for (int ly = 0; ly < mapHeight; ++ly) {
+ int i = x;
+ int length = mapWidth;
+ while (length > 0) {
+ int l = qMin(buffer_size, length);
+ QRgba64 *dest = destFetch64(buffer, rasterBuffer, i, y + ly, l);
+ for (int j=0; j < l; ++j) {
+ const uint coverage = src[j + (i - x)];
+ alphargbblend_generic(coverage, dest, j, srcColor, color, colorProfile);
+ }
+ destStore64(rasterBuffer, i, y + ly, buffer, l);
+ length -= l;
+ i += l;
+ }
+ src += srcStride;
+ }
+ } else {
+ int bottom = qMin(y + mapHeight, rasterBuffer->height());
+
+ int top = qMax(y, 0);
+ src += (top - y) * srcStride;
+
+ const_cast<QClipData *>(clip)->initialize();
+ for (int yp = top; yp<bottom; ++yp) {
+ const QClipData::ClipLine &line = clip->m_clipLines[yp];
+
+ for (int i=0; i<line.count; ++i) {
+ const QSpan &clip = line.spans[i];
+
+ int start = qMax<int>(x, clip.x);
+ int end = qMin<int>(x + mapWidth, clip.x + clip.len);
+ Q_ASSERT(clip.len <= buffer_size);
+ QRgba64 *dest = destFetch64(buffer, rasterBuffer, start, clip.y, clip.len);
+
+ for (int xp=start; xp<end; ++xp) {
+ const uint coverage = src[xp - x];
+ alphargbblend_generic(coverage, dest, xp - start, srcColor, color, colorProfile);
+ }
+ destStore64(rasterBuffer, start, clip.y, dest, clip.len);
+ } // for (i -> line.count)
+ src += srcStride;
+ } // for (yp -> bottom)
+ }
+}
+
static void qt_alphargbblit_argb32(QRasterBuffer *rasterBuffer,
int x, int y, const QRgba64 &color,
const uint *src, int mapWidth, int mapHeight, int srcStride,
const QClipData *clip, bool useGammaCorrection)
{
- const quint32 c = color.toArgb32();
+ if (color.isTransparent())
+ return;
- int sa = qAlpha(c);
+ const quint32 c = color.toArgb32();
const QColorProfile *colorProfile = QGuiApplicationPrivate::instance()->colorProfileForA32Text();
if (!colorProfile)
@@ -5714,9 +5938,6 @@ static void qt_alphargbblit_argb32(QRasterBuffer *rasterBuffer,
const QRgba64 slinear = useGammaCorrection ? colorProfile->toLinear64(c) : color;
- if (sa == 0)
- return;
-
if (!clip) {
quint32 *dst = reinterpret_cast<quint32*>(rasterBuffer->scanLine(y)) + x;
const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint32);
@@ -5729,9 +5950,12 @@ static void qt_alphargbblit_argb32(QRasterBuffer *rasterBuffer,
if (dst[i] >= 0xff000000) {
rgbBlendPixel(dst+i, coverage, slinear, colorProfile, useGammaCorrection);
} else {
- // Give up and do a naive blend.
+ // Give up and do a gray blend.
const int a = qRgbAvg(coverage);
- dst[i] = INTERPOLATE_PIXEL_255(c, a, dst[i], 255 - a);
+ if (useGammaCorrection)
+ grayBlendPixel(dst+i, a, slinear, colorProfile);
+ else
+ dst[i] = INTERPOLATE_PIXEL_255(c, a, dst[i], 255 - a);
}
}
}
@@ -5765,9 +5989,12 @@ static void qt_alphargbblit_argb32(QRasterBuffer *rasterBuffer,
if (dst[xp] >= 0xff000000) {
rgbBlendPixel(dst+xp, coverage, slinear, colorProfile, useGammaCorrection);
} else {
- // Give up and do a naive blend.
+ // Give up and do a gray blend.
const int a = qRgbAvg(coverage);
- dst[xp] = INTERPOLATE_PIXEL_255(c, a, dst[xp], 255 - coverage);
+ if (useGammaCorrection)
+ grayBlendPixel(dst+xp, a, slinear, colorProfile);
+ else
+ dst[xp] = INTERPOLATE_PIXEL_255(c, a, dst[xp], 255 - coverage);
}
}
}
@@ -5901,56 +6128,80 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
qt_gradient_quint16,
qt_bitmapblit_quint16,
qt_alphamapblit_quint16,
- 0,
+ qt_alphargbblit_generic,
qt_rectfill_quint16
},
// Format_ARGB8565_Premultiplied
{
blend_color_generic,
blend_src_generic,
- 0, 0, 0, 0
+ 0,
+ qt_alphamapblit_generic,
+ qt_alphargbblit_generic,
+ 0
},
// Format_RGB666
{
blend_color_generic,
blend_src_generic,
- 0, 0, 0, 0
+ 0,
+ qt_alphamapblit_generic,
+ qt_alphargbblit_generic,
+ 0
},
// Format_ARGB6666_Premultiplied
{
blend_color_generic,
blend_src_generic,
- 0, 0, 0, 0
+ 0,
+ qt_alphamapblit_generic,
+ qt_alphargbblit_generic,
+ 0
},
// Format_RGB555
{
blend_color_generic,
blend_src_generic,
- 0, 0, 0, 0
+ 0,
+ qt_alphamapblit_generic,
+ qt_alphargbblit_generic,
+ 0
},
// Format_ARGB8555_Premultiplied
{
blend_color_generic,
blend_src_generic,
- 0, 0, 0, 0
+ 0,
+ qt_alphamapblit_generic,
+ qt_alphargbblit_generic,
+ 0
},
// Format_RGB888
{
blend_color_generic,
blend_src_generic,
- 0, 0, 0, 0
+ 0,
+ qt_alphamapblit_generic,
+ qt_alphargbblit_generic,
+ 0
},
// Format_RGB444
{
blend_color_generic,
blend_src_generic,
- 0, 0, 0, 0
+ 0,
+ qt_alphamapblit_generic,
+ qt_alphargbblit_generic,
+ 0
},
// Format_ARGB4444_Premultiplied
{
blend_color_generic,
blend_src_generic,
- 0, 0, 0, 0
+ 0,
+ qt_alphamapblit_generic,
+ qt_alphargbblit_generic,
+ 0
},
// Format_RGBX8888
{
@@ -5960,9 +6211,9 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
qt_alphamapblit_rgba8888,
#else
- 0,
+ qt_alphamapblit_generic,
#endif
- 0,
+ qt_alphargbblit_generic,
qt_rectfill_rgba
},
// Format_RGBA8888
@@ -5973,9 +6224,9 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
qt_alphamapblit_rgba8888,
#else
- 0,
+ qt_alphamapblit_generic,
#endif
- 0,
+ qt_alphargbblit_generic,
qt_rectfill_nonpremul_rgba
},
// Format_RGB8888_Premultiplied
@@ -5986,9 +6237,9 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
qt_alphamapblit_rgba8888,
#else
- 0,
+ qt_alphamapblit_generic,
#endif
- 0,
+ qt_alphargbblit_generic,
qt_rectfill_rgba
},
// Format_BGR30
@@ -5996,8 +6247,8 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
blend_color_generic_rgb64,
blend_src_generic_rgb64,
qt_bitmapblit_rgb30<PixelOrderBGR>,
- 0,
- 0,
+ qt_alphamapblit_generic,
+ qt_alphargbblit_generic,
qt_rectfill_rgb30<PixelOrderBGR>
},
// Format_A2BGR30_Premultiplied
@@ -6005,8 +6256,8 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
blend_color_generic_rgb64,
blend_src_generic_rgb64,
qt_bitmapblit_rgb30<PixelOrderBGR>,
- 0,
- 0,
+ qt_alphamapblit_generic,
+ qt_alphargbblit_generic,
qt_rectfill_rgb30<PixelOrderBGR>
},
// Format_RGB30
@@ -6014,8 +6265,8 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
blend_color_generic_rgb64,
blend_src_generic_rgb64,
qt_bitmapblit_rgb30<PixelOrderRGB>,
- 0,
- 0,
+ qt_alphamapblit_generic,
+ qt_alphargbblit_generic,
qt_rectfill_rgb30<PixelOrderRGB>
},
// Format_A2RGB30_Premultiplied
@@ -6023,22 +6274,26 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
blend_color_generic_rgb64,
blend_src_generic_rgb64,
qt_bitmapblit_rgb30<PixelOrderRGB>,
- 0,
- 0,
+ qt_alphamapblit_generic,
+ qt_alphargbblit_generic,
qt_rectfill_rgb30<PixelOrderRGB>
},
// Format_Alpha8
{
blend_color_generic,
blend_src_generic,
- 0, 0, 0,
+ 0,
+ qt_alphamapblit_generic,
+ qt_alphargbblit_generic,
qt_rectfill_alpha
},
// Format_Grayscale8
{
blend_color_generic,
blend_src_generic,
- 0, 0, 0,
+ 0,
+ qt_alphamapblit_generic,
+ qt_alphargbblit_generic,
qt_rectfill_gray
},
};
@@ -6105,7 +6360,7 @@ void qt_memfill16(quint16 *dest, quint16 color, int count)
qt_memfill_template<quint16>(dest, color, count);
}
#endif
-#if !defined(__SSE2__) && !defined(__ARM_NEON__) && !defined(__mips_dsp)
+#if !defined(__SSE2__) && !defined(__ARM_NEON__) && !defined(__MIPS_DSP__)
void qt_memfill32(quint32 *dest, quint32 color, int count)
{
qt_memfill_template<quint32>(dest, color, count);
@@ -6296,52 +6551,50 @@ static void qInitDrawhelperFunctions()
qMemRotateFunctions[QImage::Format_RGB16][0] = qt_memrotate90_16_neon;
qMemRotateFunctions[QImage::Format_RGB16][2] = qt_memrotate270_16_neon;
#endif
-
-#endif
-
-#if defined(QT_COMPILER_SUPPORTS_MIPS_DSP) || defined(QT_COMPILER_SUPPORTS_MIPS_DSPR2)
- if (qCpuHasFeature(DSP) && qCpuHasFeature(DSPR2)) {
- // Composition functions are all DSP r1
- qt_functionForMode_C[QPainter::CompositionMode_SourceOver] = comp_func_SourceOver_asm_mips_dsp;
- qt_functionForMode_C[QPainter::CompositionMode_Source] = comp_func_Source_mips_dsp;
- qt_functionForMode_C[QPainter::CompositionMode_DestinationOver] = comp_func_DestinationOver_mips_dsp;
- qt_functionForMode_C[QPainter::CompositionMode_SourceIn] = comp_func_SourceIn_mips_dsp;
- qt_functionForMode_C[QPainter::CompositionMode_DestinationIn] = comp_func_DestinationIn_mips_dsp;
- qt_functionForMode_C[QPainter::CompositionMode_DestinationOut] = comp_func_DestinationOut_mips_dsp;
- qt_functionForMode_C[QPainter::CompositionMode_SourceAtop] = comp_func_SourceAtop_mips_dsp;
- qt_functionForMode_C[QPainter::CompositionMode_DestinationAtop] = comp_func_DestinationAtop_mips_dsp;
- qt_functionForMode_C[QPainter::CompositionMode_Xor] = comp_func_XOR_mips_dsp;
- qt_functionForMode_C[QPainter::CompositionMode_SourceOut] = comp_func_SourceOut_mips_dsp;
-
- qt_functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_mips_dsp;
- qt_functionForModeSolid_C[QPainter::CompositionMode_DestinationOver] = comp_func_solid_DestinationOver_mips_dsp;
- qt_functionForModeSolid_C[QPainter::CompositionMode_SourceIn] = comp_func_solid_SourceIn_mips_dsp;
- qt_functionForModeSolid_C[QPainter::CompositionMode_DestinationIn] = comp_func_solid_DestinationIn_mips_dsp;
- qt_functionForModeSolid_C[QPainter::CompositionMode_SourceAtop] = comp_func_solid_SourceAtop_mips_dsp;
- qt_functionForModeSolid_C[QPainter::CompositionMode_DestinationAtop] = comp_func_solid_DestinationAtop_mips_dsp;
- qt_functionForModeSolid_C[QPainter::CompositionMode_Xor] = comp_func_solid_XOR_mips_dsp;
- qt_functionForModeSolid_C[QPainter::CompositionMode_SourceOut] = comp_func_solid_SourceOut_mips_dsp;
-
- qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_mips_dsp;
- qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_mips_dsp;
- qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_mips_dsp;
- qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_mips_dsp;
-
- destFetchProc[QImage::Format_ARGB32] = qt_destFetchARGB32_mips_dsp;
-
- destStoreProc[QImage::Format_ARGB32] = qt_destStoreARGB32_mips_dsp;
-
- sourceFetchUntransformed[QImage::Format_RGB888] = qt_fetchUntransformed_888_mips_dsp;
- sourceFetchUntransformed[QImage::Format_RGB444] = qt_fetchUntransformed_444_mips_dsp;
- sourceFetchUntransformed[QImage::Format_ARGB8565_Premultiplied] = qt_fetchUntransformed_argb8565_premultiplied_mips_dsp;
-
-#if defined(QT_COMPILER_SUPPORTS_MIPS_DSPR2)
- qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_mips_dspr2;
+#endif // defined(__ARM_NEON__)
+
+#if defined(__MIPS_DSP__)
+ // Composition functions are all DSP r1
+ qt_functionForMode_C[QPainter::CompositionMode_SourceOver] = comp_func_SourceOver_asm_mips_dsp;
+ qt_functionForMode_C[QPainter::CompositionMode_Source] = comp_func_Source_mips_dsp;
+ qt_functionForMode_C[QPainter::CompositionMode_DestinationOver] = comp_func_DestinationOver_mips_dsp;
+ qt_functionForMode_C[QPainter::CompositionMode_SourceIn] = comp_func_SourceIn_mips_dsp;
+ qt_functionForMode_C[QPainter::CompositionMode_DestinationIn] = comp_func_DestinationIn_mips_dsp;
+ qt_functionForMode_C[QPainter::CompositionMode_DestinationOut] = comp_func_DestinationOut_mips_dsp;
+ qt_functionForMode_C[QPainter::CompositionMode_SourceAtop] = comp_func_SourceAtop_mips_dsp;
+ qt_functionForMode_C[QPainter::CompositionMode_DestinationAtop] = comp_func_DestinationAtop_mips_dsp;
+ qt_functionForMode_C[QPainter::CompositionMode_Xor] = comp_func_XOR_mips_dsp;
+ qt_functionForMode_C[QPainter::CompositionMode_SourceOut] = comp_func_SourceOut_mips_dsp;
+
+ qt_functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_mips_dsp;
+ qt_functionForModeSolid_C[QPainter::CompositionMode_DestinationOver] = comp_func_solid_DestinationOver_mips_dsp;
+ qt_functionForModeSolid_C[QPainter::CompositionMode_SourceIn] = comp_func_solid_SourceIn_mips_dsp;
+ qt_functionForModeSolid_C[QPainter::CompositionMode_DestinationIn] = comp_func_solid_DestinationIn_mips_dsp;
+ qt_functionForModeSolid_C[QPainter::CompositionMode_SourceAtop] = comp_func_solid_SourceAtop_mips_dsp;
+ qt_functionForModeSolid_C[QPainter::CompositionMode_DestinationAtop] = comp_func_solid_DestinationAtop_mips_dsp;
+ qt_functionForModeSolid_C[QPainter::CompositionMode_Xor] = comp_func_solid_XOR_mips_dsp;
+ qt_functionForModeSolid_C[QPainter::CompositionMode_SourceOut] = comp_func_solid_SourceOut_mips_dsp;
+
+ qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_mips_dsp;
+ qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_mips_dsp;
+ qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_mips_dsp;
+ qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_mips_dsp;
+
+ destFetchProc[QImage::Format_ARGB32] = qt_destFetchARGB32_mips_dsp;
+
+ destStoreProc[QImage::Format_ARGB32] = qt_destStoreARGB32_mips_dsp;
+
+ sourceFetchUntransformed[QImage::Format_RGB888] = qt_fetchUntransformed_888_mips_dsp;
+ sourceFetchUntransformed[QImage::Format_RGB444] = qt_fetchUntransformed_444_mips_dsp;
+ sourceFetchUntransformed[QImage::Format_ARGB8565_Premultiplied] = qt_fetchUntransformed_argb8565_premultiplied_mips_dsp;
+
+#if defined(__MIPS_DSPR2__)
+ qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_mips_dspr2;
+ sourceFetchUntransformed[QImage::Format_RGB16] = qt_fetchUntransformedRGB16_mips_dspr2;
#else
- qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_mips_dsp;
-#endif // QT_COMPILER_SUPPORTS_MIPS_DSPR2
- }
-#endif // QT_COMPILER_SUPPORTS_MIPS_DSP || QT_COMPILER_SUPPORTS_MIPS_DSPR2
+ qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_mips_dsp;
+#endif // defined(__MIPS_DSPR2__)
+#endif // defined(__MIPS_DSP__)
}
// Ensure initialization if this object file is linked.
diff --git a/src/gui/painting/qdrawhelper_mips_dsp.cpp b/src/gui/painting/qdrawhelper_mips_dsp.cpp
index 783e481296..e92a6606de 100644
--- a/src/gui/painting/qdrawhelper_mips_dsp.cpp
+++ b/src/gui/painting/qdrawhelper_mips_dsp.cpp
@@ -113,7 +113,7 @@ void qt_blend_rgb32_on_rgb32_mips_dsp(uchar *destPixels, int dbpl,
}
}
-#if defined QT_COMPILER_SUPPORTS_MIPS_DSPR2
+#if defined(__MIPS_DSPR2__)
void qt_blend_rgb16_on_rgb16_mips_dspr2(uchar *destPixels, int dbpl,
const uchar *srcPixels, int sbpl,
int w, int h,
@@ -521,4 +521,17 @@ const uint * QT_FASTCALL qt_fetchUntransformed_argb8565_premultiplied_mips_dsp (
return buffer;
}
+#if defined(__MIPS_DSPR2__)
+extern "C" void qConvertRgb16To32_asm_mips_dspr2(quint32 *dest, const quint16 *src, int length);
+
+const uint *QT_FASTCALL qt_fetchUntransformedRGB16_mips_dspr2(uint *buffer, const Operator *,
+ const QSpanData *data, int y, int x,
+ int length)
+{
+ const quint16 *scanLine = (const quint16 *)data->texture.scanLine(y) + x;
+ qConvertRgb16To32_asm_mips_dspr2(buffer, scanLine, length);
+ return buffer;
+}
+#endif
+
QT_END_NAMESPACE
diff --git a/src/gui/painting/qdrawhelper_mips_dsp_p.h b/src/gui/painting/qdrawhelper_mips_dsp_p.h
index 86773ad25f..36c4af2732 100644
--- a/src/gui/painting/qdrawhelper_mips_dsp_p.h
+++ b/src/gui/painting/qdrawhelper_mips_dsp_p.h
@@ -192,12 +192,9 @@ const uint * QT_FASTCALL qt_fetchUntransformed_argb8565_premultiplied_mips_dsp (
const QSpanData *data,
int y, int x, int length);
-#endif // QT_COMPILER_SUPPORTS_MIPS_DSP
-
-#ifdef QT_COMPILER_SUPPORTS_MIPS_DSPR2
-extern "C" void qConvertRgb16To32_asm_mips_dspr2(quint32 *dest, const quint16 *src, int length);
+#if defined(__MIPS_DSPR2__)
extern "C" void qt_blend_rgb16_on_rgb16_mips_dspr2_asm(quint16 *dest, const quint16 *src, int length, uint const_alpha);
@@ -206,7 +203,12 @@ void qt_blend_rgb16_on_rgb16_mips_dspr2(uchar *destPixels, int dbpl,
int w, int h,
int const_alpha);
-#endif // QT_COMPILER_SUPPORTS_MIPS_DSPR2
+const uint *QT_FASTCALL qt_fetchUntransformedRGB16_mips_dspr2(uint *buffer, const Operator *,
+ const QSpanData *data, int y, int x,
+ int length);
+#endif // defined(__MIPS_DSPR2__)
+
+#endif // QT_COMPILER_SUPPORTS_MIPS_DSP
QT_END_NAMESPACE
diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp
index 643c570f65..4cbac009d8 100644
--- a/src/gui/painting/qdrawhelper_neon.cpp
+++ b/src/gui/painting/qdrawhelper_neon.cpp
@@ -535,12 +535,23 @@ void qt_blend_rgb32_on_rgb32_neon(uchar *destPixels, int dbpl,
}
#if defined(ENABLE_PIXMAN_DRAWHELPERS)
+extern void qt_alphamapblit_quint16(QRasterBuffer *rasterBuffer,
+ int x, int y, const QRgba64 &color,
+ const uchar *map,
+ int mapWidth, int mapHeight, int mapStride,
+ const QClipData *clip, bool useGammaCorrection);
+
void qt_alphamapblit_quint16_neon(QRasterBuffer *rasterBuffer,
int x, int y, const QRgba64 &color,
const uchar *bitmap,
int mapWidth, int mapHeight, int mapStride,
- const QClipData *, bool /*useGammaCorrection*/)
+ const QClipData *clip, bool useGammaCorrection)
{
+ if (clip || useGammaCorrection) {
+ qt_alphamapblit_quint16(rasterBuffer, x, y, color, bitmap, mapWidth, mapHeight, mapStride, clip, useGammaCorrection);
+ return;
+ }
+
quint16 *dest = reinterpret_cast<quint16*>(rasterBuffer->scanLine(y)) + x;
const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint16);
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index fc4f2a9944..eb43453ddb 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -2621,7 +2621,7 @@ void QRasterPaintEngine::alphaPenBlt(const void* src, int bpl, int depth, int rx
return;
}
}
- } else if (d->deviceDepth == 32 && ((depth == 8 && s->penData.alphamapBlit) || (depth == 32 && s->penData.alphaRGBBlit))) {
+ } else if ((depth == 8 && s->penData.alphamapBlit) || (depth == 32 && s->penData.alphaRGBBlit)) {
// (A)RGB Alpha mask where the alpha component is not used.
if (!clip) {
int nx = qMax(0, rx);
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 74b961f042..083e68fcdb 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -7570,7 +7570,6 @@ start_lengthVariant:
lineWidth = qMax<qreal>(0, r.width());
if(!wordwrap)
tf |= Qt::TextIncludeTrailingSpaces;
- textLayout.engine()->ignoreBidi = bool(tf & Qt::TextDontPrint);
textLayout.beginLayout();
qreal leading = fm.leading();
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index aca59d0288..8067969f56 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -556,7 +556,6 @@ int QFontMetrics::width(const QString &text, int len, int flags) const
}
QStackTextEngine layout(text, QFont(d.data()));
- layout.ignoreBidi = true;
return qRound(layout.width(0, len));
}
@@ -692,7 +691,6 @@ QRect QFontMetrics::boundingRect(const QString &text) const
return QRect();
QStackTextEngine layout(text, QFont(d.data()));
- layout.ignoreBidi = true;
layout.itemize();
glyph_metrics_t gm = layout.boundingBox(0, text.length());
return QRect(qRound(gm.x), qRound(gm.y), qRound(gm.width), qRound(gm.height));
@@ -861,7 +859,6 @@ QRect QFontMetrics::tightBoundingRect(const QString &text) const
return QRect();
QStackTextEngine layout(text, QFont(d.data()));
- layout.ignoreBidi = true;
layout.itemize();
glyph_metrics_t gm = layout.tightBoundingBox(0, text.length());
return QRect(qRound(gm.x), qRound(gm.y), qRound(gm.width), qRound(gm.height));
@@ -1413,7 +1410,6 @@ qreal QFontMetricsF::width(const QString &text) const
int len = (pos != -1) ? pos : text.length();
QStackTextEngine layout(text, QFont(d.data()));
- layout.ignoreBidi = true;
layout.itemize();
return layout.width(0, len).toReal();
}
@@ -1496,7 +1492,6 @@ QRectF QFontMetricsF::boundingRect(const QString &text) const
return QRectF();
QStackTextEngine layout(text, QFont(d.data()));
- layout.ignoreBidi = true;
layout.itemize();
glyph_metrics_t gm = layout.boundingBox(0, len);
return QRectF(gm.x.toReal(), gm.y.toReal(),
@@ -1668,7 +1663,6 @@ QRectF QFontMetricsF::tightBoundingRect(const QString &text) const
return QRect();
QStackTextEngine layout(text, QFont(d.data()));
- layout.ignoreBidi = true;
layout.itemize();
glyph_metrics_t gm = layout.tightBoundingBox(0, text.length());
return QRectF(gm.x.toReal(), gm.y.toReal(), gm.width.toReal(), gm.height.toReal());
diff --git a/src/gui/text/qharfbuzzng.cpp b/src/gui/text/qharfbuzzng.cpp
index 55ef9f0d15..6aca660205 100644
--- a/src/gui/text/qharfbuzzng.cpp
+++ b/src/gui/text/qharfbuzzng.cpp
@@ -422,19 +422,53 @@ hb_unicode_funcs_t *hb_qt_get_unicode_funcs()
// Font routines
+#if HB_VERSION_ATLEAST(1, 1, 3)
static hb_bool_t
-_hb_qt_font_get_glyph(hb_font_t * /*font*/, void *font_data,
- hb_codepoint_t unicode, hb_codepoint_t /*variation_selector*/,
- hb_codepoint_t *glyph,
- void * /*user_data*/)
+_hb_qt_get_font_h_extents(hb_font_t * /*font*/, void *font_data,
+ hb_font_extents_t *metrics,
+ void * /*user_data*/)
{
QFontEngine *fe = static_cast<QFontEngine *>(font_data);
Q_ASSERT(fe);
- *glyph = fe->glyphIndex(unicode);
+ metrics->ascender = fe->ascent().value();
+ metrics->descender = fe->descent().value();
+ metrics->line_gap = fe->leading().value();
return true;
}
+#endif
+
+#if HB_VERSION_ATLEAST(1, 2, 3)
+static hb_bool_t
+_hb_qt_font_get_nominal_glyph(hb_font_t * /*font*/, void *font_data,
+ hb_codepoint_t unicode,
+ hb_codepoint_t *glyph,
+ void * /*user_data*/)
+{
+ QFontEngine *fe = static_cast<QFontEngine *>(font_data);
+ Q_ASSERT(fe);
+
+ *glyph = fe->glyphIndex(unicode);
+
+ return *glyph != 0;
+}
+#endif
+
+static hb_bool_t
+_hb_qt_font_get_variation_glyph(hb_font_t * /*font*/, void *font_data,
+ hb_codepoint_t unicode, hb_codepoint_t /*variation_selector*/,
+ hb_codepoint_t *glyph,
+ void * /*user_data*/)
+{
+ QFontEngine *fe = static_cast<QFontEngine *>(font_data);
+ Q_ASSERT(fe);
+
+ // ### TODO add support for variation selectors
+ *glyph = fe->glyphIndex(unicode);
+
+ return *glyph != 0;
+}
static hb_position_t
_hb_qt_font_get_glyph_h_advance(hb_font_t *font, void *font_data,
@@ -456,15 +490,7 @@ _hb_qt_font_get_glyph_h_advance(hb_font_t *font, void *font_data,
return advance.value();
}
-static hb_position_t
-_hb_qt_font_get_glyph_v_advance(hb_font_t * /*font*/, void * /*font_data*/,
- hb_codepoint_t /*glyph*/,
- void * /*user_data*/)
-{
- qCritical("hb_qt_font_get_glyph_v_advance: vertical writing isn't supported!");
- return 0;
-}
-
+#if !HB_VERSION_ATLEAST(1, 1, 2)
static hb_bool_t
_hb_qt_font_get_glyph_h_origin(hb_font_t * /*font*/, void * /*font_data*/,
hb_codepoint_t /*glyph*/,
@@ -473,16 +499,7 @@ _hb_qt_font_get_glyph_h_origin(hb_font_t * /*font*/, void * /*font_data*/,
{
return true; // we always work in the horizontal coordinates
}
-
-static hb_bool_t
-_hb_qt_font_get_glyph_v_origin(hb_font_t * /*font*/, void * /*font_data*/,
- hb_codepoint_t /*glyph*/,
- hb_position_t * /*x*/, hb_position_t * /*y*/,
- void * /*user_data*/)
-{
- qCritical("hb_qt_get_glyph_v_origin: vertical writing isn't supported!");
- return false;
-}
+#endif
static hb_position_t
_hb_qt_font_get_glyph_h_kerning(hb_font_t *font, void *font_data,
@@ -505,15 +522,6 @@ _hb_qt_font_get_glyph_h_kerning(hb_font_t *font, void *font_data,
return advance.value();
}
-static hb_position_t
-_hb_qt_font_get_glyph_v_kerning(hb_font_t * /*font*/, void * /*font_data*/,
- hb_codepoint_t /*first_glyph*/, hb_codepoint_t /*second_glyph*/,
- void * /*user_data*/)
-{
- qCritical("hb_qt_get_glyph_v_kerning: vertical writing isn't supported!");
- return 0;
-}
-
static hb_bool_t
_hb_qt_font_get_glyph_extents(hb_font_t * /*font*/, void *font_data,
hb_codepoint_t glyph,
@@ -554,29 +562,6 @@ _hb_qt_font_get_glyph_contour_point(hb_font_t * /*font*/, void *font_data,
return false;
}
-static hb_bool_t
-_hb_qt_font_get_glyph_name(hb_font_t * /*font*/, void * /*font_data*/,
- hb_codepoint_t /*glyph*/,
- char *name, unsigned int size,
- void * /*user_data*/)
-{
- qCritical("hb_qt_font_get_glyph_name: not implemented!");
- if (size)
- *name = '\0';
- return false;
-}
-
-static hb_bool_t
-_hb_qt_font_get_glyph_from_name(hb_font_t * /*font*/, void * /*font_data*/,
- const char * /*name*/, int /*len*/,
- hb_codepoint_t *glyph,
- void * /*user_data*/)
-{
- qCritical("hb_qt_font_get_glyph_from_name: not implemented!");
- *glyph = 0;
- return false;
-}
-
static hb_user_data_key_t _useDesignMetricsKey;
@@ -595,17 +580,25 @@ struct _hb_qt_font_funcs_t {
_hb_qt_font_funcs_t()
{
funcs = hb_font_funcs_create();
- hb_font_funcs_set_glyph_func(funcs, _hb_qt_font_get_glyph, NULL, NULL);
+
+#if HB_VERSION_ATLEAST(1, 1, 3)
+ hb_font_funcs_set_font_h_extents_func(funcs, _hb_qt_get_font_h_extents, NULL, NULL);
+#endif
+#if HB_VERSION_ATLEAST(1, 2, 3)
+ hb_font_funcs_set_nominal_glyph_func(funcs, _hb_qt_font_get_nominal_glyph, NULL, NULL);
+ hb_font_funcs_set_variation_glyph_func(funcs, _hb_qt_font_get_variation_glyph, NULL, NULL);
+#else
+ hb_font_funcs_set_glyph_func(funcs, _hb_qt_font_get_variation_glyph, NULL, NULL);
+#endif
hb_font_funcs_set_glyph_h_advance_func(funcs, _hb_qt_font_get_glyph_h_advance, NULL, NULL);
- hb_font_funcs_set_glyph_v_advance_func(funcs, _hb_qt_font_get_glyph_v_advance, NULL, NULL);
+#if !HB_VERSION_ATLEAST(1, 1, 2)
hb_font_funcs_set_glyph_h_origin_func(funcs, _hb_qt_font_get_glyph_h_origin, NULL, NULL);
- hb_font_funcs_set_glyph_v_origin_func(funcs, _hb_qt_font_get_glyph_v_origin, NULL, NULL);
+#endif
hb_font_funcs_set_glyph_h_kerning_func(funcs, _hb_qt_font_get_glyph_h_kerning, NULL, NULL);
- hb_font_funcs_set_glyph_v_kerning_func(funcs, _hb_qt_font_get_glyph_v_kerning, NULL, NULL);
hb_font_funcs_set_glyph_extents_func(funcs, _hb_qt_font_get_glyph_extents, NULL, NULL);
hb_font_funcs_set_glyph_contour_point_func(funcs, _hb_qt_font_get_glyph_contour_point, NULL, NULL);
- hb_font_funcs_set_glyph_name_func(funcs, _hb_qt_font_get_glyph_name, NULL, NULL);
- hb_font_funcs_set_glyph_from_name_func(funcs, _hb_qt_font_get_glyph_from_name, NULL, NULL);
+
+ hb_font_funcs_make_immutable(funcs);
}
~_hb_qt_font_funcs_t()
{
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 67cafa53fe..f3ed8ef63a 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1165,6 +1165,20 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
hb_buffer_clear_contents(buffer);
hb_buffer_add_utf16(buffer, reinterpret_cast<const uint16_t *>(string) + item_pos, item_length, 0, item_length);
+#if defined(Q_OS_DARWIN)
+ // ### temporary workaround for QTBUG-38113
+ // CoreText throws away the PDF token, while the OpenType backend will replace it with
+ // a zero-advance glyph. This becomes a real issue when PDF is the last character,
+ // since it gets treated like if it were a grapheme extender, so we
+ // temporarily replace it with some visible grapheme starter.
+ bool endsWithPDF = actualFontEngine->type() == QFontEngine::Mac && string[item_pos + item_length - 1] == 0x202c;
+ if (Q_UNLIKELY(endsWithPDF)) {
+ uint num_glyphs;
+ hb_glyph_info_t *infos = hb_buffer_get_glyph_infos(buffer, &num_glyphs);
+ infos[num_glyphs - 1].codepoint = '.';
+ }
+#endif
+
hb_buffer_set_segment_properties(buffer, &props);
hb_buffer_guess_segment_properties(buffer);
@@ -1286,6 +1300,20 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
while (str_pos < item_length)
log_clusters[str_pos++] = last_glyph_pos;
+#if defined(Q_OS_DARWIN)
+ if (Q_UNLIKELY(endsWithPDF)) {
+ int last_glyph_idx = num_glyphs - 1;
+ g.glyphs[last_glyph_idx] = 0xffff;
+ g.advances[last_glyph_idx] = QFixed();
+ g.offsets[last_glyph_idx].x = QFixed();
+ g.offsets[last_glyph_idx].y = QFixed();
+ g.attributes[last_glyph_idx].clusterStart = true;
+ g.attributes[last_glyph_idx].dontPrint = true;
+
+ log_clusters[item_length - 1] = glyphs_shaped + last_glyph_idx;
+ }
+#endif
+
if (Q_UNLIKELY(engineIdx != 0)) {
for (quint32 i = 0; i < num_glyphs; ++i)
g.glyphs[i] |= (engineIdx << 24);
diff --git a/src/network/access/qhstspolicy.cpp b/src/network/access/qhstspolicy.cpp
index 2cec587f4d..6922e1d8f9 100644
--- a/src/network/access/qhstspolicy.cpp
+++ b/src/network/access/qhstspolicy.cpp
@@ -156,7 +156,7 @@ QString QHstsPolicy::host(QUrl::ComponentFormattingOptions options) const
}
/*!
- Sets the expiration date for the policy (in UTC).
+ Sets the expiration date for the policy (in UTC) to \a expiry.
\sa expiry()
*/
@@ -176,9 +176,9 @@ QDateTime QHstsPolicy::expiry() const
}
/*!
- Includes or excludes subdomains for this policy.
+ Sets whether subdomains are included for this policy to \a include.
- \sa includeSubdomains()
+ \sa includesSubDomains()
*/
void QHstsPolicy::setIncludesSubDomains(bool include)
{
@@ -196,7 +196,7 @@ bool QHstsPolicy::includesSubDomains() const
}
/*!
- Returns \c true if the two policies have the same host and expriration date
+ Returns \c true if the two policies have the same host and expiration date
while agreeing on whether to include or exclude subdomains.
*/
bool QHstsPolicy::operator==(const QHstsPolicy &other) const
diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp
index 928c7fc68f..b56d460b8c 100644
--- a/src/network/socket/qnativesocketengine.cpp
+++ b/src/network/socket/qnativesocketengine.cpp
@@ -761,7 +761,9 @@ bool QNativeSocketEngine::leaveMulticastGroup(const QHostAddress &groupAddress,
return d->nativeLeaveMulticastGroup(groupAddress, iface);
}
-/*! \since 4.8 */
+/*!
+ \since 4.8
+*/
QNetworkInterface QNativeSocketEngine::multicastInterface() const
{
Q_D(const QNativeSocketEngine);
@@ -770,7 +772,9 @@ QNetworkInterface QNativeSocketEngine::multicastInterface() const
return d->nativeMulticastInterface();
}
-/*! \since 4.8 */
+/*!
+ \since 4.8
+*/
bool QNativeSocketEngine::setMulticastInterface(const QNetworkInterface &iface)
{
Q_D(QNativeSocketEngine);
diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp
index 89261ce789..95a0d0563a 100644
--- a/src/network/socket/qsocks5socketengine.cpp
+++ b/src/network/socket/qsocks5socketengine.cpp
@@ -1271,13 +1271,6 @@ void QSocks5SocketEnginePrivate::_q_controlSocketStateChanged(QAbstractSocket::S
}
#ifndef QT_NO_UDPSOCKET
-void QSocks5SocketEnginePrivate::checkForDatagrams() const
-{
- // udp should be unbuffered so we need to do some polling at certain points
- if (udpData->udpSocket->hasPendingDatagrams())
- const_cast<QSocks5SocketEnginePrivate *>(this)->_q_udpSocketReadNotification();
-}
-
void QSocks5SocketEnginePrivate::_q_udpSocketReadNotification()
{
QSOCKS5_D_DEBUG << "_q_udpSocketReadNotification()";
@@ -1609,8 +1602,6 @@ bool QSocks5SocketEngine::hasPendingDatagrams() const
Q_D(const QSocks5SocketEngine);
Q_INIT_CHECK(false);
- d->checkForDatagrams();
-
return !d->udpData->pendingDatagrams.isEmpty();
}
@@ -1618,8 +1609,6 @@ qint64 QSocks5SocketEngine::pendingDatagramSize() const
{
Q_D(const QSocks5SocketEngine);
- d->checkForDatagrams();
-
if (!d->udpData->pendingDatagrams.isEmpty())
return d->udpData->pendingDatagrams.head().data.size();
return 0;
@@ -1631,8 +1620,6 @@ qint64 QSocks5SocketEngine::readDatagram(char *data, qint64 maxlen, QIpPacketHea
#ifndef QT_NO_UDPSOCKET
Q_D(QSocks5SocketEngine);
- d->checkForDatagrams();
-
if (d->udpData->pendingDatagrams.isEmpty())
return 0;
diff --git a/src/network/socket/qsocks5socketengine_p.h b/src/network/socket/qsocks5socketengine_p.h
index 864b163489..ec50d71283 100644
--- a/src/network/socket/qsocks5socketengine_p.h
+++ b/src/network/socket/qsocks5socketengine_p.h
@@ -248,7 +248,6 @@ public:
void _q_controlSocketReadNotification();
void _q_controlSocketError(QAbstractSocket::SocketError);
#ifndef QT_NO_UDPSOCKET
- void checkForDatagrams() const;
void _q_udpSocketReadNotification();
#endif
void _q_controlSocketBytesWritten();
diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp
index 2b7351d124..5f55dba9da 100644
--- a/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp
+++ b/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp
@@ -896,7 +896,7 @@ int QWindowsFontEngine::synthesized() const
synthesized_flags = SynthesizedItalic;
if (fontDef.stretch != 100 && ttf)
synthesized_flags |= SynthesizedStretch;
- if (tm.tmWeight >= 500 && !(macStyle & 1))
+ if (tm.tmWeight >= 500 && tm.tmWeight < 750 && !(macStyle & 1))
synthesized_flags |= SynthesizedBold;
//qDebug() << "font is" << _name <<
// "it=" << (macStyle & 2) << fontDef.style << "flags=" << synthesized_flags;
diff --git a/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp b/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp
index b55ace357a..9baf94726d 100644
--- a/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp
+++ b/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp
@@ -65,9 +65,32 @@ QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(qLcTray, "qt.qpa.tray")
+static QString iconTempPath()
+{
+ QString tempPath = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);
+ if (!tempPath.isEmpty())
+ return tempPath;
+
+ tempPath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation);
+
+ if (!tempPath.isEmpty()) {
+ QDir tempDir(tempPath);
+ if (tempDir.exists())
+ return tempPath;
+
+ if (tempDir.mkpath(QStringLiteral("."))) {
+ const QFile::Permissions permissions = QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner;
+ if (QFile(tempPath).setPermissions(permissions))
+ return tempPath;
+ }
+ }
+
+ return QDir::tempPath();
+}
+
static const QString KDEItemFormat = QStringLiteral("org.kde.StatusNotifierItem-%1-%2");
static const QString KDEWatcherService = QStringLiteral("org.kde.StatusNotifierWatcher");
-static const QString TempFileTemplate = QDir::tempPath() + QLatin1String("/qt-trayicon-XXXXXX.png");
+static const QString TempFileTemplate = iconTempPath() + QLatin1String("/qt-trayicon-XXXXXX.png");
static const QString XdgNotificationService = QStringLiteral("org.freedesktop.Notifications");
static const QString XdgNotificationPath = QStringLiteral("/org/freedesktop/Notifications");
static const QString DefaultAction = QStringLiteral("default");
diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro
index f71a901341..02b3e96bfa 100644
--- a/src/plugins/bearer/generic/generic.pro
+++ b/src/plugins/bearer/generic/generic.pro
@@ -12,6 +12,8 @@ SOURCES += qgenericengine.cpp \
OTHER_FILES += generic.json
+win32:!winrt:LIBS += -lIphlpapi
+
PLUGIN_TYPE = bearer
PLUGIN_CLASS_NAME = QGenericEnginePlugin
load(qt_plugin)
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp
index 059617b367..cd3b202001 100644
--- a/src/plugins/bearer/generic/qgenericengine.cpp
+++ b/src/plugins/bearer/generic/qgenericengine.cpp
@@ -54,7 +54,13 @@
#include <QtCore/private/qcoreapplication_p.h>
#if defined(Q_OS_WIN32)
+// PMIB_TCPTABLE2 is only available since Vista
+#if _WIN32_WINNT < 0x0600
+# undef _WIN32_WINNT
+# define _WIN32_WINNT 0x0600
+#endif // _WIN32_WINNT < 0x0600
#include "../platformdefs_win.h"
+#include <iphlpapi.h>
#endif
#ifdef Q_OS_WINRT
@@ -71,9 +77,10 @@ using namespace ABI::Windows::Foundation;
using namespace ABI::Windows::Foundation::Collections;
using namespace ABI::Windows::Networking;
using namespace ABI::Windows::Networking::Connectivity;
+#endif // Q_OS_WINRT
+
// needed as interface is used as parameter name in qGetInterfaceType
#undef interface
-#endif // Q_OS_WINRT
#ifdef Q_OS_LINUX
#include <sys/socket.h>
@@ -89,62 +96,38 @@ QT_BEGIN_NAMESPACE
static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interface)
{
#if defined(Q_OS_WIN32)
- DWORD bytesWritten;
- NDIS_MEDIUM medium;
- NDIS_PHYSICAL_MEDIUM physicalMedium;
-
- unsigned long oid;
- HANDLE handle = CreateFile((TCHAR *)QString::fromLatin1("\\\\.\\%1").arg(interface).utf16(), 0,
- FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
- if (handle == INVALID_HANDLE_VALUE)
+ // QNetworkInterface::name returns a more friendly name on Windows. That name is not
+ // accepted as an identifier for CreateFile so we have to obtain the Luid.
+ std::wstring buf = interface.toStdWString();
+ if (buf.size() == 0)
return QNetworkConfiguration::BearerUnknown;
- bytesWritten = 0;
-
- oid = OID_GEN_MEDIA_SUPPORTED;
- bool result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid),
- &medium, sizeof(medium), &bytesWritten, 0);
- if (!result) {
- CloseHandle(handle);
+ NET_LUID luid;
+ NETIO_STATUS status = ConvertInterfaceNameToLuidW(buf.c_str(), &luid);
+ if (status != NO_ERROR)
return QNetworkConfiguration::BearerUnknown;
- }
-
- bytesWritten = 0;
- oid = OID_GEN_PHYSICAL_MEDIUM;
- result = DeviceIoControl(handle, IOCTL_NDIS_QUERY_GLOBAL_STATS, &oid, sizeof(oid),
- &physicalMedium, sizeof(physicalMedium), &bytesWritten, 0);
-
- if (!result) {
- CloseHandle(handle);
-
- if (medium == NdisMedium802_3)
- return QNetworkConfiguration::BearerEthernet;
- else
- return QNetworkConfiguration::BearerUnknown;
- }
-
- CloseHandle(handle);
-
- if (medium == NdisMedium802_3) {
- switch (physicalMedium) {
- case NdisPhysicalMediumWirelessLan:
- return QNetworkConfiguration::BearerWLAN;
- case NdisPhysicalMediumBluetooth:
- return QNetworkConfiguration::BearerBluetooth;
- case NdisPhysicalMediumWiMax:
- return QNetworkConfiguration::BearerWiMAX;
- default:
+ switch (luid.Info.IfType) {
+ case IF_TYPE_ETHERNET_CSMACD:
+ case IF_TYPE_ISO88025_TOKENRING:
+ case IF_TYPE_PPP:
+ case IF_TYPE_SOFTWARE_LOOPBACK:
+ return QNetworkConfiguration::BearerEthernet;
+ case IF_TYPE_IEEE80211:
+ return QNetworkConfiguration::BearerWLAN;
+ case IF_TYPE_ATM:
+ case IF_TYPE_IEEE1394:
+ case IF_TYPE_OTHER:
+ case IF_TYPE_TUNNEL:
+ return QNetworkConfiguration::BearerUnknown;
+ default:
#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "Physical Medium" << physicalMedium;
+ qDebug() << "Interface Type" << luid.Info.IfType;
#endif
- return QNetworkConfiguration::BearerEthernet;
- }
+ return QNetworkConfiguration::BearerUnknown;
}
+ return QNetworkConfiguration::BearerUnknown;
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << medium << physicalMedium;
-#endif
#elif defined(Q_OS_LINUX)
int sock = socket(AF_INET, SOCK_DGRAM, 0);
diff --git a/src/plugins/generic/tuiotouch/qtuiohandler.cpp b/src/plugins/generic/tuiotouch/qtuiohandler.cpp
index 26b88d6d78..eb646644ec 100644
--- a/src/plugins/generic/tuiotouch/qtuiohandler.cpp
+++ b/src/plugins/generic/tuiotouch/qtuiohandler.cpp
@@ -488,7 +488,7 @@ void QTuioHandler::process2DObjSet(const QOscMessage &message)
return;
}
- qCDebug(lcTuioSet) << "Processing SET for token " << classId << id << " @ " << x << y << "∡" << angle <<
+ qCDebug(lcTuioSet) << "Processing SET for token " << classId << id << " @ " << x << y << " angle: " << angle <<
"vel" << vx << vy << angularVelocity << "acc" << acceleration << angularAcceleration;
QTuioToken &tok = *it;
tok.setClassId(classId);
diff --git a/src/plugins/platforms/android/qandroideventdispatcher.cpp b/src/plugins/platforms/android/qandroideventdispatcher.cpp
index 104e905b8f..e12551283f 100644
--- a/src/plugins/platforms/android/qandroideventdispatcher.cpp
+++ b/src/plugins/platforms/android/qandroideventdispatcher.cpp
@@ -108,10 +108,9 @@ QAndroidEventDispatcherStopper *QAndroidEventDispatcherStopper::instance()
void QAndroidEventDispatcherStopper::startAll()
{
QMutexLocker lock(&m_mutex);
- if (started)
+ if (!m_started.testAndSetOrdered(0, 1))
return;
- started = true;
for (QAndroidEventDispatcher *d : qAsConst(m_dispatchers))
d->start();
}
@@ -119,10 +118,9 @@ void QAndroidEventDispatcherStopper::startAll()
void QAndroidEventDispatcherStopper::stopAll()
{
QMutexLocker lock(&m_mutex);
- if (!started)
+ if (!m_started.testAndSetOrdered(1, 0))
return;
- started = false;
for (QAndroidEventDispatcher *d : qAsConst(m_dispatchers))
d->stop();
}
diff --git a/src/plugins/platforms/android/qandroideventdispatcher.h b/src/plugins/platforms/android/qandroideventdispatcher.h
index 057a1660c9..e6f903bced 100644
--- a/src/plugins/platforms/android/qandroideventdispatcher.h
+++ b/src/plugins/platforms/android/qandroideventdispatcher.h
@@ -68,7 +68,7 @@ class QAndroidEventDispatcherStopper
{
public:
static QAndroidEventDispatcherStopper *instance();
- static bool stopped() {return !instance()->started; }
+ static bool stopped() {return !instance()->m_started.load(); }
void startAll();
void stopAll();
void addEventDispatcher(QAndroidEventDispatcher *dispatcher);
@@ -77,7 +77,7 @@ public:
private:
QMutex m_mutex;
- bool started = true;
+ QAtomicInt m_started = 1;
QVector<QAndroidEventDispatcher *> m_dispatchers;
};
diff --git a/src/plugins/platforms/android/qandroidplatformwindow.h b/src/plugins/platforms/android/qandroidplatformwindow.h
index 87e5cbaa4f..91cb1e76e6 100644
--- a/src/plugins/platforms/android/qandroidplatformwindow.h
+++ b/src/plugins/platforms/android/qandroidplatformwindow.h
@@ -71,7 +71,7 @@ public:
void requestActivateWindow() override;
void updateStatusBarVisibility();
inline bool isRaster() const {
- if ((window()->flags() & Qt::ForeignWindow) == Qt::ForeignWindow)
+ if (isForeignWindow())
return false;
return window()->surfaceType() == QSurface::RasterSurface
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
index e743dd56bf..6001a845e8 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
@@ -235,9 +235,16 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
if (!iface || !iface->isValid())
return nil;
+ // macOS expects that the hierarchy is:
+ // App -> Window -> Children
+ // We don't actually have the window reflected properly in QAccessibility.
+ // Check if the parent is the application and then instead return the native window.
+
if (QAccessibleInterface *parent = iface->parent()) {
- QAccessible::Id parentId = QAccessible::uniqueId(parent);
- return [QMacAccessibilityElement elementWithId: parentId];
+ if (parent->role() != QAccessible::Application) {
+ QAccessible::Id parentId = QAccessible::uniqueId(parent);
+ return [QMacAccessibilityElement elementWithId: parentId];
+ }
}
if (QWindow *window = iface->window()) {
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index 3e637b5db3..232e40769b 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -151,7 +151,8 @@ Qt::DropActions qt_mac_mapNSDragOperations(NSDragOperation nsActions)
a no-op.
For extra verbosity and clearer code, please consider checking
- that window()->type() != Qt::ForeignWindow before using this cast.
+ that the platform window is not a foreign window before using
+ this cast, via QPlatformWindow::isForeignWindow().
Do not use this method soley to check for foreign windows, as
that will make the code harder to read for people not working
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index fe24f95db4..114efc3e92 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -485,7 +485,7 @@ QCocoaWindow::~QCocoaWindow()
// Make sure to disconnect observer in all case if view is valid
// to avoid notifications received when deleting when using Qt::AA_NativeWindows attribute
- if (window()->type() != Qt::ForeignWindow)
+ if (!isForeignWindow())
[[NSNotificationCenter defaultCenter] removeObserver:m_view];
// While it is unlikely that this window will be in the popup stack
@@ -557,7 +557,7 @@ void QCocoaWindow::setCocoaGeometry(const QRect &rect)
QMacAutoReleasePool pool;
if (m_viewIsEmbedded) {
- if (window()->type() != Qt::ForeignWindow) {
+ if (!isForeignWindow()) {
[m_view setFrame:NSMakeRect(0, 0, rect.width(), rect.height())];
} else {
QPlatformWindow::setGeometry(rect);
@@ -581,7 +581,7 @@ void QCocoaWindow::setCocoaGeometry(const QRect &rect)
[m_view setFrame:NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height())];
}
- if (window()->type() == Qt::ForeignWindow)
+ if (isForeignWindow())
QPlatformWindow::setGeometry(rect);
// will call QPlatformWindow::setGeometry(rect) during resize confirmation (see qnsview.mm)
@@ -1288,7 +1288,7 @@ void QCocoaWindow::windowDidEndLiveResize()
void QCocoaWindow::windowDidBecomeKey()
{
- if (window()->type() == Qt::ForeignWindow)
+ if (isForeignWindow())
return;
if (m_windowUnderMouse) {
@@ -1304,7 +1304,7 @@ void QCocoaWindow::windowDidBecomeKey()
void QCocoaWindow::windowDidResignKey()
{
- if (window()->type() == Qt::ForeignWindow)
+ if (isForeignWindow())
return;
// Key window will be non-nil if another window became key, so do not
@@ -1885,7 +1885,7 @@ void QCocoaWindow::setWindowCursor(NSCursor *cursor)
return;
// Setting a cursor in a foregin view is not supported.
- if (window()->type() == Qt::ForeignWindow)
+ if (isForeignWindow())
return;
[m_windowCursor release];
diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm
index 3781a4cc65..2d5afa9375 100644
--- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm
+++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm
@@ -66,7 +66,7 @@
- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame
{
Q_UNUSED(newFrame);
- if (m_cocoaWindow && m_cocoaWindow->window()->type() != Qt::ForeignWindow)
+ if (m_cocoaWindow && !m_cocoaWindow->isForeignWindow())
[qnsview_cast(m_cocoaWindow->view()) notifyWindowWillZoom:![window isZoomed]];
return YES;
}
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp
index a2af586947..3951f46a82 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp
@@ -111,7 +111,12 @@ QImage::Format QEglFSKmsScreen::format() const
QSizeF QEglFSKmsScreen::physicalSize() const
{
- return m_output.physical_size;
+ if (!m_output.physical_size.isEmpty()) {
+ return m_output.physical_size;
+ } else {
+ const QSize s = geometry().size();
+ return QSizeF(0.254 * s.width(), 0.254 * s.height());
+ }
}
QDpi QEglFSKmsScreen::logicalDpi() const
diff --git a/src/plugins/platforms/windows/openglblacklists/default.json b/src/plugins/platforms/windows/openglblacklists/default.json
index dd99e674ec..69f4a54d05 100644
--- a/src/plugins/platforms/windows/openglblacklists/default.json
+++ b/src/plugins/platforms/windows/openglblacklists/default.json
@@ -114,6 +114,18 @@
"features": [
"disable_desktopgl"
]
- }
+ },
+ {
+ "id": 10,
+ "description": "Intel(R) HD Graphics IronLake (Arrandale) crashes on makeCurrent QTBUG-53888",
+ "vendor_id": "0x8086",
+ "device_id": [ "0x0046" ],
+ "os": {
+ "type": "win"
+ },
+ "features": [
+ "disable_desktopgl"
+ ]
+ }
]
}
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index 81abf24131..34c34fd28e 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -414,7 +414,7 @@ static bool isValidWheelReceiver(QWindow *candidate)
{
if (candidate) {
const QWindow *toplevel = QWindowsWindow::topLevelOf(candidate);
- if (toplevel->type() == Qt::ForeignWindow)
+ if (toplevel->handle() && toplevel->handle()->isForeignWindow())
return true;
if (const QWindowsWindow *ww = QWindowsWindow::windowsWindowOf(toplevel))
return !ww->testFlag(QWindowsWindow::BlockedByModal);
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 04db975360..68d69f3765 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1122,7 +1122,7 @@ void QWindowsWindow::updateDropSite(bool topLevel)
// if the parent window is a foreign window wrapped via QWindow::fromWinId, we need to enable the drop site
// on the first child window
const QWindow *parent = window()->parent();
- if (parent && (parent->type() == Qt::ForeignWindow))
+ if (parent && parent->handle() && parent->handle()->isForeignWindow())
parentIsEmbedded = true;
}
diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h
index 22ba49b0a5..8179280bb3 100644
--- a/src/plugins/platforms/windows/qwindowswindow.h
+++ b/src/plugins/platforms/windows/qwindowswindow.h
@@ -385,15 +385,14 @@ QPoint QWindowsGeometryHint::mapFromGlobal(const QWindow *w, const QPoint &p)
inline QWindowsWindow *QWindowsWindow::windowsWindowOf(const QWindow *w)
{
- QWindowsWindow *result = Q_NULLPTR;
- if (w) {
- const Qt::WindowType type = w->type();
- if (type != Qt::Desktop && type != Qt::ForeignWindow) {
- if (QPlatformWindow *pw = w->handle())
- result = static_cast<QWindowsWindow *>(pw);
- }
- }
- return result;
+ if (!w || !w->handle())
+ return nullptr;
+
+ const Qt::WindowType type = w->type();
+ if (type == Qt::Desktop || w->handle()->isForeignWindow())
+ return nullptr;
+
+ return static_cast<QWindowsWindow *>(w->handle());
}
void *QWindowsWindow::userDataOf(HWND hwnd)
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 756806108e..fd23179075 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -397,7 +397,7 @@ void QXcbWindow::create()
xcb_window_t xcb_parent_id = platformScreen->root();
if (parent()) {
xcb_parent_id = static_cast<QXcbWindow *>(parent())->xcb_window();
- m_embedded = parent()->window()->type() == Qt::ForeignWindow;
+ m_embedded = parent()->isForeignWindow();
QSurfaceFormat parentFormat = parent()->window()->requestedFormat();
if (window()->surfaceType() != QSurface::OpenGLSurface && parentFormat.hasAlpha()) {
@@ -1508,7 +1508,7 @@ void QXcbWindow::setParent(const QPlatformWindow *parent)
if (parent) {
const QXcbWindow *qXcbParent = static_cast<const QXcbWindow *>(parent);
xcb_parent_id = qXcbParent->xcb_window();
- m_embedded = qXcbParent->window()->type() == Qt::ForeignWindow;
+ m_embedded = qXcbParent->isForeignWindow();
} else {
xcb_parent_id = xcbScreen()->root();
m_embedded = false;
diff --git a/src/plugins/platformthemes/gtk3/qgtk3menu.h b/src/plugins/platformthemes/gtk3/qgtk3menu.h
index ad108f1218..21e6178ec4 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3menu.h
+++ b/src/plugins/platformthemes/gtk3/qgtk3menu.h
@@ -55,7 +55,7 @@ public:
GtkWidget *create();
GtkWidget *handle() const;
- quintptr tag() const;
+ quintptr tag() const override;
void setTag(quintptr tag) override;
QString text() const;
diff --git a/src/sql/configure.pri b/src/sql/configure.pri
index a8bc09e524..05794582e9 100644
--- a/src/sql/configure.pri
+++ b/src/sql/configure.pri
@@ -67,8 +67,11 @@ defineTest(qtConfLibrary_mysqlConfig) {
libs = $$cleanlibs
}
$${1}.libs = "$$val_escape(libs)"
- eval(includedir = $$includedir)
- includedir ~= s/^-I//g
+ eval(rawincludedir = $$includedir)
+ rawincludedir ~= s/^-I//g
+ includedir =
+ for (id, rawincludedir): \
+ includedir += $$clean_path($$id)
includedir -= $$QMAKE_DEFAULT_INCDIRS
$${1}.includedir = "$$val_escape(includedir)"
export($${1}.libs)
diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp
index 9932fb75e3..8166613e53 100644
--- a/src/sql/models/qsqltablemodel.cpp
+++ b/src/sql/models/qsqltablemodel.cpp
@@ -55,6 +55,11 @@ QT_BEGIN_NAMESPACE
typedef QSqlTableModelSql Sql;
+QSqlTableModelPrivate::~QSqlTableModelPrivate()
+{
+
+}
+
/*! \internal
Populates our record with values.
*/
diff --git a/src/sql/models/qsqltablemodel_p.h b/src/sql/models/qsqltablemodel_p.h
index 4a79d5db36..3b64cdfa47 100644
--- a/src/sql/models/qsqltablemodel_p.h
+++ b/src/sql/models/qsqltablemodel_p.h
@@ -58,7 +58,7 @@
QT_BEGIN_NAMESPACE
-class QSqlTableModelPrivate: public QSqlQueryModelPrivate
+class Q_AUTOTEST_EXPORT QSqlTableModelPrivate: public QSqlQueryModelPrivate
{
Q_DECLARE_PUBLIC(QSqlTableModel)
@@ -69,6 +69,8 @@ public:
strategy(QSqlTableModel::OnRowChange),
busyInsertingRows(false)
{}
+ ~QSqlTableModelPrivate();
+
void clear();
virtual void clearCache();
QSqlRecord record(const QVector<QVariant> &values) const;
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index e8883df527..e5715ecd57 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -557,8 +557,8 @@ int QDialog::exec()
void QDialog::done(int r)
{
Q_D(QDialog);
- hide();
setResult(r);
+ hide();
d->close_helper(QWidgetPrivate::CloseNoEvent);
d->resetModalitySetByOpen();
diff --git a/src/widgets/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h
index 1c7c5f3c2a..ae9e3bcc93 100644
--- a/src/widgets/dialogs/qdialog_p.h
+++ b/src/widgets/dialogs/qdialog_p.h
@@ -119,6 +119,24 @@ private:
mutable bool m_platformHelperCreated;
};
+template <typename T>
+class QAutoPointer {
+ QPointer<T> o;
+ struct internal { void func() {} };
+ typedef void (internal::*RestrictedBool)();
+public:
+ explicit QAutoPointer(T *t) Q_DECL_NOTHROW : o(t) {}
+ ~QAutoPointer() { delete o; }
+
+ T *operator->() const Q_DECL_NOTHROW { return get(); }
+ T *get() const Q_DECL_NOTHROW { return o; }
+ T &operator*() const { return *get(); }
+ operator RestrictedBool() const Q_DECL_NOTHROW { return o ? &internal::func : Q_NULLPTR; }
+ bool operator!() const Q_DECL_NOTHROW { return !o; }
+private:
+ Q_DISABLE_COPY(QAutoPointer);
+};
+
QT_END_NAMESPACE
#endif // QDIALOG_P_H
diff --git a/src/widgets/dialogs/qinputdialog.cpp b/src/widgets/dialogs/qinputdialog.cpp
index d09f77ea35..4ca3923d8d 100644
--- a/src/widgets/dialogs/qinputdialog.cpp
+++ b/src/widgets/dialogs/qinputdialog.cpp
@@ -1194,10 +1194,6 @@ void QInputDialog::done(int result)
\snippet dialogs/standarddialogs/dialog.cpp 3
- \warning Do not delete \a parent during the execution of the dialog. If you
- want to do this, you should create the dialog yourself using one of the
- QInputDialog constructors.
-
\sa getInt(), getDouble(), getItem(), getMultiLineText()
*/
@@ -1205,18 +1201,18 @@ QString QInputDialog::getText(QWidget *parent, const QString &title, const QStri
QLineEdit::EchoMode mode, const QString &text, bool *ok,
Qt::WindowFlags flags, Qt::InputMethodHints inputMethodHints)
{
- QInputDialog dialog(parent, flags);
- dialog.setWindowTitle(title);
- dialog.setLabelText(label);
- dialog.setTextValue(text);
- dialog.setTextEchoMode(mode);
- dialog.setInputMethodHints(inputMethodHints);
+ QAutoPointer<QInputDialog> dialog(new QInputDialog(parent, flags));
+ dialog->setWindowTitle(title);
+ dialog->setLabelText(label);
+ dialog->setTextValue(text);
+ dialog->setTextEchoMode(mode);
+ dialog->setInputMethodHints(inputMethodHints);
- int ret = dialog.exec();
+ const int ret = dialog->exec();
if (ok)
*ok = !!ret;
if (ret) {
- return dialog.textValue();
+ return dialog->textValue();
} else {
return QString();
}
@@ -1246,10 +1242,6 @@ QString QInputDialog::getText(QWidget *parent, const QString &title, const QStri
\snippet dialogs/standarddialogs/dialog.cpp 4
- \warning Do not delete \a parent during the execution of the dialog. If you
- want to do this, you should create the dialog yourself using one of the
- QInputDialog constructors.
-
\sa getInt(), getDouble(), getItem(), getText()
*/
@@ -1257,18 +1249,18 @@ QString QInputDialog::getMultiLineText(QWidget *parent, const QString &title, co
const QString &text, bool *ok, Qt::WindowFlags flags,
Qt::InputMethodHints inputMethodHints)
{
- QInputDialog dialog(parent, flags);
- dialog.setOptions(QInputDialog::UsePlainTextEditForTextInput);
- dialog.setWindowTitle(title);
- dialog.setLabelText(label);
- dialog.setTextValue(text);
- dialog.setInputMethodHints(inputMethodHints);
+ QAutoPointer<QInputDialog> dialog(new QInputDialog(parent, flags));
+ dialog->setOptions(QInputDialog::UsePlainTextEditForTextInput);
+ dialog->setWindowTitle(title);
+ dialog->setLabelText(label);
+ dialog->setTextValue(text);
+ dialog->setInputMethodHints(inputMethodHints);
- int ret = dialog.exec();
+ const int ret = dialog->exec();
if (ok)
*ok = !!ret;
if (ret) {
- return dialog.textValue();
+ return dialog->textValue();
} else {
return QString();
}
@@ -1298,28 +1290,24 @@ QString QInputDialog::getMultiLineText(QWidget *parent, const QString &title, co
\snippet dialogs/standarddialogs/dialog.cpp 0
- \warning Do not delete \a parent during the execution of the dialog. If you
- want to do this, you should create the dialog yourself using one of the
- QInputDialog constructors.
-
\sa getText(), getDouble(), getItem(), getMultiLineText()
*/
int QInputDialog::getInt(QWidget *parent, const QString &title, const QString &label, int value,
int min, int max, int step, bool *ok, Qt::WindowFlags flags)
{
- QInputDialog dialog(parent, flags);
- dialog.setWindowTitle(title);
- dialog.setLabelText(label);
- dialog.setIntRange(min, max);
- dialog.setIntValue(value);
- dialog.setIntStep(step);
+ QAutoPointer<QInputDialog> dialog(new QInputDialog(parent, flags));
+ dialog->setWindowTitle(title);
+ dialog->setLabelText(label);
+ dialog->setIntRange(min, max);
+ dialog->setIntValue(value);
+ dialog->setIntStep(step);
- int ret = dialog.exec();
+ const int ret = dialog->exec();
if (ok)
*ok = !!ret;
if (ret) {
- return dialog.intValue();
+ return dialog->intValue();
} else {
return value;
}
@@ -1350,10 +1338,6 @@ int QInputDialog::getInt(QWidget *parent, const QString &title, const QString &l
\snippet dialogs/standarddialogs/dialog.cpp 0
- \warning Do not delete \a parent during the execution of the dialog. If you
- want to do this, you should create the dialog yourself using one of the
- QInputDialog constructors.
-
\sa getText(), getDouble(), getItem(), getMultiLineText()
*/
@@ -1379,10 +1363,6 @@ int QInputDialog::getInt(QWidget *parent, const QString &title, const QString &l
\snippet dialogs/standarddialogs/dialog.cpp 1
- \warning Do not delete \a parent during the execution of the dialog. If you
- want to do this, you should create the dialog yourself using one of the
- QInputDialog constructors.
-
\sa getText(), getInt(), getItem(), getMultiLineText()
*/
@@ -1390,18 +1370,18 @@ double QInputDialog::getDouble(QWidget *parent, const QString &title, const QStr
double value, double min, double max, int decimals, bool *ok,
Qt::WindowFlags flags)
{
- QInputDialog dialog(parent, flags);
- dialog.setWindowTitle(title);
- dialog.setLabelText(label);
- dialog.setDoubleDecimals(decimals);
- dialog.setDoubleRange(min, max);
- dialog.setDoubleValue(value);
+ QAutoPointer<QInputDialog> dialog(new QInputDialog(parent, flags));
+ dialog->setWindowTitle(title);
+ dialog->setLabelText(label);
+ dialog->setDoubleDecimals(decimals);
+ dialog->setDoubleRange(min, max);
+ dialog->setDoubleValue(value);
- int ret = dialog.exec();
+ const int ret = dialog->exec();
if (ok)
*ok = !!ret;
if (ret) {
- return dialog.doubleValue();
+ return dialog->doubleValue();
} else {
return value;
}
@@ -1433,10 +1413,6 @@ double QInputDialog::getDouble(QWidget *parent, const QString &title, const QStr
\snippet dialogs/standarddialogs/dialog.cpp 2
- \warning Do not delete \a parent during the execution of the dialog. If you
- want to do this, you should create the dialog yourself using one of the
- QInputDialog constructors.
-
\sa getText(), getInt(), getDouble(), getMultiLineText()
*/
@@ -1446,19 +1422,19 @@ QString QInputDialog::getItem(QWidget *parent, const QString &title, const QStri
{
QString text(items.value(current));
- QInputDialog dialog(parent, flags);
- dialog.setWindowTitle(title);
- dialog.setLabelText(label);
- dialog.setComboBoxItems(items);
- dialog.setTextValue(text);
- dialog.setComboBoxEditable(editable);
- dialog.setInputMethodHints(inputMethodHints);
+ QAutoPointer<QInputDialog> dialog(new QInputDialog(parent, flags));
+ dialog->setWindowTitle(title);
+ dialog->setLabelText(label);
+ dialog->setComboBoxItems(items);
+ dialog->setTextValue(text);
+ dialog->setComboBoxEditable(editable);
+ dialog->setInputMethodHints(inputMethodHints);
- int ret = dialog.exec();
+ const int ret = dialog->exec();
if (ok)
*ok = !!ret;
if (ret) {
- return dialog.textValue();
+ return dialog->textValue();
} else {
return text;
}
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index b69a523c51..bd5bf08bb8 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -6596,7 +6596,7 @@ QGraphicsItem *QGraphicsItem::commonAncestorItem(const QGraphicsItem *other) con
}
/*!
- \since 4,4
+ \since 4.4
Returns \c true if this item is currently under the mouse cursor in one of
the views; otherwise, false is returned.
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 008b2a0d77..2c85ed3c0b 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -2161,11 +2161,14 @@ QWidget *qt_tlw_for_window(QWindow *wnd)
// QTBUG-32177, wnd might be a QQuickView embedded via window container.
while (wnd && !wnd->isTopLevel()) {
QWindow *parent = wnd->parent();
+ if (!parent)
+ break;
+
// Don't end up in windows not belonging to this application
- if (parent && parent->type() != Qt::ForeignWindow)
- wnd = wnd->parent();
- else
+ if (parent->handle() && parent->handle()->isForeignWindow())
break;
+
+ wnd = wnd->parent();
}
if (wnd) {
const auto tlws = qApp->topLevelWidgets();
diff --git a/src/widgets/kernel/qsizepolicy.cpp b/src/widgets/kernel/qsizepolicy.cpp
index 34ad64217b..a03523d2af 100644
--- a/src/widgets/kernel/qsizepolicy.cpp
+++ b/src/widgets/kernel/qsizepolicy.cpp
@@ -400,7 +400,7 @@ void QSizePolicy::setControlType(ControlType type)
*/
/*!
- \fn QSizePolicy QSizePolicy::transposed()
+ \fn QSizePolicy QSizePolicy::transposed() const
\since 5.9
Returns a size policy object with the horizontal and vertical
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 759821a057..d35ad87c8d 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1483,6 +1483,8 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
win->handle()->setFrameStrutEventsEnabled(true);
data.window_flags = win->flags();
+ if (!win->isTopLevel()) // In a Widget world foreign windows can only be top level
+ data.window_flags &= ~Qt::ForeignWindow;
if (!topData()->role.isNull())
QXcbWindowFunctions::setWmWindowRole(win, topData()->role.toLatin1());
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index d9d270643c..9be19b2679 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -3916,10 +3916,12 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
if (pb->minimum == 0 && pb->maximum == 0) {
int chunkCount = fillWidth/chunkWidth;
int offset = 0;
+#if QT_CONFIG(animation)
if (QProgressStyleAnimation *animation = qobject_cast<QProgressStyleAnimation*>(d->animation(opt->styleObject)))
offset = animation->animationStep() * 8 % rect.width();
else
d->startAnimation(new QProgressStyleAnimation(d->animationFps, opt->styleObject));
+#endif
int x = reverse ? r.left() + r.width() - offset - chunkWidth : r.x() + offset;
while (chunkCount > 0) {
r.setRect(x, rect.y(), chunkWidth, rect.height());
@@ -3950,8 +3952,9 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
subRule.drawRule(p, r);
x += reverse ? -chunkWidth : chunkWidth;
}
-
+#if QT_CONFIG(animation)
d->stopAnimation(opt->styleObject);
+#endif
}
p->restore();
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index f9370a2cc7..0ce8dde74c 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -1729,10 +1729,12 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
int step = 0;
int chunkCount = w / unit_width + 1;
+#if QT_CONFIG(animation)
if (QProgressStyleAnimation *animation = qobject_cast<QProgressStyleAnimation*>(d->animation(opt->styleObject)))
step = (animation->animationStep() / 3) % chunkCount;
else
d->startAnimation(new QProgressStyleAnimation(d->animationFps, opt->styleObject));
+#endif
int chunksInRow = 5;
int myY = pbBits.rect.y();
int myHeight = pbBits.rect.height();
@@ -1766,7 +1768,9 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
p->restore(); //restore state
}
else {
+#if QT_CONFIG(animation)
d->stopAnimation(opt->styleObject);
+#endif
QCommonStyle::drawControl(ce, opt, p, widget);
}
}
diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp
index 3d21320655..dc0b6855ac 100644
--- a/src/widgets/util/qundostack.cpp
+++ b/src/widgets/util/qundostack.cpp
@@ -164,7 +164,7 @@ bool QUndoCommand::isObsolete() const
/*!
\since 5.9
- Sets whether the command is obsolete.
+ Sets whether the command is obsolete to \a obsolete.
\sa isObsolete(), mergeWith(), QUndoStack::push(), QUndoStack::undo(), QUndoStack::redo()
*/
diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp
index 34eef201b8..8eb5669f1c 100644
--- a/src/widgets/widgets/qmainwindow.cpp
+++ b/src/widgets/widgets/qmainwindow.cpp
@@ -661,7 +661,7 @@ void QMainWindow::setCentralWidget(QWidget *widget)
The ownership of the removed widget is passed to the caller.
- \since Qt 5.2
+ \since 5.2
*/
QWidget *QMainWindow::takeCentralWidget()
{
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index 4ed4b8f767..4f94f6e654 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -1856,6 +1856,27 @@ void QMainWindowLayout::invalidate()
minSize = szHint = QSize();
}
+#ifndef QT_NO_DOCKWIDGET
+void QMainWindowLayout::setCurrentHoveredFloat(QWidget *w)
+{
+ if (currentHoveredFloat != w) {
+ if (currentHoveredFloat) {
+ disconnect(currentHoveredFloat.data(), &QObject::destroyed,
+ this, &QMainWindowLayout::updateGapIndicator);
+ }
+
+ currentHoveredFloat = w;
+
+ if (w) {
+ connect(w, &QObject::destroyed,
+ this, &QMainWindowLayout::updateGapIndicator, Qt::UniqueConnection);
+ }
+
+ updateGapIndicator();
+ }
+}
+#endif //QT_NO_DOCKWIDGET
+
/******************************************************************************
** QMainWindowLayout - remaining stuff
*/
@@ -1942,7 +1963,7 @@ bool QMainWindowLayout::plug(QLayoutItem *widgetItem)
dropTo->setParent(floatingTabs);
dropTo->show();
dropTo->d_func()->plug(QRect());
- currentHoveredFloat = floatingTabs;
+ setCurrentHoveredFloat(floatingTabs);
}
#endif // QT_CONFIG(tabwidget)
#if QT_CONFIG(tabbar)
@@ -2095,7 +2116,7 @@ void QMainWindowLayout::animationFinished(QWidget *widget)
currentGapPos.clear();
pluggingWidget = 0;
#if QT_CONFIG(dockwidget)
- currentHoveredFloat = nullptr;
+ setCurrentHoveredFloat(nullptr);
#endif
//applying the state will make sure that the currentGap is updated correctly
//and all the geometries (especially the one from the central widget) is correct
@@ -2395,12 +2416,12 @@ void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos)
if (!w->geometry().contains(mousePos))
continue;
- currentHoveredFloat = w;
+ setCurrentHoveredFloat(w);
restore(true);
return;
}
}
- currentHoveredFloat = Q_NULLPTR;
+ setCurrentHoveredFloat(nullptr);
#endif //QT_NO_DOCKWIDGET
QPoint pos = parentWidget()->mapFromGlobal(mousePos);
diff --git a/src/widgets/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h
index 94706d2347..507759fe96 100644
--- a/src/widgets/widgets/qmainwindowlayout_p.h
+++ b/src/widgets/widgets/qmainwindowlayout_p.h
@@ -305,18 +305,20 @@ public:
#endif
#ifndef QT_NO_DOCKWIDGET
QPointer<QWidget> currentHoveredFloat; // set when dragging over a floating dock widget
+ void setCurrentHoveredFloat(QWidget *w);
#endif
void hover(QLayoutItem *widgetItem, const QPoint &mousePos);
bool plug(QLayoutItem *widgetItem);
QLayoutItem *unplug(QWidget *widget, bool group = false);
void revert(QLayoutItem *widgetItem);
- void updateGapIndicator();
+ void paintDropIndicator(QPainter *p, QWidget *widget, const QRegion &clip);
void applyState(QMainWindowLayoutState &newState, bool animate = true);
void restore(bool keepSavedState = false);
void animationFinished(QWidget *widget);
private Q_SLOTS:
+ void updateGapIndicator();
#ifndef QT_NO_DOCKWIDGET
#ifndef QT_NO_TABBAR
void tabChanged();
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index ba67baeadb..9bf062b407 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -1447,7 +1447,7 @@ static QString computeElidedText(Qt::TextElideMode mode, const QString &text)
/*!
Returns the minimum tab size hint for the tab at position \a index.
- \since Qt 5.0
+ \since 5.0
*/
QSize QTabBar::minimumTabSizeHint(int index) const
@@ -1756,7 +1756,10 @@ void QTabBar::paintEvent(QPaintEvent *)
p.drawControl(QStyle::CE_TabBarTab, tab);
else {
int taboverlap = style()->pixelMetric(QStyle::PM_TabBarTabOverlap, 0, this);
- d->movingTab->setGeometry(tab.rect.adjusted(-taboverlap, 0, taboverlap, 0));
+ if (verticalTabs(d->shape))
+ d->movingTab->setGeometry(tab.rect.adjusted(0, -taboverlap, 0, taboverlap));
+ else
+ d->movingTab->setGeometry(tab.rect.adjusted(-taboverlap, 0, taboverlap, 0));
}
}
@@ -2035,7 +2038,10 @@ void QTabBarPrivate::setupMovableTab()
int taboverlap = q->style()->pixelMetric(QStyle::PM_TabBarTabOverlap, 0 ,q);
QRect grabRect = q->tabRect(pressedIndex);
- grabRect.adjust(-taboverlap, 0, taboverlap, 0);
+ if (verticalTabs(shape))
+ grabRect.adjust(0, -taboverlap, 0, taboverlap);
+ else
+ grabRect.adjust(-taboverlap, 0, taboverlap, 0);
QPixmap grabImage(grabRect.size() * q->devicePixelRatioF());
grabImage.setDevicePixelRatio(q->devicePixelRatioF());
@@ -2045,7 +2051,11 @@ void QTabBarPrivate::setupMovableTab()
QStyleOptionTab tab;
q->initStyleOption(&tab, pressedIndex);
- tab.rect.moveTopLeft(QPoint(taboverlap, 0));
+ tab.position = QStyleOptionTab::OnlyOneTab;
+ if (verticalTabs(shape))
+ tab.rect.moveTopLeft(QPoint(0, taboverlap));
+ else
+ tab.rect.moveTopLeft(QPoint(taboverlap, 0));
p.drawControl(QStyle::CE_TabBarTab, tab);
p.end();
diff --git a/src/winmain/qtmain_win.cpp b/src/winmain/qtmain_win.cpp
index 7087176110..5f90055762 100644
--- a/src/winmain/qtmain_win.cpp
+++ b/src/winmain/qtmain_win.cpp
@@ -61,16 +61,9 @@
linking to the Qt DLL.
When a Windows application starts, the WinMain function is
- invoked. WinMain calls qWinMain in the Qt DLL/library, which
- initializes Qt.
+ invoked.
*/
-QT_BEGIN_NAMESPACE
-
-extern void qWinMain(HINSTANCE, HINSTANCE, LPSTR, int, int &, QVector<char *> &);
-
-QT_END_NAMESPACE
-
QT_USE_NAMESPACE
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index e2a0c80396..57e197aa83 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -243,6 +243,8 @@ private slots:
void invalidFile_data();
void invalidFile();
+ void reuseQFile();
+
private:
enum FileType {
OpenQFile,
@@ -3434,5 +3436,65 @@ void tst_QFile::autocloseHandle()
}
}
+void tst_QFile::reuseQFile()
+{
+ // QTemporaryDir is current dir, no need to remove these files
+ const QString filename1("filegt16k");
+ const QString filename2("file16k");
+
+ // create test files for reusing QFile object
+ QFile file;
+ file.setFileName(filename1);
+ QVERIFY(file.open(QIODevice::WriteOnly));
+ QByteArray ba(17408, 'a');
+ qint64 written = file.write(ba);
+ QCOMPARE(written, 17408);
+ file.close();
+
+ file.setFileName(filename2);
+ QVERIFY(file.open(QIODevice::WriteOnly));
+ ba.resize(16384);
+ written = file.write(ba);
+ QCOMPARE(written, 16384);
+ file.close();
+
+ QVERIFY(file.open(QIODevice::ReadOnly));
+ QCOMPARE(file.size(), 16384);
+ QCOMPARE(file.pos(), qint64(0));
+ QVERIFY(file.seek(10));
+ QCOMPARE(file.pos(), qint64(10));
+ QVERIFY(file.seek(0));
+ QCOMPARE(file.pos(), qint64(0));
+ QCOMPARE(file.readAll(), ba);
+ file.close();
+
+ file.setFileName(filename1);
+ QVERIFY(file.open(QIODevice::ReadOnly));
+
+ // read first file
+ {
+ // get file size without touching QFile
+ QFileInfo fi(filename1);
+ const qint64 fileSize = fi.size();
+ file.read(fileSize);
+ QVERIFY(file.atEnd());
+ file.close();
+ }
+
+ // try again with the next file with the same QFile object
+ file.setFileName(filename2);
+ QVERIFY(file.open(QIODevice::ReadOnly));
+
+ // read second file
+ {
+ // get file size without touching QFile
+ QFileInfo fi(filename2);
+ const qint64 fileSize = fi.size();
+ file.read(fileSize);
+ QVERIFY(file.atEnd());
+ file.close();
+ }
+}
+
QTEST_MAIN(tst_QFile)
#include "tst_qfile.moc"
diff --git a/tests/auto/corelib/io/qsettings/qsettings.qrc b/tests/auto/corelib/io/qsettings/qsettings.qrc
index c0be7e013f..c664a6f68c 100644
--- a/tests/auto/corelib/io/qsettings/qsettings.qrc
+++ b/tests/auto/corelib/io/qsettings/qsettings.qrc
@@ -5,6 +5,7 @@
<file>resourcefile3.ini</file>
<file>resourcefile4.ini</file>
<file>resourcefile5.ini</file>
+ <file>resourcefile6.plist</file>
<file>bom.ini</file>
</qresource>
</RCC>
diff --git a/tests/auto/corelib/io/qsettings/resourcefile6.plist b/tests/auto/corelib/io/qsettings/resourcefile6.plist
new file mode 100644
index 0000000000..6f994accac
--- /dev/null
+++ b/tests/auto/corelib/io/qsettings/resourcefile6.plist
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>passwordData</key>
+ <data>
+ RBxVAAsDVsO/
+ </data>
+</dict>
+</plist>
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index fcff13b416..332c2dcc01 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -178,6 +178,7 @@ private slots:
void testByteArray_data();
void testByteArray();
+ void testByteArrayNativeFormat();
void iniCodec();
void bom();
void embeddedZeroByte_data();
@@ -671,6 +672,16 @@ void tst_QSettings::testByteArray()
}
}
+void tst_QSettings::testByteArrayNativeFormat()
+{
+#ifndef Q_OS_MACOS
+ QSKIP("This test is specific to macOS plist reading.");
+#else
+ QSettings settings(":/resourcefile6.plist", QSettings::NativeFormat);
+ QCOMPARE(settings.value("passwordData"), QVariant(QByteArray::fromBase64("RBxVAAsDVsO/")));
+#endif
+}
+
void tst_QSettings::iniCodec()
{
{
@@ -2316,14 +2327,14 @@ void tst_QSettings::setIniCodec()
{
QFile inFile(settings4.fileName());
- inFile.open(QIODevice::ReadOnly);
+ inFile.open(QIODevice::ReadOnly | QIODevice::Text);
actualContents4 = inFile.readAll();
inFile.close();
}
{
QFile inFile(settings5.fileName());
- inFile.open(QIODevice::ReadOnly);
+ inFile.open(QIODevice::ReadOnly | QIODevice::Text);
actualContents5 = inFile.readAll();
inFile.close();
}
@@ -2331,9 +2342,6 @@ void tst_QSettings::setIniCodec()
QConfFile::clearCache();
-#ifdef Q_OS_WIN
- QEXPECT_FAIL("", "QTBUG-25446", Abort);
-#endif
QCOMPARE(actualContents4, expeContents4);
QCOMPARE(actualContents5, expeContents5);
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp
index d69e0997d5..71a0c943d2 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp
+++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp
@@ -3058,8 +3058,11 @@ void tst_QUrl::fromUserInputWithCwd_data()
#endif
); // fromUserInput cleans the path
}
- QTest::newRow(("file-" + QByteArray::number(c++)).constData())
+ QTest::newRow(("file-" + QByteArray::number(c)).constData())
<< it.fileName() << QDir::currentPath() << url << url;
+ QTest::newRow(("file-" + QByteArray::number(c) + "-dot").constData())
+ << it.fileName() << QStringLiteral(".") << url << url;
+ ++c;
}
#ifndef Q_OS_WINRT // WinRT cannot cd outside current / sandbox
QDir parent = QDir::current();
diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
index 29ff552f6a..3c2989831e 100644
--- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
+++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
@@ -158,6 +158,7 @@ void tst_QTimer::remainingTime()
QTimer timer;
connect(&timer, SIGNAL(timeout()), &helper, SLOT(timeout()));
+ timer.setTimerType(Qt::PreciseTimer);
timer.start(200);
QCOMPARE(helper.count, 0);
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index 2a9b9c0a7f..6cb23023c7 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -1755,6 +1755,10 @@ void tst_QVariant::compareNumbers_data() const
QTest::newRow("double5") << qVariantFromValue(0.) << qVariantFromValue(-qInf()) << +1;
QTest::newRow("double6") << qVariantFromValue(-double(qInf())) << qVariantFromValue(-qInf()) << 0;
QTest::newRow("double7") << qVariantFromValue(qInf()) << qVariantFromValue(qInf()) << 0;
+ QTest::newRow("double8") << qVariantFromValue(-qInf()) << qVariantFromValue(qInf()) << -1;
+ QTest::newRow("double9") << qVariantFromValue(qQNaN()) << qVariantFromValue(0.) << INT_MAX;
+ QTest::newRow("double10") << qVariantFromValue(0.) << qVariantFromValue(qQNaN()) << INT_MAX;
+ QTest::newRow("double11") << qVariantFromValue(qQNaN()) << qVariantFromValue(qQNaN()) << INT_MAX;
// mixed comparisons
// fp + fp
@@ -1763,8 +1767,12 @@ void tst_QVariant::compareNumbers_data() const
QTest::newRow("float+double3") << qVariantFromValue(0.f) << qVariantFromValue(-1.) << +1;
QTest::newRow("float+double4") << qVariantFromValue(-float(qInf())) << qVariantFromValue(0.) << -1;
QTest::newRow("float+double5") << qVariantFromValue(0.f) << qVariantFromValue(-qInf()) << +1;
- QTest::newRow("float+double6") << qVariantFromValue(-float(qInf())) << qVariantFromValue(qInf()) << 0;
+ QTest::newRow("float+double6") << qVariantFromValue(-float(qInf())) << qVariantFromValue(-qInf()) << 0;
QTest::newRow("float+double7") << qVariantFromValue(float(qInf())) << qVariantFromValue(qInf()) << 0;
+ QTest::newRow("float+double8") << qVariantFromValue(-float(qInf())) << qVariantFromValue(qInf()) << -1;
+ QTest::newRow("float+double9") << qVariantFromValue(qQNaN()) << qVariantFromValue(0.) << INT_MAX;
+ QTest::newRow("float+double10") << qVariantFromValue(0.) << qVariantFromValue(qQNaN()) << INT_MAX;
+ QTest::newRow("float+double11") << qVariantFromValue(qQNaN()) << qVariantFromValue(qQNaN()) << INT_MAX;
// fp + int
QTest::newRow("float+int1") << qVariantFromValue(0.f) << qVariantFromValue(0) << 0;
@@ -1978,7 +1986,7 @@ void tst_QVariant::compareNumbers() const
QCOMPARE(v2, v1);
QVERIFY(v2 >= v1);
QVERIFY(!(v2 > v1));
- } else {
+ } else if (expected == +1) {
QVERIFY(!(v1 < v2));
QVERIFY(!(v1 <= v2));
QVERIFY(!(v1 == v2));
@@ -1990,6 +1998,9 @@ void tst_QVariant::compareNumbers() const
QVERIFY(!(v2 == v1));
QVERIFY(!(v2 >= v1));
QVERIFY(!(v2 > v1));
+ } else {
+ // unorderable (NaN)
+ QVERIFY(!(v1 == v2));
}
}
diff --git a/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp b/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp
index 0c098cb1c3..8a55f54449 100644
--- a/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp
+++ b/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp
@@ -54,12 +54,21 @@ void tst_QStringMatcher::qstringmatcher()
// public Qt::CaseSensitivity caseSensitivity() const
void tst_QStringMatcher::caseSensitivity()
{
- QStringMatcher matcher;
+ const QString haystack = QStringLiteral("foobarFoo");
+ const QStringRef needle = haystack.rightRef(3); // "Foo"
+ QStringMatcher matcher(needle.data(), needle.size());
- matcher.setCaseSensitivity(Qt::CaseSensitive);
QCOMPARE(matcher.caseSensitivity(), Qt::CaseSensitive);
+ QCOMPARE(matcher.indexIn(haystack), 6);
+
matcher.setCaseSensitivity(Qt::CaseInsensitive);
+
QCOMPARE(matcher.caseSensitivity(), Qt::CaseInsensitive);
+ QCOMPARE(matcher.indexIn(haystack), 0);
+
+ matcher.setCaseSensitivity(Qt::CaseSensitive);
+ QCOMPARE(matcher.caseSensitivity(), Qt::CaseSensitive);
+ QCOMPARE(matcher.indexIn(haystack), 6);
}
void tst_QStringMatcher::indexIn_data()
diff --git a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
index 72609d4095..e3bda6c2df 100644
--- a/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/gui/image/qpixmap/tst_qpixmap.cpp
@@ -119,6 +119,7 @@ private slots:
void refUnref();
void copy();
+ void deepCopyPreservesDpr();
void depthOfNullObjects();
void transformed();
@@ -1133,6 +1134,19 @@ void tst_QPixmap::copy()
QCOMPARE(trans, transCopy);
}
+// QTBUG-58653: Force a deep copy of a pixmap by
+// having a QPainter and check whether DevicePixelRatio is preserved
+void tst_QPixmap::deepCopyPreservesDpr()
+{
+ const qreal dpr = 2;
+ QPixmap src(32, 32);
+ src.setDevicePixelRatio(dpr);
+ src.fill(Qt::red);
+ QPainter painter(&src);
+ const QPixmap dest = src.copy();
+ QCOMPARE(dest.devicePixelRatio(), dpr);
+}
+
void tst_QPixmap::depthOfNullObjects()
{
QBitmap b1;
diff --git a/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp
index 6192e3cd8d..8667caa1ef 100644
--- a/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp
+++ b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp
@@ -202,36 +202,36 @@ void tst_QFontMetrics::bypassShaping()
QCOMPARE(textWidth, charsWidth);
}
-template<class FontMetrics> void elidedMultiLength_helper()
+template<class FontMetrics, typename PrimitiveType> void elidedMultiLength_helper()
{
QString text1 = QLatin1String("Long Text 1\x9cShorter\x9csmall");
QString text1_long = "Long Text 1";
QString text1_short = "Shorter";
QString text1_small = "small";
FontMetrics fm = FontMetrics(QFont());
- int width_long = fm.size(0, text1_long).width();
+ PrimitiveType width_long = fm.size(0, text1_long).width();
QCOMPARE(fm.elidedText(text1,Qt::ElideRight, 8000), text1_long);
QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_long + 1), text1_long);
QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_long - 1), text1_short);
- int width_short = fm.size(0, text1_short).width();
+ PrimitiveType width_short = fm.size(0, text1_short).width();
QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_short + 1), text1_short);
QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_short - 1), text1_small);
// Not even wide enough for "small" - should use ellipsis
QChar ellipsisChar(0x2026);
QString text1_el = QString::fromLatin1("s") + ellipsisChar;
- int width_small = fm.width(text1_el);
+ PrimitiveType width_small = fm.width(text1_el);
QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_small + 1), text1_el);
}
void tst_QFontMetrics::elidedMultiLength()
{
- elidedMultiLength_helper<QFontMetrics>();
+ elidedMultiLength_helper<QFontMetrics, int>();
}
void tst_QFontMetrics::elidedMultiLengthF()
{
- elidedMultiLength_helper<QFontMetricsF>();
+ elidedMultiLength_helper<QFontMetricsF, qreal>();
}
void tst_QFontMetrics::inFontUcs4()
diff --git a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp
index 7c60c8c9f8..21b2697b90 100644
--- a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp
+++ b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp
@@ -527,6 +527,7 @@ void tst_QGlyphRun::drawStruckOutText()
QFont font;
font.setStrikeOut(true);
+ font.setStyleStrategy(QFont::ForceIntegerMetrics);
QTextLayout layout(s);
layout.setFont(font);
@@ -569,6 +570,7 @@ void tst_QGlyphRun::drawOverlinedText()
QFont font;
font.setOverline(true);
+ font.setStyleStrategy(QFont::ForceIntegerMetrics);
QTextLayout layout(s);
layout.setFont(font);
@@ -611,6 +613,7 @@ void tst_QGlyphRun::drawUnderlinedText()
QFont font;
font.setUnderline(true);
+ font.setStyleStrategy(QFont::ForceIntegerMetrics);
QTextLayout layout(s);
layout.setFont(font);
diff --git a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp
index 9f84f64ee9..f4e3356ad0 100644
--- a/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp
+++ b/tests/auto/gui/text/qstatictext/tst_qstatictext.cpp
@@ -716,6 +716,7 @@ void tst_QStaticText::drawStruckOutText()
QFont font;
font.setStrikeOut(true);
+ font.setStyleStrategy(QFont::ForceIntegerMetrics);
{
QPainter p(&imageDrawText);
@@ -751,6 +752,7 @@ void tst_QStaticText::drawOverlinedText()
QFont font;
font.setOverline(true);
+ font.setStyleStrategy(QFont::ForceIntegerMetrics);
{
QPainter p(&imageDrawText);
@@ -786,6 +788,7 @@ void tst_QStaticText::drawUnderlinedText()
QFont font;
font.setUnderline(true);
+ font.setStyleStrategy(QFont::ForceIntegerMetrics);
{
QPainter p(&imageDrawText);
diff --git a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
index 36907b9258..ee50b98733 100644
--- a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
+++ b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
@@ -1104,7 +1104,7 @@ void tst_QTextScriptEngine::controlInSyllable_qtbug14204()
const ushort *log_clusters = e->logClusters(&e->layoutData->items[0]);
QCOMPARE(log_clusters[0], ushort(0));
QCOMPARE(log_clusters[1], ushort(0));
- QCOMPARE(log_clusters[2], ushort(1));
+ QCOMPARE(log_clusters[2], ushort(0));
QCOMPARE(log_clusters[3], ushort(2));
}
@@ -1214,6 +1214,9 @@ void tst_QTextScriptEngine::thaiWithZWJ()
QFont font(QStringLiteral("Waree"));
font.setStyleStrategy(QFont::NoFontMerging);
+ if (QFontInfo(font).styleName() != QStringLiteral("Book"))
+ QSKIP("couldn't find 'Waree Book' font");
+
QString s(QString::fromUtf8("\xe0\xb8\xa3\xe2\x80\x8d\xe0\xb8\xa3\xe2\x80"
"\x8c\x2e\xe0\xb8\xa3\x2e\xe2\x80\x9c\xe0\xb8"
"\xa3\xe2\x80\xa6\xe0\xb8\xa3\xe2\x80\x9d\xe0"
@@ -1233,20 +1236,22 @@ void tst_QTextScriptEngine::thaiWithZWJ()
QCOMPARE(e->layoutData->items[2].num_glyphs, ushort(2)); // Thai: Thai character followed by superscript "a" which is of inherited type
//A quick sanity check - check all the characters are individual clusters
+ // A thai implementation could either remove the ZWJ and ZWNJ characters, or hide them.
+ // The current implementation hides them, so we test for that.
unsigned short *logClusters = e->layoutData->logClustersPtr;
- for (int i = 0; i < 15; i++)
+ QCOMPARE(logClusters[0], ushort(0));
+ QCOMPARE(logClusters[1], ushort(0));
+ QCOMPARE(logClusters[2], ushort(2));
+ QCOMPARE(logClusters[3], ushort(2));
+ for (int i = 4; i < 15; i++)
QCOMPARE(logClusters[i], ushort(i));
for (int i = 0; i < 3; i++)
QCOMPARE(logClusters[i+15], ushort(0));
- // A thai implementation could either remove the ZWJ and ZWNJ characters, or hide them.
- // The current implementation hides them, so we test for that.
// The only characters that we should be hiding are the ZWJ and ZWNJ characters in position 1 and 3.
const QGlyphLayout glyphLayout = e->layoutData->glyphLayout;
for (int i = 0; i < 18; i++) {
- if (i == 17)
- QCOMPARE(glyphLayout.advances[i].toInt(), 0);
- else if (i == 1 || i == 3)
+ if (i == 1 || i == 3)
QCOMPARE(glyphLayout.advances[i].toInt(), 0);
else
QVERIFY(glyphLayout.advances[i].toInt() != 0);
diff --git a/tests/auto/widgets/dialogs/qinputdialog/qinputdialog.pro b/tests/auto/widgets/dialogs/qinputdialog/qinputdialog.pro
index cc479812a8..9cb14c5350 100644
--- a/tests/auto/widgets/dialogs/qinputdialog/qinputdialog.pro
+++ b/tests/auto/widgets/dialogs/qinputdialog/qinputdialog.pro
@@ -1,4 +1,4 @@
CONFIG += testcase
TARGET = tst_qinputdialog
-QT += widgets testlib
+QT += widgets-private testlib
SOURCES += tst_qinputdialog.cpp
diff --git a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp
index bbb6883238..0ea9e0259f 100644
--- a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp
+++ b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp
@@ -35,6 +35,7 @@
#include <QComboBox>
#include <QDialogButtonBox>
#include <qinputdialog.h>
+#include <QtWidgets/private/qdialog_p.h>
class tst_QInputDialog : public QObject
{
@@ -52,6 +53,7 @@ private slots:
void getInt();
void getDouble_data();
void getDouble();
+ void taskQTBUG_54693_crashWhenParentIsDeletedWhileDialogIsOpen();
void task255502getDouble();
void getText_data();
void getText();
@@ -311,6 +313,75 @@ void tst_QInputDialog::getDouble()
delete parent;
}
+namespace {
+class SelfDestructParent : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit SelfDestructParent(int delay = 100)
+ : QWidget(Q_NULLPTR)
+ {
+ QTimer::singleShot(delay, this, SLOT(deleteLater()));
+ }
+};
+}
+
+void tst_QInputDialog::taskQTBUG_54693_crashWhenParentIsDeletedWhileDialogIsOpen()
+{
+ // getText
+ {
+ QAutoPointer<SelfDestructParent> dialog(new SelfDestructParent);
+ bool ok = true;
+ const QString result = QInputDialog::getText(dialog.get(), "Title", "Label", QLineEdit::Normal, "Text", &ok);
+ QVERIFY(!dialog);
+ QVERIFY(!ok);
+ QVERIFY(result.isNull());
+ }
+
+ // getMultiLineText
+ {
+ QAutoPointer<SelfDestructParent> dialog(new SelfDestructParent);
+ bool ok = true;
+ const QString result = QInputDialog::getMultiLineText(dialog.get(), "Title", "Label", "Text", &ok);
+ QVERIFY(!dialog);
+ QVERIFY(!ok);
+ QVERIFY(result.isNull());
+ }
+
+ // getItem
+ for (int editable = false; editable <= true; ++editable) {
+ QAutoPointer<SelfDestructParent> dialog(new SelfDestructParent);
+ bool ok = true;
+ const QString result = QInputDialog::getItem(dialog.get(), "Title", "Label",
+ QStringList() << "1" << "2", 1, editable, &ok);
+ QVERIFY(!dialog);
+ QVERIFY(!ok);
+ QCOMPARE(result, QLatin1String("2"));
+ }
+
+ // getInt
+ {
+ const int initial = 7;
+ QAutoPointer<SelfDestructParent> dialog(new SelfDestructParent);
+ bool ok = true;
+ const int result = QInputDialog::getInt(dialog.get(), "Title", "Label", initial, -10, +10, 1, &ok);
+ QVERIFY(!dialog);
+ QVERIFY(!ok);
+ QCOMPARE(result, initial);
+ }
+
+ // getDouble
+ {
+ const double initial = 7;
+ QAutoPointer<SelfDestructParent> dialog(new SelfDestructParent);
+ bool ok = true;
+ const double result = QInputDialog::getDouble(dialog.get(), "Title", "Label", initial, -10, +10, 2, &ok);
+ QVERIFY(!dialog);
+ QVERIFY(!ok);
+ QCOMPARE(result, initial);
+ }
+}
+
void tst_QInputDialog::task255502getDouble()
{
parent = new QWidget;
diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
index 426db265ae..d241296a6b 100644
--- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
+++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
@@ -52,6 +52,7 @@
#include <qstringlistmodel.h>
#include <qsortfilterproxymodel.h>
#include <qproxystyle.h>
+#include <qdialog.h>
static inline void setFrameless(QWidget *w)
{
@@ -149,6 +150,7 @@ private slots:
void QTBUG50535_update_on_new_selection_model();
void testSelectionModelInSyncWithView();
void testClickToSelect();
+ void testDialogAsEditor();
};
class MyAbstractItemDelegate : public QAbstractItemDelegate
@@ -173,6 +175,29 @@ public:
QSize size;
};
+class DialogItemDelegate : public QStyledItemDelegate
+{
+public:
+ DialogItemDelegate() : QStyledItemDelegate() { }
+ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const
+ {
+ openedEditor = new QDialog(parent);
+ return openedEditor;
+ }
+
+ void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
+ {
+ Q_UNUSED(model)
+ Q_UNUSED(index)
+
+ QDialog *dialog = qobject_cast<QDialog *>(editor);
+ result = static_cast<QDialog::DialogCode>(dialog->result());
+ }
+
+ mutable QDialog::DialogCode result;
+ mutable QDialog *openedEditor;
+};
+
// Testing get/set functions
void tst_QAbstractItemView::getSetCheck()
{
@@ -2156,5 +2181,37 @@ void tst_QAbstractItemView::testClickToSelect()
QCOMPARE(spy.back().front().value<QRect>(), QRect(nearCenterA, QSize(1, 1)));
}
+void tst_QAbstractItemView::testDialogAsEditor()
+{
+ DialogItemDelegate delegate;
+
+ QStandardItemModel model;
+ model.appendRow(new QStandardItem(QStringLiteral("editme")));
+
+ QListView view;
+ view.setItemDelegate(&delegate);
+ view.setModel(&model);
+ view.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+
+ view.edit(model.index(0,0));
+
+ QVERIFY(QTest::qWaitForWindowExposed(delegate.openedEditor));
+
+ delegate.openedEditor->reject();
+ QApplication::processEvents();
+
+ QCOMPARE(delegate.result, QDialog::Rejected);
+
+ view.edit(model.index(0,0));
+
+ QVERIFY(QTest::qWaitForWindowExposed(delegate.openedEditor));
+
+ delegate.openedEditor->accept();
+ QApplication::processEvents();
+
+ QCOMPARE(delegate.result, QDialog::Accepted);
+}
+
QTEST_MAIN(tst_QAbstractItemView)
#include "tst_qabstractitemview.moc"
diff --git a/tests/benchmarks/gui/painting/qtbench/benchmarktests.h b/tests/benchmarks/gui/painting/qtbench/benchmarktests.h
index c69fca68bc..e4b98336c7 100644
--- a/tests/benchmarks/gui/painting/qtbench/benchmarktests.h
+++ b/tests/benchmarks/gui/painting/qtbench/benchmarktests.h
@@ -320,7 +320,7 @@ public:
DrawScaledImage(const QImage &image, qreal scale, bool asPixmap)
: Benchmark(QSize(image.width(), image.height())),
m_image(image),
- m_type(m_as_pixmap ? "Pixmap" : "Image"),
+ m_type(asPixmap ? "Pixmap" : "Image"),
m_scale(scale),
m_as_pixmap(asPixmap)
{
@@ -368,7 +368,7 @@ public:
DrawTransformedImage(const QImage &image, bool asPixmap)
: Benchmark(QSize(image.width(), image.height())),
m_image(image),
- m_type(m_as_pixmap ? "Pixmap" : "Image"),
+ m_type(asPixmap ? "Pixmap" : "Image"),
m_as_pixmap(asPixmap)
{
m_pixmap = QPixmap::fromImage(m_image);
@@ -414,7 +414,7 @@ public:
DrawImage(const QImage &image, bool asPixmap)
: Benchmark(QSize(image.width(), image.height())),
m_image(image),
- m_type(m_as_pixmap ? "Pixmap" : "Image"),
+ m_type(asPixmap ? "Pixmap" : "Image"),
m_as_pixmap(asPixmap)
{
m_pixmap = QPixmap::fromImage(image);
diff --git a/tests/manual/diaglib/diaglib.pri b/tests/manual/diaglib/diaglib.pri
index e3e7c3757c..f240a73167 100644
--- a/tests/manual/diaglib/diaglib.pri
+++ b/tests/manual/diaglib/diaglib.pri
@@ -10,7 +10,7 @@ HEADERS += \
$$PWD/qwindowdump.h \
$$PWD/nativewindowdump.h
-win32 {
+win32!winrt: {
SOURCES += $$PWD/nativewindowdump_win.cpp
LIBS *= -luser32
} else {
diff --git a/tests/manual/windowflags/controllerwindow.cpp b/tests/manual/windowflags/controllerwindow.cpp
index d02f64c27b..3654bfbad0 100644
--- a/tests/manual/windowflags/controllerwindow.cpp
+++ b/tests/manual/windowflags/controllerwindow.cpp
@@ -70,7 +70,7 @@ ControllerWidget::ControllerWidget(QWidget *parent)
hintsControl->setHints(previewWindow->windowFlags());
connect(hintsControl, SIGNAL(changed(Qt::WindowFlags)), this, SLOT(updatePreview()));
- statesControl = new WindowStatesControl(WindowStatesControl::WantVisibleCheckBox|WindowStatesControl::WantActiveCheckBox);
+ statesControl = new WindowStatesControl;
statesControl->setStates(previewWindow->windowState());
statesControl->setVisibleValue(true);
connect(statesControl, SIGNAL(changed()), this, SLOT(updatePreview()));
@@ -106,13 +106,13 @@ void ControllerWidget::updatePreview()
{
const Qt::WindowFlags flags = typeControl->type() | hintsControl->hints();
- previewWindow->hide();
- previewDialog->hide();
-
- if (previewWidgetButton->isChecked())
+ if (previewWidgetButton->isChecked()) {
previewWidget = previewWindow;
- else
+ previewDialog->hide();
+ } else {
previewWidget = previewDialog;
+ previewWindow->hide();
+ }
if (modalWindowCheckBox->isChecked()) {
parentWindow->show();
diff --git a/tests/manual/windowflags/controls.cpp b/tests/manual/windowflags/controls.cpp
index 319f6aac8e..c167e5f8bf 100644
--- a/tests/manual/windowflags/controls.cpp
+++ b/tests/manual/windowflags/controls.cpp
@@ -161,97 +161,71 @@ void HintControl::slotCheckBoxChanged()
emit changed(hints());
}
-WindowStateControl::WindowStateControl(unsigned flags, QWidget *parent)
+WindowStateControl::WindowStateControl(QWidget *parent)
: QWidget(parent)
, group(new QButtonGroup)
- , visibleCheckBox(0)
- , restoreButton(new QRadioButton(tr("Normal")))
- , minimizeButton(0)
- , maximizeButton(new QRadioButton(tr("Maximized")))
- , fullscreenButton(new QRadioButton(tr("Fullscreen")))
+ , restoreButton(new QCheckBox(tr("Normal")))
+ , minimizeButton(new QCheckBox(tr("Minimized")))
+ , maximizeButton(new QCheckBox(tr("Maximized")))
+ , fullscreenButton(new QCheckBox(tr("Fullscreen")))
{
QHBoxLayout *layout = new QHBoxLayout(this);
- layout->setSpacing(0);
+ group->setExclusive(false);
layout->setMargin(ControlLayoutMargin);
- if (flags & WantVisibleCheckBox) {
- visibleCheckBox = new QCheckBox(tr("Visible"));
- connect(visibleCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
- layout->addWidget(visibleCheckBox);
- }
-
- group->setExclusive(true);
- if (flags & WantMinimizeRadioButton) {
- minimizeButton = new QRadioButton(tr("Minimized"));
- group->addButton(minimizeButton, Qt::WindowMinimized);
- layout->addWidget(minimizeButton);
- }
group->addButton(restoreButton, Qt::WindowNoState);
+ restoreButton->setEnabled(false);
layout->addWidget(restoreButton);
+ group->addButton(minimizeButton, Qt::WindowMinimized);
+ layout->addWidget(minimizeButton);
group->addButton(maximizeButton, Qt::WindowMaximized);
layout->addWidget(maximizeButton);
group->addButton(fullscreenButton, Qt::WindowFullScreen);
layout->addWidget(fullscreenButton);
- connect(group, SIGNAL(buttonReleased(int)), this, SIGNAL(changed()));
+ connect(group, SIGNAL(buttonReleased(int)), this, SIGNAL(stateChanged(int)));
}
-Qt::WindowState WindowStateControl::state() const
+Qt::WindowStates WindowStateControl::state() const
{
- return Qt::WindowState(group->checkedId());
+ Qt::WindowStates states;
+ foreach (QAbstractButton *button, group->buttons()) {
+ if (button->isChecked())
+ states |= Qt::WindowState(group->id(button));
+ }
+ return states;
}
-void WindowStateControl::setState(Qt::WindowState s)
+void WindowStateControl::setState(Qt::WindowStates s)
{
group->blockSignals(true);
- if (QAbstractButton *b = group->button(s))
- b->setChecked(true);
- group->blockSignals(false);
-}
+ foreach (QAbstractButton *button, group->buttons())
+ button->setChecked(s & Qt::WindowState(group->id(button)));
-bool WindowStateControl::visibleValue() const
-{
- return visibleCheckBox && visibleCheckBox->isChecked();
-}
+ if (!(s & (Qt::WindowMaximized | Qt::WindowFullScreen)))
+ restoreButton->setChecked(true);
-void WindowStateControl::setVisibleValue(bool v)
-{
- if (visibleCheckBox) {
- visibleCheckBox->blockSignals(true);
- visibleCheckBox->setChecked(v);
- visibleCheckBox->blockSignals(false);
- }
+ group->blockSignals(false);
}
-WindowStatesControl::WindowStatesControl(unsigned flags, QWidget *parent)
+WindowStatesControl::WindowStatesControl(QWidget *parent)
: QGroupBox(tr("States"), parent)
- , visibleCheckBox(0)
- , activeCheckBox(0)
- , minimizeCheckBox(new QCheckBox(tr("Minimized")))
- , stateControl(new WindowStateControl(0))
+ , visibleCheckBox(new QCheckBox(tr("Visible")))
+ , activeCheckBox(new QCheckBox(tr("Active")))
+ , stateControl(new WindowStateControl)
{
QHBoxLayout *layout = new QHBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(ControlLayoutMargin);
- if (flags & WantVisibleCheckBox) {
- visibleCheckBox = new QCheckBox(tr("Visible"));
- connect(visibleCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
- layout->addWidget(visibleCheckBox);
- }
- if (flags & WantActiveCheckBox) {
- activeCheckBox = new QCheckBox(tr("Active"));
- connect(activeCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
- layout->addWidget(activeCheckBox);
- }
- layout->addWidget(minimizeCheckBox);
+ connect(visibleCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
+ layout->addWidget(visibleCheckBox);
+ connect(activeCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
+ layout->addWidget(activeCheckBox);
layout->addWidget(stateControl);
- connect(stateControl, SIGNAL(changed()), this, SIGNAL(changed()));
- connect(minimizeCheckBox, SIGNAL(clicked()), this, SIGNAL(changed()));
+ connect(stateControl, SIGNAL(stateChanged(int)), this, SIGNAL(changed()));
}
Qt::WindowStates WindowStatesControl::states() const
{
Qt::WindowStates s = stateControl->state();
- if (minimizeCheckBox->isChecked())
- s |= Qt::WindowMinimized;
if (activeValue())
s |= Qt::WindowActive;
return s;
@@ -259,11 +233,7 @@ Qt::WindowStates WindowStatesControl::states() const
void WindowStatesControl::setStates(Qt::WindowStates s)
{
- minimizeCheckBox->blockSignals(true);
- minimizeCheckBox->setChecked(s & Qt::WindowMinimized);
- minimizeCheckBox->blockSignals(false);
- s &= ~Qt::WindowMinimized;
- stateControl->setState(Qt::WindowState(int(s)));
+ stateControl->setState(s);
setActiveValue(s & Qt::WindowActive);
}
diff --git a/tests/manual/windowflags/controls.h b/tests/manual/windowflags/controls.h
index 79faaaa9c3..e140d813cc 100644
--- a/tests/manual/windowflags/controls.h
+++ b/tests/manual/windowflags/controls.h
@@ -77,29 +77,20 @@ private:
class WindowStateControl : public QWidget {
Q_OBJECT
public:
- enum Flags {
- WantVisibleCheckBox = 0x1,
- WantMinimizeRadioButton = 0x2
- };
+ explicit WindowStateControl(QWidget *parent= 0);
- explicit WindowStateControl(unsigned flags, QWidget *parent= 0);
-
- Qt::WindowState state() const;
- void setState(Qt::WindowState s);
-
- bool visibleValue() const;
- void setVisibleValue(bool);
+ Qt::WindowStates state() const;
+ void setState(Qt::WindowStates s);
signals:
- void changed();
+ void stateChanged(int);
private:
QButtonGroup *group;
- QCheckBox *visibleCheckBox;
- QRadioButton *restoreButton;
- QRadioButton *minimizeButton;
- QRadioButton *maximizeButton;
- QRadioButton *fullscreenButton;
+ QCheckBox *restoreButton;
+ QCheckBox *minimizeButton;
+ QCheckBox *maximizeButton;
+ QCheckBox *fullscreenButton;
};
// Control for the Qt::WindowStates flags (normal, maximized, fullscreen exclusively
@@ -108,12 +99,7 @@ class WindowStatesControl : public QGroupBox
{
Q_OBJECT
public:
- enum Flags {
- WantVisibleCheckBox = 0x1,
- WantActiveCheckBox = 0x2
- };
-
- explicit WindowStatesControl(unsigned flags, QWidget *parent= 0);
+ explicit WindowStatesControl(QWidget *parent= 0);
Qt::WindowStates states() const;
void setStates(Qt::WindowStates s);
@@ -129,7 +115,6 @@ signals:
private:
QCheckBox *visibleCheckBox;
QCheckBox *activeCheckBox;
- QCheckBox *minimizeCheckBox;
WindowStateControl *stateControl;
};