Place subscripts in a QString - string

I'm having a difficult time finding how to insert subscripts into a QString. I know it can be done with style sheets, but I can't really use a style sheet in places where I place a QString. I've tried HTML markup and UTF-8 and other unicode systems for substrings with no luck.
Hopefully someone has some more experience with this and can help out!

Depending on what characters you want to subscript, you may be able to use Unicode subscript characters without formatting.
That of course requires font and text rendering engine that support it. Don't know if Qt on your platform does.

A QString is just a string. If you're dealing with particular Unicode characters which should be subscript then fine, but otherwise what you seem to be trying to do makes no sense.
If you want to display a string with subscript formatting then you can use QTextEdit or other classes which support rich text display. You could do this with HTML markup or programatically using the relevant Qt classes. Try http://qt-project.org/doc/qt-4.8/richtext.html for more information.

Related

How to display Japanese characters in VBA editor?

I can't set Sheet.Name property in Japanese. Event file name also displays in maybe Chinese? All display well in Excel.
How can I set up the VBA editor to work with Japanese?
I changed region to Japanese.
Finally, I got to the right point.
this post is in Japanese but by picture so not hard to see that in Admitration we must uncheck [Header: World Wide language support ... use Unicode UTF-8]
maybe as #stifin mentioned, it is about wide character.
Answer

Previewing and Typing in Unicode font (Private Area / Basic Multilingual Plane) in Linux for SMuFL

I would like to make a change to an open source Android app which uses the Bravura font implementing the Standard Music Font Layout (SMuFL) fonts. I am developing on Linux.
The app displays musical notes with things like
<string name="notef_c5"> == ==</string>
which is displayed like
I now need to change things and I would like to see what I am going to do, rather than semi-randomly changing the Unicode numbers and see what happens. So I installed the font on my Linux desktop from github, by simply copying the SVG that the app is using into my global font directory and that did not work (fc-cache said /usr/share/fonts/svg/Bravura: caching, new cache contents: 0 fonts, 0 dirs). The same procedure for the OTF did work. This could be a problem down the line, since the app is using slightly modified version of the SVG, so any hint on that could help, but it's secondary regarding the question.
In fact I want to use "something" to display the font, and I tried many things, including Charmap and FontManager (which is almost the same as FontViewer). Charmap is the worst, displaying basically every single font installed on the machine even if I select just the Bravura (why is that???!) -- FontManager does the same (???!) -- FontViewer is almost passable, in that (when the "Characters" tab is selected) it display empty squares for the characters not defined in Bravura. Therefore with lots of careful scrolling it displays the "actual things" I am looking for, but it does not show their unicode values, and it's an extenuating search of few actual characters in a huge ocean of empty squares. So it's a no go anyway.
Is it possible that the best solution is just to blindly type Unicode values as described in the docs and see what happens? I know, if I were running Windows or Mac I could use Dorico SE but more generally there must be a better way of using Unicode in Linux, perhaps built for other purposes?
If you’re looking for specific symbols in the SMuFL specification, the full list of glyphs is available on the SMuFL website. (Note that the fonts themselves know nothing about music typesetting, they are simply collections of shapes to be used by a typesetting program. Even the simple example you provided is a composite of several carefully scaled and positioned glyphs, and simply changing the character codes may or may not work as intended.)
If you’re looking for ways to input Unicode characters on Linux, see the many suggestions provided here: How to type special characters in Linux?

Special characters on MFC dialog form

I can see special characters ąęį when I do form design on static text label:
These character are changed while running:
If I set these characters in programming way I have:
How can I ensure that the correct characters are displayed instead of question marks as shown in the screenshot above?
UPD:
My project is Multi-Byte. I found that in another computer I can see special characters. Why?
You need to use Unicode character set for this to work correctly, and my guess is that you're using MBCS character set now.
You could change it in the project properties. Refer to this screenshot:
Visual studio editor is fully Unicode, meaning it could display such special characters as you type when you're designing the dialog. However, if your application is not built with Unicode support, it won't be able to display thsoe characters when it runs. Thich is why you see the ??? replacing the Unicode text when you run the application.
If you get different results on different computers this is obviously due to differences in system settings.
The setting that controls this is called "Language for non-Unicode programs", and can be found under Control Panel, Language, Change date, time or number formats. Unfortunately it's a global setting (ie cannot be set per application or programmatically) and requires a re-boot.
Consider making your application Unicode, if possible (and meaningful cost- or effort-wise).

How to write superscript / upper index in Visual Studio?

It is possible, but I don't know how is it done.
Use the Windows Charmap.exe applet. In the Font combobox select a font that has a lot of glyphs, Arial Unicode MS is a very good choice. Tick the Advanced view checkbox and type "super" in the Search box. The grid will show all superscript glyphs, select and copy from that and paste into your source code.
Or copy/paste one of these: ¹²³⁴⁵⁶⁷⁸⁹⁰
Subscript characters: ₀₁₂₃₄₅₆₇₈₉
Adding more details to complement #HansPassant's answer. Other frequently used sets which can be used as is by copy/paste:
Superscript small case letters: ᵃᵇᶜᵈᵉᶠᵍʰⁱʲᵏˡᵐⁿᵒᵖʳˢᵗᵘᵛʷˣʸᶻ
Subscript small case letters: ₐ ₑ ₕ ᵢ ⱼ ₖ ₗ ₘ ₙ ₒ ₚ ᵣ ₛ ₜ ᵤ ᵥ ₓ
If you're wondering why few letters are missing in above series then please read below posts:
Where are the other letters in this Unicode block?
Why does the unicode Superscripts and Subscripts block not contain simple sequences of all letters?
Why is there no character for "superscript q" in Unicode?
Since there is a tag visual-studio-2012, I assume you are running Windows. There is a great opensource program called WinCompose, which allows to use easy-to-remember and intuitive shortcuts for a huge amount of Unicode symbols, including numerical super- and subscripts. Every shortcut is invoked via a Meta key (e.g. Right Alt), for example:
Meta + ^ + 1 gives ¹;
Meta + _ + 9 gives ₉.
WinCompose also supports search, can be run in background, and eliminates tedious procedure of calling Character Map with subsequent copy-pasting or remembering the Unicode charsets (but the latter are also listed):
P. S. I'm not affiliated with this software by any means. Just a happy user.
One more way for WPF users,
<TextBlock >
<Run>x</Run>
<Run FontSize="8" BaselineAlignment="TextTop" >2</Run>
</TextBlock>
Change BaselineAlignment to TextBottom if you want to use as subscript.
In VsCode download the extension "Fast Unicode Math Characters".
The hotkeys for ₂ is \_2.
The hotkeys for ² is \^2.
Looks like there are some simple tags that you can use to make any text superscript/subscript. The superscript tag is <sup> and the subscript tag is <sub>.
https://www.w3schools.com/tags/tag_sup.asp
use (Ctrl + Shift + P) command to apply superscript and subscript in Visual Studio.
This is how usually I tend to do it on Mac.
In the VS code, hit (Control + Command + Space) to bring up the Character selector and search for 'superscript' in the search box.
Click on required superscript and add it. And here is the result. Screenshot are from the VS code only.
This approach should work across most of the apps in the Mac. Tested in MacOS 12.5. (Monterey)
There are several solutions. Personally, I simply formaat the label text in Word, use a screen capture and save it as an image that I use with a label.

apostrophes changes when I copy and paste

When I cut and paste apostrophes between programs (ie. notepad2, notepad++, hiedisql, word, etc etc) and wysiwyg's, and source codes my apostrophe is changing a little. It looks different and it behaves differently depending on the copy source and paste source.
Is this normal? Is there any way to make sure everything renders the apostrophe the same way? is this a windows thing?
I feel like this is a new thing, but maybe it has always been like this.
Do you mean that ’ -- should look like: -- turns into ' ??
If so, your editor program is "helpfully" changing a non-Ascii right apostrophe into the only apostrophe available in Ascii, the "straight" apostrophe: ' (Or vice-versa.)
The right and left apostrophes are defined in Unicode and ISO 8859 character sets, but not Ascii.
Solution Check the docs for your editors to see if you can turn off the behavior. It may not be possible depending on the specific editing software and its version.
Added Even this editor in Stack Overflow caused me some problems: I entered the Unicode right apostrophe, and it looked fine in the editor. But the preview window (and the display of my answer) shows the apostrophe as being a "straight" apostrophe: it appears that the font used by Chrome for displaying and previewing the answer shows a straight apostrophe instead of a right one. So I added a graphic for the right apostrophe.
Blog post about the problem
For writing software, SQL, etc, you should stick to the straight apostrophe. Editors should not convert the straight apostrophe to the right apostrophe. The issues of single quotes (apostrophes) and straight quotes vs opening and closing quotes is a primary difference between a document editor and a code (software) editor. If your editor changes apostrophes and quotes for you, it can cause a lot of problems in your software. You can usually turn off the behavior of "smart quotes" or similar.

Resources