rolandwalker / unicode-fonts

Configure Unicode fonts for Emacs
227 stars 28 forks source link

Suggestions to drastically simplify this package #30

Open wyuenho opened 4 years ago

wyuenho commented 4 years ago

All this package does is to override Emacs' font backends to provide a better font fallback behavior, but right now, every block especially the CJK blocks are littered with a mix of serif and sans-serif fonts, and some old optional system fonts that require additional downloads either from the OS font manager or manually from the internet, and all in different orderings. This makes the out of the box experience not much better than the default Emacs behavior. The font choices are just as random for each block.

The reason seems to be the unicode-fonts-known-font-characteristics variable is just a dump of old Windows and macOS system font lists. In addition, a lot of the fonts like the brush, cursive, pen and Kai styles are purely stylistic and not designed to provide good Unicode coverage or used for plaintext display, but somehow made into the block mappings.

In the course of fixing this, I've discovered that with the exception of a couple of symbol blocks, a block only requires a couple of fonts to provide good coverage - a few from Windows, a few from macOS, Noto and maybe an exotic font purely designed for coverage for that block, so here's my suggestions for improvements to provide a better default experience:

  1. Drastically reduce the list of known fonts to the most basic serif and sans-serif default system fonts with good coverage and a couple of good fallbacks fonts for their respective blocks (i.e. Arial Unicode MS, MS JhengHei, PingFang, Noto*, Dejavu, Symbola etc.)
  2. Label each font with their typeface, and add 2 entries into unicode-fonts-skip-font-groups (serif and sans-serif, so the user can choose to filter out those that conflict with their default font typeface)
  3. Let the user to put unknown fonts in the block mapping without skipping, so we don't have keep maintaining the ever-expanding list of known fonts.
  4. Redo the entire list of block mappings to provide consistent ordering, sorted by (typeface, coverage)
  5. Maybe a different custom option per block so we don't get a massive dump of the entire block mapping into the custom file when the user just wants to remap one block.

What do you think?

rolandwalker commented 4 years ago

Hi!

I wrote this library so long ago that I depended on the Code2000 font. It was long before Noto, and the situation with available fonts was much more of a patchwork.

In general I agree with your points, though I don't understand how number 3 would be implemented.

As to number 4, aren't fonts mostly sorted by coverage already, per the comments?

As to number 5, yes, the original design of a single customize option was a mistake. An API for specifying fonts might be nicer than customize.

wyuenho commented 4 years ago

3) Remove all the whitelist/blacklist options. Basically, with a drastically reduced set of modern Unicode fonts, you don't need them anymore. Currently, even on my 7 year old MBP, the first time only takes seconds and with caches, the slow down is basically unnoticeable.

rolandwalker commented 4 years ago

@wyuenho would you like to become a collaborator on this repository?

wyuenho commented 4 years ago

@rolandwalker Thanks for the offer. I'm currently experiment implementing this, and I'm afraid it's growing to almost a complete rewrite. Let me think about this more. There are a lot of really good foundations built into this package and its dependencies that I don't want to throw away.

hpfr commented 2 years ago

@wyuenho Are you able to publish what you have?