• 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
Re: NSGlyph
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSGlyph


  • Subject: Re: NSGlyph
  • From: Douglas Davidson <email@hidden>
  • Date: Sat, 4 Oct 2008 12:26:28 -0700


On Oct 4, 2008, at 11:59 AM, email@hidden wrote:

I can't figure out how NSGlyph works in methods like this:

[path appendBezierPathWithGlyph:'x' inFont:[NSFont userFontOfSize: 14.0]]

(Of course 'path' is an NSBezierPath.)

What I get on the screen is not an '+', but an upper-case "H" in some outline font. And when I put in explicit Unicodes, I don't get the expected symbol either.

NSGlyph is declared as an unsigned int. But how is it connected to displayed characters?

You should take a look at some of the text system conceptual documentation, such as http://developer.apple.com/documentation/Cocoa/Conceptual/TextLayout/TextLayout.html .


Glyph are not characters, and in general they do not have a simple relationship to characters. A glyph is an individual displayable element in a particular font, and its numerical value is an index into the font's glyph repertoire; this numerical value does not in general have meaning outside of the context of that particular font.

The Cocoa text system converts characters into glyphs as needed for text display; in general, NSLayoutManager manages this process, with the help of two auxiliary classes, NSGlyphGenerator and NSTypesetter. The first of these performs a first-pass conversion of characters to glyphs, while the second makes any contextual adjustments that are necessary as the text is laid out. The final mapping between glyphs and characters need not be one-to-one; for example, even with Latin- script text, in many fonts the two characters "fi" will be represented by a single "fi" ligature glyph. Other scripts, or specialized fonts, can produce much more complicated character-glyph mappings.

Try taking a look at the "SpeedometerView" example on developer.apple.com. It includes among other things a mechanism for producing bezier paths from arbitrary text, in the SpeedyCategories.m file.

Douglas Davidson

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NSGlyph (From: email@hidden)

  • Prev by Date: Re: NSGlyph
  • Next by Date: Re: file fixtures for unit testing
  • Previous by thread: Re: NSGlyph
  • Next by thread: Re: NSGlyph
  • Index(es):
    • Date
    • Thread