Skip to content

Commit

Permalink
The remaining schematic symbols (be5invis#2383)
Browse files Browse the repository at this point in the history
* small gate

* and/or gate

* loops

* doc

---------

Co-authored-by: Belleve <belleve@typeof.net>
  • Loading branch information
Logo121 and be5invis authored Jun 18, 2024
1 parent 1938dd6 commit 5b2b359
Show file tree
Hide file tree
Showing 5 changed files with 203 additions and 12 deletions.
9 changes: 9 additions & 0 deletions changes/30.3.0.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
* Add separate variant selectors For Cyrillic Capital/Lower E (`VXAA`, `VXAB`).
* Add `unilateral-bottom-serifed` and `unilateral-bottom-inward-serifed` variants for Cyrillic Capital/Lower Ze (`cv69`, `cv70`).
* Add characters:
- SYMBOL FOR SAMARITAN SOURCE (`U+214F`).
- CURLY LOOP (`U+27B0`).
- DOUBLE CURLY LOOP (`U+27BF`).
- LEFT THIRD INDUCTOR (`U+1CC0B`) (Proposed for Unicode 16; L2/21-235).
- MIDDLE THIRD INDUCTOR (`U+1CC0C`) (Proposed for Unicode 16; L2/21-235).
- RIGHT THIRD INDUCTOR (`U+1CC0D`) (Proposed for Unicode 16; L2/21-235).
- LOGIC GATE OR (`U+1CC15`) (Proposed for Unicode 16; L2/21-235).
- LOGIC GATE AND (`U+1CC16`) (Proposed for Unicode 16; L2/21-235).
2 changes: 1 addition & 1 deletion packages/font-glyphs/src/letter/latin-ext/rams-horn.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ glyph-block Letter-Latin-Rams-Horn : begin
else : no-shape

if SLAB : begin
include : VSerif.dl SB (top - sw) (VJut * (sw / Stroke) - sw) fine
include : VSerif.dl SB (top - sw) (VJut * (sw / Stroke) - sw) fine
include : VSerif.dr RightSB (top - sw) (VJut * (sw / Stroke) - sw) fine

create-glyph 'ramshorn' 0x264 : glyph-proc
Expand Down
1 change: 1 addition & 0 deletions packages/font-glyphs/src/symbol/pictograph.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export : define [apply] : begin
run-glyph-module "./pictograph/iec-power-and-playback.mjs"
run-glyph-module "./pictograph/keyboard.mjs"
run-glyph-module "./pictograph/kome.mjs"
run-glyph-module "./pictograph/loops.mjs"
run-glyph-module "./pictograph/metric-marks.mjs"
run-glyph-module "./pictograph/musical.mjs"
run-glyph-module "./pictograph/powerline-and-gui.mjs"
Expand Down
54 changes: 54 additions & 0 deletions packages/font-glyphs/src/symbol/pictograph/loops.ptl
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
$$include '../../meta/macros.ptl'

import [mix linreg clamp fallback] from "@iosevka/util"
import [Box] from "@iosevka/geometry/box"

glyph-module

glyph-block Symbol-Pictograph-Loops : for-width-kinds WideWidth1
glyph-block-import CommonShapes
glyph-block-import Common-Derivatives
glyph-block-import Symbol-Geometric-Shared : GeometricDim

define Geom : GeometricDim MosaicUnitWidth MosaicWidth
define box : new Box Geom.Top Geom.Bot Geom.Left Geom.Right

define [LoopImpl bound nLoops sw _kX] : glyph-proc
local xDroop : (bound.right - bound.left) * (0.2 / nLoops)
local left : bound.left + xDroop
local right : bound.right - xDroop
local yTerm : bound.mixY (1 - 0.05 / nLoops)
local yInter : bound.mixY 0.9
local ySide : bound.mixY 0.4
local kX : fallback _kX 0.1

local loopPart {}
foreach [i : range 0 nLoops] : loopPart.push : list
g4.right.mid [mix left right (i / nLoops)] bound.top
g4 [mix left right ((i + 0.5) / nLoops)] yInter
g4.down.mid [mix left right ((i + 1 - kX) / nLoops)] ySide
arch.rhs bound.bot (sw -- sw)
g4.up.mid [mix left right ((i + kX) / nLoops)] ySide
g4 [mix left right ((i + 0.5) / nLoops)] yInter

include : dispiro
widths.rhs sw
g4 bound.left yTerm
* loopPart
g4.right.mid right bound.top
g4 bound.right yTerm

create-glyph [MangleName 'curlyLoop'] [MangleUnicode 0x27B0] : glyph-proc
set-width Geom.Width
include : LoopImpl box 1 GeometryStroke

create-glyph [MangleName 'doubleCurlyLoop'] [MangleUnicode 0x27BF] : glyph-proc
set-width Geom.Width
include : LoopImpl box 2 [AdviceStroke : 8 / MosaicWidthScalar] 0.05

create-glyph [MangleName 'samaritanSource'] [MangleUnicode 0x214F] : glyph-proc
set-width Geom.Width
local lowBox : new Box (XH / 2) 0 SB (MosaicWidth - SB)
include : LoopImpl lowBox 3 [AdviceStroke : 10 / MosaicWidthScalar]

include : FlipAround lowBox.xMid lowBox.yMid
149 changes: 138 additions & 11 deletions packages/font-glyphs/src/symbol/pictograph/schematic.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ glyph-block Symbol-Pictograph-Schematic : for-width-kinds WideWidth4 : begin
corner [mix x1 x2 (-1)] [mix y1 y2 (-1)]
corner [mix x1 x2 2 ] [mix y1 y2 2 ]

define gateSize : MosaicHeight / 2
define gateSize : MosaicHeight / 4 * MosaicWidthScalar
define gateBot : midy - gateSize
define gateTop : midy + gateSize
define ringSize : Math.min (Geom.Size * 0.5) (MosaicWidth / 6)
Expand Down Expand Up @@ -186,6 +186,60 @@ glyph-block Symbol-Pictograph-Schematic : for-width-kinds WideWidth4 : begin
MaskLeft : midx + [HSwToV : 0.5 * boxDrawingStroke]
LineExt down (top - 0.5 * halfPeriod) midx top boxDrawingStroke

do "Coil"
glyph-block-import Symbol-Mosaic-Split-Graphic : Multicell
local multicell : Multicell MosaicWidth

define amplitude : Geom.Size * 0.8

define [CoilImpl top bot left right] : begin
local mid1 : mix left right (1 / 3)
local mid2 : mix left right (2 / 3)
local midy : mix bot top 0.5

local yTerm : midy + boxDrawingStroke / 2
local yTop : midy + amplitude
local yBot : midy - amplitude
local yInter : mix yBot yTop 0.95
local ySide : mix yBot yTop 0.45
local kX 0.1
local kX2 0.15
local kX3 : StrokeWidthBlend 0.24 0.21

return : dispiro
widths.rhs boxDrawingStroke
straight.right.start left yTerm
g4 [mix left mid1 kX3] [mix yTerm yTop 0.4]
g4.right.mid [mix left mid1 (0.5 + kX2)] yTop
g4 mid1 yInter
g4.down.mid [mix mid1 mid2 (0.5 - kX)] ySide
arch.rhs yBot (sw -- boxDrawingStroke)
g4.up.mid [mix left mid1 (0.5 + kX)] ySide
g4 mid1 yInter
flat [mix mid1 mid2 (0.5 - kX2)] yTop
curl [mix mid1 mid2 (0.5 + kX2)] yTop
g4 mid2 yInter
g4.down.mid [mix mid2 right (0.5 - kX)] ySide
arch.rhs yBot (sw -- boxDrawingStroke)
g4.up.mid [mix mid1 mid2 (0.5 + kX)] ySide
g4 mid2 yInter
g4.right.mid [mix mid2 right (0.5 - kX2)] yTop
g4 [mix right mid2 kX3] [mix yTerm yTop 0.4]
straight.right.end right yTerm

create-glyph [MangleName 'inductorLeftThird'] [MangleUnicode 0x1CC0B] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : multicell.Split top bottom left right 1 3 0 0 1 CoilImpl
create-glyph [MangleName 'inductorMiddleThird'] [MangleUnicode 0x1CC0C] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : multicell.Split top bottom left right 1 3 0 1 1 CoilImpl
create-glyph [MangleName 'inductorRightThird'] [MangleUnicode 0x1CC0D] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : multicell.Split top bottom left right 1 3 0 2 1 CoilImpl

do "Diode"
define diodeGap : MosaicWidth / 9
define diodeLeft : left + diodeGap
Expand Down Expand Up @@ -281,17 +335,36 @@ glyph-block Symbol-Pictograph-Schematic : for-width-kinds WideWidth4 : begin
include : InvertRingAt (left + ringSize) midy
include : InvertRingAt (right - ringSize) midy

define [InvertedInputImpl spread] : glyph-proc
local limit : MosaicHeight / 2 - ringSize
local spread2 : Math.min (spread - boxDrawingStroke / 2) limit

include : InvertRingAt (right - ringSize) (midy + spread2)
include : InvertRingAt (right - ringSize) (midy - spread2)

if (spread >= MosaicHeight / 2) : begin
include : difference
HBar.t left (right - ringSize) top boxDrawingStroke
InvertRingAt (right - ringSize) (midy + spread2) 1
include : difference
HBar.b left (right - ringSize) bottom boxDrawingStroke
InvertRingAt (right - ringSize) (midy - spread2) 1
: else : begin
include : HBar.t left midx top boxDrawingStroke
include : HBar.b left midx bottom boxDrawingStroke
include : VBar.m midx (midy + spread - boxDrawingStroke) top boxDrawingStroke
include : VBar.m midx bottom (midy - spread + boxDrawingStroke) boxDrawingStroke
include : difference
HBar.t midx (right - ringSize) (midy + spread) boxDrawingStroke
InvertRingAt (right - ringSize) (midy + spread2) 1
include : difference
HBar.b midx (right - ringSize) (midy - spread) boxDrawingStroke
InvertRingAt (right - ringSize) (midy - spread2) 1

create-glyph [MangleName 'invertedInputs'] [MangleUnicode 0x1CC17] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : InvertRingAt (right - ringSize) (top - ringSize)
include : InvertRingAt (right - ringSize) (bottom + ringSize)
include : difference
HBar.t left (right - ringSize) top boxDrawingStroke
InvertRingAt (right - ringSize) (top - ringSize) 1
include : difference
HBar.b left (right - ringSize) bottom boxDrawingStroke
InvertRingAt (right - ringSize) (bottom + ringSize) 1
include : InvertedInputImpl (gateSize - [if (MosaicWidthScalar < 2) (ringSize - boxDrawingStroke / 2) 0])

create-glyph [MangleName 'invertedOutput'] [MangleUnicode 0x1CC18] : glyph-proc
set-width MosaicWidth
Expand All @@ -304,11 +377,65 @@ glyph-block Symbol-Pictograph-Schematic : for-width-kinds WideWidth4 : begin
set-width MosaicWidth
include : ForceUpright
include : HBar.m left midx midy boxDrawingStroke
include : TriangleShape midx bottom midx top right midy boxDrawingStroke
include : TriangleShape midx gateBot midx gateTop right midy boxDrawingStroke

create-glyph [MangleName 'invertedBufferGate'] [MangleUnicode 0x1CC1A] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : HBar.m left (midx - ringSize * 2 + fineStroke / 2) midy boxDrawingStroke
include : InvertRingAt (midx - ringSize) midy
include : TriangleShape midx bottom midx top right midy boxDrawingStroke
include : TriangleShape midx gateBot midx gateTop right midy boxDrawingStroke

do "Logic Gates"
define andCurlX : Math.max midx (right - gateSize)
define leftOX : left - OX
define orCurlX1 : mix leftOX right 0.15
define orCurlX2 : mix leftOX right 0.4

create-glyph [MangleName 'andGate'] [MangleUnicode 0x1CC16] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : VBar.l left gateBot gateTop boxDrawingStroke

include : dispiro
widths.lhs boxDrawingStroke
flat left gateBot
curl (right - andCurlX) gateBot
archv
g4 right midy
arcvh
flat (right - andCurlX) gateTop
corner left gateTop

create-glyph [MangleName 'orGate'] [MangleUnicode 0x1CC15] : glyph-proc
set-width MosaicWidth
include : ForceUpright
include : intersection [Rect gateTop gateBot leftOX right]
dispiro
widths.lhs boxDrawingStroke
g4 leftOX gateTop
quadControls 1 0.3
g4 orCurlX1 midy
quadControls 0 0.7
g4 leftOX gateBot
include : difference
union
intersection [MaskBelow midy] : dispiro
widths.lhs boxDrawingStroke
flat leftOX gateBot
curl orCurlX2 gateBot
quadControls 0.7 0
g4 right midy
intersection [MaskAbove midy] : dispiro
widths.rhs boxDrawingStroke
flat leftOX gateTop
curl orCurlX2 gateTop
quadControls 0.7 0
g4 right midy
spiro-outline
g4 leftOX gateTop
quadControls 1 0.3
g4 orCurlX1 midy
quadControls 0 0.7
g4 leftOX gateBot
close

0 comments on commit 5b2b359

Please sign in to comment.