Hello list, The following program illustrates my problem:
# The program illustrates an apparent error generating SVG files. # Note how the figure renders properly in the R graphics window, but # fails if you open it in in an SVG-capable viewer, such as Chrome, # Firefox, or Edge. # It appears that something in the svg() device is failing to # handle characters in higher parts of the Unicode range. # This program runs under Windows and the system must have the Cambria # Math font, which comes builtin with Windows. # (The font and range below are used by the Microsoft Word equation # editor, so it's desirable to use the same font and range in some # graphics to duplicate the algebraic characters used in math equations # in Word documents.) # Don Macnaughton August 2021. # Specify where to save the generated svg file. SVGfile = "C:/Temp/TestSVG.svg" # Make the Cambria Math font available to R. windowsFonts("Cambria Math"=windowsFont("Cambria Math")) # Use a loop to draw the graph twice, once in the SVG file and once # in the graphics window. for (i in 1:2){ graphics.off() # If this is the first pass, specify the file for the SVG graph. if (i == 1) {svg(SVGfile)} xvals = c(0,100) yvals = c(0,100) # Draw an invisible graph to establish the ranges # using using the two points in xvals and yvals defined above. plot(xvals, yvals, type="n", xlab=" ", ylab=" ", axes=FALSE) llab <- '\U01d44e' # the letter a in the math italic range text(x=1,y=60,labels=llab,family="Cambria Math",adj=0,cex=3) text(x=7,y=63, labels="<- The desired lowercase math italic a in the Cambria Math font", adj=0) llab <- '\U000061' # the letter a in the standard range. text(x=1,y=40,labels=llab,family="Cambria Math",adj=0,cex=3,font=3) text(x=7,y=40, labels="<- The lowercase italic a in the standard range in the Cambria Math font", adj=0) if (i == 1) {dev.off()} # End of the loop to draw the graph twice: } # End of program. Here's my sessionInfo() R version 4.1.1 (2021-08-10) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19042) Matrix products: default locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] compiler_4.1.1 tools_4.1.1 Thank you for your help, Don Macnaughton ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.