• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Are non-breaking space characters just ignored in AE's text engine?

Enthusiast ,
May 18, 2021 May 18, 2021

Copy link to clipboard

Copied

I know you can explicitly set a space to "no break" using the character palette, but I need to set non-breaking spaces using expressions. Problem is, it sure looks like AE just treats non-breaking spaces like regular old spaces and breaks on them anyway when laying out paragraph text. Is there a simple solution to this, a setting I'm missing maybe? I can work around it with a character value animator, but it doesn't seem like this should be needed, right?

TOPICS
Error or problem , Expressions

Views

986

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 20, 2021 May 20, 2021

Copy link to clipboard

Copied

It looks like After Effects doesn't tag the space, but instead tags the two words either side of the non-breaking space.  I took a quick look, but can't spot what that tag is via expressions.

When I made my tutorial for resizing a text box, I denoted line breaks with the '|' symbol and then replaced them after my code with line breaks.  So my text midway looked like "the|Quick|brown|fox|jumps|over|the|lazy|dog.  This gave me a bit more control.  

Depending what you're trying to do with your expression, could you start by splitting the text into an array and adding a different symbol at the point where you want a non-breaking space?

This code below splits the text by spaces and reassembles it, but adds in a symbol after the 4th word instead of a space.

var myArray = text.sourceText.split(' ');
txt = '';
for (var i = 0; i< myArray.length; i++) {
    txt += myArray[i];
    if (i == 4) {
        txt += '|';
    } else {
        txt += ' ';
    }

}
txt;

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
May 20, 2021 May 20, 2021

Copy link to clipboard

Copied

LATEST

Yeah, I have been doing something similar, except uisng a regular expression and the replace() function to insert a placeholder character, then changing it back to a space with a text animator. It's just annoying that it has to be this complicated.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines