Commit graph

247 commits

Author SHA1 Message Date
Fini Jastrow
a19800195a font-patcher: Copy selection instead of continuously regenerating
[why]
This is a TODO item. Well, two in fact.

The symbolFont's selection is used for two things
- the main loop to iterate over all glyphs to insert
- to select the one glyph that is actually copied over

Because the main loop uses iterators on the selection.
The iterator is not 'stable' but invalidates if the selection
is changed.
The current code therefor restores the old selection before the loop
jumps to the head again.

This design is not very robust.

[how]
We need the selection to copy the symbol glyph.

But we can rewrite the loop that it does not need the selection at every
iteration, but that the selection is copied into a list, and we loop
over that list - which is independent on a later selection state.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2021-12-22 14:50:08 +01:00
Ryan L McIntyre
725c9df524 Follow up changes for new Codicons glyph set 2021-12-22 05:47:28 -08:00
Ryan L McIntyre
611f9279f9
Merge branch 'master' into codicon 2021-12-22 13:28:52 -08:00
Ryan L McIntyre
66adcfe7c9
Merge pull request #695 from ryanoasis/feature/panose-monospaced
font-patcher: Improve 'Mono' compatibility with Windows
2021-12-22 13:17:48 -08:00
Ryan L McIntyre
6c41bf7dfa Fixes a few issues brought up in #724 2021-12-19 11:12:08 -08:00
Fini Jastrow
5170911e3b font-patcher: Improve 'Mono' compatibility with Windows
[why]
Some of the patched Mono fonts do not turn up in the font chooser
of Windows CMD and PowerShell (and probably more).

[how]
For some reasons Windows does not identify the fonts as being strictly
monospaced, so they are hidden in that font choosers.

For the monospaced fonts we set now the Panose proportion 'monospaced'.
Windows seems to honor the Panose properties.

It is not clear why we need to set the old Panose props, especially as
Cascadia Code does not (!) set them and is still detected as monospaced.

Anyhow, the way Windows detects if a font is monospaced is a mystery (at
least for me), and this works, so ;-)

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2021-12-17 22:59:24 +01:00
Ryan L McIntyre
7eb5ce5926
Merge pull request #720 from ryanoasis/bugfix/cant-detect-extension
font-parser: Allow patching without --ext
2021-12-16 19:14:02 -08:00
Fini Jastrow
f6b6174680 font-parser: Allow patching without --ext
[why]
Sometimes fontforge returns None for font.path. That should not be the
case according to specs:

font.path
    (readonly) Returns a string containing the name of the file from
    which the font was originally read (in this session), or if this
    is a new font, returns a made up filename in the current directory
    named something like “Untitled1.sfd”. See also font.sfd_path.

This seems to be the case for fonts that do not have a fullname set.
I did not search for nor file any issue at Fontforge.

[how]
In fact we already have the original font file name, and we want to
retain its extension anyhow (if nothing is specified), so we use the
filename that we opened to determine the extension.

[note]
Related: #412
Related: #641

[note]
This was the sole usage of font.path.
Has been introduced with commit d8b760aee which looks uncritical.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2021-12-15 18:24:13 +01:00
Fini Jastrow
ef38ad6324 font-patcher: Remove obsolete metadata on glyph exchange
[why]
When we overwrite a glyph that originally had some special handling, be
it a substitution or position table entry (GPOS/GSUB), that special
handling is usually not appropriate anymore and has to be removed.

If we need special lookup table entries for the new glyph we would have
to add them later anyhow, because we can not rely on their existance.

In Issue #509 it was a ligature entry, that replaced 'f' followed by 'i'
with the 'fi' ligature. The ligature glyph is overwritten by us with a
telephone symbol and the substitution table entry makes no sense
anymore.

[how]
If we overwrite a preexisting codepoint we remove it from all lookup
tables.

Thanks to all other reporters with details.

Fixes: #509 #254

Reported-by: mangelozzi <mangelozzi@gmail.com>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2021-12-13 16:55:48 +01:00
Ryan L McIntyre
e323f2991a
Merge pull request #693 from ryanoasis/feature/set-sfnt-version
font-patcher: Set SFNT Version
2021-12-11 17:42:42 -08:00
Ryan L McIntyre
9633b4d362 License audit work to fix some licensing issues in #266 2021-12-11 08:10:08 -08:00
Ryan L McIntyre
f33b0298fd
Merge pull request #692 from ryanoasis/bugfix/fstype-font-does-not-open
font-patcher: Reintroduce fsType fix
2021-12-11 11:16:39 -08:00
Ryan L McIntyre
f943e8ec81
Merge pull request #593 from Finii/bugfix/use-correct-source-font-metrics
font-patcher: Use correct source font metrics
2021-12-11 10:32:34 -08:00
Charles Strahan
96ab7f6ef7 add support for codicons
Closes #620
2021-12-04 16:44:01 -06:00
Fini Jastrow
3384fc302c font-patcher: Give meaningful error messages on trivial open fails
[why]
When the font file is not existing the message we get is either
unreadable or missleading (at least for normal users).

[how]
Explicitely state why we can not open a font file, at least in the cases
where we can.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2021-11-30 07:58:12 +01:00
Fini Jastrow
0d905e2293 font-patcher: Set SFNT Version
[why]
The Nerd Font Version is not added to the SFNT Version.
This is also a TODO item in `font-patcher`.
The SFNT-Revision is not updated at all.

[how]
Set the SFNT Version and Revision.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2021-11-29 10:11:04 +01:00
Fini Jastrow
f554ed50c6 font-patcher: Reintroduce fsType fix
[why]
With commit
  f7d6fcb5 font-patcher: Allow processing of fonts with fsType set
we added support for fonts with the fsType set. This came up in
issue #686 with font 'Bicubik'.

The solution in that commit uses (modern) textual flags in the
`fontforge` open() method. But they have been only introduced in 2020,
so people using older `fontforge` could not patch anything anymore.
This has been reported in issue #691.

As a quick fix the fsType support has been removed with commit
  ab6fa3c5 Reverts part of #687 * the patcher refuses to patch all/most fonts with this flag in the open options

[how]
Revert f7d6fcb5 but use the old fashioned numerical open flags
interface instead.

[note]
The textual open() flags have been introduced into `fontforge`s python
interface with their commit

4a76712f0c

  Font Open flag improvements
  * Document more Open flags
  * Add string tuple interface to python FontOpen API

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2021-11-28 11:06:17 +01:00
Ryan L McIntyre
ab6fa3c562 Reverts part of #687
* the patcher refuses to patch all/most fonts with this flag in the open options
2021-11-27 11:33:18 -08:00
Fini Jastrow
204a43aafb font-patcher: Fail with meaningful message if font can not be opened
[why]
When fontforge is not able to open the font we fail with a meaninless
exception. Users might think that the font-patcher script itself is
broken.

[how]
Exit the script with a hint how to get more information if fontforge was
not able to open the font.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2021-11-24 08:28:53 +01:00
Fini Jastrow
f7d6fcb59c font-patcher: Allow processing of fonts with fsType set
[why]
Through fsType certain restrictions can be set on a font. When fontforge
is used in interactive mode the user can override the restrictions with
a popup dialogue. The font-patcher script dies instead, without any
meaningful message.

[how]
Allow the script to ignore fsType settings when opening.
The restrictions will still persist into the generated patched font.

[note]
This came up with Bicubik by Anton Kudin, that has fsType = 2
(modification restriction) set.

Fixes: #686

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2021-11-24 08:28:53 +01:00
Ryan L McIntyre
fc8a4fb74e Workflow for building release candidate
* debug font patcher version
2021-11-21 13:11:25 -08:00
Ryan L McIntyre
be0069cf91 Merge branch 'puppet_icon' of https://github.com/dhollinger/nerd-fonts into dhollinger-puppet_icon 2021-11-17 12:40:23 -08:00
Ryan L McIntyre
b9c0e2f139
Merge pull request #681 from BiscuitTin/master
Add Caskyadia Mono to RFN replacements
2021-11-17 20:36:47 -08:00
Kexy Biscuit
2c104d287c
Fix typo. 2021-11-12 12:16:12 +08:00
Kexy Biscuit
1454141c95
Add Caskyadia Mono to RFN replacements. 2021-11-12 12:01:18 +08:00
David Hollinger III
c01e5f62f8
Add the official Puppet icon as a custom icon 2021-08-13 12:51:35 -05:00
fracsinus
c72b0d98c1 fix over-indentation 2021-07-26 06:24:27 +09:00
Aisha Tammy
c920b5b26b
allow setting custom glyph storage directory
Useful for allowing installation in system wide
locations as a package from the package manager.
This way the script can be installed in /usr/bin
and glyphs can be in /usr/share/nerd-fonts/glyphs.

Signed-off-by: Aisha Tammy <floss@bsd.ac>
2021-04-24 14:24:21 -04:00
Ryan L McIntyre
3deb6166be
Merge pull request #551 from daniruiz/master
Update font-logos with new linux icons
2021-04-10 20:56:06 -07:00
Ryan L McIntyre
9f24ccf1a7
Merge pull request #545 from andys8/icon-purescript
Adds PureScript glyph/icon
2021-04-10 20:32:17 -07:00
Fini Jastrow
ca26382644 font-patcher: Use correct source font metrics
[why]
With a source font where Win Ascent/Descent differs from Typo
Ascend/Descent newly added symbols that are intended to be centered
_within the visual space_ can end up too far up or down.

