Open mdavidsaver opened 11 years ago
I will check if it is possible to set font size according to widget's size. BTW, could you send the screenshots again?
It seems that attaching images doesn't work well for me...
One of the possible solutions could be to try to move towards some form of definition of fonts in pixels. I tried the following snippet which defines the font size in number of pixels and then tries to calculate the point size associated with it.
final FontData[] fd = text1.getFont().getFontData(); final GC gc = new GC(text1); final FontMetrics fm = gc.getFontMetrics();
int pixelHeight = 25; int pointHeight = pixelHeight * 72 / Display.getDefault().getDPI().y; FontData fontData = new FontData(fd[0].getName(), pointHeight, fd[0].getStyle()); System.out.println(fontData); text1.setFont(new Font(d, fontData));
I have added code to automatically scale font size to make text size fit the size of text widgets (Label, Text Update and Text Input). Note that this function doesn't work for "wrap words" Label and native Text Input. Let me know if it works for you. If it doesn't work, please reopen this issue.
Xihui, this is a critical issue for us. Please leave this issue open pending testing and verification of the fix.
Michael, do you feel this is fixed?
moving to 3.2.12
What is the status on this? has the fix been verified with Micheal?
@shroffk can you comment on if this is fixed?
At present the apparent size of widget text and widget bounding boxes do not scale together. In an environment with computers having different screen sizes and pixel densities (DPI) gives inconsistent visuals. Text which fits on one computer will be clipped on others.
In some cases this can be "tweaked" by DPI value used in rendering fonts. However, we have only found system wide controls, which causes some other applications to look strange.
In the following examples the same .opi is rendered at 75 DPI.
![Uploading boyfonts.png . . .]()
and 96 DPI
![Uploading boyfonts2.jpg . . .]()
Some discussion may also be found here:
http://wiki.mandriva.com/en/Font_Size_and_DPI
We would like to request that BOY should ensure that the relative sizes of text and widgets be constant on all systems.