racket / drracket

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

Support for font ligatures #130

Open beneyal opened 6 years ago

beneyal commented 6 years ago

Is there a way to enable font ligatures in fonts like Fira Code?

rfindler commented 6 years ago

Based on the code below, it appears the underlying drawing library would support it, but the editor layer built on top never passes #t as the fourth argument to draw-text that I can see (https://github.com/racket/snip/blob/master/snip-lib/racket/snip/private/snip.rkt).

I guess it makes sense for there to be some way to set a property of a text% object which, when enabled, caused it to create string-snip%s that used #t instead of #f in those four places. Once that's done we could change code in the framework library that added a mixin to control that setting via a preference and then DrRacket could add in that mixin.

#lang racket/gui

(define (draw c dc)
  (send dc set-font (send the-font-list find-or-create-font 24
                          "Fira Code" 'default 'normal))
  (send dc draw-text ">=" 10 10 #t))

(define f (new frame% [label ""] [width 200] [height 200]))
(define c (new canvas% [parent f] [paint-callback draw]))
(send f show #t)
spdegabrielle commented 4 years ago

is this still an issue? Please consider adding the label good first issue so it is findable:

Issues labeled good first issue in in Racket GitHub repositories

spdegabrielle commented 3 years ago

ligature displayed in 7.9 cs

spdegabrielle commented 3 years ago

This post has convinced me that ligatures are a bad idea https://practicaltypography.com/ligatures-in-programming-fonts-hell-no.html

sorawee commented 3 years ago

I'm no font expert, and I think @mbutterick is right about it. Still, this is a valid feature request. I don't think we should close it.