From 822d0dd285d245eb8f38159ad6225b921b1593f9 Mon Sep 17 00:00:00 2001 From: be5invis Date: Sun, 20 Dec 2015 15:56:52 +0800 Subject: [PATCH] Added centered tildes. --- glyphs/autobuilds.ptl | 2 ++ glyphs/common-shapes.ptl | 2 +- glyphs/overmarks.ptl | 5 ++++- support/fairify.js | 7 +++---- support/spirokit.ptl | 4 ++-- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/glyphs/autobuilds.ptl b/glyphs/autobuilds.ptl index 491a46a..83b7479 100644 --- a/glyphs/autobuilds.ptl +++ b/glyphs/autobuilds.ptl @@ -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 diff --git a/glyphs/common-shapes.ptl b/glyphs/common-shapes.ptl index 849d6ab..46e4ad1 100644 --- a/glyphs/common-shapes.ptl +++ b/glyphs/common-shapes.ptl @@ -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 diff --git a/glyphs/overmarks.ptl b/glyphs/overmarks.ptl index a28a8c1..586c200 100644 --- a/glyphs/overmarks.ptl +++ b/glyphs/overmarks.ptl @@ -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 diff --git a/support/fairify.js b/support/fairify.js index 41bb99c..4652811 100644 --- a/support/fairify.js +++ b/support/fairify.js @@ -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; } diff --git a/support/spirokit.ptl b/support/spirokit.ptl index e499361..a3194c0 100644 --- a/support/spirokit.ptl +++ b/support/spirokit.ptl @@ -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