<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>You've already noticed the essential problem, which is that there is no standardized width, height, or alignment for the square-root glyph. (Off the top of my head, I can't think of any Unicode glyph that is standardized in this way.)</div><div><br></div><div>As Nadeem suggested, you can 1) draw it yourself using primitives.</div><div><br></div><div>2) You could also include a math-symbol font in your program and use it for all the symbol work. Then you know in advance what the shapes will look like and can rely on those measurements.</div><div><br></div><div>But I think (1) ends up being more practical, because you soon run into situations where your font won't help you — e.g., you want to show the square root of an expression with a numerator & denominator. At that point, the square-root symbol wants to be two lines high, and merely scaling the square-root glyph in the font won't look right.</div><div><br></div><div>There are also LaTeX-to-SVG renderers out there, if you want to circumvent the problem at a higher level.</div><div><br></div><div><br></div><div><br></div><div><br></div><br><div><div>On Nov 15, 2013, at 2:21 PM, Nadeem Abdul Hamid <<a href="mailto:nadeem@acm.org">nadeem@acm.org</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Not an answer to your question, but maybe you should try just generating the entire symbol programmatically using pict primitives instead of trying to get half of it from a font character?<div>--- nadeem<br><br>On Friday, November 15, 2013, Jens Axel Søgaard wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi All,<br>
<br>
I want to render simple mathematical formulas using picts.<br>
Consider a simple example, the square root of x:<br>
<br>
√x<br>
<br>
To make this look nice, I want to introduce an overline that draws a bar over x.<br>
The bar should begin where the root sign ends. To do this I need to know<br>
how high the root sign is. Calculating this has turned out to more complicated<br>
than I expected. If I use a font size of say 30, then the root sign will (in<br>
some fonts) be higher than 30. If I use (text "√" font) to get a pict then<br>
the pict height will be 30 (for most fonts), but the end of the root sign<br>
will stick out of the bounding box. It actually makes sense it stick out,<br>
since this makes it easy to make roots over tall characters such as h.<br><br>
</blockquote></div><br><br>-- <br><div><br></div>--<div>Nadeem Abdul Hamid<br>Associate Professor, Computer Science<br>Berry College, Mount Berry, GA 30149<br><a href="http://cs.berry.edu/~nhamid/" target="_blank">http://cs.berry.edu/~nhamid/</a></div>
<br>
____________________<br> Racket Users list:<br> <a href="http://lists.racket-lang.org/users">http://lists.racket-lang.org/users</a><br></blockquote></div><br></body></html>