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
    # list all axis from the current font
    for axis, data in listFontVariations().items():
        print((axis, data))
    # pick a variation from the current font
    # draw text!!
    text("Hello Q", (100, 100))
    # pick a variation from the current font
    # 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:


    ttfPath = 'SourceSerif4Variable-Roman.ttf'
    txt = 'Handgloves'
    translate(20, 100)
    with savedState():
        text(txt, (0, 0))
    translate(0, 300)
    with savedState():
        text(txt, (0, 0))
    translate(0, 300)
    with savedState():
        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)
    text("hello world", (0, 0))
    text("hello world", (0, 80))


  • admin

    works also fine on Big Sur (11.4)


  • 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)


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

  • admin

    frederik at 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