Le 25/03/2015 21:50, Enrico Forestieri a écrit :
I have verified that even scaling their width down to 1em, the svg icons are actually recognizable, so I implemented this alternative. The same is done as regards the on-screen representation. However, on screen the icons look a bit larger than the surrounding text (which maybe is good). So, I think that the method that returns the dimension of 1em in pixels uses only a rough estimate. I have verified that changing the zoom factor in the preferences, correspondingly changes also the icon dimension. One has to close and reopen the document, though.
The method Length::inPixels can use the size of an EM as optional argument :) Indeed the default computation is a bit bogus.
I have some code to add a FontMetrics::em() method giving the pixel size of one EM for a given font. However, it not possible in this place of InsetInfo to have access to the current font.
What we really miss is the option "show natural size on screen". I do not really understand whay we do not have this already, actually.
On a related idea, could you tell us what is the intent of the following code?
int iconsize = Length(1, Length::EM).inPixels(1); percent_scale = (100 * iconsize + imgsize / 2)/imgsize; JMarc