SFML community forums

General => SFML wiki => Topic started by: panithadrum on August 10, 2010, 09:00:40 pm

Title: [Sources] Rich text
Post by: panithadrum on August 10, 2010, 09:00:40 pm
sfe::RichText Allows the user to draw paragraphs of text with mixed styles and colors.

The source code is found in this git repository: https://github.com/Skyrpex/RichText.

You are invited to contribute using the issue tracker (https://github.com/Skyrpex/RichText/issues).

Have fun!
Title: Re: [Sources] Richt text
Post by: eXpl0it3r on July 24, 2012, 01:55:15 am
I could have created a new thread, but I thought to give all the credit to panithadrum and keep the 'history' clear I'll bump this old thread. ;)

I've converted the class using an old version of SFML 2 from the old wiki to the latest SFML 2 version and added it to the GitHub wiki (unfortunatly the titles still don't get updated correctly).

- A RichText class (https://github.com/SFML/SFML/wiki/Source:-RichText)

This class can still get some improvements, so feel free to do so. ;)
Title: Re: [Sources] Rich text
Post by: panithadrum on July 24, 2012, 06:30:40 am
I forgot about that class 8) Thanks for the conversion!

It would be cool if someone fixes the return carriage thing. Maybe I will do myself, but I'm quite busy this month.
Title: Re: [Sources] Rich text
Post by: Laurent on July 24, 2012, 08:04:18 am
Quote
unfortunatly the titles still don't get updated correctly
The GitHub guy answered me about this: they changed how title work, and now the page name is shown as the main title, regardless of whether there is a level-1 title (one #) or not.

So it seems that the whole naming convention has to be changed, you must use "human friendly" page names directly.
Title: Re: [Sources] Rich text
Post by: eXpl0it3r on July 24, 2012, 11:12:28 am
I forgot about that class 8) Thanks for the conversion!

It would be cool if someone fixes the return carriage thing. Maybe I will do myself, but I'm quite busy this month.
Hehe no problem, maybe I'll look into it.

@Laurent: Will you give out new directives?
Title: Re: [Sources] Rich text
Post by: Hiura on July 24, 2012, 11:30:20 am
Looks great!

I've 2-3 remarks though.  ;D

Wouldn't vector be more efficient here (instead of list) ? (Insertion is only at the end so it's should be O(1) most of the time, and iteration is quite frequent in this class so it should be faster with continuous memory.) I know that at this scale it doesn't really matter which collection you use but it's a good programming practice.

On the style level, using a typedef std::somecollection<sf::Text> CollectionType; would allow changing the collection in one line editing.

Last remarque : using sf as the namespace is quite confusion IMHO. If someone sees an example alone he would think RichText is part of SFML itself and when he will try to use it he will get errors without understanding why.

And I say it again : great job, this is really useful !
Title: Re: [Sources] Rich text
Post by: eXpl0it3r on July 24, 2012, 12:56:23 pm
Last remarque : using sf as the namespace is quite confusion IMHO. If someone sees an example alone he would think RichText is part of SFML itself and when he will try to use it he will get errors without understanding why.
Hehe I knew you would bring that up. ;D
But I fully agree with you. It kind of is like trying to put some code into the std namespace (which isn't allowed afaik).  ;)

Btw Hirua, will you consider porting your sources from the old wiki to the new one?
Title: Re: [Sources] Rich text
Post by: Ceylo on July 24, 2012, 01:24:06 pm
It's probably quite another level but I guess it would be interesting to read real RTF files and to be able to display them. librtf (http://librtf.sourceforge.net/) seems to do a good part of the job.
Title: Re: [Sources] Rich text
Post by: Hiura on July 24, 2012, 01:42:47 pm
Btw Hirua, will you consider porting your sources from the old wiki to the new one?
Yes, I might do that later this summer if I have enough free time (it has been on my mind since a few months now but time is running out so fast...).
Title: Re: [Sources] Rich text
Post by: panithadrum on July 26, 2012, 01:12:21 pm
I felt like creating a git repository so... https://github.com/Skyrpex/RichText

You are invited to contribute!
Title: Re: [Sources] Rich text
Post by: eXpl0it3r on July 26, 2012, 01:28:40 pm
I felt like creating a git repository so... https://github.com/Skyrpex/RichText
Nice! :)

Btw you could update the first post of yours, adding the new wiki page & the git repository.

Also it's now questionable if the wiki page is really needed or if we should just link to your repository...
Title: Re: [Sources] Rich text
Post by: panithadrum on July 26, 2012, 01:46:06 pm
Btw you could update the first post of yours, adding the new wiki page & the git repository.
Done!

Also it's now questionable if the wiki page is really needed or if we should just link to your repository...
I've just edited the wiki page to link to the repository, but I think it should move from source code to projects.
Title: Re: [Sources] Rich text
Post by: eXpl0it3r on July 26, 2012, 01:52:40 pm
I've just edited the wiki page to link to the repository, but I think it should move from source code to projects.
Then do so! :P
The wiki is the territory of the users. ;)
Title: Re: [Sources] Rich text
Post by: panithadrum on February 24, 2014, 08:09:52 pm
Hey guys!

FYI, I've released version 2.0.0 that mainly fixes the newline bug.

Have fun!