Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
f734d16
work in progress... implementing encoding of GPOS table
felipesanches Jun 30, 2015
4a7b022
Improving the way the parser stores the parsed data so that we can us…
felipesanches Jun 30, 2015
375b62c
preparing the code to a future implementation of all subTables
felipesanches Jul 1, 2015
91d8ff7
hooking the encoder to the main OTF generation routine
felipesanches Jul 1, 2015
7e22ee9
I have setup mocha and as a result identified and fix all syntax erro…
felipesanches Jul 2, 2015
d434940
refactoring the GPOS table support and storing data to font.tables.gpos
felipesanches Jul 3, 2015
3ee9e5d
Added a new test file which includes GPOS tables and a corresponding …
felipesanches Jul 3, 2015
23104f1
July 3rd draft code (It is broken work in progress)
felipesanches Jul 3, 2015
46fb8c5
The encoding test is passing now (i.e. notcrashing) even though GPOS …
felipesanches Jul 6, 2015
09b384a
Work in Progress. Implemented most of the type#2 GPOS table. I also a…
felipesanches Jul 6, 2015
e625772
wip: improving encoding/decoding of GPOS type#2 table
felipesanches Jul 13, 2015
cc7c6dc
all tests are passing. In the next commit I'll cleanup the debugging …
felipesanches Jul 14, 2015
608e8a9
impoving the test coverage for GPOS round-tripping (and indeed, out c…
felipesanches Jul 15, 2015
85da676
some explicit error logs for unhandled lookup types
felipesanches Jul 15, 2015
f7130b8
wip: more parsing routines (still broken, though)
felipesanches Jul 15, 2015
875f0aa
wip: implementing the encoding of PairPos subtables
felipesanches Jul 17, 2015
79012d0
wip: GPOS subtables parsing/encoding
felipesanches Jul 18, 2015
35b53ae
minor refactoring on the encodeLookupEntry function
felipesanches Jul 18, 2015
5c4408f
wip: tweaks in the GPOS encoding and parsing done during this weekend
felipesanches Jul 20, 2015
be0e6b5
corrected encoding of subtable count and of lookup offsets
felipesanches Jul 20, 2015
344e427
wip;
felipesanches Jul 21, 2015
d4927b9
wip: some refactoring
felipesanches Jul 21, 2015
9a42c76
some debugging code
felipesanches Jul 22, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added fonts/FiraSansOT-Medium_gpos.otf
Binary file not shown.
2 changes: 1 addition & 1 deletion src/opentype.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ function parseBuffer(buffer) {
}

if (gposOffset) {
gpos.parse(data, gposOffset, font);
font.tables.gpos = gpos.parse(data, gposOffset, font);
}

return font;
Expand Down
27 changes: 27 additions & 0 deletions src/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,33 @@ Parser.prototype.parseByte = function() {
return v;
};

Parser.prototype.hexdump = function(length, width) {
var length = length || 32;
var width = width || 8;

function paddedHex(v, n){
return (v + (1<<(4*n))).toString(16).substr(-n).toUpperCase();
}

var result = "";
var values = [];
for (var i=0; i < length; i++){
var v = this.data.getUint8(this.offset + this.relativeOffset + i);
values.push(paddedHex(v,2));
if (i % width === width-1){
var address = width * Math.floor(i/width);
result += paddedHex(address,4) + ":\t";
result += values.join(' ') + "\n";
values = []
}
}
if (values.length){
result += width * Math.floor(i/width) + ":\t";
result += values.join('\t') + "\n";
}
return result;
};

Parser.prototype.parseChar = function() {
var v = this.data.getInt8(this.offset + this.relativeOffset);
this.relativeOffset += 1;
Expand Down
4 changes: 4 additions & 0 deletions src/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ Table.prototype.sizeOf = function() {
var v = 0;
for (var i = 0; i < this.fields.length; i += 1) {
var field = this.fields[i];
check.assert(field.name !== undefined, 'Field at index i='+i+' has undefined name and its value is "' + field.value + '". The field object is:'+ field + ' this.tableName='+this.tableName);

var value = this[field.name];
if (value === undefined) {
value = field.value;
}

check.assert(value !== undefined, 'field.name: "' + field.name + '" has undefined value!');

if (typeof value.sizeOf === 'function') {
v += value.sizeOf();
} else {
Expand Down
Loading