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 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
include : ForceUpright
include : spiro-outline
@ -749,7 +756,7 @@ glyph-block Symbol-Mosaic-Powerline : begin
corner pwlNear 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
include : ForceUpright
local fine : adviceBlackness 4
@ -770,31 +777,47 @@ glyph-block Symbol-Mosaic-Powerline : begin
flat pwlFar pwlMid
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
include : ForceUpright
include : refer-glyph : MangleName 'pwlTriangleRight'
include : FlipAround (MosaicWidth / 2) pwlMid
include : spiro-outline
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
include : ForceUpright
include : refer-glyph : MangleName 'pwlAngleRight'
include : FlipAround (MosaicWidth / 2) pwlMid
local fine : adviceBlackness 4
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
include : ForceUpright
local fine : adviceBlackness 4
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
include : ForceUpright
local fine : adviceBlackness 4
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
include : ForceUpright
include : spiro-outline
@ -803,7 +826,7 @@ glyph-block Symbol-Mosaic-Powerline : begin
corner pwlFar 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
include : ForceUpright
local fine : adviceBlackness 4
@ -812,7 +835,7 @@ glyph-block Symbol-Mosaic-Powerline : begin
flat pwlNear pwlTop
curl pwlFar pwlBot
create-glyph [MangleName 'pwlCornerTopLeft'] [MangleUnicode 0xE0BC] : glyph-proc
create-glyph [MangleName 'powerline/cornerTopLeft'] [MangleUnicode 0xE0BC] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : spiro-outline
@ -821,7 +844,7 @@ glyph-block Symbol-Mosaic-Powerline : begin
corner pwlFar pwlTop
corner (pwlNear + O) pwlBot
create-glyph [MangleName 'pwlSlashTopLeft'] [MangleUnicode 0xE0BD] : glyph-proc
create-glyph [MangleName 'powerline/slashTopLeft'] [MangleUnicode 0xE0BD] : glyph-proc
set-width MosaicWidth
include : ForceUpright
local fine : adviceBlackness 4
@ -830,29 +853,10 @@ glyph-block Symbol-Mosaic-Powerline : begin
flat pwlNear pwlBot
curl pwlFar pwlTop
create-glyph [MangleName 'pwlCornerBottomRight'] [MangleUnicode 0xE0BA] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : refer-glyph : MangleName 'pwlCornerTopLeft'
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
RotatedPowerline 'powerline/cornerBottomRight' 0xE0BA 'powerline/cornerTopLeft'
RotatedPowerline 'powerline/slashBottomRight' 0xE0BB 'powerline/slashTopLeft'
RotatedPowerline 'powerline/cornerTopRight' 0xE0BE 'powerline/cornerBottomLeft'
RotatedPowerline 'powerline/slashTopRight' 0xE0BF 'powerline/slashBottomLeft'
glyph-block Symbol-Mosaic-NotDef : begin

View file

@ -6,14 +6,23 @@ 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;
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++) {
if (processed.has(lch)) continue;
const chName = ucdNames.get(lch);
const gc = ugc.get(lch);
const cdUpright = covUpright.get(lch);
@ -43,9 +52,8 @@ module.exports = function (covUpright, covItalic, covOblique) {
glyphName: undefined
});
}
processed.add(lch);
}
}
if (blockResults.length) {
result.push({
name: block,