<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yiv7429822054"><div id="yui_3_16_0_1_1444356890200_4360"><div id="yui_3_16_0_1_1444356890200_4359" style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"><div id="yiv7429822054"><div id="yiv7429822054yui_3_16_0_1_1444350676239_4482"><div id="yiv7429822054yui_3_16_0_1_1444350676239_4481" style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"><div id="yiv7429822054yui_3_16_0_1_1444347995292_6309">Hi katja,</div><div id="yiv7429822054yui_3_16_0_1_1444347995292_6391">What you say is completely reasonable.  And according to Pd's source code, it also happens to be wrong.<br clear="none"></div><div id="yiv7429822054yui_3_16_0_1_1444347995292_6343"><br clear="none"></div><div id="yiv7429822054yui_3_16_0_1_1444347995292_6342">Here's the definition of a size "10" font, from sys_fontlist of s_main.c:</div><div id="yiv7429822054yui_3_16_0_1_1444347995292_6341">fi_fontsize = 10 (we don't know what the units are but I'm guessing it's supposed to be points)<br clear="none">fi_maxwidth = 7 (pixels)<br clear="none"><div id="yiv7429822054yui_3_16_0_1_1444350676239_4505">fi_maxheight = 13 (pixels)</div><div id="yiv7429822054yui_3_16_0_1_1444350676239_4506"><br clear="none"></div><div id="yiv7429822054yui_3_16_0_1_1444350676239_4528">So according to Pd, a size "10" font is the largest font size <br clear="none"></div><div id="yiv7429822054yui_3_16_0_1_1444350676239_5016">listed that has a width no greater than 7 pixels and a height <br clear="none"></div><div dir="ltr" id="yiv7429822054yui_3_16_0_1_1444350676239_5505">no greater than 13.  (Unless _no_ font will fit in that spec in <br clear="none"></div><div dir="ltr" id="yiv7429822054yui_3_16_0_1_1444350676239_4850"><div id="yui_3_16_0_1_1444356890200_4411">which case the smallest font size is used.)  Pd doesn't care if the font is "Crazy Cursive Condensed" at size <br></div><div id="yui_3_16_0_1_1444356890200_4413">"33.3333pts".  As long as that font fits the closest to the max height/width, it can be used for size "10".</div></div><div dir="ltr" id="yiv7429822054yui_3_16_0_1_1444350676239_6154"><br clear="none"></div><div dir="ltr" id="yiv7429822054yui_3_16_0_1_1444350676239_5111">Regardless of how the font metrics proc is picking that <br clear="none"></div><div dir="ltr" id="yiv7429822054yui_3_16_0_1_1444350676239_5147">11px font, it still fits the metrics Pd gives for a size "10" font.</div><div id="yui_3_16_0_1_1444356890200_4451" dir="ltr">Even if we "fixed" this bug, any other user on any other OS <br clear="none"></div><div id="yui_3_16_0_1_1444356890200_4452" dir="ltr">can have a size "10" font with characters that measure 7x13 <br clear="none"></div><div id="yui_3_16_0_1_1444356890200_4453" dir="ltr">pixels.  And because it's ultimately up to the font engine <br clear="none"></div><div dir="ltr" id="yiv7429822054yui_3_16_0_1_1444350676239_5545">exactly how the characters get rendered, such a user could <br clear="none"></div><div dir="ltr" id="yiv7429822054yui_3_16_0_1_1444350676239_5546">even be using "DejaVu Sans Mono" and hit this <br clear="none"></div><div dir="ltr" id="yiv7429822054yui_3_16_0_1_1444350676239_5547">discrepancy.  They wouldn't know they hit it until they <br clear="none"></div><div dir="ltr" id="yiv7429822054yui_3_16_0_1_1444350676239_5553">compared their screenshot to yours.</div><div dir="ltr" id="yiv7429822054yui_3_16_0_1_1444350676239_5624"><br clear="none"></div><div dir="ltr" id="yiv7429822054yui_3_16_0_1_1444350676239_6297">The only solution is to always render the box for the max <br clear="none"></div><div dir="ltr" id="yiv7429822054yui_3_16_0_1_1444350676239_6298">width/height characters.  That would almost be guaranteed <br clear="none"></div><div dir="ltr" id="yiv7429822054yui_3_16_0_1_1444350676239_5728">to look ugly on everyone's system, but at least you'd be <br clear="none"></div><div dir="ltr" id="yiv7429822054yui_3_16_0_1_1444350676239_5664">guaranteed never to accidentally create a patch where <br clear="none"></div><div dir="ltr" id="yiv7429822054yui_3_16_0_1_1444350676239_5674">boxes overlap on someone else's machine.</div><div dir="ltr" id="yiv7429822054yui_3_16_0_1_1444350676239_6203"><br clear="none"></div><div id="yui_3_16_0_1_1444356890200_4567">I'll admit that in the GUI port I haven't addressed this <br></div><div id="yui_3_16_0_1_1444356890200_4569" dir="ltr">problem.</div><div id="yui_3_16_0_1_1444356890200_4571" dir="ltr"><br></div><div id="yui_3_16_0_1_1444356890200_4573" dir="ltr">-Jonathan<br> </div></div><br clear="none"><br><div class="qtdSeparateBR"><br><br></div><div class="yiv7429822054yqt9399104635" id="yiv7429822054yqt22953"></div></div></div></div><div class="yiv7429822054yqt4823908062" id="yiv7429822054yqt18050"><div id="yui_3_16_0_1_1444356890200_4579"> <div id="yui_3_16_0_1_1444356890200_4578" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div id="yui_3_16_0_1_1444356890200_4577" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div id="yui_3_16_0_1_1444356890200_4576" dir="ltr"> <font id="yui_3_16_0_1_1444356890200_4575" face="Arial" size="2"> On Thursday, October 8, 2015 8:20 PM, katja <katjavetter@gmail.com> wrote:<br clear="none"> </font> </div>  <br clear="none"><br clear="none"> <div class="yiv7429822054y_msg_container">On Thu, Oct 8, 2015 at 3:41 PM, Jonathan Wilkes <<a rel="nofollow" shape="rect" ymailto="mailto:jancsika@yahoo.com" target="_blank" href="mailto:jancsika@yahoo.com">jancsika@yahoo.com</a>> wrote:<br clear="none">> Four things:<br clear="none">> 1) The font dialog shouldn't use numbers.  It should say "tiny", "small",<br clear="none">> "medium", etc. because those numbers just mislead the user.<br clear="none"><br clear="none">Numbers only mislead the user when the wrong font size is displayed,<br clear="none">like on Raspbian (size 11 where 10 is requested, as revealed by your<br clear="none">bugfinder code). Since objects are positioned at fixed coordinates in<br clear="none">a Pd patch, and coordinates are given in pixels, it is required to<br clear="none">define and register everything else in exact pixels too, in order to<br clear="none">display patches undistorted across platforms and independent from DPI<br clear="none">settings.<br clear="none"><br clear="none">Attached are two zoomed screenshots where font pixels can be counted:<br clear="none">10 pix total height on Xubuntu and 11 on Raspbian, exactly the size as<br clear="none">reported by Tk. Why Tk gives size 11 when Pd wants 10 I don't know but<br clear="none">it is a bug and apart from the bug everything is totally accurate.<div class="yiv7429822054yqt8643360722" id="yiv7429822054yqtfd48287"><br clear="none"><br clear="none"><br clear="none">> 2)  Font dialog number "10" in Vanilla may correspond to any font size that<br clear="none">> has<br clear="none">> a width less than or equal to 7 pixels (and height <= 13).  That includes<br clear="none">> DejaVu Sans Mono at pixel size 11 on Raspbian.  Since the text fits in the<br clear="none">> box in your screenshot we can tell Tk is measuring the actual font<br clear="none">> correctly.  (Well, more or<br clear="none">> less-- what happens with a message box that has, say 50 lines?).<br clear="none">><br clear="none">> 3) I can't figure out how pd_font_10 ends up with pixel size "11".<br clear="none">><br clear="none">> 4) There are only two ways I can think of to fix this problem.  One is to<br clear="none">> always<br clear="none">> size boxes according to fi_maxwidth and fi_maxheight.  The other is to forgo<br clear="none">> the automated metrics and brute-force it so that DejaVu Sans Mono fits<br clear="none">> exactly<br clear="none">> into the hardcoded metrics of s_main.c.  I chose the 2nd solution in the GUI<br clear="none">> port, but only because I have decimal pixel sizes to choose from.  Tcl/tk<br clear="none">> doesn't<br clear="none">> let you do that.<br clear="none">><br clear="none">> I'll check again but I think my method looks fine on Raspbian as well as<br clear="none">> Ubuntu.<br clear="none">><br clear="none">> I also played around with Droid Sans Mono Dotted because it has CJK<br clear="none">> characters.  But DejaVu Sans Mono evidently has them, too-- or at least when<br clear="none">> I copy/paste them they show up correctly.  (Perhaps there's some kind of<br clear="none">> fallback mechanism that I'm not seeing.)  Those characters open up a<br clear="none">> wellspring of new problems.  They are referred to as "full width", but take<br clear="none">> up something like 1.5x width of ascii characters.  If you use them in<br clear="none">> any flavor of Pd they overflow the object/message box borders.<br clear="none">><br clear="none">> -Jonathan<br clear="none">><br clear="none">><br clear="none">><br clear="none">> On Thursday, October 8, 2015 2:53 AM, katja <<a rel="nofollow" shape="rect" ymailto="mailto:katjavetter@gmail.com" target="_blank" href="mailto:katjavetter@gmail.com">katjavetter@gmail.com</a>> wrote:<br clear="none">><br clear="none">><br clear="none">> On Thu, Oct 8, 2015 at 12:23 AM, Jonathan Wilkes <<a rel="nofollow" shape="rect" ymailto="mailto:jancsika@yahoo.com" target="_blank" href="mailto:jancsika@yahoo.com">jancsika@yahoo.com</a>> wrote:<br clear="none">>> Ok, try this in place of the command that was giving the error:<br clear="none">>> pdtk_post "rank tk speculation follows: [font actual [get_font_for_size<br clear="none">>> $font_size] -displayof $tkcanvas]\n"<br clear="none">>><br clear="none">><br clear="none">> There you got it, inspector Wilkes! For Xubuntu the output is:<br clear="none">><br clear="none">> rank tk speculation follows: -family {DejaVu Sans Mono} -size -10<br clear="none">> -weight normal -slant roman -underline 0 -overstrike 0<br clear="none">><br clear="none">> For Raspbian:<br clear="none">><br clear="none">> rank tk speculation follows: -family {DejaVu Sans Mono} -size -11<br clear="none">> -weight normal -slant roman -underline 0 -overstrike 0<br clear="none">><br clear="none">> In both cases the font size menu says "10".<br clear="none">><br clear="none">><br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">>> On Wednesday, October 7, 2015 4:33 PM, Jonathan Wilkes via Pd-list<br clear="none">>> <<a rel="nofollow" shape="rect" ymailto="mailto:pd-list@lists.iem.at" target="_blank" href="mailto:pd-list@lists.iem.at">pd-list@lists.iem.at</a>> wrote:<br clear="none">>><br clear="none">>><br clear="none">>> Sorry, I thought that would work.  I'll sit down and wade through all the<br clear="none">>> indirection later to get a working debug printout.<br clear="none">>><br clear="none">>> -Jonathan<br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">>> On Wednesday, October 7, 2015 4:26 PM, katja <<a rel="nofollow" shape="rect" ymailto="mailto:katjavetter@gmail.com" target="_blank" href="mailto:katjavetter@gmail.com">katjavetter@gmail.com</a>><br clear="none">>> wrote:<br clear="none">>><br clear="none">>><br clear="none">>> On Wed, Oct 7, 2015 at 9:40 PM, Jonathan Wilkes <<a rel="nofollow" shape="rect" ymailto="mailto:jancsika@yahoo.com" target="_blank" href="mailto:jancsika@yahoo.com">jancsika@yahoo.com</a>><br clear="none">>> wrote:<br clear="none">>>> For the official record-- I'm holding my tongue, in the hopes that when<br clear="none">>>> others look at the code<br clear="none">>>> in my GUI port they'll practice similar restraint.<br clear="none">>>><br clear="none">>>> Ok, add this:<br clear="none">>>><br clear="none">>>> pdtk_post "for real this time-- the actual font we are sending to tk is:<br clear="none">>>> [set [get_font_for_size $font_size]]\n"<br clear="none">>><br clear="none">>> Pd list is now looking at a line that doesn't work. The error is:<br clear="none">>><br clear="none">>> can't read "::pd_font_10": no such variable<br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">>>> -Jonathan<br clear="none">>>><br clear="none">>>><br clear="none">>>><br clear="none">>>><br clear="none">>>><br clear="none">>>><br clear="none">>>> On Wednesday, October 7, 2015 3:19 PM, katja <<a rel="nofollow" shape="rect" ymailto="mailto:katjavetter@gmail.com" target="_blank" href="mailto:katjavetter@gmail.com">katjavetter@gmail.com</a>><br clear="none">>>> wrote:<br clear="none">>>><br clear="none">>>><br clear="none">>>> On Wed, Oct 7, 2015 at 8:37 PM, Jonathan Wilkes <<a rel="nofollow" shape="rect" ymailto="mailto:jancsika@yahoo.com" target="_blank" href="mailto:jancsika@yahoo.com">jancsika@yahoo.com</a>><br clear="none">>>> wrote:<br clear="none">>>>> Silly me, I forgot this is Pd so it has to be way more complex than<br clear="none">>>>> that...<br clear="none">>>>><br clear="none">>>>> Add this line to pdtk_text_new in pdtk_text.tcl:<br clear="none">>>>><br clear="none">>>>> pdtk_post "the actual font we are sending to tk is: [get_font_for_size<br clear="none">>>>> $font_size]\n"<br clear="none">>>>><br clear="none">>>>> Now do the test I mentioned before.<br clear="none">>>><br clear="none">>>> The answer is in both cases:<br clear="none">>>><br clear="none">>>> "the actual font we are sending to tk is: ::pd_font_10"<br clear="none">>>><br clear="none">>>><br clear="none">>>><br clear="none">>>>> -Jonathan<br clear="none">>>>><br clear="none">>>>><br clear="none">>>>><br clear="none">>>>> On Wednesday, October 7, 2015 2:16 PM, Jonathan Wilkes via Pd-list<br clear="none">>>>> <<a rel="nofollow" shape="rect" ymailto="mailto:pd-list@lists.iem.at" target="_blank" href="mailto:pd-list@lists.iem.at">pd-list@lists.iem.at</a>> wrote:<br clear="none">>>>><br clear="none">>>>><br clear="none">>>>> Hi katja,<br clear="none">>>>><br clear="none">>>>> Could you do a test?  Make a simple patch with a single object in it,<br clear="none">>>>> and<br clear="none">>>>> use the same canvas font size you did above.  Then run Pd with -d 3 flag<br clear="none">>>>> and<br clear="none">>>>> see what font size is actually being sent from Pd to the GUI on each<br clear="none">>>>> distro.<br clear="none">>>>><br clear="none">>>>> -Jonathan<br clear="none">>>>><br clear="none">>>>><br clear="none">>>>><br clear="none">>>>><br clear="none">>>>><br clear="none">>>>> On Wednesday, October 7, 2015 12:28 PM, katja <<a rel="nofollow" shape="rect" ymailto="mailto:katjavetter@gmail.com" target="_blank" href="mailto:katjavetter@gmail.com">katjavetter@gmail.com</a>><br clear="none">>>>> wrote:<br clear="none">>>>><br clear="none">>>>><br clear="none">>>>> Hello,<br clear="none">>>>><br clear="none">>>>> A particular font size issue can be observed in vanilla Pd and package<br clear="none">>>>> puredata on Raspbian Wheezy and Jessie: font size 10 is larger for<br clear="none">>>>> object boxes, message boxes and comments than for IEM guis (bang,<br clear="none">>>>> toggle, slider, radio button, canvas). Object/message/comment<br clear="none">>>>> characters are too large in number of pixels. When Edit > Font > Font<br clear="none">>>>> Size is set to 8, their size is identical to IEM gui font size 10.<br clear="none">>>>> This inconsistency does not happen for me on Xubuntu. A test patch and<br clear="none">>>>> two screenshots are attached for illustration.<br clear="none">>>>><br clear="none">>>>> For IEM guis, font size 10 translates to 6 pixels per character on<br clear="none">>>>> both systems, given the default font type DejaVu Sans Mono. For object<br clear="none">>>>> boxes, message boxes and comments, font size 10 is 6 pixels on Xubuntu<br clear="none">>>>> and almost 7 pixels on Raspbian.<br clear="none">>>>><br clear="none">>>>> I don't know if this issue is related to font size effects on Windows<br clear="none">>>>> as described by Roman in another thread. In any case, consequences are<br clear="none">>>>> similar: patches created on Xubuntu tend to look messy on Raspbian,<br clear="none">>>>> sometimes with overlapping texts. With XFCE (Xubuntu's default desktop<br clear="none">>>>> environment) installed on Raspbian the issue still persists. Custom<br clear="none">>>>> dpi setting has no effect on Pd. What else might cause the difference<br clear="none">>>>> in behavior on those systems?<br clear="none">>>>><br clear="none">>>>> Katja<br clear="none">>>>><br clear="none">>>>> _______________________________________________<br clear="none">>>>> <a rel="nofollow" shape="rect" ymailto="mailto:Pd-list@lists.iem.at" target="_blank" href="mailto:Pd-list@lists.iem.at">Pd-list@lists.iem.at</a> mailing list<br clear="none">>>>> UNSUBSCRIBE and account-management -><br clear="none">>>>> <a rel="nofollow" shape="rect" target="_blank" href="http://lists.puredata.info/listinfo/pd-list">http://lists.puredata.info/listinfo/pd-list</a><br clear="none">>>>><br clear="none">>>>><br clear="none">>>>><br clear="none">>>>> _______________________________________________<br clear="none">>>>> <a rel="nofollow" shape="rect" ymailto="mailto:Pd-list@lists.iem.at" target="_blank" href="mailto:Pd-list@lists.iem.at">Pd-list@lists.iem.at</a> mailing list<br clear="none">>>>> UNSUBSCRIBE and account-management -><br clear="none">>>>> <a rel="nofollow" shape="rect" target="_blank" href="http://lists.puredata.info/listinfo/pd-list">http://lists.puredata.info/listinfo/pd-list</a><br clear="none">>>>><br clear="none">>>>><br clear="none">>>><br clear="none">>>><br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">>> _______________________________________________<br clear="none">>> <a rel="nofollow" shape="rect" ymailto="mailto:Pd-list@lists.iem.at" target="_blank" href="mailto:Pd-list@lists.iem.at">Pd-list@lists.iem.at</a> mailing list<br clear="none">>> UNSUBSCRIBE and account-management -><br clear="none">>> <a rel="nofollow" shape="rect" target="_blank" href="http://lists.puredata.info/listinfo/pd-list">http://lists.puredata.info/listinfo/pd-list</a><br clear="none">>><br clear="none">>><br clear="none">><br clear="none">><br clear="none"></div><br clear="none"><br clear="none"></div>  </div> </div>  </div></div></div></div></div></div></body></html>