val->extents.x_bearing = DOUBLE_FROM_26_6 (metrics->horiBearingX) / sf.x_scale; val->extents.y_bearing = -DOUBLE_FROM_26_6 (metrics->horiBearingY) / sf.y_scale;
val->extents.x_bearing = DOUBLE_FROM_26_6 (metrics->horiBearingX) / unscaled->x_scale; val->extents.y_bearing = -DOUBLE_FROM_26_6 (metrics->horiBearingY) / unscaled->y_scale;
_cairo_ft_font_create_glyph(cairo_image_glyph_cache_entry_t 	*val)    {    cairo_ft_font_t *font = (cairo_ft_font_t *)val->key.unscaled;    FT_GlyphSlot glyphslot;    unsigned int width, height, stride;    FT_Outline *outline;    FT_BBox cbox;    FT_Bitmap bitmap;    FT_Glyph_Metrics *metrics;    ft_font_transform_t sf;    glyphslot = font->val->face->glyph;    metrics = &glyphslot->metrics;    _cairo_ft_font_compute_transform (&sf, &val->key.scale);    _cairo_ft_font_install_transform (&sf, font->val->face);    if (FT_Load_Glyph (font->val->face, val->key.index, FT_LOAD_DEFAULT) != 0)	return CAIRO_STATUS_NO_MEMORY;    /*     * Note: the font's coordinate system is upside down from ours, so the     * Y coordinates of the bearing and advance need to be negated.     *     * Scale metrics back to glyph space from the scaled glyph space returned     * by FreeType     */    val->extents.x_bearing = DOUBLE_FROM_26_6 (metrics->horiBearingX) / sf.x_scale;    val->extents.y_bearing = -DOUBLE_FROM_26_6 (metrics->horiBearingY) / sf.y_scale;    val->extents.width  = DOUBLE_FROM_26_6 (metrics->width) / sf.x_scale;    val->extents.height = DOUBLE_FROM_26_6 (metrics->height) / sf.y_scale;    /*     * use untransformed advance values     * XXX uses horizontal advance only at present;     should provide FT_LOAD_VERTICAL_LAYOUT     */    val->extents.x_advance = DOUBLE_FROM_26_6 (font->val->face->glyph->metrics.horiAdvance) / sf.x_scale;    val->extents.y_advance = 0 / sf.y_scale;        outline = &glyphslot->outline;    FT_Outline_Get_CBox (outline, &cbox);    cbox.xMin &= -64;    cbox.yMin &= -64;    cbox.xMax = (cbox.xMax + 63) & -64;    cbox.yMax = (cbox.yMax + 63) & -64;        width = (unsigned int) ((cbox.xMax - cbox.xMin) >> 6);    height = (unsigned int) ((cbox.yMax - cbox.yMin) >> 6);    stride = (width + 3) & -4;        if (width * height == 0) 	val->image = NULL;    else	    {	bitmap.pixel_mode = ft_pixel_mode_grays;	bitmap.num_grays  = 256;	bitmap.width = width;	bitmap.rows = height;	bitmap.pitch = stride;   	bitmap.buffer = calloc (1, stride * height);		if (bitmap.buffer == NULL) {	    return CAIRO_STATUS_NO_MEMORY;	};		FT_Outline_Translate (outline, -cbox.xMin, -cbox.yMin);		if (FT_Outline_Get_Bitmap (glyphslot->library, outline, &bitmap) != 0) {	    free (bitmap.buffer);	    return CAIRO_STATUS_NO_MEMORY;	}		val->image = (cairo_image_surface_t *)	cairo_image_surface_create_for_data ((char *) bitmap.buffer,					     CAIRO_FORMAT_A8,					     width, height, stride);	if (val->image == NULL) {	    free (bitmap.buffer);	    return CAIRO_STATUS_NO_MEMORY;	}		_cairo_image_surface_assume_ownership_of_data (val->image);    }    /*     * Note: the font's coordinate system is upside down from ours, so the     * Y coordinate of the control box needs to be negated.     */    val->size.width = (unsigned short) width;    val->size.height = (unsigned short) height;    val->size.x =   (short) (cbox.xMin >> 6);    val->size.y = - (short) (cbox.yMax >> 6);        return CAIRO_STATUS_SUCCESS;}