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

View file

@ -101,12 +101,14 @@ create-glyph 'parenLeft' : glyph-construction {
assign-unicode '(' assign-unicode '('
local p 0.6 local p 0.6
include : spiro {
include : create-stroke widths.lhs
:.start-from [mix SB RIGHTSB parenInside] parenTop g4 [mix SB RIGHTSB parenInside] parenTop
:.set-width STROKE 0 quadcontrols 1 [1 - p]
:.curve-to [mix SB RIGHTSB parenOutside] [mix parenMid parenTop p] [mix SB RIGHTSB parenOutside] parenMid g4 [mix SB RIGHTSB parenOutside] parenMid
:.curve-to [mix SB RIGHTSB parenOutside] [mix parenMid parenBot p] [mix SB RIGHTSB parenInside] parenBot quadcontrols 0 p
g4 [mix SB RIGHTSB parenInside] parenBot
}
} }
create-glyph 'parenRight' : glyph-construction { 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 { define [Glyph.prototype.create-stroke] : begin {
local s : new Stroke 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 return s
} }
define [Glyph.prototype.set-anchor id type x y mbx mby] : begin { 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 return this
} }
define [Stroke.prototype.start-from x y] : begin { 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 return this
} }
Stroke.prototype.moveTo = Stroke.prototype.start-from Stroke.prototype.moveTo = Stroke.prototype.start-from

View file

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