Comments (3)
We do already support Chinese character, whether it is simplified or traditional. If you set the family to a font that does have glyphs for these, it works perfectly fine. (Also took the liberty of answering the SO question)
library(tidyverse)
library(geomtextpath)
plot_data_2 <- data.frame(category=c('品类A','品类B','品类C','品类D'),
amount=c(1,6,4,7))
plot_data_2 %>% ggplot(aes(x=1,y=amount,fill=category))+
geom_col()+geom_textpath(position = position_stack(vjust=0.5),
aes(label=category),
family = "Noto Sans TC")+
coord_polar() +
theme(legend.text = element_text(family = "Noto Sans TC"))
The issue is that the default font doesn't include glyphs for Chinese characters, which makes our 'convert font index back to glyph' step not work as intended. This is also why some BiDi test of ours doesn't work on MacOS, since the default font doesn't contain Hebrew glyphs (I presume).
While this step solves a lot of other issues for us, this step makes font fallback impossible (which is what graphics devices, including {ragg}, do behind the scenes). I've submitted a feature request at {textshaping} a while back, asking to return sensible representations of glyphs. If we get to be blessed on this topic on {textshaping}'s side, we don't need the conversion step, and thus font fallback would work as intended.
from geomtextpath.
Ah! I didn't have time to look at this in any detail earlier. I know from my work in parsing pdfs that vertical writing is sometimes used in CJK scripts, which presumably we can't realistically support, but it's good to know that there isn't anything we are doing to inherently suppress the glyphs.
Since we have our own fallback font mechanism now (including a freeware font) I wonder if we should think about using a maximally inclusive fallback font that contains these glyphs and a mechanism for using them where necessary.
Thanks for clarifying, and for answering the SO post.
from geomtextpath.
which presumably we can't realistically support,
I'm not exactly sure what the expectation would be for vertical text, as I don't think I've used it other than playing around with WordArt in the 90s. Would it be to place text on a straight line orthogonal to the curve? Or would it be a 90° rotation per-letter? I think that you can make a case for the text orthogonal to the curve. For example in the usecase of this type of plot, it would be nice if one could label the year orthogonally.
I wonder if we should think about using a maximally inclusive fallback font
I think there is a technical limitation to fonts that makes it such that a font can't contain all unicode glyphs (discussion here). We could try to use systemfonts::font_fallback()
, but I'm not sure how much overhead this adds, especially since it would need to be called for every substring. E.g. systemfonts::font_fallback(unlist(strsplit('品类A', "")))
.
from geomtextpath.
Related Issues (20)
- geom_labelsf() not recognizing aesthetics HOT 5
- While working with ragg, minuses aren't drawn HOT 2
- geom_textpath() always draw a empty box when label is ""
- Ignoring unknown parameters: text_smoothing HOT 10
- Feature request - multiple labels per line HOT 7
- geom_textsmooth computation fails if method argument is not specified HOT 3
- ggplot2 is separating size and linewidth HOT 2
- Negative values in geom_textcontour not appearing HOT 2
- geom_textlinerange HOT 1
- Question on angle HOT 1
- text_only in geom_labelsegment
- Feature request - avoid text overlapping
- two labels on same curve HOT 5
- straight argument unknown in geom_textsf() HOT 2
- `label` aesthetic in `geom_textdensity2d` HOT 2
- R 4.3.0 and glyphs 👀 HOT 1
- Can't get things to work HOT 11
- vjust and hjust as aesthetics in geom_textsf HOT 3
- Different behavior for line breaks when there's no data
- geomtextline not accommodating RGBA colors
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 geomtextpath.