[PD-dev] text placement

Hans-Christoph Steiner hans at eds.org
Wed Jan 10 07:52:58 CET 2007


Thanks much.  I'll take a look.  But now after fiddling with  
different fonts, it seems that its the fonts themselves that have  
different placement.  Bitstream Vera Sans Mono seems to be too high  
up.  Lucida Grande looks much better:

http://bam.idmi.poly.edu/~hans/pdfonts/

Since I am on the topic, I thought I'd post about what I did to get  
the same size boxes on each platform.  It's pretty simple actually, I  
just hardcoded the values, eliminating all the Tcl/Tk and Pd that  
tries to guess the box size based on font measurements.  Basically,  
the Courier font that is provided on each platform is not the same  
font at all.  They are all different heights and widths.  So the way  
around this is to use the exact same font on each platform.  That's  
why I choose Bitstream Vera Sans Mono.  It is available under a BSD- 
ish license and works on all platforms.  I originally thought that a  
mono-spaced font was necessary, but after seeing Lucida Grande, I  
think a proportional font works nicely.

.hc




On Jan 8, 2007, at 2:49 PM, Miller Puckette wrote:

> In g_rtext.c:
>
>         sys_vgui("pdtk_text_new .x%lx.c %s %f %f {%.*s} %d %s\n",
>             canvas, x->x_tag,
>             dispx + LMARGIN, dispy + TMARGIN,
>             outchars, tempbuf, sys_hostfontsize(font),
>             (glist_isselected(x->x_glist,
>                 &x->x_glist->gl_gobj)? "blue" : "black"));
>
> places the text, and the border gets drawn in the text_drawborder()
> function.  I couldn't spot anything platform-dependent in the code,
> although I've noticed that drawing comes out differently on Mac  
> compared
> to other platforms - create a slider, for instance and look at the  
> bar.
> I believe Pd corrects for that when drawing inlets/outlet on objects,
> but I don't think there's anywhere else.
>
> cheers
> Miller
>
> On Mon, Jan 08, 2007 at 01:20:49PM -0500, Hans-Christoph Steiner  
> wrote:
>>
>> Can anyone point me to where the text is placed on the canvas in
>> relation to the object and message boxes?  It seems to vary depending
>> on platform and I'd like to troubleshoot it.
>>
>> .hc
>>
>> --------------------------------------------------------------------- 
>> ---
>>
>> As we enjoy great advantages from inventions of others, we should be
>> glad of an opportunity to serve others by any invention of ours; and
>> this we should do freely and generously.         - Benjamin Franklin
>>
>>
>>
>> _______________________________________________
>> PD-dev mailing list
>> PD-dev at iem.at
>> http://lists.puredata.info/listinfo/pd-dev



------------------------------------------------------------------------

All information should be free.  - the hacker ethic








More information about the Pd-dev mailing list