forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

loaded font and setPixelSizes tied together?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
liquid8d



Joined: 30 Jun 2005
Posts: 66

PostPosted: Sun Feb 05, 2006 5:51 am    Post subject: loaded font and setPixelSizes tied together? Reply with quote

I am trying to use multiple font sizes, but it seems that if you try to set more than one variable to the same font, and just change it's pixelsize, it doesn't work. They all end up being the same size as the last setPixelSizes provided. Maybe this is the way it should be by design, or maybe a bug,?

For instance:

Code:


myFont = font.load("font.ttf")

smallFont = myFont
smallFont:setPixelSizes(0, 10)

mediumFont = myFont
mediumFont:setPixelSizes(0, 12)

largeFont = myFont
largeFont:setPixelSizes(0, 14)



The only way I can get it to work is to load each font seperately...

Code:


smallFont = font.load("font.ttf")
smallFont:setPixelSizes(0, 10)

mediumFont = font.load("font.ttf")
mediumFont:setPixelSizes(0, 12)

largeFont = font.load("font.ttf")
largeFont:setPixelSizes(0, 14)



So question is, a) is this an error, and b) is loading the same font multiple times going to eat memory or cause any kind of performance hit?


This is on .16 luaplayer.


Thanks,

liquid8d
Back to top
View user's profile Send private message AIM Address
modsyn



Joined: 27 Sep 2005
Posts: 28

PostPosted: Sun Feb 05, 2006 3:08 pm    Post subject: Reply with quote

i don't think it's a bug. saying
mediumFont = myFont is really just saying that mediumFont and myFont
both point to the same thing. so, if you have 3 or 4 variables all pointing
at the same Font object then using any of them will affect the same thing.
someone correct me if i'm wrong, but i think that's how it works.

i noticed that truetype printing is soooo slow. it was the reason my downloads
were dragging. i went on a whim one day and replaced all of the fontPrints
with regular prints and the speed was more than twice as fast.
Back to top
View user's profile Send private message
liquid8d



Joined: 30 Jun 2005
Posts: 66

PostPosted: Mon Feb 06, 2006 6:08 am    Post subject: Reply with quote

that's what I am assuming. To me it just seemed that setting another variable to the same loaded font would use the same font, but have it's own settings... apparently not. Seems odd to have to load the same font multiple times to have different pixel settings... Thanks anyways.

Truetype is pretty slow, hopefully it can be sped up soon? :)
Back to top
View user's profile Send private message AIM Address
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Tue Feb 07, 2006 5:35 am    Post subject: Reply with quote

liquid8d wrote:
Truetype is pretty slow, hopefully it can be sped up soon? :)


Yes, it's slow because the curves of the fonts are rendered to an byte array again and again for each blit, which then is used for plotting the font. The byte array should be cached and the cache should be invalidated when setting a new font size, then it will be nearly as fast as image blitting.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group