|
1 | 1 | # Font |
| 2 | + |
2 | 3 | Manage and Manipulate fonts with PowerShell |
| 4 | + |
| 5 | +With the Font module, you can: |
| 6 | + |
| 7 | +* `Get-Font` - Get Installed Fonts |
| 8 | +* `Export-Font` - Export a font to various formats |
| 9 | +* `Import-Font` - Import a font as SVG |
| 10 | + |
| 11 | +We can always get installed fonts. |
| 12 | + |
| 13 | +To Export and Import fonts, we need to install [FontForge](https://fontforge.org/), and ensure it is loaded in the path. |
| 14 | + |
| 15 | +## Fonts 101 |
| 16 | + |
| 17 | +Fonts are fun! |
| 18 | + |
| 19 | +Fonts are a series of symbols, often used to represent text. |
| 20 | + |
| 21 | +Each symbol in a font is called a `Glyph`. |
| 22 | + |
| 23 | +All of the glyphs in a font are called the `Font Face`. |
| 24 | + |
| 25 | +Fonts with similar faces (and often similar designers) are called a `Font Family`. |
| 26 | + |
| 27 | +The Font module is designed to help you work with fonts. |
| 28 | + |
| 29 | +It allows you to import and export fonts, get specific glyphs, and edit a typeface. |
| 30 | + |
| 31 | + |
| 32 | +### Installing the Font Module |
| 33 | + |
| 34 | +~~~PowerShell |
| 35 | +# Install the Font Module from the PowerShell Gallery |
| 36 | +Install-Module Font |
| 37 | +~~~ |
| 38 | + |
| 39 | +~~~PowerShell |
| 40 | +# Import the font module |
| 41 | +Import-Module Font |
| 42 | +~~~ |
| 43 | + |
| 44 | +#### Cloning and Importing |
| 45 | + |
| 46 | +You can also clone the repository and import the module |
| 47 | + |
| 48 | +~~~PowerShell |
| 49 | +
|
| 50 | +git clone https://github.com/PowerShellWeb/Font |
| 51 | +cd ./Font |
| 52 | +Import-Module ./ -Force -PassThru |
| 53 | +
|
| 54 | +~~~ |
| 55 | + |
| 56 | +### Font GitHub Action |
| 57 | + |
| 58 | +The Font module has a GitHub action, and can be run in a workflow. |
| 59 | + |
| 60 | +To use the font action, simply refer to this repository: |
| 61 | + |
| 62 | +~~~yaml |
| 63 | +- name: BuildFont |
| 64 | + uses: PowerShellWeb/Font@main |
| 65 | +~~~ |
| 66 | + |
| 67 | +Any file named `*.font.ps1` will be executed. |
| 68 | + |
| 69 | +Any outputted files will be checked in. |
| 70 | + |
| 71 | +## Basic Examples |
| 72 | + |
| 73 | +~~~PowerShell |
| 74 | +# Import a random font |
| 75 | +$importRandomFont = Get-Font | Get-Random | Import-Font |
| 76 | + |
| 77 | +# Get the bounding box |
| 78 | +$importRandomFont.BoundingBox |
| 79 | + |
| 80 | +# Get the glyph for 'p' and get it's path data |
| 81 | +$importRandomFont.GetGlyph("P").d |
| 82 | +# We can change the path by setting 'd' |
| 83 | +# Font glyphs are drawn "upside-down", and should fit within the bounding box. |
| 84 | +~~~ |
| 85 | + |
| 86 | +For more examples, see the [Examples directory](./Examples/) |
0 commit comments