How to set individual font color using extendscript - extendscript

I have created a paragraph text in after effects using Extendscript
For example i have a text "HI". I need to give color for "H" as red [1,0,0] and "I" as green [0,1,0].
I have checked everywhere ,. where i can find out that i can change the text color in whole rather than individually ! is there anything that can be done?
I need to change color of each and individual characters using script

It looks like it's not possible. The text in a text layer is a TextDocument object, and when you look at the AE scripting guide it says
TextDocument fillColor attribute
textDocument.fillColor
Description
The text layer’s fill color, as an array of [r, g, b] floating-point values. For example, in an 8-bpc project, a red
value of 255 would be 1.0, and in a 32-bpc project, an overbright blue value can be something like 3.2.
NOTE: If the text layer has different fill color settings for each character, this attribute returns the setting for the first character. Also, if you change the value, it resets all characters in the text layer to the specified setting.
Type
Array [r, g, b] of floating-point values; read/write.
The important bit is the Note. The same thing applies for all the text attributes like fontSize, fill, stroke &c., &c..
So for some reason you can't access the style attributes for anything but the first character in a line of text. Are you annoyed? I am. Perhaps log a bug with Adobe—it will be completely futile, but you might feel better.

Related

Letter Spacing on Curves SVG Makes Letters Tilted Using D3

When I add letter-spacing style to my text on path in D3, it tilts the letters and they don't follow nicely the circle anymore (see highlighted letters on image 2)
You can see my D3 code in this notebook
I've tried to do it in InkScape and it looks like it handles the letter-spacing differently (see image 3)
The style in the inkscape for the text is
font-size:17.6389px;line-height:1.25;text-align:center;text-decoration-color:#000000;letter-spacing:5.29167px;writing-mode:vertical-lr;text-anchor:middle;white-space:pre;fill:#990000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3.77953;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers;stop-color:#000000
and for textPath is
font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:17.6389px;font-family:Arial;-inkscape-font-specification:Arial
I've tried to use some of these attributes, but I cannot get the same result in D3. I would like the letters to be straight as in InkScape
Thanks for your help.
It might be impossible to center the letter with the letter-spacing attribute to be tilted symetrically.
I ended up creating a function that add non-breakable spaces between every character d.data.split("").join("\xa0".repeat(d.space)) where d.data is the text and d.space is the number of spaces inbetween every letter. This is just good for me now and give the following result.

Create Overstrike Effect In A Cell

I have been asked if there is any way to get Excel to produce an overstrike effect in a cell. My first attempt was the use the BACKSPACE character:
="A" & CHAR(8) & "B"
But the display does not seem to honor the BACKSPACE:
Is this a font problem? Is there a unicode approach ?
I hate to tell the client to search for a custom font.
EDIT#1:
For example. This code:
Sub XBar()
ActiveCell.Font.Name = "Arial MS Unicode"
ActiveCell.Value = "X" & ChrW(773)
End Sub
Visually produces:
but this is not a general solution.
You can extend the character set by putting one character on top of another BUT you can only do this with a limited set of symbols. These are known at the "Combining Diacritical Marks" and usually live towards the end of the font set.
For a spreadsheet document, I wanted to put in 9 recurring (ie 9 with a dot above it). This does not exist as one character but can be made by combining two.
First of all put in the 9, then from the Combining Diacritical Marks, choose the . and one will go above the other. I actually had to do this in Word and then copy and paste the new characters back to Excel to make them work.
Once in Excel, I used a look up to convert the digit 9 into the dotted digit 9 wherever I needed it.
Different fonts have different ranges of these characters. Arial Unicode MS has some unusual ones. You need to look at the fonts and choose the most appropriate for your needs.
However, on the whole, I don't think you can put a B on top of an A!
Are you trying to do this?
If so, then select the character(s) you'd like to strikethrough, click the arrow icon in the font section (circled below) and tick the box next to strikethrough.
See here for more information.

Adding object to paragraph style in InDesign

I am trying to add a short underline in the paragraph style for my inline headlines. At the moment I am doing it with Paragraph Rules - rule below + offset and right indent (see attached image, the orange line). But this solution only works if the columns are always the same width.
Is there a way to add a object/line, with a defined width, to a paragraph style?
Spontaneously, would say no. However that would be easy to set while adding some contents. You could however use a dedicated character style (underline) taht you would attach with agrep style to a tab character. Then you can control "rule" width with a tab position.
Sure. Here it is…(and now just adding characters so stackoverflow will accept my if not too brief message…)
The fact is that you need to add a new line and type in a tab character. The presence of that tab will draw the "rule".
Other solution is to use both "Above" and "Below" rules.
Playing with below's weight, color (white), offset and left indent would make it independent on column width (ruleAbove has entire column range)
Here is how I would solve it:
Create a Stroke Style with Pattern Length = to the page size of your document (not text frame or column) and Length = to whatever length of your line should be.
Example:
Pattern Length = 8.5in (letter size paper)
Length = 1in (width of line under paragraph)
Use Rule Under in the paragraph style and apply the stroke style you created. Make sure to set Width to "Text".
Apply any color/offset, etc. options.
This will work independently of the text column width and text length.

How do I change the color of each letter in a sentence in LaTeX?

I've been struggling in find the solution for the following problem.
If I want to change the color of each letter in a sentence in latex, how can I do it? Let's say that I want to write "Merry Christmas" using the colors red and green and alternating between them.
I want to define a command and use a forloop to change the color of each letter, but I don't know:
How can I find the number of letters in a sentence (excluding spaces) to give the upper limit for the forloop?
How can I define a string with the two colors to use in the forloop?
So far my silly "solution" is to do it manually, like:
\documentclass[a4paper,12pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage{xcolor}
\begin{document}
\textcolor{red}{M}\textcolor{green}{e}\textcolor{red}{r}
\textcolor{green}{r}\textcolor{red}{y}\textcolor{green}{C}
\textcolor{red}{h}\textcolor{green}{r}\textcolor{red}{i}
\textcolor{green}{s}\textcolor{red}{t}\textcolor{green}{m}
\textcolor{red}{a}\textcolor{green}{s}\textcolor{red}{!}
\end{document}
From what I saw I can define an environment and use a loop to alternate between the colors, I don't have a sensilble solution, but it would be something like:
\newenvironment{redgreen}{
\forloop{WORDNUMBER}{1}{\VALUE{WORDNUMBER} < \LENGHT{WORDNUMBER}}{
\textcolor{red}{WORDNUMBER}
\textcolor{green}{WORDNUMBER + 1}
WORDNUMBER = WORDNUMBER + 2
}
}
The parts with capital letters I know won't work, I just want to give an example of what I'm willing to do. I want to find a way to get the number of letters in the sentence that I would put inside the redgreen block and somehow use the forloop to change the color of each letter in the sentence alternating between red and green. I'm not sure how the forloop works in latex, so everything in the example above may be trash.

Setting Color for Category Lines

I have a view that displays data from several categories, where the category (bug severity in my case) is color-coded into the background color of individual entries. Now I'd like to apply the same background color to the category line itself.
As the column setting the background color for the rest of the line isn't displayed in category rows, the setting isn't applied. Is there a workaround for that?
Taken from: http://www-10.lotus.com/ldd/nd6forum.nsf/0/2765b9380021c666852572d800589f9d?OpenDocument
Here is an awkward method that works to color your category rows
differently.
Put a column before all the categorized columns. This will be your color column. Check the Use Value as Color property of the column
properties.
Use one of the functions below:
#If(#IsCategory("any")="any";any;1:1:1)
#If(#IsCategory("x")="y";z;1:1:1)
Note: in the function above, where the word "any" appears, or "x" "y"
and "z", it can be anything, matching or not. It will always evaluate
to false. If you try just #IsCategory, it will error out because that
doesn't return true. And no match you try will ever cause a true
comparison.
That said, the result is that all rows will be colored black if they
are not categories. This overrides the default text color. If you want
another color than black, then adjust the 1:1:1 accordingly
(red:green:blue up to 255 for each position, red= 255:0:0)
Now go to any column and set the text color to the row you want your
categorized rows to appear in, and click Apply to All. Voila!
I was trying to figure out how to do this programmatically and then I wondered, why not just borrow from the mail template? I'd like to suggest you check into how the ColorProfile is used there to allow users to change their color preferences based on a field value (sender name) and see if it can be done for your case.
Or, have them either access the view via a browser client or XPages in the Notes client and assign a class to that dependent on the severity.
You could build the category column formula with HTML such that when it is severe the value is "<tr class='severe'><td>CategoryNameValueHere</td></tr>" or something along those lines, right?

Resources