You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
elseif(glyph.numberOfContours>=0){// note that the spec allows for numberOfContours to be 0, in which case we have a zero-contour glyph but with the possibility of instructions to move phantom points
2095
2099
2096
2100
glyph.endPts=this.u16_arrayOfLength(glyph.numberOfContours);// end points of each contour
returnfinalLength;// now the buffer "this" contains the binary font, we return the length to the client as the buffer is larger than the font
2745
+
this.seek(finalLength);
2746
+
returnfinalLength;// now the buffer "this" contains the binary font, we return the length to the client (finalLength <= this.byteLength)
2746
2747
}
2747
2748
2748
2749
decodeItemVariationStore(){
@@ -2924,7 +2925,7 @@ class SamsaBuffer extends DataView {
2924
2925
if(numPoints<0x80)
2925
2926
this.u8=numPoints;// set length byte
2926
2927
else
2927
-
this.u16=numPoints|(GVAR_POINTS_ARE_WORDS<<8);// set length byte
2928
+
this.u16=numPoints|(GVAR_POINTS_ARE_WORDS<<8);// set length bit
2928
2929
2929
2930
// this method avoids the need to create arrays of runs
2930
2931
constu8PackedTell=this.byteOffset+this.tell();
@@ -4424,6 +4425,38 @@ SamsaFont.prototype.instance = function (axisSettings={}) {
4424
4425
returnnewSamsaInstance(this,axisSettings);
4425
4426
}
4426
4427
4428
+
// convenience functions
4429
+
SamsaFont.prototype.axes=function(){
4430
+
returnthis.fvar ? this.fvar.axes : [];
4431
+
}
4432
+
4433
+
SamsaFont.prototype.instances=function(){
4434
+
returnthis.fvar ? this.fvar.instances : [];
4435
+
}
4436
+
4437
+
SamsaFont.prototype.fvsFromCoordinates=function(coordinates){// note that coordinates here are not normalized, so directly from the user or the fvar table
4438
+
constfvs={};
4439
+
if(this.fvar){
4440
+
this.fvar.axes.forEach((axis,a)=>{
4441
+
if(coordinates===undefined)
4442
+
fvs[axis.axisTag]=axis.defaultValue;// set coordinates == undefined to get a default fvs (of course you can use an empty object for this)
@@ -4434,6 +4467,8 @@ function SamsaInstance(font, axisSettings={}, options={}) {
4434
4467
this.font=font;
4435
4468
if(options.name)
4436
4469
this.name=options.name;
4470
+
if(options.ppem)
4471
+
this.ppem=options.ppem;
4437
4472
const{avar, gvar}=font;// destructure table data objects
4438
4473
this.axisSettings={...axisSettings};
4439
4474
this.coordinates=font.coordinatesFromFvs(axisSettings);// the coordinates of the instance in user space
@@ -4582,40 +4617,6 @@ function SamsaInstance(font, axisSettings={}, options={}) {
4582
4617
}
4583
4618
}
4584
4619
4585
-
4586
-
// convenience functions
4587
-
SamsaFont.prototype.axes=function(){
4588
-
returnthis.fvar ? this.fvar.axes : [];
4589
-
}
4590
-
4591
-
SamsaFont.prototype.instances=function(){
4592
-
returnthis.fvar ? this.fvar.instances : [];
4593
-
}
4594
-
4595
-
SamsaFont.prototype.fvsFromCoordinates=function(coordinates){// note that coordinates here are not normalized, so directly from the user or the fvar table
4596
-
constfvs={};
4597
-
if(this.fvar){
4598
-
this.fvar.axes.forEach((axis,a)=>{
4599
-
if(coordinates===undefined)
4600
-
fvs[axis.axisTag]=axis.defaultValue;// set coordinates == undefined to get a default fvs (of course you can use an empty object for this)
// SamsaInstance.glyphAdvance() - return the advance of a glyph
4620
4621
// - we need this method in SamsaInstance, not SamsaGlyph, because SamsaGlyph might not be loaded (and we don’t need to load it, because we have hmtx and HVAR)
4621
4622
// - if we have a variable font and HVAR is not present, we must load the glyph in order to know its variable advance
@@ -4943,7 +4944,7 @@ SamsaInstance.prototype.glyphRunGSUB = function (inputRun, options={}) {
4943
4944
4944
4945
// get coverage for this lookup
4945
4946
if(subtable.coverageOffset){
4946
-
buf.seek(subtableOffset+coverageOffset);
4947
+
buf.seek(subtableOffset+subtable.coverageOffset);
4947
4948
subtable.coverage=buf.decodeCoverage();
4948
4949
}
4949
4950
}
@@ -5597,9 +5598,13 @@ function SamsaGlyph (init={}) {
5597
5598
this.points=init.points||[];
5598
5599
this.components=init.components||[];
5599
5600
this.endPts=init.endPts||[];
5600
-
this.tvts=init.tvts ? font.gvar.buffer.decodeTvts(this) : undefined;// init.tvts is boolean
this.tvts=init.tvts ? font.gvar.buffer.decodeTvts(this) : undefined;// init.tvts is boolean // TODO: this doesn’t work, move it to an options parameter?
0 commit comments