summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/harfbuzz-ng/src/hb-ot-var-hvar-table.hh
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2019-11-11 15:10:08 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-03-04 08:28:04 +0100
commitfb2f42b6044fe4673e71f3d12082b53c9f3182cd (patch)
treed2f579c0362be1def50d957bc4e46eb27ea6198a /src/3rdparty/harfbuzz-ng/src/hb-ot-var-hvar-table.hh
parent4724dfff627f3cd3754f5d4a827c6b6790a89955 (diff)
Update to Harfbuzz 2.6.4
Quite a big change since it has been several years since the last update. This drops the Harfbuzz source on top of the existing code in Qt, and does the following additional changes: 1. Deletes old source files that have been removed upstream (everything named foo-private.hh is now renamed to just foo.hh for instance). 2. Added a header guard to config.h because it may be double-included. 3. Implement a memory barrier needed by hb-atomic.hh. 4. Changed the signature of hb_atomic_int_impl_add() to take a pointer to match new upstream. 5. Updated .pro file to include new files and removed old. 6. Updated qt_attribution.json 7. No longer disable deprecated APIs since hb_ot_tags_from_script() is now deprecated and is used from Qt code. 8. Updated and applied the patch in patches/ for CoreText. 9. Updated tst_qtextscriptengine::thaiWithZWJ() according to changes in Harfbuzz and disabled it for system-harfbuzz, since this may be an older version of harfbuzz depending on the system. Fixes: QTBUG-79606 Change-Id: I3f057a43ff44ee416628b75ef12fb1a221f31910 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/3rdparty/harfbuzz-ng/src/hb-ot-var-hvar-table.hh')
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-var-hvar-table.hh58
1 files changed, 33 insertions, 25 deletions
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-var-hvar-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-var-hvar-table.hh
index fac843a719..223430fb82 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-var-hvar-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-var-hvar-table.hh
@@ -27,7 +27,7 @@
#ifndef HB_OT_VAR_HVAR_TABLE_HH
#define HB_OT_VAR_HVAR_TABLE_HH
-#include "hb-ot-layout-common-private.hh"
+#include "hb-ot-layout-common.hh"
namespace OT {
@@ -35,11 +35,13 @@ namespace OT {
struct DeltaSetIndexMap
{
- inline bool sanitize (hb_sanitize_context_t *c) const
+ bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
- c->check_array (mapData, get_width (), mapCount));
+ c->check_range (mapDataZ.arrayZ,
+ mapCount,
+ get_width ()));
}
unsigned int map (unsigned int v) const /* Returns 16.16 outer.inner. */
@@ -55,7 +57,7 @@ struct DeltaSetIndexMap
unsigned int u = 0;
{ /* Fetch it. */
unsigned int w = get_width ();
- const UINT8 *p = mapData + w * v;
+ const HBUINT8 *p = mapDataZ.arrayZ + w * v;
for (; w; w--)
u = (u << 8) + *p++;
}
@@ -71,37 +73,37 @@ struct DeltaSetIndexMap
}
protected:
- inline unsigned int get_width (void) const
- { return ((format >> 4) & 3) + 1; }
+ unsigned int get_width () const { return ((format >> 4) & 3) + 1; }
- inline unsigned int get_inner_bitcount (void) const
- { return (format & 0xF) + 1; }
+ unsigned int get_inner_bitcount () const { return (format & 0xF) + 1; }
protected:
- UINT16 format; /* A packed field that describes the compressed
+ HBUINT16 format; /* A packed field that describes the compressed
* representation of delta-set indices. */
- UINT16 mapCount; /* The number of mapping entries. */
- UINT8 mapData[VAR]; /* The delta-set index mapping data. */
+ HBUINT16 mapCount; /* The number of mapping entries. */
+ UnsizedArrayOf<HBUINT8>
+ mapDataZ; /* The delta-set index mapping data. */
public:
- DEFINE_SIZE_ARRAY (4, mapData);
+ DEFINE_SIZE_ARRAY (4, mapDataZ);
};
/*
- * HVAR -- The Horizontal Metrics Variations Table
- * VVAR -- The Vertical Metrics Variations Table
+ * HVAR -- Horizontal Metrics Variations
+ * https://docs.microsoft.com/en-us/typography/opentype/spec/hvar
+ * VVAR -- Vertical Metrics Variations
+ * https://docs.microsoft.com/en-us/typography/opentype/spec/vvar
*/
-
#define HB_OT_TAG_HVAR HB_TAG('H','V','A','R')
#define HB_OT_TAG_VVAR HB_TAG('V','V','A','R')
struct HVARVVAR
{
- static const hb_tag_t HVARTag = HB_OT_TAG_HVAR;
- static const hb_tag_t VVARTag = HB_OT_TAG_VVAR;
+ static constexpr hb_tag_t HVARTag = HB_OT_TAG_HVAR;
+ static constexpr hb_tag_t VVARTag = HB_OT_TAG_VVAR;
- inline bool sanitize (hb_sanitize_context_t *c) const
+ bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (version.sanitize (c) &&
@@ -112,15 +114,21 @@ struct HVARVVAR
rsbMap.sanitize (c, this));
}
- inline float get_advance_var (hb_codepoint_t glyph,
- int *coords, unsigned int coord_count) const
+ float get_advance_var (hb_font_t *font, hb_codepoint_t glyph) const
{
unsigned int varidx = (this+advMap).map (glyph);
+ return (this+varStore).get_delta (varidx, font->coords, font->num_coords);
+ }
+
+ float get_side_bearing_var (hb_codepoint_t glyph,
+ const int *coords, unsigned int coord_count) const
+ {
+ if (!has_side_bearing_deltas ()) return 0.f;
+ unsigned int varidx = (this+lsbMap).map (glyph);
return (this+varStore).get_delta (varidx, coords, coord_count);
}
- inline bool has_sidebearing_deltas (void) const
- { return lsbMap && rsbMap; }
+ bool has_side_bearing_deltas () const { return lsbMap && rsbMap; }
protected:
FixedVersion<>version; /* Version of the metrics variation table
@@ -139,12 +147,12 @@ struct HVARVVAR
};
struct HVAR : HVARVVAR {
- static const hb_tag_t tableTag = HB_OT_TAG_HVAR;
+ static constexpr hb_tag_t tableTag = HB_OT_TAG_HVAR;
};
struct VVAR : HVARVVAR {
- static const hb_tag_t tableTag = HB_OT_TAG_VVAR;
+ static constexpr hb_tag_t tableTag = HB_OT_TAG_VVAR;
- inline bool sanitize (hb_sanitize_context_t *c) const
+ bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (static_cast<const HVARVVAR *> (this)->sanitize (c) &&