Re: problems with glyph y-axis flipping in an NSBezierPath
Re: problems with glyph y-axis flipping in an NSBezierPath
- Subject: Re: problems with glyph y-axis flipping in an NSBezierPath
- From: "John C. Randolph" <email@hidden>
- Date: Wed, 8 Aug 2001 17:16:51 -0700
On Wednesday, August 8, 2001, at 04:07 PM, Brad Werth wrote:
I am trying to create an NSBezierPath containing some line art and some
text that can be drawn as needed when my subclass of NSCell is resized.
My NSCell subclass has two NSBezierPath instance variables -- one which
is filled and one which is stroked. The text glyphs are being added to
the NSBezierPath that gets filled. When drawing, the lines, rects,
ovals etc. are consitently correct, but the text is not: sometimes the
y-axis of the font is flipped such that a glpyh draws upside-down, but
at the same baseline. As if a mirror was placed under the letter.
Responding to my own thread here for the sake of the someday-searchable
archives... Had an epiphany at 12:30am last night, in the shower, no
less. The call to NSBezierPath appendBezierPathWithGlyphs:count:inFont:
is obviously checking SOMETHING to determine whether or not the y-axis
is flipped, but what? There is no supplied NSView in the parameters, so
I guessed that it was using the currently focused NSView, and it was.
At the appropriate point in my code I put in a [whateverView lockFocus]
and everything looks great.
So now my question is this: is this a bug? I understand the need to
lockFocus during drawing, but I didn't expect the same need to occur
when populating an NSBezierPath -- I understand why now but it seems
really inconsistent and totally undocumented. Is it the presumption
that NSBezierPaths will only be modified during drawing?
I would guess glyphs are special-cased, to deal with the fact that text
views are usually flipped.
-jcr
"Scientology is evil; its techniques are evil; its practice is a serious
threat to the community, medically, morally, and socially; and its
adherents are sadly deluded and often mentally ill... --Justice
Anderson, Supreme Court of Victoria, Australia