Skip to content

Commit 3268fbe

Browse files
feat: Font.svg.get_SVG ( Fixes #17 )
1 parent 143e190 commit 3268fbe

6 files changed

Lines changed: 22 additions & 17 deletions

File tree

Types/Font.svg/GetGlyph.ps1

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
param([string]$value)
2-
$this |
3-
Select-Xml -Namespace @{s='http://www.w3.org/2000/svg'} -XPath "//s:glyph[@unicode='$($value -replace "'", "''")']" |
4-
Select-Object -ExpandProperty Node
1+
param(
2+
[PSObject]$value
3+
)
4+
5+
if ($value -is [string] -and $value.Length -le 2) {
6+
$this.SVG |
7+
Select-Xml -Namespace @{s='http://www.w3.org/2000/svg'} -XPath "//s:glyph[@unicode='$($value -replace "'", "''")']" |
8+
Select-Object -ExpandProperty Node
9+
}

Types/Font.svg/get_FamilyName.ps1

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
$this |
2-
Select-Xml -Namespace @{s='http://www.w3.org/2000/svg'} -XPath //s:font-face |
3-
Select-Object -ExpandProperty Node |
4-
Select-Object -ExpandProperty font-family
1+
$this.FontFace.'font-family'

Types/Font.svg/get_FontFace.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
$this |
1+
$this.SVG |
22
Select-Xml -Namespace @{s='http://www.w3.org/2000/svg'} -XPath //s:font-face |
33
Select-Object -ExpandProperty Node

Types/Font.svg/get_FontStyle.ps1

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
$this |
2-
Select-Xml -Namespace @{s='http://www.w3.org/2000/svg'} -XPath //s:font-face |
3-
Select-Object -ExpandProperty Node |
4-
Select-Object -ExpandProperty font-style
1+
$this.FontFace.'font-style'

Types/Font.svg/get_FontWeight.ps1

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
$this |
2-
Select-Xml -Namespace @{s='http://www.w3.org/2000/svg'} -XPath //s:font-face |
3-
Select-Object -ExpandProperty Node |
4-
Select-Object -ExpandProperty font-weight
1+
$this.FontFace.'font-weight'

Types/Font.svg/get_SVG.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
if (-not $this.'#SVG') {
2+
if ($this -is [IO.FileInfo] -and $this.Extension -eq '.svg') {
3+
$svgXml = (Get-Content -LiteralPath $this.FullName -Raw) -as [xml]
4+
if ($svgXml) {
5+
$this | Add-Member NoteProperty '#SVG' $svgXml -Force
6+
}
7+
}
8+
}
9+
return $this.'#SVG'

0 commit comments

Comments
 (0)