iOS/buildlibs/armv7/allegro-4.4.2/addons/allegrogl/src/fontconv.c
/* agl_merge_fonts:
 * font vtable entry
 * Merges f2 with f1 and returns a new font.
 */
font vtable entry
Merges f2 with f1 and returns a new font.
font vtable entry Merges f2 with f1 and returns a new font .
static FONT *agl_merge_fonts(FONT *f1, FONT *f2) {
	FONT *retval;
	FONT_AGL_DATA *fad1, *fad2, *fad = NULL;
	int phony = 0;
	if (!f1 || !f2)
		return NULL;
	fad1 = (FONT_AGL_DATA*)f1->data;
	fad2 = (FONT_AGL_DATA*)f2->data;
	if (fad1->type != AGL_FONT_TYPE_TEXTURED ||
	    fad2->type != AGL_FONT_TYPE_TEXTURED)
		return NULL;
	if (fad1->format != fad2->format)
		return NULL;
	retval = malloc(sizeof(struct FONT));
	retval->vtable = font_vtable_agl;
	retval->height = MAX(f1->height, f2->height);
	while (fad1 || fad2) {
		if (fad1 && (!fad2 || fad1->start < fad2->start)) {
			if (fad) {
				fad->next = copy_glyph_range(fad1, fad1->start, fad1->end,
																	 	&phony);
				fad = fad->next;
				fad->is_free_chunk = TRUE;
			}
			else {
				fad = copy_glyph_range(fad1, fad1->start, fad1->end, &phony);
				retval->data = fad;
			}
			fad1 = fad1->next;
		}
		else {
			if (fad) {
				fad->next = copy_glyph_range(fad2, fad2->start, fad2->end,
																	&phony);
				fad = fad->next;
				fad->is_free_chunk = TRUE;
			}
			else {
				fad = copy_glyph_range(fad2, fad2->start, fad2->end, &phony);
				retval->data = fad;
			}
			fad2 = fad2->next;
		}
	}
	return retval;
}
static FONT * agl_merge_fonts ( FONT * f1 , FONT * f2 ) { FONT * retval ; FONT_AGL_DATA * fad1 , * fad2 , * fad = NULL ; int phony = 0 ; if ( ! f1 || ! f2 ) return NULL ; fad1 = ( FONT_AGL_DATA * ) f1 -> data ; fad2 = ( FONT_AGL_DATA * ) f2 -> data ; if ( fad1 -> type != AGL_FONT_TYPE_TEXTURED || fad2 -> type != AGL_FONT_TYPE_TEXTURED ) return NULL ; if ( fad1 -> format != fad2 -> format ) return NULL ; retval = malloc ( sizeof ( struct FONT ) ) ; retval -> vtable = font_vtable_agl ; retval -> height = MAX ( f1 -> height , f2 -> height ) ; while ( fad1 || fad2 ) { if ( fad1 && ( ! fad2 || fad1 -> start < fad2 -> start ) ) { if ( fad ) { fad -> next = copy_glyph_range ( fad1 , fad1 -> start , fad1 -> end , & phony ) ; fad = fad -> next ; fad -> is_free_chunk = TRUE ; } else { fad = copy_glyph_range ( fad1 , fad1 -> start , fad1 -> end , & phony ) ; retval -> data = fad ; } fad1 = fad1 -> next ; } else { if ( fad ) { fad -> next = copy_glyph_range ( fad2 , fad2 -> start , fad2 -> end , & phony ) ; fad = fad -> next ; fad -> is_free_chunk = TRUE ; } else { fad = copy_glyph_range ( fad2 , fad2 -> start , fad2 -> end , & phony ) ; retval -> data = fad ; } fad2 = fad2 -> next ; } } return retval ; }
agl_merge_fonts:
 font vtable entry
 Merges f2 with f1 and returns a new font.
agl_merge_fonts : font vtable entry Merges f2 with f1 and returns a new font .
/* fonts must be textured and of the same format */ /* alloc output font */