Adding spaces to SugarCube 1.x button text

edited January 2017 in Help! with 1.x
So I am trying to make sugarcube buttons the same size with different text. E.g.

<<button "six">>

<<button "sixty">>

I first tried adding a non-breaking space either side of the "six" to bring it up to five characters, but a nonbreaking space entity doesn't register - it gets typed out in full in the buttons.
&nbsp;six&nbsp;

Is there another way to do this?


Comments

  • edited January 2017
    IIRC, the way SugarCube v1 handles <<button>> text means you need to use the JavaScript Unicode escapes. For example:
    <<button "\u00A0six\u00A0">>…<</button>>
    


    That said, unless you've changed the font to be monospaced, you're never going to be able to get the widths perfect doing that—and it's kind of a hassle anyway. You're better off using some HTML & CSS to set the widths of the generated <button> elements. For example:
    <span class="fixed-buttons">\
    <<button "six">>…<</button>>
    <<button "sixty">>…<</button>>\
    </span>
    
    .fixed-buttons button {
    	width: 5em;
    }
    
  • Awesome, thanks so much.
Sign In or Register to comment.