[Drawkit] "not flipped" drawing issues
Allan Daly
allandaly at me.com
Tue Jun 2 22:28:11 PDT 2009
Graham,
I figured out a temporary fix to the not-flipped text issue. I hope
this helps you identify the problem in the code and design/implement a
real fix at some point.
In DKTextAdornment.m in method -(NSPoint) textOriginForSize:(NSSize)
textSize objectSize:(NSSize) osize
in the section where you adjust the textOrigin based on the size of
the textRect here's your code:
// factor in textRect offset
textOrigin.x += ( tr.origin.x * osize.width);
textOrigin.y += ( tr.origin.y * osize.height);
If I add in another adjustment to the textOrigin.y value as below,
then I can get the text objects to display correctly in a not-flipped
drawing.
// factor in textRect offset
textOrigin.x += ( tr.origin.x * osize.width);
textOrigin.y += ( tr.origin.y * osize.height) - textSize.height/2; //
[AD] changed to get not-flipped text to display correctly
This will certainly mess things up in a flipped drawing, but in my
case I'm not working with flipped drawings so this fix solves my
problem temporarily.
I hope this helps pinpoint at least some of the not-flipped text
issues. Nothing I'm doing here would address your point about the
NSLayoutManger, however.
-Allan
On Jun 1, 2009, at 10:32 PM, Graham Cox wrote:
> One big problem with text is that NSLayoutManager assumes a flipped
> context. This may add some headaches when drawing text and so far I
> must admit I haven't put any effort into addressing this. However,
> recent work has led me a much greater understanding of this class
> than before, so I have a chance to create a subclass that can be
> used for tackling this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.apptree.net/pipermail/drawkit-apptree.net/attachments/20090602/7726ebf5/attachment.htm>
More information about the Drawkit
mailing list