Skip to main content
Inspiring
February 21, 2023
Answered

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

  • February 21, 2023
  • 1 reply
  • 1583 views

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

Correct answer Amozza

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.

 

1 reply

OussK
Community Expert
February 22, 2023

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

AmozzaAuthor
Inspiring
February 22, 2023

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.

AmozzaAuthorCorrect answer
Inspiring
February 22, 2023

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.