Skip to main content
Participant
November 10, 2023
Answered

Different fonts in the same text layer

  • November 10, 2023
  • 3 replies
  • 908 views

Hello! I am trying to find the solution to be able to apply different fonts when I have an Asian and a Western text in the same text layer. So far, I have only been able to change it by selecting those characters and changing it in the font selector. My idea is to automate the font change but for this, first I need to find a way to change in a single step using scripting or expressions. For example, in this text 2023年11月27日, that the numbers have one font and the Japanese text have another different font. Does anyone know any solution?

This topic has been closed for replies.
Correct answer JavierEstrada

I would use two different text layers with different fonts each. the short answer would be:
write these lines on the X axis (separating the dimensions)

 

var xPos = thisComp.layer("2023").transform.xPosition;
var theWidth = thisComp.layer("2023").sourceRectAtTime().width;

xPos + theWidth

 

This will place the layers close together, if you want to leave a space between them you can add a slider to each one and give them a space individually

 

var xPos = thisComp.layer("2023").transform.xPosition;
var theWidth = thisComp.layer("2023").sourceRectAtTime().width;
var thePadding = effect("padding")("Slider");

xPos + theWidth + thePadding


If you want to automate it a little more you can change thisComp.layer("2023") with the code thisComp.layer(thisLayer, 1) so that it detects the position and width of a layer below, when you duplicate them it will position itself automatically.

 

So this would be my final lines

 

var xPos = thisComp.layer(thisLayer, 1).transform.xPosition;
var theWidth = thisComp.layer(thisLayer, 1).sourceRectAtTime().width;
var thePadding = effect("padding")("Slider");

xPos + theWidth + thePadding

I hope this helps

3 replies

Adobe Employee
November 26, 2023

Hi @cristiansierra 

 

There is a Scripting (not Expressions) solution now available in beta which will allow per-character control of styles, so you will be able to apply different fonts to different characters, like you wish to do here.

 

https://community.adobe.com/t5/after-effects-beta-discussions/per-character-scripting-public-beta-announcement/td-p/14247138

 

Douglas Waterfall

After Effects Engineering

JavierEstradaCorrect answer
Inspiring
November 10, 2023

I would use two different text layers with different fonts each. the short answer would be:
write these lines on the X axis (separating the dimensions)

 

var xPos = thisComp.layer("2023").transform.xPosition;
var theWidth = thisComp.layer("2023").sourceRectAtTime().width;

xPos + theWidth

 

This will place the layers close together, if you want to leave a space between them you can add a slider to each one and give them a space individually

 

var xPos = thisComp.layer("2023").transform.xPosition;
var theWidth = thisComp.layer("2023").sourceRectAtTime().width;
var thePadding = effect("padding")("Slider");

xPos + theWidth + thePadding


If you want to automate it a little more you can change thisComp.layer("2023") with the code thisComp.layer(thisLayer, 1) so that it detects the position and width of a layer below, when you duplicate them it will position itself automatically.

 

So this would be my final lines

 

var xPos = thisComp.layer(thisLayer, 1).transform.xPosition;
var theWidth = thisComp.layer(thisLayer, 1).sourceRectAtTime().width;
var thePadding = effect("padding")("Slider");

xPos + theWidth + thePadding

I hope this helps

Participant
November 10, 2023

Thank you for tour answer! It's actually a good solution in theory but I don't think that would work. On the one hand, since each layer has a different font, the characters have different sizes between them, so it would not be perfect as if it were a single word. On the other hand, I would be interested if it were all on the same text layer for animations, effects...etc. 

Community Expert
November 10, 2023

I have created similar projects many times. Text animators can be tied together with expressions, and timing can be adjusted. so that everything looks like it is on a single line as it animates in and out. If you could describe your design idea in detail, we could help you figure things out. 

 

The expressions suggested are just a start. I almost never separate dimensions because you lose the ability to edit a motion path accurately, and the speed graphs can be next to impossible to control.  

 

 

Community Expert
November 10, 2023

Expressions can only set a font for the entire layer. You'll have to use two text layers and line them up with sourceRecAtTime().