 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
liquid8d
Joined: 30 Jun 2005 Posts: 66
|
Posted: Sun Feb 05, 2006 5:51 am Post subject: loaded font and setPixelSizes tied together? |
|
|
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 |
|
 |
modsyn
Joined: 27 Sep 2005 Posts: 28
|
Posted: Sun Feb 05, 2006 3:08 pm Post subject: |
|
|
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 |
|
 |
liquid8d
Joined: 30 Jun 2005 Posts: 66
|
Posted: Mon Feb 06, 2006 6:08 am Post subject: |
|
|
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 |
|
 |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Tue Feb 07, 2006 5:35 am Post subject: |
|
|
| 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 |
|
 |
|
|
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
|