[PD] pd font finetuning with tk scaling ?

Hans-Christoph Steiner hans at eds.org
Tue Nov 29 17:57:48 CET 2005


On Nov 29, 2005, at 3:41 AM, Andre Schmidt wrote:

> i remember someone saying "-*-courier-bold--normal--*-8" would be using
> pixel sizes (instead of point sizes). made a little test and font bomb
> didnt resize the fonts at all... (ill try more later)
>
> btw. the code in miller cvs looked a little different... (pd devel cvs
> had issues, so i used millers cvs;)

I think I found something else.  It seems that tk scaling only works  
when fonts are specified using the tk font spec (courier 8 bold).  The  
fonts specified X-style (-*-courier-bold--normal--*-8) don't seem to  
get scaled.

> but i found something else (that i allways wanted to do:)
> http://wiki.tcl.tk/470
> adding 'option add *font "Helvetica 10"' in top of 'pd.tk' changes all
> the tk widget fonts
> and 'option add *font "Helvetica -10"' seems to even use pixel sizes...
>
> that wiki seems to be good resource, where i found about "tk scaling"
> too: http://wiki.tcl.tk/8484
>
> btw. the little (useless?) tk scaling gallery is here:
> http://osku.de/pd/tst01/index.html

Nice, it does clearly demonstrate the variations on systems.  It would  
be really great to have everything controlled by tk scaling, then have  
the tk scaling factor be a preference.  Plus, you can get the current  
screen DPI in Tk, so then you could have some level of automatic tk  
scaling based on screen DPI.

.hc

