racket / racket/redex

Redex PDF output contains a wrong font, while Racket REPL renders the correct font

Open
#263 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Racket
Stars
112
Forks
42
PR merge metrics
No merged PRs in 30d

Description

When I try to use Source Code Pro as the font for nonterminals, the font is correctly rendered in the output of the racket REPL, but when outputting as pdf then a different font is used in the pdf, namely Source Code Variable with weight ExtraLight.

My OS is macOS Ventura 13.4.1, running Racket 8.9 [cs].

A nearly minimal example to reproduce the issue. Some of the style modifications are undoubtedly redundant since they do not affect nonterminals, but this is the actual configuration that I am using in a project (which may be relevant). If needed, the used fonts can be acquired here: Source Code Pro and CMU Serif.

#lang racket

(require redex
         redex/pict)

(define-language CommonLang
  (atom ::= number boolean string ())
  (r/w ::= READ WRITE))

(define sans-serif-style "Source Code Pro")
(define roman-style "CMU Serif")
(label-style sans-serif-style)
(literal-style sans-serif-style)
(metafunction-style sans-serif-style)
(paren-style roman-style)
(default-style roman-style)
(grammar-style roman-style)
(non-terminal-subscript-style `(subscript large-script italic . ,roman-style))
(non-terminal-superscript-style `(superscript large-script italic . ,roman-style))
(non-terminal-style `(italic . ,roman-style))

(render-language CommonLang)
(render-language CommonLang "./commonlang.pdf")

Pictures of the issue:

Correct font for the READ and WRITE terminals:
correct

Incorrect font for the READ and WRITE terminals:
incorrect

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided minimal Racket example and the redex/pict rendering entry point, especially render-language; compare the REPL and PDF outputs with the specified styles. Done means the PDF uses Source Code Pro for the relevant terminals rather than Source Code Variable ExtraLight, without regressing the REPL rendering.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.