encode_VARDELTAS function
dynamic
encode_VARDELTAS(
- dynamic deltas
Encode a list of variation adjustment deltas.
Variation adjustment deltas are used in ‘gvar’ and ‘cvar’ tables. They indicate how points (in ‘gvar’) or values (in ‘cvar’) get adjusted when generating instances of variation fonts.
@see https://www.microsoft.com/typography/otspec/gvar.htm @see https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6gvar.html @param {Array} @return {Array}
Implementation
encode_VARDELTAS(deltas) {
var pos = 0;
var result = [];
while (pos < deltas.length) {
var value = deltas[pos];
if (value == 0) {
pos = encodeVarDeltaRunAsZeroes(deltas, pos, result);
} else if (value >= -128 && value <= 127) {
pos = encodeVarDeltaRunAsBytes(deltas, pos, result);
} else {
pos = encodeVarDeltaRunAsWords(deltas, pos, result);
}
}
return result;
}