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

Directory redesign and some new glyphs #47

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

barrycohen
Copy link

First of all, thanks for making Hack! It's an awesome font and the only thing that's come close to dragging me away from Droid Sans Mono for decades. It corrects problems I didn't even realise Droid had. Bold and italic variants, non-joining underscores, more legible comma, colon, semicolon and tilde etc.

Unfortunately, I've become indoctrinated to some of the glyphs in Droid so I couldn't seem to get comfortable with a curved 'i' and 'l', a '0' with a vertical line in it etc. I was excited to discover alt-hack and decided, with a bit of work, I could make my perfect programming font and maybe help others do the same.

alt-hack is a bit cumbersome to use because you have to know your u0457 from your u0069. The readme's help, of course, but you still have go through each directory and then select the glyphs one by one in patch-hack.sh.

I've shuffled all the files around so the directories now describe the change they make and can contain updates to several characters at once. Given that patch-hack.sh copies *.glif, this works seamlessly. So now you just have to select i-slab and all of the 'i'-like characters will be modified. I can't think of a scenario where someone might want 'iacute' with a slab and 'idieresis' without, but I may be missing a design decision.

Next, I've modified patch-hack.sh so it can be used from the command-line without modifying the tool, e.g.

HACK_PATH=/home/user/git/Hack ./patch-hack.sh i-slab one-noslab zero-diamond

I've also added a small section to automatically remove tt-hinting for modified glyphs by extracting the unicode hex code from the .glif file and commenting out any matching lines from tt-hinting/Hack-*-TA.txt from the Hack repository.

To satisfy my desire to create a better Droid Sans Mono, I've added a traditional percent sign, and ampersand without a gap, slabbed 'l' characters and 'g' characters with a bottom loop.

I've added a little script, create-pngs.sh, to help people create transparent .png files at a consistent size if they want to modify or add any glyphs to the alt-hack repository and I've popped a README.md in the base glyphs directory so you can see all of the variations at a glance. This script and the modifications to patch-hack.sh both pass shellcheck.

Finally, I've added some prebuilt .ttf variations with comparison sample images so people don't have to create a build environment and work out how to run shell scripts to get the most common modifications. One of the variations I've renamed to Hack Droid, which is now my daily font.

While staring at the glyphs in detail, I've noticed a few extra things which it would be nice to address someday:

  • I'm not sure both curved and rounder parentheses variations are necessary. They're very similar and it's confusing to see which one you ought to pick. Whilst I believe the curved variation is the preferred one by the author, I don't think that one is properly vertically centred (i.e. a close up smiley :-) looks a bit off). I didn't want to step on any toes by modifying it yet, though. Personally, I prefer a parenthesis with a flat top rather than flat edges, but I didn't want to add a third variation!
  • I'm not sure if it's necessary to keep square-brackets-oldv3 around, but it's not doing any harm!
  • one-noslab is great, but really we should also modify superscriptone, onequarter, onehalf etc.

@chrissimpkins
Copy link
Member

chrissimpkins commented Mar 29, 2020

Thank you very much for this PR Barry. I really appreciate your efforts here. This is an enormous amount of work and is going to take me a bit of time to get through it. I fixed the CI tests and it looks like there are a few issues that shellcheck is pointing out in the shell script. Let's wait on addressing them until I have an opportunity to work through all of your changes.

Will you please confirm the sources of all of your new designs here? Are these derivatives of an upstream typeface (e.g. Droid Sans Mono)? We'll need to confirm that the licensing is ok on anything that is coming into the repository from other code bases.

I really appreciate all of this. I'll take a look through it as soon as I can!

@barrycohen
Copy link
Author

Thanks for getting back to me, I appreciate you're busy on other projects!

The percent and ampersand came from Noto Sans Mono, because that font has a bold variant so I didn't have to do extra work to create those.

The 'g' came from Droid Sans which has a bold variant, even though Droid Sans Mono does not. I expanded the glyphs by 10% to make them the correct width for the monospace version.

