a Rich Text library for LÖVE

Showcase your libraries, tools and other projects that help your fellow love users.

Which license should richtext use?

Poll ended at Sat Oct 09, 2010 4:36 pm

Public Domain
4
22%
BSD
1
6%
MIT/X11
5
28%
LPCL
0
No votes
zlib
6
33%
LGPL
1
6%
Other (please specify in replies)
1
6%
 
Total votes: 18

User avatar
Mud
Citizen
Posts: 98
Joined: Fri Nov 05, 2010 4:54 am

Re: a Rich Text library for LÖVE

Post by Mud »

Robin wrote:Oh, I thought you enabled debug mode, which draws those rectangles so you can check whether everything's aligned OK.
And so I did. >.>
Robin wrote:Are you on windows? I think for that you need to wait until rude makes another build, or ask a friendly lover on windows who just happened to have compiled it themselves recently.
How are you guys building it? Do you have a libraries package somewhere, or are you downloading them from their respective sources?
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: a Rich Text library for LÖVE

Post by TechnoCat »

Mud wrote:How are you guys building it? Do you have a libraries package somewhere, or are you downloading them from their respective sources?
http://web.ics.purdue.edu/~dcfritz/file ... in-sdk.zip
That should help you get started.

sorry to off-topic like that.
luminosity
Prole
Posts: 34
Joined: Fri Sep 24, 2010 5:46 am

Re: a Rich Text library for LÖVE

Post by luminosity »

Robin wrote:
luminosity wrote:I've noticed rendering text to a buffer seems to make it extremely ugly and hard to read. That seems to be love wide rather than specific to this library though. I don't suppose anyone knows what's going on there? I can attach screenshots if someone wants.
Odd, I have never seen that effect. Screenshots would be useful, yes. :)
Rendering text directly to screen using love.graphics.printf:
no-framebuffers.png
no-framebuffers.png (2.99 KiB) Viewed 2149 times
Rendering with 1 framebuffer, used by rich text:
1-framebuffer.png
1-framebuffer.png (8.37 KiB) Viewed 2149 times
Rendering several rich text messages into an image using a framebuffer in my draw method:
2-framebuffers.png
2-framebuffers.png (7.15 KiB) Viewed 2149 times
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: a Rich Text library for LÖVE

Post by Robin »

Hm. The problem seems to be that RichText doesn't round off any positions. Luckily, that's fixable.
luminosity wrote:Rendering several rich text messages into an image using a framebuffer in my draw method:
Wait, what?
Help us help you: attach a .love.
luminosity
Prole
Posts: 34
Joined: Fri Sep 24, 2010 5:46 am

Re: a Rich Text library for LÖVE

Post by luminosity »

Robin wrote:Hm. The problem seems to be that RichText doesn't round off any positions. Luckily, that's fixable.
Ah. I didn't think of that when I first ran into these problems. Though... why would not rounding be a problem when rendering text to an image but not when rendering directly to screen? I'd have thought love would treat both the same way.
Robin wrote:
luminosity wrote:Rendering several rich text messages into an image using a framebuffer in my draw method:
Wait, what?
My previous code for the combat log rendered strings to an image so I could use a quad to choose what to display. When I substitued rich text in I put it in place of the printfs, so it now renders rich text's framebuffers inside my own framebuffer.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: a Rich Text library for LÖVE

Post by Robin »

luminosity wrote:Ah. I didn't think of that when I first ran into these problems. Though... why would not rounding be a problem when rendering text to an image but not when rendering directly to screen? I'd have thought love would treat both the same way.
I have no idea. I do have, however, committed what I hope to be a fix to your problem. Will push it to GitHub soon. [EDIT: pushed. You may commence the cheering.]
luminosity wrote:so it now renders rich text's framebuffers inside my own framebuffer.
Someone please post the obligatory Xzibit image macro. :P
Help us help you: attach a .love.
luminosity
Prole
Posts: 34
Joined: Fri Sep 24, 2010 5:46 am

Re: a Rich Text library for LÖVE

Post by luminosity »

Robin wrote:[EDIT: pushed. You may commence the cheering.]
Just updated to it. I get an error running it out of the box, where it sets self.height = y. "Attempt to index global self, a nil value." Having fixed that, unfortunately your change doesn't seem to have stopped the weird rendering for a framebuffer. I'm a bit stumped trying to figure out what could be causing it.
different-framebuffers.png
different-framebuffers.png (4.26 KiB) Viewed 2091 times
The thing that stumps me is that the End Turn text here is rendered using a framebuffer and the text in it looks fine. The rich text in the log just above it isn't however. But it's not just the rich text, if I draw my own framebuffer there and put some text in it it also looks odd like the rich text. I've checked that the left, and top values given to draw are rounded, just to be sure, and they are.

In any case, since I have one framebuffer working and another not, there has to be some difference that accounts for it. I'll play around and try to figure it out.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: a Rich Text library for LÖVE

Post by Robin »

Whoops. I think the latest commit fixes the error.
luminosity wrote:In any case, since I have one framebuffer working and another not, there has to be some difference that accounts for it. I'll play around and try to figure it out.
Sure. I have no idea what would be different.
Help us help you: attach a .love.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: a Rich Text library for LÖVE

Post by Robin »

All right, more updates! Experimental ones.

This is an attempt to fix the horrible mess that was word-wrapping. However, it doesn't work exactly right yet. And you can help out! Test it out, or check the source code for mistakes.
Help us help you: attach a .love.
luminosity
Prole
Posts: 34
Joined: Fri Sep 24, 2010 5:46 am

Re: a Rich Text library for LÖVE

Post by luminosity »

Just upgraded, and I had two small problems.

1. If colormode is set to replace by the love app, text won't be drawn with colours. I can see the justification for going with the user's choice, but when asking for a colour, I suspect people want a colour. In any case, I just chucked the colour modes I wanted in to the library and it all works for me, so no problem if you disagree.

2. Text lines are rendered very close, after hitting a new line, and seem to ignore any attempt to set line height on the font. I'd like to space my text out a little more, any chance that there'd be an easy way to specify this?

Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 56 guests