guideline properties



  • Hello,

    I was wondering if there was a way to categorise guidelines and display them accordingly.

    For example: I like to have global guidelines for for horizontal stems in the uppercase and lowercase.
    If there are different stroke weights or overshoots the view gets quite cluttered with 4 guides for uc + lc.

    I am looking now for a way to define maybe a set of rules where I say: Show me these guidelines only if we have a lowercase letter (or uppercase, or numeral or whatever — basically a guideline set for glyph categories).

    I wanted to do some tests and thought maybe the

    BaseGuideline.identifier
    

    would be a good start, but in my attempts I only could get to local guidelines and couldn’t access the global ones.

    Is this something people would find useful? Is it possible?


  • admin

    check out the Guidetool from Tal:

    https://github.com/typesupply/guidetool



  • Thanks for the link, I was aware and already tried, but sadly the exact functionality (the smart rules) are somehow not working on my system.

    I opened up an issue here https://github.com/typesupply/guidetool/issues/15#issue-1224157239



  • @ddaanniiieeelll

    Global guidelines are nested in font objects, and local guidelines are in glyph objects. See:

    f = CurrentFont()
    g = CurrentGlyph()
    
    print("Global guidelines:")
    print(f.guidelines)
    
    print("\nLocal guidelines:")
    print(g.guidelines)
    

    In my experience, guideline identifiers are tricky to work with, because you can't assign them; they just are. You could write code to apprehend them and store them on the fly, but that leads to questions around where to store them, etc.

    Your best bet for a quick hacky approach is to standardize your guideline names for yourself. (e.g. lc_x_over, UC_x_over). If the current glyph is a lowercase glyph you could remove all "_over" and re-append the ones with "lc_". You'll have to figure out somewhere else in your tool to store the actual overshoot values you want (or automatic ways to surmise them [look at certain glyphs like /O /o]).

    Here's a simplistic way to check if a glyph is lowercase:

    f = CurrentFont()
    g = CurrentGlyph()
    
    g_parent_name = g.name.split(".")[0]
    
    character = chr(f[g_parent_name].unicode)
    
    if character == character.upper():
        print("this is an uppercase glyph")
    
    elif character == character.lower():
        print("this is a lowercase glyph")
    

    There's probably a better way that involved unicode categories (like MetricsMachine contexts’s backend)

    I have a newer version of this code that is a little smarter [uses identifiers] (haven't gotten around to fully testing and pushing to git yet), but maybe it's helpful.


  • admin



  • Global guidelines are nested in font objects, and local guidelines are in glyph objects.
    

    Aha! That makes so much sense, yet I never thought about it. Thanks @Ryan :)

    I quickly wrote a script that adds local guidelines with specific coordinates for a list of glyphs.
    That way I can define the overshoots for /O and /o (that's usually two of the characters I draw in the ideation stage already) and put those values in the code that then adds the guidelines to the list of glyphs I defined and where I need them.

    It’s not a very "programming" way of doing things, but it gets the job done and it’s pretty straight forward without having to many places I can make mistakes :)

    I was even thinking about making it a small tool or something inside the inspector where one can store the values for UC & lc and on click remove or add local guidelines.
    Who knows, maybe I can make Tals tool work for me, then I don't need to do anything by myself :)


Log in to reply