The problem appears to be fixed in Pango 1.37:

  https://bugzilla.gnome.org/show_bug.cgi?id=700592

Is upgrading your Pango installation a possibility?

Otherwise, `racket/draw` could can probably work around this problem,
much the same as

  https://mail.gnome.org/archives/commits-list/2014-May/msg06383.html

but it would be a little complicated, since scaling can come from
different layers.

At Thu, 17 Dec 2015 17:06:05 +0100, David Christiansen wrote:
> I seem to have clicked "Reply" rather than "Reply list" - sorry for the
> duplicate email, Matthew!
> 
> --------------------------
> 
> Thanks so much for a quick answer! Sorry it took me a bit to get back, I
> had to go read up on the relevant APIs.
> 
> I've managed to cause the problem at the REPL, and it does seem to be
> dependent on the backing scale.
> 
> Here's my test program:
> 
> #lang racket
> 
> (require racket/gui)
> 
> (define (get-bitmap backing-scale) (make-object bitmap% 500 300 #f #f
> backing-scale))
> 
> (define (test backing-scale kern?)
>   (let* ((bitmap (get-bitmap backing-scale))
>          (dc (new bitmap-dc% [bitmap bitmap])))
>     (send dc set-font (make-object font% 100 "PT Sans Narrow" 'default))
>     (send dc draw-text "Types" 0 0 kern?)
>     bitmap))
> 
> And here's what I get when I evaluate the following at the REPL:
> (for*/list ([scale (list 1.0 2.0)] [combine (list #f #t)]) (list scale
> combine (test scale combine)))
> 
> https://imgur.com/Sj2qhOp
> 
> It seems that the problem occurs with kerning enabled, but a backing
> scale of 2.0.
> 
> Any ideas on how I can work around this?
> 
> Thanks again!
> 
> /David
> 
> 
> On 17/12/15 16:37, Matthew Flatt wrote:
> > Letter spacing there certainly does look wrong. While "Ty" is the most
> > obvious problem, "Pr" and "Re" look too closely spaced, also. It
> > appears that spacing is going wrong for kerning pairs, and not for
> > other pairs of letters.
> > 
> > You're correct that Racket defers to Pango and Cairo to kern and draw
> > text. One possibility is that something is going wrong with using a
> > font at size N with a drawing scale of M (as opposed to using a font of
> > size N*M and a drawing scale of 1). Slideshow is likely using a value
> > of M other than 1, and other programs seem unlikely to be using a
> > drawing scale. In particular, as I recall, you have a high-resolution
> > display, which means that Slideshow will render to a bitmap with a
> > backing scale of 2, and likely an additional drawing scale to stretch
> > the 1024x768 slide dimensions to fit your screen.
> > 
> > To help diagnose the problem, could you perform experiments along those
> > lines at the level of a `bitmap%` and `bitmap-dc%`? The key is to call
> > `draw-text` with #t as the fourth argument, which enables kerning. You
> > could create a bitmap with different backing scales and also use
> > different drawing scales (as set by the `scale` method of `dc<%>`, for
> > example).
> > 
> > At Thu, 17 Dec 2015 16:21:07 +0100, David Christiansen wrote:
> >> I'm in the process of learning slideshow, and it's tons of fun! I vastly
> >> prefer Racket to LaTeX for algorithmically generating slides :-)
> >>
> >> However, I'm encountering a pretty major issue with font rendering. I'm
> >> running Racket 6.3 under GNOME 3.16 on Linux.
> >>
> >> I have noticed that, with a number of fonts, lowercase letters following
> >> a capital T are drawn very close to the T. My understanding is that
> >> Racket uses GTK, Pango, and Cairo to draw, so I tested it out in gedit
> >> with the same font, as well as XeTeX.
> >>
> >> At https://imgur.com/a/BVi2r, you can see the results. The first
> >> screenshot is from slideshow, where the word "Types" looks very odd
> >> compared to the other two, which have roughly the same layouts. Some
> >> other letter spacings are also a bit compressed, but none as radically
> >> as "Ty".
> >>
> >> Is this a misconfiguration on my part? A bug in Racket somewhere? Can
> >> anyone suggest a work-around?
> >>
> >> Thanks in advance!
> >>
> >> /David
> >>
> >> -- 
> >> You received this message because you are subscribed to the Google Groups 
> >> "Racket Users" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an 
> >> email to racket-users+unsubscr...@googlegroups.com.
> >> For more options, visit https://groups.google.com/d/optout.
> > 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to