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

draw-text with combine? = #t missplaces diacritics. #22

Open
florence opened this issue Jan 30, 2020 · 6 comments
Open

draw-text with combine? = #t missplaces diacritics. #22

florence opened this issue Jan 30, 2020 · 6 comments

Comments

@florence
Copy link

The combine? argument to draw-text seems to shift circumflexes one character space to the left. The program:

#lang racket
(require racket/draw)
(define (draw t combine?)
  (define b (make-object bitmap% 100 100))
  (define dc (send b make-dc))
  (send dc translate 20 20)
  (send dc scale 5 5)
  (send dc draw-text t 0 0 combine?)
  b)

Produces:

Screen Shot 2020-01-30 at 10 55 43 AM

@florence
Copy link
Author

I'm running macOS 10.14.13, running a Racket head from a few days ago.

@florence
Copy link
Author

This is not a regression from 7.5.
The exact UTF-8 bytestring I'm using for is "p̂" is #"p\314\202".

@rfindler
Copy link
Member

Wikipedia suggests that 10.14.6 is the latest version of 10.14: https://en.wikipedia.org/wiki/MacOS_Mojave

@gus-massa
Copy link
Contributor

Is this related to "Unicode Acents in DrRacket" racket/drracket#46 ?

@florence
Copy link
Author

It might be. From what I can tell drracket always uses combine as #f (judging by grepping the framework and drracket codebase)

An interesting note some fonts have special liggatures for diacritics, and that effect the behavior here. For example Futura has a diacritic for  but not p̂. The code:

(scale
 (vl-append
  (text "pp̂" (cons 'combine "Futura"))
  (text "pp̂" (cons 'no-combine "Futura"))
  (text "pÂ" (cons 'combine "Futura"))
  (text "pÂ" (cons 'no-combine "Futura")))
 3)

Renders

Screen Shot 2020-02-14 at 10 19 23 AM

Which is to say, this only goes wrong if there is no ligature for the combined glyph.

But more bizzarly, if I switch to inconsolata, which has the same ligature set for this diacritic I get:

(scale
 (vl-append
  (text "pp̂" (cons 'combine "Inconsolata"))
  (text "pp̂" (cons 'no-combine "Inconsolata"))
  (text "pÂ" (cons 'combine "Inconsolata"))
  (text "pÂ" (cons 'no-combine "Inconsolata")))
 3)

Screen Shot 2020-02-14 at 10 58 26 AM

Which is to say it draws the completely wrong character!

@florence
Copy link
Author

this issue might be related to this pango bug (https://bugzilla.gnome.org/show_bug.cgi?id=584160)?

Specifically this comment https://bugzilla.gnome.org/show_bug.cgi?id=584160#c75 makes me think so.

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

No branches or pull requests

3 participants