[Sugar-devel] Best Practices for setting font and widget size

Gonzalo Odiard godiard at gmail.com
Sun Jul 24 21:18:27 EDT 2016


Best practice is not hardcode, but measure the text and set the font size
as needed.
You can use Pango to measure the text.
Example code in Memorize activity:

https://github.com/godiard/memorize-activity/blob/master/svgcard.py#L303

On Sun, Jul 24, 2016 at 9:15 AM, Yash Agarwal <agrwal.ysh94 at gmail.com>
wrote:

> Hello,
> In this pic
> <https://lh3.googleusercontent.com/T65HVKfDOZg53ESHmipRMfrLAHAoVJKAqxWPQcGD1ywRNF8YF11B65tW-PuN5mlsDdP5GKUzA5giBfG_66Fv7MNsMsEGAAYF3t6pobEPNXeUNQITv9D-WqzyiY8XGeJcWS_nc48f6X11DzcVvrQBduktjaIGrGZ5F2HYolfbTTmRrfHjFR7fOUSqID3tLOWpIgRxGWAbwoDz4ywCFbl79LDyqUUI1xHg1NRdjO_1q1tUA0Fcq6NfAhSipwMayLL6GBUjmNQB9rjGyN_UQXcbEhoy1x_9X4wZARcLChWp5SrBuWerQIjbBmydloiYGtWLz-rF1JHn43KDA-ctpTfz71yEhQi-e1_iVaghHeEUDTthLJVkFFHGNkF7GWdWZ0H6c2p38_akz2UoI5sWnmZ2uQeOhaApZqUFOv1tjb7iHk77zNWhig7KjjCrjJXg9qTrQxVJ4qYxwNtVowr1sakx_yW0Let3ytvnbOcinGhcdOrsQ84RkmOFxkVcJyCgfu9OMZlxwSQMh0yRIdyMso4BXiSOPuZQ11n4RIO2ZARUDugs1KX35CloKjlYHA99MZs44_KEQlRCAuOk328HwgRu1XU_VBmEkN0Q=w1624-h913-no> you
> can see the font size and the grid below are way too large for the screen
> of a XO-4, this looked just fine on my laptop(at 1920 x 1080)
> Assuming this is a common issue, what is the general way this is handled
> in a sugar activity or should I just hard code the sizes to  a lower value
> and not worry about multiple screen sizes?
>
> with regards,
> Yash Agarwal
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
>


-- 
[image: photo]
*Gonzalo Odiard*
Lider de proyecto
tel.:  <tel.:+4210-7748>2081-6424 y 2082-0312 | www.trinom.io    Av
Calchaqui 4936ยท 2do Piso. Quilmes
<http://www.facebook.com/trinomiosrl>
<https://www.linkedin.com/company/trinom-io>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20160724/abc39ee4/attachment-0001.html>


More information about the Sugar-devel mailing list