Observer for active document change?



  • Is there an event observer that can detect when the user switches from one open document to another? I have a Vanilla popup button whose menu should always show the list of open fonts. Right now I get that list with AllFonts() and update it when fontDidOpen or fontDidClose. But that list is ordered according to the window stack, and I don't see a Mojo event for when the active (top-most) document or window changes.

    Is there such an event? Or could I achieve the same thing by observing a bunch of the ...WindowDidOpen and ...WindowWillClose events? Thanks!



  • I don't have an answer but you can always check the event observer extension to see what's being posted.

    There are events for
    fontResignCurrent
    fontBecameCurrent

    You can also sort AllFonts() using https://robofont.com/documentation/building-tools/toolspace/mojo/sort-fonts-list/



  • Thank you so much, @okaytype! fontBecameCurrent is exactly what I was looking for. I’m familiar with sorting AllFonts() but was hoping to have my list ordered according to the window stack.

    @frederik, could you add fontBecameCurrent to the RoboFont Observers doc? It seems to be missing.


Log in to reply