[fonts]
bmpfont=al_load_font(bmp_filename, 24, flags)
asciifont=al_load_font(ascii_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
ascii_filename=../examples/data/fixed_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ýþæö
missing=here -> á <- is unicode #00E1

[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

# Per glyph drawing
[test font glyph simple builtin en]
op0= al_clear_to_color(#665544)
op1= al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA)
op2= x = int(100)
op3= y = int(100)
op4=
# al_hold_bitmap_drawing(1)
op5= al_draw_glyph(font, glyph_color, x, y, glyph)
# op6= al_hold_bitmap_drawing(0)
font=builtin
glyph=84
x=100
y=100
glyph_color=#00ff00ff
hash=5a674455

[test font glyph simple bmp en]
extend=test font glyph simple builtin en
font=bmpfont
hash=5a674455


[test font glyph simple ttf en]
extend=test font glyph simple builtin en
font=ttf
hash=6ed595a5
sig=LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL

[test font glyph simple ttf gr]
extend=test font glyph simple builtin en
font=ttf
glyph=922
hash=f02da2af
sig=LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL

# Per glyph drawing
[test font glyph match builtin en]
op0= al_clear_to_color(#665544)
op1= al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA)
op2= x = int(100)
op3= y = int(100)
op4=
# al_hold_bitmap_drawing(0)
op5= al_draw_text(font, blue, x, y, ALLEGRO_ALIGN_LEFT, str)
op6= al_draw_text(font, text_color, x, y, ALLEGRO_ALIGN_LEFT, str) 
op7= glyph_Tu_k = al_get_glyph_advance(font, glyph_T, glyph_u)
op8= glyph_ul_k = al_get_glyph_advance(font, glyph_u, glyph_l)
op9= glyph_li_k = al_get_glyph_advance(font, glyph_l, glyph_i)
op10= glyph_ip_k = al_get_glyph_advance(font, glyph_i, glyph_p)
op11= al_draw_glyph(font, glyph_color, x, y, glyph_T)
op12= x = isum(x, glyph_Tu_k)
op13= al_draw_glyph(font, glyph_color, x, y, glyph_u)
op14= x = isum(x, glyph_ul_k)
op15= al_draw_glyph(font, glyph_color, x, y, glyph_l)
op16= x = isum(x, glyph_li_k)
op17= al_draw_glyph(font, glyph_color, x, y, glyph_i)
op18= x = isum(x, glyph_ip_k)
op19= al_draw_glyph(font, glyph_color, x, y, glyph_p)
op20= x = isum(x, glyph_p_w)
op21= h = al_get_font_line_height(font)
op22= x = int(100)
op23= y = int(100)
op24=
# al_hold_bitmap_drawing(0)
font=builtin
str=Tulip
glyph_T=84
glyph_u=117
glyph_l=108
glyph_i=105
glyph_p=112
glyph_Tu_k=0
glyph_ul_k=0
glyph_li_k=0
glyph_ip_k=0
x=100
y=100
text_color=#ff0000ff
glyph_color=#00ff00ff
hash=60affa5d


[test font glyph match bmp en]
extend=test font glyph match builtin en
font=bmpfont
str=Tulip
hash=60affa5d

[test font glyph match ttf en]
extend=test font glyph match builtin en
font=ttf
hash=5857f828
sig=LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL

[test font glyph match ttf gr]
extend=test font glyph match ttf en
glyph_T=922
glyph_u=945
glyph_l=955
glyph_i=974
glyph_p=962
str=Καλώς
font=ttf
hash=f0ff79f6
sig=LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL

[test font fallback]
extend=text
op0=al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA)
op1=al_clear_to_color(black)
op2=al_draw_text(asciifont, yellow, 100, 100, 0, missing)
op3=al_set_fallback_font(asciifont, builtin)
op4=al_draw_text(asciifont, yellow, 100, 120, 0, missing)
op5=al_set_fallback_font(asciifont, NULL)
op6=al_draw_text(builtin, yellow, 100, 140, 0, missing)
hash=c4ee101f