Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions After Effects mogrt force curly quotes

  • After Effects mogrt force curly quotes

    Posted by Jeff Hinkle on March 7, 2024 at 6:13 pm

    After lots of searching and experimentation, I still haven’t found a solution so turning to the pros.

    I’ve made a mogrt for a lower-third in AE 2020 (they won’t let us upgrade). Everything works fine except if you type quotes into the mogrt text field, they come out as straight quotes on screen instead of the curly quotes we want. Don’t know why that’s the default behavior, but sure. I’ve found where you can right-click the field and choose Smart Quotes from Substitutions, but this mogrt is going out of the building and I figure there’s maybe a 30% chance of the editors doing that consistently.

    I’ve tried using textReplace but either I’m not escaping the quotes properly or am not typing the different quotes correctly. I tried messing with Unicode values but that hit a brick wall.

    So is there an easy way to force straight quotes to curly? I feel like the logic of my solution makes sense but my syntax must be faulty. Really don’t want to rely on user interaction for a fix.

    Dan Ebberts replied 2 years, 4 months ago 5 Members · 5 Replies
  • 5 Replies
  • Tamer rabah

    March 7, 2024 at 10:50 pm

    I think you need to disable the smart quote option in premiere pro

  • Tom Morton

    March 8, 2024 at 11:08 am

    Let me know if you get this sorted, because I’m interested – as far as I know, I didn’t think there is a way to guarantee this. Can you tell me what you’ve been using in the textReplace function? What values are you using?

    The big killer here, as far as I know, is that most font sets i’ve seen don’t include curly quotation marks as standard, because most word processors such as Word, Indesign, PagePlus etc will use an algorithm to automatically change the look of the standard double quote included in the font set, and adapt the design to look like a curly quote. These page processors also will replace missing glyphs from different font sets if required too, making the whole process very smooth.

    I would say that it would be difficult to try and imitate all this just using expressions within AFX. If you’re using a certain font set, you could create the curly quotes in that font if they’re missing. You’ll need to create open and closed quotation glyphs and then you could use textReplace() to change standard quotes out when required.

    If they’re included in the font set, you could use Character Map in word to check they’re using the right key codes.

    I know you can get curly quote marks in ASCII and Unicode, but AFX doesn’t default to either of these, and I don’t know if they have keycodes in a standard character set. If not then you might be fighting a losing battle trying to do it natively, and you’ll find it easier to use a workaround like updating the font as above.

    Not sure what else to say, but feel free to add more info about what you’ve tried and we can keep thinking…

  • Yoan Boisjoli

    March 8, 2024 at 2:56 pm

    I know you said you tried the replace function but here’s another way using the same function. Let me know if it works:

    var originalText = thisLayer.text.sourceText;

    var replacedText = originalText

    .replace(/”/g, “\u201C$&\u201D”) // Replaces all straight double quotes with curly double quotes

    .replace(/’/g, “\u2018$&\u2019”); // Replaces all straight single quotes with curly single quotes

    replacedText;

  • Jeff Hinkle

    March 12, 2024 at 3:37 pm

    Sadly, that code failed as “Invalid or unexpected token” on the .replace line. I double-checked and the Expressions are set to JavaScript. I got this very simple test code to work:

    text.sourceText.replace(“e”, “c”)

    But of course I’m not trying to replace e with c (if only life were so simple). I tried copy/pasting the (/”/g, “\u201C$&\u201D”) over the working parentheses and instantly got the fail. I also pasted a few other code snippets I found online and they all gave the same error. Are there curly vs straight quotes in the expression entry field that could cause issues?

  • Dan Ebberts

    March 12, 2024 at 8:13 pm

    This seems to work:

    value.replace(/(^|\s)(")/g, "$1“").replace(/"/g, "”");

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy