racket / drracket

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

Feature request: allow comment style to specify font and size. #299

Open gfbee opened 5 years ago

gfbee commented 5 years ago

Setting the font for comments to a non-monospaced font would help provide a more readable and humane feel to very literate code with lots of prose. Since the metrics could be quite different, being able to then set the size independently would be quite useful.

spdegabrielle commented 5 years ago

TL;DR close issue as ‘not DrRacket’ - should be a plug-in and a #lang. Would support as a plug-in project.

——

Hi

I understand the motivation for this issue but the comments in the current #lang’s supported by DrRacket rely on monospace fonts for formatting existing comments.

As the GUI library supports proportional fonts and is distinct from DrRacket, and this is not an issue that would be resolved in DrRacket code I think this should be closed.

That said, I think this is an idea worthy of investigation. An implementation would probably require a custom #lang that is the same as normal racket, and a DrRacket plug-in that recognises the custom #lang and supports proportional comments.

If you were to embark on this project I believe community members would be supportive. I’d be interested in proportional fonts for code (using tabs for indenting), or even code and comments with implicit and explicit font styles. I’d be happy to discuss on racket-users or on the racket slack.

Kind regards Stephen

gfbee commented 5 years ago

I'm not proposing this for expression comments, which have horizontal structure. The issue you raise is really whether other code comments (end-of-line or block) imply horizontal structure. If they do, then we don't have a prose comment form. One route is to have more kinds of comment, and then the #lang and tool mechanisms can be used to react to the semantics.

But you can choose a variable-width font right now in DrRacket, and ruin horizontal layout of both code and comments. If there's a file with a lot of prose commentary that could be worth it. But unless you're saying that source requires all-fixed or all-variable, then it must be fine to have a mix. In any case, I would find it very useful to be able to choose for myself whether to view the comments in a fixed or variable font. I've already hard-coded this into the csc104 language today, and it makes many of the course files look much nicer, and gets me a large amount of the benefit that notebooks have.

commentary-and-code
spdegabrielle commented 5 years ago

Thanks @gfbee that looks great! You are correct that the Racket GUI toolkit supports a mix of proportional and monospace in a variety of fonts

If you are happy yo put your code on your GitHub we can continue the conversation there.

Kind regards, Stephen