pattr to store font selected from umenu not working

Mauro Trotta's icon

Hi! I am trying that a max for live device remember the last font pick by the user from an umenu. I have a fontlist object that populates the umenu with the system fonts and I understand that the pattr object initiate before every object is restored, so I guess I am not getting the last picked font because fontlist is replacing the font stored by the pattr. I tried adding a delay after live.device to trigger pattr but it is not working. Pattr parameter mode is enabled and visibility is set to stored only.

Max Patch
Copy patch and select New From Clipboard in Max.

TFL's icon

You've set the pattr parameter to store an int, pointing to an index in the font menu, not the actual font name. This might be an issue if the user removes or install new font on their computer: the list order would change and the index would point to another font.

The second issue is that Live parameters don't like of type Enum (the typical type for a list of custom items) don't like to get their range dynamically changed during runtime.

IMO the best approach here would be to unbind your [pattr] from the [umenu], set its data type to Blob (for storing symbols), and route it "manually" to your [umenu]:

Max Patch
Copy patch and select New From Clipboard in Max.



Mauro Trotta's icon

IMO the best approach here would be to unbind your [pattr] from the [umenu], set its data type to Blob (for storing symbols), and route it "manually" to your [umenu]:

I am trying to set the data type of pattr to symbol, but every time I close and open again the patch, it reset to data type atom.

Besides that, pattr is saving a selected font from the umenu and send it to umenu when reopening the patch, but it´s not the last selected font.

At least, the order of "actions"(I don't know how to call them) are happening correctly. I place a print after fontlist and another after prepend symbol and the latest is sending the saved font symbol after fontlist clear and load the system fonts.

TFL's icon

My bad, I wasn't talking about the "Data Type" under the Behavior section (atom is fine for it), but the "Type" attribute under the Parameter section, which should be set to Blob.

For me, this works, ie. the last selected font before saving the Live set is properly selected when reopening the Live set:

Max Patch
Copy patch and select New From Clipboard in Max.

Mauro Trotta's icon

That works for me too, thanks!