# kuten is 94x94 matrix (JISX0208) KuRange <- c( 1:2, # symbol 147 chars 3, # Alpha Numeric 62 chars 4, # HiraKana 83 chars 5, # KataKana 86 chars 6, # Greek 48 chars 7, # Cyrillic 66 chars 8, # Line 32 chars # 9:15,undefined or machine dependence, 13 ms only. 16:47,# JIS1 2965 chars 48:84 # JIS2 3390 chars # 85:94 undefined or machine dependence ) kuplot<-function(ku=1,start="\033$B",end="\033(B",kutenname="ISO-2022-JP") { kutenToRaw<-function(ku=1,ten=1) { as.raw(as.integer(structure(c(32+ku,32+ten)))) } TenRange <- c(1:94) par(mar=c(3,1,4,1)) par(ps=as.integer(par()$pin[1]*2)) plot(0:15,xlim=c(0,15), ylim=c(-5.5,0), type="n", xlab="", ylab="", xaxt="n", yaxt="n") title(paste(kutenname," encoding ", ku, "ku")) grid(16, 6, lty=1) text(0, 0-.2, cex=.6, col="red",kutenname) text(0, 0-.4, cex=.6, col="blue",localeToCharset()) text(0, 0-.6, cex=.6, col="gray","UCS-2") for(ten in TenRange){ x <- ten %% 16 y <- ten %/% 16 kutenhex<-rawToChar(kutenToRaw(ku,ten)) str<-paste(start,kutenhex,end,sep="") str<-iconv(str,kutenname) if(strwidth(str)>0){ text(x, -y, str) text(x, -y-.2, cex=.6, col="red",paste(as.character(kutenToRaw(ku,ten)),collapse="")) text(x, -y-.4, cex=.6, col="blue",paste(as.character(charToRaw(str)),collapse="")) text(x, -y-.6, cex=.6, col="gray",paste(as.character(charToRaw(iconv(str,"","UCS-2BE"))),collapse="")) } } } pdf("Japan1ex.pdf",family="Japan1GothicBBB",paper="a4", width=0, height=0) par(mfrow=c(3,2)) lapply(KuRange,kuplot) dev.off()