bug with eDrawAlign.CENTER & eDrawAlign.RIGHT on multiple lines

Jungle Ide Home Forums FontMachine FontMachine open source module bug with eDrawAlign.CENTER & eDrawAlign.RIGHT on multiple lines

This topic contains 3 replies, has 2 voices, and was last updated by  Ziggy 5 years, 5 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #5661

    supertino
    Participant
    'We import the required modules:
    Import mojo
    Import fontmachine
    
    'Start the program:
    Function Main() 
    	New Tutorial
    End
    
    Class Tutorial extends App
    
    	'We create a BitmapFont variable called font. Our font will be loaded here:  
    	Field font:BitmapFont
    
    	Method OnCreate()
    		SetUpdateRate(60)
    		'We load the sample font (called bluesky) into our variable called font.
    		'The first parameter is the name (and path) of the font description file (txt file generated on the FontMachine editor) 
    		'The second parameter indicates if the font glipths will be loaded dynamically (true) or statically (false).
    		'If the font characters are loaded dynamically, the application will load (and download on HTML5) only required characters.
    		'Otherwise, the full font will be required. For more information about dynamic or static fonts, see the documentation.
    		font = New BitmapFont("bluesky/bluesky.txt", False)
    	End
    	Method OnRender()
    	
    		Cls(255,255,255) 
    		'We just draw some text: 
    		font.DrawText("Hello~nworld~nthis~nis~na~ntest", 210, 10, eDrawAlign.CENTER)
    		 
    	End
    	
    	Method OnUpdate()
    		If KeyDown(KEY_A) Then font.Kerning.x-=.4
    		If KeyDown(KEY_D) Then font.Kerning.x+=.4
    		If KeyDown(KEY_W) Then font.Kerning.y-=.4
    		If KeyDown(KEY_S) Then font.Kerning.y+=.4
    		if KeyDown(KEY_SPACE) Then DebugStop()
    	End
    End

    I am using the latest version 14-01-14-A of font machine and latest non-experimental Monkey

    Above is one of the tutorial samples, I have extended the text to have more than two lines, all the lines are not centered when drawn using eDrawAlign.CENTER, its also not correct when using eDrawAlign.RIGHT

    It looks like this centered;

    example

    #5662

    Ziggy
    Keymaster

    Found it and fixed it. Will commit a fix into the google code page in a while (just ensuring there are no side effects on the fix).

    #5663

    supertino
    Participant

    Excellent as always Ziggy. /smiley_face

    #5668

    Ziggy
    Keymaster

    The fix has been commited to the official google code repository. Will prepare and offial update soon.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.