Skip to content
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

Update Cascadia to 2111.01 #723

Merged
merged 19 commits into from
Aug 22, 2022
Merged

Update Cascadia to 2111.01 #723

merged 19 commits into from
Aug 22, 2022

Conversation

Finii
Copy link
Collaborator

@Finii Finii commented Dec 16, 2021

Description

Update Cascadia to 2111.01

Also including the italic variants.

We do not use the PL versions but patch in the PL glyphs ourselves.
If this is smart can be discussed (I believe: no).

This does not add 'Cascadia Mono'.

[how]

$ ./standardize-and-complete-readmes.sh ../../src/unpatched-fonts/CascadiaCode
$ ./gotta-patch-em-all-font-patcher\!.sh Cascadia

[note]
Also fix font name typo ('Cascdia') in info files.

[note]
Because of the font family naming problem the font-patcher has been
patched. See comments.

Requirements / Checklist

  • Read the Contributing Guidelines
  • Read or at least glanced at the FAQ
  • Read or at least glanced at the Wiki
  • Scripts execute without error (if necessary):
    • If any of the scripts were modified they have been tested and execute without error, e.g.:
      • ./font-patcher Inconsolata.otf --fontawesome --octicons --pomicons
      • ./gotta-patch-em-all-font-patcher\!.sh Hermit
  • Extended the README and documentation if necessary, e.g. You added a new font please update the table

What does this Pull Request (PR) do?

  • Update Cascadia Files in src/unpatched-fonts/CascadiaCode/ to latest release files.
  • Include italics
  • Use standard mechanism to create patched fonts
  • Patched fonts included in PR.

How should this be manually tested?

Use a font or two.

Any background context you can provide?

https://github.com/microsoft/cascadia-code/releases/tag/v2111.01

What are the relevant tickets (if any)?

Stalled #601

Screenshots (if appropriate or helpful)

@Finii
Copy link
Collaborator Author

Finii commented Dec 16, 2021

The standard font naming of font-patcher is not very nice for fonts with multiple weights (which Cascadia has).

See #717 (comment)

This PR uses a slightly modified font-patcher to get a more reasonable font grouping.
We use Really set Family to what we want (mentioned in comment linked above).

This has been done by modifying font-patcher:

--- a/font-patcher
+++ b/font-patcher
@@ -224,6 +224,17 @@ class font_patcher:
         #     self.args.weather is True
         # ])
 
+    def insert_sfnt(self, key, value):
+        found = False
+        table = list(self.sourceFont.sfnt_names)
+        for i, e in enumerate(table):
+            if e[1] != key:
+                continue
+            table[i] = ( e[0], key, value )
+            found = True
+        if not found:
+            table += [ ( "English (US)", key, value ) ]
+        self.sourceFont.sfnt_names = tuple(table)
 
     def setup_font_names(self):
         verboseAdditionalFontNameSuffix = " " + projectNameSingular
@@ -399,7 +410,7 @@ class font_patcher:
         self.sourceFont.fontname   = " ".join(fontname.split())
 
         self.sourceFont.appendSFNTName(str('English (US)'), str('Preferred Family'), self.sourceFont.familyname)
-        self.sourceFont.appendSFNTName(str('English (US)'), str('Family'), self.sourceFont.familyname)
+        self.insert_sfnt(str('Family'), self.sourceFont.familyname)
         self.sourceFont.appendSFNTName(str('English (US)'), str('Compatible Full'), self.sourceFont.fullname)
         self.sourceFont.appendSFNTName(str('English (US)'), str('SubFamily'), subFamily)
         self.sourceFont.comment = projectInfo
-- 
2.32.0

@Finii
Copy link
Collaborator Author

Finii commented Dec 16, 2021

Font naming details:

