Added centered tildes.

This commit is contained in:
be5invis 2015-12-20 15:56:52 +08:00
parent 036f653a87
commit 822d0dd285
5 changed files with 12 additions and 8 deletions

View File

@ -230,6 +230,8 @@ symbol-block "Manual Precomposites"
composite 'asciicaret' glyphs.space glyphs.circumflexAbove MarkZoom [into-unicode '^']
composite 'latin1acute' glyphs.space glyphs.acuteAbove MarkZoom [into-unicode 0xB4]
composite 'degree' glyphs.space glyphs.ringAbove MarkZoom [into-unicode 0xB0]
composite 'asciitilde.centered' glyphs.asciitilde [Upright] [Translate 0 (parenMid - XH - ACCENT)] [Italify]
define [suggestName name] : begin
if glyphs.(name) : begin

View File

@ -506,7 +506,7 @@ define [CyrDescender x shift] : glyph-construction
# Derived subfonts
define [refair g] : begin
foreach [j : range 0 g.contours.length] : begin
set g.contours.(j) : fairify g.contours.(j) globalTransform
set g.contours.(j) : fairify g.contours.(j) globalTransform g.dense
return nothing
define [Fork gs params] : begin
local p : Object.create params

View File

@ -113,13 +113,16 @@ symbol-block 'Above marks'
local tildeWaveEnd : [smoothreg {16 60 90} {(-0.025) (-0.05) 0}] (markHalfStroke * 2)
include : dispiro
widths.center (markHalfStroke * 2)
widths.center (markHalfStroke * 2 / CONTRAST)
g2 leftEnd [mix tbot ttop tildeWaveEnd]
bezcontrols.absolute
* [mix leftEnd rightEnd tildeWaveX]; * [mix bot top tildeWave]
* [mix leftEnd rightEnd (1 - tildeWaveX)]; * [mix bot top (1 - tildeWave)]
* 128; * important; * g2
g2 rightEnd [mix tbot ttop (1 - tildeWaveEnd)]
end [function : set this.dense true]
set this.dense true
create-glyph 'macronAbove' : glyph-construction
set-width 0

View File

@ -178,8 +178,7 @@ function enoughRotate(bef, z0, z1, z2, aft){
return !((angleRotatedBefore < SMALLANGLE || angleRotatedBefore > Math.PI - SMALLANGLE)
|| (angleRotatedAfter < SMALLANGLE || angleRotatedAfter > Math.PI - SMALLANGLE))
}
function fairify(scurve, gizmo, angles){
angles = angles || ANGLES
function fairify(scurve, gizmo, denseQ){
for(var j = 0; j < scurve.length; j++){
scurve[j] = Transform.untransform(gizmo, scurve[j])
}
@ -244,7 +243,7 @@ function fairify(scurve, gizmo, angles){
var inflect = ((z0.y-z2.y)*(za.x-z0.x) + (z2.x-z0.x)*(za.y-z0.y)) * ((z0.y-z2.y)*(zb.x-z0.x) + (z2.x-z0.x)*(zb.y-z0.y));
if(inflect < 0) isInflection = true;
};
if((z1.inflect || isInflection) && enoughRotate(lastmark, z0, z1, z2, nextmark)) {
if((z1.inflect || isInflection) && (denseQ || enoughRotate(lastmark, z0, z1, z2, nextmark))) {
z1.mark = true;
}
}
@ -268,7 +267,7 @@ function fairify(scurve, gizmo, angles){
var angle = Math.abs(angle0 / Math.PI * segments % 1);
var angleRotatedBefore = Math.abs(angleBetween(z1, lastmark, z1, z0));
var angleRotatedAfter = Math.abs(angleBetween(z1, nextmark, z1, z2));
if(!enoughRotate(lastmark, z0, z1, z2, nextmark)
if(!(denseQ || enoughRotate(lastmark, z0, z1, z2, nextmark))
|| !(Math.abs(Math.abs(angle0) - Math.PI / 2) <= SMALL || angle <= SMALL || angle >= 1 - SMALL)){
z1.remove = z0.remove = z2.remove = true;
}

View File

@ -165,7 +165,7 @@ export : define [SetupBuilders args] : begin
lhs.0.type = rhs.0.type = lhs.(lhs.length - 1).type = rhs.(rhs.length - 1).type = 'corner'
libspiro.spiroToBezierOnContext [lhs.concat : rhs.reverse] true g QUAD PRECISION
if ([not s.unfair] && [not para.unfair]) : foreach [j : range 0 g.contours.length] : begin
set g.contours.(j) : fairify g.contours.(j) globalTransform s.angles
set g.contours.(j) : fairify g.contours.(j) globalTransform s.dense
set g.knots knots
set g.lhsknots lhs
set g.rhsknots rhs
@ -177,7 +177,7 @@ export : define [SetupBuilders args] : begin
libspiro.spiroToBezierOnContext knots closed g QUAD PRECISION
foreach af [items-of lastafs] : if af : af.call g
if [not para.unfair] : foreach [j : range 0 g.contours.length] : begin
set g.contours.(j) : fairify g.contours.(j) (g.fairGizmo || g.gizmo) g.angles
set g.contours.(j) : fairify g.contours.(j) (g.fairGizmo || g.gizmo) g.dense
this.include g
return [object