How do I properly display Korean text with TextOut? - visual-c++

I am compiling with the UNICODE directive, so all CStrings are in Unicode. If I place "봉재" into a CString, select a font with "Arial", then use TextOut or TextOutW to display this text, two boxes are displayed.
If I add Latin characters to the text, e.g. "봉재 ABC", then the display becomes two boxes followed by " ABC".
However if I add certain other CJKV characters to the text, e.g. "봉재 /元", the then display shows the text of my CString.
I am guessing that TextOut examines the text, and if certain characters are found, it substitutes fonts for the best display. If my theory is correct, then by adding certain oriental characters to a string, I can force TextOut to substitute a Unicode font, but if I add other oriental characters, TextOut does not substitute the correct font, and the display is inadequate.
How can I get TextOut to always substitute the correct font, or to otherwise display text consistently?

Note that "Arial" doesn't support CJKV at all, it's just a Latin font. If you want wider Unicode support while maintaining the look of the Arial typeface, use "Arial Unicode". Otherwise, use another font for which you first check that it contains all the glyphs you need rendered.

Related

How to pad text with spaces in Labview

I would like to left-pad spaces in a string as needed so it is always 8 characters long. I would also like to limit the initial string to 8 characters. Example:
Given string of "1234", should become "\s\s\s\s1234"
Given string of "123456789", should become "12345678"
I've tried "Scan From String" function using a format specifier of %8.8s, which I thought should limit the original length to 8 or less characters, and then pad spaces as necessary, to ensure a maximum of 8 characters in total.
I was expecting "1234" text to be turned into " 1234" but it just returned "1234".
It's labview "G" code so I can't enter text code.
You did not include a picture, so I am not sure if you are using the right VI, but you should be using the Format Into String VI. The parameter that you are looking for is called Width (see more about specifier syntax here).
Here is how you would use that to do what you are asking:
To see the spaces, make sure the string constant or indicator is set to view slash codes

Userform Input Small hyphen & Long hyphen? (✱Using symbols in Excel)

I am entering a string in a Userform in Excel-VBA from the user side of the form. I would want to know how to enter the Long Hyphen.
The Small Hyphen would be Shift + - the (the minus sign button next to 0).
How would you enter the Long Hyphen on the form as I am doing a string match in my VBA code on the back-end? It can be entered with Alt+0150, but is there another simpler way?
If the option of entering the Long Hyphen doesn't work then I will handle this value on the back-end through a find and replace method or something in VBA.
👆 There is only one "Hyphen"...    It's part of a ᖴᗩᗰᎥᒪƳ ᴏғ ᑕᕼᗩᖇᗩᑕ丅ᗴᖇᔕ called Dashes.
Examples:
Hyphen [-] (-)
Minus sign [−] (−)
En dash [–] (–)
Em dash [—] (—)
✱ Your browser might render them differently, but the fonts above are supposed to be [Consolas or Courier 13px] and (Arial or Helvetica 15px). While they all kind of look the same in this font, those are four different characters.
The characters can be copy/pasted directly from here - − – — into Excel (but not to the the VBA Editor), or can be produced along with 136,686 other Unicode characters, either:
with a worksheet formula, using the ᴜɴɪᴄʜᴀʀ function:
=UNICHAR(9733) 'produces a [★] star character.
programmatically with VBA, using the ChrW function:
Range("A1") = ChrW(9743) 'puts a wee [☏] rotary phone in cell A1.
More about dashes —
What they are
How to use them
"Stealing" Unicode characters from websites
There are all sorts of handy Unicode symbols — so many that it can be hard to find "just" the right one.
However you can (and will!) find other Unicode symbols on web pages that you want to use programmatically. All you need is the symbol's code, which can be determined easily:
Copy/paste the symbol from your browser (being careful to copy only the single character; no spaces, etc.) into a cell in Excel
then, go to VBA's Immediate Window ( AltF11→CtrlG ), type:
MsgBox AscW([a1])
...(Where A1 is the cell with the character). Hit Enter, and the character's Unicode code will display.
You could also use Windows' built-in Character Map utility, or one of many third-party browser plug-ins. You can even paste a symbol directly into Google to learn more about it:
Finally, no discussion on the topic of Unicode would be complete without links to:
  👉  The Unicode Consortium (unicode.org) and,
  👉  “ȶɦɛ 𝓒𝓸𝓸𝓵 𝕱𝖆𝖓𝖈𝖞 Ⓣⓔⓧⓣ 𝔾𝕖𝕟𝕖𝕣𝕒𝕥𝕠𝕣”  (Yes, those are all plain text characters.)
...and if you're looking for a unique gift, or just want your name to go down in history for something that really matters, you can even adopt a Unicode character, starting at $100 ᴜsᴅ!
Special thanks to Vinton Cerf for adopting the Unicode Leonard Nimoy's "Live Long and Prosper" symbol.
                               🖖

How to set individual font color using 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.

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.

how to set colour in jtextarea(java) to only some characters from the string, not to entire string?

How to set colour in jTextArea(java) some characters from the string, not to entire string?
I haven't coded in Java in a while, but could you try creating a substring of the text you want to create a specific color, then set the color of the substring to the desired color. I hope that makes sense.

Resources