freenode/#clim - IRC Chatlog
Search
19:37:47
jackdaniel
we have defined climi::text-bounding-rectangle* over and over again. it is used in recording. question: why do we need it over clim:text-size?
19:43:05
jackdaniel
there is: "If a programmer needs to account for kerning or the ascent or descent of the text style, he should measure the size of the bounding rectangle of the text rendered on medium." and that text-size should use medium line height, but this is bogus for two reasons: line-height is defined only for streams in the spec (which takes text-style) and we should determine line-height based on the text style
22:52:43
slyrus1
jackdaniel: ok, I've begun using the code in basic/regions.lisp. thanks for pointing me at it!
2:44:01
loke
jackdaniel: I have noted there are two differences between bounding-rectangle and text-size. Both are useful.
2:44:39
loke
And as Climaxima is probably one of the most text-measurement-heavy applications, m taking advantage of both to a very high extent.
4:15:55
loke
jackdaniel: The height (top and bottom of the bounding box) are different. The text-size function returns the actual pixel boundaries, while the bounding rectangle uses the font height and descender.
4:17:29
loke
Note that the truetype renderer's backend implementation of text-size doesn't actually return the correct values. It returns 7 values, four of which are the ascent and descent of the font, followed by the asecent and descent of the actual text. The trueype renderer returns the dame values for these, while the freetype renderer returns the correct values.
4:19:04
loke
So in Climaxima, I'm using text-size when I need to perfectly align text based on the content (i.e. when choosing where do draw the exponent, or where to put the limits in a SIGMA operation)
4:19:42
loke
The bounding box is used for regular alignment where the actual string doesn't matter, since it uses the font dimensions rather than the text dimension.
4:39:51
jackdaniel
you mean that bounding-box shouldn't take into account each glyph but rather return some approximate value taken from font-ascent/descent and average character-width? or what?
4:42:21
loke
What I'm saying is that the current implementation uses the font ascent/descent when computing the height of the bounding-box.
4:43:44
loke
Persoanlly, I don't agree with that, but that's not really relevant. We discussed that back when I implemented the freetype renderer, and it was pointed out (by you or beach, I think?) that the bounding box height should not be affected by the actual characters that are displayed in it, as that would affect the height of a clickable presentation.
4:44:57
loke
And I have no problems using TEXT-SIZE to determine the actual dimensions of the text. Using TEXT-SIZE givens me the pixel-perfect dimensions, which is absolutely required by Climaxima.
4:47:52
loke
It's clear that both pieces of information (font ascent/descent and actual text ascent/descent) is needed at different times. Both of these pieces of information is returned by FONT-TEXT-EXTENTS, but, as I mentioned earlier, the truetype renderer doesn't actually compute the text ascent/descent, but simply returns the font values for both.
4:50:27
loke
You can see the difference in the return alues of FONT-TEXT-EXTENDS for the freetype vs. the truetype renderers.
4:51:30
loke
The text ascent/descent is returned in the second and third return values, while the font extents are returned as the sixth and seventh values.