githubnext / monaspace

An innovative superfamily of fonts for code
https://monaspace.githubnext.com
SIL Open Font License 1.1
13.16k stars 219 forks source link

post.isFixedPitch #132

Closed Finii closed 2 months ago

Finii commented 7 months ago

Probably you want the font to be detected as monospaced.

Apart from the missing Panose values

the font is not really monospaced, although it could be. The width of the font is generally 1240.

The most obvious errors in being monospaced are:

.notdef -> width 965

image

uni2123 -> width 7440 (!!!)

image

Apart from the wrong width (you could in principle just make the advance width standard and have a very big right side bearing), the glyph itself is questionable (see #51).

All the other non-conforming widths are from the ligatures.

Here a complete list of all glyphs with a differing width (patched the fontforge font generation code):

``` Running CIDOneWidth(SplineFont) CIDOneWidth width 965 for glyph '.notdef' (#0) CIDOneWidth width 3720 for glyph 'hyphen_hyphen_greater' (#1fc) CIDOneWidth width 2480 for glyph 'hyphen_greater' (#1fd) CIDOneWidth width 2480 for glyph 'parenleft_asterisk' (#1fe) CIDOneWidth width 3720 for glyph 'parenleft_asterisk_parenright' (#1ff) CIDOneWidth width 2480 for glyph 'period_hyphen' (#200) CIDOneWidth width 2480 for glyph 'period_period' (#201) CIDOneWidth width 3720 for glyph 'period_period_hyphen' (#202) CIDOneWidth width 3720 for glyph 'period_period_period' (#203) CIDOneWidth width 3720 for glyph 'period_period_equal' (#204) CIDOneWidth width 3720 for glyph 'period_period_less' (#205) CIDOneWidth width 2480 for glyph 'period_equal' (#206) CIDOneWidth width 2480 for glyph 'colon_colon' (#207) CIDOneWidth width 3720 for glyph 'colon_colon_colon' (#208) CIDOneWidth width 2480 for glyph 'colon_equal' (#209) CIDOneWidth width 2480 for glyph 'colon_greater' (#20a) CIDOneWidth width 2480 for glyph 'colon_less' (#20b) CIDOneWidth width 2480 for glyph 'semicolon_semicolon' (#20c) CIDOneWidth width 2480 for glyph 'exclam_exclam' (#20d) CIDOneWidth width 2480 for glyph 'exclam_equal' (#20e) CIDOneWidth width 3720 for glyph 'exclam_equal_equal' (#20f) CIDOneWidth width 2480 for glyph 'exclam_asciitilde' (#210) CIDOneWidth width 2480 for glyph 'question_period' (#211) CIDOneWidth width 2480 for glyph 'question_colon' (#212) CIDOneWidth width 2480 for glyph 'question_question' (#213) CIDOneWidth width 2480 for glyph 'asterisk_parenright' (#214) CIDOneWidth width 3720 for glyph 'asterisk_asterisk_asterisk' (#215) CIDOneWidth width 2480 for glyph 'asterisk_slash' (#216) CIDOneWidth width 2480 for glyph 'numbersign_numbersign' (#217) CIDOneWidth width 3720 for glyph 'numbersign_numbersign_numbersign' (#218) CIDOneWidth width 2480 for glyph 'numbersign_equal' (#219) CIDOneWidth width 2480 for glyph 'slash_asterisk' (#21a) CIDOneWidth width 3720 for glyph 'slash_asterisk_slash' (#21b) CIDOneWidth width 2480 for glyph 'slash_equal' (#21c) CIDOneWidth width 3720 for glyph 'slash_equal_equal' (#21d) CIDOneWidth width 2480 for glyph 'slash_greater' (#21e) CIDOneWidth width 2480 for glyph 'slash_slash' (#21f) CIDOneWidth width 3720 for glyph 'slash_slash_slash' (#220) CIDOneWidth width 2480 for glyph 'slash_backslash' (#221) CIDOneWidth width 2480 for glyph 'backslash_slash' (#222) CIDOneWidth width 2480 for glyph 'ampersand_ampersand' (#250) CIDOneWidth width 2480 for glyph 'bar_bar' (#251) CIDOneWidth width 2480 for glyph 'bar_greater' (#252) CIDOneWidth width 2480 for glyph 'equal_colon' (#253) CIDOneWidth width 3720 for glyph 'equal_colon_equal' (#254) CIDOneWidth width 3720 for glyph 'equal_exclam_equal' (#255) CIDOneWidth width 2480 for glyph 'equal_equal' (#256) CIDOneWidth width 3720 for glyph 'equal_equal_equal' (#257) CIDOneWidth width 2480 for glyph 'equal_greater' (#258) CIDOneWidth width 2480 for glyph 'equal_asciitilde' (#259) CIDOneWidth width 3720 for glyph 'equal_slash_equal' (#25a) CIDOneWidth width 2480 for glyph 'greater_colon' (#25b) CIDOneWidth width 2480 for glyph 'greater_equal' (#25c) CIDOneWidth width 2480 for glyph 'less_hyphen' (#25d) CIDOneWidth width 2480 for glyph 'less_colon' (#25e) CIDOneWidth width 4960 for glyph 'less_exclam_hyphen_hyphen' (#25f) CIDOneWidth width 2480 for glyph 'less_bar' (#260) CIDOneWidth width 2480 for glyph 'less_equal' (#261) CIDOneWidth width 2480 for glyph 'less_asciitilde' (#262) CIDOneWidth width 3720 for glyph 'less_asciitilde_greater' (#263) CIDOneWidth width 3720 for glyph 'less_asciitilde_asciitilde' (#264) CIDOneWidth width 2480 for glyph 'less_slash' (#265) CIDOneWidth width 3720 for glyph 'less_slash_greater' (#266) CIDOneWidth width 2480 for glyph 'asciitilde_greater' (#267) CIDOneWidth width 2480 for glyph 'asciitilde_asciitilde' (#268) CIDOneWidth width 3720 for glyph 'asciitilde_asciitilde_greater' (#269) CIDOneWidth width 7440 for glyph 'uni2123' (#278) CIDOneWidth width 0 for glyph 'uni0308' (#2e3) CIDOneWidth width 0 for glyph 'uni0307' (#2e4) CIDOneWidth width 0 for glyph 'gravecomb' (#2e5) CIDOneWidth width 0 for glyph 'acutecomb' (#2e6) CIDOneWidth width 0 for glyph 'uni030B' (#2e7) CIDOneWidth width 0 for glyph 'uni030C.alt' (#2e8) CIDOneWidth width 0 for glyph 'uni0302' (#2e9) CIDOneWidth width 0 for glyph 'uni030C' (#2ea) CIDOneWidth width 0 for glyph 'uni0306' (#2eb) CIDOneWidth width 0 for glyph 'uni030A' (#2ec) CIDOneWidth width 0 for glyph 'tildecomb' (#2ed) CIDOneWidth width 0 for glyph 'uni0304' (#2ee) CIDOneWidth width 0 for glyph 'dotbelowcomb' (#2ef) CIDOneWidth width 0 for glyph 'uni0326' (#2f0) CIDOneWidth width 0 for glyph 'uni0327' (#2f1) CIDOneWidth width 0 for glyph 'uni0328' (#2f2) CIDOneWidth width 0 for glyph 'uni0308.case' (#2f3) CIDOneWidth width 0 for glyph 'uni0307.case' (#2f4) CIDOneWidth width 0 for glyph 'gravecomb.case' (#2f5) CIDOneWidth width 0 for glyph 'acutecomb.case' (#2f6) CIDOneWidth width 0 for glyph 'uni030B.case' (#2f7) CIDOneWidth width 0 for glyph 'uni0302.case' (#2f8) CIDOneWidth width 0 for glyph 'uni030C.case' (#2f9) CIDOneWidth width 0 for glyph 'uni0306.case' (#2fa) CIDOneWidth width 0 for glyph 'uni030A.case' (#2fb) CIDOneWidth width 0 for glyph 'tildecomb.case' (#2fc) CIDOneWidth width 0 for glyph 'uni0304.case' (#2fd) ```

The ligatures substitute multiple 1240 wide glyphs with one extrawide liga glyph. That could also be formulated differently, so that the ligature glyph itself has the standard width but a wide right side bearing, here a comparison for example with Cascadia:

image

They substitude ( and * by parenleft-asterix.liga and LIG, where both parenleft-asterix.liga and LIG are of standard width, LIG is just empty. You have a different approach. I'm not sure what is better; most fonts I have examined have the 'all glyphs have the same width' approach. At least with that approach it gets isFixedPitch set.

Finii commented 7 months ago

Ah, another downside of the way the ligs are formulated here (substitude two glyphs to one glyph with increased width) is

Changing the ligature formulation would probably solve both (but I feel the pain in reformulating the ligs).

idan commented 7 months ago

Split off the notdef glyph width into #159

idan commented 2 months ago

Fixed in ca8015b27bdc6d8e1201b1ad722f4ae3c38970d0