Results 1 to 13 of 13

Thread: CL_TextStyler patch (clanlib 1.0)

  1. #1

    Default CL_TextStyler patch (clanlib 1.0)

    In Clanlib 1.0 font scale isn't stored per instance.
    CL_TextStyler doesn't consider this so when you do [s 0.95] Text [/s]
    your font shrinks to infinity, with every paint.
    This patch solves this.
    To bad that CL_Glyphs don't store the font scale so this patch alone doesn't make it work as intended.
    Attached Files Attached Files

  2. #2

    Default

    Here is a second patch which saves the font scale on every glyph. It partly make CL_TextStyler now work. (textstyler still doesn't check if the lines changes sizes). And it should although reduce other font problems.
    Please check if this patch breaks anything, I only tested it on my small program.
    Attached Files Attached Files

  3. #3

    Default

    this updated patch although adds a fontcolor to the Glyphs which enables CL_TextStyler to actually work. (with some minor issues with different font scale)
    Attached Files Attached Files

  4. #4

    Default

    here a small segfault/debugwarning I found on windows system when you draw a string with more than 256 characters it is triggered (getting value 292 of a 255 big std::vector). simple patch is included
    Attached Files Attached Files

  5. #5
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    I'm sorry noone has grabbed these patches, but we're lacking a 1.0.x maintainer... if anyone want to grab that position, we'd be grateful

  6. #6
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,343

    Default

    I used to be able to test/apply 1.0 patches but I've been pretty dead lately because my current project doesn't use it..

    We need a maintainer who works with it on a daily basis to notice when new patches break something.
    Seth A. Robinson
    Robinson Technologies

  7. #7
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Patch applied.

    The patch looked okay (visually)

    I checked the font example and the rich text example, and they seem to work as before

  8. #8

    Default Maintainer

    It seems like I'm the main patcher of clanlib 1.0 so I'm volunteering (but I've no svn access so far).

    The Textsystem needs a major rewrite anyway, because it really lags when you have a lot of text. And having the freedom to move/change/design the code around would make this job a lot easier. At least I hope that it has something to do with algorithms not being O(n).

  9. #9
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    Can this be fixed without modifying the API?

    If we change the API, then the version would have to be bumped up to ClanLib V1.1.0

    Personally, i'm not touching ClanLib 1.0. I don't know the API (I only apply patches). I already spend too much time maintaining ClanLib 2.1 SVN and ClanLib 2.2 SVN.

    If you want to fix any problems, your very welcome

    What do other developers think?

  10. #10
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    Yes, changing the API will require a version bump. Hopefully, this won't be neccessary, though..

    If someone wants to do 1.0 maintaince, I say go Just need to make sure any new code follows the patterns and "quality" of existing 1.0 code.

  11. #11

    Default

    At some small points it won't. I found some O(n^2 log(n)) code parts. But maybe it's necessary to change from some of the std::maps to std::vector.
    But I have no complete overview of the code yet.
    There is a lot of action going on when drawing text, so there should be improvements possible, even without changing small parts of the API. (only adding new private structures).

    I think it's more interessting to see if ClanLib 2.2 framerate although drops, when painting a very long text. (for example some mission information, or a long helptext)

  12. #12
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    ClanLib 2.1.1 Fonts were completely rewritten (from the ClanLib 0.9 development branch).

    Each font glyph are packed inside large multiple opengl texture(s) (Using CL_TextureGroup).

    Font glyph drawing is batched, so only a single opengl call is required for a block of text. CL_Sprite's and CL_Image's are also batched this way

    Examples/Text shows this. Lots of text drawn at 333fps on my pc


  13. #13

    Default

    the slow part isn't the drawing (it only tages about 1/4 of the lag).
    The slow part is drawing to the glyphbuffer which shouldn't implement any GL call. It's simply because in the glyphbuffer everything is stored as std::maps so adding all characters at least takes O(n log(n)) because AFAIK at the moment we add the font for every char.

    I did a reimplementation of the code for my game and replace std::map with a vector which is filled with each fontchange and an id in the glyph pointing to the corresponding vector position. And had a speed update of factor *4 (although it misses functionality, the lag now should only be drawing).

    So I think rewriting the CL code might gain a lot. Even when we just add something like a vector<CL_Font> to keep the map<CL_Font> empty and search it only for compatibility reasons.

    I use 2 times as much text with a lot more colorchanges. (they should decrease the fps overlinear)

Similar Threads

  1. Patch [Clanlib 8.1] alsafailsegfault
    By gpmfuchs in forum Official ClanLib SDK Forums
    Replies: 11
    Last Post: 12-02-2008, 02:21 AM
  2. ClanLib 0.9 pacman example patch
    By rombust in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 12-01-2008, 04:09 PM
  3. Using CL_TextStyler
    By LaDoncella in forum Official ClanLib SDK Forums
    Replies: 3
    Last Post: 06-17-2007, 09:33 PM
  4. Patch to ClanLib-0.9 svn rev 365
    By rombust in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 05-09-2007, 01:08 PM
  5. Patch to ClanLib-0.8 svn rev 364
    By rombust in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 05-06-2007, 01:14 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •