s-u / cairo Goto Github PK
View Code? Open in Web Editor NEWR graphics device using cairo graphics library for creating high-quality output
R graphics device using cairo graphics library for creating high-quality output
When building Cairo from sources on Windows with R 4.3.1, I see during link:
gcc -shared -static-libgcc -o Cairo.dll tmp.def cairobem.o cairogd.o cairotalk.o img-backend.o img-jpeg.o img-tiff.o pdf-backend.o ps-backend.o svg-backend.o w32-backend.o xlib-backend.o -lcairo -lfontconfig -lintl -liconv -lexpat -lfreetype -lharfbuzz -lpixman-1 -ltiff -lwebp -llzma -lzstd -ljpeg -lpng -lbz2 -lz -lgdi32 -lmsimg32 -lRgraphapp -LC:/rtools43/x86_64-w64-mingw32.static.posix/lib/x64 -LC:/rtools43/x86_64-w64-mingw32.static.posix/lib -LC:/R/R-4.3.1/bin/x64 -lR
C:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: C:/rtools43/x86_64-w64-mingw32.static.posix/lib/libwebp.a(libwebpencode_la-picture_csp_enc.o): in function `ImportYUVAFromRGBA':
/root/mxe/tmp-libwebp-x86_64-w64-mingw32.static.posix/libwebp-1.3.0/src/enc/picture_csp_enc.c:508: undefined reference to `SharpYuvInit'
C:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: C:/rtools43/x86_64-w64-mingw32.static.posix/lib/libwebp.a(libwebpencode_la-picture_csp_enc.o): in function `PreprocessARGB':
/root/mxe/tmp-libwebp-x86_64-w64-mingw32.static.posix/libwebp-1.3.0/src/enc/picture_csp_enc.c:180: undefined reference to `SharpYuvGetConversionMatrix'
C:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: /root/mxe/tmp-libwebp-x86_64-w64-mingw32.static.posix/libwebp-1.3.0/src/enc/picture_csp_enc.c:180: undefined reference to `SharpYuvConvert'
In my installation of Rtools43, these symbols are apparently provided by libsharpyuv.a
; for example:
kevin@KEVINUSHEY8387 MINGW64 /x86_64-w64-mingw32.static.posix/lib
$ nm libwebp.a | grep SharpYuvConvert
U SharpYuvConvert
kevin@KEVINUSHEY8387 MINGW64 /x86_64-w64-mingw32.static.posix/lib
$ nm libsharpyuv.a | grep SharpYuvConvert
0000000000000410 T SharpYuvConvert
But clearly a Cairo binary is available on CRAN, so it's possible I'm missing something?
Hi,
Installing this in apptainer container - RedHat-7. If install ICU, it will mess up my system. How can i solve this?
`** building package indices
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘Cairo’:
.onLoad failed in loadNamespace() for 'Cairo', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/mnt/users/xx/R/library-4.3/00LOCK-Cairo/00new/Cairo/libs/Cairo.so':
libicuuc.so.58: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
The downloaded source packages are in
‘/tmp/RtmpvNqztt/downloaded_packages’
Warning message:
In install.packages("Cairo", repo = "https://RForge.net", lib = "/mnt/users/xx/R/library-4.3") :
installation of package ‘Cairo’ had non-zero exit status`
install.packages("Cairo")
sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: Ubuntu 18.04.2 LTS
Matrix products: default
BLAS/LAPACK: /raid1/shiq/app/miniconda3/envs/R/lib/libopenblasp-r0.3.18.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=zh_CN.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=zh_CN.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=zh_CN.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.1.2 tools_4.1.2
It appears that, from a fresh R 4.2.0 (or higher) session on Windows, the first call to Cairo::CairoPNG()
always generates:
Fontconfig error: Cannot load default config file: No such file: (null)
Plots are still generated, but the fonts appear thinner and poorer quality then they should be. See rstudio/shiny#3626 for some examples
I am using R-3.6.1, Cairo 1.5.12, and working remotely. I was using X11()
to view R plots remotely over ssh, but it is painfully slow -- sometimes few minutes just to run plot(1:10)
. Using CairoX11()
is much faster -- not instantaneous, but certainly very usable. Kudos and thanks for that!
The problem is whenever my connection is lost, it crashes my whole R session. Even if I run dev.off()
first, it crashes R.
For example:
packageVersion("Cairo")
# [1] '1.5.12'
library(Cairo)
CairoX11(display="localhost:10.0")
plot(1:10)
dev.off()
# null device
# 1
Then if for some reason my ssh is lost -- bad VPN, bad wifi, bad cable modem, bad luck...
> XIO: fatal IO error 0 (Success) on X server "localhost:10.0"
after 99 requests (99 known processed) with 0 events remaining.
(I love that it says "(Success)" like some Jedi mind trick.) ;)
And R crashes. Is there some troubleshooting you can suggest? I was hoping it's something simple I'm doing wrong. :)
My workaround is to save the R session frequently, or to save plots to PDF and sync files to my laptop. But that's no fun, and misses out on using this nice package!
R.3.1.2.>library("Cairo")
R.3.1.2.>Cairo.capabilities()
png jpeg tiff pdf svg ps x11 win raster
TRUE TRUE FALSE TRUE TRUE TRUE TRUE FALSE TRUE
R.3.1.2.>filename <- "~/test.pdf"
R.3.1.2.>Cairo(filename,dpi = 120,width = 400,height = 400,type = "pdf",)
Error in Cairo(filename, dpi = 120, width = 400, height = 400, type = "pdf", :
Failed to create Cairo backend!
R.3.1.2.>plot.new()
R.3.1.2.>text(x=.5,y=.5,labels="\u0260",family="Times New Roman")
R.3.1.2.>dev.off()
null device
1
R.3.1.2.>
R.3.1.2.>filename <- "/Users/achalk/test2.pdf"
R.3.1.2.>Cairo(filename,dpi = 120,width = 400,height = 400,type = "pdf",)
R.3.1.2.>plot.new()
R.3.1.2.>text(x=.5,y=.5,labels="\u0260",family="Times New Roman")
R.3.1.2.>dev.off()
null device
1
R.3.1.2.>sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
other attached packages:
[1] Cairo_1.5-6
loaded via a namespace (and not attached):
[1] tools_3.1.2
CairoPDF()
plot(sqrt, family = 'Fira Code')
dev.off()
I expect that plot to have the font I specified. The same applies for calls to main
/xlab
/…
I just filed a bug report about grDevices::svg
, and the same issue (with the same fix) affects Cairo::CairoSVG
too.
https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16594
Related to #8
The res argument affects font sizes in base graphics, but doesn't seem to affect font sizes in grid graphics.
library(Cairo)
packageVersion('Cairo')
# [1] ‘1.5.3’
# Base graphics
CairoPNG('test-Cairo-72.png', width=250, height=250, res=72)
plot(1:10, 1:10)
dev.off()
CairoPNG('test-Cairo-144-2x.png', width=500, height=500, res=144)
plot(1:10, 1:10)
dev.off()
# Grid graphics (with ggplot2)
library(ggplot2)
Cairo('test-Cairo-ggplot2-72.png', width=250, height=250, res=72)
qplot(1:10, 1:10)
dev.off()
Cairo('test-Cairo-ggplot2-144-2x.png', width=500, height=500, res=144)
qplot(1:10, 1:10)
dev.off()
When using grid.raster() or rasterImage to render a PNG image through Cairo device, interpolate must be set to FALSE. Otherwise, no graphics is rendered.
-- create an png file
R> png()
R> plot(1:10)
R> dev.off()
R> grid.raster(readPNG("Rplot001.png"))
-- render png image with interpolate = TRUE to a png file plot_cairo.png
R> Cairo(file = "plot_cairo.png")
R> grid.raster(readPNG("Rplot001.png"), interpolate=TRUE)
R> dev.off()
-- render png image with interpolate = FALSE to a png file plot_cairo_no_interp.png
R> Cairo(file = "plot_cairo_no_interp.png")
R> grid.raster(readPNG("Rplot001.png"), interpolate=FALSE)
R> dev.off()
R> grid.raster(readPNG("plot_cairo.png")) # no graphic on the plot
R> grid.raster(readPNG("plot_cairo_no_interp.png")) # graphic is rendered on the plot
Other graphics devices, e.g., X11, png, work with no issue on interpolate argument setting.
Hi, when installing Cairo from source on Linux, libXt seems to be required in addition to Cairo, but libXt isn't mentioned in the SystemRequirements
field or package README.
Without the development files for libXt installed, Linux users run into compilation errors without an obvious resolution like this:
> install.packages("Cairo")
...
gcc -I"/opt/R/4.2.1/lib/R/include" -DNDEBUG -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I. -Iinclude -I/usr/local/include -g -O2 -fpic -g -O2 -c xlib-backend.c -o xlib-backend.o
xlib-backend.c:34:10: fatal error: X11/Intrinsic.h: No such file or directory
34 | #include <X11/Intrinsic.h> /*-> Xlib.h Xutil.h Xresource.h .. */
| ^~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [/opt/R/4.2.1/lib/R/etc/Makeconf:168: xlib-backend.o] Error 1
ERROR: compilation failed for package ‘Cairo’
* removing ‘/opt/R/4.2.1/lib/R/library/Cairo’
Searching for the error message turns up many questions over the years about Cairo also requiring libXt development files (e.g. libxt-dev
on Ubuntu/Debian or libXt-devel
on CentOS/RHEL/Fedora):
To help users install Cairo on Linux, would you be open to adding libXt to SystemRequirements
or the package README?
This would also help out tools that use SystemRequirements
, like the automatic system dependency installation used by the GitHub Actions for R, R-hub, and the Linux binary packages from RStudio Package Manager (https://packagemanager.rstudio.com/). This was the original motivation for opening this, via rstudio/r-system-requirements#31.
Silly question maybe, why is it called Cairo :)?
I've just discovered how handy this package is, thank you for making and maintaining it!
CairoFonts(bold = 'Fira Code:style=Regular')
CairoPDF()
plot(sqrt, main = 'foo <- bar != baz')
dev.off()
I expect to see Fira Code’s ligatures, but all text is separate
library(Cairo)
results in:
Error: package or namespace load failed for ‘Cairo’:
.onLoad failed in loadNamespace() for 'Cairo', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Cairo/libs/Cairo.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Cairo/libs/Cairo.so, 0x0006): Library not loaded: /opt/X11/lib/libXrender.1.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Cairo/libs/Cairo.so
Reason: tried: '/opt/X11/lib/libXrender.1.dylib' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/libXrender.1.dylib' (no such file)
Any ideas how to solve this?
sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.2.1Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libRlapack.dyliblocale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8attached base packages:
[1] tools stats graphics grDevices utils datasets methods baseother attached packages:
[1] googleAuthR_2.0.0 firebase_1.0.1 RPostgres_1.4.3 pool_0.1.6
[5] dplyr_1.0.8 shinyjs_2.1.0 shinybusy_0.3.0 shinyWidgets_0.6.4
[9] magick_2.7.3 colourpicker_1.1.1 shiny_1.7.1loaded via a namespace (and not attached):
[1] Rcpp_1.0.8.3 pillar_1.7.0 compiler_4.1.2 bslib_0.3.1
[5] later_1.3.0 jquerylib_0.1.4 base64enc_0.1-3 digest_0.6.29
[9] bit_4.0.4 gargle_1.2.0 memoise_2.0.1 tibble_3.1.6
[13] jsonlite_1.8.0 lifecycle_1.0.1 pkgconfig_2.0.3 rlang_1.0.2
[17] DBI_1.1.2 cli_3.2.0 fastmap_1.1.0 httr_1.4.2
[21] fs_1.5.2 generics_0.1.2 vctrs_0.4.0 htmlwidgets_1.5.4
[25] sass_0.4.1 askpass_1.1 hms_1.1.1 tidyselect_1.1.2
[29] bit64_4.0.5 glue_1.6.2 qpdf_1.1 R6_2.5.1
[33] fansi_1.0.3 purrr_0.3.4 blob_1.2.3 magrittr_2.0.3
[37] promises_1.2.0.1 ellipsis_0.3.2 htmltools_0.5.2 assertthat_0.2.1
[41] jose_1.2.0 mime_0.12 xtable_1.8-4 httpuv_1.6.5
[45] utf8_1.2.2 miniUI_0.1.1.1 openssl_2.0.0 cachem_1.0.6
[49] crayon_1.5.1
Step to reproduce: CFLAGS += -std=c11
.
Fix: #19
Hi,
I'm trying to install Cairo on my MacBook using R version 4.0.3 (2020-10-10).
I tried to install it from bioconductor, Github repo, and binary file. I got the same error in all the cases.
Here is the error:
Here is the error I get
configure: error: Cannot use cairo-ft backend, although cairo claims it is working.
LAGS/CAIRO_LIBS accordingly.
ERROR: configuration failed for package ‘Cairo’
* removing ‘/usr/local/lib/R/4.0/site-library/Cairo’
* restoring previous ‘/usr/local/lib/R/4.0/site-library/Cairo’
Can you please fix this error for the recent version of the R?
When executing the following, I only see “, 1” in the resulting PNG.
tf <- tempfile(fileext = '.png')
Cairo::CairoFonts('Noto Sans')
Cairo::Cairo(200, 200, tf, 'png', units = 'px', bg = 'white')
plot.new()
plot.window(0:1, 0:1)
text(.5, .5, labels = expression(list(rho, 1)))
dev.off()
Hi,
When using R Cairo package onSave function, we detect some memory leak on R object. The issue seems coming from CairoGD_Close function.
On Cairo/src/cairogd.c, Cairo_set_onSave() sets onSave function a protected R object (Line 544)
SEXP Cairo_set_onSave(SEXP dev, SEXP fn) {
int devNr = asInteger(dev) - 1;
GEDevDesc *gd = GEgetDevice(devNr);
if (gd) {
NewDevDesc *dd = gd->dev;
if (dd) {
CairoGDDesc *xd = (CairoGDDesc *) dd->deviceSpecific;
if (xd->magic != CAIROGD_MAGIC)
error("Not a Cairo device");
if (xd && xd->cb) {
SEXP old = xd->cb->onSave;
if (!old) old = R_NilValue;
if (fn != R_NilValue) {
R_PreserveObject(fn);
xd->cb->onSave = fn;
} else xd->cb->onSave = 0;
if (old != R_NilValue)
R_ReleaseObject(old);
return old;
}
}
}
Rf_error("Not a valid Cairo device");
return R_NilValue;
}
On Cairo/src/cairotalk.c, CairoGD_Close does not seem release that protected function object at the end. Since R put protected object into a stack, missing one release call would leave the object on the bottom of stack which could be a much bigger R object. So, the memory leak could be large. We add an explicit object release (shown below) and then find the memory leak becomes no longer detected.
static void CairoGD_Close(NewDevDesc *dd)
{
CairoGDDesc *xd = (CairoGDDesc *) dd->deviceSpecific;
if(!xd || !xd->cb) return;
xd->cb->save_page(xd->cb,xd->npages);
if (xd->cb->onSave) {
SEXP devNr = PROTECT(ScalarInteger(ndevNumber(dd) + 1));
SEXP pageNr = PROTECT(ScalarInteger(xd->npages + 1));
eval(lang3(xd->cb->onSave, devNr, pageNr), R_GlobalEnv);
UNPROTECT(2);
/* Add object release call to onSave, otherwise, memory would leak */
R_ReleaseObject(xd->cb->onSave);
}
xd->cb->destroy_backend(xd->cb);
free(xd);
dd->deviceSpecific=NULL;
}
We would like you to know of this finding. If you think this is an issue, could you consider fixing it in a new version.
Thanks,
Qin
Both PDFs (through metadata) and SVGs (through title
) have the capability for titles.
instead of ignoring the title
parameter, it should work for all output types that have the necessary capabilities.
The attached PNG and PDF were both rendered from an identical ggplot2 plot (dput(ggplotGrob(plot))
is also attached) using this procedure
save_Cairo <- function (filename, plot, type) {
Cairo(width=10, height=4, units="cm", dpi=300, type=type, file=filename)
print(plot)
invisible(dev.off())
}
so the only difference is type="pdf"
vs type="png"
. The PNG rendering is correct. In the PDF, however, every piece of text is much too large, as are all of the lines, and because the text takes up too much space, the plot is crushed into illegibility.
If there is a workaround of any sort, please advise.
Since updating to R 4.2.0, Shiny apps have issues formatting plots and throw the following error:
Fontconfig error: Cannot load default config file
It is unclear to me whether the issue lies with Cairo or Shiny, but disabling Cairo in Shiny fixes the issue.
See rstudio/shiny#3626 for more information
just had to reinstall, because I had to upgrade R to 4.3.0. this time,
xlib-backend.c:34:10: fatal error: 'X11/Intrinsic.h' file not found
#include <X11/Intrinsic.h> /*-> Xlib.h Xutil.h Xresource.h .. */
^~~~~~~~~~~~~~~~~
1 error generated.
make: *** [xlib-backend.o] Error 1
ERROR: compilation failed for package ‘Cairo’
my own XQuartz probably came courtesy via brew install --cask xquartz
many years ago, because brew tells me XQuartz is already installed. XQuartz is installed at /Applications/Utilities/ and updated to XQuartz 2.8.5 (xorg-server 21.1.6). A little search on my file system tells me
./System/Volumes/Data/opt/X11/include/X11/IntrinsicP.h
./System/Volumes/Data/opt/X11/include/X11/Intrinsic.h
./System/Volumes/Data/opt/X11/include/X11/IntrinsicI.h
One of the include libraries indeed has an X11, but this one only contains
ls /opt/homebrew/include/X11
DECkeysym.h@ XF86keysym.h@ Xatom.h@ Xfuncproto.h@ Xlibint.h@ Xosdefs.h@ Xresource.h@ Xwinsock.h@ fonts@
HPkeysym.h@ XKBlib.h@ Xauth.h@ Xfuncs.h@ Xlocale.h@ Xpoll.h@ Xthreads.h@ ap_keysym.h@ keysym.h@
ImUtil.h@ XWDFile.h@ Xcms.h@ Xlib-xcb.h@ Xmd.h@ Xproto.h@ Xutil.h@ cursorfont.h@ keysymdef.h@
Sunkeysym.h@ Xalloca.h@ Xdefs.h@ Xlib.h@ Xos.h@ Xprotostr.h@ Xw32defs.h@ dri@
X.h@ Xarch.h@ Xdmcp.h@ XlibConf.h@ Xos_r.h@ Xregion.h@ Xwindows.h@ extensions/
with the XQuartz includes not found, could you either update the library search list or tell the user in an error what [s]he should do?
PS: my own nasty fix was sudo ln -s /System/Volumes/Data/opt/X11/include/X11 /opt/homebrew/Cellar/cairo/1.16.0_5/include/cairo/
during installation and then removing it.
regards,
/iaw
[This is more a feature request than a bug report]
PDF/A is the archival version of PDF and therefore more suitable to long-term use of a pdf file. Many professional offset printers require PDF/A files. When a PDF/A file includes one graphic that is not PDF/A compliant, it is itself no longer compliant. Ergo, any document that includes a Cairo R pdf is no longer pdf/a compliable.
For example, take a simple file and run it through macos:
library(Cairo)
CairoFonts( regular="Charter:style=Regular" )
pdf(file="testcairo.pdf")
plot( 1:10, 1:10 )
dev.off()
run the output through the free VeraPDF compliance checker:
$ verapdf testcairo.pdf
<?xml version="1.0" encoding="utf-8"?>
<report>
<buildInformation>
<releaseDetails id="core" version="1.20.2" buildDate="2022-05-19T08:23:00-07:00"></releaseDetails>
<releaseDetails id="validation-model" version="1.20.2" buildDate="2022-05-19T08:27:00-07:00"></releaseDetails>
<releaseDetails id="gui" version="1.20.3" buildDate="2022-05-19T09:10:00-07:00"></releaseDetails>
</buildInformation>
<jobs>
<job>
<item size="4982">
<name>/Users/ivo/verapdf/testcairo.pdf</name>
</item>
<validationReport profileName="PDF/A-1B validation profile" statement="PDF file is not compliant with Validation Profile requirements." isCompliant="false">
<details passedRules="96" failedRules="5" passedChecks="684" failedChecks="6">
<rule specification="ISO 19005-1:2005" clause="6.3.4" testNumber="1" status="failed" passedChecks="0" failedChecks="1">
<description>The font programs for all fonts used within a conforming file shall be embedded within that file, as defined in PDF Reference 5.8,
except when the fonts are used exclusively with text rendering mode 3</description>
<object>PDFont</object>
<test>Subtype == "Type3" || Subtype == "Type0" || renderingMode == 3 || fontFile_size == 1</test>
<check status="failed">
<context>root/document[0]/pages[0](7 0 obj PDPage)/contentStream[0](8 0 obj PDContentStream)/operators[107]/font[0](Helvetica)</context>
<errorMessage>The font program is not embedded</errorMessage>
</check>
</rule>
<rule specification="ISO 19005-1:2005" clause="6.7.3" testNumber="1" status="failed" passedChecks="0" failedChecks="1">
<description>If a document information dictionary does appear at a document, then all of its entries that have analogous properties in predefined XMP schemas, shall also be embedded in the file in XMP form with equivalent values.</description>
<object>CosDocument</object>
<test>doesInfoMatchXMP</test>
<check status="failed">
<context>root</context>
<errorMessage>Some of document information dictionary entries' that have analogous properties in predefined XMP schemas do not embedded or have not equivalent values in the file in XMP form.</errorMessage>
</check>
</rule>
<rule specification="ISO 19005-1:2005" clause="6.1.7" testNumber="2" status="failed" passedChecks="0" failedChecks="2">
<description>The stream keyword shall be followed either by a CARRIAGE RETURN (0Dh) and LINE FEED (0Ah) character sequence
or by a single LINE FEED character. The endstream keyword shall be preceded by an EOL marker</description>
<object>CosStream</object>
<test>streamKeywordCRLFCompliant == true && endstreamKeywordEOLCompliant == true</test>
<check status="failed">
<context>root/indirectObjects[2](8 0)/directObject[0]</context>
<errorMessage>Spacings of keywords 'stream' and 'endstream' do not comply PDF/A specification</errorMessage>
</check>
<check status="failed">
<context>root/indirectObjects[4](6 0)/directObject[0]</context>
<errorMessage>Spacings of keywords 'stream' and 'endstream' do not comply PDF/A specification</errorMessage>
</check>
</rule>
<rule specification="ISO 19005-1:2005" clause="6.7.2" testNumber="1" status="failed" passedChecks="0" failedChecks="1">
<description>The document catalog dictionary of a conforming file shall contain the Metadata key.</description>
<object>PDDocument</object>
<test>metadata_size == 1</test>
<check status="failed">
<context>root/document[0]</context>
<errorMessage>The document catalog dictionary doesn't contain metadata key.</errorMessage>
</check>
</rule>
<rule specification="ISO 19005-1:2005" clause="6.1.3" testNumber="1" status="failed" passedChecks="0" failedChecks="1">
<description>The file trailer dictionary shall contain the ID keyword. The file trailer referred to is either the last trailer dictionary in a PDF file,
as described in PDF Reference 3.4.4 and 3.4.5, or the first page trailer in a linearized PDF file, as described in PDF Reference F.2</description>
<object>CosDocument</object>
<test>(isLinearized == true && firstPageID != null) || ((isLinearized != true) && lastID != null)</test>
<check status="failed">
<context>root</context>
<errorMessage>Missing ID in the document trailer</errorMessage>
</check>
</rule>
</details>
</validationReport>
<duration start="1662856868494" finish="1662856868688">00:00:00.194</duration>
</job>
</jobs>
<batchSummary totalJobs="1" failedToParse="0" encrypted="0" outOfMemory="0" veraExceptions="0">
<validationReports compliant="0" nonCompliant="1" failedJobs="0">1</validationReports>
<featureReports failedJobs="0">0</featureReports>
<repairReports failedJobs="0">0</repairReports>
<duration start="1662856868473" finish="1662856868701">00:00:00.228</duration>
</batchSummary>
</report>
#4 0x00007ffff3ca509f in cairo_font_match (args=0x6080d8) at cairogd.c:394
394 FcPatternDel(vpat,FC_CHARSET);
(gdb) l
389 FcChar8 *fname;
390
391 fname = FcNameUnparse(fs->fonts[j]);
392 if (fname){
393 vpat = FcNameParse(fname);
394 FcPatternDel(vpat,FC_CHARSET);
Hi Simon,
I detected a possible bug in the current version of Cairo
. Descriptions and possible solutions are given below.
CairoPNG()
creates wrong number of images. The problem can be reproduced by the following code:
library(Cairo)
CairoPNG()
for(i in 1:5) plot(1, main = i)
dev.off()
It turns out that only four images are created, and the last image but one (i.e., the 4th image in the loop) is missing.
In cairotalk.c
=> CairoGD_Close()
, xd->npages
doesn't increase by one as it does in CairoGD_NewPage()
. So when the device is closing, the last image overwrites the previous one.
Add one line of xd->npages++
before xd->cb->save_page(xd->cb,xd->npages);
. I already created a pull request.
I'm using a tiling window manager and am consistently observing CairoX11() crash my R process when using multiple instances.
Hi,
Updating to 1.5-14 from the source failed with a following error;
xlib-backend.c:34:10: fatal error: 'X11/Intrinsic.h' file not found
#include <X11/Intrinsic.h> /*-> Xlib.h Xutil.h Xresource.h .. */
I guess the xlib-backend.c
can't locate /opt/X11/include/X11/Intrinsic.h
, although I set up the path in the env as follows;
XCFLAGS=-I/opt/X11/include/X11
XLIBS=-L/opt/X11/lib
Are there any other ways to specific the path to intrinsic.h ?
> R.version
_
platform x86_64-apple-darwin17.0
arch x86_64
os darwin17.0
system x86_64, darwin17.0
status
major 4
minor 1.2
year 2021
month 11
day 01
svn rev 81115
language R
version.string R version 4.1.2 (2021-11-01)
nickname Bird Hippie
~ ❯ neofetch 11:10:14 AM
'c. dmanjcm@IN-OTA-C07YJ0X9JYW0
,xNMM. ---------------------------
.OMMMMo OS: macOS 11.6.2 20G314 x86_64
OMMM0, Host: Macmini8,1
.;loddo:' loolloddol;. Kernel: 20.6.0
cKMMMMMMMMMMNWMMMMMMMMMM0: Uptime: 11 days, 1 hour, 29 mins
.KMMMMMMMMMMMMMMMMMMMMMMMWd. Packages: 96 (brew)
XMMMMMMMMMMMMMMMMMMMMMMMX. Shell: zsh 5.8
;MMMMMMMMMMMMMMMMMMMMMMMM: Resolution: 1920x1080
:MMMMMMMMMMMMMMMMMMMMMMMM: DE: Aqua
.MMMMMMMMMMMMMMMMMMMMMMMMX. WM: Quartz Compositor
kMMMMMMMMMMMMMMMMMMMMMMMMWd. WM Theme: Blue (Light)
.XMMMMMMMMMMMMMMMMMMMMMMMMMMk Terminal: iTerm2
.XMMMMMMMMMMMMMMMMMMMMMMMMK. Terminal Font: MesloLGS-NF-Regular 13
kMMMMMMMMMMMMMMMMMMMMMMd CPU: Intel i7-8700B (12) @ 3.20GHz
;KMMMMMMMWXXWMMMMMMMk. GPU: Intel UHD Graphics 630
.cooc,. .,coo:. Memory: 34015MiB / 65536MiB
I am getting the error below when I install the Cairo package:
cairogd.c: In function ‘ptr_to_raw’:
cairogd.c:490:18: error: expected expression before ‘!=’ token
if (TYPEOF(ptr) != EXTPTRSXP)
^
cairogd.c: In function ‘raw_to_ptr’:
cairogd.c:508:18: error: expected expression before ‘!=’ token
if (TYPEOF(ptr) != EXTPTRSXP)
^
cairogd.c:510:18: error: expected expression before ‘!=’ token
if (TYPEOF(raw) != RAWSXP)
^
/usr/lib64/R/etc/Makeconf:134: recipe for target 'cairogd.o' failed
make: *** [cairogd.o] Error 1
ERROR: compilation failed for package ‘Cairo’
* removing ‘/home/miguel/R/x86_64-unknown-linux-gnu-library/3.2/Cairo’
The gcc compiler version is 5.1.0
The documentation says the res
argument will be mapped to dpi
:
https://github.com/s-u/Cairo/blob/master/man/Cairo.Rd#L111-L112 but actually it is just silently ignored: https://github.com/s-u/Cairo/blob/master/R/Cairo.R#L80-L83
Had a few issues loading the Cairo package on MacOSX (Big Sur) with "R version 4.0.5 (2021-03-31)". I installed a number of missing libraries for X11/Quartz with Homebrew and they were placed under /usr/local/lib/.
I had to add links for six libraries:
libICE.6.dylib libX11.6.dylib libXrender.1.dylib
libSM.6.dylib libXext.6.dylib libXt.6.dylib
When I attempted to load the Cairo package, it couldn't find these libraries and instead was looking for them in /opt/11/lib/. I added symbolic links to keep Cairo and the libraries talking.
Here's an example output from trying to load Cairo:
library(Cairo)
Error: package or namespace load failed for ‘Cairo’:
.onLoad failed in loadNamespace() for 'Cairo', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Cairo/libs/Cairo.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Cairo/libs/Cairo.so, 6): Library not loaded: /opt/X11/lib/libSM.6.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Cairo/libs/Cairo.so
Reason: image not found
# R
> library(devtools)
> install_github("s-u/Cairo")
Downloading GitHub repo s-u/Cairo@master
Installing Cairo
'/usr/lib64/R/bin/R' --no-site-file --no-environ --no-save --no-restore CMD \
INSTALL '/tmp/RtmpRhmOk2/devtoolsda019c23afa/s-u-Cairo-d598ff1' \
--library='/usr/lib64/R/library' --install-tests
* installing *source* package ‘Cairo’ ...
** libs
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c cairobem.c -o cairobem.o
In file included from cairobem.c:5:0:
backend.h:5:21: fatal error: cconfig.h: No file or Directory
#include "cconfig.h"
^
compilation terminated.
make: *** [cairobem.o] ERROR 1
ERROR: compilation failed for package ‘Cairo’
* removing ‘/usr/lib64/R/library/Cairo’
에러: Command failed (1)
In base R, grid primitives have a default empty fill. So you could plot to concentric circles with:
library(grid)
grid.circle(r=.1)
grid.circle(r=.2)
dev.off()
When using a Cairo device, however, it appears to assume these shapes have a white fill.
CairoPNG()
grid.circle(r=.1)
grid.circle(r=.2)
dev.off()
If you supply an NA
fill, parameter, the scene plots correctly.
CairoPNG()
grid.circle(r=.1, gp=gpar(fill=NA))
grid.circle(r=.2, gp=gpar(fill=NA))
dev.off()
I want to use Cairo to export pictures in tiff format, but after I ran "Cairo.capabilities()", then I found that the tiff format is FALSE. How can I solve this problem?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.