IdreesInc / Monocraft

A monospaced programming font inspired by the Minecraft typeface
https://idreesinc.com
SIL Open Font License 1.1
8.02k stars 115 forks source link

Extend characters with European non-latin set #105

Closed dantaeusb closed 1 year ago

dantaeusb commented 1 year ago

This pull request contains all implemented european non-latin letters, without margins.

While definitions seem correct to me, with the current shape implementation, there are few issues to fix alongside:

1. Characters longer than 5px are overlapping other characters.

Examples with Georgian and Armenian scripts:

Screenshot 2023-02-05 at 23 55 00 Screenshot 2023-02-05 at 23 55 07 Screenshot 2023-02-05 at 23 55 03 Screenshot 2023-02-05 at 23 55 09

2. Descent pixels, which are lower than 7px border, seem to be cut off, even with correct descent parameter:

kart-issue

dantaeusb commented 1 year ago

I believe it addresses the #41, #75. Though for Hebrew, some adjustments might be useful.

A couple of letters seem to be off, for example ע

Screenshot 2023-02-06 at 00 15 06
dantaeusb commented 1 year ago

Also, Cyrillic ц is misaligned, missing descent: 1

Screenshot 2023-02-06 at 01 30 40
dantaeusb commented 1 year ago

Results I was able to achieve on non-monospaced font (all webkit, macOS Chrome):

With smoothing, 16px Screenshot 2023-02-06 at 03 44 04

No smoothing, 16px Screenshot 2023-02-06 at 03 44 13

No smoothing, 8px (original size) Screenshot 2023-02-06 at 03 44 30

Some notable details:

Using bearings instead of extra pixel in fixed width:

monocraft[character["name"]].left_side_bearing = math.floor(PIXEL_SIZE / 2)
monocraft[character["name"]].right_side_bearing = math.floor(PIXEL_SIZE / 2)

Which works surprisingly well. Though, probably won't help to fit more into long letters. But margins could.

The cut-off of the descent pixels could be either a macOS preview bug, or miscalculated size. For size to work properly, I found those parameters to work the best:

monocraft.design_size = 8
monocraft.em = math.floor(PIXEL_SIZE * 7.75)

UPD: I think it needs further tweaking. I used 8 as a “design size”, as I thought it's the tallest character, but with diacritics I believe it could reach as much as 12px (LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW). Tweaking greatly improves sharpness with WebKit AA, but not much with JetBrains AA.

UPD2: Apparently, those settings are working good only in macOS Webkit renderer. As I find macOS users who would like to render this font in smallest size without anti-aliasing rare, I don't think those settings should be considered.

IdreesInc commented 1 year ago

Wow, this is insane work, thank you for adding all of these characters! Due to the sheer number of characters added, I'll need a bit of time to review this before merging it in. Especially since we are about to release https://github.com/IdreesInc/Monocraft/pull/112 which might change the appearance of certain characters. Thanks again for this contribution and the accompanying notes!

IdreesInc commented 1 year ago

Coming back to this, once again amazed at the number of glyphs added to the glyphset. I've looked through them from an english-speaking perspective and see no obvious bugs, but I am going to release this as a "beta" for a few days and see if anyone sees anything I might have missed. Thank you once again for the work you have put into this, it is very much appreciated.