You Are Here:

Community: Developer Discussion Boards

#1 Old Lightbulb [announce] S60 3rd font patch updated - 2007-02-15, 21:40

Join Date: Jan 2007
Posts: 135
Location: Oulu, Finland
GameDude
Offline
Regular Contributor
Started from here: http://discussion.forum.nokia.com/fo...ad.php?t=97573

Get it from here:
http://www.student.oulu.fi/~jtoivola...t_patch_V2.zip

Screenshot here:
http://www.student.oulu.fi/~jtoivola/s60/shot.png

###############
V2 15.02.2007
###############
WARNING: If you use the new features, this patch may not be a 'temporary' solution anymore.

Fixed:
  • Crash when no font given.
  • Zoom value can be > 0 instead of > 1
  • Giving True or False for italic and bold should work correctly.

Added:
  • twips - For setting font size. If both size and twips are given, twips is used.
  • getwidth - Returns the width of the text in pixels using the given font.
  • maxwidth - Returns amount of characters that can be displayed without exceeding the specified width. Draws the text that fits if dodraw == True
  • dodraw - Enable or disable drawing.

If both getwidth and maxwidth are given, character count is returned.

For those who do not know what is a "twip" let me quote this piece of poetry from Python for Series 60 Platform API Reference:

Quote:
Twips are screen-independent units to ensure that the proportion of screen elements are the same on all display systems. A twip is defined as 1/1440 of an inch, or 1/567 of a centimeter.
If you need exact size, twips is easier to use than trying to tinker with zoom and size.

The font_leaktest.py is updated with a test for the above mentioned crash and example use of the added features.

What it still needs, is a way to store all attributes of the previous font.

PS: The Ball works now

I hope you can test this and report any bugs you encounter.

Edit: Oops... GCCE didn't compile because of those cursed goto -statements. Fixed.
Last edited by GameDude : 2007-02-16 at 10:23.
Reply With Quote

#2 Old Re: [announce] S60 3rd font patch updated - 2007-02-19, 18:12

Join Date: Feb 2005
Posts: 1,353
Location: Belgium (Europe)
cyke64's Avatar
cyke64
Offline
Super Contributor
hello ,

You are great man

Code works but API is awfull

Could you refine API in graphics.py ? I would have width in pixels with a new function not embedded with the all purpose text

Thanks you for the future G3 patch !


pys60 1.4.5,1.9.7,pygame,PyS60 CE on E90 , N810 with Python 2.5.2 and ... last PyS60 1.9.7 with touch ui on 5800 !

pys60 extension modules on http://cyke64.googlepages.com/
Reply With Quote

#3 Old Re: [announce] S60 3rd font patch updated - 2007-02-19, 19:05

Join Date: Jan 2007
Posts: 135
Location: Oulu, Finland
GameDude
Offline
Regular Contributor
You are welcome.

API is awfull, I know. Causes long lines sometimes. The text -function has all the operations to set the font, so it was easier for me to put all functionality in it. Bad decision maybe.

I have been thinking to make it similar to Symbian's API. By using a separate function to set the font, I could separate the other functionality also in similar way. It would be a bit faster also, since there would be no need to set the font attributes for drawing every time. In Python it would look something like this:

Code:
draw.setFont( "normal", size = 7, bold = True, fill = ( 255,0,0 ) )
width = draw.getWidth( u"Title:" )
draw.text( (10, 15), u"Title:" )
draw.text( (10 + width, 15), u"value" )

And I'm not sure, if the text drawing function should be kept backwards compatible with scripts written for pre 3rd edition. At least those new features I added will be removed to separate functions. After setting the font, all that is actually needed is the text and position parameters. By using separate setFont -function, it would propably be easier to make scripts work in both platforms:

Code:
if s60ver >= (3,0):
  draw.setFont( u"Times New Roman", size=12 )
else:
  draw.setFont( u"LatinBold12" )
This would be a good time to change the API, because it seems that it is too tricky to make a compatible solution. Or what do you think?
Reply With Quote

#4 Old Re: [announce] S60 3rd font patch updated - 2007-02-19, 19:16

Join Date: Feb 2005
Posts: 1,353
Location: Belgium (Europe)
cyke64's Avatar
cyke64
Offline
Super Contributor
Quote:
Originally Posted by GameDude
You are welcome.

This would be a good time to change the API, because it seems that it is too tricky to make a compatible solution. Or what do you think?
All changes are ok for me
I think it would be better to make a not compatible solution because many features are not available in 3rd and new API proposal seems the same as this from appuifw.text with font settings can be set by default and not each time in the drawing function ...


pys60 1.4.5,1.9.7,pygame,PyS60 CE on E90 , N810 with Python 2.5.2 and ... last PyS60 1.9.7 with touch ui on 5800 !

pys60 extension modules on http://cyke64.googlepages.com/
Reply With Quote

#5 Old Re: [announce] S60 3rd font patch updated - 2007-02-22, 12:53

Join Date: Feb 2007
Posts: 22
DorianScholz
Offline
Registered User
Thanks a lot GameDude!

This is what I was waiting for!!!
With the getwidth feature I can now really use it for my PyS60RemoteControl app...

But I also think you should change the API and make a seperate setfont and getwidth function!

One last thing ;-)
Could you also post a precompiled version when you're finished with it?
I don't want to install the whole Symbian SDK just for that...

Thanks again

Dorian
Reply With Quote

#6 Old Re: [announce] S60 3rd font patch updated - 2007-02-22, 13:28

Join Date: Feb 2005
Posts: 1,353
Location: Belgium (Europe)
cyke64's Avatar
cyke64
Offline
Super Contributor
Quote:
Originally Posted by DorianScholz
But I also think you should change the API and make a seperate setfont and getwidth function!

One last thing ;-)
Could you also post a precompiled version when you're finished with it?
I don't want to install the whole Symbian SDK just for that...

Thanks again

Dorian
Hello Dorian ,

Have you missed this announce from me : PyS60 1.3.1.8 with GameDude font 3rd patch ?

keep up the good job

Cyke64


pys60 1.4.5,1.9.7,pygame,PyS60 CE on E90 , N810 with Python 2.5.2 and ... last PyS60 1.9.7 with touch ui on 5800 !

pys60 extension modules on http://cyke64.googlepages.com/
Reply With Quote

#7 Old Re: [announce] S60 3rd font patch updated - 2007-02-22, 17:15

Join Date: Feb 2007
Posts: 22
DorianScholz
Offline
Registered User
Thanks Cyke!

I didn't see your announcement...
Got here by searching...

Cheers
Dorian
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
3rd party dual mode phone app on the S60 3rd edition SDK ZelimirD VoIP 7 2007-11-30 15:49
Problems with MIDlet icon size in application shell on S60 3rd edition devices knorring Mobile Java General 7 2007-09-05 11:38
Remote Camera Manager - S60 3rd edition pspickett General Discussion 0 2006-12-18 08:02
Device font in S60 Platform SDK 3rd ED jiipee63 Mobile Java Tools & SDKs 4 2006-10-02 11:09
OpenGL ES Support in S60 3rd Edition Beta SDK choefele Symbian Media (Graphics & Sounds) 2 2005-12-14 07:01

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia