Add circular powerline

This commit is contained in:
be5invis 2020-08-08 01:27:21 -07:00
parent 226c819c17
commit 91a716abe7
2 changed files with 84 additions and 72 deletions

View file

@ -739,7 +739,14 @@ glyph-block Symbol-Mosaic-Powerline : begin
local pwlNear : 0 * para.powerlineScaleX + para.powerlineShiftX local pwlNear : 0 * para.powerlineScaleX + para.powerlineShiftX
local pwlFar : MosaicWidth * para.powerlineScaleX + para.powerlineShiftX local pwlFar : MosaicWidth * para.powerlineScaleX + para.powerlineShiftX
create-glyph [MangleName 'pwlTriangleRight'] [MangleUnicode 0xE0B0] : glyph-proc define [RotatedPowerline gidNew unicodeNew gidSource] : begin
create-glyph [MangleName gidNew] [MangleUnicode unicodeNew] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : refer-glyph [MangleName gidSource]
include : FlipAround (MosaicWidth / 2) pwlMid
create-glyph [MangleName 'powerline/triangleRight'] [MangleUnicode 0xE0B0] : glyph-proc
set-width MosaicWidth set-width MosaicWidth
include : ForceUpright include : ForceUpright
include : spiro-outline include : spiro-outline
@ -749,7 +756,7 @@ glyph-block Symbol-Mosaic-Powerline : begin
corner pwlNear pwlBot corner pwlNear pwlBot
corner (pwlNear + O) pwlBot corner (pwlNear + O) pwlBot
create-glyph [MangleName 'pwlAngleRight'] [MangleUnicode 0xE0B1] : glyph-proc create-glyph [MangleName 'powerline/angleRight'] [MangleUnicode 0xE0B1] : glyph-proc
set-width MosaicWidth set-width MosaicWidth
include : ForceUpright include : ForceUpright
local fine : adviceBlackness 4 local fine : adviceBlackness 4
@ -770,31 +777,47 @@ glyph-block Symbol-Mosaic-Powerline : begin
flat pwlFar pwlMid flat pwlFar pwlMid
curl pwlNear pwlBot curl pwlNear pwlBot
create-glyph [MangleName 'pwlTriangleLeft'] [MangleUnicode 0xE0B2] : glyph-proc RotatedPowerline 'powerline/triangleLeft' 0xE0B2 'powerline/triangleRight'
RotatedPowerline 'powerline/angleLeft' 0xE0B3 'powerline/angleRight'
create-glyph [MangleName 'powerline/hemiCircleRight'] [MangleUnicode 0xE0B4] : glyph-proc
set-width MosaicWidth set-width MosaicWidth
include : ForceUpright include : ForceUpright
include : refer-glyph : MangleName 'pwlTriangleRight' include : spiro-outline
include : FlipAround (MosaicWidth / 2) pwlMid corner (pwlNear + O) pwlTop
g4 pwlNear pwlTop
g4.down.mid pwlFar pwlMid
g4 pwlNear pwlBot
corner (pwlNear + O) pwlBot
create-glyph [MangleName 'pwlAngleLeft'] [MangleUnicode 0xE0B3] : glyph-proc create-glyph [MangleName 'powerline/arcRight'] [MangleUnicode 0xE0B5] : glyph-proc
set-width MosaicWidth set-width MosaicWidth
include : ForceUpright include : ForceUpright
include : refer-glyph : MangleName 'pwlAngleRight' local fine : adviceBlackness 4
include : FlipAround (MosaicWidth / 2) pwlMid include : dispiro
widths.rhs fine
corner (pwlNear + O) pwlTop [heading Rightward]
g4 pwlNear pwlTop [heading Rightward]
g4.down.mid pwlFar pwlMid [heading Downward]
g4 pwlNear pwlBot [heading Leftward]
corner (pwlNear + O) pwlBot [heading Leftward]
create-glyph [MangleName 'pwlUnderline'] [MangleUnicode 0xE0AE] : glyph-proc RotatedPowerline 'powerline/hemiCircleLeft' 0xE0B6 'powerline/hemiCircleRight'
RotatedPowerline 'powerline/arcLeft' 0xE0B7 'powerline/arcRight'
create-glyph [MangleName 'powerline/underline'] [MangleUnicode 0xE0AE] : glyph-proc
set-width MosaicWidth set-width MosaicWidth
include : ForceUpright include : ForceUpright
local fine : adviceBlackness 4 local fine : adviceBlackness 4
include : HBarBottom 0 MosaicWidth pwlBot include : HBarBottom 0 MosaicWidth pwlBot
create-glyph [MangleName 'pwlOverline'] [MangleUnicode 0xE0AF] : glyph-proc create-glyph [MangleName 'powerline/overline'] [MangleUnicode 0xE0AF] : glyph-proc
set-width MosaicWidth set-width MosaicWidth
include : ForceUpright include : ForceUpright
local fine : adviceBlackness 4 local fine : adviceBlackness 4
include : HBarTop 0 MosaicWidth pwlTop include : HBarTop 0 MosaicWidth pwlTop
create-glyph [MangleName 'pwlCornerBottomLeft'] [MangleUnicode 0xE0B8] : glyph-proc create-glyph [MangleName 'powerline/cornerBottomLeft'] [MangleUnicode 0xE0B8] : glyph-proc
set-width MosaicWidth set-width MosaicWidth
include : ForceUpright include : ForceUpright
include : spiro-outline include : spiro-outline
@ -803,7 +826,7 @@ glyph-block Symbol-Mosaic-Powerline : begin
corner pwlFar pwlBot corner pwlFar pwlBot
corner (pwlNear + O) pwlBot corner (pwlNear + O) pwlBot
create-glyph [MangleName 'pwlSlashBottomLeft'] [MangleUnicode 0xE0B9] : glyph-proc create-glyph [MangleName 'powerline/slashBottomLeft'] [MangleUnicode 0xE0B9] : glyph-proc
set-width MosaicWidth set-width MosaicWidth
include : ForceUpright include : ForceUpright
local fine : adviceBlackness 4 local fine : adviceBlackness 4
@ -812,7 +835,7 @@ glyph-block Symbol-Mosaic-Powerline : begin
flat pwlNear pwlTop flat pwlNear pwlTop
curl pwlFar pwlBot curl pwlFar pwlBot
create-glyph [MangleName 'pwlCornerTopLeft'] [MangleUnicode 0xE0BC] : glyph-proc create-glyph [MangleName 'powerline/cornerTopLeft'] [MangleUnicode 0xE0BC] : glyph-proc
set-width MosaicWidth set-width MosaicWidth
include : ForceUpright include : ForceUpright
include : spiro-outline include : spiro-outline
@ -821,7 +844,7 @@ glyph-block Symbol-Mosaic-Powerline : begin
corner pwlFar pwlTop corner pwlFar pwlTop
corner (pwlNear + O) pwlBot corner (pwlNear + O) pwlBot
create-glyph [MangleName 'pwlSlashTopLeft'] [MangleUnicode 0xE0BD] : glyph-proc create-glyph [MangleName 'powerline/slashTopLeft'] [MangleUnicode 0xE0BD] : glyph-proc
set-width MosaicWidth set-width MosaicWidth
include : ForceUpright include : ForceUpright
local fine : adviceBlackness 4 local fine : adviceBlackness 4
@ -830,29 +853,10 @@ glyph-block Symbol-Mosaic-Powerline : begin
flat pwlNear pwlBot flat pwlNear pwlBot
curl pwlFar pwlTop curl pwlFar pwlTop
create-glyph [MangleName 'pwlCornerBottomRight'] [MangleUnicode 0xE0BA] : glyph-proc RotatedPowerline 'powerline/cornerBottomRight' 0xE0BA 'powerline/cornerTopLeft'
set-width MosaicWidth RotatedPowerline 'powerline/slashBottomRight' 0xE0BB 'powerline/slashTopLeft'
include : ForceUpright RotatedPowerline 'powerline/cornerTopRight' 0xE0BE 'powerline/cornerBottomLeft'
include : refer-glyph : MangleName 'pwlCornerTopLeft' RotatedPowerline 'powerline/slashTopRight' 0xE0BF 'powerline/slashBottomLeft'
include : FlipAround (MosaicWidth / 2) pwlMid
create-glyph [MangleName 'pwlSlashBottomRight'] [MangleUnicode 0xE0BB] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : refer-glyph : MangleName 'pwlSlashTopLeft'
include : FlipAround (MosaicWidth / 2) pwlMid
create-glyph [MangleName 'pwlCornerTopRight'] [MangleUnicode 0xE0BE] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : refer-glyph : MangleName 'pwlCornerBottomLeft'
include : FlipAround (MosaicWidth / 2) pwlMid
create-glyph [MangleName 'pwlSlashTopRight'] [MangleUnicode 0xE0BF] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : refer-glyph : MangleName 'pwlSlashBottomLeft'
include : FlipAround (MosaicWidth / 2) pwlMid
glyph-block Symbol-Mosaic-NotDef : begin glyph-block Symbol-Mosaic-NotDef : begin

View file

@ -6,46 +6,54 @@ module.exports = function (covUpright, covItalic, covOblique) {
const result = []; const result = [];
for (const [[lchBlockStart, lchBlockEnd], block] of blockData) { for (const [[lchBlockStart, lchBlockEnd], block] of blockData) {
let blockResults = []; let blockResults = [];
let processed = new Set(); let lchFirst = 0,
lchLast = 0;
for (const [lchFont] of covUpright) { for (const [lchFont] of covUpright) {
if (lchFont < 0x20 || lchFont < lchBlockStart || lchFont > lchBlockEnd) continue; if (lchFont < 0x20 || lchFont < lchBlockStart || lchFont > lchBlockEnd) continue;
const lchStart = (lchFont >>> 4) << 4; if (!lchFirst || lchFont < lchFirst) lchFirst = lchFont;
const lchEnd = lchStart + 0x10; if (!lchLast || lchFont > lchLast) lchLast = lchFont;
for (let lch = lchStart; lch < lchEnd; lch++) { }
if (processed.has(lch)) continue; if (!lchFirst || !lchLast) continue;
const chName = ucdNames.get(lch);
const gc = ugc.get(lch); if (lchBlockEnd - lchBlockStart <= 0x100 && lchBlockStart > 0xff) {
const cdUpright = covUpright.get(lch); (lchFirst = lchBlockStart), (lchLast = lchBlockEnd);
const cdItalic = covItalic.get(lch); }
const cdOblique = covOblique.get(lch); const lchStart = (lchFirst >>> 4) << 4;
if (cdUpright && cdItalic && cdOblique) { const lchEnd = ((lchLast >>> 4) << 4) + 0x10;
const [glyphName, typographicVariants, charVariantsUpright] = cdUpright;
const [, , charVariantsItalic] = cdItalic; for (let lch = lchStart; lch < lchEnd; lch++) {
const [, , charVariantsOblique] = cdOblique; const chName = ucdNames.get(lch);
blockResults.push({ const gc = ugc.get(lch);
lch, const cdUpright = covUpright.get(lch);
gc, const cdItalic = covItalic.get(lch);
charName: chName, const cdOblique = covOblique.get(lch);
inFont: true, if (cdUpright && cdItalic && cdOblique) {
glyphName: glyphName, const [glyphName, typographicVariants, charVariantsUpright] = cdUpright;
typographicVariants: typographicVariants, const [, , charVariantsItalic] = cdItalic;
charVariantsUpright, const [, , charVariantsOblique] = cdOblique;
charVariantsItalic, blockResults.push({
charVariantsOblique lch,
}); gc,
} else { charName: chName,
blockResults.push({ inFont: true,
lch, glyphName: glyphName,
gc, typographicVariants: typographicVariants,
charName: chName, charVariantsUpright,
inFont: false, charVariantsItalic,
glyphName: undefined charVariantsOblique
}); });
} } else {
processed.add(lch); blockResults.push({
lch,
gc,
charName: chName,
inFont: false,
glyphName: undefined
});
} }
} }
if (blockResults.length) { if (blockResults.length) {
result.push({ result.push({
name: block, name: block,