×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    Jan 2007
    Location
    Oulu, Finland
    Posts
    147

    Lightbulb [announce] S60 3rd font patch updated

    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:

    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 09:23.

  2. #2
    Registered User
    Join Date
    Feb 2005
    Location
    Belgium (Europe)
    Posts
    1,352

    Re: [announce] S60 3rd font patch updated

    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 and 2.0.0, pygame, PyS60 CE on E90 and 5800 !

    Find my pys60 extension modules on cyke64.googlepages.com

  3. #3
    Regular Contributor
    Join Date
    Jan 2007
    Location
    Oulu, Finland
    Posts
    147

    Re: [announce] S60 3rd font patch updated

    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?

  4. #4
    Registered User
    Join Date
    Feb 2005
    Location
    Belgium (Europe)
    Posts
    1,352

    Re: [announce] S60 3rd font patch updated

    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 and 2.0.0, pygame, PyS60 CE on E90 and 5800 !

    Find my pys60 extension modules on cyke64.googlepages.com

  5. #5
    Registered User
    Join Date
    Feb 2007
    Posts
    22

    Re: [announce] S60 3rd font patch updated

    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

  6. #6
    Registered User
    Join Date
    Feb 2005
    Location
    Belgium (Europe)
    Posts
    1,352

    Re: [announce] S60 3rd font patch updated

    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 and 2.0.0, pygame, PyS60 CE on E90 and 5800 !

    Find my pys60 extension modules on cyke64.googlepages.com

  7. #7
    Registered User
    Join Date
    Feb 2007
    Posts
    22

    Re: [announce] S60 3rd font patch updated

    Thanks Cyke!

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

    Cheers
    Dorian

Similar Threads

  1. Replies: 7
    Last Post: 2007-11-30, 14:49
  2. Replies: 7
    Last Post: 2007-09-05, 10:38
  3. Remote Camera Manager - S60 3rd edition
    By pspickett in forum General Development Questions
    Replies: 0
    Last Post: 2006-12-18, 07:02
  4. Device font in S60 Platform SDK 3rd ED
    By jiipee63 in forum Mobile Java Tools & SDKs
    Replies: 4
    Last Post: 2006-10-02, 10:09
  5. OpenGL ES Support in S60 3rd Edition Beta SDK
    By choefele in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2005-12-14, 06:01

Posting Permissions

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