Convert text to vector code?

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
dkwroot
Posts: 677
Joined: Thu May 02, 2013 6:56 am
Location: USA
Contact:

Convert text to vector code?

Post 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?
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Convert text to vector code?

Post 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
dkwroot
Posts: 677
Joined: Thu May 02, 2013 6:56 am
Location: USA
Contact:

Re: Convert text to vector code?

Post 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.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Convert text to vector code?

Post 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.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Convert text to vector code?

Post 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.
User avatar
hayasidist
Posts: 3492
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Convert text to vector code?

Post 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
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Convert text to vector code?

Post by synthsin75 »

Yeah, I assumed he wanted something scriptable.
Post Reply