Typographic white space?

  • Does DrawBot allow for utilizing whitespace characters such as em, en, or thin spaces?

  • admin

    You just have to use the proper unicode and the font should of course support it:

    # a collection of space unicodes
    spaces = [
        (0x0020, "normal space"),    
        (0x2000, "en space"),
        (0x2001, "em space"),
        (0x2008, "hair space"),
        (0x2009, "thin space"),
        (0x200B, "zero width space"),    
    y = 20
    # start loop over all spaces
    for space, name in spaces:
        # draw the space as text
        # using the py3 f-string formatting!!!
        text(f"draw{chr(space)}bot\t\t({name})", (10, y))    
        y += 100

  • @frederik wonderful! Thank you!