Added /venus, /earth, /mars and /quaver. It's almost there!

This commit is contained in:
be5invis 2015-08-12 03:39:49 +08:00
parent af9ba2e094
commit 68f29a7725
6 changed files with 55 additions and 18 deletions

View File

@ -45,6 +45,7 @@ define [buildFont para recursive] : begin {
define AHOOK para.ahook define AHOOK para.ahook
define SHOOK para.shook define SHOOK para.shook
define RHOOK para.rhook define RHOOK para.rhook
define HOOKX para.hookx
define SMOOTH para.smooth define SMOOTH para.smooth
define SMALLSMOOTH para.smallsmooth define SMALLSMOOTH para.smallsmooth
define STROKE para.stroke define STROKE para.stroke

View File

@ -26,7 +26,7 @@ define [createCircledGlyphs records] : if [not recursive] : begin {
define [createSuperscripts records] : if [not recursive] : begin { define [createSuperscripts records] : if [not recursive] : begin {
local pendingGlyphs : records.map : [record] -> record.1 local pendingGlyphs : records.map : [record] -> record.1
local miniatureFont : Miniature pendingGlyphs 3.7 0.7 local miniatureFont : Miniature pendingGlyphs 3.7 0.7
foreach (unicode glyphid) [items-of records] : create-glyph ['superscript_' + glyphid] : glyph-construction { foreach (unicode glyphid) [items-of records] : create-glyph ['superscript' + glyphid] : glyph-construction {
if unicode : assign-unicode unicode if unicode : assign-unicode unicode
include : create-glyph : glyph-construction { include : create-glyph : glyph-construction {
include miniatureFont.(glyphid) include miniatureFont.(glyphid)
@ -41,7 +41,7 @@ define [createSuperscripts records] : if [not recursive] : begin {
define [createSubscripts records] : if [not recursive] : begin { define [createSubscripts records] : if [not recursive] : begin {
local pendingGlyphs : records.map : [record] -> record.1 local pendingGlyphs : records.map : [record] -> record.1
local miniatureFont : Miniature pendingGlyphs 3.7 0.7 local miniatureFont : Miniature pendingGlyphs 3.7 0.7
foreach (unicode glyphid) [items-of records] : create-glyph ['subscript_' + glyphid] : glyph-construction { foreach (unicode glyphid) [items-of records] : create-glyph ['subscript' + glyphid] : glyph-construction {
if unicode : assign-unicode unicode if unicode : assign-unicode unicode
include : create-glyph : glyph-construction { include : create-glyph : glyph-construction {
include miniatureFont.(glyphid) include miniatureFont.(glyphid)
@ -56,10 +56,11 @@ define [createSubscripts records] : if [not recursive] : begin {
define [createFractions records] : if [not recursive] : begin { define [createFractions records] : if [not recursive] : begin {
local pendingGlyphs : [records.map : [record] -> record.1].concat : records.map : [record] -> record.2 local pendingGlyphs : [records.map : [record] -> record.1].concat : records.map : [record] -> record.2
local miniatureFont : Miniature pendingGlyphs 4 0.7 local miniatureFont : Miniature pendingGlyphs 4 0.6
foreach (unicode numid denid height) [items-of records] : create-glyph ['fraction_' + numid + '_' + denid] : glyph-construction { foreach (unicode numid denid height) [items-of records] : create-glyph [numid + 'over' + denid] : glyph-construction {
if unicode : assign-unicode unicode if unicode : assign-unicode unicode
local fine : adviceBlackness 3.7 local fine : adviceBlackness 3.7
local dist : XH * 0.4
include : create-glyph : glyph-construction { include : create-glyph : glyph-construction {
include : create-glyph : glyph-construction { include : create-glyph : glyph-construction {
include miniatureFont.(numid) include miniatureFont.(numid)
@ -70,7 +71,7 @@ define [createFractions records] : if [not recursive] : begin {
apply-transform : Italify apply-transform : Italify
} }
apply-transform : Upright apply-transform : Upright
apply-transform : Translate 0 [CAP + fine * 4] apply-transform : Translate 0 [CAP + dist]
apply-transform : Italify apply-transform : Italify
include : create-glyph : glyph-construction { include : create-glyph : glyph-construction {
include miniatureFont.(denid) include miniatureFont.(denid)
@ -81,8 +82,8 @@ define [createFractions records] : if [not recursive] : begin {
apply-transform : Italify apply-transform : Italify
} }
apply-transform : Upright apply-transform : Upright
apply-transform : Translate [-MIDDLE] [-CAP - fine * 2] apply-transform : Translate [-MIDDLE] [-CAP - dist / 2]
apply-transform : Scale 0.5 apply-transform : Scale 0.55
apply-transform : Translate MIDDLE parenMid apply-transform : Translate MIDDLE parenMid
apply-transform : Italify apply-transform : Italify
} }
@ -274,8 +275,8 @@ createFractions : list {
list 0x215E 'seven' 'eight' list 0x215E 'seven' 'eight'
list 0x2189 'zero' 'three' list 0x2189 'zero' 'three'
# care-of # care-of
list 0x2105 'c' 'o' XH list 0x2105 'C' 'O'
list 0x2106 'c' 'u' XH list 0x2106 'C' 'U'
# Powerline LN symbol # Powerline LN symbol
list 0xE0A1 'L' 'N' list 0xE0A1 'L' 'N'
} }
@ -293,11 +294,11 @@ define [doubleSuperscript a b] : glyph-construction {
} }
create-glyph 'trademark' : glyph-construction { create-glyph 'trademark' : glyph-construction {
assign-unicode 0x2122 assign-unicode 0x2122
include : doubleSuperscript glyphs.superscript_T glyphs.superscript_M include : doubleSuperscript glyphs.superscriptT glyphs.superscriptM
} }
create-glyph 'servicemark' : glyph-construction { create-glyph 'servicemark' : glyph-construction {
assign-unicode 0x2120 assign-unicode 0x2120
include : doubleSuperscript glyphs.superscript_S glyphs.superscript_M include : doubleSuperscript glyphs.superscriptS glyphs.superscriptM
} }
# Build accented glyphs # Build accented glyphs

View File

@ -660,7 +660,7 @@ create-glyph 'longs.upright' : glyph-construction {
:.heads-to UPWARD :.heads-to UPWARD
:.set-width HALFSTROKE HALFSTROKE :.set-width HALFSTROKE HALFSTROKE
:.line-to MIDDLE [CAP - SHOOK * 1.4] :.line-to MIDDLE [CAP - SHOOK * 1.4]
:.arc-vh-to [MIDDLE + SHOOK * 2] [CAP - HALFSTROKE - O * 6] :.arc-vh-to [MIDDLE + HOOKX * 2] [CAP - HALFSTROKE - O * 6]
:.heads-to RIGHTWARD :.heads-to RIGHTWARD
} }
define [eshHook attach] : glyph-construction { define [eshHook attach] : glyph-construction {

View File

@ -1,21 +1,22 @@
###### GEOMETRIC SHAPES ###### GEOMETRIC SHAPES
### Arrowheads ### Arrowheads
let [arrowSize : [RIGHTSB - SB] / 3] [halfstroke : [adviceBlackness 4] / 2] [fine : adviceBlackness 4.5] [arrowTop : mix parenMid parenTop 0.75] [arrowBot : mix parenMid parenBot 0.75] : begin { define (ArrowHead ArrowShape) : let [arrowSize : [RIGHTSB - SB] / 3] [halfstroke : [adviceBlackness 4] / 2] [fine : adviceBlackness 4.5] [arrowTop : mix parenMid parenTop 0.75] [arrowBot : mix parenMid parenBot 0.75] : begin {
define [ArrowHead x1 y1 x2 y2] : create-glyph : glyph-construction { define [ArrowHead x1 y1 x2 y2 _size] : create-glyph : glyph-construction {
local size : fallback _size arrowSize
set this.gizmo : Translate 0 0 set this.gizmo : Translate 0 0
include : create-stroke include : create-stroke
:.start-from 0 0 :.start-from 0 0
:.heads-to UPWARD :.heads-to UPWARD
:.set-width 0 fine :.set-width 0 fine
:.line-to [arrowSize * 1] arrowSize :.line-to [size * 1] size
:.set-width 0 fine :.set-width 0 fine
:.set-samples 1 :.set-samples 1
include : create-stroke include : create-stroke
:.start-from 0 0 :.start-from 0 0
:.heads-to DOWNWARD :.heads-to DOWNWARD
:.set-width fine 0 :.set-width fine 0
:.line-to [arrowSize * 1] [-arrowSize] :.line-to [size * 1] [-size]
:.set-width fine 0 :.set-width fine 0
:.set-samples 1 :.set-samples 1
apply-transform : Translate O 0 apply-transform : Translate O 0
@ -24,10 +25,10 @@ let [arrowSize : [RIGHTSB - SB] / 3] [halfstroke : [adviceBlackness 4] / 2] [fin
apply-transform : Rotate : Math.atan2 [yo - yt] [xo - xt] apply-transform : Rotate : Math.atan2 [yo - yt] [xo - xt]
apply-transform : Translate xt yt apply-transform : Translate xt yt
} }
define [ArrowShape x1 y1 x2 y2] : glyph-construction { define [ArrowShape x1 y1 x2 y2 size] : glyph-construction {
local mag : Math.hypot [y2 - y1] [x2 - x1] local mag : Math.hypot [y2 - y1] [x2 - x1]
local p : [mag - halfstroke * 1.1] / mag local p : [mag - halfstroke * 1.1] / mag
include : ArrowHead x1 y1 x2 y2 include : ArrowHead x1 y1 x2 y2 size
include : create-stroke include : create-stroke
:.start-from x1 y1 :.start-from x1 y1
:.set-width halfstroke halfstroke :.set-width halfstroke halfstroke
@ -54,6 +55,8 @@ let [arrowSize : [RIGHTSB - SB] / 3] [halfstroke : [adviceBlackness 4] / 2] [fin
arrow 'arrowupright' 0x2197 SB arrowBot RIGHTSB arrowTop arrow 'arrowupright' 0x2197 SB arrowBot RIGHTSB arrowTop
arrow 'arrowdownright' 0x2198 SB arrowTop RIGHTSB arrowBot arrow 'arrowdownright' 0x2198 SB arrowTop RIGHTSB arrowBot
arrow 'arrowdownleft' 0x2199 RIGHTSB arrowTop SB arrowBot arrow 'arrowdownleft' 0x2199 RIGHTSB arrowTop SB arrowBot
* (ArrowHead ArrowShape)
} }
### Standard geometric shapes ### Standard geometric shapes
let : begin { let : begin {

View File

@ -51,3 +51,34 @@ let : begin {
line-to SB parenMid line-to SB parenMid
} }
} }
# planets
create-glyph 'venus' : glyph-construction { # also female
assign-unicode 0x2640
local obot : operTop - RIGHTSB + SB
include : smallo operTop obot SB RIGHTSB OPERATORSTROKE
include : VBar MIDDLE operBot obot OPERATORSTROKE
include : HBar SB RIGHTSB [mix operBot [obot + OPERATORSTROKE] 0.5] OPERATORSTROKE
}
turned 'earth' 0x2641 'venus' MIDDLE parenMid
create-glyph 'mars' : glyph-construction { # also female
assign-unicode 0x2642
local otop : operBot + RIGHTSB - SB
include : smallo otop operBot SB RIGHTSB OPERATORSTROKE
include : ArrowShape MIDDLE [otop - OPERATORSTROKE / 3] MIDDLE operTop [[RIGHTSB - SB] * 0.4]
}
# music notes
create-glyph 'quaver' : glyph-construction {
assign-unicode 0x266A
local fine : adviceBlackness 5
local noteSize : MIDDLE + fine / 2 - SB
local y1 : mix operBot operTop 0.8
local y2 : mix operBot operTop 0.4
local x3 : mix SB RIGHTSB 0.7
local y3 : mix operBot operTop 0.25
include : list : Ring [operBot + 0.8 * noteSize] operBot SB [SB + noteSize]
include : VBarRight [SB + noteSize] [operBot + 0.4 * noteSize] operTop fine
include : create-stroke
:.start-from [SB + noteSize] operTop
:.set-width 0 fine
:.cubic-to RIGHTSB y1 RIGHTSB y2 x3 y3
}

View File

@ -18,6 +18,7 @@ define regular (
.ahook 130 .ahook 130
.shook 100 .shook 100
.rhook 100 .rhook 100
.hookx 100
.smooth 192 .smooth 192
.smallsmooth 242 .smallsmooth 242