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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Cierpliwy

Pages: 1 [2]
16
General discussions / New implementation for sf::Font in SFML 2
« on: December 15, 2009, 08:59:53 pm »
Quote
No, actually the glyphs are rendered at every requested size.


So it's nicely done trap ;) For example user want to do effect which looks like:

Code: [Select]
text.SetCharacterSize((frames%100)/100);

And then... oops. My linux suspended in few seconds. No one knows what's going on :) The problem is that this function looks like a "scaling" one. In SFML 1 i used it a lot (but had a different name I think) so others also can misunderstand its meaning.

According to sf::String I will test it for a longer time and say something about it.

17
General discussions / New implementation for sf::Font in SFML 2
« on: December 15, 2009, 05:46:35 pm »
That's a great news. I did few tests with different sizes of displayed fonts and styles, and results are really good. Only few FPS lower with styled text. That's how font class should look like form the beginning (I know it wasn't possible ;)). One question although..

What about memory management? I really didn't look at the code. I would spend a lot of time to understand all the concepts, so question is much more convenient.

For example if I use one font, display text size 10 and then use size 50 I bet glyphs are rendered only if I exceed last maximum size? Last one: rendered bold and regular glyphs are held separately?

What are your next plans for sf::String, sf::Text, sf::Font classes ;D?

18
General discussions / New implementation for sf::Font in SFML 2
« on: December 14, 2009, 03:34:23 pm »
Code: [Select]

17. Is it  possible to perform styling (like  oblique, italic, bold,
    underline, etc.) with FreeType?

  Actually, these refer to very different things:

  - Italic  and Bold styles  usually mean  many variations  from the
    'Regular' font.   This is  why you normally  need a  proper font
    file for  each of  these.  For example,  the MS core  font Times
    comes in the following TrueType files:

      TIMES.TTF    Times New Roman Regular
      TIMESI.TTF   Times New Roman Italic
      TIMESB.TTF   Times New Roman Bold
      TIMESBI.TTF  Times New Roman Bold Italic
                   (sometimes named TIMESZ.TTF)

    With FreeType, you simply need the required font file to use it.

  - Oblique style  refers to a  transformation that is applied  to a
    regular font  in order to  make it 'slanted', likes  italics do.
    However,  an  italic font  very  frequently  contains small  but
    important variations that cannot  be produced by this method and
    make the font more appealing.

    Slanting  can  easily  be   done  with  a  transformation  under
    FreeType, with the exact same process as rendering rotated text.
    Please  read  the  "glyphs"   documentation  file  where  it  is
    explained in details.

    Usually, Windows or the  Macintosh produce oblique versions of a
    regular font  when the corresponding italic  TrueType file isn't
    available.   They also stretch  horizontally regular  fonts when
    the  bold one isn't  available.  All  of this  can be  done with
    trivial transformations.

  - Underlining  and stroking, are  not really  part of  the glyphs.
    They're simply lines that are  printed on the glyph after it has
    been rendered.  Each TrueType  file provides, in its OS/2 table,
    which  is  accessible  through  the face  object  properties  in
    FreeType, several  values that define the position  and width of
    those lines, in notional font units.

    If you  want to use them,  you'll have to scale  these values to
    your current instance/point size, then draw the lines yourself.


I really didn't know that there is no support for making bold, italic and underline font faces in freetype 2 library. Now, after some look at your code I finally understand why you use such tricks to render proper text. It would be difficult to do further optimizations in the source code. But I suggest you mentioning in documentation to use specific font files if possible (Arial Bold, Arial Italic) instead of using sf::Text::Style.

19
General discussions / New implementation for sf::Font in SFML 2
« on: December 14, 2009, 01:31:45 pm »
I think it's not worth to optimize that thing. If I were you I'd focus on better implementation of styles. Because now they are slow and little buggy. And justify feature would be nice :D

20
General discussions / New implementation for sf::Font in SFML 2
« on: December 14, 2009, 01:11:46 pm »
Test 1:
FPS: 380-390 , no changes at all...
Test 2:
FPS: ~410... so there are small changes.

21
General discussions / New implementation for sf::Font in SFML 2
« on: December 14, 2009, 12:56:12 pm »
But do these tests with disabled line 246 in src/SFML/Graphics/Text.cpp?

22
General discussions / New implementation for sf::Font in SFML 2
« on: December 14, 2009, 12:23:59 pm »
Yep, I uncommented that line and font rendering is even faster then in old version! FPS: 400-410, 90-100. But there is small glitch when rendering with styles, without kerning:


After look at 2 letters: VA, I really don't know if kerning is disabled or not, but line is of course uncommented.

23
General discussions / New implementation for sf::Font in SFML 2
« on: December 14, 2009, 10:53:20 am »
I did few basic tests to see if new font implementation is more convenient and faster.  I used this code for old sf::Font class: http://paste-it.net/public/qe854f8/ and this for new one: http://paste-it.net/public/r0a9e21/

The results are:
Old sf::Font without styles:

FPS: 390-400

Old sf::Font with styles:

FPS: 100-110

New sf::Font without styles:

FPS: 330-340

New sf::Font with styles:

FPS: 90-100

In overall:
+ Higher quality of font
+ Kerning
+ Don't need bother about charsets (easier translations)

- Some issues while displaying text with small rotation
- Slower rendering

Questions:
- Why underline is more transparent then font itself.
- Why text with styles is brighter (have invalid colour)

I didn't check how will be displayed small fonts. Which is also very important.

Good job Laurent!

Pages: 1 [2]
anything