[Interest] Dilemma with Truetype/ClearType or maybe Qt itself?
Stanislav Baiduzhyi
baiduzhyi.devel at gmail.com
Thu Apr 9 13:00:54 CEST 2015
On Thursday 09 April 2015 12:55:04 Aragon Del Francia wrote:
> Hi,
>
> i am currently developing a rather simple tool to demonstrate how unique
> ttf/otf-fonts can look like on a LED-Display.
>
> *What it does*: it renders with a given font some text on a QImage, which
> is then saved as a bitmap-output-file. That BMP is then scanned
> pixel-by-pixel and that data is used to show some LED-kind-of-image.
> As you might now, it is possible to save Bitmap-Characters into TTFs/OTFs,
> which then will be applied at certain font-sizes.
>
> *However*, when in Linux the general font-smoothing is activated (in CentOS
> found inside the appearance seetings) or in Windows the so called ClearType
> feature, those features prevent the usage of those embedded bitmaps.
> And furthermore they also alter the fonts in some ways, such as
> Anti-Aliasing and Subpixelrendering.
>
> My first thought on this was to switch off those features completely, which
> does do the job for once. But doesn't solve the problem, as you need
> administrative rights to do so, and the software needs to run anywhere
> without those.
> Then I found out that while ClearType under Windows is turned off, one can
> seperately turn it on inside InternetExplorer.
>
> *Therefore* I thought there should be some kind of way to tell my app not
> to use this feature.
> Microsoft Developer Network (MSDN) didn't help much so far. Besides the
> same kind of effect can be seen in Linux, too.
> Conclusion: There MUST be a control inside Qt which decides wether to use
> those features or not.
>
> To round this up, here is what I tried and did not work so far:
>
> - CustomFont.setKerning(false);
> - CustomFont.setStyleStrategy(QFont::NoAntialias);
> - CustomFont.setStyleStrategy(QFont::PreferBitmap);
> - CustomFont.setStyleStrategy(QFont::NoSubpixelAntialias);
> - CustomFont.setHintingPreference(QFont::PreferNoHinting);
> - CustomPainter.setRenderHint(QPainter::Antialiasing, false);
> - CustomPainter.setRenderHint(QPainter::HighQualityAntialiasing, false);
>
> Appreciate any help/advice you got on this one.
Hi,
If I understood your problem correctly, this might be helpful to you:
https://github.com/Helbrass/openjdk-fontfix/blob/master/demo/freetype/ftlabel.cxx
It is a minimal code to experiment with different freetype flags and arguments
and render the result onto QImage. So all you need to do is just cleanup 90%
of code from there, dropping fontconfig support and using strict predetermined
Freetype loading and rendering arguments.
--
Regards,
Stas
More information about the Interest
mailing list