$ fontforge --script ~/git/nerd-fonts/bin/scripts/name_parser/query_relevant_names patched-fonts/CascadiaCode/**/*Complete.otf 2>/dev/null

 |PSname                                             | | Fullname                                           | | Family                         | | Subfamily                      | | Typogr. Family                 | | Typogr. Subfamily
 |-------------------------------------------------- |-| -------------------------------------------------- |-| ------------------------------ |-| ------------------------------ |-| ------------------------------ |-| ------------------------------
 |CaskaydiaCoveNerdFontComplete-BoldItalic           | | Caskaydia Cove Bold Italic Nerd Font Complete      | | CaskaydiaCove Nerd Font        | | Bold Italic                    | | CaskaydiaCove Nerd Font        | |
 |CaskaydiaCoveNerdFontComplete-Bold                 | | Caskaydia Cove Bold Nerd Font Complete             | | CaskaydiaCove Nerd Font        | | Bold                           | | CaskaydiaCove Nerd Font        | |
 |CaskaydiaCoveNerdFontComplete-ExtraLightItalic     | | Caskaydia Cove ExtraLight Italic Nerd Font Complet | | CaskaydiaCove Nerd Font        | | Italic                         | | CaskaydiaCove Nerd Font        | | ExtraLight Italic
 |CaskaydiaCoveNerdFontComplete-ExtraLight           | | Caskaydia Cove ExtraLight Nerd Font Complete       | | CaskaydiaCove Nerd Font        | | Regular                        | | CaskaydiaCove Nerd Font        | | ExtraLight
 |CaskaydiaCoveNerdFontComplete-LightItalic          | | Caskaydia Cove Light Italic Nerd Font Complete     | | CaskaydiaCove Nerd Font        | | Italic                         | | CaskaydiaCove Nerd Font        | | Light Italic
 |CaskaydiaCoveNerdFontComplete-Light                | | Caskaydia Cove Light Nerd Font Complete            | | CaskaydiaCove Nerd Font        | | Regular                        | | CaskaydiaCove Nerd Font        | | Light
 |CaskaydiaCoveNerdFontComplete-Italic               | | Caskaydia Cove Italic Nerd Font Complete           | | CaskaydiaCove Nerd Font        | | Italic                         | | CaskaydiaCove Nerd Font        | |
 |CaskaydiaCoveNerdFontComplete-Regular              | | Caskaydia Cove Regular Nerd Font Complete          | | CaskaydiaCove Nerd Font        | | Regular                        | | CaskaydiaCove Nerd Font        | |
 |CaskaydiaCoveNerdFontComplete-SemiBoldItalic       | | Caskaydia Cove SemiBold Italic Nerd Font Complete  | | CaskaydiaCove Nerd Font        | | Italic                         | | CaskaydiaCove Nerd Font        | | SemiBold Italic
 |CaskaydiaCoveNerdFontComplete-SemiBold             | | Caskaydia Cove SemiBold Nerd Font Complete         | | CaskaydiaCove Nerd Font        | | Regular                        | | CaskaydiaCove Nerd Font        | | SemiBold
 |CaskaydiaCoveNerdFontComplete-SemiLightItalic      | | Caskaydia Cove SemiLight Italic Nerd Font Complete | | CaskaydiaCove Nerd Font        | | Italic                         | | CaskaydiaCove Nerd Font        | | SemiLight Italic
 |CaskaydiaCoveNerdFontComplete-SemiLight            | | Caskaydia Cove SemiLight Nerd Font Complete        | | CaskaydiaCove Nerd Font        | | Regular                        | | CaskaydiaCove Nerd Font        | | SemiLight

with this helper script:

#!/usr/bin/env python
# coding=utf8

import fontforge
import sys

def get_sfnt_dict(font):
    """Extract SFNT table as nice dict"""
    return { k: v for l, k, v in font.sfnt_names }

def format_names(header, *stuff):
    """Unify outputs (with header)"""
    f = '{:1.1}|{:50.50} |{:1.1}| {:50.50} |{:1.1}| {:30.30} |{:1.1}| {:30.30} |{:1.1}| {:30.30} |{:1.1}| {:.30}'
    if header:
        d = '------------------------------------------------------------'
        return f.format(*stuff) + '\n' + f.format('', d, d, d, d, d, d, d, d, d, d, d)
    return f.format(*stuff).rstrip()

###### Let's go!

if len(sys.argv) < 2:
    print('Usage: {} font_name [font_name ...]\n'.format(sys.argv[0]))
    sys.exit(1)

print(format_names(True, '', 'PSname', '', 'Fullname', '', 'Family', '', 'Subfamily', '', 'Typogr. Family', '', 'Typogr. Subfamily'))

