-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Feature: Select name source #1319
Conversation
[why] A lot arguments need one user supplied value, but that is not enforced. For example font-patcher src/unpatched-fonts/Agave/Agave-Regular.ttf --out results in a crash, because the needed output directory has not been passed, but the default is also not used. The problem is that the option is defined to take any amount of values, includeing zero values (and more than one value). That all does not make sense. The switch does need exactly one value. [how] Remove the wrong nargs specification. Instead use the default, which is 'expect one value' for the default action 'store'. Instead of a crash the user is now presented with this output: font-patcher: error: argument -out/--outputdir: expected one argument Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why] In the post we used these information sources to determine the name and weights/styles of the to-be-patched font: * The filename * The fullname (ID 4) * The postscriptname (ID 6) Usually it is best to use the Fullname of a font to determine its real name and styles/weights: The Postscript name has the advantage to have a hyphen between name and styles/weight; but as it can not contain blanks the correct name can not be determined by this. To get the styles/weights back we use a list of all possible (?!) weights and styles and sort all the string parts. This works reasonably well and the fullname is usually best. Not so with Input Mono Condensed. Here are its names: ID4: "InputMonoCondensed LightIta" IF6: "InputMonoConsensed-LightItalic" [how] Add option to select between fullname and postscriptname as font naming source. For special purposes, also allow a custom (arbitrary) name input. If that is given the specified name will be used to name the patched font without adding any suffix - the user has full control on the name. Fixes: #1314 Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Oh. Well, I guess you can't because blanks are always removed from the name (e.g. Can you describe your use-case? |
$ fontforge font-patcher --dry --debug 2 --name 'Example Mono' src/unpatched-fonts/Agave/Agave-Regular.ttf
[...]
DEBUG: =====> Family (ID 1) ok (11 <=31): ExampleMono
DEBUG: =====> SubFamily (ID 2) ok ( 7 <=31): Regular
DEBUG: =====> Fullname (ID 4) ok (11 <=63): ExampleMono
DEBUG: =====> PSN (ID 6) ok (11 <=63): ExampleMono
DEBUG: =====> Filename 'ExampleMono-Regular.ttf' If you can edit the |
Maybe that should be the default if Use case would be helpful to decide on this. I in fact did not think anybody would ever use that feature :-D |
I just want to get a font name that is as short as possiable. e.g.: Input Mono #1314
Yeah, It works like I expected. Thanks!
It should be default, IMO. Becuase user explicitly specified a name contains space, but space disappeared after patching. |
Makes sense, thank you. Will change accordingly. |
[why] If a user specified a name we should probably not camel-casify it. Fixes (idea mentioned in): #1319 Suggested-by: HUMORCE Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Implemented via 12b51f5 in |
[why] If a user specified a name we should probably not camel-casify it. Fixes (idea mentioned in): ryanoasis#1319 Suggested-by: HUMORCE Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
Description
font-patcher: Add option to select postscript name as name source
[why]
In the post we used these information sources to determine the name and
weights/styles of the to-be-patched font:
Usually it is best to use the Fullname of a font to determine its real
name and styles/weights:
The Postscript name has the advantage to have a hyphen between name and
styles/weight; but as it can not contain blanks the correct name can not
be determined by this. To get the styles/weights back we use a list of
all possible (?!) weights and styles and sort all the string parts.
This works reasonably well and the fullname is usually best.
Not so with Input Mono Condensed. Here are its names:
ID4:
"InputMonoCondensed LightIta"
ID6:
"InputMonoConsensed-LightItalic"
[how]
Add option to select between fullname and postscriptname as font naming
source.
For special purposes, also allow a custom (arbitrary) name input.
If that is given the specified name will be used to name the patched
font without adding any suffix - the user has full control on the name.
Fixes: #1314
Requirements / Checklist
What does this Pull Request (PR) do?
How should this be manually tested?
Any background context you can provide?
What are the relevant tickets (if any)?
Screenshots (if appropriate or helpful)