// // Android PDF Writer // http://coderesearchlabs.com/androidpdfwriter // // by Javier Santo Domingo (j-a-s-d@coderesearchlabs.com) // modified by Akira Atsumi (akiraatsumi@gmail.com) // package crl.android.pdfwriter; public class JapaneseFonts extends StandardFonts { public static final String SUBTYPE_CF = "Type0"; public static final String SUBTYPE_CID = "CIDFontType2"; public static final String MS_GOTHIC = "#82l#82r#20#83S#83V#83b#83N"; public static final String MS_MINCHO = "#82l#82r#20#96#BE#92#A9"; public static final String MSP_GOTHIC = "#82l#82r#20#82o#83S#83V#83b#83N"; public static final String MSP_MINCHO = "#82l#82r#20#82o#96#BE#92#A9"; public static final String MEIRYO = "Meiryo"; public static final String UNICODE_ENCODING = "UniJIS-UCS2-H"; public static final String WIN_SJIS_ENCODING = "90ms-RKSJ-H"; // Font descriptor for each fonts public static final String MS_GOTHIC_W = "[ 231 389 500 631 631 500 ]"; public static final String MS_MINCHO_W = "[ 231 389 500 631 631 500 ]"; public static final String MSP_GOTHIC_W = "[ 231 389 500 631 631 500 ]"; public static final String MSP_MINCHO_W = "[ 231 389 500 631 631 500 ]"; public static final String MEIRYO_W = "[ 231 389 500 631 631 500 ]"; public static final String MS_GOTHIC_DESC = "/Type /FontDescriptor /Ascent 859 /CapHeight 500 /Descent -140 /Flags 34 /FontBBox [-81 -136 996 859] /ItalicAngle 0 /StemV 80"; public static final String MS_MINCHO_DESC = "/Type /FontDescriptor /Ascent 859 /CapHeight 500 /Descent -140 /Flags 35 /FontBBox [-81 -136 996 859] /ItalicAngle 0 /StemV 80"; public static final String MSP_GOTHIC_DESC = "/Type /FontDescriptor /Ascent 859 /CapHeight 500 /Descent -140 /Flags 33 /FontBBox [-120 -136 996 859] /ItalicAngle 0 /StemV 80"; public static final String MSP_MINCHO_DESC = "/Type /FontDescriptor /Ascent 859 /CapHeight 500 /Descent -140 /Flags 33 /FontBBox [-120 -136 996 859] /ItalicAngle 0 /StemV 80"; public static final String MEIRYO_DESC = "/Type /FontDescriptor /Ascent 878 /CapHeight 500 /Descent -121 /Flags 33 /FontBBox [-386 -439 1822 1060] /ItalicAngle 0 /StemV 80"; public static String getW(String baseFont){ String w = ""; if( baseFont.equals(JapaneseFonts.MS_GOTHIC) ) { w = JapaneseFonts.MS_GOTHIC_W; } else if( baseFont.equals(JapaneseFonts.MS_MINCHO) ) { w = JapaneseFonts.MS_MINCHO_W; } else if( baseFont.equals(JapaneseFonts.MSP_GOTHIC) ) { w = JapaneseFonts.MSP_GOTHIC_W; } else if( baseFont.equals(JapaneseFonts.MSP_MINCHO) ) { w = JapaneseFonts.MSP_MINCHO_W; } else if(baseFont.equals(JapaneseFonts.MEIRYO) ) { w = JapaneseFonts.MEIRYO_W; } return w; } public static String getFontDescriptor(String baseFont) { String fontDescriptor = ""; if( baseFont.equals(JapaneseFonts.MS_GOTHIC) ) { fontDescriptor = JapaneseFonts.MS_GOTHIC_DESC; } else if( baseFont.equals(JapaneseFonts.MS_MINCHO) ) { fontDescriptor = JapaneseFonts.MS_MINCHO_DESC; } else if( baseFont.equals(JapaneseFonts.MSP_GOTHIC) ) { fontDescriptor = JapaneseFonts.MSP_GOTHIC_DESC; } else if( baseFont.equals(JapaneseFonts.MSP_MINCHO) ) { fontDescriptor = JapaneseFonts.MSP_MINCHO_DESC; } else if(baseFont.equals(JapaneseFonts.MEIRYO) ) { fontDescriptor = JapaneseFonts.MEIRYO_DESC; } return fontDescriptor; } public static String stringToSjisHex( String originalString ){ String resultString = ""; try { byte[] sjis = originalString.getBytes("Shift_JIS"); for( int i=0; i