source-foundry / Hack

A typeface designed for source code
http://sourcefoundry.org/hack/
Other
16.43k stars 613 forks source link

Extend upper serif in "i" (0069) #641

Open elshize opened 1 year ago

elshize commented 1 year ago

Right off the bat, let me apologize for using any incorrect terms, I have very limited knowledge of typography. Suffice it to say, I am talking about the little horizontal line extending from the middle to the left.

For the longest time I felt that something was wrong with the lowercase i but I could not put my finger on it. But I think I sort of figured out what has been bothering me. As the i was essentially created by removing the left part of the slab from the original glyph, it lost its balance. It feels a bit narrow and often feels very disconnected from the preceding letter. For comparison, here is the current contour of i overlaid with l:

image

This is less of a problem in very low sizes, but once we get to larger sizes (for example, I use 19px, which is 13pt on my 2k monitor; on 4k). I believe extending this upper part a little further to the left makes a big, though very subtle, difference.

I don't really know how to property edit .ufo files (couldn't find any software I could use that worked), but I hacked (pun intended) the source file directly, borrowing the coordinates from l. Here's the results:

hack-regular-extended-top

This is on Linux/Wayland/Foot terminal.

I haven't done careful comparison in lower sizes; I wanted to see what you think first before committing too much work into it.

Here is the change I applied:

diff --git a/source/Hack-Regular.ufo/glyphs/i.glif b/source/Hack-Regular.ufo/glyphs/i.glif
index dbbe950bc..27601f5d1 100644
--- a/source/Hack-Regular.ufo/glyphs/i.glif
+++ b/source/Hack-Regular.ufo/glyphs/i.glif
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <glyph name="i" format="2">
-  <advance width="1233"/>
+  <advance width="1271"/>
   <unicode hex="0069"/>
   <outline>
     <contour>
@@ -27,8 +27,8 @@
       <point x="513" y="140.281"/>
       <point x="513" y="398" type="curve" smooth="yes"/>
       <point x="513" y="976" type="line"/>
-      <point x="268" y="976" type="line"/>
-      <point x="268" y="1120" type="line"/>
+      <point x="180" y="976" type="line"/>
+      <point x="180" y="1120" type="line"/>
       <point x="697" y="1120" type="line"/>
       <point x="697" y="398" type="line" smooth="yes"/>
       <point x="697" y="235.65"/>

~BTW, when I build it with this change, some applications work ok (like my terminal) and some seem to fall back to bold font (like my browser). Is there something I am missing here, am I doing it wrong?~ Clearing font cache fixed this.

elshize commented 1 year ago

Alternatively, here's the diff for "i" aligned with "l":

diff --git a/source/Hack-Regular.ufo/glyphs/i.glif b/source/Hack-Regular.ufo/glyphs/i.glif
index dbbe950bc..592ff10a4 100644
--- a/source/Hack-Regular.ufo/glyphs/i.glif
+++ b/source/Hack-Regular.ufo/glyphs/i.glif
@@ -4,38 +4,38 @@
   <unicode hex="0069"/>
   <outline>
     <contour>
-      <point x="523" y="1323" type="line" smooth="yes"/>
-      <point x="503" y="1323"/>
-      <point x="493" y="1333"/>
-      <point x="493" y="1353" type="curve" smooth="yes"/>
-      <point x="493" y="1526" type="line" smooth="yes"/>
-      <point x="493" y="1546"/>
-      <point x="503" y="1556"/>
-      <point x="523" y="1556" type="curve" smooth="yes"/>
-      <point x="667" y="1556" type="line" smooth="yes"/>
-      <point x="687" y="1556"/>
-      <point x="697" y="1546"/>
-      <point x="697" y="1526" type="curve" smooth="yes"/>
-      <point x="697" y="1353" type="line" smooth="yes"/>
-      <point x="697" y="1333"/>
-      <point x="687" y="1323"/>
-      <point x="667" y="1323" type="curve" smooth="yes"/>
+      <point x="485" y="1323" type="line" smooth="yes"/>
+      <point x="465" y="1323"/>
+      <point x="455" y="1333"/>
+      <point x="455" y="1353" type="curve" smooth="yes"/>
+      <point x="455" y="1526" type="line" smooth="yes"/>
+      <point x="455" y="1546"/>
+      <point x="465" y="1556"/>
+      <point x="485" y="1556" type="curve" smooth="yes"/>
+      <point x="629" y="1556" type="line" smooth="yes"/>
+      <point x="649" y="1556"/>
+      <point x="659" y="1546"/>
+      <point x="659" y="1526" type="curve" smooth="yes"/>
+      <point x="659" y="1353" type="line" smooth="yes"/>
+      <point x="659" y="1333"/>
+      <point x="649" y="1323"/>
+      <point x="629" y="1323" type="curve" smooth="yes"/>
     </contour>
     <contour>
-      <point x="859" y="-8" type="line" smooth="yes"/>
-      <point x="639.367" y="-8"/>
-      <point x="513" y="140.281"/>
-      <point x="513" y="398" type="curve" smooth="yes"/>
-      <point x="513" y="976" type="line"/>
-      <point x="268" y="976" type="line"/>
-      <point x="268" y="1120" type="line"/>
-      <point x="697" y="1120" type="line"/>
-      <point x="697" y="398" type="line" smooth="yes"/>
-      <point x="697" y="235.65"/>
-      <point x="760.108" y="148"/>
-      <point x="877" y="148" type="curve" smooth="yes"/>
-      <point x="1092" y="148" type="line"/>
-      <point x="1092" y="-8" type="line"/>
+      <point x="821" y="-8" type="line" smooth="yes"/>
+      <point x="601.367" y="-8"/>
+      <point x="475" y="140.281"/>
+      <point x="475" y="398" type="curve" smooth="yes"/>
+      <point x="475" y="976" type="line"/>
+      <point x="180" y="976" type="line"/>
+      <point x="180" y="1120" type="line"/>
+      <point x="659" y="1120" type="line"/>
+      <point x="659" y="398" type="line" smooth="yes"/>
+      <point x="659" y="235.65"/>
+      <point x="722.108" y="148"/>
+      <point x="839" y="148" type="curve" smooth="yes"/>
+      <point x="1054" y="148" type="line"/>
+      <point x="1054" y="-8" type="line"/>
     </contour>
   </outline>
   <lib>
elshize commented 1 year ago

Here's a preview for the i-shifted-to-align-with-l change (starts with 19px and goes down by one pixel to 10px): hacked-black-on-white hacked-white-on-black