-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option for metrics and boxdrawing #1300
Conversation
Hmm, we could add code that cross-checks our metrics with the box-glyph-metrics, if the font has box glyphs 🤔 |
75dad55
to
11a4526
Compare
Rebase on master, force push |
[why] If the font has contradicting baseline to baseline metrics the patcher tries to find a sane value and use that. That automatism gets it right in most cases, but there might be fonts where the user wants a different metric to be used. At the moment the use would need to use `font-line` to adjust the metrics, which is not very convenient. [how] Add option to select one of the metricses. Use that metrics when setting up the patched font. Signed-off-by: Fini Jastrow <[email protected]>
[why] When the original font designer's idea of cell height differs from the height we deduce the box drawing glyphs come out with the wrong size (if we do not touch them, for example because the font already has a complete set). [how] Add option that enforces patch-in of the box set. Signed-off-by: Fini Jastrow <[email protected]>
11a4526
to
c7b7cc9
Compare
[why] It can be hard to find the 'usual' options in between all the expert options. [how] Regroup the options and sort them alphabetically (most of the time). Not sure if this helps, but in my personal view this makes it easier. Signed-off-by: Fini Jastrow <[email protected]>
[why] It is rather confusing to have so many aliases. [how] Remove some long forms and some alternatives, to make the help page easier to read. Signed-off-by: Fini Jastrow <[email protected]>
$ fontforge font-patcher --help 2>/dev/null
Nerd Fonts Patcher v3.0.2-79 (4.6.0) (ff 20230101)
usage: font-patcher [-h] [-v] [-s] [--variable-width-glyphs] [--debug [{0,1,2,3}]] [-q] [--careful] [-ext EXTENSION]
[-out OUTPUTDIR] [--makegroups [{-1,0,1,2,3,4,5,6}]] [-c] [--codicons] [--fontawesome]
[--fontawesomeext] [--fontlogos] [--material] [--octicons] [--powersymbols] [--pomicons]
[--powerline] [--powerlineextra] [--weather] [--boxdrawing] [--configfile CONFIGFILE]
[--custom CUSTOM] [--dry] [--glyphdir GLYPHDIR] [--has-no-italic] [-l] [--metrics {HHEA,TYPO,WIN}]
[--name FORCE_NAME] [--postprocess POSTPROCESS] [--removeligs] [--xavgcharwidth [XAVGWIDTH]]
[--progressbars | --no-progressbars]
font
Nerd Fonts Font Patcher: patches a given font with programming and development related glyphs
* Website: https://www.nerdfonts.com
* Version: 3.0.2-79
* Development Website: https://github.com/ryanoasis/nerd-fonts
* Changelog: https://github.com/ryanoasis/nerd-fonts/blob/-/changelog.md
positional arguments:
font The path to the font to patch (e.g., Inconsolata.otf)
options:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-s, --mono, --use-single-width-glyphs
Whether to generate the glyphs as single-width not double-width (default is double-width) (Nerd Font Mono)
--variable-width-glyphs
Do not adjust advance width (no "overhang") (Nerd Font Propo)
--debug [{0,1,2,3}] Verbose mode (optional: 1=just to file; 2*=just to terminal; 3=display and file)
-q, --quiet Do not generate verbose output
--careful Do not overwrite existing glyphs if detected
-ext EXTENSION, --extension EXTENSION
Change font file type to create (e.g., ttf, otf)
-out OUTPUTDIR, --outputdir OUTPUTDIR
The directory to output the patched font file to
--makegroups [{-1,0,1,2,3,4,5,6}]
Use alternative method to name patched fonts (default=1)
Symbol Fonts:
-c, --complete Add all available Glyphs
--codicons Add Codicons Glyphs (https://github.com/microsoft/vscode-codicons)
--fontawesome Add Font Awesome Glyphs (http://fontawesome.io/)
--fontawesomeext Add Font Awesome Extension Glyphs (https://andrelzgava.github.io/font-awesome-extension/)
--fontlogos Add Font Logos Glyphs (https://github.com/Lukas-W/font-logos)
--material, --mdi Add Material Design Icons (https://github.com/templarian/MaterialDesign)
--octicons Add Octicons Glyphs (https://octicons.github.com)
--powersymbols Add IEC Power Symbols (https://unicodepowersymbol.com/)
--pomicons Add Pomicon Glyphs (https://github.com/gabrielelana/pomicons)
--powerline Add Powerline Glyphs
--powerlineextra Add Powerline Extra Glyphs (https://github.com/ryanoasis/powerline-extra-symbols)
--weather Add Weather Icons (https://github.com/erikflowers/weather-icons)
Expert Options:
--boxdrawing Force patching in (over existing) box drawing glyphs
--configfile CONFIGFILE
Specify a file path for JSON configuration file (see sample: src/config.sample.json)
--custom CUSTOM Specify a custom symbol font, all glyphs will be copied; absolute path suggested
--dry Do neither patch nor store the font, to check naming
--glyphdir GLYPHDIR Path to glyphs to be used for patching
--has-no-italic Font family does not have Italic (but Oblique), to help create correct RIBBI set
-l, --adjust-line-height
Whether to adjust line heights (attempt to center powerline separators more evenly)
--metrics {HHEA,TYPO,WIN}
Select vertical metrics source (for problematic cases)
--name FORCE_NAME Specify naming source ('full', 'postscript', or concrete free name-string)
--postprocess POSTPROCESS
Specify a Script for Post Processing
--removeligs, --removeligatures
Removes ligatures specificed in JSON configuration file (needs --configfile)
--xavgcharwidth [XAVGWIDTH]
Adjust xAvgCharWidth (optional: concrete value)
--progressbars Show percentage completion progress bars per Glyph Set (default)
--no-progressbars Don't show percentage completion progress bars per Glyph Set |
Add option for metrics and boxdrawing
To anybody having a look at it afterward: Was it on purpose? I don't see the link with the PR's intent. |
It is this commit: 99f3b20 Commit: Fini Jastrow <[email protected]>
CommitDate: Fri Oct 13 12:42:46 2023 +0200
font-patcher: Drop some option alternatives
[why]
It is rather confusing to have so many aliases.
[how]
Remove some long forms and some alternatives, to make the help page
easier to read.
Signed-off-by: Fini Jastrow <[email protected]>
---
font-patcher | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/font-patcher b/font-patcher
index 62a2554ee..ba8625144 100755
--- a/font-patcher
+++ b/font-patcher
@@ -1858,7 +1858,7 @@ def setup_arguments():
parser.add_argument('-s', '--mono', '--use-single-width-glyphs', dest='single', default=False, action='count', help='Whether to generate the glyphs as single-width not double-width (defaul
parser.add_argument('--variable-width-glyphs', dest='nonmono', default=False, action='store_true', help='Do not adjust advance width (no "overhang") (Nerd Font Propo)')
parser.add_argument('--debug', dest='debugmode', default=0, type=int, nargs='?', help='Verbose mode (optional: 1=just to file; 2*=just to terminal; 3=display
- parser.add_argument('-q', '--quiet', '--shutup', dest='quiet', default=False, action='store_true', help='Do not generate verbose output')
+ parser.add_argument('-q', '--quiet', dest='quiet', default=False, action='store_true', help='Do not generate verbose output')
parser.add_argument('--careful', dest='careful', default=False, action='store_true', help='Do not overwrite existing glyphs if detected')
parser.add_argument('-ext', '--extension', dest='extension', default="", type=str, help='Change font file type to create (e.g., ttf, otf)')
parser.add_argument('-out', '--outputdir', dest='outputdir', default=".", type=str, help='The directory to output the patched font file to')
@@ -1879,15 +1879,15 @@ def setup_arguments():
sym_font_group.add_argument('-c', '--complete', dest='complete', default=False, action='store_true', help='Add all available Glyphs')
sym_font_group.add_argument('--codicons', dest='codicons', default=False, action='store_true', help='Add Codicons Glyphs (https://github.com/microsoft/vscode
sym_font_group.add_argument('--fontawesome', dest='fontawesome', default=False, action='store_true', help='Add Font Awesome Glyphs (http://fontawesome.io/)')
- sym_font_group.add_argument('--fontawesomeextension', dest='fontawesomeextension', default=False, action='store_true', help='Add Font Awesome Extension Glyphs (https://andrelzgava.g
- sym_font_group.add_argument('--fontlogos', '--fontlinux', dest='fontlogos', default=False, action='store_true', help='Add Font Logos Glyphs (https://github.com/Lukas-W/font-l
- sym_font_group.add_argument('--material', '--materialdesignicons', '--mdi', dest='material', default=False, action='store_true', help='Add Material Design Icons (https://github.com/templarian
+ sym_font_group.add_argument('--fontawesomeext', dest='fontawesomeextension', default=False, action='store_true', help='Add Font Awesome Extension Glyphs (https://andrelzgava.g
+ sym_font_group.add_argument('--fontlogos', dest='fontlogos', default=False, action='store_true', help='Add Font Logos Glyphs (https://github.com/Lukas-W/font-l
+ sym_font_group.add_argument('--material', '--mdi', dest='material', default=False, action='store_true', help='Add Material Design Icons (https://github.com/templarian
sym_font_group.add_argument('--octicons', dest='octicons', default=False, action='store_true', help='Add Octicons Glyphs (https://octicons.github.com)')
sym_font_group.add_argument('--powersymbols', dest='powersymbols', default=False, action='store_true', help='Add IEC Power Symbols (https://unicodepowersymbol.com/)'
sym_font_group.add_argument('--pomicons', dest='pomicons', default=False, action='store_true', help='Add Pomicon Glyphs (https://github.com/gabrielelana/pomi
sym_font_group.add_argument('--powerline', dest='powerline', default=False, action='store_true', help='Add Powerline Glyphs')
- sym_font_group.add_argument('--powerlineextra', dest='powerlineextra', default=False, action='store_true', help='Add Powerline Glyphs (https://github.com/ryanoasis/power
- sym_font_group.add_argument('--weather', '--weathericons', dest='weather', default=False, action='store_true', help='Add Weather Icons (https://github.com/erikflowers/weathe
+ sym_font_group.add_argument('--powerlineextra', dest='powerlineextra', default=False, action='store_true', help='Add Powerline Extra Glyphs (https://github.com/ryanoasis
+ sym_font_group.add_argument('--weather', dest='weather', default=False, action='store_true', help='Add Weather Icons (https://github.com/erikflowers/weathe
expert_group = parser.add_argument_group('Expert Options')
expert_group.add_argument('--boxdrawing', dest='forcebox', default=False, action='store_true', help='Force patching in (over existing) box drawing glyphs') It was, together with the commit directly before it, obviously some fly-by change triggered by the fact that the options has been worked on: This was changed with in-parens version |
Hello Finii, Thank you for the explanation 🙇 Would it be reasonable to patch the release notes of 3.2.0 to mention those changes? |
In fact Nerd Fonts is two projects: One is the patcher script that has its own version number (the in-parens version number) and no release notes at all - it is a rolling release and both the patcher-zip and docker image are always updated whenever a commit is merged. The other project are the prepatched fonts, which are "the Nerd Fonts release" with the main number we mentioned above, and it uses that font-patcher version whichever was newest at the time of font-release. It ALSO includes the patcher script used for the fonts-release, but that usually becomes outdated within a week or so as new rolling releases of the patcher are created. Anyhow, I try to generate useful release notes, but that means that not every small thing is included (for this you can have a look at the commit list - normally all commits have a meaningful title and The reason the renaming of the options did not make it were (probably):
|
This is something I wasn't aware of. I agree it is marginal usage, and that in retrospect the Thank you again for the detailed explanations 🙇 |
Description
This PR introduces two new options to the
font-patcher
that can be used by advanced users to tackle problematic fonts.See individual commits for explanation.
Is this already featurism? Maybe this amount of detailed options is too much? 🤔
Requirements / Checklist
What does this Pull Request (PR) do?
Add
--metrics
and--boxdrawing
to thefont-patcher
parameters.How should this be manually tested?
As the options are disabled by default normal runs are safe.
Debug runs should show the expected (different) behavior.
Any background context you can provide?
#1298
What are the relevant tickets (if any)?
Screenshots (if appropriate or helpful)