ryanc
2022-5-27 12:58:11

I don’t know what would cause that, but maybe @mflatt or @greg would know.


greg
2022-5-27 14:52:59

When I (browse-syntax #'(module racket/base (displayln "hello"))) in an Emacs REPL the resulting frame text is nearly the same size as in DrRacket.


greg
2022-5-27 14:54:02

It’s definitely not something like a 2X difference, which if it were would suggest I’m seeing a HiDPI issue. So it seems to “just work” for me on Ubuntu 18.04 with Emacs 25.2.


greg
2022-5-27 14:54:56

Note that I have the “Text Scale” thing in Ubuntui tweaks set to 1.5, which is how most HiDPI things work OK-ish for me.


greg
2022-5-27 14:55:05

But IIRC @rntz you’re using Ubuntu 22.04, and probably a newer Emacs, too.


greg
2022-5-27 14:55:14

You might even be on Wayland instead of X.


greg
2022-5-27 14:55:37

So I’m not sure what HiDPI advice to give?


greg
2022-5-27 14:56:28

ISTR there is some env var that racket/gui looks for, which might affect 2X scaling; maybe ensuring that’s set in Emacs, would fix this?? (wild guess theory)


greg
2022-5-27 15:01:14

@rntz Had trouble finding this, probably needs an index tag like “HiDPI”, but here it is: PLT_DISPLAY_BACKING_SCALE: https://docs.racket-lang.org/gui/windowing-overview.html#%28idx._%28gentag._13._%28lib._scribblings%2Fgui%2Fgui..scrbl%29%29%29


greg
2022-5-27 15:05:35

So for example $ PLT_DISPLAY_BACKING_SCALE=3.0 drracket gives you a DrRacket scaled quite large. Now how to make this work in Emacs launching a syntax browser? I think something like setenv in Emacs, then (re)start the Racket Mode back end (which is the process supporting your user program and REPL)? Trying that…


greg
2022-5-27 15:07:08

Bingo. That works for me.


greg
2022-5-27 15:09:13
  1. M-x eval-expression and enter (setenv "PLT_DISPLAY_BACKING_SCALE" "3.0").
  2. M-x racket-start-back-end.
  3. Start a REPL and do (require macro-debugger/syntax-browser) and (browse-syntax #'(module racket/base (displayln "hello"))) and you should get larger text.

mflatt
2022-5-27 15:09:32

But why would it be different when starting from Emacs in the first place? When PLT_DISPLAY_BACKING_SCALE is not set, racket/gui consults Gtk to get the scale; is it possible that GDK_SCALE or GDK_DPI_SCALE is getting set?


greg
2022-5-27 15:09:34

@rntz Does that work for you? If so, then move step 1 to your Emacs init file.


greg
2022-5-27 15:10:45

@mflatt AFAICT it’s not different for me, on my older Ubuntu system.


greg
2022-5-27 15:12:21

Hopefully @rntz can get you some details for a deeper fix if possible, on their end (??) or in racket/gui (??). (But meanwhile/instead I think the work-around I suggested could work.)


sw5355700
2022-5-27 19:55:08

Racket is a procedural language organized into modules. Go is close to being a domain specific language that Thompson made for Google to solve their systems programming needs.