Some troubles with fonts for embedded system - qt

When I run my application on Set Top Box the font quality degrades. The degradation manifests itself as follows:
1. The letters in a word is not the same brightness, the pixels of one letter also differ in brightness;
2. Vertical Alignment moves down, in the worst case the bottom line bump on the top.
3. There is a feeling that used font is not I wanted (although the log indicates that the font that's what I need).
Most interestingly, it's fine in the desktop version of the same code, the same fonts.
Below are additional information about used enviroment and experiments that I done.
Fonts - TrueType, is loaded into the system using QFontDatabase :: addApplicationFont;
For PC: QT 5.2.1
For STB: QT 4.7.2
I use for fonts QFont :: PreferAntialias, setStretch (100)
I have replaced setPixelSize calls on setPointSize - did not help;
Suspecting QT version - made application for PC using qt 4.8 - for this version all are well;
I have played with different weights and sizes of font - used for this font information, which pulled via QFontDatabase. Did not help;
I have tested on different plasmas with different diagonal - one result.
The last thing I have learned - DPI. Here are DPI for my PC and STB:
Physical Logical
STB 72x72 72x72
PC 90x116 96x96
Well, perhaps all. If you help I will be very grateful.

Related

Issue with mipmaps with custom sizes in WebGL2

AFAIK, WebGL2 doesn't have a limitation with texture sizes which should be power of 2 in WebGL1. But, with WebGL2, I have tried to generate mipmaps for compressed textures in DDS format with custom sizes (not power of 2) and always got an exception: "level 0 not power of 2...". I've tried with one mipmap level and miltiple levels. No luck. It only works when the sizes are power of 2. Does anybody know why? I've it tried with mipmaps created with a tool like imagemagick and mipmaps generated at runtime with gl.generateMipmap(target). No luck.
DXT definetely works for non-POT textures. It uses 4x4 blocks, so it works fine on any image whose dimensions are multiples of 4. You have to follow this rule. Originally, my texture didn't have the width / height as multiple of 4. I've tried DXT5 with width / height of mip levels which are multiples of 4 and everything works fine. Thanks.

Combined diacritics don't combine

I have a font where combined diacritics don't combine. Some applications (Adobe Illustrator) render the font correctly, one application shows the characters separately. Unfortunately, this application lives on a server outside of my control, which makes testing difficult. When I switch to another font (Arial Unicode MS), the combined diacritics are shown correctly. This application does not support OpenType fonts.
For example, U+00EA (ê) plus U+0323 (dot below) should be rendered as an e with circumflex above and dot below (ệ), but one application renders it as ê. with the dot after the ê (the dot is at the correct vertical position).
When I use View->Combinations->Ligatures in FontForge, the combination of these two glyphs is shown correctly.
Not being a font designer, I'm a bit lost. What could cause this problem?
Combining diacritics is a nice font feature but it's not universally supported. The application in question probably just doesn't support modern font features.
Combining diacritics should be designed with this in mind. Give them zero advance-width, and position the diacritic left of the glyph start position, so that it will naturally fall over/under the previous character. Unfortunately you can't get it perfectly positioned against that character; but if you make it look good over/under an a, it will probably be at least legible with i, w, etc.
This is really a stopgap measure in case of poor software, and it won't always work. For instance, high diacritics above capitals or tall lowercase letters will run into trouble.

How can I create QColor objects in Qt for the SRGB color space?

I can't seem to find (official or unofficial) documentation on Qt colors vs color spaces.
I would like to define QColor's for my Qt application. I am coming from an OS X background, where I am accustomed to having [NSColor colorWithDeviceRed:green:blue:alpha:] and also [NSColor colorWithSRGBRed:green:blue:alpha:], and other options as well.
Most of the time, I would like to use SRGB. How can I achieve that? It would be also good to know where using the default QColor(int,int,int,int) constructor leads to, but I suspect it will be device colors.
My target platform is mostly Windows, so if you can only come up with a platform-dependent way of creating QColor objects with components defined in the SRGB color space, go ahead!
QColor is just a container for four ints. Everything depends on what you use it for. You'd need to show example code of how you use the QColor instance.
In most cases, though, QColor will end up being used by the raster paint engine back end. In such case, it has the meaning of the device color. Specifically, if you paint using QColor, it is not ever seen directly by OS X drawing functions. OS X is only passed a texture/image that has been already rendered by the raster paint engine.

How to change QCursor(mouse) size in embedded linux ? (don't use QPixmap or QBitmap)

I use Qt 4.8 in embedded linux. I want to change mouse cursor(QCursor) size, it's too small, but in QCursor class there is no function can change the size.
in Qt document: http://qt-project.org/doc/qt-4.8/qcursor.html#QCursor-3
it says here that:
Valid cursor sizes depend on the display hardware (or the underlying window system). We recommend using 32 x 32 cursors, because this size is supported on all platforms. Some platforms also support 16 x 16, 48 x 48, and 64 x 64 cursors.
so my question is: how to change the default cursor(QCursor) size in embedded linux ? I'm searching for answers on the Internet, almost no one mentioned this problem !?
(I know it can use QPixmap or QBitmap to change the cursor icon, but this is not the fundamental way.)
thanks.

QT: QPainter.drawText() into QPixmap crashes under OSX Lion, not Leopard

Solved!
I cross compiled for Windows, and got my hint: The windows version crashed even before main -- so it had to be basic allocation issues. And it was. I had made a large static allocation and recently made it even larger (something the program requires, not optional or temporary); changed array[size] to array=calloc(etc,etc) and bingo, the windows version ran, and the crash deep in the bowels of OSX/Lion went away, everything runs fine again.
So, lesson learned: large static allocations, no good -- neither windows or OSX is particularly able to accommodate them.
I get a paint event. I have a QPixmap, standalone, that I will be drawing on a QWidget frame. Within the paint event call, I create a painter for the QPixmap, which lives in the class definition. I set colors; brushes, pens. I fill, I draw lines. rects. gradients. text. ellipses. it all works fine under Snow Leopard and Leopard. Under Lion, 10.7.anything, any drawText() call on this same QPixmap fails many call levels within OSX, and five levels deep in com.apple.ColorSync. Doesn't matter what font I use, or size. Both drawText() and drawStaticText() fail the same way.
The failure occurs prior to any attempt to actually draw the QPixmap -- it's during the render of the drawText() that it blows up. All I've done to that point is fill with black (works), fill with a gradient (works), draw some filled rects (works) and draw a grid (works) and then I go to draw this text. Which doesn't work, but blows out the main thread (0) (which is doing the drawing during the paint event) with EXC_BAD_ACCESS SIGSEGV.
Qt has no color management as far as I can tell. OSX has no way to turn off colorsync to the display.
For the moment, I've special cased the OS level and simply don't draw text (in the beta) if running under Lion but this is a horrible workaround.
Anyone have any ideas at all why Apple's 10.7 colorsync would get its knickers in a knot over drawText() to a perfectly vanilla QPixmap with valid size, text, rectangle, and within-bounds drawing task?

Resources