Deprecated CGContext Functions

A function identified as deprecated has been superseded and may become unsupported in the future.

Deprecated in OS X v10.9

CGContextSelectFont

Sets the font and font size in a graphics context. (Deprecated in OS X v10.9. Use Core Text instead.)

void CGContextSelectFont (
   CGContextRef c,
   const char *name,
   CGFloat size,
   CGTextEncoding textEncoding
);
Parameters
c

The graphics context for which to set the font and font size.

name

A null-terminated string that contains the PostScript name of the font to set.

size

A value that specifies the font size to set, in text space units.

textEncoding

A CGTextEncoding value that specifies the encoding used for the font. For a description of the available values, see “CGTextEncoding”.

Availability
  • Available in OS X v10.0 and later.
  • Deprecated in OS X v10.9.
Declared In
CGContext.h

CGContextShowGlyphs

Displays an array of glyphs at the current text position. (Deprecated in OS X v10.9. Use Core Text instead.)

void CGContextShowGlyphs (
   CGContextRef c,
   const CGGlyph g[],
   size_t count
);
Parameters
c

The graphics context in which to display the glyphs.

glyphs

An array of glyphs to display.

count

The total number of glyphs passed in the g parameter.

Discussion

This function displays an array of glyphs at the current text position, a point specified by the current text matrix.

Availability
  • Available in OS X v10.0 and later.
  • Deprecated in OS X v10.9.
Declared In
CGContext.h

CGContextShowGlyphsAtPoint

Displays an array of glyphs at a position you specify. (Deprecated in OS X v10.9. Use Core Text instead.)

void CGContextShowGlyphsAtPoint (
   CGContextRef c,
   CGFloat x,
   CGFloat y,
   const CGGlyph glyphs[],
   size_t count
);
Parameters
c

The graphics context in which to display the glyphs.

x

A value for the x-coordinate of the user space at which to display the glyphs.

y

A value for the y-coordinate of the user space at which to display the glyphs.

glyphs

An array of glyphs to display.

count

The total number of glyphs passed in the glyphs parameter.

Discussion

This function displays an array of glyphs at the specified position in the user space.

Availability
  • Available in OS X v10.0 and later.
  • Deprecated in OS X v10.9.
Declared In
CGContext.h

CGContextShowGlyphsWithAdvances

Draws an array of glyphs with varying offsets. (Deprecated in OS X v10.9. Use Core Text instead.)

void CGContextShowGlyphsWithAdvances (
   CGContextRef c,
   const CGGlyph glyphs[],
   const CGSize advances[],
   size_t count
);
Parameters
c

The graphics context in which to display the glyphs.

glyphs

An array of Quartz glyphs.

advances

An array of offset values associated with each glyph in the array. Each value specifies the offset from the previous glyph's origin to the origin of the corresponding glyph. Offsets are specified in user space.

count

The number of glyphs in the specified array.

Discussion

This function draws an array of glyphs at the current point specified by the text matrix.

Availability
  • Available in OS X v10.3 and later.
  • Deprecated in OS X v10.9.
Declared In
CGContext.h

CGContextShowText

Displays a character array at the current text position, a point specified by the current text matrix. (Deprecated in OS X v10.9. Use Core Text instead.)

void CGContextShowText (
   CGContextRef c,
   const char *string,
   size_t length
);
Parameters
c

A graphics context.

string

An array of characters to draw.

length

The length of the array specified in the bytes parameter.

Discussion

Quartz uses font data provided by the system to map each byte of the array through the encoding vector of the current font to obtain the glyph to display. Note that the font must have been set using CGContextSelectFont. Don’t use CGContextShowText in conjunction with CGContextSetFont.

Availability
  • Available in OS X v10.0 and later.
  • Deprecated in OS X v10.9.
Declared In
CGContext.h

CGContextShowTextAtPoint

Displays a character string at a position you specify. (Deprecated in OS X v10.9. Use Core Text instead.)

void CGContextShowTextAtPoint (
   CGContextRef c,
   CGFloat x,
   CGFloat y,
   const char *string,
   size_t length
);
Parameters
c

A graphics context .

x

A value for the x-coordinate (in user space) at which to display the text.

y

A value for the y-coordinate (in user space) at which to display the text.

string

An array of characters to draw.

length

The length of the array specified in the string parameter.

Discussion

Quartz uses font data provided by the system to map each byte of the array through the encoding vector of the current font to obtain the glyph to display. Note that the font must have been set using CGContextSelectFont. Don’t use CGContextShowTextAtPoint in conjunction with CGContextSetFont.

Availability
  • Available in OS X v10.0 and later.
  • Deprecated in OS X v10.9.
Declared In
CGContext.h