I extended the bottom left part of the 'l' glyphs myself to create the slab 'l'.

I manually applied transformations in FontForge to create all of the italic and bolditalic variations.

Since I submitted the pull request, I've discovered the Hack dev branch, so I can see that the parentheses questions have been answered. Given that parentheses-curved has been incorporated into the dev branch, I think we should remove parentheses-rounder and put a comment against parentheses-curved to say it is the same version as the dev branch. Once the dev branch is merged into master, we can remove parentheses from alt-hack as there will no longer be any difference. We could create parentheses-oldv3 in case anyone wants to use the old glyphs, I suppose.

The prebuilt ttfs I've included do not have hinting applied. On Linux it makes no difference (assuming you're using the default settings of slight hinting). On Windows, I find the ttfautohint settings cause the whole font to be a bit taller which looks a bit strange to me! I believe there have been some issues reported against this behaviour. It doesn't happen if I use FontForge hinting (basically following this guide: https://github.com/fontforge/fontforge/wiki/How-TT-Hinting-Works). I'm not sure if it's a good idea to add ttfautohint hinting to these or not.

I'm using shellcheck 0.6.0 (the latest on Ubuntu 19.10) and I can't make it emit the warnings semaphore is producing, even with the minimum severity. I also don't agree that the quotes in "${1}" do nothing, as ${1} could be a path containing spaces.

It would be great to get the Hack dev branch merged into master so the new glyphs were available in the default build directory. It would also mean the updated hinting scripts were available for someone trying to build from the master branch.

@equwal
Copy link

equwal commented Sep 20, 2020

Hello,

I had a prototype setup to compile with Common Lisp at https://github.com/equwal/alt-hack. I didn't use the shell because I really hate writing shell scripts. I was about to try to make it into a shell script when I saw this.

One recommendation I can make from my experience is accepting formatting types as options like this:

./patch-hack.sh --ttf --woff --woff2 slabi

Since most of the time you don't need all three (programmers don't need the web fonts normally).

You might assist the maintainer a bit by separating this into two pull requests:

  • One pull request for the renaming and changes to patch-hack
  • One pull request for your new glyphs

Or some other configuration. It is best to do one thing per submission to avoid overloading the maintainer.

Also, you should rewrite that history and remove your /home/barry from the first commit.

…all variants of g with a loop; all variants of l with a slab
 - allow HACK_PATH to be provided as an environment variable
 - allow replacement glyphs to be provided as command-line arguments
 - automatically replace hinting rules for modified glyphs

Update README.md to describe some of the changes to the repository.

Added create-pngs.sh to create transparent pngs with a consistent size for all modified characters of a given font set.  This should help a developer produce pngs suitable for use on the alt-hack github site.
…ronment and build the whole font from scratch for some simple variations.
@barrycohen
Copy link
Author

Hi

Thanks for taking the time to look at the pull request!

I've rewritten the commit history to remove the erroneous directly inclusion, as scary as it is to alter the history of a public repository!

The patch-hack.sh script already takes glyphs on the command-line, so

./patch-hack.sh zero-diamond g-loop

will just patch those two glyphs. I can't do anything about which fonts are built (ttf, woff etc) because that's not part of alt-hack. Once the glyphs have been modified, you can run ./build-ttf.sh, ./build-woff.sh from the main Hack repository for that.

I appreciate why you might want to split this into two pull requests. The new glyphs are a different concern to the updated directory and build scheme. Unfortunately, it's a huge amount of work to do that! I would have to repackage all of my glyphs into the old directory style in order to submit just the new glyphs. And then submit a pull request just for renaming the old glyphs and the new directory structure. Only when both pull requests had been applied could I then combine them to produce this request.

@equwal
Copy link

equwal commented Sep 24, 2020

I've rewritten the commit history to remove the erroneous directly inclusion, as scary as it is to alter the history of a public repository!