for filename in sys.argv[1:]:

    font = fontforge.open(filename)
    sfnt = get_sfnt_dict(font)
    fullname = font.fullname
    fontname = font.fontname
    font.close()

    sfnt_psname =  sfnt['PostScriptName']
    sfnt_full =    sfnt['Fullname']
    sfnt_fam =     sfnt['Family']
    sfnt_subfam =  sfnt['SubFamily']
    sfnt_pfam =    sfnt['Preferred Family'] if 'Preferred Family' in sfnt else ''
    sfnt_psubfam = sfnt['Preferred Styles'] if 'Preferred Styles' in sfnt else ''

    if fontname != sfnt_psname or fullname != sfnt_full:
        o1 = format_names(False, '!', fontname, '', fullname, '', '', '', '', '', '', '', '')
        o1 += '\n'
    else:
        o1 = ''
    o2 = format_names(False, '', sfnt_psname, '', sfnt_full, '', sfnt_fam, '', sfnt_subfam, '', sfnt_pfam, '', sfnt_psubfam)

    print(o1 + o2)

@Finii
Copy link
Collaborator Author

Finii commented Dec 16, 2021

Open questions

  • Add Cascadia Mono?
  • Use Cascadia * PL together with a partial --careful?
  • Font Family and SubFamily naming :-(

@Finii
Copy link
Collaborator Author

Finii commented Dec 16, 2021

We could also pull #717 (which does not change anything if users do not use --parser).

Generate Caskaydia Cove with --parser for this PR (secretly, without telling anyone). 😀

@ryanoasis
Copy link
Owner

We could also pull #717 (which does not change anything if users do not use --parser).

That's actually not a bad idea. I was thinking #717 would go with the next major release (3.0) but might be a good idea to incorporate it in a limited fashion and prove/test it out with some limited fonts (Cascadia)

Add Cascadia Mono?

I'd say no, not for now, but I don't have a strong opinion on that.

Font Family and SubFamily naming :-(

I think it's best to take the approach of incremental steps. There are a lot of issues and requests and it's all too tempting to try to tackle it all at once (or at least I can get lost in that way). At least here we get the font updated, names as it seems is going to take some time and trial and error to get better.

@ryanoasis
Copy link
Owner

I would like to merge this soon.

Generate Caskaydia Cove with --parser for this PR (secretly, without telling anyone).

I think maybe that is the most reasonable way forward and changes to patcher etc are going to now repatch the fonts upon changes to the font-patcher

@Finii
Copy link
Collaborator Author

Finii commented Dec 28, 2021

I did the patching again, but this time with all the bells and whistles ;-)

i.e.

Not sure if you want the result here, therefore it is in the fork: https://github.com/Finii/nerd-fonts/tree/feature/cascadia-2111.01

Related #731 bottom.

@ryanoasis
Copy link
Owner

Could you implement your flag idea (i.e. do some special logic with Cascadia only) so this will work okay with the release action? 🙇🏻

now that the fonts are rebuilding in CI there is going to continuously be conflicts and if I merge with --theirs that'll be fine but during a release they will get overwritten 😢

@Finii
Copy link
Collaborator Author

Finii commented Jan 10, 2022

Hope this is what you intended. The release action seems to use gotta-*.sh.

Hard reset to current master and cherry pick #732 and #717:

git reset --hard origin/master
git cherry-pick cfcd15aa25afa6450da6287864720ec4a2a3bbf2
git cherry-pick e5768e925cd023c31bdea80adc7c7d2157360488
git cherry-pick d8579b1b11e8154fcf958293cf5444accade5bcc
git cherry-pick d887391ca0ba7bb0d4930a3fb14246f37340708f
git cherry-pick e805b87997bf7dbe3d99fc3582e246d8c9cb4dda
git cherry-pick 2016539a9188c435256a63733b8b2216817dac54
git cherry-pick ae0f6bf3b7169f6e21db4c42049c7232a51b72ee
git cherry-pick 53f759a774e424f049d4f8f240c1ff0726a1c18b
git cherry-pick 89620ade6d78b21191d7e9194af8ebc141ab9680
git cherry-pick 778763b49f7a4cbd034432988b54c1b34a8dcf11
git cherry-pick af1eab2458474c8c524611ac341fd5920a0d70e0

cd src/unpatched-fonts/CascadiaCode
cp ~/Downloads/CascadiaCode-2111.01/otf/static/CascadiaCode-Bold* Bold      
cp ~/Downloads/CascadiaCode-2111.01/otf/static/CascadiaCode-ExtraLight* ExtraLight
cp ~/Downloads/CascadiaCode-2111.01/otf/static/CascadiaCode-Light* Light
cp ~/Downloads/CascadiaCode-2111.01/otf/static/CascadiaCode-Regular.otf Regular
cp ~/Downloads/CascadiaCode-2111.01/otf/static/CascadiaCode-Italic.otf Regular 
cp ~/Downloads/CascadiaCode-2111.01/otf/static/CascadiaCode-SemiBold* SemiBold
cp ~/Downloads/CascadiaCode-2111.01/otf/static/CascadiaCode-SemiLight* SemiLight

The result is 2b29a96

Then added a way to specify --parser in the config.cfg of individual source fonts. I was a bit hesitant to add a specific font name into the code; and in this way source fonts can be switched over one by one conveniently.

  • patch-em-all: Allow to specify font specific options 109d2aa
  • name-parser: Create more usable short (Windows) names 69fa09c
  • Update patched Cascadia (Caskaydia) 85d4783

I will push both changing commits (patch-em-all: options & name-parser: short names) also to #717, where it belongs.

Note: CodeClimate probably fails here, because one can not commit changes to the CodeClimate settings and have them into effect in one PR, I would have needed to push them one by one... (or there is a real issue)

So in summary: Merging this will implicitely pull

Edit: typo

@Finii Finii mentioned this pull request Jan 10, 2022
5 tasks
bin/scripts/gotta-patch-em-all-font-patcher!.sh Outdated Show resolved Hide resolved
font-patcher Outdated Show resolved Hide resolved
font-patcher Outdated Show resolved Hide resolved
bin/scripts/name_parser/README.md Show resolved Hide resolved
bin/scripts/name_parser/README.md Outdated Show resolved Hide resolved
bin/scripts/name_parser/README.md Outdated Show resolved Hide resolved
bin/scripts/name_parser/name_parser_test1 Outdated Show resolved Hide resolved
bin/scripts/name_parser/name_parser_test2 Outdated Show resolved Hide resolved
@ryanoasis
Copy link
Owner

ryanoasis commented Feb 6, 2022

I forgot to mention, and I'm not sure if it was because of a change I made to get it to run but.. there was strange script output for Cascadia:
Generated: CaskaydiaCoveNERDFONTCOMPLETE-Regular

Also, it generated file with names such as C a s k a y d i a C o v e N e r d F o n t C o m p l e t e Regular.otf or Caskaydia Cove N e r d F o n t C o m p l e t e Regular.otf

@Finii
Copy link
Collaborator Author

Finii commented Feb 6, 2022

Force push: Removed patched fonts from all the commits (as per #775 (comment)).
This improves future rebase actions (if needed).

Needed the rebase for this:
Add change to font-patcher.zip to include the now needed Module files.

@Finii
Copy link
Collaborator Author

Finii commented Feb 6, 2022

I forgot to mention, and I'm not sure if it was because of a change I made to get it to run but.. there was strange script output for Cascadia: Generated: CaskaydiaCoveNERDFONTCOMPLETE-Regular

Can reproduce...

Given this small 2-line-script:

#!/usr/bin/env python

from __future__ import absolute_import, print_function, unicode_literals

import sys
import os

sys.path.insert(0, os.path.abspath(os.path.dirname(sys.argv[0])) + '/bin/scripts/name_parser/')
from FontnameParser import FontnameParser
from FontnameTools import FontnameTools

parser_name = 'Cascadia Code Regular'
print(FontnameParser(parser_name).ps_fontname())
fini@Ryzen:~/git/nerd-fonts$ python3 aa.py
CaskaydiaCove-Regular
fini@Ryzen:~/git/nerd-fonts$ python2 aa.py
CASKAYDIACOVE-Regular

Interestingly it works OK under Python 2, if the from __future__ is dropped?!!

Edit: It is just the unicode_literals!

@Finii
Copy link
Collaborator Author

Finii commented Feb 6, 2022

Source

Drawbacks of unicode-literals

Adding unicode_literals to a module amounts to a “global flag day” for that module, changing the data types of all strings in the module at once. Cautious developers may prefer an incremental approach. (See here for an excellent article describing the superiority of an incremental patch-set in the the case of the Linux kernel.)

Changing to unicode_literals will likely introduce regressions on Python 2 that require an initial investment of time to find and fix. The APIs may be changed in subtle ways that are not immediately obvious.

Regressions 🙄

Reason known the fix will be easy *cough* ;)

Finii added a commit that referenced this pull request Mar 3, 2022
[why]
We want to patch some fonts with different font-patcher options.

[how]
Use the config.cfg file that each source font can have to specify one
arbitrary option to the font-patcher calls.

[note]
This is partially commit 9e2bc9a from #723.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Finii added a commit that referenced this pull request Mar 3, 2022
[why]
The symbol only fonts Symbols-1000-em Nerd Font Complete.ttf
and 2048-em in `NerdFontsSymbolsOnly/` are gerenated from
some 'almost' empty source fonts, that are assumably in turn generated
from the sfd font descriptions in `src/glyphs/`?

The process is not documented and we have issues in the generated font
(for example the glyph for capital `E` is defined (and empty) #581 #765).

[how]
Use the existing font definitions from `src/glyphs/*.sfd` directly as
source font. That needs a change in font-patcher because the empty
fonts have no glyphs that can be used to orient the scaling upon. In
that case scale on the source font definitions EM.

Then we need patch-em-all to also patch *.sfd fonts.

And finally we need patch-em-all to take a font specific command line
switch for font-patcher (compare 9e2bc9a of #723) to instruct it to
create a ttf rather than a sfd front file.

In the sfd file we additionally set the Panose type.
And the UnderlinePosition is adjusted to match the current patched font.

[note]
Also fix wrong glob pattern in patch-em-all `*.[o,t]tf`. The comma is
for sure some leftover from a '{}' shell pattern, that is not used
anymore.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Finii added a commit that referenced this pull request Mar 3, 2022
[why]
We want to patch some fonts with different font-patcher options.

[how]
Use the config.cfg file that each source font can have to specify one
arbitrary option to the font-patcher calls.

[note]
This is partially commit 9e2bc9a from #723.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Finii added a commit that referenced this pull request Mar 3, 2022
[why]
The symbol only fonts Symbols-1000-em Nerd Font Complete.ttf
and 2048-em in `NerdFontsSymbolsOnly/` are generated from
some 'almost' empty source fonts, that are assumable in turn generated
from the sfd font descriptions in `src/glyphs/`?

The process is not documented and we have issues in the generated font
(for example the glyph for capital `E` is defined (and empty) #581 #765).

[how]
Use the existing font definitions from `src/glyphs/*.sfd` directly as
source font. That needs a change in font-patcher because the empty
fonts have no glyphs that can be used to orient the scaling upon. In
that case scale on the source font definitions EM.

Then we need patch-em-all to also patch *.sfd fonts.

And finally we need patch-em-all to take a font specific command line
switch for font-patcher (compare 9e2bc9a of #723) to instruct it to
create a ttf rather than a sfd font file.

In the sfd file we additionally set the Panose type.
And the UnderlinePosition is adjusted to match the current patched font.

[note]
Also fix wrong glob pattern in patch-em-all `*.[o,t]tf`. The comma is
for sure some leftover from a '{}' shell pattern, that is not used
anymore.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Finii added a commit to Finii/nerd-fonts that referenced this pull request Mar 4, 2022
Use all stuff from PR ryanoasis#723 to allow correct font names.
Use fontforge HEAD to have no 16 bit field errors.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@RomelSan
Copy link

Thanks, tested the font and it is working.
I am using latest Windows Terminal.

@Finii Finii mentioned this pull request Apr 22, 2022
5 tasks
[why]
Some CJK fonts seem to have no Fullname.

[how]
But they have a Postscript name. Use that for parsing the names.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Under certain circumstances the WWS names (Family and Subfamily) are
used to identify a font. We do not touch these SFNT table entries, so
when the font is renamed these are wrong (have the original name).
Font-grouping will go wrong then.

[how]
The typographic ('Preferred') Family and Styles are set correctly
already and they follow the WWS pattern, so the WWS fields can be (and
should) be empty. They exist to allow font grouping in the case where
the typographic names do not follow that pattern.

Remove preexisting WWS entries (because they are not needed anymore,
otherwise we would need to write the corrected new names there).

We already set the WWS bit in fsSelection that is needed:
    def fs_selection(self, fs):
        """Modify a given fsSelection value for current name, bits 0, 5, 6, 8, 9 touched"""
        [...]
        b |= WWS # We assert this by our naming process
        return b

Unfortunately we have no way (jet) to set fsSelection.

This is only the case for Iosevka for all fonts in src/unpatched-fonts.

Reported-by: Rui Ming (Max) Xiong <xsrvmy>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
fontforge has an undocumented call to set the fsSelection bits.
Never rely on documentation :-(

Found this here:
fontforge/fontforge#3174

And the readback values are actually not read from the source font, so
we do not use them.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
A lot people expect the font-patcher to be a stand alone script. They
even think that the source glyphs (symbols) to be added to be somehow
magically there and one PR makes sure that they are fetched if missing.

The same problem arises when we have a script distributed over multiple
files. For maintenance reasons and code quality this is what one wants.
But that might hinder easy use of the font-patcher.

[how]
Put all the code in the main script.

That has an additional drawback: For the nameparser_test* scripts to
work we need stand alone files for that classes. Now the code is
duplicated and will get out of sync.

I have no solution for that, and it all boils down what Nerd Font wants
to do.

One solution would be to have font-patcher properly set up / divided in
many .py files, and to create one monolithic font-patcher from all the
sources on demand (via github actions or manually when someone pushes
changes to any of the constituends). That approach is taken by a lot of
C++ 'header only libraries' that originally consist of a lot files but
create one big 'all in one' file automatically from all the small files.

For now I guess we can live with the duplication, but we need to think
about a solution, as this will bite us sooner or later.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Also including the italic variants.

We do not use the PL versions but patch in the PL glyphs ourselves.
If this is smart can be discussed (I believe: no).

This does not add 'Cascadia Mono'.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
We want to patch Cascadia with `--parser` while all other fonts shall be
patched as before.

[how]
Use the config.cfg file that each source font can have to specify one
arbitrary option to the font-patcher calls.

This is just set in Cascadia's config.cfg, but can be extended to other
fonts gradually.

In this way the stand alone `font-patcher` works as before, unless
someone adds the `--parser` option. Which probably will become the
recommended way to use it over time.

The patch-em-all script on the other hand can be instructed to use or
not to use --parser on a font by font basis via their cfg file.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The fontname for Windows can be quite unusable, for example
  `CaskaydiaCoveNerdFontCompleteM-`
for several different fonts, as this is the maximum allowed length of 31
characters that is enforced.

The style/weight is completely lost.

[how]
Split the name into base and style (at a dash `-`) and just shrink the
base name. Result for example:
  `CaskaydiaCoveN-ExtraLightItalic`

Use equal approach for the PostScriptName (although it is less likely
that length limit is ever met).

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This reverts commit df42c91.

[why]
Having all the code in one big file is probably a maintenance nightmare.
We should develop other solutions to make the usage for end-users easy.
Future commits might do that.
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The option `--parser` instructs `font-patcher` to come up with the font
naming by utilizing the FontnameParser object.

This sounds logical from a programmers perspective, but the option name
is not descriptive for end users of `font-patcher`

[how]
As usual naming is hard. A short but maybe more descriptive name for the
option can be `--makegroups`; as it describes what the option means for
the end user: functioning font grouping.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Sometimes scripts can not be run.

[how]
Depending on installed python versions and 'alternatives' setup the
script's shebang needs to point to python3 of course.

Also the files need the executable bit set.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
People might want to use the font-patcher with just the one script file.
The error message does not help them to understand the problem.

[how]
Require the modules only if the user wants to use it (i.e. --makegroups).
Give the expected path in the error message.

We could also download the missing files instead, similar to #741
But that PR did not get any feedback yet, so I do not know if this is
something we want.

Anyhow, the fetching of missing parts should then be unified for both
usecases (i.e. Fontname* and src/glyphs).

And then, there is font-patcher.zip (which needs to be adapted), maybe
that is the way to go.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
The naming has bizarre blanks strewn in sometimes,
or is all caps. For example
`C a s k a y d i a   C o v e` or
`CASKAYDIACOVE-Regular`

[how]
When run under Python2 all strings are unicode strings because
`unicode_literals` is imported by `font-patcher`.
Unfortunately the code checks for type str; but that will all become
type unicode with the import.

One check is suboptimal anyhow and can be dropped, while the other is
turned around.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@Finii
Copy link
Collaborator Author

Finii commented Aug 20, 2022

Rebase on master (because manual merge conflict solving), force push

@Finii
Copy link
Collaborator Author

Finii commented Aug 20, 2022

Need to check:

  • docker
  • font-patcher.zip

Edit: It is in the zip and it should be in the docker. The later can only be checked after pulling this.
Edit: docker checked

@Finii
Copy link
Collaborator Author

Finii commented Aug 21, 2022

Do the name_parser tests...
See this for an explanation:
https://github.com/ryanoasis/nerd-fonts/blob/feature/cascadia-2111.01/bin/scripts/name_parser/README.md

$ fontforge name_parser_test1 ../../../src/unpatched-fonts/**/*.[ot]tf 2>/dev/null
[...]
Fonts with different name rendering: 69/601 (69/69 are in known_issues)
There are 3 lines not needed in known_issues, appending commented out in new known_issues

Reasons:

  • Lilex VF has been removed
$ fontforge name_parser_test2 ../../../src/unpatched-fonts/**/*.[ot]tf 2>/dev/null
Fonts with different name rendering: 437/598 (430/437 are in known_issues)
There are 552 lines not needed in known_issues, appending commented out in new known_issues

Reasons:

  • 67 Noto Serif Display fonts have been removed

  • 68 Noto Sans Display fonts have been removed

  • Noto Emoji has been removed

  • 2 Fura Mono Powerline have been changed

  • 67+68+1+2 = 138 --> four lines each = 552 lines

  • Added Cascadia Code Italic for ExtraLight, Light, SemiBold, SemiLight

  • Added Fira Mono Bold

Hmm, what is it about FuraMono / Fira Mono?
In older times Fira Mono was a RFN, so we called it FuraMono.
But the RFN has been removed at least in 2018 and 2019 for Mono.

We already list both as 'no RFN':
image

Related:

This still needs cleanup (and probably a source update?)

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@Finii
Copy link
Collaborator Author

Finii commented Aug 22, 2022

This is ready to be merged now.

  • It is added as experimental feature that people need to actively select with --makegroups
  • It is used by the CI only on Cascadia Code, later more fonts might follow (like in 3.0.0)

@Finii Finii merged commit 747e707 into master Aug 22, 2022
@Finii Finii deleted the feature/cascadia-2111.01 branch August 22, 2022 08:53
LNKLEO pushed a commit to LNKLEO/Nerd that referenced this pull request Nov 24, 2023
[why]
We want to patch some fonts with different font-patcher options.

[how]
Use the config.cfg file that each source font can have to specify one
arbitrary option to the font-patcher calls.

[note]
This is partially commit 9e2bc9a from ryanoasis#723.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
LNKLEO pushed a commit to LNKLEO/Nerd that referenced this pull request Nov 24, 2023
[why]
The symbol only fonts Symbols-1000-em Nerd Font Complete.ttf
and 2048-em in `NerdFontsSymbolsOnly/` are generated from
some 'almost' empty source fonts, that are assumable in turn generated
from the sfd font descriptions in `src/glyphs/`?

The process is not documented and we have issues in the generated font
(for example the glyph for capital `E` is defined (and empty) ryanoasis#581 ryanoasis#765).

[how]
Use the existing font definitions from `src/glyphs/*.sfd` directly as
source font. That needs a change in font-patcher because the empty
fonts have no glyphs that can be used to orient the scaling upon. In
that case scale on the source font definitions EM.

Then we need patch-em-all to also patch *.sfd fonts.

And finally we need patch-em-all to take a font specific command line
switch for font-patcher (compare 9e2bc9a of ryanoasis#723) to instruct it to
create a ttf rather than a sfd font file.

In the sfd file we additionally set the Panose type.
And the UnderlinePosition is adjusted to match the current patched font.

[note]
Also fix wrong glob pattern in patch-em-all `*.[o,t]tf`. The comma is
for sure some leftover from a '{}' shell pattern, that is not used
anymore. (This comment is probably outdated, due to rebasing.)

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants