iOS/buildlibs/armv7/allegro-4.4.2/addons/allegrogl/src/fontconv.c
/* agl_extract_font_range:
 * font vtable entry
 * Extracts a glyph range from a given font and makes a new font of it.
 */
font vtable entry
Extracts a glyph range from a given font and makes a new font of it.
font vtable entry Extracts a glyph range from a given font and makes a new font of it .
static FONT *agl_extract_font_range(FONT *f, int start, int end) {
	FONT *retval = NULL;
	FONT_AGL_DATA *fad, *next, *newfad = NULL;
	int count;
	if (!f)
		return NULL;
	if (start == -1 && end == -1) {
	}
	else if (start == -1 && end > agl_get_font_range_begin(f, -1)) {
	}
	else if (end == -1 && start <= agl_get_font_range_end(f, -1)) {
	}
	else if (start <= end && start != -1 && end != -1) {
	}
	else
		return NULL;
	fad = (FONT_AGL_DATA*)f->data;
	if (fad->type != AGL_FONT_TYPE_TEXTURED)
		return NULL;
	start = MAX(start, agl_get_font_range_begin(f, -1));
	if (end > -1) {
		end = MIN(end, agl_get_font_range_end(f, -1));
	}
	else {
		end = agl_get_font_range_end(f, -1);
	}
	end++;
	retval = malloc(sizeof (struct FONT));
	retval->height = 0;
	retval->vtable = font_vtable_agl;
	next = fad;
	count = end - start;
	while (next) {
		if ((start >= next->start && start < next->end)
		 || (end   <= next->end   && end   > next->start)
		 || (start <  next->start && end   > next->end)) {
			int local_start, local_end;
			local_start = MAX(next->start, start);
			local_end = MIN(next->end, end);
			if (newfad) {
				newfad->next = copy_glyph_range(next, local_start, local_end,
															&(retval->height));
				newfad = newfad->next;
				newfad->is_free_chunk = TRUE;
			}
			else {
				newfad = copy_glyph_range(next, local_start, local_end,
															&(retval->height));
				retval->data = newfad;
			}
		}
		next = next->next;
	}
	return retval;
}
static FONT * agl_extract_font_range ( FONT * f , int start , int end ) { FONT * retval = NULL ; FONT_AGL_DATA * fad , * next , * newfad = NULL ; int count ; if ( ! f ) return NULL ; if ( start == -1 && end == -1 ) { } else if ( start == -1 && end > agl_get_font_range_begin ( f , -1 ) ) { } else if ( end == -1 && start <= agl_get_font_range_end ( f , -1 ) ) { } else if ( start <= end && start != -1 && end != -1 ) { } else return NULL ; fad = ( FONT_AGL_DATA * ) f -> data ; if ( fad -> type != AGL_FONT_TYPE_TEXTURED ) return NULL ; start = MAX ( start , agl_get_font_range_begin ( f , -1 ) ) ; if ( end > -1 ) { end = MIN ( end , agl_get_font_range_end ( f , -1 ) ) ; } else { end = agl_get_font_range_end ( f , -1 ) ; } end ++ ; retval = malloc ( sizeof ( struct FONT ) ) ; retval -> height = 0 ; retval -> vtable = font_vtable_agl ; next = fad ; count = end - start ; while ( next ) { if ( ( start >= next -> start && start < next -> end ) || ( end <= next -> end && end > next -> start ) || ( start < next -> start && end > next -> end ) ) { int local_start , local_end ; local_start = MAX ( next -> start , start ) ; local_end = MIN ( next -> end , end ) ; if ( newfad ) { newfad -> next = copy_glyph_range ( next , local_start , local_end , & ( retval -> height ) ) ; newfad = newfad -> next ; newfad -> is_free_chunk = TRUE ; } else { newfad = copy_glyph_range ( next , local_start , local_end , & ( retval -> height ) ) ; retval -> data = newfad ; } } next = next -> next ; } return retval ; }
agl_extract_font_range:
 font vtable entry
 Extracts a glyph range from a given font and makes a new font of it.
agl_extract_font_range : font vtable entry Extracts a glyph range from a given font and makes a new font of it .
/* check if range boundaries make sense */ /* only textured fonts are supported */ /* anticipate invalid range values */ /* find the range that is covered by the requested range
		 * check if the requested and processed ranges at least overlap
		 *    or if the requested range wraps processed range.
		 */ /* extract the overlapping range */