Merge branch 'master' into cff-subset
This commit is contained in:
commit
fb2a037f54
@ -107,6 +107,7 @@ HB_OT_sources = \
|
||||
hb-aat-layout-feat-table.hh \
|
||||
hb-aat-layout-just-table.hh \
|
||||
hb-aat-layout-kerx-table.hh \
|
||||
hb-aat-layout-lcar-table.hh \
|
||||
hb-aat-layout-morx-table.hh \
|
||||
hb-aat-layout-trak-table.hh \
|
||||
hb-aat-layout.hh \
|
||||
|
@ -54,13 +54,6 @@ struct SettingName
|
||||
|
||||
struct FeatureName
|
||||
{
|
||||
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
|
||||
{
|
||||
TRACE_SANITIZE (this);
|
||||
return_trace (likely (c->check_struct (this) &&
|
||||
(base+settingTable).sanitize (c, nSettings)));
|
||||
}
|
||||
|
||||
enum {
|
||||
Exclusive = 0x8000, /* If set, the feature settings are mutually exclusive. */
|
||||
NotDefault = 0x4000, /* If clear, then the setting with an index of 0 in
|
||||
@ -75,6 +68,13 @@ struct FeatureName
|
||||
* as the default. */
|
||||
};
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
|
||||
{
|
||||
TRACE_SANITIZE (this);
|
||||
return_trace (likely (c->check_struct (this) &&
|
||||
(base+settingTable).sanitize (c, nSettings)));
|
||||
}
|
||||
|
||||
protected:
|
||||
HBUINT16 feature; /* Feature type. */
|
||||
HBUINT16 nSettings; /* The number of records in the setting name array. */
|
||||
|
@ -178,6 +178,8 @@ struct RepeatedAddGlyphAction
|
||||
|
||||
struct ActionSubrecord
|
||||
{
|
||||
inline unsigned int get_length (void) const { return u.header.actionLength; }
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||
{
|
||||
TRACE_SANITIZE (this);
|
||||
@ -196,8 +198,6 @@ struct ActionSubrecord
|
||||
}
|
||||
}
|
||||
|
||||
inline unsigned int get_length () const { return u.header.actionLength; }
|
||||
|
||||
protected:
|
||||
union {
|
||||
ActionSubrecordHeader header;
|
||||
@ -309,8 +309,8 @@ struct WidthDeltaPair
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (24);
|
||||
};
|
||||
|
||||
struct WidthDeltaCluster : OT::LArrayOf<WidthDeltaPair> {};
|
||||
|
||||
typedef OT::LArrayOf<WidthDeltaPair> WidthDeltaCluster;
|
||||
|
||||
struct JustificationCategory
|
||||
{
|
||||
@ -388,9 +388,10 @@ struct just
|
||||
{
|
||||
TRACE_SANITIZE (this);
|
||||
|
||||
return_trace (unlikely (c->check_struct (this) &&
|
||||
horizData.sanitize (c, this, this) &&
|
||||
vertData.sanitize (c, this, this)));
|
||||
return_trace (likely (c->check_struct (this) &&
|
||||
version.major == 1 &&
|
||||
horizData.sanitize (c, this, this) &&
|
||||
vertData.sanitize (c, this, this)));
|
||||
}
|
||||
|
||||
protected:
|
||||
|
92
src/hb-aat-layout-lcar-table.hh
Normal file
92
src/hb-aat-layout-lcar-table.hh
Normal file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright © 2018 Ebrahim Byagowi
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef HB_AAT_LAYOUT_LCAR_TABLE_HH
|
||||
#define HB_AAT_LAYOUT_LCAR_TABLE_HH
|
||||
|
||||
#include "hb-open-type.hh"
|
||||
#include "hb-aat-layout-common.hh"
|
||||
|
||||
/*
|
||||
* lcar -- Ligature caret
|
||||
* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6lcar.html
|
||||
*/
|
||||
#define HB_AAT_TAG_lcar HB_TAG('l','c','a','r')
|
||||
|
||||
|
||||
namespace AAT {
|
||||
|
||||
typedef ArrayOf<HBINT16> LigCaretClassEntry;
|
||||
|
||||
struct lcar
|
||||
{
|
||||
static const hb_tag_t tableTag = HB_AAT_TAG_lcar;
|
||||
|
||||
inline unsigned int get_lig_carets (hb_font_t *font,
|
||||
hb_direction_t direction,
|
||||
hb_codepoint_t glyph,
|
||||
unsigned int start_offset,
|
||||
unsigned int *caret_count /* IN/OUT */,
|
||||
hb_position_t *caret_array /* OUT */) const
|
||||
{
|
||||
const OffsetTo<LigCaretClassEntry>* entry_offset = lookup.get_value (glyph, font->face->num_glyphs);
|
||||
const LigCaretClassEntry& array = entry_offset ? this+*entry_offset : Null (LigCaretClassEntry);
|
||||
if (caret_count && *caret_count)
|
||||
{
|
||||
const HBINT16 *arr = array.sub_array (start_offset, caret_count);
|
||||
unsigned int count = *caret_count;
|
||||
for (unsigned int i = 0; i < count; ++i)
|
||||
switch (format)
|
||||
{
|
||||
case 0: caret_array[i] = font->em_scale_dir (arr[i], direction); break;
|
||||
case 1:
|
||||
hb_position_t x, y;
|
||||
font->get_glyph_contour_point_for_origin (glyph, arr[i], direction, &x, &y);
|
||||
caret_array[i] = HB_DIRECTION_IS_HORIZONTAL (direction) ? x : y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return array.len;
|
||||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||
{
|
||||
TRACE_SANITIZE (this);
|
||||
return_trace (likely (c->check_struct (this) &&
|
||||
version.major == 1 &&
|
||||
lookup.sanitize (c, this)));
|
||||
}
|
||||
|
||||
protected:
|
||||
FixedVersion<>version; /* Version number of the ligature caret table */
|
||||
HBUINT16 format; /* Format of the ligature caret table. */
|
||||
Lookup<OffsetTo<LigCaretClassEntry> >
|
||||
lookup; /* data Lookup table associating glyphs */
|
||||
|
||||
public:
|
||||
DEFINE_SIZE_MIN (8);
|
||||
};
|
||||
|
||||
} /* namespace AAT */
|
||||
|
||||
#endif /* HB_AAT_LAYOUT_LCAR_TABLE_HH */
|
@ -147,9 +147,9 @@ struct TrackData
|
||||
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
|
||||
{
|
||||
TRACE_SANITIZE (this);
|
||||
return_trace (c->check_struct (this) &&
|
||||
sizeTable.sanitize (c, base, nSizes) &&
|
||||
trackTable.sanitize (c, nTracks, base, nSizes));
|
||||
return_trace (likely (c->check_struct (this) &&
|
||||
sizeTable.sanitize (c, base, nSizes) &&
|
||||
trackTable.sanitize (c, nTracks, base, nSizes)));
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -171,15 +171,6 @@ struct trak
|
||||
|
||||
inline bool has_data (void) const { return version.to_int () != 0; }
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||
{
|
||||
TRACE_SANITIZE (this);
|
||||
|
||||
return_trace (unlikely (c->check_struct (this) &&
|
||||
horizData.sanitize (c, this, this) &&
|
||||
vertData.sanitize (c, this, this)));
|
||||
}
|
||||
|
||||
inline bool apply (hb_aat_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY (this);
|
||||
@ -221,15 +212,27 @@ struct trak
|
||||
return_trace (true);
|
||||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||
{
|
||||
TRACE_SANITIZE (this);
|
||||
|
||||
return_trace (likely (c->check_struct (this) &&
|
||||
version.major == 1 &&
|
||||
horizData.sanitize (c, this, this) &&
|
||||
vertData.sanitize (c, this, this)));
|
||||
}
|
||||
|
||||
protected:
|
||||
FixedVersion<> version; /* Version of the tracking table
|
||||
FixedVersion<>version; /* Version of the tracking table
|
||||
* (0x00010000u for version 1.0). */
|
||||
HBUINT16 format; /* Format of the tracking table (set to 0). */
|
||||
OffsetTo<TrackData> horizData; /* Offset from start of tracking table to TrackData
|
||||
* for horizontal text (or 0 if none). */
|
||||
OffsetTo<TrackData> vertData; /* Offset from start of tracking table to TrackData
|
||||
* for vertical text (or 0 if none). */
|
||||
HBUINT16 reserved; /* Reserved. Set to 0. */
|
||||
HBUINT16 format; /* Format of the tracking table (set to 0). */
|
||||
OffsetTo<TrackData>
|
||||
horizData; /* Offset from start of tracking table to TrackData
|
||||
* for horizontal text (or 0 if none). */
|
||||
OffsetTo<TrackData>
|
||||
vertData; /* Offset from start of tracking table to TrackData
|
||||
* for vertical text (or 0 if none). */
|
||||
HBUINT16 reserved; /* Reserved. Set to 0. */
|
||||
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (12);
|
||||
|
@ -356,7 +356,12 @@ hb_bsearch_r (const void *key, const void *base,
|
||||
}
|
||||
|
||||
|
||||
/* From https://github.com/noporpoise/sort_r */
|
||||
/* From https://github.com/noporpoise/sort_r
|
||||
* With following modifications:
|
||||
*
|
||||
* 10 November 2018:
|
||||
* https://github.com/noporpoise/sort_r/issues/7
|
||||
*/
|
||||
|
||||
/* Isaac Turner 29 April 2014 Public Domain */
|
||||
|
||||
@ -412,7 +417,7 @@ static inline void sort_r_simple(void *base, size_t nel, size_t w,
|
||||
|
||||
/* Use median of first, middle and last items as pivot */
|
||||
char *x, *y, *xend, ch;
|
||||
char *pl, *pr;
|
||||
char *pl, *pm, *pr;
|
||||
char *last = b+w*(nel-1), *tmp;
|
||||
char *l[3];
|
||||
l[0] = b;
|
||||
@ -434,13 +439,15 @@ static inline void sort_r_simple(void *base, size_t nel, size_t w,
|
||||
pr = last;
|
||||
|
||||
while(pl < pr) {
|
||||
for(; pl < pr; pl += w) {
|
||||
pm = pl+((pr-pl+1)>>1);
|
||||
for(; pl < pm; pl += w) {
|
||||
if(sort_r_cmpswap(pl, pr, w, compar, arg)) {
|
||||
pr -= w; /* pivot now at pl */
|
||||
break;
|
||||
}
|
||||
}
|
||||
for(; pl < pr; pr -= w) {
|
||||
pm = pl+((pr-pl)>>1);
|
||||
for(; pm < pr; pr -= w) {
|
||||
if(sort_r_cmpswap(pl, pr, w, compar, arg)) {
|
||||
pl += w; /* pivot now at pr */
|
||||
break;
|
||||
@ -517,7 +524,10 @@ struct hb_bytes_t
|
||||
inline hb_bytes_t (const char *bytes_, unsigned int len_) : arrayZ (bytes_), len (len_) {}
|
||||
inline hb_bytes_t (const void *bytes_, unsigned int len_) : arrayZ ((const char *) bytes_), len (len_) {}
|
||||
template <typename T>
|
||||
inline hb_bytes_t (const T& array) : arrayZ ((const char *) array.arrayZ), len (array.len) {}
|
||||
inline hb_bytes_t (const T& array) : arrayZ ((const char *) array.arrayZ), len (array.len * sizeof (array.arrayZ[0])) {}
|
||||
|
||||
inline operator const void * (void) const { return arrayZ; }
|
||||
inline operator const char * (void) const { return arrayZ; }
|
||||
|
||||
inline void free (void) { ::free ((void *) arrayZ); arrayZ = nullptr; len = 0; }
|
||||
|
||||
@ -526,6 +536,9 @@ struct hb_bytes_t
|
||||
if (len != a.len)
|
||||
return (int) a.len - (int) len;
|
||||
|
||||
if (!len)
|
||||
return 0; /* glibc's memcmp() declares args non-NULL, and UBSan doesn't like that. :( */
|
||||
|
||||
return memcmp (a.arrayZ, arrayZ, len);
|
||||
}
|
||||
static inline int cmp (const void *pa, const void *pb)
|
||||
|
@ -337,8 +337,16 @@ struct UnsizedArrayOf
|
||||
{
|
||||
HB_NO_CREATE_COPY_ASSIGN_TEMPLATE (UnsizedArrayOf, Type);
|
||||
|
||||
inline const Type& operator [] (unsigned int i) const { return arrayZ[i]; }
|
||||
inline Type& operator [] (unsigned int i) { return arrayZ[i]; }
|
||||
/* Unlikely other places, use "int i" instead of "unsigned int i" for our
|
||||
* indexing operator. For two reasons:
|
||||
* 1. For UnsizedArrayOf, it's not totally unimaginable to want to look
|
||||
* at items before the start of current array.
|
||||
* 2. Fixes MSVC 2008 "overloads have similar conversions" issue with the
|
||||
* built-in operator [] that takes int, in expressions like sizeof(array[0])).
|
||||
* I suppose I could fix that by replacing 0 with 0u, but like this fix
|
||||
* more now. */
|
||||
inline const Type& operator [] (int i) const { return arrayZ[i]; }
|
||||
inline Type& operator [] (int i) { return arrayZ[i]; }
|
||||
|
||||
template <typename T> inline operator T * (void) { return arrayZ; }
|
||||
template <typename T> inline operator const T * (void) const { return arrayZ; }
|
||||
|
@ -103,7 +103,12 @@ struct COLR
|
||||
unsigned int *count, /* IN/OUT. May be NULL. */
|
||||
hb_ot_color_layer_t *layers /* OUT. May be NULL. */) const
|
||||
{
|
||||
const BaseGlyphRecord &record = get_glyph_record (glyph);
|
||||
const BaseGlyphRecord *rec = (BaseGlyphRecord *) bsearch (&glyph,
|
||||
&(this+baseGlyphsZ),
|
||||
numBaseGlyphs,
|
||||
sizeof (BaseGlyphRecord),
|
||||
BaseGlyphRecord::cmp);
|
||||
const BaseGlyphRecord &record = rec ? *rec : Null (BaseGlyphRecord);
|
||||
|
||||
hb_array_t<const LayerRecord> all_layers ((this+layersZ).arrayZ, numLayers);
|
||||
hb_array_t<const LayerRecord> glyph_layers = all_layers.sub_array (record.firstLayerIdx,
|
||||
@ -129,17 +134,6 @@ struct COLR
|
||||
(this+layersZ).sanitize (c, numLayers)));
|
||||
}
|
||||
|
||||
private:
|
||||
inline const BaseGlyphRecord &get_glyph_record (hb_codepoint_t glyph_id) const
|
||||
{
|
||||
const BaseGlyphRecord *rec = (BaseGlyphRecord *) bsearch (&glyph_id,
|
||||
&(this+baseGlyphsZ),
|
||||
numBaseGlyphs,
|
||||
sizeof (BaseGlyphRecord),
|
||||
BaseGlyphRecord::cmp);
|
||||
return rec ? *rec : Null(BaseGlyphRecord);
|
||||
}
|
||||
|
||||
protected:
|
||||
HBUINT16 version; /* Table version number (starts at 0). */
|
||||
HBUINT16 numBaseGlyphs; /* Number of Base Glyph Records. */
|
||||
|
@ -62,6 +62,7 @@
|
||||
HB_OT_TABLE(AAT, kerx) \
|
||||
HB_OT_TABLE(AAT, ankr) \
|
||||
HB_OT_TABLE(AAT, trak) \
|
||||
HB_OT_TABLE(AAT, lcar) \
|
||||
HB_OT_TABLE(AAT, ltag) \
|
||||
/* OpenType variations. */ \
|
||||
HB_OT_TABLE(OT, fvar) \
|
||||
|
@ -149,7 +149,7 @@ struct glyf
|
||||
};
|
||||
|
||||
HBUINT16 flags;
|
||||
HBUINT16 glyphIndex;
|
||||
GlyphID glyphIndex;
|
||||
|
||||
inline unsigned int get_size (void) const
|
||||
{
|
||||
|
@ -123,10 +123,8 @@ struct CaretValueFormat2
|
||||
inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id) const
|
||||
{
|
||||
hb_position_t x, y;
|
||||
if (font->get_glyph_contour_point_for_origin (glyph_id, caretValuePoint, direction, &x, &y))
|
||||
return HB_DIRECTION_IS_HORIZONTAL (direction) ? x : y;
|
||||
else
|
||||
return 0;
|
||||
font->get_glyph_contour_point_for_origin (glyph_id, caretValuePoint, direction, &x, &y);
|
||||
return HB_DIRECTION_IS_HORIZONTAL (direction) ? x : y;
|
||||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||
|
@ -42,6 +42,8 @@
|
||||
#include "hb-ot-kern-table.hh"
|
||||
#include "hb-ot-name-table.hh"
|
||||
|
||||
#include "hb-aat-layout-lcar-table.hh"
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:hb-ot-layout
|
||||
@ -275,12 +277,15 @@ hb_ot_layout_get_ligature_carets (hb_font_t *font,
|
||||
unsigned int *caret_count /* IN/OUT */,
|
||||
hb_position_t *caret_array /* OUT */)
|
||||
{
|
||||
return font->face->table.GDEF->table->get_lig_carets (font,
|
||||
direction,
|
||||
glyph,
|
||||
start_offset,
|
||||
caret_count,
|
||||
caret_array);
|
||||
unsigned int result_caret_count = 0;
|
||||
unsigned int result = font->face->table.GDEF->table->get_lig_carets (font, direction, glyph, start_offset, &result_caret_count, caret_array);
|
||||
if (result)
|
||||
{
|
||||
if (caret_count) *caret_count = result_caret_count;
|
||||
}
|
||||
else
|
||||
result = font->face->table.lcar->get_lig_carets (font, direction, glyph, start_offset, caret_count, caret_array);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
@ -73,28 +73,15 @@ 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);
|
||||
}
|
||||
|
||||
inline bool subset (hb_subset_plan_t *plan) const
|
||||
{
|
||||
unsigned int post_prime_length;
|
||||
hb_blob_t *post_blob = hb_sanitize_context_t().reference_table<post>(plan->source);
|
||||
hb_blob_t *post_prime_blob = hb_blob_create_sub_blob (post_blob, 0, post::static_size);
|
||||
hb_blob_t *post_prime_blob = hb_blob_create_sub_blob (post_blob, 0, post::min_size);
|
||||
post *post_prime = (post *) hb_blob_get_data_writable (post_prime_blob, &post_prime_length);
|
||||
hb_blob_destroy (post_blob);
|
||||
|
||||
if (unlikely (!post_prime || post_prime_length != post::static_size))
|
||||
if (unlikely (!post_prime || post_prime_length != post::min_size))
|
||||
{
|
||||
hb_blob_destroy (post_prime_blob);
|
||||
DEBUG_MSG(SUBSET, nullptr, "Invalid source post table with length %d.", post_prime_length);
|
||||
@ -122,7 +109,7 @@ struct post
|
||||
if (version != 0x00020000)
|
||||
return;
|
||||
|
||||
const postV2Tail &v2 = StructAfter<postV2Tail> (*table);
|
||||
const postV2Tail &v2 = table->v2;
|
||||
|
||||
glyphNameIndex = &v2.glyphNameIndex;
|
||||
pool = &StructAfter<uint8_t> (v2.glyphNameIndex);
|
||||
@ -259,12 +246,21 @@ struct post
|
||||
private:
|
||||
hb_blob_t *blob;
|
||||
uint32_t version;
|
||||
hb_nonnull_ptr_t<const ArrayOf<HBUINT16> > glyphNameIndex;
|
||||
const ArrayOf<HBUINT16> *glyphNameIndex;
|
||||
hb_vector_t<uint32_t, 1> index_to_offset;
|
||||
const uint8_t *pool;
|
||||
hb_atomic_ptr_t<uint16_t *> gids_sorted_by_name;
|
||||
};
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||
{
|
||||
TRACE_SANITIZE (this);
|
||||
return_trace (likely (c->check_struct (this) &&
|
||||
(version.to_int () == 0x00010000 ||
|
||||
(version.to_int () == 0x00020000 && v2.sanitize (c)) ||
|
||||
version.to_int () == 0x00030000)));
|
||||
}
|
||||
|
||||
public:
|
||||
FixedVersion<>version; /* 0x00010000 for version 1.0
|
||||
* 0x00020000 for version 2.0
|
||||
@ -297,8 +293,8 @@ struct post
|
||||
* is downloaded as a Type 1 font. */
|
||||
HBUINT32 maxMemType1; /* Maximum memory usage when an OpenType font
|
||||
* is downloaded as a Type 1 font. */
|
||||
/*postV2Tail v2[VAR];*/
|
||||
DEFINE_SIZE_STATIC (32);
|
||||
postV2Tail v2;
|
||||
DEFINE_SIZE_MIN (32);
|
||||
};
|
||||
|
||||
struct post_accelerator_t : post::accelerator_t {};
|
||||
|
@ -375,8 +375,8 @@ struct hb_set_t
|
||||
if (!resize (count))
|
||||
return;
|
||||
population = other->population;
|
||||
memcpy (pages, other->pages, count * sizeof (pages[0]));
|
||||
memcpy (page_map, other->page_map, count * sizeof (page_map[0]));
|
||||
memcpy (pages, other->pages, count * pages.item_size);
|
||||
memcpy (page_map, other->page_map, count * page_map.item_size);
|
||||
}
|
||||
|
||||
inline bool is_equal (const hb_set_t *other) const
|
||||
|
@ -34,6 +34,9 @@
|
||||
template <typename Type, unsigned int StaticSize=8>
|
||||
struct hb_vector_t
|
||||
{
|
||||
typedef Type ItemType;
|
||||
enum { item_size = sizeof (Type) };
|
||||
|
||||
HB_NO_COPY_ASSIGN_TEMPLATE2 (hb_vector_t, Type, StaticSize);
|
||||
inline hb_vector_t (void) { init (); }
|
||||
inline ~hb_vector_t (void) { fini (); }
|
||||
|
@ -78,6 +78,7 @@ endif
|
||||
|
||||
TEST_PROGS += \
|
||||
test-ot-color \
|
||||
test-ot-ligature-carets \
|
||||
test-ot-name \
|
||||
test-ot-tag \
|
||||
test-ot-extents-cff \
|
||||
|
BIN
test/api/fonts/lcar.ttf
Normal file
BIN
test/api/fonts/lcar.ttf
Normal file
Binary file not shown.
67
test/api/test-ot-ligature-carets.c
Normal file
67
test/api/test-ot-ligature-carets.c
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright © 2018 Ebrahim Byagowi
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "hb-test.h"
|
||||
|
||||
#include <hb-ot.h>
|
||||
|
||||
static void
|
||||
test_ot_layout_feature_get_name_ids_and_characters (void)
|
||||
{
|
||||
hb_face_t *face = hb_test_open_font_file ("fonts/lcar.ttf");
|
||||
hb_font_t *font = hb_font_create (face);
|
||||
hb_font_set_scale (font, hb_face_get_upem (face) * 2, hb_face_get_upem (face) * 4);
|
||||
|
||||
hb_position_t caret_array[2];
|
||||
unsigned int caret_count = 2;
|
||||
g_assert_cmpuint (2, ==, hb_ot_layout_get_ligature_carets (font, HB_DIRECTION_RTL,
|
||||
98, 0, &caret_count,
|
||||
caret_array));
|
||||
|
||||
g_assert_cmpuint (2, ==, caret_count);
|
||||
g_assert_cmpuint (1130, ==, caret_array[0]);
|
||||
g_assert_cmpuint (2344, ==, caret_array[1]);
|
||||
|
||||
g_assert_cmpuint (2, ==, hb_ot_layout_get_ligature_carets (font, HB_DIRECTION_BTT,
|
||||
98, 0, &caret_count,
|
||||
caret_array));
|
||||
|
||||
g_assert_cmpuint (2, ==, caret_count);
|
||||
g_assert_cmpuint (2260, ==, caret_array[0]);
|
||||
g_assert_cmpuint (4688, ==, caret_array[1]);
|
||||
|
||||
hb_font_destroy (font);
|
||||
hb_face_destroy (face);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
hb_test_add (test_ot_layout_feature_get_name_ids_and_characters);
|
||||
|
||||
return hb_test_run ();
|
||||
}
|
Binary file not shown.
@ -1,3 +1,4 @@
|
||||
tests/MORX-31.tests
|
||||
tests/MORX-41.tests
|
||||
|
||||
# Non-Unicode cmap
|
||||
|
@ -51,7 +51,6 @@ TESTS = \
|
||||
tests/MORX-29.tests \
|
||||
tests/MORX-2.tests \
|
||||
tests/MORX-30.tests \
|
||||
tests/MORX-31.tests \
|
||||
tests/MORX-32.tests \
|
||||
tests/MORX-33.tests \
|
||||
tests/MORX-34.tests \
|
||||
@ -74,6 +73,7 @@ TESTS = \
|
||||
|
||||
DISBALED_TESTS = \
|
||||
tests/CMAP-3.tests \
|
||||
tests/MORX-31.tests \
|
||||
tests/MORX-41.tests \
|
||||
tests/SHARAN-1.tests \
|
||||
tests/SHBALI-1.tests \
|
||||
|
@ -1,8 +1,8 @@
|
||||
../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0058,U+0058,U+0041,U+0059,U+0059,U+0041,U+005A,U+005A:[X|X@364,0|I@728,0|N@1558,0|S@2388,0|A@3218,0|Y@4048,0|Y@4380,0|A@4712,0|Z@5542,0|Z@5864,0]
|
||||
../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0058,U+0058,U+0041,U+0059,U+0059,U+0042,U+0059,U+0059:[X|X@364,0|A@728,0|I@1558,0|N@2388,0|S@3218,0|Y@4048,0|Y@4380,0|B@4712,0|Y@5542,0|Y@5874,0]
|
||||
../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0058,U+0058,U+0042,U+0059,U+0059,U+0041,U+005A,U+005A:[X|X@364,0|I@728,0|N@1558,0|S@2388,0|B@3218,0|Y@4048,0|Y@4380,0|A@4712,0|Z@5542,0|Z@5864,0]
|
||||
../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0058,U+0058,U+0042,U+0059,U+0059,U+0042,U+005A,U+005A:[X|X@364,0|B@728,0|I@1558,0|N@2388,0|S@3218,0|Y@4048,0|Y@4380,0|B@4712,0|Z@5542,0|Z@5864,0]
|
||||
../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+004D,U+0050,U+0051,U+0052,U+0041,U+0058,U+0059,U+005A,U+0041:[I|N@830,0|S@1660,0|M@2490,0|P@3320,0|Q@3653,0|R@4019,0|I@4370,0|N@5200,0|S@6030,0|A@6860,0|X@7690,0|Y@8054,0|Z@8386,0|A@8708,0]
|
||||
../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+004D,U+0050,U+0051,U+0052,U+0041,U+0058,U+0059,U+005A,U+0042:[I|N@830,0|S@1660,0|M@2490,0|P@3320,0|Q@3653,0|R@4019,0|A@4370,0|I@5200,0|N@6030,0|S@6860,0|X@7690,0|Y@8054,0|Z@8386,0|B@8708,0]
|
||||
../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+004D,U+0050,U+0051,U+0052,U+0042,U+0058,U+0059,U+005A,U+0041:[M|I@830,0|N@1660,0|S@2490,0|P@3320,0|Q@3653,0|R@4019,0|I@4370,0|N@5200,0|S@6030,0|B@6860,0|X@7690,0|Y@8054,0|Z@8386,0|A@8708,0]
|
||||
../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+004D,U+0050,U+0051,U+0052,U+0042,U+0058,U+0059,U+005A,U+0042:[M|I@830,0|N@1660,0|S@2490,0|P@3320,0|Q@3653,0|R@4019,0|B@4370,0|I@5200,0|N@6030,0|S@6860,0|X@7690,0|Y@8054,0|Z@8386,0|B@8708,0]
|
||||
../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0058,U+0058,U+0041,U+0059,U+0059,U+0041,U+005A,U+005A:[I|N@830,0|I@1660,0|N@2490,0|S@3320,0|S@4150,0|X@4980,0|X@5344,0|A@5708,0|Y@6538,0|Y@6870,0|A@7202,0|Z@8032,0|Z@8354,0]
|
||||
../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0058,U+0058,U+0041,U+0059,U+0059,U+0042,U+0059,U+0059:[I|N@830,0|S@1660,0|I@2490,0|N@3320,0|S@4150,0|X@4980,0|X@5344,0|A@5708,0|Y@6538,0|Y@6870,0|B@7202,0|Y@8032,0|Y@8364,0]
|
||||
../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0058,U+0058,U+0042,U+0059,U+0059,U+0041,U+005A,U+005A:[X|I@364,0|I@1194,0|N@2024,0|S@2854,0|N@3684,0|S@4514,0|X@5344,0|B@5708,0|Y@6538,0|Y@6870,0|A@7202,0|Z@8032,0|Z@8354,0]
|
||||
../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+0058,U+0058,U+0042,U+0059,U+0059,U+0042,U+005A,U+005A:[X|I@364,0|N@1194,0|I@2024,0|N@2854,0|S@3684,0|S@4514,0|X@5344,0|B@5708,0|Y@6538,0|Y@6870,0|B@7202,0|Z@8032,0|Z@8354,0]
|
||||
../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+004D,U+0050,U+0051,U+0052,U+0041,U+0058,U+0059,U+005A,U+0041:[I|N@830,0|S@1660,0|M@2490,0|I@3320,0|N@4150,0|S@4980,0|P@5810,0|Q@6143,0|R@6509,0|A@6860,0|X@7690,0|Y@8054,0|Z@8386,0|A@8708,0]
|
||||
../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+004D,U+0050,U+0051,U+0052,U+0041,U+0058,U+0059,U+005A,U+0042:[I|N@830,0|S@1660,0|M@2490,0|P@3320,0|I@3653,0|N@4483,0|S@5313,0|Q@6143,0|R@6509,0|A@6860,0|X@7690,0|Y@8054,0|Z@8386,0|B@8708,0]
|
||||
../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+004D,U+0050,U+0051,U+0052,U+0042,U+0058,U+0059,U+005A,U+0041:[M|I@830,0|N@1660,0|S@2490,0|I@3320,0|N@4150,0|S@4980,0|P@5810,0|Q@6143,0|R@6509,0|B@6860,0|X@7690,0|Y@8054,0|Z@8386,0|A@8708,0]
|
||||
../fonts/TestMORXThirtyone.ttf:--font-size=1000 --ned --remove-default-ignorables --font-funcs=ft:U+004D,U+0050,U+0051,U+0052,U+0042,U+0058,U+0059,U+005A,U+0042:[M|I@830,0|N@1660,0|S@2490,0|P@3320,0|I@3653,0|N@4483,0|S@5313,0|Q@6143,0|R@6509,0|B@6860,0|X@7690,0|Y@8054,0|Z@8386,0|B@8708,0]
|
||||
|
Loading…
Reference in New Issue
Block a user