예제 #1
0
 public Text renderwrap(String text, Color c, int width) {
   if (wfnd == null) wfnd = new RichText.Foundry(font, defcol);
   wfnd.aa = aa;
   text = RichText.Parser.quote(text);
   if (c != null)
     text =
         String.format(
             "$col[%d,%d,%d,%d]{%s}", c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha(), text);
   return (wfnd.render(text, width));
 }
예제 #2
0
 public static Tex rendertt(Resource res, boolean withpg, boolean hotkey) {
   Resource.AButton ad = res.layer(Resource.action);
   Resource.Pagina pg = res.layer(Resource.pagina);
   String tt = ad.name;
   BufferedImage xp = null, food = null;
   if (hotkey) {
     int pos = tt.toUpperCase().indexOf(Character.toUpperCase(ad.hk));
     if (pos >= 0)
       tt =
           tt.substring(0, pos)
               + "$col[255,255,0]{"
               + tt.charAt(pos)
               + "}"
               + tt.substring(pos + 1);
     else if (ad.hk != 0) tt += " [" + ad.hk + "]";
   }
   if (withpg) {
     if (pg != null) {
       tt += "\n\n" + pg.text;
     }
     xp = getXPgain(ad.name);
     food = getFood(ad.name);
   }
   BufferedImage img = ttfnd.render(tt, 300).img;
   if (xp != null) {
     img = ItemInfo.catimgs(3, img, xp);
   }
   if (food != null) {
     img = ItemInfo.catimgs(3, img, food);
   }
   return (new TexI(img));
 }
예제 #3
0
 private static Text rendertt(Resource res, boolean withpg) {
   Resource.AButton ad = res.layer(Resource.action);
   Resource.Pagina pg = res.layer(Resource.pagina);
   String tt = ad.name;
   int pos = tt.toUpperCase().indexOf(Character.toUpperCase(ad.hk));
   if (pos >= 0)
     tt =
         tt.substring(0, pos)
             + "$b{$col[255,128,0]{"
             + tt.charAt(pos)
             + "}}"
             + tt.substring(pos + 1);
   else if (ad.hk != 0) tt += " [" + ad.hk + "]";
   if (withpg && (pg != null)) {
     tt += "\n\n" + pg.text;
   }
   return (ttfnd.render(tt, 300));
 }