2013-05-16 05:57:27 +09:00
|
|
|
/* Copyright 2012 Mozilla Foundation
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2017-12-13 22:51:45 +09:00
|
|
|
import {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
bytesToString,
|
|
|
|
FONT_IDENTITY_MATRIX,
|
|
|
|
FormatError,
|
|
|
|
unreachable,
|
|
|
|
warn,
|
2020-01-02 20:00:16 +09:00
|
|
|
} from "../shared/util.js";
|
|
|
|
import { CFFParser } from "./cff_parser.js";
|
|
|
|
import { getGlyphsUnicode } from "./glyphlist.js";
|
|
|
|
import { StandardEncoding } from "./encodings.js";
|
|
|
|
import { Stream } from "./stream.js";
|
2013-05-16 05:57:27 +09:00
|
|
|
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const FontRendererFactory = (function FontRendererFactoryClosure() {
|
2013-05-16 05:57:27 +09:00
|
|
|
function getLong(data, offset) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
return (
|
|
|
|
(data[offset] << 24) |
|
|
|
|
(data[offset + 1] << 16) |
|
|
|
|
(data[offset + 2] << 8) |
|
|
|
|
data[offset + 3]
|
|
|
|
);
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
function getUshort(data, offset) {
|
|
|
|
return (data[offset] << 8) | data[offset + 1];
|
|
|
|
}
|
|
|
|
|
2020-01-14 23:28:37 +09:00
|
|
|
function getSubroutineBias(subrs) {
|
|
|
|
const numSubrs = subrs.length;
|
|
|
|
let bias = 32768;
|
|
|
|
if (numSubrs < 1240) {
|
|
|
|
bias = 107;
|
|
|
|
} else if (numSubrs < 33900) {
|
|
|
|
bias = 1131;
|
|
|
|
}
|
|
|
|
return bias;
|
|
|
|
}
|
|
|
|
|
2013-05-16 05:57:27 +09:00
|
|
|
function parseCmap(data, start, end) {
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const offset =
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
getUshort(data, start + 2) === 1
|
|
|
|
? getLong(data, start + 8)
|
|
|
|
: getLong(data, start + 16);
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const format = getUshort(data, start + offset);
|
|
|
|
let ranges, p, i;
|
2013-05-16 05:57:27 +09:00
|
|
|
if (format === 4) {
|
2017-01-19 22:00:36 +09:00
|
|
|
getUshort(data, start + offset + 2); // length
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const segCount = getUshort(data, start + offset + 6) >> 1;
|
2014-04-08 06:42:54 +09:00
|
|
|
p = start + offset + 14;
|
|
|
|
ranges = [];
|
|
|
|
for (i = 0; i < segCount; i++, p += 2) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
ranges[i] = { end: getUshort(data, p) };
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
|
|
|
p += 2;
|
2014-04-08 06:42:54 +09:00
|
|
|
for (i = 0; i < segCount; i++, p += 2) {
|
2013-05-16 05:57:27 +09:00
|
|
|
ranges[i].start = getUshort(data, p);
|
|
|
|
}
|
2014-04-08 06:42:54 +09:00
|
|
|
for (i = 0; i < segCount; i++, p += 2) {
|
2013-05-16 05:57:27 +09:00
|
|
|
ranges[i].idDelta = getUshort(data, p);
|
|
|
|
}
|
2014-04-08 06:42:54 +09:00
|
|
|
for (i = 0; i < segCount; i++, p += 2) {
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
let idOffset = getUshort(data, p);
|
2013-05-16 05:57:27 +09:00
|
|
|
if (idOffset === 0) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
ranges[i].ids = [];
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
|
2013-05-16 05:57:27 +09:00
|
|
|
ranges[i].ids[j] = getUshort(data, p + idOffset);
|
|
|
|
idOffset += 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ranges;
|
|
|
|
} else if (format === 12) {
|
2017-01-19 22:00:36 +09:00
|
|
|
getLong(data, start + offset + 4); // length
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const groups = getLong(data, start + offset + 12);
|
2014-04-08 06:42:54 +09:00
|
|
|
p = start + offset + 16;
|
|
|
|
ranges = [];
|
|
|
|
for (i = 0; i < groups; i++) {
|
2013-05-16 05:57:27 +09:00
|
|
|
ranges.push({
|
|
|
|
start: getLong(data, p),
|
|
|
|
end: getLong(data, p + 4),
|
Fix inconsistent spacing and trailing commas in objects in `src/core/` files, so we can enable the `comma-dangle` and `object-curly-spacing` ESLint rules later on
*Unfortunately this patch is fairly big, even though it only covers the `src/core` folder, but splitting it even further seemed difficult.*
http://eslint.org/docs/rules/comma-dangle
http://eslint.org/docs/rules/object-curly-spacing
Given that we currently have quite inconsistent object formatting, fixing this in *one* big patch probably wouldn't be feasible (since I cannot imagine anyone wanting to review that); hence I've opted to try and do this piecewise instead.
Please note: This patch was created automatically, using the ESLint --fix command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch.
```diff
diff --git a/src/core/evaluator.js b/src/core/evaluator.js
index abab9027..dcd3594b 100644
--- a/src/core/evaluator.js
+++ b/src/core/evaluator.js
@@ -2785,7 +2785,8 @@ var EvaluatorPreprocessor = (function EvaluatorPreprocessorClosure() {
t['Tz'] = { id: OPS.setHScale, numArgs: 1, variableArgs: false, };
t['TL'] = { id: OPS.setLeading, numArgs: 1, variableArgs: false, };
t['Tf'] = { id: OPS.setFont, numArgs: 2, variableArgs: false, };
- t['Tr'] = { id: OPS.setTextRenderingMode, numArgs: 1, variableArgs: false, };
+ t['Tr'] = { id: OPS.setTextRenderingMode, numArgs: 1,
+ variableArgs: false, };
t['Ts'] = { id: OPS.setTextRise, numArgs: 1, variableArgs: false, };
t['Td'] = { id: OPS.moveText, numArgs: 2, variableArgs: false, };
t['TD'] = { id: OPS.setLeadingMoveText, numArgs: 2, variableArgs: false, };
diff --git a/src/core/jbig2.js b/src/core/jbig2.js
index 5a17d482..71671541 100644
--- a/src/core/jbig2.js
+++ b/src/core/jbig2.js
@@ -123,19 +123,22 @@ var Jbig2Image = (function Jbig2ImageClosure() {
{ x: -1, y: -1, }, { x: 0, y: -1, }, { x: 1, y: -1, }, { x: -2, y: 0, },
{ x: -1, y: 0, }],
[{ x: -3, y: -1, }, { x: -2, y: -1, }, { x: -1, y: -1, }, { x: 0, y: -1, },
- { x: 1, y: -1, }, { x: -4, y: 0, }, { x: -3, y: 0, }, { x: -2, y: 0, }, { x: -1, y: 0, }]
+ { x: 1, y: -1, }, { x: -4, y: 0, }, { x: -3, y: 0, }, { x: -2, y: 0, },
+ { x: -1, y: 0, }]
];
var RefinementTemplates = [
{
coding: [{ x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, }],
- reference: [{ x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, }, { x: 0, y: 0, },
- { x: 1, y: 0, }, { x: -1, y: 1, }, { x: 0, y: 1, }, { x: 1, y: 1, }],
+ reference: [{ x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, },
+ { x: 0, y: 0, }, { x: 1, y: 0, }, { x: -1, y: 1, },
+ { x: 0, y: 1, }, { x: 1, y: 1, }],
},
{
- coding: [{ x: -1, y: -1, }, { x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, }],
- reference: [{ x: 0, y: -1, }, { x: -1, y: 0, }, { x: 0, y: 0, }, { x: 1, y: 0, },
- { x: 0, y: 1, }, { x: 1, y: 1, }],
+ coding: [{ x: -1, y: -1, }, { x: 0, y: -1, }, { x: 1, y: -1, },
+ { x: -1, y: 0, }],
+ reference: [{ x: 0, y: -1, }, { x: -1, y: 0, }, { x: 0, y: 0, },
+ { x: 1, y: 0, }, { x: 0, y: 1, }, { x: 1, y: 1, }],
}
];
```
2017-06-02 18:16:24 +09:00
|
|
|
idDelta: getLong(data, p + 8) - getLong(data, p),
|
2013-05-16 05:57:27 +09:00
|
|
|
});
|
|
|
|
p += 12;
|
|
|
|
}
|
|
|
|
return ranges;
|
|
|
|
}
|
2017-06-29 05:51:31 +09:00
|
|
|
throw new FormatError(`unsupported cmap: ${format}`);
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
|
|
|
|
2016-04-01 02:53:07 +09:00
|
|
|
function parseCff(data, start, end, seacAnalysisEnabled) {
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const properties = {};
|
|
|
|
const parser = new CFFParser(
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
new Stream(data, start, end - start),
|
|
|
|
properties,
|
|
|
|
seacAnalysisEnabled
|
|
|
|
);
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const cff = parser.parse();
|
2013-05-16 05:57:27 +09:00
|
|
|
return {
|
|
|
|
glyphs: cff.charStrings.objects,
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
subrs:
|
|
|
|
cff.topDict.privateDict &&
|
|
|
|
cff.topDict.privateDict.subrsIndex &&
|
|
|
|
cff.topDict.privateDict.subrsIndex.objects,
|
Fix inconsistent spacing and trailing commas in objects in `src/core/` files, so we can enable the `comma-dangle` and `object-curly-spacing` ESLint rules later on
*Unfortunately this patch is fairly big, even though it only covers the `src/core` folder, but splitting it even further seemed difficult.*
http://eslint.org/docs/rules/comma-dangle
http://eslint.org/docs/rules/object-curly-spacing
Given that we currently have quite inconsistent object formatting, fixing this in *one* big patch probably wouldn't be feasible (since I cannot imagine anyone wanting to review that); hence I've opted to try and do this piecewise instead.
Please note: This patch was created automatically, using the ESLint --fix command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch.
```diff
diff --git a/src/core/evaluator.js b/src/core/evaluator.js
index abab9027..dcd3594b 100644
--- a/src/core/evaluator.js
+++ b/src/core/evaluator.js
@@ -2785,7 +2785,8 @@ var EvaluatorPreprocessor = (function EvaluatorPreprocessorClosure() {
t['Tz'] = { id: OPS.setHScale, numArgs: 1, variableArgs: false, };
t['TL'] = { id: OPS.setLeading, numArgs: 1, variableArgs: false, };
t['Tf'] = { id: OPS.setFont, numArgs: 2, variableArgs: false, };
- t['Tr'] = { id: OPS.setTextRenderingMode, numArgs: 1, variableArgs: false, };
+ t['Tr'] = { id: OPS.setTextRenderingMode, numArgs: 1,
+ variableArgs: false, };
t['Ts'] = { id: OPS.setTextRise, numArgs: 1, variableArgs: false, };
t['Td'] = { id: OPS.moveText, numArgs: 2, variableArgs: false, };
t['TD'] = { id: OPS.setLeadingMoveText, numArgs: 2, variableArgs: false, };
diff --git a/src/core/jbig2.js b/src/core/jbig2.js
index 5a17d482..71671541 100644
--- a/src/core/jbig2.js
+++ b/src/core/jbig2.js
@@ -123,19 +123,22 @@ var Jbig2Image = (function Jbig2ImageClosure() {
{ x: -1, y: -1, }, { x: 0, y: -1, }, { x: 1, y: -1, }, { x: -2, y: 0, },
{ x: -1, y: 0, }],
[{ x: -3, y: -1, }, { x: -2, y: -1, }, { x: -1, y: -1, }, { x: 0, y: -1, },
- { x: 1, y: -1, }, { x: -4, y: 0, }, { x: -3, y: 0, }, { x: -2, y: 0, }, { x: -1, y: 0, }]
+ { x: 1, y: -1, }, { x: -4, y: 0, }, { x: -3, y: 0, }, { x: -2, y: 0, },
+ { x: -1, y: 0, }]
];
var RefinementTemplates = [
{
coding: [{ x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, }],
- reference: [{ x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, }, { x: 0, y: 0, },
- { x: 1, y: 0, }, { x: -1, y: 1, }, { x: 0, y: 1, }, { x: 1, y: 1, }],
+ reference: [{ x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, },
+ { x: 0, y: 0, }, { x: 1, y: 0, }, { x: -1, y: 1, },
+ { x: 0, y: 1, }, { x: 1, y: 1, }],
},
{
- coding: [{ x: -1, y: -1, }, { x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, }],
- reference: [{ x: 0, y: -1, }, { x: -1, y: 0, }, { x: 0, y: 0, }, { x: 1, y: 0, },
- { x: 0, y: 1, }, { x: 1, y: 1, }],
+ coding: [{ x: -1, y: -1, }, { x: 0, y: -1, }, { x: 1, y: -1, },
+ { x: -1, y: 0, }],
+ reference: [{ x: 0, y: -1, }, { x: -1, y: 0, }, { x: 0, y: 0, },
+ { x: 1, y: 0, }, { x: 0, y: 1, }, { x: 1, y: 1, }],
}
];
```
2017-06-02 18:16:24 +09:00
|
|
|
gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
|
2018-04-10 22:44:42 +09:00
|
|
|
isCFFCIDFont: cff.isCIDFont,
|
|
|
|
fdSelect: cff.fdSelect,
|
|
|
|
fdArray: cff.fdArray,
|
2013-05-16 05:57:27 +09:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
let itemSize, itemDecode;
|
2013-05-16 05:57:27 +09:00
|
|
|
if (isGlyphLocationsLong) {
|
|
|
|
itemSize = 4;
|
|
|
|
itemDecode = function fontItemDecodeLong(data, offset) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
return (
|
|
|
|
(data[offset] << 24) |
|
|
|
|
(data[offset + 1] << 16) |
|
|
|
|
(data[offset + 2] << 8) |
|
|
|
|
data[offset + 3]
|
|
|
|
);
|
2013-05-16 05:57:27 +09:00
|
|
|
};
|
|
|
|
} else {
|
|
|
|
itemSize = 2;
|
|
|
|
itemDecode = function fontItemDecode(data, offset) {
|
|
|
|
return (data[offset] << 9) | (data[offset + 1] << 1);
|
|
|
|
};
|
|
|
|
}
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const glyphs = [];
|
|
|
|
let startOffset = itemDecode(loca, 0);
|
|
|
|
for (let j = itemSize; j < loca.length; j += itemSize) {
|
|
|
|
const endOffset = itemDecode(loca, j);
|
2013-05-16 05:57:27 +09:00
|
|
|
glyphs.push(glyf.subarray(startOffset, endOffset));
|
|
|
|
startOffset = endOffset;
|
|
|
|
}
|
|
|
|
return glyphs;
|
|
|
|
}
|
|
|
|
|
|
|
|
function lookupCmap(ranges, unicode) {
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const code = unicode.codePointAt(0);
|
|
|
|
let gid = 0,
|
|
|
|
l = 0,
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
r = ranges.length - 1;
|
2013-05-16 05:57:27 +09:00
|
|
|
while (l < r) {
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const c = (l + r + 1) >> 1;
|
2013-05-16 05:57:27 +09:00
|
|
|
if (code < ranges[c].start) {
|
|
|
|
r = c - 1;
|
|
|
|
} else {
|
|
|
|
l = c;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ranges[l].start <= code && code <= ranges[l].end) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
gid =
|
|
|
|
(ranges[l].idDelta +
|
|
|
|
(ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code)) &
|
|
|
|
0xffff;
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
2016-03-23 21:52:30 +09:00
|
|
|
return {
|
|
|
|
charCode: code,
|
|
|
|
glyphId: gid,
|
|
|
|
};
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
|
|
|
|
2015-06-25 05:29:36 +09:00
|
|
|
function compileGlyf(code, cmds, font) {
|
2013-05-16 05:57:27 +09:00
|
|
|
function moveTo(x, y) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
cmds.push({ cmd: "moveTo", args: [x, y] });
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
|
|
|
function lineTo(x, y) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
cmds.push({ cmd: "lineTo", args: [x, y] });
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
|
|
|
function quadraticCurveTo(xa, ya, x, y) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
cmds.push({ cmd: "quadraticCurveTo", args: [xa, ya, x, y] });
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
|
|
|
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
let i = 0;
|
|
|
|
const numberOfContours = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
|
|
|
|
let flags;
|
|
|
|
let x = 0,
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
y = 0;
|
2013-05-16 05:57:27 +09:00
|
|
|
i += 10;
|
|
|
|
if (numberOfContours < 0) {
|
|
|
|
// composite glyph
|
|
|
|
do {
|
2014-04-08 06:42:54 +09:00
|
|
|
flags = (code[i] << 8) | code[i + 1];
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
|
2013-05-16 05:57:27 +09:00
|
|
|
i += 4;
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
let arg1, arg2;
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
if (flags & 0x01) {
|
2013-05-16 05:57:27 +09:00
|
|
|
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
|
|
|
|
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
|
|
|
|
i += 4;
|
|
|
|
} else {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
arg1 = code[i++];
|
|
|
|
arg2 = code[i++];
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
if (flags & 0x02) {
|
|
|
|
x = arg1;
|
|
|
|
y = arg2;
|
2013-05-16 05:57:27 +09:00
|
|
|
} else {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
x = 0;
|
|
|
|
y = 0; // TODO "they are points" ?
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
let scaleX = 1,
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
scaleY = 1,
|
|
|
|
scale01 = 0,
|
|
|
|
scale10 = 0;
|
|
|
|
if (flags & 0x08) {
|
|
|
|
scaleX = scaleY =
|
|
|
|
((code[i] << 24) | (code[i + 1] << 16)) / 1073741824;
|
2013-05-16 05:57:27 +09:00
|
|
|
i += 2;
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
} else if (flags & 0x40) {
|
2013-05-16 05:57:27 +09:00
|
|
|
scaleX = ((code[i] << 24) | (code[i + 1] << 16)) / 1073741824;
|
|
|
|
scaleY = ((code[i + 2] << 24) | (code[i + 3] << 16)) / 1073741824;
|
|
|
|
i += 4;
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
} else if (flags & 0x80) {
|
2013-05-16 05:57:27 +09:00
|
|
|
scaleX = ((code[i] << 24) | (code[i + 1] << 16)) / 1073741824;
|
|
|
|
scale01 = ((code[i + 2] << 24) | (code[i + 3] << 16)) / 1073741824;
|
|
|
|
scale10 = ((code[i + 4] << 24) | (code[i + 5] << 16)) / 1073741824;
|
|
|
|
scaleY = ((code[i + 6] << 24) | (code[i + 7] << 16)) / 1073741824;
|
|
|
|
i += 8;
|
|
|
|
}
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const subglyph = font.glyphs[glyphIndex];
|
2013-05-16 05:57:27 +09:00
|
|
|
if (subglyph) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
cmds.push({ cmd: "save" });
|
|
|
|
cmds.push({
|
|
|
|
cmd: "transform",
|
|
|
|
args: [scaleX, scale01, scale10, scaleY, x, y],
|
|
|
|
});
|
2015-06-25 05:29:36 +09:00
|
|
|
compileGlyf(subglyph, cmds, font);
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
cmds.push({ cmd: "restore" });
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
} while (flags & 0x20);
|
2013-05-16 05:57:27 +09:00
|
|
|
} else {
|
|
|
|
// simple glyph
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const endPtsOfContours = [];
|
|
|
|
let j, jj;
|
2014-04-08 06:42:54 +09:00
|
|
|
for (j = 0; j < numberOfContours; j++) {
|
2013-05-16 05:57:27 +09:00
|
|
|
endPtsOfContours.push((code[i] << 8) | code[i + 1]);
|
|
|
|
i += 2;
|
|
|
|
}
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const instructionLength = (code[i] << 8) | code[i + 1];
|
2013-05-16 05:57:27 +09:00
|
|
|
i += 2 + instructionLength; // skipping the instructions
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
|
|
|
|
const points = [];
|
2013-05-16 05:57:27 +09:00
|
|
|
while (points.length < numberOfPoints) {
|
2014-04-08 06:42:54 +09:00
|
|
|
flags = code[i++];
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
let repeat = 1;
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
if (flags & 0x08) {
|
2013-05-16 05:57:27 +09:00
|
|
|
repeat += code[i++];
|
|
|
|
}
|
|
|
|
while (repeat-- > 0) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
points.push({ flags });
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
|
|
|
}
|
2014-04-08 06:42:54 +09:00
|
|
|
for (j = 0; j < numberOfPoints; j++) {
|
2013-05-16 05:57:27 +09:00
|
|
|
switch (points[j].flags & 0x12) {
|
|
|
|
case 0x00:
|
|
|
|
x += ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
|
|
|
|
i += 2;
|
|
|
|
break;
|
|
|
|
case 0x02:
|
|
|
|
x -= code[i++];
|
|
|
|
break;
|
|
|
|
case 0x12:
|
|
|
|
x += code[i++];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
points[j].x = x;
|
|
|
|
}
|
2014-04-08 06:42:54 +09:00
|
|
|
for (j = 0; j < numberOfPoints; j++) {
|
2013-05-16 05:57:27 +09:00
|
|
|
switch (points[j].flags & 0x24) {
|
|
|
|
case 0x00:
|
|
|
|
y += ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
|
|
|
|
i += 2;
|
|
|
|
break;
|
|
|
|
case 0x04:
|
|
|
|
y -= code[i++];
|
|
|
|
break;
|
|
|
|
case 0x24:
|
|
|
|
y += code[i++];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
points[j].y = y;
|
|
|
|
}
|
|
|
|
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
let startPoint = 0;
|
2014-04-08 06:42:54 +09:00
|
|
|
for (i = 0; i < numberOfContours; i++) {
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const endPoint = endPtsOfContours[i];
|
2013-05-16 05:57:27 +09:00
|
|
|
// contours might have implicit points, which is located in the middle
|
|
|
|
// between two neighboring off-curve points
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const contour = points.slice(startPoint, endPoint + 1);
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
if (contour[0].flags & 1) {
|
2013-05-16 05:57:27 +09:00
|
|
|
contour.push(contour[0]); // using start point at the contour end
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
} else if (contour[contour.length - 1].flags & 1) {
|
2013-05-16 05:57:27 +09:00
|
|
|
// first is off-curve point, trying to use one from the end
|
|
|
|
contour.unshift(contour[contour.length - 1]);
|
|
|
|
} else {
|
|
|
|
// start and end are off-curve points, creating implicit one
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const p = {
|
2013-05-16 05:57:27 +09:00
|
|
|
flags: 1,
|
|
|
|
x: (contour[0].x + contour[contour.length - 1].x) / 2,
|
Fix inconsistent spacing and trailing commas in objects in `src/core/` files, so we can enable the `comma-dangle` and `object-curly-spacing` ESLint rules later on
*Unfortunately this patch is fairly big, even though it only covers the `src/core` folder, but splitting it even further seemed difficult.*
http://eslint.org/docs/rules/comma-dangle
http://eslint.org/docs/rules/object-curly-spacing
Given that we currently have quite inconsistent object formatting, fixing this in *one* big patch probably wouldn't be feasible (since I cannot imagine anyone wanting to review that); hence I've opted to try and do this piecewise instead.
Please note: This patch was created automatically, using the ESLint --fix command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch.
```diff
diff --git a/src/core/evaluator.js b/src/core/evaluator.js
index abab9027..dcd3594b 100644
--- a/src/core/evaluator.js
+++ b/src/core/evaluator.js
@@ -2785,7 +2785,8 @@ var EvaluatorPreprocessor = (function EvaluatorPreprocessorClosure() {
t['Tz'] = { id: OPS.setHScale, numArgs: 1, variableArgs: false, };
t['TL'] = { id: OPS.setLeading, numArgs: 1, variableArgs: false, };
t['Tf'] = { id: OPS.setFont, numArgs: 2, variableArgs: false, };
- t['Tr'] = { id: OPS.setTextRenderingMode, numArgs: 1, variableArgs: false, };
+ t['Tr'] = { id: OPS.setTextRenderingMode, numArgs: 1,
+ variableArgs: false, };
t['Ts'] = { id: OPS.setTextRise, numArgs: 1, variableArgs: false, };
t['Td'] = { id: OPS.moveText, numArgs: 2, variableArgs: false, };
t['TD'] = { id: OPS.setLeadingMoveText, numArgs: 2, variableArgs: false, };
diff --git a/src/core/jbig2.js b/src/core/jbig2.js
index 5a17d482..71671541 100644
--- a/src/core/jbig2.js
+++ b/src/core/jbig2.js
@@ -123,19 +123,22 @@ var Jbig2Image = (function Jbig2ImageClosure() {
{ x: -1, y: -1, }, { x: 0, y: -1, }, { x: 1, y: -1, }, { x: -2, y: 0, },
{ x: -1, y: 0, }],
[{ x: -3, y: -1, }, { x: -2, y: -1, }, { x: -1, y: -1, }, { x: 0, y: -1, },
- { x: 1, y: -1, }, { x: -4, y: 0, }, { x: -3, y: 0, }, { x: -2, y: 0, }, { x: -1, y: 0, }]
+ { x: 1, y: -1, }, { x: -4, y: 0, }, { x: -3, y: 0, }, { x: -2, y: 0, },
+ { x: -1, y: 0, }]
];
var RefinementTemplates = [
{
coding: [{ x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, }],
- reference: [{ x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, }, { x: 0, y: 0, },
- { x: 1, y: 0, }, { x: -1, y: 1, }, { x: 0, y: 1, }, { x: 1, y: 1, }],
+ reference: [{ x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, },
+ { x: 0, y: 0, }, { x: 1, y: 0, }, { x: -1, y: 1, },
+ { x: 0, y: 1, }, { x: 1, y: 1, }],
},
{
- coding: [{ x: -1, y: -1, }, { x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, }],
- reference: [{ x: 0, y: -1, }, { x: -1, y: 0, }, { x: 0, y: 0, }, { x: 1, y: 0, },
- { x: 0, y: 1, }, { x: 1, y: 1, }],
+ coding: [{ x: -1, y: -1, }, { x: 0, y: -1, }, { x: 1, y: -1, },
+ { x: -1, y: 0, }],
+ reference: [{ x: 0, y: -1, }, { x: -1, y: 0, }, { x: 0, y: 0, },
+ { x: 1, y: 0, }, { x: 0, y: 1, }, { x: 1, y: 1, }],
}
];
```
2017-06-02 18:16:24 +09:00
|
|
|
y: (contour[0].y + contour[contour.length - 1].y) / 2,
|
2013-05-16 05:57:27 +09:00
|
|
|
};
|
|
|
|
contour.unshift(p);
|
|
|
|
contour.push(p);
|
|
|
|
}
|
|
|
|
moveTo(contour[0].x, contour[0].y);
|
2014-04-08 06:42:54 +09:00
|
|
|
for (j = 1, jj = contour.length; j < jj; j++) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
if (contour[j].flags & 1) {
|
2013-05-16 05:57:27 +09:00
|
|
|
lineTo(contour[j].x, contour[j].y);
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
} else if (contour[j + 1].flags & 1) {
|
|
|
|
quadraticCurveTo(
|
|
|
|
contour[j].x,
|
|
|
|
contour[j].y,
|
|
|
|
contour[j + 1].x,
|
|
|
|
contour[j + 1].y
|
|
|
|
);
|
2013-05-16 05:57:27 +09:00
|
|
|
j++;
|
|
|
|
} else {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
quadraticCurveTo(
|
|
|
|
contour[j].x,
|
|
|
|
contour[j].y,
|
2013-05-16 05:57:27 +09:00
|
|
|
(contour[j].x + contour[j + 1].x) / 2,
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
(contour[j].y + contour[j + 1].y) / 2
|
|
|
|
);
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
startPoint = endPoint + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-24 01:04:47 +09:00
|
|
|
function compileCharString(charStringCode, cmds, font, glyphId) {
|
2013-05-16 05:57:27 +09:00
|
|
|
function moveTo(x, y) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
cmds.push({ cmd: "moveTo", args: [x, y] });
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
|
|
|
function lineTo(x, y) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
cmds.push({ cmd: "lineTo", args: [x, y] });
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
|
|
|
function bezierCurveTo(x1, y1, x2, y2, x, y) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
cmds.push({ cmd: "bezierCurveTo", args: [x1, y1, x2, y2, x, y] });
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
|
|
|
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const stack = [];
|
|
|
|
let x = 0,
|
2020-03-24 01:04:47 +09:00
|
|
|
y = 0;
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
let stems = 0;
|
2020-03-24 01:04:47 +09:00
|
|
|
|
2013-05-16 05:57:27 +09:00
|
|
|
function parse(code) {
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
let i = 0;
|
2013-05-16 05:57:27 +09:00
|
|
|
while (i < code.length) {
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
let stackClean = false;
|
|
|
|
let v = code[i++];
|
|
|
|
let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
|
2013-05-16 05:57:27 +09:00
|
|
|
switch (v) {
|
|
|
|
case 1: // hstem
|
|
|
|
stems += stack.length >> 1;
|
|
|
|
stackClean = true;
|
|
|
|
break;
|
|
|
|
case 3: // vstem
|
|
|
|
stems += stack.length >> 1;
|
|
|
|
stackClean = true;
|
|
|
|
break;
|
|
|
|
case 4: // vmoveto
|
|
|
|
y += stack.pop();
|
|
|
|
moveTo(x, y);
|
|
|
|
stackClean = true;
|
|
|
|
break;
|
|
|
|
case 5: // rlineto
|
|
|
|
while (stack.length > 0) {
|
|
|
|
x += stack.shift();
|
|
|
|
y += stack.shift();
|
|
|
|
lineTo(x, y);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 6: // hlineto
|
|
|
|
while (stack.length > 0) {
|
|
|
|
x += stack.shift();
|
|
|
|
lineTo(x, y);
|
|
|
|
if (stack.length === 0) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
y += stack.shift();
|
|
|
|
lineTo(x, y);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 7: // vlineto
|
|
|
|
while (stack.length > 0) {
|
|
|
|
y += stack.shift();
|
|
|
|
lineTo(x, y);
|
|
|
|
if (stack.length === 0) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
x += stack.shift();
|
|
|
|
lineTo(x, y);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 8: // rrcurveto
|
|
|
|
while (stack.length > 0) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
xa = x + stack.shift();
|
|
|
|
ya = y + stack.shift();
|
|
|
|
xb = xa + stack.shift();
|
|
|
|
yb = ya + stack.shift();
|
|
|
|
x = xb + stack.shift();
|
|
|
|
y = yb + stack.shift();
|
2013-05-16 05:57:27 +09:00
|
|
|
bezierCurveTo(xa, ya, xb, yb, x, y);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 10: // callsubr
|
2018-04-10 22:44:42 +09:00
|
|
|
n = stack.pop();
|
|
|
|
subrCode = null;
|
|
|
|
if (font.isCFFCIDFont) {
|
2020-01-24 17:48:21 +09:00
|
|
|
const fdIndex = font.fdSelect.getFDIndex(glyphId);
|
2018-04-10 22:44:42 +09:00
|
|
|
if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
|
2020-01-24 21:21:16 +09:00
|
|
|
const fontDict = font.fdArray[fdIndex];
|
|
|
|
let subrs;
|
2018-04-10 22:44:42 +09:00
|
|
|
if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
|
|
|
|
subrs = fontDict.privateDict.subrsIndex.objects;
|
|
|
|
}
|
|
|
|
if (subrs) {
|
|
|
|
// Add subroutine bias.
|
2020-01-14 23:28:37 +09:00
|
|
|
n += getSubroutineBias(subrs);
|
2018-04-10 22:44:42 +09:00
|
|
|
subrCode = subrs[n];
|
|
|
|
}
|
|
|
|
} else {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
warn("Invalid fd index for glyph index.");
|
2018-04-10 22:44:42 +09:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
subrCode = font.subrs[n + font.subrsBias];
|
|
|
|
}
|
2013-05-16 05:57:27 +09:00
|
|
|
if (subrCode) {
|
|
|
|
parse(subrCode);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 11: // return
|
|
|
|
return;
|
|
|
|
case 12:
|
|
|
|
v = code[i++];
|
|
|
|
switch (v) {
|
|
|
|
case 34: // flex
|
2014-04-08 06:42:54 +09:00
|
|
|
xa = x + stack.shift();
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
xb = xa + stack.shift();
|
|
|
|
y1 = y + stack.shift();
|
2013-05-16 05:57:27 +09:00
|
|
|
x = xb + stack.shift();
|
|
|
|
bezierCurveTo(xa, y, xb, y1, x, y1);
|
2014-04-08 06:42:54 +09:00
|
|
|
xa = x + stack.shift();
|
|
|
|
xb = xa + stack.shift();
|
2013-05-16 05:57:27 +09:00
|
|
|
x = xb + stack.shift();
|
|
|
|
bezierCurveTo(xa, y1, xb, y, x, y);
|
|
|
|
break;
|
|
|
|
case 35: // flex
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
xa = x + stack.shift();
|
|
|
|
ya = y + stack.shift();
|
|
|
|
xb = xa + stack.shift();
|
|
|
|
yb = ya + stack.shift();
|
|
|
|
x = xb + stack.shift();
|
|
|
|
y = yb + stack.shift();
|
2013-05-16 05:57:27 +09:00
|
|
|
bezierCurveTo(xa, ya, xb, yb, x, y);
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
xa = x + stack.shift();
|
|
|
|
ya = y + stack.shift();
|
|
|
|
xb = xa + stack.shift();
|
|
|
|
yb = ya + stack.shift();
|
|
|
|
x = xb + stack.shift();
|
|
|
|
y = yb + stack.shift();
|
2013-05-16 05:57:27 +09:00
|
|
|
bezierCurveTo(xa, ya, xb, yb, x, y);
|
|
|
|
stack.pop(); // fd
|
|
|
|
break;
|
|
|
|
case 36: // hflex1
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
xa = x + stack.shift();
|
|
|
|
y1 = y + stack.shift();
|
|
|
|
xb = xa + stack.shift();
|
|
|
|
y2 = y1 + stack.shift();
|
2013-05-16 05:57:27 +09:00
|
|
|
x = xb + stack.shift();
|
|
|
|
bezierCurveTo(xa, y1, xb, y2, x, y2);
|
2014-04-08 06:42:54 +09:00
|
|
|
xa = x + stack.shift();
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
xb = xa + stack.shift();
|
|
|
|
y3 = y2 + stack.shift();
|
2013-05-16 05:57:27 +09:00
|
|
|
x = xb + stack.shift();
|
|
|
|
bezierCurveTo(xa, y2, xb, y3, x, y);
|
|
|
|
break;
|
|
|
|
case 37: // flex1
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const x0 = x,
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
y0 = y;
|
|
|
|
xa = x + stack.shift();
|
|
|
|
ya = y + stack.shift();
|
|
|
|
xb = xa + stack.shift();
|
|
|
|
yb = ya + stack.shift();
|
|
|
|
x = xb + stack.shift();
|
|
|
|
y = yb + stack.shift();
|
2013-05-16 05:57:27 +09:00
|
|
|
bezierCurveTo(xa, ya, xb, yb, x, y);
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
xa = x + stack.shift();
|
|
|
|
ya = y + stack.shift();
|
|
|
|
xb = xa + stack.shift();
|
|
|
|
yb = ya + stack.shift();
|
|
|
|
x = xb;
|
|
|
|
y = yb;
|
2014-03-23 04:44:17 +09:00
|
|
|
if (Math.abs(x - x0) > Math.abs(y - y0)) {
|
2013-05-16 05:57:27 +09:00
|
|
|
x += stack.shift();
|
2016-12-10 22:28:27 +09:00
|
|
|
} else {
|
2013-05-16 05:57:27 +09:00
|
|
|
y += stack.shift();
|
2014-03-23 04:44:17 +09:00
|
|
|
}
|
2013-05-16 05:57:27 +09:00
|
|
|
bezierCurveTo(xa, ya, xb, yb, x, y);
|
|
|
|
break;
|
|
|
|
default:
|
2017-06-29 05:51:31 +09:00
|
|
|
throw new FormatError(`unknown operator: 12 ${v}`);
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 14: // endchar
|
|
|
|
if (stack.length >= 4) {
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const achar = stack.pop();
|
|
|
|
const bchar = stack.pop();
|
2013-05-16 05:57:27 +09:00
|
|
|
y = stack.pop();
|
|
|
|
x = stack.pop();
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
cmds.push({ cmd: "save" });
|
|
|
|
cmds.push({ cmd: "translate", args: [x, y] });
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
let cmap = lookupCmap(
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
font.cmap,
|
|
|
|
String.fromCharCode(font.glyphNameMap[StandardEncoding[achar]])
|
|
|
|
);
|
|
|
|
compileCharString(
|
|
|
|
font.glyphs[cmap.glyphId],
|
|
|
|
cmds,
|
|
|
|
font,
|
|
|
|
cmap.glyphId
|
|
|
|
);
|
|
|
|
cmds.push({ cmd: "restore" });
|
|
|
|
|
|
|
|
cmap = lookupCmap(
|
|
|
|
font.cmap,
|
|
|
|
String.fromCharCode(font.glyphNameMap[StandardEncoding[bchar]])
|
|
|
|
);
|
|
|
|
compileCharString(
|
|
|
|
font.glyphs[cmap.glyphId],
|
|
|
|
cmds,
|
|
|
|
font,
|
|
|
|
cmap.glyphId
|
|
|
|
);
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
case 18: // hstemhm
|
|
|
|
stems += stack.length >> 1;
|
|
|
|
stackClean = true;
|
|
|
|
break;
|
|
|
|
case 19: // hintmask
|
|
|
|
stems += stack.length >> 1;
|
|
|
|
i += (stems + 7) >> 3;
|
|
|
|
stackClean = true;
|
|
|
|
break;
|
|
|
|
case 20: // cntrmask
|
|
|
|
stems += stack.length >> 1;
|
|
|
|
i += (stems + 7) >> 3;
|
|
|
|
stackClean = true;
|
|
|
|
break;
|
|
|
|
case 21: // rmoveto
|
|
|
|
y += stack.pop();
|
|
|
|
x += stack.pop();
|
|
|
|
moveTo(x, y);
|
|
|
|
stackClean = true;
|
|
|
|
break;
|
|
|
|
case 22: // hmoveto
|
|
|
|
x += stack.pop();
|
|
|
|
moveTo(x, y);
|
|
|
|
stackClean = true;
|
|
|
|
break;
|
|
|
|
case 23: // vstemhm
|
|
|
|
stems += stack.length >> 1;
|
|
|
|
stackClean = true;
|
|
|
|
break;
|
|
|
|
case 24: // rcurveline
|
|
|
|
while (stack.length > 2) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
xa = x + stack.shift();
|
|
|
|
ya = y + stack.shift();
|
|
|
|
xb = xa + stack.shift();
|
|
|
|
yb = ya + stack.shift();
|
|
|
|
x = xb + stack.shift();
|
|
|
|
y = yb + stack.shift();
|
2013-05-16 05:57:27 +09:00
|
|
|
bezierCurveTo(xa, ya, xb, yb, x, y);
|
|
|
|
}
|
|
|
|
x += stack.shift();
|
|
|
|
y += stack.shift();
|
|
|
|
lineTo(x, y);
|
|
|
|
break;
|
|
|
|
case 25: // rlinecurve
|
|
|
|
while (stack.length > 6) {
|
|
|
|
x += stack.shift();
|
|
|
|
y += stack.shift();
|
|
|
|
lineTo(x, y);
|
|
|
|
}
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
xa = x + stack.shift();
|
|
|
|
ya = y + stack.shift();
|
|
|
|
xb = xa + stack.shift();
|
|
|
|
yb = ya + stack.shift();
|
|
|
|
x = xb + stack.shift();
|
|
|
|
y = yb + stack.shift();
|
2013-05-16 05:57:27 +09:00
|
|
|
bezierCurveTo(xa, ya, xb, yb, x, y);
|
|
|
|
break;
|
|
|
|
case 26: // vvcurveto
|
|
|
|
if (stack.length % 2) {
|
|
|
|
x += stack.shift();
|
|
|
|
}
|
|
|
|
while (stack.length > 0) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
xa = x;
|
|
|
|
ya = y + stack.shift();
|
|
|
|
xb = xa + stack.shift();
|
|
|
|
yb = ya + stack.shift();
|
|
|
|
x = xb;
|
|
|
|
y = yb + stack.shift();
|
2013-05-16 05:57:27 +09:00
|
|
|
bezierCurveTo(xa, ya, xb, yb, x, y);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 27: // hhcurveto
|
|
|
|
if (stack.length % 2) {
|
|
|
|
y += stack.shift();
|
|
|
|
}
|
|
|
|
while (stack.length > 0) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
xa = x + stack.shift();
|
|
|
|
ya = y;
|
|
|
|
xb = xa + stack.shift();
|
|
|
|
yb = ya + stack.shift();
|
|
|
|
x = xb + stack.shift();
|
|
|
|
y = yb;
|
2013-05-16 05:57:27 +09:00
|
|
|
bezierCurveTo(xa, ya, xb, yb, x, y);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 28:
|
|
|
|
stack.push(((code[i] << 24) | (code[i + 1] << 16)) >> 16);
|
|
|
|
i += 2;
|
|
|
|
break;
|
|
|
|
case 29: // callgsubr
|
2014-04-08 06:42:54 +09:00
|
|
|
n = stack.pop() + font.gsubrsBias;
|
|
|
|
subrCode = font.gsubrs[n];
|
2013-05-16 05:57:27 +09:00
|
|
|
if (subrCode) {
|
|
|
|
parse(subrCode);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 30: // vhcurveto
|
|
|
|
while (stack.length > 0) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
xa = x;
|
|
|
|
ya = y + stack.shift();
|
|
|
|
xb = xa + stack.shift();
|
|
|
|
yb = ya + stack.shift();
|
2013-05-16 05:57:27 +09:00
|
|
|
x = xb + stack.shift();
|
|
|
|
y = yb + (stack.length === 1 ? stack.shift() : 0);
|
|
|
|
bezierCurveTo(xa, ya, xb, yb, x, y);
|
|
|
|
if (stack.length === 0) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
xa = x + stack.shift();
|
|
|
|
ya = y;
|
|
|
|
xb = xa + stack.shift();
|
|
|
|
yb = ya + stack.shift();
|
2013-05-16 05:57:27 +09:00
|
|
|
y = yb + stack.shift();
|
|
|
|
x = xb + (stack.length === 1 ? stack.shift() : 0);
|
|
|
|
bezierCurveTo(xa, ya, xb, yb, x, y);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 31: // hvcurveto
|
|
|
|
while (stack.length > 0) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
xa = x + stack.shift();
|
|
|
|
ya = y;
|
|
|
|
xb = xa + stack.shift();
|
|
|
|
yb = ya + stack.shift();
|
2013-05-16 05:57:27 +09:00
|
|
|
y = yb + stack.shift();
|
|
|
|
x = xb + (stack.length === 1 ? stack.shift() : 0);
|
|
|
|
bezierCurveTo(xa, ya, xb, yb, x, y);
|
|
|
|
if (stack.length === 0) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
xa = x;
|
|
|
|
ya = y + stack.shift();
|
|
|
|
xb = xa + stack.shift();
|
|
|
|
yb = ya + stack.shift();
|
2013-05-16 05:57:27 +09:00
|
|
|
x = xb + stack.shift();
|
|
|
|
y = yb + (stack.length === 1 ? stack.shift() : 0);
|
|
|
|
bezierCurveTo(xa, ya, xb, yb, x, y);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2014-03-23 04:44:17 +09:00
|
|
|
if (v < 32) {
|
2017-06-29 05:51:31 +09:00
|
|
|
throw new FormatError(`unknown operator: ${v}`);
|
2014-03-23 04:44:17 +09:00
|
|
|
}
|
|
|
|
if (v < 247) {
|
2013-05-16 05:57:27 +09:00
|
|
|
stack.push(v - 139);
|
2014-03-23 04:44:17 +09:00
|
|
|
} else if (v < 251) {
|
2013-05-16 05:57:27 +09:00
|
|
|
stack.push((v - 247) * 256 + code[i++] + 108);
|
2014-03-23 04:44:17 +09:00
|
|
|
} else if (v < 255) {
|
2013-05-16 05:57:27 +09:00
|
|
|
stack.push(-(v - 251) * 256 - code[i++] - 108);
|
2014-03-23 04:44:17 +09:00
|
|
|
} else {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
stack.push(
|
|
|
|
((code[i] << 24) |
|
|
|
|
(code[i + 1] << 16) |
|
|
|
|
(code[i + 2] << 8) |
|
|
|
|
code[i + 3]) /
|
|
|
|
65536
|
|
|
|
);
|
2013-05-16 05:57:27 +09:00
|
|
|
i += 4;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (stackClean) {
|
|
|
|
stack.length = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-03-24 01:04:47 +09:00
|
|
|
parse(charStringCode);
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
|
|
|
|
2018-07-09 04:36:20 +09:00
|
|
|
const NOOP = [];
|
2013-05-16 05:57:27 +09:00
|
|
|
|
2018-07-09 05:16:05 +09:00
|
|
|
class CompiledFont {
|
|
|
|
constructor(fontMatrix) {
|
|
|
|
if (this.constructor === CompiledFont) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
unreachable("Cannot initialize CompiledFont.");
|
2018-07-09 05:16:05 +09:00
|
|
|
}
|
|
|
|
this.fontMatrix = fontMatrix;
|
|
|
|
|
|
|
|
this.compiledGlyphs = Object.create(null);
|
|
|
|
this.compiledCharCodeToGlyphId = Object.create(null);
|
|
|
|
}
|
|
|
|
|
2017-04-27 19:58:44 +09:00
|
|
|
getPathJs(unicode) {
|
2018-07-09 05:16:05 +09:00
|
|
|
const cmap = lookupCmap(this.cmap, unicode);
|
|
|
|
let fn = this.compiledGlyphs[cmap.glyphId];
|
2013-05-16 05:57:27 +09:00
|
|
|
if (!fn) {
|
2018-04-10 22:44:42 +09:00
|
|
|
fn = this.compileGlyph(this.glyphs[cmap.glyphId], cmap.glyphId);
|
2016-03-23 21:52:30 +09:00
|
|
|
this.compiledGlyphs[cmap.glyphId] = fn;
|
|
|
|
}
|
|
|
|
if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
|
|
|
|
this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
|
|
|
return fn;
|
2018-07-09 05:16:05 +09:00
|
|
|
}
|
2013-08-20 08:33:20 +09:00
|
|
|
|
2018-04-10 22:44:42 +09:00
|
|
|
compileGlyph(code, glyphId) {
|
2013-05-16 05:57:27 +09:00
|
|
|
if (!code || code.length === 0 || code[0] === 14) {
|
2018-07-09 04:36:20 +09:00
|
|
|
return NOOP;
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
|
|
|
|
2018-04-10 22:44:42 +09:00
|
|
|
let fontMatrix = this.fontMatrix;
|
|
|
|
if (this.isCFFCIDFont) {
|
|
|
|
// Top DICT's FontMatrix can be ignored because CFFCompiler always
|
|
|
|
// removes it and copies to FDArray DICTs.
|
2020-01-24 17:48:21 +09:00
|
|
|
const fdIndex = this.fdSelect.getFDIndex(glyphId);
|
2018-04-10 22:44:42 +09:00
|
|
|
if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
|
2020-01-24 17:48:21 +09:00
|
|
|
const fontDict = this.fdArray[fdIndex];
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
fontMatrix = fontDict.getByName("FontMatrix") || FONT_IDENTITY_MATRIX;
|
2018-04-10 22:44:42 +09:00
|
|
|
} else {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
warn("Invalid fd index for glyph index.");
|
2018-04-10 22:44:42 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-09 05:16:05 +09:00
|
|
|
const cmds = [];
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
cmds.push({ cmd: "save" });
|
|
|
|
cmds.push({ cmd: "transform", args: fontMatrix.slice() });
|
|
|
|
cmds.push({ cmd: "scale", args: ["size", "-size"] });
|
2013-05-16 05:57:27 +09:00
|
|
|
|
2018-04-10 22:44:42 +09:00
|
|
|
this.compileGlyphImpl(code, cmds, glyphId);
|
2013-05-16 05:57:27 +09:00
|
|
|
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
cmds.push({ cmd: "restore" });
|
2013-05-16 05:57:27 +09:00
|
|
|
|
2015-06-25 05:29:36 +09:00
|
|
|
return cmds;
|
2018-07-09 05:16:05 +09:00
|
|
|
}
|
2013-08-20 08:33:20 +09:00
|
|
|
|
2017-04-27 19:58:44 +09:00
|
|
|
compileGlyphImpl() {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
unreachable("Children classes should implement this.");
|
2018-07-09 05:16:05 +09:00
|
|
|
}
|
2013-08-20 08:33:20 +09:00
|
|
|
|
2017-04-27 19:58:44 +09:00
|
|
|
hasBuiltPath(unicode) {
|
2018-07-09 05:16:05 +09:00
|
|
|
const cmap = lookupCmap(this.cmap, unicode);
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
return (
|
|
|
|
this.compiledGlyphs[cmap.glyphId] !== undefined &&
|
|
|
|
this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined
|
|
|
|
);
|
2018-07-09 05:16:05 +09:00
|
|
|
}
|
|
|
|
}
|
2013-05-16 05:57:27 +09:00
|
|
|
|
2018-07-09 05:16:05 +09:00
|
|
|
class TrueTypeCompiled extends CompiledFont {
|
|
|
|
constructor(glyphs, cmap, fontMatrix) {
|
|
|
|
super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
|
2013-08-20 08:33:20 +09:00
|
|
|
|
2018-07-09 05:16:05 +09:00
|
|
|
this.glyphs = glyphs;
|
|
|
|
this.cmap = cmap;
|
|
|
|
}
|
2013-08-20 08:33:20 +09:00
|
|
|
|
2017-04-27 19:58:44 +09:00
|
|
|
compileGlyphImpl(code, cmds) {
|
2015-06-25 05:29:36 +09:00
|
|
|
compileGlyf(code, cmds, this);
|
2018-07-09 05:16:05 +09:00
|
|
|
}
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
|
|
|
|
2018-07-09 05:16:05 +09:00
|
|
|
class Type2Compiled extends CompiledFont {
|
|
|
|
constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
|
|
|
|
super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
|
|
|
|
|
|
|
|
this.glyphs = cffInfo.glyphs;
|
|
|
|
this.gsubrs = cffInfo.gsubrs || [];
|
|
|
|
this.subrs = cffInfo.subrs || [];
|
|
|
|
this.cmap = cmap;
|
|
|
|
this.glyphNameMap = glyphNameMap || getGlyphsUnicode();
|
|
|
|
|
2020-01-14 23:28:37 +09:00
|
|
|
this.gsubrsBias = getSubroutineBias(this.gsubrs);
|
|
|
|
this.subrsBias = getSubroutineBias(this.subrs);
|
2018-07-09 05:16:05 +09:00
|
|
|
|
|
|
|
this.isCFFCIDFont = cffInfo.isCFFCIDFont;
|
|
|
|
this.fdSelect = cffInfo.fdSelect;
|
|
|
|
this.fdArray = cffInfo.fdArray;
|
|
|
|
}
|
|
|
|
|
2018-04-10 22:44:42 +09:00
|
|
|
compileGlyphImpl(code, cmds, glyphId) {
|
|
|
|
compileCharString(code, cmds, this, glyphId);
|
2018-07-09 05:16:05 +09:00
|
|
|
}
|
|
|
|
}
|
2013-08-20 08:33:20 +09:00
|
|
|
|
2013-05-16 05:57:27 +09:00
|
|
|
return {
|
2016-04-01 02:53:07 +09:00
|
|
|
create: function FontRendererFactory_create(font, seacAnalysisEnabled) {
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const data = new Uint8Array(font.data);
|
|
|
|
let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
|
|
|
|
const numTables = getUshort(data, 4);
|
|
|
|
for (let i = 0, p = 12; i < numTables; i++, p += 16) {
|
|
|
|
const tag = bytesToString(data.subarray(p, p + 4));
|
|
|
|
const offset = getLong(data, p + 8);
|
|
|
|
const length = getLong(data, p + 12);
|
2013-05-16 05:57:27 +09:00
|
|
|
switch (tag) {
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
case "cmap":
|
2013-05-16 05:57:27 +09:00
|
|
|
cmap = parseCmap(data, offset, offset + length);
|
|
|
|
break;
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
case "glyf":
|
2013-05-16 05:57:27 +09:00
|
|
|
glyf = data.subarray(offset, offset + length);
|
|
|
|
break;
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
case "loca":
|
2013-05-16 05:57:27 +09:00
|
|
|
loca = data.subarray(offset, offset + length);
|
|
|
|
break;
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
case "head":
|
2013-05-16 05:57:27 +09:00
|
|
|
unitsPerEm = getUshort(data, offset + 18);
|
|
|
|
indexToLocFormat = getUshort(data, offset + 50);
|
|
|
|
break;
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
case "CFF ":
|
2016-04-01 02:53:07 +09:00
|
|
|
cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
|
2013-05-16 05:57:27 +09:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (glyf) {
|
Enable the ESLint `no-var` rule in the `src/core/font_renderer.js` file
Note that the majority of these changes were done automatically, by using `gulp lint --fix`, and the manual changes were limited to the following diff:
```diff
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index e1538c481..00f5424cd 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -152,9 +152,9 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
}
function lookupCmap(ranges, unicode) {
- let code = unicode.codePointAt(0),
- gid = 0;
- let l = 0,
+ const code = unicode.codePointAt(0);
+ let gid = 0,
+ l = 0,
r = ranges.length - 1;
while (l < r) {
const c = (l + r + 1) >> 1;
@@ -199,7 +199,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
flags = (code[i] << 8) | code[i + 1];
const glyphIndex = (code[i + 2] << 8) | code[i + 3];
i += 4;
- var arg1, arg2;
+ let arg1, arg2;
if (flags & 0x01) {
arg1 = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
arg2 = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
@@ -366,7 +366,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
while (i < code.length) {
let stackClean = false;
let v = code[i++];
- var xa, xb, ya, yb, y1, y2, y3, n, subrCode;
+ let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
switch (v) {
case 1: // hstem
stems += stack.length >> 1;
@@ -494,7 +494,7 @@ const FontRendererFactory = (function FontRendererFactoryClosure() {
bezierCurveTo(xa, y2, xb, y3, x, y);
break;
case 37: // flex1
- var x0 = x,
+ const x0 = x,
y0 = y;
xa = x + stack.shift();
ya = y + stack.shift();
```
2021-03-12 19:49:06 +09:00
|
|
|
const fontMatrix = !unitsPerEm
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
? font.fontMatrix
|
|
|
|
: [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
|
2013-05-16 05:57:27 +09:00
|
|
|
return new TrueTypeCompiled(
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
parseGlyfTable(glyf, loca, indexToLocFormat),
|
|
|
|
cmap,
|
|
|
|
fontMatrix
|
|
|
|
);
|
2013-05-16 05:57:27 +09:00
|
|
|
}
|
2016-12-16 21:05:33 +09:00
|
|
|
return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
|
Fix inconsistent spacing and trailing commas in objects in `src/core/` files, so we can enable the `comma-dangle` and `object-curly-spacing` ESLint rules later on
*Unfortunately this patch is fairly big, even though it only covers the `src/core` folder, but splitting it even further seemed difficult.*
http://eslint.org/docs/rules/comma-dangle
http://eslint.org/docs/rules/object-curly-spacing
Given that we currently have quite inconsistent object formatting, fixing this in *one* big patch probably wouldn't be feasible (since I cannot imagine anyone wanting to review that); hence I've opted to try and do this piecewise instead.
Please note: This patch was created automatically, using the ESLint --fix command line option. In a couple of places this caused lines to become too long, and I've fixed those manually; please refer to the interdiff below for the only hand-edits in this patch.
```diff
diff --git a/src/core/evaluator.js b/src/core/evaluator.js
index abab9027..dcd3594b 100644
--- a/src/core/evaluator.js
+++ b/src/core/evaluator.js
@@ -2785,7 +2785,8 @@ var EvaluatorPreprocessor = (function EvaluatorPreprocessorClosure() {
t['Tz'] = { id: OPS.setHScale, numArgs: 1, variableArgs: false, };
t['TL'] = { id: OPS.setLeading, numArgs: 1, variableArgs: false, };
t['Tf'] = { id: OPS.setFont, numArgs: 2, variableArgs: false, };
- t['Tr'] = { id: OPS.setTextRenderingMode, numArgs: 1, variableArgs: false, };
+ t['Tr'] = { id: OPS.setTextRenderingMode, numArgs: 1,
+ variableArgs: false, };
t['Ts'] = { id: OPS.setTextRise, numArgs: 1, variableArgs: false, };
t['Td'] = { id: OPS.moveText, numArgs: 2, variableArgs: false, };
t['TD'] = { id: OPS.setLeadingMoveText, numArgs: 2, variableArgs: false, };
diff --git a/src/core/jbig2.js b/src/core/jbig2.js
index 5a17d482..71671541 100644
--- a/src/core/jbig2.js
+++ b/src/core/jbig2.js
@@ -123,19 +123,22 @@ var Jbig2Image = (function Jbig2ImageClosure() {
{ x: -1, y: -1, }, { x: 0, y: -1, }, { x: 1, y: -1, }, { x: -2, y: 0, },
{ x: -1, y: 0, }],
[{ x: -3, y: -1, }, { x: -2, y: -1, }, { x: -1, y: -1, }, { x: 0, y: -1, },
- { x: 1, y: -1, }, { x: -4, y: 0, }, { x: -3, y: 0, }, { x: -2, y: 0, }, { x: -1, y: 0, }]
+ { x: 1, y: -1, }, { x: -4, y: 0, }, { x: -3, y: 0, }, { x: -2, y: 0, },
+ { x: -1, y: 0, }]
];
var RefinementTemplates = [
{
coding: [{ x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, }],
- reference: [{ x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, }, { x: 0, y: 0, },
- { x: 1, y: 0, }, { x: -1, y: 1, }, { x: 0, y: 1, }, { x: 1, y: 1, }],
+ reference: [{ x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, },
+ { x: 0, y: 0, }, { x: 1, y: 0, }, { x: -1, y: 1, },
+ { x: 0, y: 1, }, { x: 1, y: 1, }],
},
{
- coding: [{ x: -1, y: -1, }, { x: 0, y: -1, }, { x: 1, y: -1, }, { x: -1, y: 0, }],
- reference: [{ x: 0, y: -1, }, { x: -1, y: 0, }, { x: 0, y: 0, }, { x: 1, y: 0, },
- { x: 0, y: 1, }, { x: 1, y: 1, }],
+ coding: [{ x: -1, y: -1, }, { x: 0, y: -1, }, { x: 1, y: -1, },
+ { x: -1, y: 0, }],
+ reference: [{ x: 0, y: -1, }, { x: -1, y: 0, }, { x: 0, y: 0, },
+ { x: 1, y: 0, }, { x: 0, y: 1, }, { x: 1, y: 1, }],
}
];
```
2017-06-02 18:16:24 +09:00
|
|
|
},
|
2013-05-16 05:57:27 +09:00
|
|
|
};
|
|
|
|
})();
|
2015-11-22 01:32:47 +09:00
|
|
|
|
Enable auto-formatting of the entire code-base using Prettier (issue 11444)
Note that Prettier, purposely, has only limited [configuration options](https://prettier.io/docs/en/options.html). The configuration file is based on [the one in `mozilla central`](https://searchfox.org/mozilla-central/source/.prettierrc) with just a few additions (to avoid future breakage if the defaults ever changes).
Prettier is being used for a couple of reasons:
- To be consistent with `mozilla-central`, where Prettier is already in use across the tree.
- To ensure a *consistent* coding style everywhere, which is automatically enforced during linting (since Prettier is used as an ESLint plugin). This thus ends "all" formatting disussions once and for all, removing the need for review comments on most stylistic matters.
Many ESLint options are now redundant, and I've tried my best to remove all the now unnecessary options (but I may have missed some).
Note also that since Prettier considers the `printWidth` option as a guide, rather than a hard rule, this patch resorts to a small hack in the ESLint config to ensure that *comments* won't become too long.
*Please note:* This patch is generated automatically, by appending the `--fix` argument to the ESLint call used in the `gulp lint` task. It will thus require some additional clean-up, which will be done in a *separate* commit.
(On a more personal note, I'll readily admit that some of the changes Prettier makes are *extremely* ugly. However, in the name of consistency we'll probably have to live with that.)
2019-12-25 23:59:37 +09:00
|
|
|
export { FontRendererFactory };
|