Add circular powerline
This commit is contained in:
parent
226c819c17
commit
91a716abe7
2 changed files with 84 additions and 72 deletions
|
@ -6,46 +6,54 @@ module.exports = function (covUpright, covItalic, covOblique) {
|
|||
const result = [];
|
||||
for (const [[lchBlockStart, lchBlockEnd], block] of blockData) {
|
||||
let blockResults = [];
|
||||
let processed = new Set();
|
||||
let lchFirst = 0,
|
||||
lchLast = 0;
|
||||
|
||||
for (const [lchFont] of covUpright) {
|
||||
if (lchFont < 0x20 || lchFont < lchBlockStart || lchFont > lchBlockEnd) continue;
|
||||
const lchStart = (lchFont >>> 4) << 4;
|
||||
const lchEnd = lchStart + 0x10;
|
||||
for (let lch = lchStart; lch < lchEnd; lch++) {
|
||||
if (processed.has(lch)) continue;
|
||||
const chName = ucdNames.get(lch);
|
||||
const gc = ugc.get(lch);
|
||||
const cdUpright = covUpright.get(lch);
|
||||
const cdItalic = covItalic.get(lch);
|
||||
const cdOblique = covOblique.get(lch);
|
||||
if (cdUpright && cdItalic && cdOblique) {
|
||||
const [glyphName, typographicVariants, charVariantsUpright] = cdUpright;
|
||||
const [, , charVariantsItalic] = cdItalic;
|
||||
const [, , charVariantsOblique] = cdOblique;
|
||||
blockResults.push({
|
||||
lch,
|
||||
gc,
|
||||
charName: chName,
|
||||
inFont: true,
|
||||
glyphName: glyphName,
|
||||
typographicVariants: typographicVariants,
|
||||
charVariantsUpright,
|
||||
charVariantsItalic,
|
||||
charVariantsOblique
|
||||
});
|
||||
} else {
|
||||
blockResults.push({
|
||||
lch,
|
||||
gc,
|
||||
charName: chName,
|
||||
inFont: false,
|
||||
glyphName: undefined
|
||||
});
|
||||
}
|
||||
processed.add(lch);
|
||||
if (!lchFirst || lchFont < lchFirst) lchFirst = lchFont;
|
||||
if (!lchLast || lchFont > lchLast) lchLast = lchFont;
|
||||
}
|
||||
if (!lchFirst || !lchLast) continue;
|
||||
|
||||
if (lchBlockEnd - lchBlockStart <= 0x100 && lchBlockStart > 0xff) {
|
||||
(lchFirst = lchBlockStart), (lchLast = lchBlockEnd);
|
||||
}
|
||||
const lchStart = (lchFirst >>> 4) << 4;
|
||||
const lchEnd = ((lchLast >>> 4) << 4) + 0x10;
|
||||
|
||||
for (let lch = lchStart; lch < lchEnd; lch++) {
|
||||
const chName = ucdNames.get(lch);
|
||||
const gc = ugc.get(lch);
|
||||
const cdUpright = covUpright.get(lch);
|
||||
const cdItalic = covItalic.get(lch);
|
||||
const cdOblique = covOblique.get(lch);
|
||||
if (cdUpright && cdItalic && cdOblique) {
|
||||
const [glyphName, typographicVariants, charVariantsUpright] = cdUpright;
|
||||
const [, , charVariantsItalic] = cdItalic;
|
||||
const [, , charVariantsOblique] = cdOblique;
|
||||
blockResults.push({
|
||||
lch,
|
||||
gc,
|
||||
charName: chName,
|
||||
inFont: true,
|
||||
glyphName: glyphName,
|
||||
typographicVariants: typographicVariants,
|
||||
charVariantsUpright,
|
||||
charVariantsItalic,
|
||||
charVariantsOblique
|
||||
});
|
||||
} else {
|
||||
blockResults.push({
|
||||
lch,
|
||||
gc,
|
||||
charName: chName,
|
||||
inFont: false,
|
||||
glyphName: undefined
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (blockResults.length) {
|
||||
result.push({
|
||||
name: block,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue