Skip to content

Commit

Permalink
Forgot to add byteOffset when assigning new SamsaBuffer based on old one
Browse files Browse the repository at this point in the history
  • Loading branch information
Lorp committed Nov 22, 2024
1 parent 82727fb commit 06396ca
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/samsa-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -2771,7 +2771,7 @@ class SamsaBuffer extends DataView {

// do we have tvt data?
if (nextOffset - offset > 0) {

// jump to the tvt data, record the offset
this.seek(gvar.glyphVariationDataArrayOffset + offset);
const tvtStart = this.tell();
Expand All @@ -2780,8 +2780,8 @@ class SamsaBuffer extends DataView {
const _tupleCount = this.u16;
const tupleCount = _tupleCount & 0x0FFF;
const offsetToSerializedData = this.u16;
const bufS = new SamsaBuffer(this.buffer, tvtStart + offsetToSerializedData);
const sharedPointIds = _tupleCount & GVAR_SHARED_POINT_NUMBERS ? bufS.decodePointIds() : undefined; // get the shared pointIds
const bufS = new SamsaBuffer(this.buffer, this.byteOffset + tvtStart + offsetToSerializedData);
const sharedPointIds = _tupleCount & GVAR_SHARED_POINT_NUMBERS ? bufS.decodePointIds() : null; // get the shared pointIds

// create all the tuples
for (let t=0; t < tupleCount; t++) {
Expand Down Expand Up @@ -2869,8 +2869,8 @@ class SamsaBuffer extends DataView {
}

// get pointIds and deltas from the serialized data
const pointIds = flags & GVAR_PRIVATE_POINT_NUMBERS ? bufS.decodePointIds() : sharedPointIds; // use private point ids or use the shared point ids
tvt.allPoints = pointIds.length == 0; // flag special case if all points are used (when unset this triggers IUP!)
const pointIds = flags & GVAR_PRIVATE_POINT_NUMBERS ? bufS.decodePointIds() : sharedPointIds; // use private point ids or use the shared point ids
tvt.allPoints = pointIds.length === 0; // flag special case if all points are used (when unset this triggers IUP!)
const tupleNumPoints = tvt.allPoints ? glyph.points.length : pointIds.length; // how many deltas do we need?
const xDeltas = bufS.decodeDeltas(tupleNumPoints);
const yDeltas = bufS.decodeDeltas(tupleNumPoints);
Expand Down

0 comments on commit 06396ca

Please sign in to comment.