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

font() not working with quarto #625

Closed
davidgohel opened this issue Apr 12, 2024 Discussed in #624 · 1 comment
Closed

font() not working with quarto #625

davidgohel opened this issue Apr 12, 2024 Discussed in #624 · 1 comment

Comments

@davidgohel
Copy link
Owner

Discussed in #624

Originally posted by philimho April 12, 2024
Hi, I am trying to change the font in a flextable-body in a pdf output with the 'font()' function. This works fine with a markdown-file:

---
output:
  pdf_document:
    latex_engine: xelatex
    keep_tex: true
title: "Mrkdwn_test"
mainfont: Roboto
---
## Lorem

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin suscipit, nulla eu commodo euismod, justo nisi scelerisque nulla, ut imperdiet turpis lorem vel dolor. 
```{r, echo = FALSE}
library(flextable)
flextable::set_flextable_defaults(
    font.family = "Roboto", 
  )
ft <- flextable::flextable(iris) |>
  flextable::font(fontname = "Roboto Condensed", part = "body")

ft
```

The resulting pdf uses Roboto correctly for the standalone text and the column headers, while using Roboto Condensed in the flextable-body.
image

Now trying to do the same in quarto:

---
title: "quarto_test"
format:
  pdf:
    documentclass: article
pdf-engine: xelatex
mainfont: Roboto
keep-tex: true
---

## Lorem

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin suscipit, nulla eu commodo euismod, justo nisi scelerisque nulla, ut imperdiet turpis lorem vel dolor. Proin eu tincidunt nisi. Mauris volutpat purus ut iaculis venenatis. Sed a purus arcu. Maecenas non nibh libero. Ut gravida velit augue, a rhoncus massa lobortis quis. Vestibulum vestibulum dolor ac iaculis faucibus.

```{r, echo = FALSE}
library(flextable)
flextable::set_flextable_defaults(
    font.family = "Roboto", 
  )
ft <- flextable::flextable(iris) |>
  flextable::font(fontname = "Roboto Condensed", part = "body")

ft
```

Results in a pdf-file with only the mainfont, ignoring the defined font for the body of the flextable:
image

Any idea why the font() is not applied in the .tex file created by quarto? Sorry if this is a quarto problem rather than a flextable issue.

@davidgohel
Copy link
Owner Author

@philimho, it should be fixed now. Thanks for reporting the issue

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

1 participant