|Enaium|
  1.         private final UnicodeFont font;
  2.         @SuppressWarnings("unchecked")
  3.         public UnicodeFontRenderer(Font awtFont) {

  4.                super(Minecraft.getMinecraft().gameSettings, new
  5. ResourceLocation("textures/font/ascii.png"),
  6. Minecraft.getMinecraft().getTextureManager(), false);
  7.                 font = new UnicodeFont(awtFont);
  8.                 font.addAsciiGlyphs();
  9.                 font.getEffects().add(new ColorEffect(Color.WHITE));
  10.                 try {
  11.                         font.loadGlyphs();
  12.                 } catch(SlickException exception) {
  13.                         throw new RuntimeException(exception);
  14.                 }
  15.                 String alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789";
  16.                 FONT_HEIGHT = font.getHeight(alphabet) / 2;
  17.         }
复制代码
  1.                 public static void loadFonts(){
  2.                         InputStream is =Fonts.class.getResourceAsStream("fonts/font.ttf");
  3.                         Font font =null;
  4.                         try{
  5.                                         font=Font.createFont(Font.TRUETYPE_FONT, is);
  6.                         }catch(FontFormatException e){
  7.                                 e.printStackTrace();
  8.                         }catch(IOException e){
  9.                                 e.printStackTrace();
  10.                         }
  11.                         smallLC=new UnicodeFontRenderer(font.deriveFont(20F));
  12.                         menuLC=new UnicodeFontRenderer(font.deriveFont(60F));
  13.                         if(Minecraft.getMinecraft().gameSettings.language !=null){
  14.                                 Fonts.smallXX.setUnicodeFlag(true);
  15.                                 Fonts.menuXX..setUnicodeFlag(true);

  16.                               
  17. Fonts.smallLC.setBidiFlag(Minecraft.getMinecraft().mcLanguageManager.isCurrentLanguageBidirectional());

  18.                               
  19. Fonts.menuLC.setBidiFlag(Minecraft.getMinecraft().mcLanguageManager.isCurrentLanguageBidirectional());

  20.                         }
  21.                         
  22.                 }
复制代码


只显示英文