err = ATSUSetAttributes(	style, sizeof(styleTags) / sizeof(styleTags[0]), styleTags, styleSizes, styleValues);    font = malloc(sizeof(cairo_atsui_font_t));  if (_cairo_unscaled_font_init(&font->base, &cairo_atsui_font_backend) == CAIRO_STATUS_SUCCESS) { font->style		= style; font->fontID	= fontID;   return &font->base; }   free(font);  return NULL;
err = ATSUCreateStyle(&style);   switch (weight) { case CAIRO_FONT_WEIGHT_BOLD: isBold = true; break; case CAIRO_FONT_WEIGHT_NORMAL: default: isBold = false; break; }  switch (slant) { case CAIRO_FONT_SLANT_ITALIC: isItalic = true; break; case CAIRO_FONT_SLANT_OBLIQUE: isItalic = false; break; case CAIRO_FONT_SLANT_NORMAL: default: isItalic = false; break; }  err = ATSUFindFontFromName(family, strlen(family), kFontFamilyName, kFontNoPlatformCode, kFontRomanScript, kFontNoLanguageCode, &fontID);  if (err != noErr) {   if (!strcmp(family, "serif")) family = "Times"; else if (!strcmp(family, "sans-serif")) family = "Helvetica"; else if (!strcmp(family, "cursive")) family = "Apple Chancery"; else if (!strcmp(family, "fantasy")) family = "Gadget"; else if (!strcmp(family, "monospace")) family = "Courier"; else family = "Courier";  err = ATSUFindFontFromName(family, strlen(family), kFontFamilyName, kFontNoPlatformCode, kFontRomanScript, kFontNoLanguageCode, &fontID); }   ATSUAttributeTag styleTags[] = { kATSUQDItalicTag, kATSUQDBoldfaceTag, kATSUFontTag }; ATSUAttributeValuePtr styleValues[] = { &isItalic, &isBold, &fontID }; ByteCount styleSizes[] = { sizeof(Boolean), sizeof(Boolean), sizeof(ATSUFontID) };   err = ATSUSetAttributes(style, sizeof(styleTags) / sizeof(styleTags[0]), styleTags, styleSizes, styleValues);  font = malloc(sizeof(cairo_atsui_font_t));  _cairo_font_init(&font->base, scale, &cairo_atsui_font_backend);  font->style = CreateSizedCopyOfStyle(style, scale);   Fixed theSize = FloatToFixed(1.0); const ATSUAttributeTag theFontStyleTags[] = { kATSUSizeTag }; const ByteCount theFontStyleSizes[] = { sizeof(Fixed) }; ATSUAttributeValuePtr theFontStyleValues[] = { &theSize }; err = ATSUSetAttributes(style, sizeof(theFontStyleTags) / sizeof(ATSUAttributeTag), theFontStyleTags, theFontStyleSizes, theFontStyleValues);  font->unscaled_style = style;  font->fontID = fontID; font->scale = *scale;  *font_out = (cairo_font_t *)font;  return CAIRO_STATUS_SUCCESS;
_cairo_atsui_font_create(	const char   	*family, 							cairo_font_slant_t   slant, 							cairo_font_weight_t  weight){	cairo_atsui_font_t  *font = NULL;	ATSUStyle			style;	ATSUFontID			fontID;	OSStatus			err;	Boolean				isItalic, isBold;			err = ATSUCreateStyle(&style);			switch (weight)	{		case CAIRO_FONT_WEIGHT_BOLD:			isBold = true;			break;		case CAIRO_FONT_WEIGHT_NORMAL:		default:			isBold = false;			break;	}	switch (slant)	{		case CAIRO_FONT_SLANT_ITALIC:			isItalic = true;			break;		case CAIRO_FONT_SLANT_OBLIQUE:			isItalic = false;			break;		case CAIRO_FONT_SLANT_NORMAL:		default:			isItalic = false;			break;	}		err = ATSUFindFontFromName( family, strlen(family),								kFontFamilyName,								kFontNoPlatformCode,								kFontRomanScript,								kFontNoLanguageCode,								&fontID);			ATSUAttributeTag		styleTags[] = {kATSUQDItalicTag, kATSUQDBoldfaceTag, kATSUFontTag};	ATSUAttributeValuePtr   styleValues[] = {&isItalic, &isBold, &fontID};	ByteCount				styleSizes[] = {sizeof(Boolean), sizeof(Boolean), sizeof(ATSUFontID)};	err = ATSUSetAttributes(	style,								sizeof(styleTags) / sizeof(styleTags[0]),								styleTags,								styleSizes,								styleValues);				font = malloc(sizeof(cairo_atsui_font_t));		if (_cairo_unscaled_font_init(&font->base, &cairo_atsui_font_backend) == CAIRO_STATUS_SUCCESS)	{		font->style		= style;		font->fontID	= fontID;						return &font->base;	}			free(font);		return NULL;}