2017-11-02 00:31:29 +01:00
|
|
|
/*
|
|
|
|
* Copyright © 2017 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_KERN_TABLE_HH
|
|
|
|
#define HB_OT_KERN_TABLE_HH
|
|
|
|
|
2018-11-07 16:39:39 +01:00
|
|
|
#include "hb-aat-layout-kerx-table.hh"
|
2018-10-09 05:09:48 +02:00
|
|
|
|
2017-11-02 00:31:29 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* kern -- Kerning
|
2018-04-12 11:08:19 +02:00
|
|
|
* https://docs.microsoft.com/en-us/typography/opentype/spec/kern
|
|
|
|
* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6kern.html
|
2017-11-02 00:31:29 +01:00
|
|
|
*/
|
|
|
|
#define HB_OT_TAG_kern HB_TAG('k','e','r','n')
|
|
|
|
|
2018-04-12 11:08:19 +02:00
|
|
|
|
|
|
|
namespace OT {
|
|
|
|
|
|
|
|
|
2018-11-06 18:07:15 +01:00
|
|
|
template <typename KernSubTableHeader>
|
2018-11-02 16:56:55 +01:00
|
|
|
struct KernSubTableFormat3
|
|
|
|
{
|
2018-12-16 20:08:10 +01:00
|
|
|
int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
|
2018-11-02 16:56:55 +01:00
|
|
|
{
|
|
|
|
hb_array_t<const FWORD> kernValue = kernValueZ.as_array (kernValueCount);
|
2019-04-30 22:05:10 +02:00
|
|
|
hb_array_t<const HBUINT8> leftClass = StructAfter<const UnsizedArrayOf<HBUINT8>> (kernValue).as_array (glyphCount);
|
|
|
|
hb_array_t<const HBUINT8> rightClass = StructAfter<const UnsizedArrayOf<HBUINT8>> (leftClass).as_array (glyphCount);
|
|
|
|
hb_array_t<const HBUINT8> kernIndex = StructAfter<const UnsizedArrayOf<HBUINT8>> (rightClass).as_array (leftClassCount * rightClassCount);
|
2018-11-02 16:56:55 +01:00
|
|
|
|
2018-11-03 19:58:54 +01:00
|
|
|
unsigned int leftC = leftClass[left];
|
|
|
|
unsigned int rightC = rightClass[right];
|
|
|
|
if (unlikely (leftC >= leftClassCount || rightC >= rightClassCount))
|
|
|
|
return 0;
|
|
|
|
unsigned int i = leftC * rightClassCount + rightC;
|
2018-12-01 02:45:40 +01:00
|
|
|
return kernValue[kernIndex[i]];
|
2018-11-02 16:56:55 +01:00
|
|
|
}
|
|
|
|
|
2018-12-16 20:08:10 +01:00
|
|
|
bool apply (AAT::hb_aat_apply_context_t *c) const
|
2018-11-02 18:23:54 +01:00
|
|
|
{
|
|
|
|
TRACE_APPLY (this);
|
|
|
|
|
|
|
|
if (!c->plan->requested_kerning)
|
|
|
|
return false;
|
|
|
|
|
2018-11-07 20:52:36 +01:00
|
|
|
if (header.coverage & header.Backwards)
|
2018-11-06 20:48:42 +01:00
|
|
|
return false;
|
|
|
|
|
2018-11-07 20:52:36 +01:00
|
|
|
hb_kern_machine_t<KernSubTableFormat3> machine (*this, header.coverage & header.CrossStream);
|
2018-11-02 18:23:54 +01:00
|
|
|
machine.kern (c->font, c->buffer, c->plan->kern_mask);
|
|
|
|
|
|
|
|
return_trace (true);
|
|
|
|
}
|
|
|
|
|
2018-12-16 20:08:10 +01:00
|
|
|
bool sanitize (hb_sanitize_context_t *c) const
|
2018-11-02 16:56:55 +01:00
|
|
|
{
|
|
|
|
TRACE_SANITIZE (this);
|
|
|
|
return_trace (c->check_struct (this) &&
|
|
|
|
c->check_range (kernValueZ,
|
2018-11-03 20:06:45 +01:00
|
|
|
kernValueCount * sizeof (FWORD) +
|
2018-11-02 16:56:55 +01:00
|
|
|
glyphCount * 2 +
|
|
|
|
leftClassCount * rightClassCount));
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2018-11-06 18:07:15 +01:00
|
|
|
KernSubTableHeader header;
|
|
|
|
HBUINT16 glyphCount; /* The number of glyphs in this font. */
|
|
|
|
HBUINT8 kernValueCount; /* The number of kerning values. */
|
|
|
|
HBUINT8 leftClassCount; /* The number of left-hand classes. */
|
|
|
|
HBUINT8 rightClassCount;/* The number of right-hand classes. */
|
|
|
|
HBUINT8 flags; /* Set to zero (reserved for future use). */
|
|
|
|
UnsizedArrayOf<FWORD> kernValueZ; /* The kerning values.
|
|
|
|
* Length kernValueCount. */
|
2018-11-02 16:56:55 +01:00
|
|
|
#if 0
|
2018-11-06 18:07:15 +01:00
|
|
|
UnsizedArrayOf<HBUINT8>leftClass; /* The left-hand classes.
|
|
|
|
* Length glyphCount. */
|
|
|
|
UnsizedArrayOf<HBUINT8>rightClass; /* The right-hand classes.
|
|
|
|
* Length glyphCount. */
|
|
|
|
UnsizedArrayOf<HBUINT8>kernIndex; /* The indices into the kernValue array.
|
|
|
|
* Length leftClassCount * rightClassCount */
|
2018-11-02 16:56:55 +01:00
|
|
|
#endif
|
|
|
|
public:
|
2018-11-06 18:07:15 +01:00
|
|
|
DEFINE_SIZE_ARRAY (KernSubTableHeader::static_size + 6, kernValueZ);
|
2018-11-02 16:56:55 +01:00
|
|
|
};
|
|
|
|
|
2018-11-06 18:07:15 +01:00
|
|
|
template <typename KernSubTableHeader>
|
2017-11-02 00:54:56 +01:00
|
|
|
struct KernSubTable
|
|
|
|
{
|
2018-12-17 19:01:01 +01:00
|
|
|
unsigned int get_size () const { return u.header.length; }
|
|
|
|
unsigned int get_type () const { return u.header.format; }
|
2018-11-06 18:07:15 +01:00
|
|
|
|
2018-12-16 20:08:10 +01:00
|
|
|
int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
|
2017-11-02 02:33:09 +01:00
|
|
|
{
|
2018-11-06 18:11:45 +01:00
|
|
|
switch (get_type ()) {
|
2018-11-02 18:23:54 +01:00
|
|
|
/* This method hooks up to hb_font_t's get_h_kerning. Only support Format0. */
|
2017-11-02 02:33:09 +01:00
|
|
|
case 0: return u.format0.get_kerning (left, right);
|
2017-11-02 00:54:56 +01:00
|
|
|
default:return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-05 19:14:17 +02:00
|
|
|
template <typename context_t, typename ...Ts>
|
2019-05-08 05:58:43 +02:00
|
|
|
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
|
2018-11-02 18:23:54 +01:00
|
|
|
{
|
2018-11-06 18:11:45 +01:00
|
|
|
unsigned int subtable_type = get_type ();
|
|
|
|
TRACE_DISPATCH (this, subtable_type);
|
|
|
|
switch (subtable_type) {
|
|
|
|
case 0: return_trace (c->dispatch (u.format0));
|
2019-05-11 08:55:22 +02:00
|
|
|
#ifndef HB_NO_SHAPE_AAT
|
2019-05-05 19:14:17 +02:00
|
|
|
case 1: return_trace (u.header.apple ? c->dispatch (u.format1, hb_forward<Ts> (ds)...) : c->default_return_value ());
|
2019-05-11 08:31:05 +02:00
|
|
|
#endif
|
2018-11-06 18:11:45 +01:00
|
|
|
case 2: return_trace (c->dispatch (u.format2));
|
2019-05-11 08:55:22 +02:00
|
|
|
#ifndef HB_NO_SHAPE_AAT
|
2019-05-05 19:14:17 +02:00
|
|
|
case 3: return_trace (u.header.apple ? c->dispatch (u.format3, hb_forward<Ts> (ds)...) : c->default_return_value ());
|
2019-05-11 08:31:05 +02:00
|
|
|
#endif
|
2018-11-06 18:11:45 +01:00
|
|
|
default: return_trace (c->default_return_value ());
|
2018-11-02 18:23:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-16 20:08:10 +01:00
|
|
|
bool sanitize (hb_sanitize_context_t *c) const
|
2017-11-02 00:54:56 +01:00
|
|
|
{
|
|
|
|
TRACE_SANITIZE (this);
|
2018-11-06 18:07:15 +01:00
|
|
|
if (unlikely (!u.header.sanitize (c) ||
|
|
|
|
u.header.length < u.header.min_size ||
|
|
|
|
!c->check_range (this, u.header.length))) return_trace (false);
|
2018-11-06 18:11:45 +01:00
|
|
|
|
|
|
|
return_trace (dispatch (c));
|
2017-11-02 00:54:56 +01:00
|
|
|
}
|
|
|
|
|
2018-11-06 19:32:13 +01:00
|
|
|
public:
|
2017-11-02 00:54:56 +01:00
|
|
|
union {
|
2018-11-06 18:07:15 +01:00
|
|
|
KernSubTableHeader header;
|
2018-11-07 16:45:25 +01:00
|
|
|
AAT::KerxSubTableFormat0<KernSubTableHeader> format0;
|
2018-11-07 17:28:36 +01:00
|
|
|
AAT::KerxSubTableFormat1<KernSubTableHeader> format1;
|
2018-11-07 18:19:52 +01:00
|
|
|
AAT::KerxSubTableFormat2<KernSubTableHeader> format2;
|
2018-11-06 18:07:15 +01:00
|
|
|
KernSubTableFormat3<KernSubTableHeader> format3;
|
2017-11-02 00:54:56 +01:00
|
|
|
} u;
|
|
|
|
public:
|
2018-11-22 07:22:33 +01:00
|
|
|
DEFINE_SIZE_MIN (KernSubTableHeader::static_size);
|
2017-11-02 00:54:56 +01:00
|
|
|
};
|
|
|
|
|
2017-11-02 00:31:29 +01:00
|
|
|
|
2018-11-07 18:57:10 +01:00
|
|
|
struct KernOTSubTableHeader
|
2017-11-02 00:31:29 +01:00
|
|
|
{
|
2019-01-22 12:07:43 +01:00
|
|
|
static constexpr bool apple = false;
|
2018-11-07 18:57:10 +01:00
|
|
|
typedef AAT::ObsoleteTypes Types;
|
2017-11-02 00:31:29 +01:00
|
|
|
|
2018-12-17 19:01:01 +01:00
|
|
|
unsigned int tuple_count () const { return 0; }
|
|
|
|
bool is_horizontal () const { return (coverage & Horizontal); }
|
2017-11-02 00:31:29 +01:00
|
|
|
|
2018-11-07 18:57:10 +01:00
|
|
|
enum Coverage
|
2017-11-02 00:31:29 +01:00
|
|
|
{
|
2018-11-07 18:57:10 +01:00
|
|
|
Horizontal = 0x01u,
|
2018-11-07 19:33:23 +01:00
|
|
|
Minimum = 0x02u,
|
2018-11-07 18:57:10 +01:00
|
|
|
CrossStream = 0x04u,
|
2018-11-07 19:33:23 +01:00
|
|
|
Override = 0x08u,
|
2018-11-07 16:33:46 +01:00
|
|
|
|
2018-11-07 19:33:23 +01:00
|
|
|
/* Not supported: */
|
|
|
|
Backwards = 0x00u,
|
|
|
|
Variation = 0x00u,
|
2018-11-07 18:57:10 +01:00
|
|
|
};
|
2018-11-07 16:45:25 +01:00
|
|
|
|
2018-12-16 20:08:10 +01:00
|
|
|
bool sanitize (hb_sanitize_context_t *c) const
|
2018-11-07 18:57:10 +01:00
|
|
|
{
|
|
|
|
TRACE_SANITIZE (this);
|
|
|
|
return_trace (c->check_struct (this));
|
|
|
|
}
|
2017-11-02 02:33:09 +01:00
|
|
|
|
2018-11-07 18:57:10 +01:00
|
|
|
public:
|
|
|
|
HBUINT16 versionZ; /* Unused. */
|
|
|
|
HBUINT16 length; /* Length of the subtable (including this header). */
|
|
|
|
HBUINT8 format; /* Subtable format. */
|
|
|
|
HBUINT8 coverage; /* Coverage bits. */
|
|
|
|
public:
|
|
|
|
DEFINE_SIZE_STATIC (6);
|
|
|
|
};
|
2017-11-02 02:33:09 +01:00
|
|
|
|
2018-11-07 19:40:22 +01:00
|
|
|
struct KernOT : AAT::KerxTable<KernOT>
|
2018-11-07 18:57:10 +01:00
|
|
|
{
|
2018-11-07 19:40:22 +01:00
|
|
|
friend struct AAT::KerxTable<KernOT>;
|
2018-11-06 18:07:15 +01:00
|
|
|
|
2019-01-22 12:08:57 +01:00
|
|
|
static constexpr hb_tag_t tableTag = HB_OT_TAG_kern;
|
2019-01-22 12:11:24 +01:00
|
|
|
static constexpr unsigned minVersion = 0u;
|
2018-11-07 19:33:23 +01:00
|
|
|
|
2018-11-07 18:57:10 +01:00
|
|
|
typedef KernOTSubTableHeader SubTableHeader;
|
2018-11-07 19:33:23 +01:00
|
|
|
typedef SubTableHeader::Types Types;
|
2018-11-07 19:04:21 +01:00
|
|
|
typedef KernSubTable<SubTableHeader> SubTable;
|
2018-11-07 18:57:10 +01:00
|
|
|
|
2017-11-02 00:31:29 +01:00
|
|
|
protected:
|
2018-11-07 19:33:23 +01:00
|
|
|
HBUINT16 version; /* Version--0x0000u */
|
|
|
|
HBUINT16 tableCount; /* Number of subtables in the kerning table. */
|
|
|
|
SubTable firstSubTable; /* Subtables. */
|
2017-11-02 00:31:29 +01:00
|
|
|
public:
|
2018-11-07 18:51:49 +01:00
|
|
|
DEFINE_SIZE_MIN (4);
|
2017-11-02 00:31:29 +01:00
|
|
|
};
|
|
|
|
|
2018-11-07 18:57:10 +01:00
|
|
|
|
|
|
|
struct KernAATSubTableHeader
|
2017-11-02 00:31:29 +01:00
|
|
|
{
|
2019-01-22 12:07:43 +01:00
|
|
|
static constexpr bool apple = true;
|
2018-11-07 18:57:10 +01:00
|
|
|
typedef AAT::ObsoleteTypes Types;
|
2017-11-02 00:31:29 +01:00
|
|
|
|
2018-12-17 19:01:01 +01:00
|
|
|
unsigned int tuple_count () const { return 0; }
|
|
|
|
bool is_horizontal () const { return !(coverage & Vertical); }
|
2017-11-02 00:31:29 +01:00
|
|
|
|
2018-11-07 18:57:10 +01:00
|
|
|
enum Coverage
|
2017-11-02 00:31:29 +01:00
|
|
|
{
|
2018-11-07 19:33:23 +01:00
|
|
|
Vertical = 0x80u,
|
2018-11-07 18:57:10 +01:00
|
|
|
CrossStream = 0x40u,
|
2018-11-07 19:33:23 +01:00
|
|
|
Variation = 0x20u,
|
|
|
|
|
|
|
|
/* Not supported: */
|
|
|
|
Backwards = 0x00u,
|
2018-11-07 18:57:10 +01:00
|
|
|
};
|
2018-11-07 16:33:46 +01:00
|
|
|
|
2018-12-16 20:08:10 +01:00
|
|
|
bool sanitize (hb_sanitize_context_t *c) const
|
2018-11-07 18:57:10 +01:00
|
|
|
{
|
|
|
|
TRACE_SANITIZE (this);
|
|
|
|
return_trace (c->check_struct (this));
|
|
|
|
}
|
2018-11-07 16:45:25 +01:00
|
|
|
|
2018-11-07 18:57:10 +01:00
|
|
|
public:
|
|
|
|
HBUINT32 length; /* Length of the subtable (including this header). */
|
|
|
|
HBUINT8 coverage; /* Coverage bits. */
|
|
|
|
HBUINT8 format; /* Subtable format. */
|
|
|
|
HBUINT16 tupleIndex; /* The tuple index (used for variations fonts).
|
|
|
|
* This value specifies which tuple this subtable covers.
|
|
|
|
* Note: We don't implement. */
|
|
|
|
public:
|
|
|
|
DEFINE_SIZE_STATIC (8);
|
|
|
|
};
|
2017-11-02 02:33:09 +01:00
|
|
|
|
2018-11-07 19:40:22 +01:00
|
|
|
struct KernAAT : AAT::KerxTable<KernAAT>
|
2018-11-07 18:57:10 +01:00
|
|
|
{
|
2018-11-07 19:40:22 +01:00
|
|
|
friend struct AAT::KerxTable<KernAAT>;
|
2018-11-06 18:07:15 +01:00
|
|
|
|
2019-01-22 12:08:57 +01:00
|
|
|
static constexpr hb_tag_t tableTag = HB_OT_TAG_kern;
|
2019-01-22 12:11:24 +01:00
|
|
|
static constexpr unsigned minVersion = 0x00010000u;
|
2018-11-07 19:33:23 +01:00
|
|
|
|
2018-11-07 18:57:10 +01:00
|
|
|
typedef KernAATSubTableHeader SubTableHeader;
|
2018-11-07 19:33:23 +01:00
|
|
|
typedef SubTableHeader::Types Types;
|
2018-11-07 19:04:21 +01:00
|
|
|
typedef KernSubTable<SubTableHeader> SubTable;
|
2018-11-07 18:57:10 +01:00
|
|
|
|
2017-11-02 00:31:29 +01:00
|
|
|
protected:
|
2018-11-07 19:33:23 +01:00
|
|
|
HBUINT32 version; /* Version--0x00010000u */
|
|
|
|
HBUINT32 tableCount; /* Number of subtables in the kerning table. */
|
|
|
|
SubTable firstSubTable; /* Subtables. */
|
2017-11-02 00:31:29 +01:00
|
|
|
public:
|
2018-11-07 18:51:49 +01:00
|
|
|
DEFINE_SIZE_MIN (8);
|
2017-11-02 00:31:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct kern
|
|
|
|
{
|
2019-01-22 12:08:57 +01:00
|
|
|
static constexpr hb_tag_t tableTag = HB_OT_TAG_kern;
|
2017-11-02 00:31:29 +01:00
|
|
|
|
2018-12-17 19:01:01 +01:00
|
|
|
bool has_data () const { return u.version32; }
|
|
|
|
unsigned int get_type () const { return u.major; }
|
2018-10-09 05:57:45 +02:00
|
|
|
|
2018-12-17 19:01:01 +01:00
|
|
|
bool has_state_machine () const
|
2018-11-23 17:10:17 +01:00
|
|
|
{
|
|
|
|
switch (get_type ()) {
|
|
|
|
case 0: return u.ot.has_state_machine ();
|
2019-05-11 08:55:22 +02:00
|
|
|
#ifndef HB_NO_SHAPE_AAT
|
2018-11-23 17:10:17 +01:00
|
|
|
case 1: return u.aat.has_state_machine ();
|
2019-05-11 08:31:05 +02:00
|
|
|
#endif
|
2018-11-23 17:10:17 +01:00
|
|
|
default:return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-17 19:01:01 +01:00
|
|
|
bool has_cross_stream () const
|
2018-11-07 22:02:40 +01:00
|
|
|
{
|
2018-11-07 22:03:09 +01:00
|
|
|
switch (get_type ()) {
|
2018-11-07 22:02:40 +01:00
|
|
|
case 0: return u.ot.has_cross_stream ();
|
2019-05-11 08:55:22 +02:00
|
|
|
#ifndef HB_NO_SHAPE_AAT
|
2018-11-07 22:02:40 +01:00
|
|
|
case 1: return u.aat.has_cross_stream ();
|
2019-05-11 08:31:05 +02:00
|
|
|
#endif
|
2018-11-07 22:02:40 +01:00
|
|
|
default:return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-16 20:08:10 +01:00
|
|
|
int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right) const
|
2017-11-02 02:33:09 +01:00
|
|
|
{
|
2018-11-07 22:03:09 +01:00
|
|
|
switch (get_type ()) {
|
2018-10-10 04:46:12 +02:00
|
|
|
case 0: return u.ot.get_h_kerning (left, right);
|
2019-05-11 08:55:22 +02:00
|
|
|
#ifndef HB_NO_SHAPE_AAT
|
2018-10-10 04:46:12 +02:00
|
|
|
case 1: return u.aat.get_h_kerning (left, right);
|
2019-05-11 08:31:05 +02:00
|
|
|
#endif
|
2017-11-02 02:33:09 +01:00
|
|
|
default:return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-16 20:08:10 +01:00
|
|
|
bool apply (AAT::hb_aat_apply_context_t *c) const
|
2018-11-07 22:03:09 +01:00
|
|
|
{ return dispatch (c); }
|
|
|
|
|
2019-05-05 19:14:17 +02:00
|
|
|
template <typename context_t, typename ...Ts>
|
2019-05-08 05:58:43 +02:00
|
|
|
typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
|
2018-11-02 18:23:54 +01:00
|
|
|
{
|
2018-11-07 22:03:09 +01:00
|
|
|
unsigned int subtable_type = get_type ();
|
|
|
|
TRACE_DISPATCH (this, subtable_type);
|
|
|
|
switch (subtable_type) {
|
2019-05-05 19:14:17 +02:00
|
|
|
case 0: return_trace (c->dispatch (u.ot, hb_forward<Ts> (ds)...));
|
2019-05-11 08:55:22 +02:00
|
|
|
#ifndef HB_NO_SHAPE_AAT
|
2019-05-05 19:14:17 +02:00
|
|
|
case 1: return_trace (c->dispatch (u.aat, hb_forward<Ts> (ds)...));
|
2019-05-11 08:31:05 +02:00
|
|
|
#endif
|
2018-11-07 22:03:09 +01:00
|
|
|
default: return_trace (c->default_return_value ());
|
2018-11-02 18:23:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-16 20:08:10 +01:00
|
|
|
bool sanitize (hb_sanitize_context_t *c) const
|
2017-11-02 00:31:29 +01:00
|
|
|
{
|
|
|
|
TRACE_SANITIZE (this);
|
2018-10-10 03:56:37 +02:00
|
|
|
if (!u.version32.sanitize (c)) return_trace (false);
|
2018-11-07 22:03:09 +01:00
|
|
|
return_trace (dispatch (c));
|
2017-11-02 00:31:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
union {
|
2018-10-09 05:57:45 +02:00
|
|
|
HBUINT32 version32;
|
2018-10-10 03:56:37 +02:00
|
|
|
HBUINT16 major;
|
2017-11-02 00:31:29 +01:00
|
|
|
KernOT ot;
|
2019-05-11 08:55:22 +02:00
|
|
|
#ifndef HB_NO_SHAPE_AAT
|
2017-11-02 00:31:29 +01:00
|
|
|
KernAAT aat;
|
2019-05-11 08:31:05 +02:00
|
|
|
#endif
|
2017-11-02 00:31:29 +01:00
|
|
|
} u;
|
|
|
|
public:
|
2018-10-10 03:56:37 +02:00
|
|
|
DEFINE_SIZE_UNION (4, version32);
|
2017-11-02 00:31:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace OT */
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* HB_OT_KERN_TABLE_HH */
|