mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-26 01:11:25 +01:00
[instancer/varstore] Put back sort again
In testing with GoogleSansFlex, this produces slightly smaller result.
This commit is contained in:
1 parent
d6343fa3bf
commit
cf6c9d8a8f
2 files changed
+18
No files matched your search
@@ -2333,6 +2333,11 @@ struct delta_row_encoding_t
|
||||
* needed for this region */
|
||||
struct chars_t : hb_vector_t<uint8_t>
|
||||
{
|
||||
int cmp (const chars_t& other) const
|
||||
{
|
||||
return as_array ().cmp (other.as_array ());
|
||||
}
|
||||
|
||||
hb_pair_t<unsigned, unsigned> get_width ()
|
||||
{
|
||||
unsigned width = 0;
|
||||
@@ -2486,6 +2491,17 @@ struct delta_row_encoding_t
|
||||
|
||||
bool add_row (const hb_vector_t<int>* row)
|
||||
{ return items.push (row); }
|
||||
|
||||
static int cmp (const void *pa, const void *pb)
|
||||
{
|
||||
const delta_row_encoding_t *a = (const delta_row_encoding_t *)pa;
|
||||
const delta_row_encoding_t *b = (const delta_row_encoding_t *)pb;
|
||||
|
||||
if (a->width != b->width)
|
||||
return (int) a->width - (int) b->width;
|
||||
|
||||
return b->chars.cmp (a->chars);
|
||||
}
|
||||
};
|
||||
|
||||
struct VarRegionAxis
|
||||
|
||||
@@ -1877,6 +1877,8 @@ struct item_variations_t
|
||||
* is a compromise between optimization and performance and practically
|
||||
* works very well. */
|
||||
|
||||
// This produces slightly smaller results in some cases.
|
||||
encoding_objs.qsort ();
|
||||
|
||||
/* main algorithm: repeatedly pick 2 best encodings to combine, and combine them */
|
||||
using item_t = hb_priority_queue_t<combined_gain_idx_tuple_t>::item_t;
|
||||
|
||||
Reference in new issue
Block a user