[Qt-interest] All glyphs of a font
Teaburon
teaburon at googlemail.com
Fri Sep 3 16:11:02 CEST 2010
Hi!
I would like to integrate some kind of font map in a current project. I want
to display all glyphs that are defined in a particular font in a table.
Therefore I am looking for a way to find out which code points are defined
in a font. Alternatively it would be possible to check if a glyph is defined
in the font. I already tried that, but had no success, because Qt seems to
be using font-merging all the time.
The way I tried was:
QString test = "Some glyphs";
QFont f ( "Sans" );
f.setStyleStrategy( QFont::NoFontMerging );
QFontMetrics fm ( f );
bool result = true;
for( int i = 0; i < test.size(); ++i ){
if( ! fm.inFont ( test.at ( i ) ){
result = false;
}
}
The problem with this approach is, that "result" is true although the chosen
font is not used to render the glyph in the table, but is replaced by Qts
font merging. In fact if I set the font of the table to
QFont::NoFontMerging, replacement characters are used for some of the
glyphs, even if the result was true.
Does anyone have an idea on how to do this? I looked carefully in the docs,
but did not find an answer.
Any hints would be highly appreciated,
Greetings
Teaburon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100903/890a8efe/attachment.html
More information about the Qt-interest-old
mailing list