It isn't like there is a community of people having to force pull your
pull request's branch; there is a community of people that will see your
history once it is pulled.

I appreciate why you might want to split this into two pull requests. The new glyphs are a different concern to the updated directory and build scheme. Unfortunately, it's a huge amount of work to do that! I would have to repackage all of my glyphs into the old directory style in order to submit just the new glyphs. And then submit a pull request just for renaming the old glyphs and the new directory structure. Only when both pull requests had been applied could I then combine them to produce this request.

I probably should have perceived that before I made by suggestion; you
are right: it is too late.

The patch-hack.sh script already takes glyphs on the command-line, so

./patch-hack.sh zero-diamond g-loop

will just patch those two glyphs. I can't do anything about which fonts are built (ttf, woff etc) because that's not part of alt-hack. Once the glyphs have been modified, you can run ./build-ttf.sh, ./build-woff.sh from the main Hack repository for that.

Actually, Hack's makefile does it for you:

make ttf woff woff2

That is okay if you don't want to do that, maybe I will take up that
project later. My solution to this problem, using my generator.ros program did
manage to include this, and I found it very useful.

https://github.com/equwal/alt-hack/blob/master/generator.ros

As you can see at the top of the tree, it used Hack as a submodule to do it.

However, that prototype is in Common Lisp and is itself a pain to build
properly, and not really a great choice for general use here.

@equwal
Copy link

equwal commented Jan 30, 2021

Now that I've been hacking on my cheap script for about six months, I'm firmly against any changes that will make it stop working!

So I hope you might abandon this pull request so I don't end up with additional work.

@barrycohen
Copy link
Author

The main goal of my pull request was to provide the extra glyphs: ampersand-nogap, g-loop, l-slab and percent-traditional.

The other changes just make it easier to navigate the repository, see all the alternative glyphs in one place, more easily build variants from the command-line etc.

If you have a better solution for any of those tasks, feel free to submit your own code for consideration. Bear in mind, it should be possible to add new alternatives to your solution, in order that my glyph variants can be included.

I can see you've created a website hosting many combinations of the existing glyph variants. As a casual user, you would still have to navigate through the alt-hack repository to see the variations, decide which you were interested in and hope you'd built that exact combination.

Rather than build and host every variant, it might be worth concentrating on something similar to the Input font, which allows you to select variations, preview them and then download them as a custom font, https://input.fontbureau.com/preview. This would be the gold standard for downloading alternatives.

