What is the relationship between a font Glyph Ascender and Descender in iOS?

I’m working with fonts in a UILabel (iOS7) and have come across something I’m hoping someone can explain:
What is the relationship between a fonts’ Glyph, Ascender, and Descender?

From the documents I’ve read the Ascender is the portion of a font above the baseline, the Descender is the portion below (returned as negative). The combined absolute values should be the max Height of the font.

  • PayPal API : How to integrate it in my App? IOS5
  • CSS background images resizing incorrectly on iPad and iPhone.
  • aes 128 message decryption — Swift, iOS
  • Potential reference count issues unless grabbing fresh reference in background thread
  • Why scale to fill give bigger image than UIImageVIew size? (using swift)
  • IOS: copy a file in documents folder
  • From Apple's documentation

    For example an Ascender of 255 and a Descender of -64 would give a total height of 319.
    However the Glyph height is returned as 228.4

    EDIT: Here’s the Glyph code:

    CTFontRef ctFont = CTFontCreateWithName((__bridge CFStringRef)(uiFont.fontName), uiFont.pointSize, NULL);
    UniChar ch = [msgLabel.text characterAtIndex:0];
    CGGlyph glyph;
    if (CTFontGetGlyphsForCharacters (ctFont, &ch, &glyph, 1)) {
        CGRect bounds = CTFontGetBoundingRectsForGlyphs (ctFont, kCTFontOrientationDefault, &glyph, nil, 1);
        float glyphHeight = bounds.size.height;

    And here’s the Ascender/Descender code:

    float adHeight = myLabel.font.ascender-myLabel.font.descender; //Descender is always a negative value

    So why does the Glyph height returned from CTFontGetBoundingRectsForGlyphs not equal the Ascender plus Descender?

    Solutions Collect From Internet About “What is the relationship between a font Glyph Ascender and Descender in iOS?”

    Every glyph (letter shape) in the font is a different size and shape, right? The glyph for character ‘A’ is taller than the glyph for character ‘a’, the top of the ‘t’ glyph is different again.

    Font.ascender is the maximum value for all letter shapes (glyphs) and Font.descender is the minimum value.

    Any particular font could easily have an extra tall glyph that meant the Font.ascender value had no relation to the dimensions of a string that didn’t contain that character.