[aat] Start implementing Apple hvgl table

This commit is contained in:
Behdad Esfahbod committed 2025-03-02 16:56:38 -07:00
1 parent 622f242eb0
commit ce97c41fa4
3 files changed
+76

No files matched your search

+74
View File
@@ -0,0 +1,74 @@
#ifndef HB_AAT_VAR_HVGL_TABLE_HH
#define HB_AAT_VAR_HVGL_TABLE_HH
#include "hb-ot-var-common.hh"
/*
* `hvgl` table
*/
#define HB_AAT_TAG_hvgl HB_TAG('h','v','g','l')
namespace AAT {
using namespace OT;
namespace hvgl {
struct coordinates_t
{
public:
unsigned get_size (unsigned axis_count, unsigned segment_count) const
{ return (coords[0].static_size * 4) * segment_count; }
hb_array_t<const HBFLOAT64LE>
get_coords(unsigned segment_count) const
{ return hb_array (coords, segment_count * 4); }
bool sanitize (hb_sanitize_context_t *c,
unsigned segment_count) const
{
TRACE_SANITIZE (this);
return_trace (c->check_range (coords, coords[0].static_size * 4, segment_count));
}
protected:
HBFLOAT64LE coords[HB_VAR_ARRAY]; // length: SegmentCount * 4
};
struct deltas_t
{
public:
unsigned get_size (unsigned axis_count, unsigned segment_count) const
{ return (matrix[0].static_size * 2 * 4) * axis_count * segment_count; }
hb_array_t<const HBFLOAT64LE>
get_column(unsigned column_index, unsigned axis_count, unsigned segment_count) const
{
const unsigned rows = 4 * segment_count;
const unsigned start = column_index * rows;
return hb_array (matrix + start, rows);
}
hb_array_t<const HBFLOAT64LE>
get_matrix(unsigned axis_count, unsigned segment_count) const
{ return hb_array (matrix, (2 * 4) * axis_count * segment_count); }
bool sanitize (hb_sanitize_context_t *c,
unsigned axis_count,
unsigned segment_count) const
{
TRACE_SANITIZE (this);
return_trace (c->check_range (matrix, matrix[0].static_size * 2 * 4, axis_count, segment_count));
}
protected:
HBFLOAT64LE matrix[HB_VAR_ARRAY]; // column-major: AxisCount * 2 columns, DeltaSegmentCount * 4 rows
};
} // namespace hvgl
} // namespace AAT
#endif /* HB_AAT_VAR_HVGL_TABLE_HH */
+1
View File
@@ -39,6 +39,7 @@
#ifndef HB_NO_AAT
#include "hb-aat-layout-trak-table.hh"
#endif
#include "hb-aat-var-hvgl-table.hh"
#include "hb-ot-cmap-table.hh"
#include "hb-ot-glyf-table.hh"
#include "hb-ot-cff2-table.hh"
+1
View File
@@ -23,6 +23,7 @@ hb_base_sources = files(
'hb-aat-ltag-table.hh',
'hb-aat-map.cc',
'hb-aat-map.hh',
'hb-aat-var-hvgl-table.hh',
'hb-algs.hh',
'hb-array.hh',
'hb-atomic.hh',