Page 1 of 1

Convert text to vector code?

Posted: Sun Apr 29, 2018 2:36 am
by dkwroot
I can't find a function that allows us to convert a text layer into a regular vector. Does it exist or are there workarounds?

Re: Convert text to vector code?

Posted: Sun Apr 29, 2018 4:43 am
by synthsin75
Not that I can find, but you can set whether a text or vector layer is going to be created by the next use of the insert text tool or calling: moho:CreateTextObject()

local param = MOHO.MohoGlobals.InsertText
param.MakeLayer = false --false to create vector layer

Re: Convert text to vector code?

Posted: Sun Apr 29, 2018 5:15 am
by dkwroot
I also noticed the function for creating text objects. I just didn't see any other functions for them. The more I look into this, the more it seems like the text layer was just hacked into the vector layer. It really should have its own class and functions, maybe a future Moho release.

Thanks Wes.

Re: Convert text to vector code?

Posted: Sun Apr 29, 2018 6:56 am
by synthsin75
Yeah, unless we ask for something specific, they only create new scripting access for stuff they need in stock scripts. It's pretty rare that we get other scripting additions that we haven't asked for.

Re: Convert text to vector code?

Posted: Sun Feb 10, 2019 8:30 am
by synthsin75

Code: Select all

	local layer = moho.layer --text layer
	moho:CreateNewLayer(MOHO.LT_VECTOR)
	local param = MOHO.MohoGlobals.InsertText
	param.Text:Set(layer:Name())
	moho:InsertText(param, 0)
	moho:DeleteLayer(layer)
But you lose any line breaks.

Well, you can maintain line breaks, by leaving off "param.Text:Set(layer:Name())", but only if you open the layer's layer settings first, so it registers that as the param text.

moho:EditLayerSettings() doesn't seem to do anything.

Re: Convert text to vector code?

Posted: Wed Feb 13, 2019 3:19 pm
by hayasidist
dunno if this is helpful or irrelevant as we're in the scripting area but … there is a right-click option on a Text layer to convert it to a vector layer

Re: Convert text to vector code?

Posted: Wed Feb 13, 2019 4:20 pm
by synthsin75
Yeah, I assumed he wanted something scriptable.