[fonts]
bmpfont=al_load_font(bmp_filename, 24, flags)
builtin=al_create_builtin_font()
ttf=al_load_font(ttf_filename, 24, flags)
ttf_tall=al_load_ttf_font_stretch(ttf_filename, 24, 48, flags)
ttf_wide=al_load_ttf_font_stretch(ttf_filename, 48, 24, flags)
ttf_px1=al_load_font(ttf_filename, -32, flags)
ttf_px2=al_load_ttf_font_stretch(ttf_filename, 0, -32, flags)
ttf_px3=al_load_ttf_font_stretch(ttf_filename, -24, -32, flags)
# arguments
bmp_filename=../examples/data/a4_font.tga
ttf_filename=../examples/data/DejaVuSans.ttf
flags=ALLEGRO_NO_PREMULTIPLIED_ALPHA

[text]
en=Welcome to Allegro
gr=Καλώς ήρθατε στο Allegro
latin1=aábdðeéfghiíjkprstuúvxyýþæö

[test font bmp]
extend=text
op0=al_clear_to_color(rosybrown)
op1=al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA)
op2=
op3=al_draw_text(font, darkred, 320, 100, ALLEGRO_ALIGN_LEFT, en)
op4=al_draw_text(font, white, 320, 150, ALLEGRO_ALIGN_CENTRE, en)
op5=al_draw_text(font, blue, 320, 200, ALLEGRO_ALIGN_RIGHT, en)
op6=
font=bmpfont
hash=68f73534

[test font bmp hold]
extend=test font bmp
op2=al_hold_bitmap_drawing(true)
op6=al_hold_bitmap_drawing(false)

[test font builtin]
extend=text
op0=al_clear_to_color(rosybrown)
op1=al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA)
op2=al_draw_text(font, darkred, 320, 100, ALLEGRO_ALIGN_LEFT, en)
op3=al_draw_text(font, white, 320, 150, ALLEGRO_ALIGN_CENTRE, latin1)
font=builtin
hash=502aa12f

[test font ttf]
extend=test font bmp
op6=al_draw_text(font, khaki, 320, 300, ALLEGRO_ALIGN_CENTRE, gr)
font=ttf
# Result changes with the FreeType configuration of the system.
hash=off

[test font ttf hold]
extend=test font ttf
op2=al_hold_bitmap_drawing(true)
op7=al_hold_bitmap_drawing(false)

[test font ttf tall]
extend=test font ttf
font=ttf_tall

[test font ttf wide]
extend=test font ttf
font=ttf_wide

[test font ttf pixelsize 1]
extend=test font ttf
font=ttf_px1

[test font ttf pixelsize 2]
extend=test font ttf
font=ttf_px2

[test font ttf pixelsize 3]
extend=test font ttf
font=ttf_px3

[test font bmp justify]
extend=text
op0=al_clear_to_color(#886655)
op1=al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA)
op2=al_draw_justified_text(bmpfont, black, 100, 540, 100, 0, 0, en)
op3=al_draw_justified_text(bmpfont, black, 100, 540, 150, 1000, 0, en)
hash=6a402079

[test font ttf justify]
extend=test font bmp justify
op4=al_draw_justified_text(ttf, black, 100, 540, 300, 0, 0, gr)
op5=al_draw_justified_text(ttf, black, 100, 540, 350, 1000, 0, gr)
# Result changes with the FreeType configuration of the system.
hash=off

[test font complex]
extend=text
op0=al_clear_to_color(#665544)
op1=al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA)
op2=al_build_transform(T, cx, cy, 2.0, 2.0, -0.3)
op3=al_use_transform(T)
op4=al_draw_text(ttf, #aabbcc80, 0, 0, ALLEGRO_ALIGN_CENTRE, en)
op5=al_build_transform(T, cx, cy, 2.0, 2.0, 0.3)
op6=al_use_transform(T)
op7=al_draw_text(ttf, #eebbaa80, 0, 0, ALLEGRO_ALIGN_CENTRE, gr)
op8=al_build_transform(T2, cx, 360, 20, 20, 0)
op9=al_use_transform(T2)
op10=al_draw_text(bmpfont, #88888855, 0, 0, ALLEGRO_ALIGN_CENTRE, yeah)
cx=320
cy=200
yeah=yeah!
# Result changes with the FreeType configuration of the system.
hash=off

[test font dimensions ttf en]
op0= al_clear_to_color(#665544)
op1= al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA)
op2= al_translate_transform(T, 100, 100)
op3= al_use_transform(T)
op4= al_get_text_dimensions(font, str, bbx, bby, bbw, bbh)
# We can't actually draw it without introducing arithmetic.
#op5=al_draw_rectangle(bbx, bby, bbx+bbw, bby+bbh, black, 0)
op5=
op6= al_draw_text(font, #aabbcc80, 0, 0, ALLEGRO_ALIGN_LEFT, str)
op7=
op8= al_translate_transform(T, 0, 100)
op9= al_use_transform(T)
op10=w = al_get_text_width(font, str)
op11=h = al_get_font_line_height(font)
op12=as = al_get_font_ascent(font)
op13=de = al_get_font_descent(font)
# Note: the hw version blurs the lines because we can't add 0.5 offsets.
op14=al_draw_rectangle(0, 0, w, h, black, 0)
op15=al_draw_line(0, as, w, as, black, 0)
op16=al_draw_line(0, de, w, de, black, 0)
op17=al_draw_text(font, #aabbcc80, 0, 0, ALLEGRO_ALIGN_LEFT, str)
font=ttf
str=Welcome to Allegro
hash=off

[test font dimensions ttf gr]
extend=test font dimensions ttf en
str=Καλώς ήρθατε στο Allegro
hash=off

[test font dimensions bmp]
extend=test font dimensions ttf en
font=bmpfont
hash=4284d74d

# Not a font test but requires a font.
[test d3d cache state bug]
op0=image = al_create_bitmap(20, 20)
op1=al_set_target_bitmap(image)
op2=al_clear_to_color(white)
op3=al_set_target_bitmap(target)
op4=al_clear_to_color(#00000000)
op5=al_draw_text(bmpfont, red, 0, 0, ALLEGRO_ALIGN_LEFT, str)
op6=al_set_blender(ALLEGRO_DEST_MINUS_SRC, ALLEGRO_ALPHA, ALLEGRO_ONE)
op7=al_draw_rectangle(45, 45, 75, 75, #ffffff40, 1)
op8=al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA)
op9=al_draw_tinted_bitmap(image, #ffffffff, 50, 50, 0)
str=Hello
hash=249efe55
