Comments (8)
OK, now I know the problem. The fact is not that the spacing is doubled, but that the font sizes are made smaller. ggsave()
has a default dpi = 300
argument, while showtext_opts()
has dpi = 96
. Simply add the following line will fix the issue.
showtext_opts(dpi = 300)
The same reason applies to Rmarkdown. You need to make sure the dpi
knitr option is consistent with the one in showtext
.
from showtext.
Same issue observed
from showtext.
I'll take a look some time later this week.
from showtext.
I was trying to investigate this issue today, but I couldn't reproduce it. The spacing seems correct for the minimal example below. Can someone give me a (runnable) example that has double spacing?
library(showtext)
library(ggplot2)
showtext_auto()
dat = data.frame(x = c("AAA\nAAA", "BBB\nBBB", "CCC\nCCC"), y = 1:3)
x11()
ggplot(dat, aes(x = x, y = y)) +
geom_bar(stat = "identity") +
ggtitle("First Line\nsecond line") +
theme_grey(base_family = "sans")
from showtext.
from showtext.
The issue is also observed when using showtext within a Rmarkdown document.
from showtext.
Would it be possible to find a way in Rmarkdown for showtext
to detect automatically the dpi used by knitr
?
from showtext.
@larmarange I find that adding the following option to the document header automatically solves the problem. Can you confirm this?
---
output:
html_document:
fig_retina: 1
---
from showtext.
Related Issues (20)
- Fonts turn to be blurry in MacOS - Xquartz when enable showtext
- Text layer removed in PDF HOT 1
- Installing showtext error while compiling freetype on ubuntu 16.04 HOT 2
- Error loading of showtext HOT 7
- Adding fonts on a project basis. Possible? HOT 2
- library showtext error HOT 4
- using showtext leads to smaller font size in ggplot2 HOT 8
- White patches when using Google Fonts Inter in *.pdf HOT 3
- Will font_install() support loading in local font files? HOT 3
- showtext messing up emoji rendering HOT 2
- Arabic Text Support HOT 1
- How to determine font family name from google fonts? HOT 5
- Editable text in vector output HOT 1
- Installing showtext on databricks? HOT 5
- Acrobat distortions for certain fonts HOT 1
- Fontconfig error with CairoPNG on Windows R 4.2.0 (and 4.2.1) HOT 1
- 有没有可以调用Narrow字体的方法? HOT 2
- Small text when used with the ragg device HOT 3
- plotly support
- Quarto Support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from showtext.