Re: [racket-users] Font bearing - lining up texts and outlines

2020-07-21 Thread Matthew Butterick
The `fontland` library does not have an official public API but it will give 
you the answer, which is 1446.

#lang racket
(require fontland fontland/ttf-glyph)
(define f (open-font "/System/Library/Fonts/Supplemental/Arial Unicode.ttf"))
;; `layout` uses OpenType positioning & substitution tables to create a glyph 
run,
;; which is a structure with two vectors: a vector of glyphs and a vector of 
glyph positions
;; once we have the glyph we can `glyph-decode` it and inspect its yMax value.
(match (layout f "♖")
  [(glyphrun (vector glyph _ ...) _) (hash-ref (glyph-decode glyph) 'yMax)])



> On 21 Jul 20, at 4:25 AM, Jens Axel Søgaard  wrote:
> 
> It helps to use the correct font...
> 
> It turns out the chess rook is not in "Courier", it is in  "Arial Unicode MS".
> The raw pango functions aren't clever enough to find an alternative font,
> but I think `text` from `pict` is. I am not sure of the details here though.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/43A50577-DCC4-49DE-B33E-8CB16A1B2A10%40mbtype.com.


Re: [racket-users] Font bearing - lining up texts and outlines

2020-07-21 Thread Jens Axel Søgaard
Den man. 20. jul. 2020 kl. 19.14 skrev Jens Axel Søgaard <
jensa...@soegaard.net>:

> Thanks for the response.
>
> I have attempted to go in your foot steps and have made a single file
> example, so it is easy to try out.
> Just to recap, the goal is to get the vertical bearing.
>
> The first step is to get the pict `text` numbers and the pango numbers
> (ascent, descent and height) -
> but I can't get them to match. Any hints or ideas are welcome.
>

It helps to use the correct font...

It turns out the chess rook is not in "Courier", it is in  "Arial Unicode
MS".
The raw pango functions aren't clever enough to find an alternative font,
but I think `text` from `pict` is. I am not sure of the details here though.

/Jens Axel

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CABefVgyw%2B8O_BnqRbpajA2JfY5O9UKpcHyQuqLsHBNVZ3AfZoA%40mail.gmail.com.