Skip to content

_brand.yml: typography: fonts: source: file option fails #12267

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

Open
floholl opened this issue Mar 11, 2025 · 4 comments
Open

_brand.yml: typography: fonts: source: file option fails #12267

floholl opened this issue Mar 11, 2025 · 4 comments
Assignees
Labels
documentation Doc improvements & quarto-web yaml-validation Issues with YAML validation and autocompletion in quarto

Comments

@floholl
Copy link

floholl commented Mar 11, 2025

Bug description

The source: file option does not work for me as expected when trying to specify a custom font in a brand.yml. It insists the source field's value must be google (but I do use it successfully with source: system, for example).

Steps to reproduce

Copy follwing files to same test directory

_brand.yml

typography:
  fonts:
    - family: Amplitude-Light
      source: file
      files: Amplitude-Light.ttf
  base: Amplitude-Light
  headings: Amplitude-Light

_quarto.yml

title: Test

my.qmd

# Foo bar

- Test
- Foo
- Bar

Amplitude-Light.ttf

(not included here, but could be replaced by other suitable font file)

Compile

quarto render my.qmd --to html

Actual behavior

I am getting the following error. Notice in particular the claim that Field "source" has value file, which must instead be 'google', even though I use source: system with system fonts quite successfully on the same machine.

ERROR: Brand validation failed for /home/me/font_test/_brand.yml.

In file _brand.yml
(line 5, columns 7--12) property name files is invalid
4:       source: file
5:       files: Amplitude-Light.ttf
        ~~~~~~
6:   base: Amplitude-Light
ℹ The error happened in location typography:fonts:0:files.


In file _brand.yml
(line 4, columns 15--19) Field "source" has value file, which must instead be 'google'
3:     - family: Amplitude-Light
4:       source: file
                ~~~~~
5:       files: Amplitude-Light.ttf


Stack trace:

In file _brand.yml
(line 5, columns 7--12) property name files is invalid
4:       source: file
5:       files: Amplitude-Light.ttf
        ~~~~~~
6:   base: Amplitude-Light
ℹ The error happened in location typography:fonts:0:files.


In file _brand.yml
(line 4, columns 15--19) Field "source" has value file, which must instead be 'google'
3:     - family: Amplitude-Light
4:       source: file
                ~~~~~
5:       files: Amplitude-Light.ttf

    at readAndValidateYamlFromFile (file:///opt/quarto/bin/quarto.js:20482:15)
    at eventLoopTick (ext:core/01_core.js:175:7)
    at async projectResolveBrand (file:///opt/quarto/bin/quarto.js:40049:27)
    at async resolveFormats (file:///opt/quarto/bin/quarto.js:80545:23)
    at async renderContexts (file:///opt/quarto/bin/quarto.js:80377:21)
    at async renderFileInternal (file:///opt/quarto/bin/quarto.js:85654:20)
    at async renderFiles (file:///opt/quarto/bin/quarto.js:85604:17)
    at async renderProject (file:///opt/quarto/bin/quarto.js:86020:25)
    at async Command.actionHandler (file:///opt/quarto/bin/quarto.js:90654:32)
    at async Command.execute (file:///opt/quarto/bin/quarto.js:8111:13)

Expected behavior

Successful compilation with local font file.

Your environment

  • IDE: vim & terminal
  • OS: Debian

Quarto check output

Quarto 1.6.42
[✓] Checking environment information...
      Quarto cache location: /home/flo/.cache/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.4.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.46.3: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.6.42
      Path: /opt/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /usr/bin
      Version: 2024

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.12.7
      Path: /usr/bin/python3
      Jupyter: 5.7.2
      Kernels: python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.4.1
      Path: /usr/lib/R
      LibPaths:
        - /usr/local/lib/R/site-library
        - /usr/lib/R/site-library
        - /usr/lib/R/library
      knitr: 1.48
      rmarkdown: 2.27

[✓] Checking Knitr engine render......OK
@floholl floholl added the bug Something isn't working label Mar 11, 2025
@floholl floholl changed the title _brand.yml: typography: > fonts: > source: file option fails _brand.yml: typography: fonts: source: file option fails Mar 11, 2025
@floholl floholl changed the title _brand.yml: typography: fonts: source: file option fails _brand.yml: typography: fonts: source: file option fails Mar 11, 2025
@mcanouil
Copy link
Collaborator

mcanouil commented Mar 11, 2025

What if you use?

typography:
  fonts:
    - family: Amplitude-Light
      source: file
      files:
        - path: Amplitude-Light.ttf

https://posit-dev.github.io/brand-yml/brand/typography.html#comprehensive-example-with-font-definitions

Note that Quarto mentions the complete documentation several times and is not exhaustive about brand.yml which has its own documentation.

@floholl
Copy link
Author

floholl commented Mar 11, 2025

Yes, indeed this did the trick - thanks! Was aware of the brand.yml documentation, actually, but clearly hadn't dug deep enough there.

@floholl floholl closed this as completed Mar 11, 2025
@mcanouil
Copy link
Collaborator

mcanouil commented Mar 11, 2025

Maybe we could add that files expects an array of "path" in Quarto reference page.

@mcanouil mcanouil reopened this Mar 11, 2025
@mcanouil mcanouil added documentation Doc improvements & quarto-web and removed bug Something isn't working labels Mar 11, 2025
@mcanouil mcanouil self-assigned this Mar 12, 2025
mcanouil added a commit to mcanouil/quarto-cli that referenced this issue Mar 12, 2025
@mcanouil
Copy link
Collaborator

PR is up:

mcanouil added a commit to mcanouil/quarto-cli that referenced this issue Mar 12, 2025
@mcanouil mcanouil added the yaml-validation Issues with YAML validation and autocompletion in quarto label Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Doc improvements & quarto-web yaml-validation Issues with YAML validation and autocompletion in quarto
Projects
None yet
Development

No branches or pull requests

2 participants