ot-builder-cli 1.3.3 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.json CHANGED
@@ -2,7 +2,94 @@
2
2
  "name": "ot-builder-cli",
3
3
  "entries": [
4
4
  {
5
- "date": "Sat, 18 Dec 2021 01:17:29 GMT",
5
+ "date": "Sat, 02 Apr 2022 01:38:49 GMT",
6
+ "tag": "ot-builder-cli_v1.5.1",
7
+ "version": "1.5.1",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "beachball",
12
+ "package": "ot-builder-cli",
13
+ "comment": "Bump ot-builder to v1.5.1",
14
+ "commit": "f87981f0891315771cda43fb56a3d8e85731a0af"
15
+ },
16
+ {
17
+ "author": "beachball",
18
+ "package": "ot-builder-cli",
19
+ "comment": "Bump @ot-builder/cli-help-shower to v1.5.1",
20
+ "commit": "f87981f0891315771cda43fb56a3d8e85731a0af"
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "ot-builder-cli",
25
+ "comment": "Bump @ot-builder/cli-shared to v1.5.1",
26
+ "commit": "f87981f0891315771cda43fb56a3d8e85731a0af"
27
+ }
28
+ ]
29
+ }
30
+ },
31
+ {
32
+ "date": "Sat, 26 Mar 2022 01:37:00 GMT",
33
+ "tag": "ot-builder-cli_v1.5.0",
34
+ "version": "1.5.0",
35
+ "comments": {
36
+ "minor": [
37
+ {
38
+ "author": "beachball",
39
+ "package": "ot-builder-cli",
40
+ "comment": "Bump ot-builder to v1.5.0",
41
+ "commit": "0d6eb83609255ffdfd147ed0610aab1aa424b357"
42
+ },
43
+ {
44
+ "author": "beachball",
45
+ "package": "ot-builder-cli",
46
+ "comment": "Bump @ot-builder/cli-help-shower to v1.5.0",
47
+ "commit": "0d6eb83609255ffdfd147ed0610aab1aa424b357"
48
+ },
49
+ {
50
+ "author": "beachball",
51
+ "package": "ot-builder-cli",
52
+ "comment": "Bump @ot-builder/cli-shared to v1.5.0",
53
+ "commit": "0d6eb83609255ffdfd147ed0610aab1aa424b357"
54
+ }
55
+ ]
56
+ }
57
+ },
58
+ {
59
+ "date": "Sat, 26 Feb 2022 01:27:19 GMT",
60
+ "tag": "ot-builder-cli_v1.4.0",
61
+ "version": "1.4.0",
62
+ "comments": {
63
+ "minor": [
64
+ {
65
+ "author": "otbbuilder-dev@users.noreply.github.com",
66
+ "package": "ot-builder-cli",
67
+ "commit": "d5ef5ade3424ec81b7545c9967badddeb9cc8f1b",
68
+ "comment": "Enhance OTBCLI with better subset, drop and transform-glyphs"
69
+ },
70
+ {
71
+ "author": "beachball",
72
+ "package": "ot-builder-cli",
73
+ "comment": "Bump ot-builder to v1.4.0",
74
+ "commit": "f1c3eedd84cadff44ee97d878a245b451ce7bd59"
75
+ },
76
+ {
77
+ "author": "beachball",
78
+ "package": "ot-builder-cli",
79
+ "comment": "Bump @ot-builder/cli-help-shower to v1.4.0",
80
+ "commit": "f1c3eedd84cadff44ee97d878a245b451ce7bd59"
81
+ },
82
+ {
83
+ "author": "beachball",
84
+ "package": "ot-builder-cli",
85
+ "comment": "Bump @ot-builder/cli-shared to v1.4.0",
86
+ "commit": "f1c3eedd84cadff44ee97d878a245b451ce7bd59"
87
+ }
88
+ ]
89
+ }
90
+ },
91
+ {
92
+ "date": "Sat, 18 Dec 2021 01:19:54 GMT",
6
93
  "tag": "ot-builder-cli_v1.3.3",
7
94
  "version": "1.3.3",
8
95
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,43 @@
1
1
  # Change Log - ot-builder-cli
2
2
 
3
- This log was last generated on Sat, 18 Dec 2021 01:17:29 GMT and should not be manually modified.
3
+ This log was last generated on Sat, 02 Apr 2022 01:38:49 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.5.1
8
+
9
+ Sat, 02 Apr 2022 01:38:49 GMT
10
+
11
+ ### Patches
12
+
13
+ - Bump ot-builder to v1.5.1
14
+ - Bump @ot-builder/cli-help-shower to v1.5.1
15
+ - Bump @ot-builder/cli-shared to v1.5.1
16
+
17
+ ## 1.5.0
18
+
19
+ Sat, 26 Mar 2022 01:37:00 GMT
20
+
21
+ ### Minor changes
22
+
23
+ - Bump ot-builder to v1.5.0
24
+ - Bump @ot-builder/cli-help-shower to v1.5.0
25
+ - Bump @ot-builder/cli-shared to v1.5.0
26
+
27
+ ## 1.4.0
28
+
29
+ Sat, 26 Feb 2022 01:27:19 GMT
30
+
31
+ ### Minor changes
32
+
33
+ - Enhance OTBCLI with better subset, drop and transform-glyphs (otbbuilder-dev@users.noreply.github.com)
34
+ - Bump ot-builder to v1.4.0
35
+ - Bump @ot-builder/cli-help-shower to v1.4.0
36
+ - Bump @ot-builder/cli-shared to v1.4.0
37
+
7
38
  ## 1.3.3
8
39
 
9
- Sat, 18 Dec 2021 01:17:29 GMT
40
+ Sat, 18 Dec 2021 01:19:54 GMT
10
41
 
11
42
  ### Patches
12
43
 
@@ -2,8 +2,9 @@ export interface ParseState {
2
2
  next(): ParseState;
3
3
  isEof(): this is ParsingEof;
4
4
  isOption(...options: string[]): this is ParsingOption;
5
+ expectOption(...options: string[]): string;
5
6
  isArgument(): this is ParsingArgument;
6
- nextArgument(): ParseResult<string>;
7
+ expectArgument(): string;
7
8
  reportParseErrorPosition(): string;
8
9
  }
9
10
  export interface ParsingEof {
@@ -15,14 +15,14 @@ class ParseArgvImpl {
15
15
  constructor(argv, cp) {
16
16
  this.argv = argv;
17
17
  this.cp = cp;
18
- this.eof = this.cp < this.argv.length;
18
+ this.eof = this.cp >= this.argv.length;
19
19
  this.option = this.argument = this.argv[cp];
20
20
  }
21
21
  next() {
22
22
  return new ParseArgvImpl(this.argv, this.cp + 1);
23
23
  }
24
24
  isEof() {
25
- return this.cp >= this.argv.length;
25
+ return this.eof;
26
26
  }
27
27
  isOption(...options) {
28
28
  if (this.isEof())
@@ -38,9 +38,19 @@ class ParseArgvImpl {
38
38
  }
39
39
  return false;
40
40
  }
41
+ expectOption(...options) {
42
+ if (!this.isOption(...options))
43
+ throw new TypeError("Not option.");
44
+ return this.option;
45
+ }
41
46
  isArgument() {
42
47
  return !this.isEof() && !this.isOption();
43
48
  }
49
+ expectArgument() {
50
+ if (!this.isArgument())
51
+ throw new TypeError("Not argument.");
52
+ return this.argument;
53
+ }
44
54
  nextArgument() {
45
55
  const nx = this.next();
46
56
  if (nx.isArgument()) {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createGrammar = void 0;
4
4
  const consolidate_1 = require("./syntax/actions/consolidate");
5
+ const drop_1 = require("./syntax/actions/drop");
5
6
  const gc_1 = require("./syntax/actions/gc");
6
7
  const intro_1 = require("./syntax/actions/intro");
7
8
  const merge_1 = require("./syntax/actions/merge");
@@ -9,6 +10,7 @@ const rebase_1 = require("./syntax/actions/rebase");
9
10
  const save_1 = require("./syntax/actions/save");
10
11
  const save_head_1 = require("./syntax/actions/save-head");
11
12
  const subset_1 = require("./syntax/actions/subset");
13
+ const transform_glyphs_1 = require("./syntax/actions/transform-glyphs");
12
14
  const alternate_1 = require("./syntax/composite/alternate");
13
15
  const main_command_1 = require("./syntax/composite/main-command");
14
16
  const possessive_repeat_1 = require("./syntax/composite/possessive-repeat");
@@ -32,9 +34,11 @@ function createGrammar() {
32
34
  save_1.SaveSyntax,
33
35
  save_head_1.SaveHeadSyntax,
34
36
  rebase_1.RebaseSyntax,
35
- gc_1.GcSyntax,
36
- subset_1.SubsetSyntax,
37
+ transform_glyphs_1.TransformGlyphsSyntax,
37
38
  merge_1.MergeSyntax,
39
+ subset_1.SubsetSyntax,
40
+ drop_1.DropSyntax,
41
+ gc_1.GcSyntax,
38
42
  consolidate_1.ConsolidateSyntax,
39
43
  set_optimize_level_1.SetOptimizationLevelSyntax,
40
44
  set_recalc_os2_avg_char_width_1.SetRecalcOs2AvgCharWidthSyntax
@@ -0,0 +1,6 @@
1
+ export declare type RangeDecl = {
2
+ isExclusion: boolean;
3
+ start: number;
4
+ end: number;
5
+ };
6
+ //# sourceMappingURL=datatypes.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=datatypes.js.map
@@ -0,0 +1,157 @@
1
+ import { RangeDecl } from "./datatypes";
2
+ declare type Nullable<T> = T | null;
3
+ export declare enum ASTKinds {
4
+ start = 0,
5
+ Ranges_1 = 1,
6
+ Ranges_2 = 2,
7
+ Range_1 = 3,
8
+ Range_2 = 4,
9
+ CodePoint = 5,
10
+ Prefix_1 = 6,
11
+ Prefix_2 = 7,
12
+ Prefix_3 = 8,
13
+ Separator_1 = 9,
14
+ Separator_2 = 10,
15
+ _ = 11,
16
+ __ = 12,
17
+ ___ = 13
18
+ }
19
+ export declare class start {
20
+ kind: ASTKinds.start;
21
+ rgs: Ranges;
22
+ ranges: RangeDecl[];
23
+ constructor(rgs: Ranges);
24
+ }
25
+ export declare type Ranges = Ranges_1 | Ranges_2;
26
+ export declare class Ranges_1 {
27
+ kind: ASTKinds.Ranges_1;
28
+ car: Range;
29
+ cdr: Ranges;
30
+ ranges: RangeDecl[];
31
+ constructor(car: Range, cdr: Ranges);
32
+ }
33
+ export declare class Ranges_2 {
34
+ kind: ASTKinds.Ranges_2;
35
+ range: Range;
36
+ ranges: RangeDecl[];
37
+ constructor(range: Range);
38
+ }
39
+ export declare type Range = Range_1 | Range_2;
40
+ export declare class Range_1 {
41
+ kind: ASTKinds.Range_1;
42
+ exclude: Nullable<string>;
43
+ start: CodePoint;
44
+ end: CodePoint;
45
+ codeRange: RangeDecl;
46
+ constructor(exclude: Nullable<string>, start: CodePoint, end: CodePoint);
47
+ }
48
+ export declare class Range_2 {
49
+ kind: ASTKinds.Range_2;
50
+ exclude: Nullable<string>;
51
+ at: CodePoint;
52
+ codeRange: RangeDecl;
53
+ constructor(exclude: Nullable<string>, at: CodePoint);
54
+ }
55
+ export declare class CodePoint {
56
+ kind: ASTKinds.CodePoint;
57
+ literal: string;
58
+ value: number;
59
+ constructor(literal: string);
60
+ }
61
+ export declare type Prefix = Prefix_1 | Prefix_2 | Prefix_3;
62
+ export declare type Prefix_1 = string;
63
+ export declare type Prefix_2 = string;
64
+ export declare type Prefix_3 = string;
65
+ export declare type Separator = Separator_1 | Separator_2;
66
+ export interface Separator_1 {
67
+ kind: ASTKinds.Separator_1;
68
+ }
69
+ export declare type Separator_2 = ___;
70
+ export declare type _ = string;
71
+ export declare type __ = string;
72
+ export interface ___ {
73
+ kind: ASTKinds.___;
74
+ }
75
+ export declare class Parser {
76
+ private readonly input;
77
+ private pos;
78
+ private negating;
79
+ private memoSafe;
80
+ constructor(input: string);
81
+ reset(pos: PosInfo): void;
82
+ finished(): boolean;
83
+ clearMemos(): void;
84
+ protected $scope$start$memo: Map<number, [Nullable<start>, PosInfo]>;
85
+ protected $scope$Ranges$memo: Map<number, [Nullable<Ranges>, PosInfo]>;
86
+ protected $scope$Range$memo: Map<number, [Nullable<Range>, PosInfo]>;
87
+ protected $scope$CodePoint$memo: Map<number, [Nullable<CodePoint>, PosInfo]>;
88
+ protected $scope$Prefix$memo: Map<number, [Nullable<Prefix>, PosInfo]>;
89
+ protected $scope$Separator$memo: Map<number, [Nullable<Separator>, PosInfo]>;
90
+ protected $scope$_$memo: Map<number, [Nullable<_>, PosInfo]>;
91
+ protected $scope$__$memo: Map<number, [Nullable<__>, PosInfo]>;
92
+ protected $scope$___$memo: Map<number, [Nullable<___>, PosInfo]>;
93
+ matchstart($$dpth: number, $$cr?: ErrorTracker): Nullable<start>;
94
+ matchRanges($$dpth: number, $$cr?: ErrorTracker): Nullable<Ranges>;
95
+ matchRanges_1($$dpth: number, $$cr?: ErrorTracker): Nullable<Ranges_1>;
96
+ matchRanges_2($$dpth: number, $$cr?: ErrorTracker): Nullable<Ranges_2>;
97
+ matchRange($$dpth: number, $$cr?: ErrorTracker): Nullable<Range>;
98
+ matchRange_1($$dpth: number, $$cr?: ErrorTracker): Nullable<Range_1>;
99
+ matchRange_2($$dpth: number, $$cr?: ErrorTracker): Nullable<Range_2>;
100
+ matchCodePoint($$dpth: number, $$cr?: ErrorTracker): Nullable<CodePoint>;
101
+ matchPrefix($$dpth: number, $$cr?: ErrorTracker): Nullable<Prefix>;
102
+ matchPrefix_1($$dpth: number, $$cr?: ErrorTracker): Nullable<Prefix_1>;
103
+ matchPrefix_2($$dpth: number, $$cr?: ErrorTracker): Nullable<Prefix_2>;
104
+ matchPrefix_3($$dpth: number, $$cr?: ErrorTracker): Nullable<Prefix_3>;
105
+ matchSeparator($$dpth: number, $$cr?: ErrorTracker): Nullable<Separator>;
106
+ matchSeparator_1($$dpth: number, $$cr?: ErrorTracker): Nullable<Separator_1>;
107
+ matchSeparator_2($$dpth: number, $$cr?: ErrorTracker): Nullable<Separator_2>;
108
+ match_($$dpth: number, $$cr?: ErrorTracker): Nullable<_>;
109
+ match__($$dpth: number, $$cr?: ErrorTracker): Nullable<__>;
110
+ match___($$dpth: number, $$cr?: ErrorTracker): Nullable<___>;
111
+ test(): boolean;
112
+ parse(): ParseResult;
113
+ mark(): PosInfo;
114
+ private loop;
115
+ private run;
116
+ private choice;
117
+ private regexAccept;
118
+ private tryConsume;
119
+ private noConsume;
120
+ private negate;
121
+ private memoise;
122
+ }
123
+ export declare function parse(s: string): ParseResult;
124
+ export interface ParseResult {
125
+ ast: Nullable<start>;
126
+ errs: SyntaxErr[];
127
+ }
128
+ export interface PosInfo {
129
+ readonly overallPos: number;
130
+ readonly line: number;
131
+ readonly offset: number;
132
+ }
133
+ export interface RegexMatch {
134
+ readonly kind: "RegexMatch";
135
+ readonly negated: boolean;
136
+ readonly literal: string;
137
+ }
138
+ export declare type EOFMatch = {
139
+ kind: "EOF";
140
+ negated: boolean;
141
+ };
142
+ export declare type MatchAttempt = RegexMatch | EOFMatch;
143
+ export declare class SyntaxErr {
144
+ pos: PosInfo;
145
+ expmatches: MatchAttempt[];
146
+ constructor(pos: PosInfo, expmatches: MatchAttempt[]);
147
+ toString(): string;
148
+ }
149
+ declare class ErrorTracker {
150
+ private mxpos;
151
+ private regexset;
152
+ private pmatches;
153
+ record(pos: PosInfo, result: any, att: MatchAttempt): void;
154
+ getErr(): SyntaxErr | null;
155
+ }
156
+ export {};
157
+ //# sourceMappingURL=generated.d.ts.map
@@ -0,0 +1,494 @@
1
+ "use strict";
2
+ /* AutoGenerated Code, changes may be overwritten
3
+ * INPUT GRAMMAR:
4
+ * ---
5
+ * import { RangeDecl } from "./datatypes";
6
+ * ---
7
+ * start := __ rgs=Ranges __
8
+ * .ranges = RangeDecl[] { return this.rgs.ranges }
9
+ * Ranges := car=Range Separator cdr=Ranges
10
+ * .ranges = RangeDecl[] { return [this.car.codeRange, ...this.cdr.ranges] }
11
+ * | range=Range
12
+ * .ranges = RangeDecl[] { return [this.range.codeRange] }
13
+ * Range := _ exclude='-'? _ start=CodePoint _ '..' _ end=CodePoint _
14
+ * .codeRange = RangeDecl {
15
+ * return {
16
+ * isExclusion: !!this.exclude,
17
+ * start: this.start.value,
18
+ * end:this.end.value
19
+ * }
20
+ * }
21
+ * | _ exclude='-'? _ at=CodePoint _
22
+ * .codeRange = RangeDecl {
23
+ * return { isExclusion: !!this.exclude, start: this.at.value, end:this.at.value }
24
+ * }
25
+ * CodePoint := Prefix? literal='[0-9A-Fa-f]+'
26
+ * .value = number { return parseInt(this.literal, 16) }
27
+ * Prefix := 'U\+' | '0x' | '0X'
28
+ * Separator := _ '[,;]' __
29
+ * | ___
30
+ * _ := '[ \t]*'
31
+ * __ := '(?:[ \t]|(?:#[^\r\n]*)?[\r\n])*'
32
+ * ___ := _ '(?:#[^\r\n]*)?[\r\n]' __
33
+ */
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.SyntaxErr = exports.parse = exports.Parser = exports.CodePoint = exports.Range_2 = exports.Range_1 = exports.Ranges_2 = exports.Ranges_1 = exports.start = exports.ASTKinds = void 0;
36
+ var ASTKinds;
37
+ (function (ASTKinds) {
38
+ ASTKinds[ASTKinds["start"] = 0] = "start";
39
+ ASTKinds[ASTKinds["Ranges_1"] = 1] = "Ranges_1";
40
+ ASTKinds[ASTKinds["Ranges_2"] = 2] = "Ranges_2";
41
+ ASTKinds[ASTKinds["Range_1"] = 3] = "Range_1";
42
+ ASTKinds[ASTKinds["Range_2"] = 4] = "Range_2";
43
+ ASTKinds[ASTKinds["CodePoint"] = 5] = "CodePoint";
44
+ ASTKinds[ASTKinds["Prefix_1"] = 6] = "Prefix_1";
45
+ ASTKinds[ASTKinds["Prefix_2"] = 7] = "Prefix_2";
46
+ ASTKinds[ASTKinds["Prefix_3"] = 8] = "Prefix_3";
47
+ ASTKinds[ASTKinds["Separator_1"] = 9] = "Separator_1";
48
+ ASTKinds[ASTKinds["Separator_2"] = 10] = "Separator_2";
49
+ ASTKinds[ASTKinds["_"] = 11] = "_";
50
+ ASTKinds[ASTKinds["__"] = 12] = "__";
51
+ ASTKinds[ASTKinds["___"] = 13] = "___";
52
+ })(ASTKinds = exports.ASTKinds || (exports.ASTKinds = {}));
53
+ class start {
54
+ constructor(rgs) {
55
+ this.kind = ASTKinds.start;
56
+ this.rgs = rgs;
57
+ this.ranges = (() => {
58
+ return this.rgs.ranges;
59
+ })();
60
+ }
61
+ }
62
+ exports.start = start;
63
+ class Ranges_1 {
64
+ constructor(car, cdr) {
65
+ this.kind = ASTKinds.Ranges_1;
66
+ this.car = car;
67
+ this.cdr = cdr;
68
+ this.ranges = (() => {
69
+ return [this.car.codeRange, ...this.cdr.ranges];
70
+ })();
71
+ }
72
+ }
73
+ exports.Ranges_1 = Ranges_1;
74
+ class Ranges_2 {
75
+ constructor(range) {
76
+ this.kind = ASTKinds.Ranges_2;
77
+ this.range = range;
78
+ this.ranges = (() => {
79
+ return [this.range.codeRange];
80
+ })();
81
+ }
82
+ }
83
+ exports.Ranges_2 = Ranges_2;
84
+ class Range_1 {
85
+ constructor(exclude, start, end) {
86
+ this.kind = ASTKinds.Range_1;
87
+ this.exclude = exclude;
88
+ this.start = start;
89
+ this.end = end;
90
+ this.codeRange = (() => {
91
+ return {
92
+ isExclusion: !!this.exclude,
93
+ start: this.start.value,
94
+ end: this.end.value
95
+ };
96
+ })();
97
+ }
98
+ }
99
+ exports.Range_1 = Range_1;
100
+ class Range_2 {
101
+ constructor(exclude, at) {
102
+ this.kind = ASTKinds.Range_2;
103
+ this.exclude = exclude;
104
+ this.at = at;
105
+ this.codeRange = (() => {
106
+ return { isExclusion: !!this.exclude, start: this.at.value, end: this.at.value };
107
+ })();
108
+ }
109
+ }
110
+ exports.Range_2 = Range_2;
111
+ class CodePoint {
112
+ constructor(literal) {
113
+ this.kind = ASTKinds.CodePoint;
114
+ this.literal = literal;
115
+ this.value = (() => {
116
+ return parseInt(this.literal, 16);
117
+ })();
118
+ }
119
+ }
120
+ exports.CodePoint = CodePoint;
121
+ class Parser {
122
+ constructor(input) {
123
+ this.negating = false;
124
+ this.memoSafe = true;
125
+ this.$scope$start$memo = new Map();
126
+ this.$scope$Ranges$memo = new Map();
127
+ this.$scope$Range$memo = new Map();
128
+ this.$scope$CodePoint$memo = new Map();
129
+ this.$scope$Prefix$memo = new Map();
130
+ this.$scope$Separator$memo = new Map();
131
+ this.$scope$_$memo = new Map();
132
+ this.$scope$__$memo = new Map();
133
+ this.$scope$___$memo = new Map();
134
+ this.pos = { overallPos: 0, line: 1, offset: 0 };
135
+ this.input = input;
136
+ }
137
+ reset(pos) {
138
+ this.pos = pos;
139
+ }
140
+ finished() {
141
+ return this.pos.overallPos === this.input.length;
142
+ }
143
+ clearMemos() {
144
+ this.$scope$start$memo.clear();
145
+ this.$scope$Ranges$memo.clear();
146
+ this.$scope$Range$memo.clear();
147
+ this.$scope$CodePoint$memo.clear();
148
+ this.$scope$Prefix$memo.clear();
149
+ this.$scope$Separator$memo.clear();
150
+ this.$scope$_$memo.clear();
151
+ this.$scope$__$memo.clear();
152
+ this.$scope$___$memo.clear();
153
+ }
154
+ matchstart($$dpth, $$cr) {
155
+ return this.memoise(() => {
156
+ return this.run($$dpth, () => {
157
+ let $scope$rgs;
158
+ let $$res = null;
159
+ if (true
160
+ && this.match__($$dpth + 1, $$cr) !== null
161
+ && ($scope$rgs = this.matchRanges($$dpth + 1, $$cr)) !== null
162
+ && this.match__($$dpth + 1, $$cr) !== null) {
163
+ $$res = new start($scope$rgs);
164
+ }
165
+ return $$res;
166
+ });
167
+ }, this.$scope$start$memo);
168
+ }
169
+ matchRanges($$dpth, $$cr) {
170
+ return this.memoise(() => {
171
+ return this.choice([
172
+ () => this.matchRanges_1($$dpth + 1, $$cr),
173
+ () => this.matchRanges_2($$dpth + 1, $$cr),
174
+ ]);
175
+ }, this.$scope$Ranges$memo);
176
+ }
177
+ matchRanges_1($$dpth, $$cr) {
178
+ return this.run($$dpth, () => {
179
+ let $scope$car;
180
+ let $scope$cdr;
181
+ let $$res = null;
182
+ if (true
183
+ && ($scope$car = this.matchRange($$dpth + 1, $$cr)) !== null
184
+ && this.matchSeparator($$dpth + 1, $$cr) !== null
185
+ && ($scope$cdr = this.matchRanges($$dpth + 1, $$cr)) !== null) {
186
+ $$res = new Ranges_1($scope$car, $scope$cdr);
187
+ }
188
+ return $$res;
189
+ });
190
+ }
191
+ matchRanges_2($$dpth, $$cr) {
192
+ return this.run($$dpth, () => {
193
+ let $scope$range;
194
+ let $$res = null;
195
+ if (true
196
+ && ($scope$range = this.matchRange($$dpth + 1, $$cr)) !== null) {
197
+ $$res = new Ranges_2($scope$range);
198
+ }
199
+ return $$res;
200
+ });
201
+ }
202
+ matchRange($$dpth, $$cr) {
203
+ return this.memoise(() => {
204
+ return this.choice([
205
+ () => this.matchRange_1($$dpth + 1, $$cr),
206
+ () => this.matchRange_2($$dpth + 1, $$cr),
207
+ ]);
208
+ }, this.$scope$Range$memo);
209
+ }
210
+ matchRange_1($$dpth, $$cr) {
211
+ return this.run($$dpth, () => {
212
+ let $scope$exclude;
213
+ let $scope$start;
214
+ let $scope$end;
215
+ let $$res = null;
216
+ if (true
217
+ && this.match_($$dpth + 1, $$cr) !== null
218
+ && (($scope$exclude = this.regexAccept(String.raw `(?:-)`, $$dpth + 1, $$cr)) || true)
219
+ && this.match_($$dpth + 1, $$cr) !== null
220
+ && ($scope$start = this.matchCodePoint($$dpth + 1, $$cr)) !== null
221
+ && this.match_($$dpth + 1, $$cr) !== null
222
+ && this.regexAccept(String.raw `(?:..)`, $$dpth + 1, $$cr) !== null
223
+ && this.match_($$dpth + 1, $$cr) !== null
224
+ && ($scope$end = this.matchCodePoint($$dpth + 1, $$cr)) !== null
225
+ && this.match_($$dpth + 1, $$cr) !== null) {
226
+ $$res = new Range_1($scope$exclude, $scope$start, $scope$end);
227
+ }
228
+ return $$res;
229
+ });
230
+ }
231
+ matchRange_2($$dpth, $$cr) {
232
+ return this.run($$dpth, () => {
233
+ let $scope$exclude;
234
+ let $scope$at;
235
+ let $$res = null;
236
+ if (true
237
+ && this.match_($$dpth + 1, $$cr) !== null
238
+ && (($scope$exclude = this.regexAccept(String.raw `(?:-)`, $$dpth + 1, $$cr)) || true)
239
+ && this.match_($$dpth + 1, $$cr) !== null
240
+ && ($scope$at = this.matchCodePoint($$dpth + 1, $$cr)) !== null
241
+ && this.match_($$dpth + 1, $$cr) !== null) {
242
+ $$res = new Range_2($scope$exclude, $scope$at);
243
+ }
244
+ return $$res;
245
+ });
246
+ }
247
+ matchCodePoint($$dpth, $$cr) {
248
+ return this.memoise(() => {
249
+ return this.run($$dpth, () => {
250
+ let $scope$literal;
251
+ let $$res = null;
252
+ if (true
253
+ && ((this.matchPrefix($$dpth + 1, $$cr)) || true)
254
+ && ($scope$literal = this.regexAccept(String.raw `(?:[0-9A-Fa-f]+)`, $$dpth + 1, $$cr)) !== null) {
255
+ $$res = new CodePoint($scope$literal);
256
+ }
257
+ return $$res;
258
+ });
259
+ }, this.$scope$CodePoint$memo);
260
+ }
261
+ matchPrefix($$dpth, $$cr) {
262
+ return this.memoise(() => {
263
+ return this.choice([
264
+ () => this.matchPrefix_1($$dpth + 1, $$cr),
265
+ () => this.matchPrefix_2($$dpth + 1, $$cr),
266
+ () => this.matchPrefix_3($$dpth + 1, $$cr),
267
+ ]);
268
+ }, this.$scope$Prefix$memo);
269
+ }
270
+ matchPrefix_1($$dpth, $$cr) {
271
+ return this.regexAccept(String.raw `(?:U\+)`, $$dpth + 1, $$cr);
272
+ }
273
+ matchPrefix_2($$dpth, $$cr) {
274
+ return this.regexAccept(String.raw `(?:0x)`, $$dpth + 1, $$cr);
275
+ }
276
+ matchPrefix_3($$dpth, $$cr) {
277
+ return this.regexAccept(String.raw `(?:0X)`, $$dpth + 1, $$cr);
278
+ }
279
+ matchSeparator($$dpth, $$cr) {
280
+ return this.memoise(() => {
281
+ return this.choice([
282
+ () => this.matchSeparator_1($$dpth + 1, $$cr),
283
+ () => this.matchSeparator_2($$dpth + 1, $$cr),
284
+ ]);
285
+ }, this.$scope$Separator$memo);
286
+ }
287
+ matchSeparator_1($$dpth, $$cr) {
288
+ return this.run($$dpth, () => {
289
+ let $$res = null;
290
+ if (true
291
+ && this.match_($$dpth + 1, $$cr) !== null
292
+ && this.regexAccept(String.raw `(?:[,;])`, $$dpth + 1, $$cr) !== null
293
+ && this.match__($$dpth + 1, $$cr) !== null) {
294
+ $$res = { kind: ASTKinds.Separator_1, };
295
+ }
296
+ return $$res;
297
+ });
298
+ }
299
+ matchSeparator_2($$dpth, $$cr) {
300
+ return this.match___($$dpth + 1, $$cr);
301
+ }
302
+ match_($$dpth, $$cr) {
303
+ return this.memoise(() => {
304
+ return this.regexAccept(String.raw `(?:[ \t]*)`, $$dpth + 1, $$cr);
305
+ }, this.$scope$_$memo);
306
+ }
307
+ match__($$dpth, $$cr) {
308
+ return this.memoise(() => {
309
+ return this.regexAccept(String.raw `(?:(?:[ \t]|(?:#[^\r\n]*)?[\r\n])*)`, $$dpth + 1, $$cr);
310
+ }, this.$scope$__$memo);
311
+ }
312
+ match___($$dpth, $$cr) {
313
+ return this.memoise(() => {
314
+ return this.run($$dpth, () => {
315
+ let $$res = null;
316
+ if (true
317
+ && this.match_($$dpth + 1, $$cr) !== null
318
+ && this.regexAccept(String.raw `(?:(?:#[^\r\n]*)?[\r\n])`, $$dpth + 1, $$cr) !== null
319
+ && this.match__($$dpth + 1, $$cr) !== null) {
320
+ $$res = { kind: ASTKinds.___, };
321
+ }
322
+ return $$res;
323
+ });
324
+ }, this.$scope$___$memo);
325
+ }
326
+ test() {
327
+ const mrk = this.mark();
328
+ const res = this.matchstart(0);
329
+ const ans = res !== null;
330
+ this.reset(mrk);
331
+ return ans;
332
+ }
333
+ parse() {
334
+ const mrk = this.mark();
335
+ const res = this.matchstart(0);
336
+ if (res)
337
+ return { ast: res, errs: [] };
338
+ this.reset(mrk);
339
+ const rec = new ErrorTracker();
340
+ this.clearMemos();
341
+ this.matchstart(0, rec);
342
+ const err = rec.getErr();
343
+ return { ast: res, errs: err !== null ? [err] : [] };
344
+ }
345
+ mark() {
346
+ return this.pos;
347
+ }
348
+ loop(func, star = false) {
349
+ const mrk = this.mark();
350
+ const res = [];
351
+ for (;;) {
352
+ const t = func();
353
+ if (t === null) {
354
+ break;
355
+ }
356
+ res.push(t);
357
+ }
358
+ if (star || res.length > 0) {
359
+ return res;
360
+ }
361
+ this.reset(mrk);
362
+ return null;
363
+ }
364
+ run($$dpth, fn) {
365
+ const mrk = this.mark();
366
+ const res = fn();
367
+ if (res !== null)
368
+ return res;
369
+ this.reset(mrk);
370
+ return null;
371
+ }
372
+ choice(fns) {
373
+ for (const f of fns) {
374
+ const res = f();
375
+ if (res !== null) {
376
+ return res;
377
+ }
378
+ }
379
+ return null;
380
+ }
381
+ regexAccept(match, dpth, cr) {
382
+ return this.run(dpth, () => {
383
+ const reg = new RegExp(match, "y");
384
+ const mrk = this.mark();
385
+ reg.lastIndex = mrk.overallPos;
386
+ const res = this.tryConsume(reg);
387
+ if (cr) {
388
+ cr.record(mrk, res, {
389
+ kind: "RegexMatch",
390
+ // We substring from 3 to len - 1 to strip off the
391
+ // non-capture group syntax added as a WebKit workaround
392
+ literal: match.substring(3, match.length - 1),
393
+ negated: this.negating,
394
+ });
395
+ }
396
+ return res;
397
+ });
398
+ }
399
+ tryConsume(reg) {
400
+ const res = reg.exec(this.input);
401
+ if (res) {
402
+ let lineJmp = 0;
403
+ let lind = -1;
404
+ for (let i = 0; i < res[0].length; ++i) {
405
+ if (res[0][i] === "\n") {
406
+ ++lineJmp;
407
+ lind = i;
408
+ }
409
+ }
410
+ this.pos = {
411
+ overallPos: reg.lastIndex,
412
+ line: this.pos.line + lineJmp,
413
+ offset: lind === -1 ? this.pos.offset + res[0].length : (res[0].length - lind - 1)
414
+ };
415
+ return res[0];
416
+ }
417
+ return null;
418
+ }
419
+ noConsume(fn) {
420
+ const mrk = this.mark();
421
+ const res = fn();
422
+ this.reset(mrk);
423
+ return res;
424
+ }
425
+ negate(fn) {
426
+ const mrk = this.mark();
427
+ const oneg = this.negating;
428
+ this.negating = !oneg;
429
+ const res = fn();
430
+ this.negating = oneg;
431
+ this.reset(mrk);
432
+ return res === null ? true : null;
433
+ }
434
+ memoise(rule, memo) {
435
+ const $scope$pos = this.mark();
436
+ const $scope$memoRes = memo.get($scope$pos.overallPos);
437
+ if (this.memoSafe && $scope$memoRes !== undefined) {
438
+ this.reset($scope$memoRes[1]);
439
+ return $scope$memoRes[0];
440
+ }
441
+ const $scope$result = rule();
442
+ if (this.memoSafe)
443
+ memo.set($scope$pos.overallPos, [$scope$result, this.mark()]);
444
+ return $scope$result;
445
+ }
446
+ }
447
+ exports.Parser = Parser;
448
+ function parse(s) {
449
+ const p = new Parser(s);
450
+ return p.parse();
451
+ }
452
+ exports.parse = parse;
453
+ class SyntaxErr {
454
+ constructor(pos, expmatches) {
455
+ this.pos = pos;
456
+ this.expmatches = [...expmatches];
457
+ }
458
+ toString() {
459
+ return `Syntax Error at line ${this.pos.line}:${this.pos.offset}. Expected one of ${this.expmatches.map(x => x.kind === "EOF" ? " EOF" : ` ${x.negated ? 'not ' : ''}'${x.literal}'`)}`;
460
+ }
461
+ }
462
+ exports.SyntaxErr = SyntaxErr;
463
+ class ErrorTracker {
464
+ constructor() {
465
+ this.mxpos = { overallPos: -1, line: -1, offset: -1 };
466
+ this.regexset = new Set();
467
+ this.pmatches = [];
468
+ }
469
+ record(pos, result, att) {
470
+ if ((result === null) === att.negated)
471
+ return;
472
+ if (pos.overallPos > this.mxpos.overallPos) {
473
+ this.mxpos = pos;
474
+ this.pmatches = [];
475
+ this.regexset.clear();
476
+ }
477
+ if (this.mxpos.overallPos === pos.overallPos) {
478
+ if (att.kind === "RegexMatch") {
479
+ if (!this.regexset.has(att.literal))
480
+ this.pmatches.push(att);
481
+ this.regexset.add(att.literal);
482
+ }
483
+ else {
484
+ this.pmatches.push(att);
485
+ }
486
+ }
487
+ }
488
+ getErr() {
489
+ if (this.mxpos.overallPos !== -1)
490
+ return new SyntaxErr(this.mxpos, this.pmatches);
491
+ return null;
492
+ }
493
+ }
494
+ //# sourceMappingURL=generated.js.map
@@ -0,0 +1,3 @@
1
+ import { CliAction, Syntax } from "../../command";
2
+ export declare const DropSyntax: Syntax<null | CliAction>;
3
+ //# sourceMappingURL=drop.d.ts.map
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DropSyntax = void 0;
4
+ const cli_help_shower_1 = require("@ot-builder/cli-help-shower");
5
+ const ot_builder_1 = require("ot-builder");
6
+ const argv_parser_1 = require("../../argv-parser");
7
+ exports.DropSyntax = {
8
+ handle: st => {
9
+ if (!st.isOption("--drop-otl", "--drop-math", "--drop-base", "--drop-hints"))
10
+ return (0, argv_parser_1.ParseResult)(st, null);
11
+ const opt = st.option;
12
+ return (0, argv_parser_1.ParseResult)(st.next(), async (state) => {
13
+ const entry = state.pop();
14
+ if (!entry)
15
+ throw new RangeError("Stack size invalid. No font to do handle.");
16
+ switch (opt) {
17
+ case "--drop-otl": {
18
+ entry.font.gsub = null;
19
+ entry.font.gpos = null;
20
+ entry.font.gdef = null;
21
+ break;
22
+ }
23
+ case "--drop-math": {
24
+ entry.font.math = null;
25
+ break;
26
+ }
27
+ case "--drop-base": {
28
+ entry.font.base = null;
29
+ break;
30
+ }
31
+ case "--drop-hints": {
32
+ if (ot_builder_1.Ot.Font.isTtf(entry.font)) {
33
+ entry.font.fpgm = null;
34
+ entry.font.prep = null;
35
+ entry.font.cvt = null;
36
+ entry.font.vdmx = null;
37
+ }
38
+ for (const g of entry.font.glyphs.decideOrder())
39
+ g.hints = null;
40
+ break;
41
+ }
42
+ }
43
+ state.push(entry);
44
+ });
45
+ },
46
+ displayHelp(shower) {
47
+ shower.message(cli_help_shower_1.Style.Option `--drop-otl`);
48
+ shower
49
+ .indent("")
50
+ .message("Drops OTL information of the font. Removes GSUB, GPOS and GDEF tables.");
51
+ shower.message(cli_help_shower_1.Style.Option `--drop-base`);
52
+ shower.indent("").message("Drops BASE table of the font.");
53
+ shower.message(cli_help_shower_1.Style.Option `--drop-math`);
54
+ shower.indent("").message("Drops MATH table of the font.");
55
+ shower.message(cli_help_shower_1.Style.Option `--drop-hints`);
56
+ shower.indent("").message("Drops hinting information of the font");
57
+ }
58
+ };
59
+ //# sourceMappingURL=drop.js.map
@@ -8,12 +8,13 @@ exports.RebaseSyntax = {
8
8
  handle: st => {
9
9
  if (!st.isOption("--rebase"))
10
10
  return (0, argv_parser_1.ParseResult)(st, null);
11
- const prArg = st.nextArgument();
12
- return (0, argv_parser_1.ParseResult)(prArg.progress.next(), async (state) => {
11
+ st = st.next();
12
+ const arg = st.expectArgument();
13
+ return (0, argv_parser_1.ParseResult)(st.next(), async (state) => {
13
14
  const entry = state.pop();
14
15
  if (!entry)
15
16
  throw new RangeError("Stack size invalid. No font to rebase.");
16
- const newUpm = parseFloat(prArg.result) || entry.font.head.unitsPerEm;
17
+ const newUpm = parseFloat(arg) || entry.font.head.unitsPerEm;
17
18
  console.log(`Rebase ${entry} to ${newUpm}`);
18
19
  ot_builder_1.CliProc.rebaseFont(entry.font, newUpm);
19
20
  state.push(entry);
@@ -9,13 +9,14 @@ exports.SaveHeadSyntax = {
9
9
  handle: st => {
10
10
  if (!st.isOption("+o", "++save"))
11
11
  return (0, argv_parser_1.ParseResult)(st, null);
12
- const prPath = st.nextArgument();
13
- return (0, argv_parser_1.ParseResult)(prPath.progress.next(), async (state) => {
12
+ st = st.next();
13
+ const path = st.expectArgument();
14
+ return (0, argv_parser_1.ParseResult)(st.next(), async (state) => {
14
15
  const entry = state.shift();
15
16
  if (!entry)
16
17
  throw new RangeError("Stack size invalid. No font to save.");
17
- console.log(`Save ${entry} -> ${prPath.result}`);
18
- await (0, save_1.saveFontToFile)(prPath.result, entry.font, (0, cli_shared_1.inferSaveCfg)(state, entry.font));
18
+ console.log(`Save ${entry} -> ${path}`);
19
+ await (0, save_1.saveFontToFile)(path, entry.font, (0, cli_shared_1.inferSaveCfg)(state, entry.font));
19
20
  });
20
21
  },
21
22
  displayHelp(shower) {
@@ -11,13 +11,14 @@ exports.SaveSyntax = {
11
11
  handle: st => {
12
12
  if (!st.isOption("-o", "--save"))
13
13
  return (0, argv_parser_1.ParseResult)(st, null);
14
- const prPath = st.nextArgument();
15
- return (0, argv_parser_1.ParseResult)(prPath.progress.next(), async (state) => {
14
+ st = st.next();
15
+ const path = st.expectArgument();
16
+ return (0, argv_parser_1.ParseResult)(st.next(), async (state) => {
16
17
  const entry = state.pop();
17
18
  if (!entry)
18
19
  throw new RangeError("Stack size invalid. No font to save.");
19
- console.log(`Save ${entry} -> ${prPath.result}`);
20
- await saveFontToFile(prPath.result, entry.font, (0, cli_shared_1.inferSaveCfg)(state, entry.font));
20
+ console.log(`Save ${entry} -> ${path}`);
21
+ await saveFontToFile(path, entry.font, (0, cli_shared_1.inferSaveCfg)(state, entry.font));
21
22
  });
22
23
  },
23
24
  displayHelp(shower) {
@@ -1,21 +1,45 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SubsetSyntax = void 0;
4
+ const Fs = require("fs");
4
5
  const cli_help_shower_1 = require("@ot-builder/cli-help-shower");
5
6
  const ot_builder_1 = require("ot-builder");
6
7
  const argv_parser_1 = require("../../argv-parser");
8
+ const ParseUnicodeRanges = require("../../sub-parsers/unicode-ranges/generated");
7
9
  exports.SubsetSyntax = {
8
10
  handle: st => {
9
11
  if (!st.isOption("--subset"))
10
12
  return (0, argv_parser_1.ParseResult)(st, null);
11
- const prArg = st.nextArgument();
12
- return (0, argv_parser_1.ParseResult)(prArg.progress.next(), async (state) => {
13
+ st = st.next();
14
+ let parser, argument;
15
+ if (st.isOption("--file", "--unicodes", "--unicodes-file")) {
16
+ switch (st.option) {
17
+ case "--file":
18
+ parser = new FileParser(new PlainTextParser());
19
+ break;
20
+ case "--unicodes":
21
+ parser = new UnicodeRangesParser();
22
+ break;
23
+ case "--unicodes-file":
24
+ parser = new FileParser(new UnicodeRangesParser());
25
+ break;
26
+ default:
27
+ throw new Error("Unreachable");
28
+ }
29
+ st = st.next();
30
+ argument = st.expectArgument();
31
+ }
32
+ else {
33
+ parser = new PlainTextParser();
34
+ argument = st.expectArgument();
35
+ }
36
+ return (0, argv_parser_1.ParseResult)(st.next(), async (state) => {
13
37
  const entry = state.pop();
14
38
  if (!entry)
15
39
  throw new RangeError("Stack size invalid. No font to subset.");
16
40
  console.log(`Subset ${entry}`);
17
41
  const gcBefore = entry.font.glyphs.decideOrder().length;
18
- ot_builder_1.CliProc.subsetFont(entry.font, prArg.result, ot_builder_1.Ot.ListGlyphStoreFactory);
42
+ ot_builder_1.CliProc.subsetFont(entry.font, await parser.parse(argument), ot_builder_1.Ot.ListGlyphStoreFactory);
19
43
  const gcAfter = entry.font.glyphs.decideOrder().length;
20
44
  state.push(entry);
21
45
  console.log(` Glyphs: ${gcAfter} / ${gcBefore}`);
@@ -23,7 +47,56 @@ exports.SubsetSyntax = {
23
47
  },
24
48
  displayHelp(shower) {
25
49
  shower.message(cli_help_shower_1.Style.Option `--subset`, cli_help_shower_1.Style.Param `text`);
26
- shower.indent("").message("Subset the font at the stack top according to the text given.");
50
+ shower
51
+ .indent("")
52
+ .message(cli_help_shower_1.Style.Option `--subset`, cli_help_shower_1.Style.Option `--file`, cli_help_shower_1.Style.Param `path`)
53
+ .message(cli_help_shower_1.Style.Option `--subset`, cli_help_shower_1.Style.Option `--unicodes`, cli_help_shower_1.Style.Param `codes`)
54
+ .message(cli_help_shower_1.Style.Option `--subset`, cli_help_shower_1.Style.Option `--unicodes-file`, cli_help_shower_1.Style.Param `path`);
55
+ shower
56
+ .indent("")
57
+ .message("Subset the font at the stack top according to the text or unicode ranges given.")
58
+ .message(...["Option", cli_help_shower_1.Style.Option `--unicodes`, "is specified by a comma/semicolon"], ...["separated list of hex values or ranges (using", cli_help_shower_1.Style.Arg `..`, "operator),"], ...["optionally prefixed with", cli_help_shower_1.Style.Arg `U+`, "or", cli_help_shower_1.Style.Arg `0x`, "."], ...["Prefixing a range with operator", cli_help_shower_1.Style.Arg `-`, "indicates exclusion, and"], ...["will exclude the specified range from the character set to be kept."], ...["For example, the following parameter:"]);
59
+ shower
60
+ .indent(" ")
61
+ .message(cli_help_shower_1.Style.Option `--unicodes`, cli_help_shower_1.Style.Arg `'00..7F,-30..39,2000..206F'`);
62
+ shower
63
+ .indent("")
64
+ .message("Will subset the font with Basic ASCII and General Punctuation block,", "but without number digits.");
27
65
  }
28
66
  };
67
+ class PlainTextParser {
68
+ async parse(argument) {
69
+ return argument;
70
+ }
71
+ }
72
+ class UnicodeRangesParser {
73
+ async parse(argument) {
74
+ const setChars = new Set();
75
+ const pr = ParseUnicodeRanges.parse(argument);
76
+ if (pr.errs.length || !pr.ast)
77
+ throw new Error("Unable to parse unicode ranges: " + pr.errs[0].toString());
78
+ for (const rg of pr.ast.ranges) {
79
+ if (rg.isExclusion) {
80
+ for (let ch = rg.start; ch <= rg.end; ch++) {
81
+ setChars.delete(String.fromCodePoint(ch));
82
+ }
83
+ }
84
+ else {
85
+ for (let ch = rg.start; ch <= rg.end; ch++) {
86
+ setChars.add(String.fromCodePoint(ch));
87
+ }
88
+ }
89
+ }
90
+ return setChars;
91
+ }
92
+ }
93
+ class FileParser {
94
+ constructor(subParser) {
95
+ this.subParser = subParser;
96
+ }
97
+ async parse(path) {
98
+ const body = await Fs.promises.readFile(path, "utf-8");
99
+ return this.subParser.parse(body);
100
+ }
101
+ }
29
102
  //# sourceMappingURL=subset.js.map
@@ -0,0 +1,3 @@
1
+ import { CliAction, Syntax } from "../../command";
2
+ export declare const TransformGlyphsSyntax: Syntax<null | CliAction>;
3
+ //# sourceMappingURL=transform-glyphs.d.ts.map
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TransformGlyphsSyntax = void 0;
4
+ const cli_help_shower_1 = require("@ot-builder/cli-help-shower");
5
+ const ot_builder_1 = require("ot-builder");
6
+ const argv_parser_1 = require("../../argv-parser");
7
+ exports.TransformGlyphsSyntax = {
8
+ handle: st => {
9
+ if (!st.isOption("--transform-glyphs"))
10
+ return (0, argv_parser_1.ParseResult)(st, null);
11
+ st = st.next();
12
+ const prArg = st.expectArgument();
13
+ const tfmArgs = prArg.split(",");
14
+ const transform = {
15
+ xx: parseFloat(tfmArgs[0].trim()),
16
+ yx: parseFloat(tfmArgs[1].trim()),
17
+ xy: parseFloat(tfmArgs[2].trim()),
18
+ yy: parseFloat(tfmArgs[3].trim()),
19
+ dx: parseFloat(tfmArgs[4].trim()),
20
+ dy: parseFloat(tfmArgs[5].trim())
21
+ };
22
+ return (0, argv_parser_1.ParseResult)(st.next(), async (state) => {
23
+ const entry = state.pop();
24
+ if (!entry)
25
+ throw new RangeError("Stack size invalid. No font to do GC.");
26
+ ot_builder_1.CliProc.inPlaceTransformFontGlyph(entry.font, transform);
27
+ state.push(entry);
28
+ });
29
+ },
30
+ displayHelp(shower) {
31
+ shower.message(cli_help_shower_1.Style.Option `--transform-glyphs`, cli_help_shower_1.Style.Param `xx,yx,xy,yy,dx,dy`);
32
+ shower
33
+ .indent("")
34
+ .message("Perform a 2x3 affine transform to all glyphs' geometries in the font.", "Composite fonts will be flattened.");
35
+ }
36
+ };
37
+ //# sourceMappingURL=transform-glyphs.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ot-builder-cli",
3
- "version": "1.3.3",
3
+ "version": "1.5.1",
4
4
  "bin": {
5
5
  "otb-cli": "./bin/otb-cli"
6
6
  },
@@ -28,12 +28,12 @@
28
28
  "dependencies": {
29
29
  "tslib": "^2.0.0",
30
30
  "chalk": "^4.1.1",
31
- "ot-builder": "1.3.3",
32
- "@ot-builder/cli-help-shower": "1.3.3",
33
- "@ot-builder/cli-shared": "1.3.3"
31
+ "ot-builder": "1.5.1",
32
+ "@ot-builder/cli-help-shower": "1.5.1",
33
+ "@ot-builder/cli-shared": "1.5.1"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/jest": "^26.0.23",
37
- "jest": "^27.0.6"
37
+ "jest": "^27.5.1"
38
38
  }
39
39
  }