Added several geometric shapes: /blacksquare, /dottedcircle, etc.

This commit is contained in:
be5invis 2015-08-09 05:47:48 +08:00
parent efa768e836
commit efabd8597e
5 changed files with 97 additions and 9 deletions

View File

@ -1,15 +1,22 @@
###### COMMON SHAPES
define [Ring u d l r] : begin {
define [Ring u d l r transformShiftOnly] : begin {
local my [[u + d] / 2]
local mx [[l + r] / 2]
local s : new Stroke
:.set-transform globalTransform
:.start-from mx d
if [not transformShiftOnly] : s.set-transform globalTransform
s.start-from mx d
:.cubic-to [mx + [l - mx] * CKAPPA] d l [my + [d - my] * CKAPPA] l my
:.cubic-to l [my + [u - my] * CKAPPA] [mx + [l - mx] * CKAPPA] u mx u
:.cubic-to [mx + [r - mx] * CKAPPA] u r [my + [u - my] * CKAPPA] r my
:.cubic-to r [my + [d - my] * CKAPPA] [mx + [r - mx] * CKAPPA] d mx d
if transformShiftOnly : begin {
local (.x mx1 .y my1) [tp globalTransform (.x mx .y my)]
foreach p [items-of s.points] : begin {
set p.x : p.x + mx1 - mx
set p.y : p.y + my1 - my
}
}
return s.points
}
define [RingAt x y r] : Ring [y + r] [y - r] [x - r] [x + r]

View File

@ -123,11 +123,7 @@ create-glyph 'g' : glyph-construction {
assign-unicode 'g'
include pMarks
include : list {
Ring XO [XH * GBARPOS] SB [RIGHTSB - 0.3 * SB] SMALLSMOOTH
Ring [XO - STROKE] [[XH * GBARPOS] + STROKE] [SB + STROKE] [[RIGHTSB - 0.3 * SB] - STROKE] [SMALLSMOOTH - STROKE]
}
reverse-last
include : smallo XH [XH * GBARPOS - O] SB [RIGHTSB - 0.3 * SB]
local gleftx [SB * 0.8 + O]
local grightx [RIGHTSB + SB * 0.1 - O]

View File

@ -1,5 +1,87 @@
###### GEOMETRIC SHAPES
### Standard geometric shapes
define squareRadius : [RIGHTSB - SB] / 2
define [hollowScale w] : [w - [adviceBlackness 5]] / w
define [hollow newid unicode oldid zx zy] : create-glyph newid : glyph-construction {
assign-unicode unicode
include glyphs.(oldid)
reverse-last
local zoom : hollowScale squareRadius
include : FlipAround MIDDLE parenMid [fallback zx zoom] [fallback zy zx zoom]
include glyphs.(oldid)
}
create-glyph 'blacksquare' : glyph-construction {
assign-unicode 0x25A0
start-from SB [parenMid + squareRadius]
line-to RIGHTSB [parenMid + squareRadius]
line-to RIGHTSB [parenMid - squareRadius]
line-to SB [parenMid - squareRadius]
}
create-glyph 'blackrectangle' : glyph-construction {
assign-unicode 0x25AC
start-from SB [parenMid + squareRadius / 1.5]
line-to RIGHTSB [parenMid + squareRadius / 1.5]
line-to RIGHTSB [parenMid - squareRadius / 1.5]
line-to SB [parenMid - squareRadius / 1.5]
}
create-glyph 'blacklongrectangle' : glyph-construction {
assign-unicode 0x25AE
start-from SB [parenMid + squareRadius * 1.5]
line-to RIGHTSB [parenMid + squareRadius * 1.5]
line-to RIGHTSB [parenMid - squareRadius * 1.5]
line-to SB [parenMid - squareRadius * 1.5]
}
create-glyph 'blacktriangleup' : glyph-construction {
assign-unicode 0x25B2
start-from MIDDLE [parenMid + squareRadius]
line-to RIGHTSB [parenMid - squareRadius]
line-to SB [parenMid - squareRadius]
}
create-glyph 'blackdiamond' : glyph-construction {
assign-unicode 0x25C6
start-from MIDDLE [parenMid + squareRadius]
line-to RIGHTSB parenMid
line-to MIDDLE [parenMid - squareRadius]
line-to SB parenMid
}
create-glyph 'blacktriangledown' : glyph-construction {
assign-unicode 0x25BC
start-from MIDDLE [parenMid - squareRadius]
line-to SB [parenMid + squareRadius]
line-to RIGHTSB [parenMid + squareRadius]
}
create-glyph 'blackcircle' : glyph-construction {
assign-unicode 0x25CF
include : list : Ring [parenMid + squareRadius] [parenMid - squareRadius] SB RIGHTSB
}
create-glyph 'dottedcircle' : glyph-construction {
assign-unicode 0x25CC
local n 12
local fine : [adviceBlackness 5] / 2
foreach j [range 0 n] : begin {
local angle : Math.PI * 2 * j / n
local cx : MIDDLE + [RIGHTSB - MIDDLE] * [Math.cos angle]
local cy : [XH / 2] + [RIGHTSB - MIDDLE] * [Math.sin angle]
include : list : Ring [cy + fine] [cy - fine] [cx - fine] [cx + fine] true
}
apply-transform : Upright
apply-transform : Translate 0 [parenMid - [XH / 2]]
apply-transform : Italify
include eMarks
foreach k [items-of : Object.keys this.anchors] : begin {
set this.anchors.(k).x : this.anchors.(k).x + [parenMid - [XH / 2]] * globalTransform.yx
set this.anchors.(k).y : this.anchors.(k).y + [parenMid - [XH / 2]]
}
}
hollow 'whitesquare' 0x25A1 'blacksquare'
hollow 'whiterectangle' 0x25AD 'blackrectangle' [hollowScale squareRadius] [hollowScale [squareRadius / 1.5]]
hollow 'whitelongrectangle' 0x25AF 'blacklongrectangle' [hollowScale squareRadius] [hollowScale [squareRadius * 1.5]]
hollow 'whitecircle' 0x25CB 'blackcircle'
hollow 'whitebullet' 0x25E6 'bullet' [hollowScale [PERIODSIZE - O]]
hollow 'whitediamond' 0x25C7 'blackdiamond'
### Blocks
create-glyph 'fullblock' : glyph-construction {
assign-unicode 0x2588

View File

@ -40,7 +40,7 @@ define regular (
.family 'Iosevka'
.style 'Regular'
.weight 400
.version 'r0.0.14'
.version 'r0.0.15'
.variantSelector (.)
.copyright 'Copyright (c) 2015 Belleve Invis.'
)

View File

@ -3,6 +3,9 @@
<meta charset="utf-8">
<title>Iosevka</title>
<style>
html {
font-size: 12px;
}
@font-face {
font-family: IosevkaWEB;
src: url(iosevka-regular.woff) format(woff), url(iosevka-regular.ttf) format(truetype);