>
> getting font confused :)
> andre
>
> On Mon, 2005-11-28 at 15:37 -0500, Hans-Christoph Steiner wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>>
>> Looks like that is done here (in u_main.tk aka pd.tk):
>>
>> proc pdtk_pd_startup {version apilist} {
>>      global pd_myversion pd_apilist
>>      set pd_myversion $version
>>      set pd_apilist $apilist
>>
>>      set width1 [font measure  -*-courier-bold--normal--8-* x]
>>      set height1 [lindex [font metrics -*-courier-bold--normal--8-*]  
>> 5]
>>
>>      set width2 [font measure  -*-courier-bold--normal--10-* x]
>>      set height2 [lindex [font metrics -*-courier-bold--normal--10-*]  
>> 5]
>>
>>      set width3 [font measure  -*-courier-bold--normal--12-* x]
>>      set height3 [lindex [font metrics -*-courier-bold--normal--12-*]  
>> 5]
>>
>>      set width4 [font measure  -*-courier-bold--normal--14-* x]
>>      set height4 [lindex [font metrics -*-courier-bold--normal--14-*]  
>> 5]
>>
>>      set width5 [font measure  -*-courier-bold--normal--16-* x]
>>      set height5 [lindex [font metrics -*-courier-bold--normal--16-*]  
>> 5]
>>
>>      set width6 [font measure  -*-courier-bold--normal--24-* x]
>>      set height6 [lindex [font metrics -*-courier-bold--normal--24-*]  
>> 5]
>>
>>      set width7 [font measure  -*-courier-bold--normal--36-* x]
>>      set height7 [lindex [font metrics -*-courier-bold--normal--36-*]  
>> 5]
>>
>>
>> I don't have time to mess with it now, anyone else want to try?
>>
>> .hc
>>
>> On Nov 28, 2005, at 2:25 PM, B. Bogart wrote:
>>
>>> Woo hoo!!!!
>>>
>>> Miller, how does PD size object boxes?
>>>
>>> b.
>>>
>>> Hans-Christoph Steiner wrote:
>>>>
>>>> Duh, why didn't I remember the -10 thing.  Anyway, I tried that, and
>>>> it
>>>> does indeed work!  The font sizes are very similar in size on  
>>>> Windows
>>>> and Mac OS X.  But now the problem is that the boxes on Mac OS X a
>>>> being created too large.  I think that this shouldn't be too hard to
>>>> figure out, it might just be a matter of replacing all of the  
>>>> Xwindows
>>>> font specs with { courier -12 bold } Tk-style font specs.
>>>>
>>>> It would be great to get this into the upcoming Pd-extended release.
>>>>
>>>> .hc
>>>>
>>>> On Nov 28, 2005, at 10:38 AM, B. Bogart wrote:
>>>>
>>>>>> hmmm, and did you try with the -10 pixel based font size?
>>>>>>
>>>>>> if the pixel (width) of the font is known then it would be easy to
>>>>>> scale
>>>>>> the object box based on the number of characters/spaces.
>>>>>>
>>>>>> Is that how this how it works now Miller?
>>>>>>
>>>>>> Should be easy to adapt that code to work with a consistant font.
>>>>>>
>>>>>> Good work Hans!
>>>>>>
>>>>>> b.
>>>>>>
>>>>>> Hans-Christoph Steiner wrote:
>>>>>>
>>>>>>>
>>>>>>> I think I found something:  if you change the fontspec from
>>>>>>> Xwindows
>>>>>>> style ( -*-courier-bold--normal--10-) to standard Tk style {
>>>>>>> courier  10
>>>>>>> bold }, then it looks like the fonts are the same size on MacOSX
>>>>>>> and
>>>>>>> Windows.  But then, the only problem is that the object boxes  
>>>>>>> don't
>>>>>>> adjust, and are too short for the object text.
>>>>>>>
>>>>>>> It actually swings it the other way, with the same font being
>>>>>>> bigger  on
>>>>>>> Windows than on OSX.
>>>>>>>
>>>>>>>
>>>>>>> .hc
>>>>>>>
>>>>>>> On Nov 26, 2005, at 3:37 PM, carmen wrote:
>>>>>>>
>>>>>>>>> I don't see how the point size will be somehow different in
>>>>>>>>> aspect
>>>>>>>>> ratio
>>>>>>>>>  from the pixel size?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> why point/pixel sizes at all? for years the way to specify a  
>>>>>>>> font
>>>>>>>> size  for web is in "em" units. 1.0em 0.8em etc..
>>>>>>>>
>>>>>>>>> If courier 12 is say 10pixels wide then it should be identical  
>>>>>>>>> to
>>>>>>>>> courier -10 visually, since the aspect *should* be the same.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> even a 12 point font can be different on the same platform
>>>>>>>> depending
>>>>>>>> on which DPI you launched your X server at, which toolkit you  
>>>>>>>> are
>>>>>>>> using, etc..
>>>>>>>>
>>>>>>>>> Or am I misunderstanding what you mean by the "at least three
>>>>>>>>> dimensions
>>>>>>>>> to a font size"?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> id say theres at least 4... platform, dpi, font, fontsize
>>>>>>>>
>>>>>>>>> The font issue is really a stumbling block for trying to make
>>>>>>>>> anything
>>>>>>>>> look constant accross platforms. The current PD documentation  
>>>>>>>>> is
>>>>>>>>> a
>>>>>>>>> great
>>>>>>>>> example of this, where, depending on the platform, many
>>>>>>>>> help-patches
>>>>>>>>> open with overlapping messages/comments. :(
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> how about a scalable canvas with a client-side algo to make sure
>>>>>>>> nothing overlaps? something like
>>>>>>>> http://whats-your.name/pd/chokun.png
>>>>>>>> but with less ugly colours?
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> PD-list at iem.at mailing list
>>>>>>>> UNSUBSCRIBE and account-management ->
>>>>>>>> http://lists.puredata.info/listinfo/pd-list
>>>>>>>>
>>>>>>>
>>>>>>> _________________________________________________________________ 
>>>>>>> __
>>>>>>> ___
>>>>>>> __
>>>>>>> ____
>>>>>>>
>>>>>>>                     There is no way to peace, peace is the way.
>>>>>>>                                                 -A.J. Muste
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> PD-list at iem.at mailing list
>>>>>>> UNSUBSCRIBE and account-management ->
>>>>>>> http://lists.puredata.info/listinfo/pd-list
>>>>>>>
>>>>>>>
>>>>
>>>> ____________________________________________________________________ 
>>>> __
>>>> __
>>>> ____
>>>>
>>>>                             http://at.or.at/hans/
>>>>
>>>>
>>>>
>>
>> ______________________________________________________________________ 
>> __
>> ____
>>
>> "Looking at things from a more basic level, you can come up with a  
>> more
>> direct solution... It may sound small in theory, but it in practice,  
>> it
>> can change entire economies."
>>
>>                                         - Amy Smith
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.2.2 (Darwin)
>>
>> iD8DBQFDi2qKN4PEFRUrWIsRApQDAKD39SFP7EUdZfOP28/hQZA1ZtH8LwCdGSnl
>> HntjkiR8va7FPBeukrQTUxk=
>> =+XBX
>> -----END PGP SIGNATURE-----
>>
>>
>> _______________________________________________
>> PD-list at iem.at mailing list
>> UNSUBSCRIBE and account-management ->  
>> http://lists.puredata.info/listinfo/pd-list
>
>
> _______________________________________________
> PD-list at iem.at mailing list
> UNSUBSCRIBE and account-management ->  
> http://lists.puredata.info/listinfo/pd-list
>

________________________________________________________________________ 
____

"Looking at things from a more basic level, you can come up with a more  
direct solution... It may sound small in theory, but it in practice, it  
can change entire economies."
                                                                          
                                        - Amy Smith





More information about the Pd-list mailing list