The happens for example when patching CascadiaCode. Added glyphs like
the Ubuntu logo (unicode 0xF31B) is not centered between the square
brackets or on a line with the less then and other centered glyphs.

[how]
The calculation takes the Win Ascent/Descent to calculate the visual
hight. That information is a mix of hight and line spacing and can be
misleading.

Therefore, if use_typo_metrics is set in a font, we obey that flag
and use the typo metrics values instead.

[note]
Some websites with further information follow.

https://github.com/googlefonts/gf-docs/tree/main/VerticalMetrics
  > Hhea metrics are used in Mac OS X, whilst Microsoft uses
  > Typo when Use_Typo_Metrics is enabled

https://docs.microsoft.com/en-us/typography/opentype/otspec160/os2#fsselection
https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6hhea.html

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2021-03-17 09:14:27 +01:00
andys8
2bf091cd76 purescript icon in font patcher 2020-12-06 21:39:11 +01:00
Daniel Ruiz de Alegría
557b8da5c5 Update font-logos with new linux icons 2020-12-03 20:00:54 +01:00
duganchen
0c372875ce
Update font-patcher
Fix "Subfmaily" typo
2020-11-30 21:00:54 -08:00
Dugan Chen
bfe4befabe Take the style from the filename if it's longer than the subfamily (fixes #257) 2020-09-15 23:47:48 -07:00
Ryan L McIntyre
84bb81a937 Merge branch 'patch-1' of https://github.com/WhyNotHugo/nerd-fonts into WhyNotHugo-patch-1 2020-09-06 04:59:54 -07:00
Daniel M. Capella
59c45ba4ef Remove negative bearings on 2048-em glyphs
Bisected an overlap issue in status bars to
https://github.com/ryanoasis/nerd-fonts/pull/283/files#diff-3b192ccaec850d73e6540b7eddd8b50cL710-R734
2020-09-06 04:55:36 -07:00
Hugo Barrera
66b29f6d54 Change bearing to int, since an int is expected
I keep seeing this warning when running `font-patcher`, and realised this is a relatively simple fix. This property expects and `int`, but a `float` is passed and implicitly cast.

This squelches the deprecation warning, and keeps the code future-proof too.

