racket / drracket

DrRacket, IDE for Racket
http://www.racket-lang.org/
Other
444 stars 93 forks source link

Various unicode symbols fail to display anywhere in the application after being displayed in italics #607

Open Nesuniken opened 1 year ago

Nesuniken commented 1 year ago

Tested on Windows 11 with Racket 8.8

Steps to reproduce:

  1. Open DrRacket
  2. Create a new racket file
  3. Paste 𝕣 into it

Once this is done, every 𝕣 character within the current window, as well as any 𝕣 characters displayed in new windows, will experience the bug until the application is completely restarted.

To confirm that italics are specifically the cause, you can reproduce the bug with comments if you change their style settings. Conversely, you can eliminate the bug from the REPL if you change it to not italicize errors.

Originally I encountered this problem just with the less conventional double struck letters (i.e everything but β„‚, ℍ, β„•, β„™, β„š, ℝ, and β„€), but looking into it further it seems to affect other characters like βŸœβŒΎβ—ΆβŽ‰βŸβŽŠβ₯ŠβŒ½β‰β‹β’⍷. They're all mathematical so far, but that could just be because I haven't tested much else. As for how broken italics breaks every other instance of the character, that's still a complete mystery to me.

For the time being, is there a way to disable italics for status bar error messages like there is for REPL ones?

Nesuniken commented 1 year ago

Changing the application's font to one with better italicization support (such as JetBrains mono) does appear to resolve the issue. Should've checked sooner in hindsight, didn't realize that setting affected text you otherwise can't style.

It'd still be nice if the errors for incomplete character support were less bizarre.

spdegabrielle commented 9 months ago

This would appear to be more likely related to the underlying graphics libraries, which have had recent updates (in 8.9 or 8.10)

does this still happen?

Nesuniken commented 8 months ago

Afraid so

spdegabrielle commented 8 months ago

seems not to happen on macOS - I wonder if it happens on Linux?

image
spdegabrielle commented 8 months ago

minimal example to try without DrRacket

#lang at-exp racket/gui
(define f (new frame% [label "Simple Edit"]
                      [width 200]
                      [height 200]))
(define c (new editor-canvas% [parent f]))
(define t (new text%))
(send c set-editor t)
(send f show #t)

(define mb (new menu-bar% [parent f]))
(define m-edit (new menu% [label "Edit"] [parent mb]))
(define m-font (new menu% [label "Font"] [parent mb]))
(append-editor-operation-menu-items m-edit #f)
(append-editor-font-menu-items m-font)
(send t set-max-undo-history 100)

;;r𝕣
Nesuniken commented 8 months ago

Minimal example has the same bug, except the missing character glyph no longer spreads automatically.

Test 1: Pasted three 𝕣's and changed each of their font sizes. Test 2: Italicized the first 𝕣. It glitches out without mangling the other ones Test 3: Resized the 2nd 𝕣 again. It now also shows the missing character glyph, but the 3rd 𝕣 is still unaffected

Nesuniken commented 8 months ago

seems not to happen on macOS - I wonder if it happens on Linux?

image

Did the "unbound identifier" error message correctly italicize 𝕣, or did DrRacket just avoid spreading the missing character symbol to the rest of the editor?

spdegabrielle commented 8 months ago

I couldn't reproduce on macOS by italicising comments Nor could I with the minimal test app.

image
Nesuniken commented 8 months ago

Oh, I misunderstood what you had trouble reproducing.

It also seems like your test app defaulted to a different font than mine. Perhaps the font Racket defaults to on MacOS has better italics support? If you could switch to Consolas or Courier New (or whatever the default font for DrRacket on Windows is), I can confirm at least all of those fonts fail to italicize 𝕣 correctly for me.

Nesuniken commented 8 months ago

Just realized I could use "Revert all preferences to default" to find that Courier New is the default font for DrRacket on Windows. Again, it seems like MacOS Racket has different defaults. Which font is your DrRacket version using?

spdegabrielle commented 8 months ago

Just realized I could use "Revert all preferences to default" to find that Courier New is the default font for DrRacket on Windows. Again, it seems like MacOS Racket has different defaults. Which font is your DrRacket version using?

Menlo

Nesuniken commented 8 months ago

Strange, I tried switching my font to Menlo but it still didn't work. Jetbrains Mono remains the only font I've found that DrRacket reliably italicizes correctly.

Nesuniken commented 8 months ago

I couldn't reproduce on macOS by italicising comments Nor could I with the minimal test app.

image

Within the minimal test app, is there any difference between italicizing 𝕣 and "slanting" it? I'm not sure whether the font distributions I'm finding are incomplete or if MacOS is using slanting as a fallback for characters that don't support italics

spdegabrielle commented 8 months ago

Hi, @Nesuniken

I could not find a difference between italic and slant.

I used the characters you provided.

β„‚, ℍ, β„•, β„™, β„š, ℝ, and β„€ βŸœβŒΎβ—ΆβŽ‰βŸβŽŠβ₯ŠβŒ½β‰β‹β’⍷.

image
Nesuniken commented 8 months ago

I just realized I'm having trouble getting italics and slanting to behave differently with any text. Is there some nuance I'm missing. or is Racket using the same procedure for both styles?

Nesuniken commented 6 months ago

seems not to happen on macOS - I wonder if it happens on Linux?

image

Can finally confirm the bug doesn't happen on Linux. It's exclusive to Windows for whatever reason.

image