Le 02/06/2016 07:07, Scott Kostyshak a écrit :
Dear all,
I have many system fonts installed (the command `fc-list | wc -l`
gives me 1595. Can anyone beat that?). When testing LyX's XeTeX
export with system fonts and various languages, it can be a little
annoying to find a font that has the necessary symbols. What I
usually do is e.g.
fc-list :lang=he
to list the fonts that support Hebrew.
As Xe/LuaTeX are becoming more popular, I wonder if it would be worth
it to make this easier for users. The way we can do this is to have a
checkbox that says "restrict to document language". For example, the
screenshot shows all fonts that support Hebrew. I produced the
screenshot using the attached patch.
So all we would need to do is map our list of document languages to
the WritingSystem enum, whose values are listed in the table here:
http://doc.qt.io/qt-4.8/qfontdatabase.html#WritingSystem-enum Could
we do that by adding another field in lib/languages?
Does anyone think this would be worth the work? I don't actually
write anything except for English so I don't know. Maybe the way we
have things set up now is not a bother at all.
Scott
Dear Scott,
You are right, LyX deserves a better font selection dialog. I had a
quick look: there is the QFontDialog widget which has a writing system
selection menu. See https://doc.qt.io/qt-5/qfontdialog.html and
qtbase/examples/widgets/dialogs/standarddialogs/.
The lyx font selection widgets could trigger this dialog instead of the
drop-down menu. This should be easy to do. Note that this would also fix
other issues, such as not being able to select specific fonts. For
instance it is currently impossible to select Source Sans Pro Light.
It does not seem to be possible to initialise the dialog with a specific
writing system unlike what you suggest. If you find the motivation, you
could implement a custom font selection widget based on
qtbase/src/widgets/dialogs/qfontdialog.cpp (no size selection,
defaultable writing system, no underlining, etc.). Another idea is to
make the widget into a button (QToolButton) that, in addition to opening
the font dialog when pressed, also has a drop-down menu showing the
recently used fonts. That would be another way to make font selection
more convenient.
But, for a quick solution that also addresses other issues, my advice
would be to make the button open the QFontDialog.
Guillaume