java 读斜体英文字转化成正常英文输出

img

java读取后显示的就是正常的英文,没有斜体。

class Test {
    public static void main(String[] args) {
        Test solution = new Test();
        solution.readFile("src/" + Test.class.getPackageName()
                .replace('.', '/') + "/Youth.txt"
        );
    }

    private void readFile(String fileName) {
        File file = new File(fileName);
        FileInputStream fis = null;
        try {
            fis = new FileInputStream(file);
            StringBuilder stringBuilder = new StringBuilder();
            byte[] bytes = new byte[1024];
            int len = -1;
            while ((len = fis.read(bytes)) != -1) {
                stringBuilder.append(new String(bytes, 0, len));
            }
            fis.close();
            System.out.println(stringBuilder);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

运行结果:

img

img

你说的字体,那是显示该内容的载体(如word、记事本之类的)做的事情。你只需要知道如何直接读取.txt文件就行了,并在必要的时候进行转码。
https://www.cnblogs.com/hkgov/p/14707726.html

题目不是这个意思吧 应该是文本里只有这些图片中的斜体字 读出来就行了 并不是斜体转正常的文字