Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (789)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (864)
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 5956 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:
   public static UnicodeFont deriveUnicodeFont(String name, int size)
         throws SlickException
         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));

         return derived;
      catch (FontFormatException e)
      catch (IOException e)

      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



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.


Playable work in progress online RPG:
Jabber user:
Offline Nate

« JGO Bitwise Duke »

Medals: 167
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  

hadezbladez (2610 views)
2018-11-16 13:46:03

hadezbladez (935 views)
2018-11-16 13:41:33

hadezbladez (2563 views)
2018-11-16 13:35:35

hadezbladez (503 views)
2018-11-16 13:32:03

EgonOlsen (3683 views)
2018-06-10 19:43:48

EgonOlsen (4059 views)
2018-06-10 19:43:44

EgonOlsen (2444 views)
2018-06-10 19:43:20

DesertCoockie (3250 views)
2018-05-13 18:23:11

nelsongames (3322 views)
2018-04-24 18:15:36

nelsongames (4292 views)
2018-04-24 18:14:32
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45 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‑
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!