Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: BF::Renderer::Text  (Read 4169 times)

0 Members and 1 Guest are viewing this topic.

Lord Delvin

  • Jr. Member
  • **
  • Posts: 68
    • ICQ Messenger - 166781460
    • View Profile
BF::Renderer::Text
« on: November 20, 2007, 09:22:33 am »
For my game development toolkit I wrote a version of sf::String, which should use less memory and which is easier to use, as you dont need to tell which chars are needed.
My aproach uses a simple GC, so it might not be usefull for sfml itself(besides its not fully implemented yet).

Shot:


Code: [Select]

// init
    BF::Renderer::Text test;
    test.setText(L"☢NücLäa Πlaßτ♀☢\ngrr\nDer ☠ kommt zu euch☺\nGgriesch!");

//....//

//draw

    glColor3ub(122, 255, 255);
    test.draw();

(text is stupid , I know that)

Srejv

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
BF::Renderer::Text
« Reply #1 on: November 20, 2007, 11:05:27 pm »
Cool! Does it still look good when using smaller font sizes?

Lord Delvin

  • Jr. Member
  • **
  • Posts: 68
    • ICQ Messenger - 166781460
    • View Profile
BF::Renderer::Text
« Reply #2 on: November 21, 2007, 09:00:30 am »
Atm it looks good in the range of 12px to 32px. But I will fix that when I have the gc working, as it wont be much overhead to have chars twice as long as needed in different sizes.

dabo

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
    • http://www.dabostudios.net
BF::Renderer::Text
« Reply #3 on: November 21, 2007, 12:10:23 pm »
Interesting, does this mean that you can finally draw smaller texts (other than black once) in SFML and not get a terrible result?

EDIT. kind of what Srejv asked, but what about the result using different font colors?

Lord Delvin

  • Jr. Member
  • **
  • Posts: 68
    • ICQ Messenger - 166781460
    • View Profile
BF::Renderer::Text
« Reply #4 on: November 21, 2007, 05:16:52 pm »
As far as I read the sfml code, sfml seams to load the biggest verion of a required character, whats basicly a good idea, but it leads to bad results, because OpenGL can't ever do nice scaling(as it does not know you are using a vector image source)

I think it will look better, but this will also havily depend on the font file you use...hmm I'll try out if I can really do better(thought unicode would be more interesting)
have fun!

EDIT: I tested a bit and for DejaVu I get a limit of 10px, bellow you cant read any small letters so I'd really suggest to use a bitmap font for anything smaller.

dabo

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
    • http://www.dabostudios.net
BF::Renderer::Text
« Reply #5 on: November 21, 2007, 06:31:07 pm »
I'm currently working on a sports management game which means I need to show a lot of information on the screen, that's why I need to be able to draw smaller fonts, I won't need anything below 12 though. I have tried probably around 100 fonts in SFML with the size of 12 and all of them look bad (some look good if the font color is black), so this is a big problem for me. Even standard fonts like Verdana, Arial, Tahoma etc look bad.

Hopefully your version will help me out :)

Lord Delvin

  • Jr. Member
  • **
  • Posts: 68
    • ICQ Messenger - 166781460
    • View Profile
BF::Renderer::Text
« Reply #6 on: November 21, 2007, 09:35:02 pm »

That would be 12.0px

dabo

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
    • http://www.dabostudios.net
BF::Renderer::Text
« Reply #7 on: November 21, 2007, 09:50:13 pm »
Looks perfect! great job. That should be standard in SFML.

Lord Delvin

  • Jr. Member
  • **
  • Posts: 68
    • ICQ Messenger - 166781460
    • View Profile
BF::Renderer::Text
« Reply #8 on: November 22, 2007, 08:47:30 am »
Quote from: "dabo"
Looks perfect! great job. That should be standard in SFML.

Hmm...that make String usage a bit to complex, I think...have a look at the implementation, that might give you a hint how to implement a 12px only sfml or help me bugfixing;)

dabo

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
    • http://www.dabostudios.net
BF::Renderer::Text
« Reply #9 on: November 22, 2007, 03:05:34 pm »
I don't understand much of the code "behind the scenes", but why is it that your version displays text much better than the default version of SFML? Everything in SFML is so great therefore it's sad that the texts are displayed very poorly.

acrin1

  • Newbie
  • *
  • Posts: 45
    • View Profile
    • http://www.crpgdev.com
BF::Renderer::Text
« Reply #10 on: November 25, 2007, 04:26:59 pm »
Those samples look good. I'd certainly be interested in it as I was wanting to use small font sizes myself. I ended up just using a fixed size bitmap font in the end.

Thanks.

Lord Delvin

  • Jr. Member
  • **
  • Posts: 68
    • ICQ Messenger - 166781460
    • View Profile
BF::Renderer::Text
« Reply #11 on: November 26, 2007, 08:46:51 am »
Quote from: "dabo"
I don't understand much of the code "behind the scenes", but why is it that your version displays text much better than the default version of SFML?

I dont use OpenGL for the resizing job...just think of a screenshot taken at 640x480 magnified to 1600x1200 versus the scene rendered at 1600x1200.(and btw 16x16 -> 13x13 looks a lot worse)

@acrin: I'd like to see a bitmap font, as this would enable us to use even 8px high fonts,

acrin1

  • Newbie
  • *
  • Posts: 45
    • View Profile
    • http://www.crpgdev.com
BF::Renderer::Text
« Reply #12 on: November 26, 2007, 02:28:05 pm »
Quote from: "Lord Delvin"

@acrin: I'd like to see a bitmap font, as this would enable us to use even 8px high fonts,

There is a screenshot here and the font happens to be 8px:

http://acrin1.blogspot.com/

Not much text displayed here unfortunately.

 

anything