Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.docx4j.fonts;

Certain fonts have CJK names in a docx. However, in Win 7 (English locale at least), the font names are in English. So this class translates the docx CJK font name to a physical font name.

Author(s):
jharrop
public class CJKToEnglish {

Convert a CJK font name (as used in docx) to an English font name (as used on Win 7, English locale at least).

Parameters:
fontName
Returns:
	public static String toEnglish(String fontName) {
		// Special cases; there are more; see http://en.wikipedia.org/wiki/List_of_CJK_fonts
		if (fontName.equals("MS ゴシック")) {
//	        <a:font script="Jpan" typeface="MS ゴシック"/>
			return "MS Gothic";
else if (fontName.equals("MS 明朝")) {			
			return "MS Mincho";
else if (fontName.equals("맑은 고딕")) {
//	        <a:font script="Hang" typeface="맑은 고딕"/>
			return "Malgun Gothic";
else if (fontName.equals("宋体")) {
//	        <a:font script="Hans" typeface="宋体"/>
			return "SimSung"// check this				
else {
			return null;
		}		
	}
New to GrepCode? Check out our FAQ X