[PD] pd font finetuning with tk scaling ?

Hans-Christoph Steiner hans at eds.org
Mon Nov 28 21:37:26 CET 2005


-----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-----





More information about the Pd-list mailing list