Accessing opsz fontVariation



  • I can't seem to access differing optical size settings in a variable font. This script, based on the documentation (for wght), nets two identical lines.

    size(1000, 500)
    # pick a font
    font("/Library/Application Support/Adobe/Fonts/FeneonSingleVF.ttf")
    # pick a font size
    fontSize(200)
    # list all axis from the current font
    for axis, data in listFontVariations().items():
        print((axis, data))
    # pick a variation from the current font
    fontVariations(opsz=14)
    # draw text!!
    text("Hello Q", (100, 100))
    # pick a variation from the current font
    fontVariations(opsz=66)
    # draw text!!
    text("Hello Q", (100, 300))
    

    Console correctly reports

    ('opsz', {'name': 'Optical size', 'minValue': 14.0, 'maxValue': 66.0, 'defaultValue': 66.0})
    

    But the display doesn't show the lines at different optical sizes. Does Drawbot tie opsz to font size, preventing forcing an overriding opsz setting?



  • hello @craig,

    it looks like variable optical sizes are selected automatically based on the point size. you can then use scale() to make text bigger or smaller:

    opsz.png

    ttfPath = 'SourceSerif4Variable-Roman.ttf'
    txt = 'Handgloves'
    
    font(ttfPath)
    translate(20, 100)
    
    with savedState():
        scale(40)
        fontSize(6)
        text(txt, (0, 0))
    
    translate(0, 300)
    with savedState():
        scale(13)
        fontSize(19)
        text(txt, (0, 0))
    
    translate(0, 300)
    with savedState():
        scale(4)
        fontSize(72)
        text(txt, (0, 0))
    

    hope this helps! cheers



  • Thanks @gferreira !


  • admin

    cool hack, Gustavo

    Looking at a way to disable the automatic optical size scaling.


  • admin

    what is your OS version?

    this simplified example works... on 10.13

    translate(50, 50)
    
    font('SourceSerif4Variable-Roman.ttf')
    fontSize(76)
    fontVariations(opsz=8)
    text("hello world", (0, 0))
    
    fontVariations(opsz=60)
    text("hello world", (0, 80))
    

    e1d61427-8ec7-406d-95a0-5ae9ea5056e0-image.png


  • admin

    works also fine on Big Sur (11.4)

    f1def8c5-efb8-42f9-9389-a0a5bd4f9003-image.png



  • I'm on Big Sur 11.6.

    Seems to work with Source Serif Variable, but not with my own font design. Uh oh. There isn't some signal within the font spec that would allow changing the setting or force the linkage to size, is there? It does seem to be accessing the optical sizes when I set at different sizes, but not accepting direct settings of them.


  • admin

    mm, strange, could you share your font? (offline only with me or a simplified dummy example)

    thanks



  • @frederik Happy to, is there a DM function on this board or an email address I should use? Thanks.


  • admin

    frederik at typemytype.com should do it



  • Ah wait, I've found the font file also doesn't work in Axis Praxis, and I think it may be because I started with an opsz scale that went in the wrong direction (I based in on stem thickness which is inverse to point size). I think that may be what's screwing the font up in multiple applications. Will see if that can be fixed.



  • Sure enough, that seems to have been the problem. A new font file with internal settings for opsz that increase rather than decrease with point size seems to now respond in Drawbot as expected.


Log in to reply