Run second iteration of stroke_caps

This commit is contained in:
Shaunak Kishore
2018-06-22 17:29:38 -04:00
parent 0f7b58f11a
commit c727b33e3d
5 changed files with 533 additions and 1 deletions

255
diffs.txt Normal file
View File

@ -0,0 +1,255 @@
20018
20387
20439
20500
20558
20588
20767
20861
20881
20984
21106
21117
21133
21137
21310
21344
21414
21550
21556
21592
21608
21671
21674
21679
21693
21700
21703
21705
21721
21759
21767
21780
21786
21808
21811
21854
21861
21928
21949
21996
21999
22046
22092
22099
22103
22108
22117
22121
22130
22137
22165
22196
22381
22495
22558
22697
22781
23114
23138
23207
23492
23566
23610
23628
23631
23660
23708
23888
24006
24061
24172
24291
24394
24609
25026
25078
25125
25150
25252
25326
25600
25601
25664
25776
25783
25842
25884
25900
25902
25932
25950
26005
26224
26463
26704
27008
27211
27262
27292
27331
27481
27590
27699
27835
27838
27839
27877
27896
27905
27934
27965
27996
28108
28342
28408
28638
28699
28849
29343
29431
29493
29496
29508
29559
29634
29722
29747
29822
29908
29951
29964
30168
30250
30281
30535
30611
30634
30669
30722
30732
30738
30746
30758
30761
30764
30796
30900
30964
31164
31388
31434
31449
31621
31697
31858
32080
32315
32449
32514
32561
32562
32633
32883
32921
33034
33190
33226
33244
33291
33499
33588
33716
33965
33983
34223
34264
34268
34285
34417
34480
34512
34661
34662
34676
34701
34756
34769
34799
34821
34838
34847
34866
35338
35430
35435
35518
35548
35559
35569
35738
35846
35863
35920
36032
36057
36084
36100
36382
36396
36423
36489
36530
36594
36671
36676
36758
36764
36887
36896
37090
37170
37225
37230
37624
37804
37969
38409
38428
38461
38761
38795
38799
38801
38851
39120
39241
39307
39425
39540
39618
39726
39749
39895
40022
40167
40329
40442
40529
40555
40557
40702
40713
40782
40853
40869

251
fixed.txt Normal file

File diff suppressed because one or more lines are too long

View File

@ -171,4 +171,4 @@ const fixStrokes = (strokes) => {
return corrected.modified ? corrected.strokes : strokes;
}
module.exports = {fixStrokes};
module.exports = {fixStrokes, fixStrokesWithDetails};

15
script.js Normal file
View File

@ -0,0 +1,15 @@
const fs = require('fs');
const fn = require('./lib/stroke_caps/fixStrokes.js').fixStrokesWithDetails;
fs.readFileSync('graphics.txt', 'utf8').split('\n').forEach((line, i) => {
if (!line) return;
const data = JSON.parse(line);
const corrected = fn(data.strokes);
console.error(`Done ${i + 1} characters.`);
if (!corrected.modified) return;
console.log(JSON.stringify({
character: data.character,
strokes: corrected.strokes,
medians: data.medians,
}));
});

View File

@ -255,6 +255,17 @@ Meteor.methods({
Meteor.startup(() => {
SSR.compileTemplate('animation', Assets.getText('animation.html'));
const bytes = x => Npm.require('fs').readFileSync(`${getPWD()}/${x}`);
const lines = x => bytes(x).toString().trim().split('\n');
lines('diffs.txt').forEach(line => {
const glyph = Glyphs.get(String.fromCharCode(parseInt(line, 10)));
console.log(glyph.character);
const raw = glyph.stages.strokes.raw;
glyph.stages.strokes.corrected = fixStrokes(fixStrokes(raw));
Glyphs.save(glyph);
});
const completion_callback = undefined;
const per_glyph_callback = undefined;
if (!per_glyph_callback && !completion_callback) {