```
/nerd/font-patcher:823: DeprecationWarning: an integer is required (got type float).  Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
  glyph.left_side_bearing = 0.0
/nerd/font-patcher:825: DeprecationWarning: an integer is required (got type float).  Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
  glyph.right_side_bearing = 0.0
```
2020-07-29 09:53:28 +02:00
Ryan L McIntyre
36d0708dc2
Merge pull request #439 from onokatio/fix-postscript-cid
Fix #412
2020-02-21 22:27:59 -08:00
onokatio
2c7af61136 Fixes TypeError: unsupported operand (fix #412)
use cid object instead of native.
2020-02-12 13:32:07 +09:00
Anton Maminov
3bdc0949b8 add Crystal icon 2020-01-29 13:53:56 +02:00
Ryan L McIntyre
d0faead4dd Adds Cascadia Code patched version (as 'Caskaydia Cove') (issue #373) 2020-01-25 21:22:11 -08:00
Ryan L McIntyre
a192bff0b0
Merge pull request #394 from Finii/bugfix/diacritics_in_mono
Bugfix/diacritics in mono
2019-12-21 20:55:47 -08:00
Ryan L McIntyre
8566c6539e Updates scripts in preparation for for v2.1.0 2019-11-03 09:08:39 -08:00
Fini Jastrow
d307a73356 font-patcher: Fix broken diacritic glyphs in monospaced font
[why]
Some glyphs are just used as overlays for 'real' glyphs. These can be
for example U+0300 .. U+036F (the 'COMBINING ...' diactritics) like
  U+0300, gravecomb, COMBINING GRAVE ACCENT
  U+0301, acutecomb, COMBINING ACUTE ACCENT
  U+0308, uni0308, COMBINING DIAERESIS

They are never used on their own, at least they are overlayed over a
blanc (U+0020, space).

For the font rendering engine they need to have the correct negative
bearings, so they are shifted to take no space by themselves.

The font-patcher script does not allow negative bearings in monospaced
fonts. This makes sense if every glyph is in itself a 'letter' that
should not reach beyond it's allotted (monospaced) space.

[how]
In the font-patcher script we do not touch the bearings of such overlay
glyphs. They can be identified by their width of zero.

For Windows to detect this font as 'monospaced' we need to change the
width to the standard width, though.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2019-10-24 08:21:02 +02:00
Fini Jastrow
a2f0958ae5 font-patcher: Fix broken ligature glyphs in monospaced font
[why]
For some reason reading a font into fontforge looses data on glyphs. As
a workaround the `font-patcher` script has the switch `--mono` to
ascertain an equal width of all glyphs. We want to (and sometimes need to)
use that mode of the script to get a new font that is detected as monospaced
by Windows.

Sometimes that workaround fails. For example it breaks ligature glyphs
in some circumstances; they seem to be moved sideways.

[how]
The workaround is done in two steps: First each glyph is checked for
negative bearings. If these are found they are set to fixed zero.
Afterwards the glyph width is set to the font global width.

The ligature glyphs have already the correct width, they just have
negative bearings that they indeed need. There is no reason to change
the (correct) bearings to get a monospaced font. In strict monospaced
fonts that would be impossible, but the ligatures are only used in
applications that could work with negative bearings and so they should
be there. Strict monospaced usage does ignore the bearings anyhow.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2019-10-24 08:20:12 +02:00
Gunnar Tiedt
fb2347dac8 Extend FontNameReplacements for Anka/Coder 2019-09-24 16:41:19 +02:00
Ryan L McIntyre
5512f1881f Adds font 'iA Writer' (patched as 'iM Writing) (issue #326)
* pre-release build only
2019-08-17 23:01:59 -07:00
Ryan L McIntyre
ebc95f5eb2 Makes suer to add 'Liberation' to RFN list (discovered via PR #366)
- needs to be repatched with correct name
2019-08-11 08:15:41 -07:00
Ryan L McIntyre
3068126a16 Fixes version to proper status 2019-07-26 14:57:04 -07:00
Ryan L McIntyre
28b6548d7d Designates version as alpha for now 2019-07-05 12:36:47 -07:00
Ryan L McIntyre
f49b92cb6c Resolves conflicts 2019-07-05 12:32:06 -07:00
Ryan L McIntyre
e3710e3875 Merge branch 'refactor-font-patcher' of https://github.com/haasosaurus/nerd-fonts into haasosaurus-refactor-font-patcher 2019-07-05 11:42:27 -07:00
Ryan L McIntyre
86dff75f7e Removes RFN replacement for Fira Code
* continues modifications from #352 and #356 PR
* see: https://github.com/tonsky/FiraCode/issues/767#issuecomment-495163622
2019-06-22 05:30:17 -07:00
Ryan L McIntyre
bfde19a193
Merge pull request #283 from haasosaurus/master
fix monospace/overlap problem
2019-06-19 22:05:49 -07:00
Ryan L McIntyre
3241ea6e44
Fixes the same typo found in #331
Fixes the same typo discovered in #331
2019-03-11 19:13:10 -07:00
Jimmy Haas
c5433d8de8 fix comments 2018-08-07 04:38:13 -07:00
Jimmy Haas
edba9ebdf1 removed unneeded var 2018-08-07 04:27:48 -07:00
Jimmy Haas
d83d930ee6 fix comment 2018-08-07 04:10:27 -07:00
Jimmy Haas
e442611644 polish refactor 2018-08-07 04:06:39 -07:00
Jimmy Haas
0a480bbc8d refactor font-patcher 2018-08-04 03:39:21 -07:00
Jimmy Haas
cf625d46b5 fix monospace/overlap problem 2018-08-03 18:47:20 -07:00
Nicola Tuveri
d27ef23278 Rename the patched font as 'Blex' 2018-04-03 22:49:38 +03:00
Nicola Tuveri
27b7d35a0e Add IBM Plex (https://github.com/IBM/plex) font. 2018-04-01 13:35:06 +03:00
Ryan L McIntyre
47b42c8067 Changes name for 'complete' variations to not be abbreviated with 'C' 2018-03-26 21:27:05 -04:00
Ryan L McIntyre
31d7524a2c Fixes glyph overlapping issues 2018-03-23 21:05:52 -04:00
Ryan L McIntyre
1906150729 Updates patcher and source script for Weather glyph set (issue #247) 2018-03-23 21:05:52 -04:00
Ryan L McIntyre
1d84436942 Updates 'Knack' to now be just 'Hack' (license change)
- Removes reliance on 'Knack' name due to removal of SIL OFL Reserved font name 'Hack' no longer being a RFN
- This change has been in effect since Hack v3.000
2018-03-17 11:50:06 -04:00
Ryan L McIntyre
2f25d0618e Updates parameter info for 'configfile' flag 2018-03-10 17:30:03 -05:00
Ryan L McIntyre
b7931da607 Updates version metadata consistency 2018-03-03 14:14:55 -05:00
Ryan L McIntyre
ba5a35c8b6 Updates metadata to match other scripts convention 2018-02-26 05:45:21 -05:00
Ryan L McIntyre
3ebe0a79f6 Version bumps in preparation for v2.0.0 release 2018-02-26 05:43:40 -05:00
Ryan L McIntyre
26ea118d77 Updates some logging 2018-02-25 21:51:58 -05:00
Ryan L McIntyre
5007170cf9 Updates glyph core set (SetiUI and custom) with new glyphs for Elm, Elixir, Electron (WIP #172, #228, #237) 2018-02-25 16:15:13 -05:00
Ryan L McIntyre
3e2cc61e4e Config file parsing fixes 2018-02-25 15:52:49 -05:00
Ryan L McIntyre
f49db2ae1c Add missing TTF Names String ID metadata update (WIP fix for #231) 2018-02-24 10:43:27 -05:00
Ryan L McIntyre
c7e1aafa67 Minor clean-up 2018-02-22 22:11:24 -05:00
Ryan L McIntyre
9917e2dbea Adds ability to read from config JSON file and remove subtables (thus ligatures) (WIP #186) 2018-02-18 19:06:09 -05:00
Ryan L McIntyre
6955ac2bdb Updates scripts in preparation for Weather Icons (WIP issue #226) 2018-02-15 17:46:19 -05:00
Ryan L McIntyre
8fa121b14d Fixes typo 2018-02-13 21:59:33 -05:00
Ryan L McIntyre
1ae39f339e Updates scripts in preparation for Material Design Icons (WIP issue #154) 2018-02-12 21:32:37 -05:00
Ryan L McIntyre
30c296bb8f Adds Material Design Icons (WIP issue #154)
- Also moves one Octicon that conflicts with the set
2018-02-11 15:38:33 -05:00
Ryan L McIntyre
cac0352044 Preparation work for updating font-logos (font-linux) glyphs (issue #157) 2018-02-11 10:50:26 -05:00
Ryan L McIntyre
85ed8a4b43 Bumps project version numbers of scripts for v1.2.0 release 2017-11-18 16:11:22 -05:00
JinwookMBP
d44a574e23 fix '__dir__' set to empty 2017-08-27 17:57:25 +09:00
Ryan L McIntyre
4227f0bf46 Fixes an update to font name references with various sanitation
- removes 'for Powerline'
2017-08-01 17:52:10 -04:00
Ryan L McIntyre
6af2fdc8d7 Bumps project version numbers of scripts for v1.1.0 release 2017-07-30 18:02:58 -04:00
Ryan L McIntyre
dc64c11258 Adds more project details to '--help' argument 2017-07-30 17:58:42 -04:00
Ryan L McIntyre
c8801c0ec8 Updates progress bars styling and fixes incorrect glyph set calculation 2017-07-30 17:21:08 -04:00
Ryan L McIntyre
474e384a9d Updates font name references with various sanitation
- removes 'for Powerline'
- removes 'Powerline'
- removes extra whitespace
2017-07-30 17:20:31 -04:00
Ryan L McIntyre
8284d59508 Fixes SyntaxError with EOL on string 2017-07-29 21:55:20 -04:00
Ryan L McIntyre
715df80487 Simplifies font names with Powerline
- removes 'for Powerline' from patched fonts
2017-07-29 21:42:58 -04:00
Ryan L McIntyre
ad2bd608c8 Deouples changelog.md being required in patcher
- simplifies dependency
- simplifies fontlog and comments in the actual font
- adds links to website, project, and changelog
2017-07-29 21:41:49 -04:00
reujab
3a2cc32662 fixed links 2017-07-28 16:29:44 -04:00
reujab
7dd3712791 apt-get -> apt 2017-07-27 19:20:32 -04:00
reujab
8cdcf2ef02 print errors to stderr 2017-07-27 18:25:42 -04:00
reujab
f2b36427af use sys.exit to die 2017-07-27 18:17:40 -04:00
reujab
c505466c56 removed unused import time 2017-07-27 17:49:46 -04:00
Ryan L McIntyre
b5d8c11fbd Adds missing glyph e0ca (ice waveform mirrored) (fixes #182) 2017-07-25 22:07:04 -04:00
Ryan L McIntyre
975cf78fc3 Merge pull request #185 from reujab/relative-open
Open files relative to the script's directory
2017-07-24 16:54:37 -04:00