Le 25/07/2017 à 14:36, Jean-Marc Lasgouttes a écrit :
Hi Guillaume,
The commit log for b30f8d3c says: " CountExpanders() is moved to
FontMetrics to fix a discrepancy with the duplicate implementation from
598f7e4a."
I interpret that to mean that countExpanders() should be available in
GuiPainter too, right?
OTOH, countExpanders is basically a plain function and it seems weird to
require a FontMetrics object to compute it.
Is there a reason why it is not a free standing function somewhere in
support/ ?
Hi Jean-Marc,
The reasoning was that how many expanders there are in a string is
toolkit-specific. This implementation was by testing and reading the
docs and source code of Qt, and does not correspond to my knowledge to
any Unicode standard (say). So, using the frontends/ virtual interface
is more appropriate, and virtual functions cannot be non-member nor
static. Concretely, the FontMetrics object is used to know which
frontend one refers to.
In contrast, it seems that support/ contains non-UI related Qt tools
that could still work with other frontends (e.g. command-line
interface). (Or maybe I am being too optimistic.)
I you say that for countExpanders this looks like an overzealous
application of the frontend separation I will agree. But if the question
was just out of curiosity and does not limit you then I would say leave
it as is.
Any clarification on Qt in support/ vs. Qt in frontends/ is welcome.
Guillaume