Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
coreyostrove opened this issue Feb 9, 2021 · 8 comments
Closed
Labels
bug Something isn't working enhancement New feature or request

Comments

@coreyostrove
Copy link

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
Copy link
Contributor

BubuMVX commented Feb 9, 2021

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.

@BubuMVX BubuMVX added the bug Something isn't working label Feb 9, 2021
@BubuMVX BubuMVX changed the title [bug] Fonts Clipping Fonts clipping Feb 9, 2021
@Sebazzz
Copy link
Collaborator

Sebazzz commented Feb 10, 2021

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

@Thinkersbluff
Copy link
Contributor

Thinkersbluff commented Feb 10, 2021

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.

@Sebazzz Sebazzz changed the title Fonts clipping Improve font rendering to prevent clipping and preserve proper kerning Feb 10, 2021
@Sebazzz Sebazzz added the enhancement New feature or request label Feb 10, 2021
@Thinkersbluff
Copy link
Contributor

Thinkersbluff commented Feb 10, 2021

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:

  • "Extract All" somewhere.
  • Rename whichever font file you want to use to 0_DWIN_ASC.HZK and copy/paste it into the DWIN_SET folder on the SD card you will use to reflash your display.
    The file 0_DWIN_ASC.HZK.ArialMonoMTPro_SmCaps-CR6 is the small caps version you see in the attached photo.
    The file 0_DWIN_ASC.HZK.ArialMonoMtPro_Reg-CR6 is the same Arial Mono MT Pro file as the Small Caps one, but with the regular lower-case character glyphs. The descenders still get clipped on the Regular font, but some users may prefer the aesthetics of lower case characters over the aesthetics of small caps.

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
Copy link
Collaborator

Sebazzz commented Feb 10, 2021

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.

@Sebazzz Sebazzz added this to the Community Firmware Release 6 milestone Feb 10, 2021
@Thinkersbluff
Copy link
Contributor

Thinkersbluff commented Feb 10, 2021

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

@Sebazzz Sebazzz removed this from the Community Firmware Release 6 milestone Mar 27, 2021
@Thinkersbluff
Copy link
Contributor

Thinkersbluff commented May 30, 2022

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
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants