Created
August 23, 2017 04:35
-
-
Save GitaiQAQ/99a89fddccd992e367fcce9f0889d086 to your computer and use it in GitHub Desktop.
An example R script that will generate a table of all the fonts rendered so you can compare them a little easier between the 2 systems.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fonttable <- read.table(header=TRUE, sep=",", stringsAsFactors=FALSE, | |
text=' | |
Short,Canonical | |
mono,Courier | |
sans,Helvetica | |
serif,Times | |
serif,Times | |
,AvantGarde | |
,Bookman | |
,Helvetica-Narrow | |
,NewCenturySchoolbook | |
,Palatino | |
,URWGothic | |
,URWBookman | |
,NimbusMon | |
URWHelvetica,NimbusSan | |
,NimbusSanCond | |
,CenturySch | |
,URWPalladio | |
URWTimes,NimbusRom | |
,思源宋体 | |
,文泉驿等宽微米黑 | |
') | |
fonttable$pos <- 1:nrow(fonttable) | |
library(reshape2) | |
fonttable <- melt(fonttable, id.vars="pos", measure.vars=c("Short","Canonical"), | |
variable.name="NameType", value.name="Font") | |
# Make a table of faces. Make sure factors are ordered correctly | |
facetable <- data.frame(Face = factor(c("plain","bold","italic","bold.italic"), | |
levels = c("plain","bold","italic","bold.italic"))) | |
fullfonts <- merge(fonttable, facetable) | |
library(ggplot2) | |
pf <- ggplot(fullfonts, aes(x=NameType, y=pos)) + | |
geom_text(aes(label=Font, family=Font, fontface=Face)) + | |
facet_wrap(~ Face, ncol=2) | |
png('fonttable.png', height = 1080, width = 1024, res = 120) | |
print(pf) | |
dev.off() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment