Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (523)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (591)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Slick2D blurry fonts  (Read 2354 times)
0 Members and 1 Guest are viewing this topic.
Offline ShadowGrimm

Junior Newbie





« Posted 2012-09-18 16:16:19 »

Could this be because of the ColorEffect I'm applying to the UnicodeFont?

My code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
   public static UnicodeFont deriveUnicodeFont(String name, int size)
         throws SlickException
   {
      try
      {
         java.awt.Font original = java.awt.Font.createFont(
               java.awt.Font.PLAIN, new File("./cache/fonts/" + name
                     + ".ttf"));

         UnicodeFont derived = new UnicodeFont(original, size, false, false);

         derived.getEffects().add(new ColorEffect(java.awt.Color.white));
              derived.addAsciiGlyphs();
              derived.loadGlyphs();

         return derived;
      }
      catch (FontFormatException e)
      {
         e.printStackTrace();
      }
      catch (IOException e)
      {
         e.printStackTrace();
      }

      return null;
   }


Or does it have something to do with how Slick creates the Image for each character? Thanks for your help in advance!
Offline davedes
« Reply #1 - Posted 2012-09-18 17:41:31 »

Explain your problem a bit more? Maybe with images?

(My guess is you are scaling them using linear scaling, and you want nearest-neighbour scaling instead...?)

Also, don't use File to access resources if you plan to include them in the JAR later. Instead, use the ResourceLoader from Slick.

Offline ShadowGrimm

Junior Newbie





« Reply #2 - Posted 2012-09-19 00:41:59 »

Thanks for your reply, let me take a quick screenshot

#1:


#2:


Also thanks for the tip!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Phased
« Reply #3 - Posted 2012-09-19 00:44:20 »

I see the font perfect lol

EDIT: I think its more of a illusion, trying drawing the string on a completely black or white screen, I think it will look perfect, probably the textures causing the illusion
Offline UprightPath
« Reply #4 - Posted 2012-09-19 00:46:26 »

I think that the 'blurriness' is coming from the fact that it seems like you have a 'Shadow' on your font. Typically this causes a 'blurring' behind the letters, but with certain color combinations/sizes, it can make the text look blurry as well.

Offline ShadowGrimm

Junior Newbie





« Reply #5 - Posted 2012-09-19 00:49:24 »

Well, If I don't add the ColorEffect to the font, the font simply will not draw... What should I do about that?
Offline davedes
« Reply #6 - Posted 2012-09-19 06:26:26 »

Do you mean the anti-aliasing looks too smooth? What are you trying to get it to look like?

I'd suggest using AngelCodeFont (create in TWL Font Tool and export as TEXT) if you don't need unicode font support, and save multiple sizes that you'll need. If you really need unicode fonts with different anti-aliasing, maybe try TWL as a GUI library.

Offline ShadowGrimm

Junior Newbie





« Reply #7 - Posted 2012-09-19 11:03:16 »

I'll take the AngelCodeFont approach... Thank you so much for your help!
Offline Nitram

Senior Newbie


Medals: 1



« Reply #8 - Posted 2012-09-19 11:09:52 »

You could also try applying the font size to the java.awt.font before creating the unicode font. That usually helps a bit.

Nitram

Playable work in progress online RPG: http://illarion.org
Jabber user: nitram0815@jabber.ccc.de
Offline Nate

« JGO Bitwise Duke »


Medals: 158
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #9 - Posted 2012-09-21 06:01:09 »

If you really need unicode fonts with different anti-aliasing, maybe try TWL as a GUI library.
Can TWL do Unicode fonts? I think it can only do bitmap fonts, same as the AngelCodeFont in Slick. Of course, the bitmap font can have Unicode glyphs, but won't have combining characters or on the-fly glyph rendering.

FreeType, used in the TWL Theme Editor and the BMFont tool, usually makes for the most crisp output. AWT, used in Hiero and UnicodeFont, is usually blurry at small sizes. The BMFont tool can do supersampling, which makes for nice antialiased glyphs (via FreeType). I posted some info here.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Gibbo3771 (12 views)
2014-11-24 19:59:16

trollwarrior1 (35 views)
2014-11-22 12:13:56

xFryIx (74 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50

digdugdiggy (46 views)
2014-11-12 21:10:15

digdugdiggy (40 views)
2014-11-12 21:09:33

kovacsa (66 views)
2014-11-07 19:57:14

TehJavaDev (70 views)
2014-11-03 22:04:50

BurntPizza (68 views)
2014-11-03 18:54:52

moogie (83 views)
2014-11-03 06:22:04
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!