Comment add nouveau fonts to your Powershell (Or CMD) Console paramètres?
First thing to know, is that, malheureusement (!):
Only fonts fulfilling certain criteria can be installé invers le console!
(See: here, here and here.)
The Font Criteria + Explanation
(The current status of c'est unknown.)
For Font to be supported in Console they have to:
The font doit être a corrigé-pitch font.
The font cannot be an italic font.
Si cela is a TrueTapez font, it doit être FF_MODERN.
Si cela n'est pas a TrueTapez font, it must contadans le OEM_CHARSET.
The font cannot have a negative A or C space.
Que fait all that mean?
Most duse metrics are defined here, which outlines the following structure describing a font in C++:
typedef struct tagLOGFONTA {
LONG lfHeight;
LONG lfWidth;
LONG lfEscapement;
LONG lfOrientation;
LONG lfWeight;
BYTE lfItalic;
BYTE lfUnderline;
BYTE lfStrikeOut;
BYTE lfCharSet;
BYTE lfOutPrecision;
BYTE lfClipPrecision;
BYTE lfQuality;
BYTE lfPitchAndFamily;
CHAR lfFaceName[LF_FACESIZE];
} LOGFONTA, *PLOGFONTA, *NPLOGFONTA, *LPLOGFONTA;
-
The font doit être corrigé-pitch. pitch and family du font is described by the field lfPitchAndFamily. The two low-order bits specify the pitch du font and can be one du following valeurs:
DEFAULT_PITCH
FIXED_PITCH
VARIABLE_PITCH
-
The font cannot be italic. In other words, the lfItalic field doit être set to false.
-
Si cela is a TrueTapez font, the lfPitchAndFamily field must contadans le code for the FF_MODERN family, in bits 4 through 7. FF_MODERN describes fonts avec a constant stroke width (i.e. monospace fonts), avec or sans serifs. Monospace fonts are usually modern. Pica, Elite, and CourierNew are examples.
-
Si cela n'est pas a TrueTapez font, c'est charset must include OEM_CHARSET, as defined by the lfCharSet field dans le tagLOGFONTA structure. That is, the font needs to be more than merely monospace. It également needs to support all the characters dans le OEM code page, the 437 "OEM" characters du IBM437 (OEM United States) char set as described here.
-
The font cannot have a negative A or C space. The width of a character is described by an ABC structure. The B spacing is the width du character. The A spacing is how much space to leave sur le left du character, and the C spacing is how much margin to leave sur le right.
Any character avec a negative margin sur le left or right is oversized the designated grid/raster. Par exemple, a font avec an overloaded W needs more space than the designated X pixel character width to properly draw the character. Obviously, fonts avec oversized characters ne sont pas corrigé-width.
Cependant, one known font to work and that a été suggested parce que it supports a lot of useful glyphs and math, is DejaVu. Malheureusement it n'est pas part du Windows standard font selection
and need to be installé manuellement.
Si le font you need ne déjà have a TrueType font fichier (*.ttf) or
OpenType (*.otf), vous allez need to convert the SFD fichiers into TTF (or OTF). To do so, vous pouvez use FontForge to
import SFD and ensuite generate the TTF.
Steps to installer a TTF fichier using FontForge
Installer FontForge (hereafter "FF")
Run FF as Administrator
Téléchargez le SFD font fichier(s) (Par exemple: DejaVuSansMono.sfd.)
Ouvrez le fichier avec: File > Open and hit OK.
Generate a TTF avec: File > Generate Fonts..., ensuite
Sélectionnez True Type dans le drop-down, ensuite
Un-Sélectionnez the Validate Before Saving option and hit Generate.
Drag the resulting *.ttf fichier invers le Windows Panneau de configuration for Fonts found at:
(Control Panel\Appearance and Personalisation\Fonts) or by:
WIN+R and type: %windir%\fonts.
Done. The nouveau font is maintenant immediately disponible in your registry.
Load the nouveau font(s) invers le Console registry
Open a Powershell console as Administrator to do this.
# All your available fonts are located here:
$T1key = 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Fonts'
# But your Console fonts are located here:
$T2key = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont'
# Check the correct name:
Get-ItemProperty -Path $T1key | grep "DejaVu"
DejaVu Sans Mono (TrueType) : DejaVuSansMono.ttf
# Note the correct spacing of the name and ignore the "(TrueType)" part
# Check what's already there:
Get-ItemProperty -Path $T2key
# To add more fonts, just add the new name like this:
# - Add another 0 (zero) to the -Name parameter, for each new font
# So since there is already an item with two zeros, so we need 3 and 4 zeros...
#Set-ItemProperty -Path $key -Name '000' -Value 'Arial' # Doesn't work!
#Set-ItemProperty -Path $key -Name '0000' -Value 'Calibri' # Doesn't work!
Set-ItemProperty -Path $key -Name '00000' -Value 'DejaVu Sans Mono'
Cependant, vous allez not see the nouveau font items, until:
le registre a été reloaded into mémoire, so la seule façon is to either:
redémarrer the ordinateur or
redémarrer Windows Explorer.
Redémarrer your Powershell Console
Fichier a bug report to Windows Powershell repo Console repo and ask them to:
support proper Fonts avec correct unicode glyphs.
Enjoy the many nouveau and correct glyphs!
Par exemple, try the PH39:
[char]0x2585 # (U+2585)
Addendum:
-
WindowsConsoleFonts - A PS module for fonctionnel avec Console fonts in Windows thdu toutow you to easily installer any (?) font.
-
Également see comment merge two fonts.
-
An informative Microsoft article about their font technolgy and how Font Linking fonctionne.
-
The Google Noto Project (Font) Noto Tools for the Python based merge_fonts.py.
-
One du criteria mentions to have constant stroke width, this means that the (pseuod-horizontal) pen width is constant as shown here:
The Expand Stroke dialog gives you control over various aspects du
expansion processus. First vous pouvez specify three types of pen nibs:
A round pen, which is circular par défaut but may be transformed into an ellipse
A rectangular pen, which is square par défaut but may be transformed into more traditional caligraphic nib shapes
A polygonal pen – vous pouvez draw almost any convex polygon.
For circular and caligraphic pens vous pouvez chose a stroke width, how
the ends of an open chemin devrait être drawn, and how the chemin should look
when two splines (or lines) join which ne pas have the same slope (ie.
at a corner point).