python / cpython

The Python programming language
https://www.python.org
Other
63.27k stars 30.29k forks source link

IDLE: Auto measure font fixed pitch characteristics #79949

Open terryjreedy opened 5 years ago

terryjreedy commented 5 years ago
BPO 35768
Nosy @terryjreedy

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields: ```python assignee = 'https://github.com/terryjreedy' closed_at = None created_at = labels = ['3.8', 'expert-IDLE', 'type-feature', '3.7'] title = 'IDLE: Auto measure font fixed pitch characteristics' updated_at = user = 'https://github.com/terryjreedy' ``` bugs.python.org fields: ```python activity = actor = 'terry.reedy' assignee = 'terry.reedy' closed = False closed_date = None closer = None components = ['IDLE'] creation = creator = 'terry.reedy' dependencies = [] files = [] hgrepos = [] issue_num = 35768 keywords = [] message_count = 1.0 messages = ['333939'] nosy_count = 1.0 nosy_names = ['terry.reedy'] pr_nums = [] priority = 'normal' resolution = None stage = 'test needed' status = 'open' superseder = None type = 'enhancement' url = 'https://bugs.python.org/issue35768' versions = ['Python 3.7', 'Python 3.8'] ```

terryjreedy commented 5 years ago

The greatly expanded configdialog Font tab multi-alphabet sample reveals to some degree how well tk fills in BMP Unicode characters on a particular machine. It also lets users extend the sample.

The sample has 2 lines of 20 ascii characters each and lines of 20 non-Latin1, IPA, Greek, Cyrillic, Hebrew, and Arabic characters. The intention is to let one see if a font (as extended) is fixed-pitch for Ascii and if that property extends to any of those other European and Near East alphabets. On my machine, the number of fixed alphabets varies from 0, 1 (ascii), 2 (rest of Latin1) up to 7 (for Courier) (and some in between).

On bpo-35196, Raymond Hettinger asked whether fixed-pitch fonts could be detected. With the caveat that this property is not binary unless we restrict attention to Ascii, yes. Without measuring each character, we could check the ascii lines and then the others. We could then highlight the lines in the sample that pass.

Before coding, we need to experiment a bit with the Font measuring method. Should we cache results in .idlerc?

For all the fonts on my machine, the East Asian CJK characters are filled in with a fixed-pitch that is about 1.6 to 1.8 (not 2.0) times the Ascii fixed or average pitch.

Raymond also suggested limiting the font list to those with fixed ascii. I think at least segregating fixed Ascii pitch fonts to make them easy to find is a great idea. Some detail need to be thought about.