On Feb 25, 2011, at 03:03 AM, macmap <email@hidden> wrote:
> "Quartz provides a limited, low-level interface for drawing text. For
> information on text-drawing functions, see CGContext Reference. For
> full Unicode and text-layout support, use the services provided by
> Core Text or ATSUI)."
God ! Isn't ATSUI deprecated ???
Deprecated means that the API should not be used for the development of future facing software. However, it is not unheard of for developers (even this late in the game) to support older software packages. Depending on the nature of the software it could be the case that moving to ATSUI is a step along the road to much more modern code. The original poster did not provide enough context in which to evaluate what kind of software he's developing. I covered the bases by mentioning ATSUI but I did qualify it with "possibly".
Adriaan is right, CGContextShowTextAtPoint (and all the CGContext text API's) is supposed to be low level, but in fact, you can get un-understandable (or un-predicable ?) results using it !
The terms "low-level" and "high-level" are used to compare two APIs but don't have much meaning in absolute terms. CGContextShowTextAtPoint is a low level API when compared with the functionality provided by Core Text, Cocoa Text, or ATSUI. When compared with the other routines in Core Graphics, however it is comparatively high level.
Core Graphics is a drawing API, as such it is primarily concerned with Glyphs (the drawings we use to represent the written word), not characters (atomic units of the written word) or text (collections of those atoms). CGContextShowTextAtPoint is the highest-level text drawing API in Core Graphics. It's functionality spans the text rendering pipeline. While exceedingly convenient in exactly the right conditions, it is, unfortunately, painfully limited by being tied to those very specific conditions.
To put it another way, the routine may be helpful for very specific rendering cases under very carefully controlled conditions (most of those, I suspect having to do with legacy code from the QuickDraw era). I suspect that most developers outside of Apple are not likely to encounter those exact conditions. We might consider CGContextShowTextAtPoint a low-level routine, therefore, in the sense that it is "hands off", or not meant for general use.
As the rest of Core Graphics is concerned more with drawing at the glyph level and very little software concerns itself with text rendering of individual glyphs, we may conclude that, as a general rule, Core Graphics is not the proper API most developer should use to draw text.
Look at my post "CGContextShowTextAtPoint problem in PDF context" (9th of December). An other point : why CGContextShowTextAtPoint produce some ligatures ?
If Apple provides low level APIs, they must behave like low-level APIs, not as black boxes.
Because CGContextShowTextAtPoint spans the text rendering pipeline it includes line layout and glyph selection as part of that process. Ligature substitution is part of that process and would account for the appearance of ligatures in the drawn text. If you want more control over the line layout and glyph substitution portion of your text drawing you will need to use a higher-level API that gives you control over those variables.
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden