Skip to content

Commit 1f0a4de

Browse files
authored
Add chars
- CAUTION SIGN (`U+2621`) (#2935). - WARNING SIGN (`U+26A0`) (#2935).
1 parent d540038 commit 1f0a4de

File tree

5 files changed

+115
-17
lines changed

5 files changed

+115
-17
lines changed

changes/33.3.4.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
- COMBINING OPEN MARK BELOW (`U+1AB7`).
33
- COMBINING DOUBLE OPEN MARK BELOW (`U+1AB8`).
44
- SUN (`U+2609`) (#2935).
5+
- CAUTION SIGN (`U+2621`) (#2935).
56
- PERMANENT PAPER SIGN (`U+267E`) (#2935).
67
- BLACK CIRCLE WITH WHITE DOT RIGHT (`U+2688`) (#2935).
78
- BLACK CIRCLE WITH TWO WHITE DOTS (`U+2689`) (#2935).
9+
- WARNING SIGN (`U+26A0`) (#2935).
810
* Refine shape of the following characters:
911
- MODIFIER LETTER UNASPIRATED (`U+02ED`).
1012
- MODIFIER LETTER LEFT TACK (`U+AB6A`).

packages/font-glyphs/src/auto-build/composite.ptl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,14 @@ glyph-block AutoBuild-Enclosure : begin
310310
set a.shape.slopeAngle : mix (para.slopeAngle || 0) 15 (95 / 150)
311311
return : StandardInners.getPara pp1 digits rows width
312312

313+
define TriangleInners : object
314+
gniPrefix 'tr'
315+
getShift : function [] : return (-CAP / 4)
316+
buildInnerShape StandardInners.buildInnerShape
317+
addAnchors StandardInners.addAnchors
318+
getXScalar StandardInners.getXScalar
319+
getPara StandardInners.getPara
320+
313321
define [EnclosureT prefix builder inners digits rows demands fnEnclosure] : begin
314322
foreach {suffix ww gap} [items-of circleWidthClasses] : do
315323
define allowProportional : if (digits > 1) MONOSPACE-ONLY ALLOW-PROPORTIONAL
@@ -610,6 +618,18 @@ glyph-block AutoBuild-Enclosure : begin
610618
close
611619
include : AddEnclosureMark digits : CircleDimens digits ww
612620

621+
define [createInsetTriangleGlyphs digits demands]
622+
EnclosureT 'inset-triangle' InsetBuilder TriangleInners digits 1 demands InsetTriangleEnclosureShape
623+
define [InsetTriangleEnclosureShape digits ww gap] : glyph-proc
624+
define [object width top bot left right] : CircleDimens digits ww
625+
set-width width
626+
include : spiro-outline
627+
corner (left + O) bot
628+
corner [mix left right 0.5] (top - O)
629+
corner (right - O) bot
630+
close
631+
include : AddEnclosureMark digits : CircleDimens digits ww
632+
613633
define [createInsetMosaicGlyphs digits demands]
614634
EnclosureT 'inset-mosaic' InsetBuilder StandardInners digits 1 demands InsetMosaicEnclosureShape
615635
define [InsetMosaicEnclosureShape digits ww gap] : glyph-proc
@@ -1022,6 +1042,10 @@ glyph-block AutoBuild-Enclosure : begin
10221042
createInsetDiamondGlyphs 1 : list
10231043
list 0xFFFD { "question" } WideWidth2
10241044

1045+
do "Single-digit inset triangle"
1046+
createInsetTriangleGlyphs 1 : list
1047+
list 0x26A0 { "exclam" } WideWidth2
1048+
10251049
do "Double-digit inset boxed"
10261050
createDecomposableInsetBoxedGlyphs 2 : list
10271051
list 0x1F18B {'I' 'C'} WideWidth1

packages/font-glyphs/src/symbol/pictograph/bolt-symbol.ptl

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
$$include '../../meta/macros.ptl'
22

3-
import [mix linreg clamp fallback] from "@iosevka/util"
3+
import [mix linreg clamp fallback distP] from "@iosevka/util"
4+
import [Box] from "@iosevka/geometry/box"
45

56
glyph-module
67

@@ -21,3 +22,18 @@ glyph-block Symbol-Pictograph-Bold-Symbol : begin
2122
corner [mix r l 0.6] PictBot
2223
corner (r + sw * kInside) (SymbolMid + sw)
2324
corner (l + sw * kOutside) (SymbolMid + sw)
25+
26+
create-glyph 'cautionSign' 0x2621 : glyph-proc
27+
local sw Stroke
28+
local box : new Box (CAP - 0.5 * sw) (0.5 * sw) SB RightSB
29+
local angleSize : 1.5 * sw
30+
31+
include : lift-@ : dispiro [widths.center]
32+
flat (@x1 = box.l) (@y1 = box.t)
33+
~~~ [alsoThru.curl.distTillEnd angleSize important]
34+
virt (@x2 = box.r) (@y2 = [box.yp 0.95])
35+
~~~ [alsoThru.flat.distFromStart angleSize important]
36+
~~~ [alsoThru.curl.distTillEnd angleSize important]
37+
virt (@x3 = box.l) (@y3 = [box.yp 0.05])
38+
~~~ [alsoThru.flat.distFromStart angleSize important]
39+
curl (@x4 = box.r) (@y4 = box.b)

packages/font-kits/src/spiro-kit.mjs

Lines changed: 68 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
VirtualControlKnot,
1010
DecorInterpolator,
1111
} from "@iosevka/geometry/spiro-control";
12-
import { bez3, fallback, mix } from "@iosevka/util";
12+
import { bez3, clamp, fallback, mix } from "@iosevka/util";
1313

1414
import { BiKnotCollector } from "../../geometry/src/spiro-expand.mjs";
1515

@@ -288,7 +288,7 @@ export function SetupBuilders(bindings) {
288288
super();
289289
this.ty = ty;
290290
this.rx = rx;
291-
this.ry = ry;
291+
this.ry = fallback(ry, rx);
292292
this.deltaX = deltaX;
293293
this.deltaY = deltaY;
294294
this.raf = fallback(raf, unimportant);
@@ -302,21 +302,73 @@ export function SetupBuilders(bindings) {
302302
}
303303
}
304304

305-
function alsoThru(rx, ry, raf) {
306-
return new SimpleMixInterpolator(g4, rx, ry, 0, 0, raf);
305+
class DistanceFromStartInterpolator extends InterpolatorBase {
306+
constructor(ty, distFromStart, deltaX, deltaY, raf) {
307+
super();
308+
this.ty = ty;
309+
this.distFromStart = distFromStart;
310+
this.deltaX = deltaX;
311+
this.deltaY = deltaY;
312+
this.raf = fallback(raf, unimportant);
313+
}
314+
resolveInterpolation(before, after) {
315+
const totalDist = Math.hypot(after.x - before.x, after.y - before.y);
316+
const r = clamp(0, 1, this.distFromStart / totalDist);
317+
return this.ty(
318+
mix(before.x, after.x, r) + this.deltaX,
319+
mix(before.y, after.y, r) + this.deltaY,
320+
this.raf,
321+
);
322+
}
307323
}
308-
alsoThru.withOffset = function (rx, ry, deltaX, deltaY, raf) {
309-
return new SimpleMixInterpolator(g4, rx, ry, deltaX, deltaY, raf);
310-
};
311-
alsoThru.g2 = function (rx, ry, raf) {
312-
return new SimpleMixInterpolator(g2, rx, ry, 0, 0, raf);
313-
};
314-
alsoThru.g4 = function (rx, ry, raf) {
315-
return new SimpleMixInterpolator(g4, rx, ry, 0, 0, raf);
316-
};
317-
alsoThru.g2.withOffset = function (rx, ry, deltaX, deltaY, raf) {
318-
return new SimpleMixInterpolator(g2, rx, ry, deltaX, deltaY, raf);
319-
};
324+
325+
class DistTillEndInterpolator extends InterpolatorBase {
326+
constructor(ty, distTillEnd, deltaX, deltaY, raf) {
327+
super();
328+
this.ty = ty;
329+
this.distTillEnd = distTillEnd;
330+
this.deltaX = deltaX;
331+
this.deltaY = deltaY;
332+
this.raf = fallback(raf, unimportant);
333+
}
334+
resolveInterpolation(before, after) {
335+
const totalDist = Math.hypot(after.x - before.x, after.y - before.y);
336+
const r = clamp(0, 1, 1 - this.distTillEnd / totalDist);
337+
return this.ty(
338+
mix(before.x, after.x, r) + this.deltaX,
339+
mix(before.y, after.y, r) + this.deltaY,
340+
this.raf,
341+
);
342+
}
343+
}
344+
345+
function AlsoThruSeries(ty) {
346+
const fn = function (rx, ry, raf) {
347+
return new SimpleMixInterpolator(ty, rx, ry, 0, 0, raf);
348+
};
349+
fn.withOffset = function (rx, ry, deltaX, deltaY, raf) {
350+
return new SimpleMixInterpolator(ty, rx, ry, deltaX, deltaY, raf);
351+
};
352+
fn.distFromStart = function (dist, raf) {
353+
return new DistanceFromStartInterpolator(ty, dist, 0, 0, raf);
354+
};
355+
fn.distTillEnd = function (dist, raf) {
356+
return new DistTillEndInterpolator(ty, dist, 0, 0, raf);
357+
};
358+
fn.distFromStart.withOffset = function (dist, deltaX, deltaY, raf) {
359+
return new DistanceFromStartInterpolator(ty, dist, deltaX, deltaY, raf);
360+
};
361+
fn.distTillEnd.withOffset = function (dist, deltaX, deltaY, raf) {
362+
return new DistTillEndInterpolator(ty, dist, deltaX, deltaY, raf);
363+
};
364+
return fn;
365+
}
366+
367+
const alsoThru = AlsoThruSeries(g4);
368+
alsoThru.g2 = AlsoThruSeries(g2);
369+
alsoThru.g4 = AlsoThruSeries(g2);
370+
alsoThru.flat = AlsoThruSeries(flat);
371+
alsoThru.curl = AlsoThruSeries(curl);
320372

321373
/// Multi-mix interpolator
322374
class MultiMixInterpolator extends InterpolatorBase {

packages/util/src/index.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ export function slX(x0, y0, y1, slope) {
5151
return x0 + (y1 - y0) / slope;
5252
}
5353

54+
export function distP(x0, y0, x1, y1, dist) {
55+
return dist / Math.hypot(x1 - x0, y1 - y0);
56+
}
57+
5458
///////////////////////////////////////////////////////////////////////////////////////////////////
5559

5660
export function joinCamel(a, b) {

0 commit comments

Comments
 (0)