CR6Community / CR-6-touchscreen

CR-6 SE touchscreen software extended with more functionality and pages than the stock CR-6 touchscreen software.
https://cr6community-support-team.gitbook.io/cr6comm-touchscreen-refactored-firmware-docs/
152 stars 34 forks source link

Improve font rendering to prevent clipping and preserve proper kerning #31

Closed coreyostrove closed 1 year ago

coreyostrove commented 3 years ago

I noticed some clipping of certain letters on the stock creality touchscreen LCD. See the attached photo for an example with the letter g. IMG_20210208_174747463

BubuMVX commented 3 years ago

Hi @coreyostrove and thanks for taking the time to report this issue.

We have this issue since the redesign of the firmware, but it hasn't been addressed since. Your message may be an opportunity to get back to it.

One solution could be to make lowercase letters small capitals. That way, all letters will stay in their available space. It will also harmonize with text in the pictures.

Some people are experimenting this idea on Discord, but DGUS isn't helping making nice fonts.

Sebazzz commented 3 years ago

@Thinkersbluff is also enjoying the wonders of DWIN font rendering 😅

Thinkersbluff commented 3 years ago

The DGUS font clipping behaviour takes many forms with a variety of contributing factors. The photo in this issue description seems directed at the clipping of descenders. I have been exploring ways to improve on that. Aesthetics are a large part of resolving this issue. The current implementation may yet turn out to be the best balance, but I have not given up trying. This is a different font but these two photos demo one option. Using FontForge, the 5 glyphs with descenders can be edited to bring the descenders up to the baseline, for instance. Another option is to use small caps. 1B5DC298-410A-46E8-BE8A-0736038977EB 4F0E7E45-5090-42FC-8DE4-4AD65CC44D92

Notice that if I try to take advantage of increasing the font size to take advantage of the descenders being raised, then numbers don’t fit fields as well. The modified font may also not be as pleasing to the eye.

I am hoping small caps is a better answer, but it still has its issues.

108312DE-C50C-420A-8111-1D3A1A532EE2

Just scaling the caps down gives serious anti-aliasing problems with the current font. Other fonts like SegoeU are getting clipped on left or right side of some characters on some screens and character spacing/kerning is not working.

The tools are not well documented, so it will take time and patience to finesse this issue. I will share any reasonable looking fonts I can.

Thinkersbluff commented 3 years ago

F20D5473-BD27-4CCA-9DFF-00B3EEE44A19

I find this font to be a reasonable alternative to the B612Mono font being used now. The sides of some letters still get clipped in some display fields, for reasons I have not yet understood, so it is not “perfect” but I can do no better for now.

0_DWIN_ASC.HZK.ArialMonoMtPro.zip

There are two versions of the font file in the attached .zip. To use either of these files:

NOTE: The original font file for these was downloaded from https://www.cufonfonts.com/font/arial-mono-mt-pro on 10 Feb 2021, modified in FontForge, converted using DGUS Tool 8.0.1.1 and uploaded here. It is licensed as "free for personal use only"

Sebazzz commented 3 years ago

I suspect it has something to do with the height of the fields, but I can't be sure. There is this weird vertical height and horizontal weight parameter in the DWIN editor.

Thinkersbluff commented 3 years ago

Limiting factor for “happy” fonts seems to be screen dpi and font size. Top picture shows 70% scale for small caps. Lower shows 90% scale. All other factors the same in DGUS.

F0E587F4-B3A5-407C-A697-09BBE7EB7C28 A6CEF64C-990E-4481-BE6A-EC5DBBD5B7EF

Thinkersbluff commented 2 years ago

FWIW - It is simple to substitute the HZK (font) file distributed with the Creality DWIN_SET for the one bundled with the Community Firmware. Just copy 0_DWIN_ASC.HZK from the Creality DWIN_SET folder, paste it into the Community Firmware DWIN_SET folder, and reflash the Touchscreen. That font has shorter descenders, which are not truncated by DGUS. The tradeoff will be that the Community Firware font was edited to replace the backward apostrophe character with the degrees symbol, so all fields with units of degC will now show that character instead of the degrees symbol.

image

Thinkersbluff commented 1 year ago

The Re-Factored Version1.1 released 13 March 2023 implements a new HZK file which solves the problem with descenders, though it also shrinks the message font slightly in the process.