Skip to content

Commit 6b39ec6

Browse files
StartAutomatingStartAutomating
authored andcommitted
feat: Font.Glyph.get_Outline ( Fixes #20 )
1 parent 6f4e057 commit 6b39ec6

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

Font.types.ps1xml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,27 @@
2222
<Type>
2323
<Name>Font.Glyph</Name>
2424
<Members>
25+
<ScriptProperty>
26+
<Name>Outline</Name>
27+
<GetScriptBlock>
28+
$fontFace = $this.ParentNode.'font-face'
29+
$descent = $fontFace.descent -as [double]
30+
$bbox = $fontFace.bbox -split '\s' -as [double[]]
31+
$viewbox = "0 $($bbox[-3] - $descent) $($bbox[-2]) $($bbox[-1])"
32+
@("&lt;svg xmlns='http://www.w3.org/2000/svg' viewBox='$viewbox' width='100%' height='100%' transform='scale(1 -1)'&gt;"
33+
34+
"&lt;path stroke='currentColor' d='$($this.PathData)' /&gt;"
35+
@"
36+
&lt;circle r="5" fill="red"&gt;
37+
&lt;animateMotion
38+
dur="10s"
39+
repeatCount="indefinite"
40+
path="$($pathData)" /&gt;
41+
&lt;/circle&gt;
42+
"@
43+
"&lt;/svg&gt;") -as [xml]
44+
</GetScriptBlock>
45+
</ScriptProperty>
2546
<ScriptProperty>
2647
<Name>PathData</Name>
2748
<GetScriptBlock>
@@ -36,6 +57,20 @@
3657
$this.d
3758
</GetScriptBlock>
3859
</ScriptProperty>
60+
<ScriptProperty>
61+
<Name>SVG</Name>
62+
<GetScriptBlock>
63+
$fontFace = $this.ParentNode.'font-face'
64+
$descent = $fontFace.descent -as [double]
65+
$bbox = $fontFace.bbox -split '\s' -as [double[]]
66+
$viewbox = "0 $($bbox[-3] - $descent) $($bbox[-2]) $($bbox[-1])"
67+
@(
68+
"&lt;svg xmlns='http://www.w3.org/2000/svg' viewBox='$viewbox' width='100%' height='100%' transform='scale(1 -1)'&gt;"
69+
"&lt;path fill='currentColor' d='$($this.PathData)' /&gt;"
70+
"&lt;/svg&gt;"
71+
) -as [xml]
72+
</GetScriptBlock>
73+
</ScriptProperty>
3974
</Members>
4075
</Type>
4176
<Type>

0 commit comments

Comments
 (0)