• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Drawing Glyphs one by one
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Drawing Glyphs one by one


  • Subject: Drawing Glyphs one by one
  • From: Bruno Blondeau <email@hidden>
  • Date: Thu, 18 Oct 2001 21:34:22 +0200

I am trying to draw glyphs one by one, somewhat like what the CircleView
sample project is doing, but with a different transform.

So I tried to reuse some of its code, but it doesn't seem to work well when
I have text with something else than the default font size, the characters
spacing remaining the same whatever the size is.

I was wondering what was going wrong in my code, and eventually tried to
remove the transform from the CircleView sample by doing something like
this:

for (glyphIndex = glyphRange.location; glyphIndex < NSMaxRange(glyphRange);
glyphIndex++)
{
NSRect lineFragmentRect = [layoutmanager
lineFragmentRectForGlyphAtIndex:glyphIndex effectiveRange:NULL];
NSPoint layoutLocation = [layoutmanager
locationForGlyphAtIndex:glyphIndex];

// Here layoutLocation is the location (in container coordinates) where
the glyph was laid out.
layoutLocation.x += lineFragmentRect.origin.x;
layoutLocation.y += lineFragmentRect.origin.y;

[layoutmanager drawGlyphsForGlyphRange:NSMakeRange(glyphIndex, 1)
atPoint:NSMakePoint(layoutLocation.x, layoutLocation.y)];
}

and then I noticed that character spacing was very strange (way too large).

Is this normal? How can I modify this to obtain normal a correct layout?


Bruno


  • Prev by Date: Re: Help with pasteboard
  • Next by Date: Re: Finding which control is selected
  • Previous by thread: Re: launchApplication (NSWorkSpace) : the icon is always displayed
  • Next by thread: [ANN] Cocoa SIG meeting in Houston.
  • Index(es):
    • Date
    • Thread