Skip to main content
Inspiring
Feb 21, 2023 9:42 PM UTC
Answered

Font Size Expression Not Working in Pre-Comp's Essential Properties

I have a few pre-comps to use as titles in other comps. Each pre-comp includes a text layer and a control layer with a "Font Size" slider. The Source Text of the text layer has the following expresion:

text.sourceText.style
.setFontSize(thisComp.layer("control").effect("Font Size")("Slider"))
.setAutoLeading(true)
;

Changing the slider in the pre-comp's control layer works great. I've added the slider to the Essential Graphics panel and it works great there too. However, when I add the pre-comp to another comp and try changing the Font Size in the Essential Properties, nothing happens.

I tried enabling the Font Size Adjustment in the EG panel, by that doesn't show up in the Essential Properties list. This is why I implemented the slider. 

 

I exported it as a MOGRT and tried it in Premiere, and it works fine there too. So why is it not working in AE? I'm on AE v23.1.0

AmozzaCorrect answer
Inspiring
Feb 22, 2023 3:43 PM UTC

UPDATE: The issue occurs after you edit the text in the Essential Properties (Source Text was added to the EG panel). It makes sense. When you edit the text, you replace the expression that the Font Size slider references, so it no longer works. 

 

To fix this I added a new text layer "title-text" and turned off visibility. I added this layer's source text to the EG panel instead of the other text layer. Then, on the original text layer I modified the expression as follows:

sourceTextContent = thisComp.layer("title-text").text.sourceText; 
text.sourceText.style
	.setText(sourceTextContent)
	.setFontSize(thisComp.layer("control").effect("Font Size")("Slider"))
	.setAutoLeading(true)
	;

 This now works fine.

 

4 replies

OussK
Community Expert
Community Expert
Feb 22, 2023 5:13 AM UTC

I attempted to replicate the steps you outlined and found that everything worked as expected. Please refer to the attached file for reference.

Translate
AmozzaAuthor
Inspiring
Feb 22, 2023 3:19 PM UTC

Thanks for testing OussK. Your file worked for me too, and I created a new one which also worked. I think I will need to recreate my main project in case there is some corruption.

Translate
AmozzaAuthorCorrect answer
Inspiring
Feb 22, 2023 3:43 PM UTC

UPDATE: The issue occurs after you edit the text in the Essential Properties (Source Text was added to the EG panel). It makes sense. When you edit the text, you replace the expression that the Font Size slider references, so it no longer works. 

 

To fix this I added a new text layer "title-text" and turned off visibility. I added this layer's source text to the EG panel instead of the other text layer. Then, on the original text layer I modified the expression as follows:

sourceTextContent = thisComp.layer("title-text").text.sourceText; 
text.sourceText.style
	.setText(sourceTextContent)
	.setFontSize(thisComp.layer("control").effect("Font Size")("Slider"))
	.setAutoLeading(true)
	;

 This now works fine.

 

Translate