Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, August 2007
QFontDialog fitlering


Message 1 in thread

Hi All.

Sorry to take your time.

A quick question, is there any way to set an application to only show 
allowed fonts to be for an application. For instance, I would like the 
QFontDialog to automatically set to filter Latin fonts and not allow the 
user to select any other font.

Consequently, QFontComboBox will only show the Latin fonts upon 
instantiated.

Thanks.
J.

--
 [ signature omitted ] 

Message 2 in thread

Hello,

Im using qt 3.3's QSocketDevice interface, and Im using it cause I'm in a
threaded environment and need it to be blocking. The problem is when using
waitForMore or readBlock, it's beginning to act strangely by not waiting the
set amount of time (something noticable like 20 seconds) and just skips over
the function. Does anyone know what the problem might be?

best regards,
Zahy

Message 3 in thread

Zahy Abou-Atme schrieb:
> Hello,
> 
> Im using qt 3.3's QSocketDevice interface...

Nice to know. How does this relate to font filtering? ;) (Did you hit 
the wrong button in your email client?)


Regarding the OP: I don't think there is such a functionality, IMO. Not 
even the QFont class provides a method as to find out which character 
set is supported, and from the QFont docs:

"When a QPainter draws a character from a font the QFont will report 
whether or not it has the character; if it does not, QPainter will draw 
an unfilled square."

I understand "the QFont will report whether or not is has the 
character;" as "This functionality is internal to Qt": only the QPainter 
(and other Qt classes) has direct access to this info (which characters 
are available or not in a given font).

Else you could at least have iterated over all installed fonts 
(http://doc.trolltech.com/4.3/qfontdatabase.html offers this 
functionality), create a QFont object for each (costly!) and ask this 
QFont whether it supports the latin1 character set (which again I don't 
think is possible, at least not with the public Qt 4.3 API).

Since creating a QFont object implies loading the font data itself this 
operation (iterating over ALL fonts in the system) is off course very 
memory/time consuming so you would have to cache the results and update 
them somehow upon user request ("Scan for new fonts") or each time the 
font directory (e.g. c:\windows\fonts on Win32) has changed.

 From my own experience (which is still based on Qt 3.3.x) font handling 
is one of the nastier issues (and this is not Qt's fault! Even native 
font handling with the win32 API is a nightmare!).

We implemented PDF export (with an external PDF library PDFlib) back 
then and even simple questions like "Given a QFont, which font file is 
actually used (path to truetype font)?" or "What is a suitable font 
replacement for a given font (the user has chosen in the QTextWriter) 
which is not able to print a given unicode (which font is REALLY used by 
the font rendering library in Qt)?" turned out to be really nasty - we 
had to "extend" Qt 3.3.x a bit for this (read: hack the sources, make 
certain functions public etc.)

Thanks God Qt offers PDF export now on its own :)

Cheers, Oliver

--
 [ signature omitted ]