2020-10-26 20:12:40 +09:00
|
|
|
import { decodeFontData, ttx, verifyTtxOutput } from "./fontutils.js";
|
|
|
|
import { CMapFactory } from "../../src/core/cmap.js";
|
2021-05-02 19:04:34 +09:00
|
|
|
import { Font } from "../../src/core/fonts.js";
|
2020-10-26 20:12:40 +09:00
|
|
|
import { Name } from "../../src/core/primitives.js";
|
|
|
|
import { Stream } from "../../src/core/stream.js";
|
2021-05-02 19:04:34 +09:00
|
|
|
import { ToUnicodeMap } from "../../src/core/to_unicode_map.js";
|
2012-11-08 02:32:55 +09:00
|
|
|
|
2020-10-26 20:12:40 +09:00
|
|
|
describe("font_fpgm", function () {
|
2020-10-26 20:20:03 +09:00
|
|
|
const font2324 = decodeFontData(
|
2020-10-26 20:12:40 +09:00
|
|
|
// eslint-disable-next-line max-len
|
|
|
|
"AAEAAAANAIAAAwBQT1MvMlNlbJwAAADcAAAAYGNtYXDrAFO9AAABPAAALKxjdnQgAzYCuwAALegAAAAMZnBnbQgKVdkAAC30AAACaGdseWa+m03rAAAwXAAAOERoZWFk9BT7TwAAaKAAAAA4aGhlYQWlFpUAAGjYAAAAJGhtdHgPKyHAAABo/AAAUqRsb2NhBA9dxAAAu6AAAFKobWF4cBY1AjUAAQ5IAAAAIG5hbWXZdYwDAAEOaAAAAhBwb3N0AAMAAAABEHgAAAAgcHJlcFyRbmMAARCYAAAAVAADAiQB9AAFAAACigK7AAAAjAKKArsAAAHfADEBAgAAAAAGAAAAAAAAAOAAEAFQAP3/AAAAIAAAAAQqMjEqAAAAIP//A+j+1ABkBBoB1QAAAAAAAAAAAgwC2QAAACAAAwAAAAEAAwABAAAADAAELKAAAADQAIAABgBQAH4emx75HxUfHR9FH00fVx9ZH1sfXR99H7QfxB/TH9sf7x/0H/4gZCBxII4glCCuILUguCDhIPAhCSEkITMhPCE/IUQhSyFOIX8hmSGmIaohtSHDIcwh1SHdIgAiAyINIhciGiIeIiAiLiI0Ij4iSSJNIlAiYiJlImsicyJ9IokijCKZIqcitSLDI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M8AzxDPIM8wz0DPUM9gz3DPgM+Qz6DPsM/Az9DP4M/w0ADQENAg0DDQQNBQ0GDQcNCA0JDQoNCw0MDQ0NDg0PDRANEQ0SDRMNFA0VDRYNFw0YDRkNGg0bDRwNHQ0eDR8NIA0hDSINIw0kDSUNJg0nDSgNKQ0qDSsNLA0tDS4NLw0wDTENMg0zDTQNNQ02DTcNOA05DToNOw08DT0NPg0/DUANQQ1CDUMNRA1FDUYNRw1IDUkNSg1LDU
|
|
|
|
);
|
|
|
|
|
|
|
|
describe("Fixes fpgm table", function () {
|
2021-04-19 20:26:39 +09:00
|
|
|
it("table was truncated in the middle of functions", async function () {
|
|
|
|
const cMap = await CMapFactory.create({
|
2020-10-26 20:12:40 +09:00
|
|
|
encoding: Name.get("Identity-H"),
|
2012-11-08 02:32:55 +09:00
|
|
|
});
|
2021-04-19 20:26:39 +09:00
|
|
|
const font = new Font("font", new Stream(font2324), {
|
|
|
|
loadedName: "font",
|
|
|
|
type: "CIDFontType2",
|
|
|
|
differences: [],
|
|
|
|
defaultEncoding: [],
|
|
|
|
cMap,
|
|
|
|
toUnicode: new ToUnicodeMap([]),
|
2021-06-27 22:19:02 +09:00
|
|
|
xHeight: 0,
|
|
|
|
capHeight: 0,
|
|
|
|
italicAngle: 0,
|
2021-04-19 20:26:39 +09:00
|
|
|
});
|
|
|
|
const output = await ttx(font.data);
|
|
|
|
|
|
|
|
verifyTtxOutput(output);
|
|
|
|
expect(
|
2022-07-11 02:16:21 +09:00
|
|
|
/(ENDF\[ \]|SVTCA\[0\])\s*\/\*.*\*\/\s*<\/assembly>\s*<\/fpgm>/.test(
|
|
|
|
output
|
|
|
|
)
|
2021-04-19 20:26:39 +09:00
|
|
|
).toEqual(true);
|
2012-11-08 02:32:55 +09:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|