learn-gdscript icon indicating copy to clipboard operation
learn-gdscript copied to clipboard

#931 dyslexia accessible font option (PoC)

Open Wolfy7 opened this issue 1 year ago • 1 comments

Please check if the PR fulfills these requirements:

  • [x] The commit message follows our guidelines.
  • For bug fixes and features:
    • [x] You tested the changes.

Related issue (if applicable): #931

What kind of change does this PR introduce?

This PR is a PoC how the font slection could be look like.

image

image

But things probably needs to change:

  • Currently the dropdown (available fonts) is hardcoded
    • should probably dynamic
  • It overides every font_data
    • Maybe just specific font resources should changed

Wolfy7 avatar Oct 11 '24 10:10 Wolfy7

@NathanLovato FYI

Wolfy7 avatar Oct 11 '24 10:10 Wolfy7

That's a good start, thanks for this! This is a special accessibility feature for dyslexic people, so I think a checkbox would make the most sense: "Dyslexia Font: [ ]"

And I would make the code to apply the font to theme options named more specifically to match.

NathanLovato avatar Oct 21 '24 20:10 NathanLovato

During startup the font_path is stored in _font_defaults similiar to the size.

When "Dyslexia Font" is enabled all font_path will be update to the corresponding (Regular, Bold, Italic) "OpenDyslexic" font.

When "Dyslexia Font" is disabled: image

When "Dyslexia Font" is enabled: image

Wolfy7 avatar Oct 23 '24 12:10 Wolfy7

Really cool, thanks for the help! There are a few things to refine before integrating this:

  • Syntax highlighting is lost in code listings. (fig 1)
  • For code, the current font is not monospace so code ends up misaligned. There's a mono variant that could be used, available here: https://antijingoist.itch.io/opendyslexic
  • The font looks a lot bigger at any given font size. We should make sure that when applied it looks perceptually about the same size as the default font.
  • The settings menu can end up overflowing the app, preventing you from accessing settings. On small displays the buttons to confirm changes will likely be outside the view even at normal font size. The menu could have code to ensure it's centered on the screen and perhaps also a scroll container wrapping all the options to limit its maximum size + code shortcuts to ensure it can be closed with esc. and applied with enter. (fig 2)
  • Minor: the sample text in the settings menu does not get updated when applying the font.

The first three items are most important here, the fourth one will be mitigated by the third point

Fig 1:

image

Fig 2:

image

NathanLovato avatar Oct 24 '24 09:10 NathanLovato

Thanks for the feedback.

  1. I cant reproduce this, if I test it Syntax highlighting still works: image image

  2. Okay, will add the "OpenDyslexicMono-Regular.otf" and use it for code

  3. Yes, you right. Will implement this

  4. Good point. Will be done

  5. Right. will be changed.

Wolfy7 avatar Oct 24 '24 14:10 Wolfy7

OK, if the syntax highlighting loss is only happening on my end, it might be a cache issue. Actually, now I remember having an issue like this in the past due to cache problems.

Thank you very much for your diligence!

NathanLovato avatar Oct 24 '24 17:10 NathanLovato

Changes:

  • Added OpenDyslexicMono-Regular.otf image

  • When Dyslexia Font is enabled reduce the font sice by 1/4 font_resource.size -= (font_resource.size * 0.25)

  • Added a ScrollContainer and Shortcuts "esc" for close and "enter" for apply buttons image

  • "Sample text" always gets update when changed or applying font

Wolfy7 avatar Oct 24 '24 18:10 Wolfy7

Thanks much for the work and for your patience! I missed the last notification. I found a little thing to tweak but I'll fix it in the main branch directly

NathanLovato avatar Dec 12 '24 15:12 NathanLovato