diff -r -u rakudo/parrot/config/gen/call_list/misc.in sdl_things/parrot/config/gen/call_list/misc.in --- rakudo/parrot/config/gen/call_list/misc.in 2009-06-28 13:42:41.000000000 +0400 +++ sdl_things/parrot/config/gen/call_list/misc.in 2009-06-28 13:53:27.000000000 +0400 @@ -227,6 +227,8 @@ v pip p pti i ppp +# added by RNH for the RenderXXX_XXXX text routines +p ptii # Used by SDL::Font p ti diff -r -u rakudo/parrot/CREDITS sdl_things/parrot/CREDITS --- rakudo/parrot/CREDITS 2009-06-28 13:42:45.000000000 +0400 +++ sdl_things/parrot/CREDITS 2009-06-28 14:15:10.000000000 +0400 @@ -780,6 +780,11 @@ E: rurban@cpan.org D: cygwin, 64-bit pbc compat, float converters, bignum.pmc +N: Richard Hainsworth +U: finanalyst +E: richard@rusrating.ru +D: bugfix SDL Font + N: Richard Tibbetts D: Divide by zero exceptions in some PMCs diff -r -u rakudo/parrot/runtime/parrot/library/SDL/Font.pir sdl_things/parrot/runtime/parrot/library/SDL/Font.pir --- rakudo/parrot/runtime/parrot/library/SDL/Font.pir 2009-06-28 13:41:59.000000000 +0400 +++ sdl_things/parrot/runtime/parrot/library/SDL/Font.pir 2009-06-28 13:47:05.000000000 +0400 @@ -136,14 +136,29 @@ font_surface = new 'SDL::Surface' font_surface.'init'( 'height' => 0, 'width' => 0 ) - .local pmc RenderText_Solid - get_hll_global RenderText_Solid, ['SDL::NCI::TTF'], 'RenderText_Solid' +# RNH use RenderUTF8 in preference to RenderText by default + .local pmc RenderUTF8_Solid + get_hll_global RenderUTF8_Solid, ['SDL::NCI::TTF'], 'RenderUTF8_Solid' + + .local int color +# RNH font routine takes color in the order rgb rather than bgr used by surface.pir hence cannot rely on color.get_integer + .local int component + .local pmc colors + colors = color_pmc.'color'() + + component = colors['b'] + component <<= 16 + color = component + + component = colors['g'] + component <<= 8 + color += component - .local pmc color - color = color_pmc.'color'() + component = colors['r'] + color += component .local pmc font_surface_struct - font_surface_struct = RenderText_Solid( font, text, color ) + font_surface_struct = RenderUTF8_Solid( font, text, color ) font_surface.'wrap_surface'( font_surface_struct ) .return( font_surface ) diff -r -u rakudo/parrot/runtime/parrot/library/SDL.pir sdl_things/parrot/runtime/parrot/library/SDL.pir --- rakudo/parrot/runtime/parrot/library/SDL.pir 2009-06-28 13:42:01.000000000 +0400 +++ sdl_things/parrot/runtime/parrot/library/SDL.pir 2009-06-28 13:52:01.000000000 +0400 @@ -219,6 +219,7 @@ loadlib ttf_lib, 'libSDL_ttf' if ttf_lib goto initialize loadlib ttf_lib, 'cygSDL_ttf-2-0-0' +# RNH this is not trapping a non-existent libSDL_ttf library unless ttf_lib goto error initialize: @@ -243,15 +244,21 @@ success: dlfunc nci_sub, ttf_lib, 'TTF_OpenFont', 'pti' set_hll_global ['SDL::NCI::TTF'], 'OpenFont', nci_sub - - dlfunc nci_sub, ttf_lib, 'TTF_RenderText_Solid', 'pptp' +#RNH changes: all text routines expect an integer, not a pmc, for color parameter + dlfunc nci_sub, ttf_lib, 'TTF_RenderText_Solid', 'ppti' set_hll_global ['SDL::NCI::TTF'], 'RenderText_Solid', nci_sub - dlfunc nci_sub, ttf_lib, 'TTF_RenderUTF8_Solid', 'pptp' + dlfunc nci_sub, ttf_lib, 'TTF_RenderUTF8_Solid', 'ppti' set_hll_global ['SDL::NCI::TTF'], 'RenderUTF8_Solid', nci_sub # this one could be wrong - dlfunc nci_sub, ttf_lib, 'TTF_RenderUNICODE_Solid', 'pptp' + dlfunc nci_sub, ttf_lib, 'TTF_RenderUNICODE_Solid', 'ppti' set_hll_global ['SDL::NCI::TTF'], 'RenderUNICODE_Solid', nci_sub +# RNH Additions. Add UTF8_Shaded and FontLine skip + dlfunc nci_sub, ttf_lib, 'TTF_RenderUTF8_Shaded', 'pptii' + set_hll_global ['SDL::NCI::TTF'], 'RenderUTF8_Shaded', nci_sub + dlfunc nci_sub, ttf_lib, 'TTF_FontLineSkip', 'ip' + set_hll_global ['SDL::NCI::TTF'], 'FontLineSkip', nci_sub +#end additions dlfunc nci_sub, ttf_lib, 'TTF_SizeText', 'ipt33' set_hll_global ['SDL::NCI::TTF'], 'SizeText', nci_sub