Continue ESM transform
This commit is contained in:
parent
b8205a63aa
commit
36835216f5
44 changed files with 1939 additions and 502 deletions
|
@ -1,15 +1,20 @@
|
|||
import UnicodeDataIndex from "@unicode/unicode-14.0.0";
|
||||
const BlockData = [
|
||||
[[0xe0a0, 0xe0df], "Private Use Area — Powerline"],
|
||||
[[0xee00, 0xee3f], "Private Use Area — Progress Bar"],
|
||||
// Missing ranges in UnicodeDataIndex
|
||||
[[0x1fa70, 0x1faff], "Symbols and Pictographs Extended-A "],
|
||||
[[0x1fb00, 0x1fbff], "Symbols for Legacy Computing"]
|
||||
];
|
||||
for (const id of UnicodeDataIndex.Block) {
|
||||
if (!id || /Private_Use_Area/.test(id) || /undefined/.test(id))
|
||||
continue;
|
||||
BlockData.push([[rg[0].begin, rg[0].end - 1], id.replace(/_/g, " ")]);
|
||||
}
|
||||
BlockData.sort((a, b) => a[0][0] - b[0][0]);
|
||||
export { BlockData };
|
||||
import UnicodeDataIndex from "@unicode/unicode-14.0.0";
|
||||
|
||||
export async function collectBlockData() {
|
||||
const BlockData = [
|
||||
[[0xe0a0, 0xe0df], "Private Use Area — Powerline"],
|
||||
[[0xee00, 0xee3f], "Private Use Area — Progress Bar"],
|
||||
// Missing ranges in UnicodeDataIndex
|
||||
[[0x1fa70, 0x1faff], "Symbols and Pictographs Extended-A "],
|
||||
[[0x1fb00, 0x1fbff], "Symbols for Legacy Computing"]
|
||||
];
|
||||
|
||||
for (const id of UnicodeDataIndex.Block) {
|
||||
if (!id || /Private_Use_Area/.test(id) || /undefined/.test(id)) continue;
|
||||
const rangesModule = await import(`@unicode/unicode-14.0.0/Block/${id}/ranges.js`);
|
||||
const rg = rangesModule.default;
|
||||
BlockData.push([[rg[0].begin, rg[0].end - 1], id.replace(/_/g, " ")]);
|
||||
}
|
||||
BlockData.sort((a, b) => a[0][0] - b[0][0]);
|
||||
return BlockData;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import { BlockData } from "./block-data.mjs";
|
||||
import ucdNames from "@unicode/unicode-14.0.0/Names";
|
||||
import ugc from "@unicode/unicode-14.0.0/General_Category";
|
||||
import ugc from "@unicode/unicode-14.0.0/General_Category/index.js";
|
||||
import ucdNames from "@unicode/unicode-14.0.0/Names/index.js";
|
||||
|
||||
import { collectBlockData } from "./block-data.mjs";
|
||||
|
||||
function findFirstLastChar(lchBlockStart, lchBlockEnd, cov) {
|
||||
let lchFirst = 0,
|
||||
lchLast = 0;
|
||||
|
@ -18,9 +20,9 @@ function findFirstLastChar(lchBlockStart, lchBlockEnd, cov) {
|
|||
const lchEnd = ((lchLast >>> 4) << 4) + 0x10;
|
||||
return [lchStart, lchEnd];
|
||||
}
|
||||
export const gatherCoverageData = function (covUpright, covItalic, covOblique) {
|
||||
export async function gatherCoverageData(covUpright, covItalic, covOblique) {
|
||||
const result = [];
|
||||
for (const [[lchBlockStart, lchBlockEnd], block] of BlockData) {
|
||||
for (const [[lchBlockStart, lchBlockEnd], block] of await collectBlockData()) {
|
||||
let blockResults = [];
|
||||
const [lchStart, lchEnd] = findFirstLastChar(lchBlockStart, lchBlockEnd, covUpright);
|
||||
if (!lchStart || !lchEnd) continue;
|
||||
|
@ -63,4 +65,4 @@ export const gatherCoverageData = function (covUpright, covItalic, covOblique) {
|
|||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue