mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-06 19:00:22 +01:00
quartz-font: Implement new load_truetype_table semantics
fb0304e2a9 changed and specified the
behavior of load_truetype_table.
This commit makes quartz-font implement the new behavior.
This commit is contained in:
parent
8db239660f
commit
e2c9964c3e
1 changed files with 10 additions and 13 deletions
|
|
@ -767,7 +767,6 @@ _cairo_quartz_load_truetype_table (void *abstract_font,
|
|||
{
|
||||
cairo_quartz_font_face_t *font_face = _cairo_quartz_scaled_to_face (abstract_font);
|
||||
CFDataRef data = NULL;
|
||||
CFIndex len;
|
||||
|
||||
if (likely (CGFontCopyTableForTagPtr))
|
||||
data = CGFontCopyTableForTagPtr (font_face->cgFont, tag);
|
||||
|
|
@ -775,20 +774,18 @@ _cairo_quartz_load_truetype_table (void *abstract_font,
|
|||
if (!data)
|
||||
return CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
|
||||
if (length) {
|
||||
if (*length == 0) {
|
||||
*length = CFDataGetLength (data);
|
||||
CFRelease (data);
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
if (buffer == NULL) {
|
||||
*length = CFDataGetLength (data);
|
||||
CFRelease (data);
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
len = *length;
|
||||
} else
|
||||
len = CFDataGetLength (data);
|
||||
|
||||
if (buffer)
|
||||
CFDataGetBytes (data, CFRangeMake (offset, len), buffer);
|
||||
if (CFDataGetLength (data) < offset + (long) *length) {
|
||||
CFRelease (data);
|
||||
return CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
}
|
||||
|
||||
CFDataGetBytes (data, CFRangeMake (offset, *length), buffer);
|
||||
CFRelease (data);
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue