Changed default metrics.

This commit is contained in:
be5invis 2015-08-22 07:49:43 +08:00
parent 120b5b5315
commit 338f468d01
5 changed files with 33 additions and 27 deletions

View file

@ -218,17 +218,19 @@ define [buildFont para recursive] : begin {
define upmscale : fallback para.upmscale 1
set font.head.unitsPerEm 1000
set font.hhea.ascent [CAP + ACCENT * 1.5]
set font.'OS/2'.usWinAscent [CAP + ACCENT * 1.5]
set font.'OS/2'.sTypoAscender [CAP + ACCENT * 1.5]
set font.hhea.descent [DESCENDER - ACCENT * 0.5]
set font.'OS/2'.usWinDescent [Math.abs [DESCENDER - ACCENT * 0.5]]
set font.'OS/2'.sTypoDescender [DESCENDER - ACCENT * 0.5]
set font.hhea.lineGap [CAP * 0.2]
set font.'OS/2'.sTypoLineGap [CAP * 0.2]
set font.'OS/2'.sxHeight XH
set font.post.italicAnvle [0 - para.italicangle]
let [asc : 1250 * CAP / [CAP - DESCENDER]] [desc : 1250 * DESCENDER / [CAP - DESCENDER]] : begin {
set font.head.unitsPerEm 1000
set font.hhea.ascent asc
set font.'OS/2'.usWinAscent asc
set font.'OS/2'.sTypoAscender asc
set font.hhea.descent desc
set font.'OS/2'.usWinDescent [Math.abs desc]
set font.'OS/2'.sTypoDescender desc
set font.hhea.lineGap [CAP * 0.2]
set font.'OS/2'.sTypoLineGap [CAP * 0.2]
set font.'OS/2'.sxHeight XH
set font.post.italicAnvle [0 - para.italicangle]
}
### Necessary macros
define-macro glyph-construction : syntax-rules {

View file

@ -101,12 +101,14 @@ create-glyph 'parenLeft' : glyph-construction {
assign-unicode '('
local p 0.6
include : create-stroke
:.start-from [mix SB RIGHTSB parenInside] parenTop
:.set-width STROKE 0
:.curve-to [mix SB RIGHTSB parenOutside] [mix parenMid parenTop p] [mix SB RIGHTSB parenOutside] parenMid
:.curve-to [mix SB RIGHTSB parenOutside] [mix parenMid parenBot p] [mix SB RIGHTSB parenInside] parenBot
include : spiro {
widths.lhs
g4 [mix SB RIGHTSB parenInside] parenTop
quadcontrols 1 [1 - p]
g4 [mix SB RIGHTSB parenOutside] parenMid
quadcontrols 0 p
g4 [mix SB RIGHTSB parenInside] parenBot
}
}
create-glyph 'parenRight' : glyph-construction {

View file

@ -180,7 +180,7 @@ define [Glyph.prototype.apply-transform transform alsoAnchors] : begin {
}
define [Glyph.prototype.create-stroke] : begin {
local s : new Stroke
s.gizmo = [Object.create this.gizmo]
s.gizmo = (.x this.gizmo.x .y this.gizmo.y .xx this.gizmo.xx .xy this.gizmo.xy .yx this.gizmo.yx .yy this.gizmo.yy)
return s
}
define [Glyph.prototype.set-anchor id type x y mbx mby] : begin {

View file

@ -72,7 +72,9 @@ define [Stroke.prototype.heads-to x y] : begin {
return this
}
define [Stroke.prototype.start-from x y] : begin {
this.points = ([tp this.gizmo (.x x .y y .onCurve true)])
#local pt [tp this.gizmo (.x x .y y .onCurve true .subdivided false)]
#if [x === 250] : console.log x y this.gizmo pt
this.points = ([tp this.gizmo (.x x .y y .onCurve true .subdivided false)])
return this
}
Stroke.prototype.moveTo = Stroke.prototype.start-from

View file

@ -1,10 +1,10 @@
exports.transformPoint = function(tfm, pt){
return {
onCurve: pt.onCurve || false,
cubic: pt.cubic || false,
subdivided: pt.subdivided || false,
x : pt.x * tfm.xx + pt.y * tfm.yx + tfm.x,
y : pt.x * tfm.xy + pt.y * tfm.yy + tfm.y,
onCurve: pt.onCurve,
cubic: pt.cubic,
subdivided: pt.subdivided
y : pt.x * tfm.xy + pt.y * tfm.yy + tfm.y
}
}
exports.inverse = function(tfm){
@ -23,10 +23,10 @@ exports.untransform = function(tfm, pt){
var yy = pt.y - tfm.y
var denom = tfm.xx * tfm.yy - tfm.xy * tfm.yx
return {
onCurve: pt.onCurve || false,
cubic: pt.cubic || false,
subdivided: pt.subdivided || false,
x : (xx * tfm.yy - yy * tfm.yx) / denom,
y : (yy * tfm.xx - xx * tfm.xy) / denom,
onCurve: pt.onCurve,
cubic: pt.cubic,
subdivided: pt.subdivided
y : (yy * tfm.xx - xx * tfm.xy) / denom
}
}