qt


Qt QFont Kerning - Not Affecting/Kerning Font


Problem: Kerning my QFont has no affect on the font's kerning as displayed in my QApplication.
In Qt, kerning is applied to a QFont by default
Tried QFont.setKerning(True) unsuccessfully
QFont.setKerning(False) also has no affect on font display
Font is OpenType (.otf) and QFont.kerning() returns True
Kerning this font in other applications e.g., Microsoft Word is successful
Other QFont methods, such as QFont.setLetterSpacing work successfully on this font
Font is Idler, filename is Idler-Inner.otf
Apparently no one else is having this problem. Can't find anything on this topic.
Update
This seems related to the font type. I'm able to kern ttf fonts and am unable to kern other otf fonts in Qt. While otf>ttf conversion is a solution for some fonts- for others like mine it seems to destroy the font.
It's surprising that Qt isn't supporting kerning of a major font type. Otherwise the only solution I can think of is hacking the font (converting to ttx and somehow manually converting to ttf in a way that doesn't deprecate it).
Too much work for a font; at least for a developer for a font.
Looking at the source code in qfontengine.cpp, I find a function loadKerningPairs. This contains the line
QByteArray tab = getSfntTable(MAKE_TAG('k', 'e', 'r', 'n'));
which appears to load an old style TTF kerning table from the font's main list of tables.
This kerning table contains pairs of characters and their associated adjust value. It gets stored in the QFont, and when drawing, a simple look-up retrieves the values.
However, in modern OpenType fonts (either TrueType or Type-1 flavour), the kern subtable may not be present because the OpenType feature GPOS is much more powerful. The binary format of this table is also much more complicated; for instance, rather than individual characters, one can define character classes for left, right, or both characters to be kerned. It seems this, as well as other OpenType features, have not been implemented in QFont (yet, per 11-Sep-2016).
GPOS does not only define kerning, but lots of other functionality as well, such as custom tracking for capitals, superscript and subscript positioning, and automatic placement of accents on or under characters, and for all these features you can specify different values for different script types and even distinct languages.

Related Links

How to stop the transition animation in QML?
How does Qt on Windows draw exactly? Does it call GDI internal to draw?
QML: aliases to children properties
QTreeView remove decoration/expand button for all items
Share window created in Qt C++ with PyQt
Qt: QLineEdit cursor moves to end after textChanged() or commitData()
How can I extract plain text (no markup) from QWebElement?
How can I paint on a specific pixel in BlackBerry 10, Qt QML Cpp
Size of Qt containers: is QMap much larger than Qlist?
Qt QProcess Complains about QThread::Start , Thread Creation Error
QML Repeater itemAt not working
How to reach a Qt widget from another class
Qt Popup as a completer window
What does (set PATH=…;%PATH:)=^)%) mean in a Windows shell script, and how can I overcome failure of this line in the context of a Qt5 nmake build?
Make a private C++ function visible to Qml
How to clip left side of column cell when resizing a pyqt tableview

Categories

HOME
elasticsearch
protocol-buffers
typelite
functional-programming
angular-ui-grid
devexpress
jersey-2.0
malware
polymer-2.x
cocotb
elastic-load-balancer
fireloop
buffer
ex
trace32
asciimath
restier
high-availability
pyspark-sql
mapnik
rust-cargo
custom-keyboard
subclassing
nsuserdefaults
microsoft-ui-automation
classnotfoundexception
viewcontroller
hypothesis-test
opal-framework
code-push
nuclio
directwrite
libreoffice-writer
karabiner
maven-jaxb2-plugin
webvtt
gnome-terminal
business-rules
d3v4
perl-data-structures
email-injection
nclam
visual-studio-monaco
carmen
piping
adp
maximize
jeasyui
jemdoc
fdt
currency-exchange-rates
management-studio-express
pack
m4
lovefield
mousehover
screen-orientation
auto-generate
hmisc
fantom
sequence-sql
angular-amd
pass-by-value
jcheckbox
ildasm
loginview
lumia-imaging-sdk
accessory
jini
jack
form-for
unicoins
aero
django-filebrowser
lynx
server-name
wmd-editor

Resources

Encrypt Message