I appreciate it. I had already tried bold and italic, but your note did 
give me the idea to try specifying the weights directly, e.g. "IBM Plex 
Sans, weight=700" —which, sadly, didn't solve my problem, but may have made 
the problem itself a bit more clear.

Going off of the list of weights in Pango’s documentation [1] I cooked up 
this test:

#lang racket
(require pict)

 

(define weights
  '("100"   ; thin       (since Pango 1.24)
    "200"   ; ultralight
    "300"   ; light
    "350"   ; semilight  (since Pango 1.36.7)
    "380"   ; book       (since Pango 1.24)
    "400"   ; default
    "500"   ; normal     (since Pango 1.24)
    "600"   ; semibold
    "700"   ; bold
    "800"   ; ultrabold
    "900"   ; heavy
    "1000")); ultraheavy (since Pango 1.24)

(define (compare-weights font-name)
  (apply vl-append (map (lambda (f) (text font-name (string-append 
font-name ", weight=" f) 34)) weights)))


When I do (compare-weights "IBM Plex Sans") it becomes obvious that Racket 
is actually only able to use four of Plex Sans’s seven weights (on macOS). 

Input Serif [2] is another good example. It has six weights but this test 
shows only three of them being used.

[1]: https://developer.gnome.org/pango/stable/pango-Fonts.html#PangoWeight
[2]: http://input.fontbureau.com

On Friday, February 16, 2018 at 3:48:51 PM UTC-6, Robby Findler wrote:
>
> I'm not sure what the right answer is here, but in some specific cases 
> that have happened to me along these lines, I've found that specifying 
> 'italic or 'bold works out. 
>
> Sorry that's not much to go on. 
>
> Robby 
>
>
> On Thu, Feb 15, 2018 at 2:44 PM, Joel Dueck <[email protected] 
> <javascript:>> wrote: 
> > Greetings, long time lurker/first time posting here. I have been working 
> on 
> > this one for a couple of days and can't seem to figure it out. 
> > 
> > I'm having an issue where on macOS, there are some fonts/variants 
> returned 
> > by get-face-list that I can't actually use with a drawing function like 
> > text. 
> > 
> > #lang racket 
> > (require pict racket/draw) 
> > 
> > (define (list-fonts str) 
> >   (filter (lambda(s) (string=? str (substring s 0 (min (string-length 
> str) 
> > (string-length s))))) 
> >           (get-face-list #:all-variants? #t))) 
> > 
> > (define (demo-font str) 
> >   (apply vl-append (map (lambda (f) (text f f 30)) (list-fonts str)))) 
> > 
> > Attached is a screenshot comparison of the results of this code on 
> Windows 
> > and macOS, both using Racket 6.12. 
> > 
> > To sum up the problem “narratively”, as it were: on Windows, among the 
> > strings returned by get-face-list is "IBM Plex Sans Text, Medium" and I 
> can 
> > do (text "Hello" "IBM Plex Sans Text, Medium" 30), and pict will draw 
> using 
> > that font. 
> > 
> > But on macOS, where get-face-list will include the string "IBM Plex 
> Sans, 
> > Text" (note comma), if I do (text "Hello" "IBM Plex Sans, Text"), I 
> instead 
> > get the result in the default sans serif font. 
> > 
> > Furthermore, all of IBM Plex Sans’s 16 weights work properly on 
> > macOS/Racket—except the "Text" weight! 
> > 
> > A similar problem happens with some other fonts on macOS, e.g. Halyard 
> Micro 
> > Regular and Halyard Micro Book — the Regular weight works but the Book 
> > weight displays using the Regular weight, despite using the exact string 
> > found in get-face-list as the font/variant name in the call to text. 
> > 
> > I did my main example using IBM Plex Sans since it's a free font [1] 
> should 
> > anyone wish to replicate my results for themselves. 
> > 
> > How would I best go about finding out what is happening here? Are 
> certain 
> > words like “book” or “text” just not recognized/useable as a font weight 
> on 
> > macOS? Apologies if I’m missing something obvious! 
> > 
> > [1]: https://ibm.github.io/type/ 
> > 
> > -- 
> > 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 [email protected] <javascript:>. 
> > 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to