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

Add support for Zooming or changing the font size? #33

Open
didibus opened this issue Jul 7, 2021 · 9 comments
Open

Add support for Zooming or changing the font size? #33

didibus opened this issue Jul 7, 2021 · 9 comments
Labels
enhancement New feature or request

Comments

@didibus
Copy link

didibus commented Jul 7, 2021

It be nice to be able to zoom or change the font size.

@vlaaad vlaaad added the enhancement New feature or request label Jul 10, 2021
@vlaaad
Copy link
Owner

vlaaad commented Jul 10, 2021

Indeed it would :)

Currently changing the font size is possible only with prefs system property that requires JVM restart.

@daveduthie
Copy link

daveduthie commented Aug 24, 2021

I also wanted to reload prefs without restart, and this works for me (I did a quick search for namespaces which require vlaaad.reveal.prefs:

(require '[vlaaad.reveal.prefs :as rp])

(defn set-prefs
  "`(set-prefs {...})` to reset reveal prefs without restarting your repl"
  [prefs]
  (tap>
   (do (alter-var-root #'rp/prefs (constantly (delay prefs)))
       (require '[vlaaad.reveal.style]
                '[vlaaad.reveal.font] :reload))))

(comment
  (set-prefs {:font-size 20, :theme :dark})
  ,)

The tap> is only needed because the updated settings are only reflected when the next value is send to reveal.

@vlaaad
Copy link
Owner

vlaaad commented Aug 24, 2021

That seems very unreliable, I'm surprised it worked :D

@daveduthie
Copy link

Me too, tbh. I wanted to try rewriting prefs, style, and font to use functions instead of delays, but this is working for now 🤷‍♂️

@vlaaad
Copy link
Owner

vlaaad commented Aug 24, 2021

I don't quite remember why I used delays everywhere, probably wanted to make reveal AOT-compatible, and loading prefs should happen in runtime and not during compilation

@daveduthie
Copy link

Ah, I assumed it was for performance.

In that case, I might try rewrite vlaaad.reveal.prefs/prefs and bits which refer to it as functions.

What do you think?

@vlaaad
Copy link
Owner

vlaaad commented Aug 24, 2021

I'd prefer to keep the delay for now, since a lot of reveal code currently relies on prefs being effectively constant.

@daveduthie
Copy link

I see :)

@didibus
Copy link
Author

didibus commented Aug 24, 2021

You could leverage re-delay (or your custom version of it).

https://github.com/aroemers/redelay

Which let's you selectively invalidate the delay (and in the case of re-delay the delay dependencies as well and safely do so).

I do think in general it is best to avoid side-effect at load-time.

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

No branches or pull requests

3 participants