More Truetype errors

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
xperiments
Posts: 3
Joined: Tue Jan 10, 2006 9:57 pm

More Truetype errors

Post by xperiments »

Hi, I have this problems:

1 - if I create an new image, and whant to put some text in it as:

_font = Font.load('somefont.ttf')
_font:setPixelSizes(0,30)

fileImage = Image.createEmpty(480,272)
fileImage:fontPrint(_font , 0, 0, 'Hello', Color.new(0,0,2555))

the text not render, it seems to need a:

fileImage:clear(Color.new(0,0,0))

then I can get working, but it is not posible to assing a transparent color like Color.new(0,0,0,0)

2- In the previus working case, the position of the Text is not correct, because it seems that the 0,0 point is outside the area,

Else if I set x=0 and y = 100 it renders but not exactli at 0,100 it its rendered at
x=0
y= 100-TextHeight


Thanks
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Re: More Truetype errors

Post by Shine »

xperiments wrote:Hi, I have this problems:

1 - if I create an new image, and whant to put some text in it as:

_font = Font.load('somefont.ttf')
_font:setPixelSizes(0,30)

fileImage = Image.createEmpty(480,272)
fileImage:fontPrint(_font , 0, 0, 'Hello', Color.new(0,0,2555))

the text not render, it seems to need a:

fileImage:clear(Color.new(0,0,0))

then I can get working, but it is not posible to assing a transparent color like Color.new(0,0,0,0)
I've fixed this, will be in Lua Player 0.20 today.
xperiments wrote: 2- In the previus working case, the position of the Text is not correct, because it seems that the 0,0 point is outside the area,

Else if I set x=0 and y = 100 it renders but not exactli at 0,100 it its rendered at
x=0
y= 100-TextHeight
This is by design. The reason is, that with true type fonts you don't know the exact height of each character, so you specify the base line, the same like when you write some text on a paper with lines. This is the usual concept for true type font drawing in other systems, too (e.g. Java).
romero126
Posts: 200
Joined: Sat Dec 24, 2005 2:42 pm

Post by romero126 »

I love you shine! Marry me!
Post Reply