I have no intention of abandoning my pull request because I believe the new glyphs are a valuable addition to the repository. I use a modified version of Hack every day (available as a pre-built configuration here: https://github.com/barrycohen/alt-hack/tree/master/prebuilt/hack-droid).

@equwal
Copy link

equwal commented Feb 1, 2021

The main goal of my pull request was to provide the extra glyphs: ampersand-nogap, g-loop, l-slab and percent-traditional.

The other changes just make it easier to navigate the repository, see all the alternative glyphs in one place, more easily build variants from the command-line etc.

If you have a better solution for any of those tasks, feel free to submit your own code for consideration. Bear in mind, it should be possible to add new alternatives to your solution, in order that my glyph variants can be included.

I can see you've created a website hosting many combinations of the existing glyph variants. As a casual user, you would still have to navigate through the alt-hack repository to see the variations, decide which you were interested in and hope you'd built that exact combination.

Actually, I built every possible combination and plan to keep doing that unless enough alternative glyphs are added that this becomes impractical.

Rather than build and host every variant, it might be worth concentrating on something similar to the Input font, which allows you to select variations, preview them and then download them as a custom font, https://input.fontbureau.com/preview. This would be the gold standard for downloading alternatives.

Yes, but I think the cardinality of the combination space was 236 fonts; not very many yet. Of course that is really cool and preferable to just hosting a giant font list.

Before I started hosting them I had people asking me to build fonts for them because of how absurd the Hack build process is.

I have no intention of abandoning my pull request because I believe the new glyphs are a valuable addition to the repository. I use a modified version of Hack every day (available as a pre-built configuration here: https://github.com/barrycohen/alt-hack/tree/master/prebuilt/hack-droid).

I still think you should split this up, otherwise you will end up having to be a permanent fork. And mostly I was trying to make a joke, I think there are good ideas in here.

@barrycohen
Copy link
Author

Sure, I think your tool and website are beneficial to people who want a specific build of the font but don't want to build it themselves. Kudos for going to the effort of building and hosting all the variations!

If my alternative glyphs were included, the number of combinations would be 2362222 = 3776. It might be worth figuring out how they do it for Input!

At this stage, I would say it's up to the alt-hack repository owner to decide which fork to merge and how they wish the build process to work. As we discussed in September, it would be a lot of work to separate this into two requests, and then further work to recombine it back into a single request if both were accepted.

@equwal
Copy link

equwal commented Feb 2, 2021

If my alternative glyphs were included, the number of combinations would be 236_2_2_2_2 = 3776. It might be worth figuring out how they do it for Input!

I made a similar analysis, but that is still only about 5Gb of space. I have 25Gb of space on my dirt-cheap VPS. I suppose more than that would be a problem because it would cost additional money.

For now I would consider a simple image displaying each font as a solution proportionate to the problem.

@barrycohen
Copy link
Author

I've had a little play around with adding stylistic alternates. The results are here: https://jsfiddle.net/bx68ye7h/1/. In case the fiddle stops working, it shows two buttons which allow you to toggle some of the font glyphs (just like the radio buttons for the Input font preview).

The idea is to create a single font which contains all of the glyphs. The custom font used in the fiddle contains alternate versions of the '3' and 'f' which can be toggled with alternate styles 'ss01' and 'ss02'.

If someone wants a build with certain replacements by default, you just have to modify the glyph codes within the base font with the alternative glyph names (e.g. 0x66 -> "f_knife" instead of "f"). This is a trivial operation compared to rebuilding the entire font from scratch and so could be done on a webserver to provide a customised download.

I think that's probably the way forward, but it's a lot of work!

@equwal
Copy link

equwal commented Feb 3, 2021

I've had a little play around with adding stylistic alternates. The results are here: https://jsfiddle.net/bx68ye7h/1/. In case the fiddle stops working, it shows two buttons which allow you to toggle some of the font glyphs (just like the radio buttons for the Input font preview).

Well, it doesn't work for me as it is.

The idea is to create a single font which contains all of the glyphs. The custom font used in the fiddle contains alternate versions of the '3' and 'f' which can be toggled with alternate styles 'ss01' and 'ss02'.

If someone wants a build with certain replacements by default, you just have to modify the glyph codes within the base font with the alternative glyph names (e.g. 0x66 -> "f_knife" instead of "f"). This is a trivial operation compared to rebuilding the entire font from scratch and so could be done on a webserver to provide a customised download.

This is really clever!

I think that's probably the way forward, but it's a lot of work!

This is why I'm not going to be maintaining such a thing on my site (though I would accept a simple image showing different fonts), because I don't want to have to maintain a complex javascript thing. Cheers to you or anyone who wants to do that.

In the event that such a thing was about as simple as an input form/POST request I guess I wouldn't mind it.

@equwal
Copy link

equwal commented Feb 3, 2021

If my alternative glyphs were included, the number of combinations would be 236_2_2_2_2 = 3776. It might be worth figuring out how they do it for Input!

At this stage, I would say it's up to the alt-hack repository owner to decide which fork to merge and how they wish the build process to work. As we discussed in September, it would be a lot of work to separate this into two requests, and then further work to recombine it back into a single request if both were accepted.

Well, if you change your mind and make a fork with your new variants that doesn't change the directory tree, I'll also host them.

@barrycohen
Copy link
Author

Creating a repository which just contains the new glyphs wasn't too hard. Please see https://github.com/barrycohen/alt-hack-new-glyphs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants