QLineEdit Japanese/Chinese character 𤭢 not displayed - string

I have a QLineEdit where user will enter a name (not necessary a human name) and the character is not rendered.
It looks like:
How do I have to configure the QLineEdit encoding to get that character visible?

It looks that the solution is quite simple. It is needed to upgrade to Qt 5.5.1.
The symbol is also correctly displayed in the editor of Qt Creator 3.5.1 that is based on Qt 5.5.1. In Qt Creator 3.2.1 (based on Qt 5.3.2) the symbol is not displayed.
The symbol is displayed as rectangle in UI controls of Qt 5.3.2. However, it is correctly displayed in labels and in other text controls if the project is built by Qt 5.5.1.
It appears that at least Qt 5.5.1 is needed to find such character if it is not present in the default font of the UI control.
The default font fall back mechanism is implemented only in Qt 5.5.1, so even Q 5.5.0 cannot properly display the character if it is not found in the selected font.
I guess that the improvement is done by the Qt commit 5e3e34731b7880ac775e8f1fa156ce016e6820f1 Default implementation for QPlatformFontDatabase::fallbacksForFamily() (maybe in connection with previous [QFontDatabase] Defer the fallback families list initialization).
However, it is still possible to display that character in older Qt versions (even in Qt4). It possible to set manually font that supports needed symbols.
For example, there is font "SimSun-ExtB" in Windows that supports CJK Unified Ideographs Extension B. That font can be set manually to specific UI widgets or to the entire application:
QFont CJK_ExtB("SimSun-ExtB");
// font for widget
ui->lineEdit->setFont(CJK_ExtB);
// or default application font
QApplication::setFont(CJK_ExtB);
Of course to display a character it should be available in some system font or in application loaded font. Windows 7 by default has font for CJK Ext.B, but to display symbols from CJK-C or CJK-D some other font is needed. For example, there is a free Unicode CJK font BabelStone Han that covers some such symbols. It is possible to load it manually for application:
QFontDatabase::addApplicationFont("c:/test/BabelStoneHan.ttf");
Now the application is able to find automatically CJK-B symbols in Windows system font "SimSun-ExtB" and CJK-C symbols in "BabelStoneHan" if Qt 5.5.1 is used.
The font fallback improvement in Qt 5.5.1 mainly affects Windows, since in Ubuntu Linux the application is able to find proper fonts for symbols even with older Qt versions (if fonts are added by QFontDatabase::addApplicationFont, since there is no system fonts for CJK extensions by default).

Related

xfce4/gtk-3.0 - Changing text color for the panel DateTime widget?

I'm using xfce4 built on top of gtk-3.0. Here is the system info ...
System: Host: XXXXXXXX.XXX Kernel: 4.4.0-81-generic x86_64 (64 bit) Desktop: Xfce 4.11.8 Distro: Linux Mint 17 Qiana
I am trying to change the text color of the DateTime widget on the panel, but none of the things I have tried is working. I have a dark panel background, so I want white text for the date and time info within this widget.
I'm using the oxygen-gtk theme, so I inserted this code in /usr/share/themes/oxygen-gtk/gtk-3.0/gtk.css and restarted. But I'm still getting black clock text ...
ClockBox {
color: #ffffff;
}
I also tried installing this same configuration info in the corresponding gtk config files for various other themes and tried each of these themes, making a point to comment out their existing ClockBox configuration, if it exists. After restarting, I am still getting black date-time text for each and every one of these themes.
In addition, for any of those themes which already had a ClockBox configuration, I just changed the existing config info to be the same as the default, except for it to contain color: #ffffff;. After restarting, I still get black date-time text.
Can anyone point me to instructions for changing the text color of the xfce4 DateTime widget?
Thank you very much.
Why are you using an old development release (4.11) instead of the current stable (4.12)?
Anyway, both versions are Gtk2-based, but this version of panel might support Gtk3 plugins, which is not the case for datetime until its 0.7.0 release.
Unfortunately, there's no class available that we could use a selector:
You have the following options:
Open a request to add a css class to allow custom styling.
Investigate the use of Text Attribute Markup. It works well for clock plugin, where I can set the font & color, but not for datetime. I don't know if it's regression of 0.7.0.
Update the patch which provides GUI settings to set the labels colors.
Use clock plugin with the custom format.

Theme default Colors FG and BG for both editing and compare makes elements never seen

I am quite newbie.
After I have installed Studio3 plugin Eclipse, I got some problems of colors with Default Theme.
In these for the moment I have a not workaround situation while using the "Text compare" because I could not find how two change the color of elements which have the same color as background "black".
When black background is used, as the comparison mode uses black as default color for many elements they are hidden. I made some test with a variant grey background to find the elements, it obviously can't be used for normal use.
Where are the template definition for "comparison mode" seems the main question ?
The minimum to reach is that the black ForeGround colored elements (defined surely for white background) become white with a black background.
Elements of analysis :
The changes on other elements are taken in account in comparison mode (and obviously in edit mode which functions normally), but the elements that are not taken in account in comparison mode are black by default. So I look at a default color for not held elements, I could not find such an item. The default values that I found, and that I declared FG white, have no effect.
Thanks for help.
Trebly
Aptana Studio 3.0.7
No changes done to default parameters
context : Php
black elements in compare mode : vars; functions calls; names; syntax base;
hold elements : text; keywords (var, function, parent, class, extends, array, empty....); comments
After quite long search :
When Aptana studio3 plugin is installed, the default theme can not be well setup for others editors than Aptana such as standard comparison if you use the Aptana studio3 theme. Then you get incoherent display. The solution is simple.
To get everything right, if the application is able to hold new Aptana theme management, you must simply :
1- change the default Aptana studio3 theme for example for ECLIPSE (Base) theme
2- Change again to Aptana studio3 theme, this will reset all elements of themes (for various compatible editors)
Note : SmartyPDT (and others not tested probably) are not compatible with the theme management of Sudio3, in such case you need to stay with another theme as Studio2 (theme option in studio3). In fact the defined colors are compatible with studio2, particularly black standard text (which was default color). The incompatibility makes that you get a not a coherent fit of colors which lead to incoherency, which can't be avoided, worse black on black... for some text-elements.
Trebly

External fonts not available on XIB

Hey friends, I've added a font file (.ttf) in resources folder in XCode 4 and also in info.plist. I am able to use those fonts via code. But those fonts are not available on XIB i.e. font name appears in the list but its not getting applied onto UI components (some default font style gets applied). Any idea on this?
I found that we've to create IBOutlet for components whose font style we want to change.
Custom fonts does appear when we edit text in xib, but they don't get applied at runtime.

Help with application icons

I'm building a program in C++ (target is windows XP) using Visual Studio 2008 and I'm trying to add application icons, the ones that show up in the taskbar, explorer, desktop, etc. My .ico file has the sizes 48x48, 32x32, 24x24, and 16x16 pix in color depths 32-bit, 24-bit, 256 colors, and 16 colors. For what it's worth, I'm adding the .ico file to the binary in IcoFX.
I can get all the icons to show up like they should except for the one in the upper left corner of the program itself--the one that you can click on to bring up a menu with window size options--it still shows the default icon.
To get this little icon to change do I need a different image size or is there a completely different way of managing this one icon? Does that icon even have a specific name?
Thanks for your help.
Duplicated: How do I set the icon for my application in visual studio 2008?
According to one answer on that thread, you need to make sure that your icon is the first icon in the resources file.
Ok, I've figured it out:
I'm using wxWidgets as my GUI toolkit, so this is the only satisfactory answer I can give. wxWidgets has classes to set the main frame icons, those classes include wxIcon and wxIconBundle. Then wxTopLevelWindow::SetIcons can be used to set the application's icons. This sets ALL the icons (taskbar, main frame, alt-tab chooser, etc), no need to mess with a resource file in Visual Studio.

How to have subpixel rendering of font for LCD (cleartype on windows) on linux?

I am working on embedded system, with own windowing system and rendering library. Before someday when I installed Ubuntu, to my surprise it has LCD subpixel rendering. It really looks cool to have it on my device. Because it is very readable.
Currently I ask for particular glyph in freetype, freetype gives me one memory buffer with values of alpha, with that it is not possible to have subpixel rendering. What I have is normal antialiazed font. As in subpixel - rendering left most pixel of font is anti-aliazed with Red and Rightmost with Blue ( Assuming Screen is RGB ).
Is there any methods with which freetype can give me information that whether current pixel is left or right or centerone?
Thanks, Sunny.
freetype can do it
As you point out, the desktop environment you're using (GNOME, KDE, whatever) may implement this. The setting for it varies by environment.
As to how to do it in your own code, you can use the same routines the window manager does (Gtk+ on GNOME, Qt on KDE, etc.), or you can use a separate library like FreeType or SDL_ttf. Antialiasing -- the generic term for this, as ClearType is a patented algorithm specific to Microsoft -- is usually optional in these libraries, disabled by default for speed.
I think that libcairo is at the bottom of most GTK applications in Ubuntu that do antialiasing. I think that whether subpixel rendering is done specifically for an LCD screen is something the user chooses, not the application author. The user controls it through the "Fonts" tab of "Appearance Preferences" in System -> Preferences -> Appearance (which can be run manually as the binary "gnome-appearance-properties") and clicking on the "Subpixel smoothing (LCDs)" option.
Maybe there's a way that an application can override this setting for themselves? Not sure why they'd want to, though, since an app doesn't control what kind of display the user is using.

Resources