LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 11-06-2018, 06:13 PM   #1
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Fuzzyness on LCD monitor using different DPI


There is something about the display on LCD monitors I don't understand. Recently I purchased 2 monitors 1920x1080. But the monitors were 25 inch instead of what I expected, 23.5 inch. (It does not happen often that something is better than advertised)

Anyway, the resolution was correct, 1920x1080 but everything looked BIG. So I tried to change the dpi setting usng xrandr:
Code:
xrandr --scale 1.125x1.125
Using this command, the dpi is set to 108, and characters in the console look slightly fuzzy. I can partially understand that. Lines (and the straight part of characters) used to be exactly 1 pixel wide, and now have to be 0.8533 pixel wide.

But, why were they exactly one pixel wide? Are they one pixel wide regardless when I use 8pt, 10pt, 11pt or 12 pt characters? None of them look fuzzy using the original 96 dpi. Is there some magic working which adjusts the font size in inches or mm, but keep the lines at 1 pixel?

Same goes for looking at PDFs. When I scale a PDF, characters are scaled accordingly. Still, characters large and small in a PDF look fuzzy at 108 dpi, and not fuzzy in 96 dpi. Or is that just my eyes and a psychological effect?

So I understand that some elements are fuzzy when using not the 96 dpi. But I don't understand why elements do not look fuzzy when scaled using 96 dpi. What is the magic behind?

jlinkels
 
Old 11-06-2018, 06:28 PM   #2
cantab
Member
 
Registered: Oct 2009
Location: England
Distribution: Kubuntu, Ubuntu, Debian, Proxmox.
Posts: 553

Rep: Reputation: 115Reputation: 115
Font rendering. The letters of a font are typically stored as vector graphics - lines and curves described with exact mathematical coordinates. When displaying the font on a screen those vectors can be effectively rounded to the nearest pixel boundary, making the letter shapes slightly imprecise to ensure the text looks good. (There'll be antialiasing and maybe subpixel rendering too.) When printing a document the precision available can be much higher.

But the xrandr scaling is evidently coming in after that, and misaligning the text with the screen pixels.
 
Old 11-06-2018, 11:39 PM   #3
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,808
Blog Entries: 1

Rep: Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066
Most fonts for PCs are scalable, intended for GUI use, and tuned for 96 DPI. When 96 isn't appropriate, best results are generally when using a multiple of 24, so second best are 120 (125%), 144 (150%), 168 (175%), 192 (200%), etc. Next best is multiple of 12, so 108, 132, 156, 180, etc. On the vttys (what you mean by console?) and some GUI apps, bitmap fonts are used, usually by default 9 nominal px wide by 16 high.

96 DPI for a 1920x1080 resolution screen comes out to about a nominal 23", so for a 25" screen, the match between logical pixels and physical pixels is off by about 8%, which is not close to any multiple of 12, much less 24.

I suggest you may find results more pleasant by lower level scaling, that is, setting the DPI itself directly to a multiple of 12 or 24 rather than xrandr scaling. That way the apps and fontconfig can "magically" (better) match the font tuning rather than having that effort thrown off by scaling after their tuning effects. Use xrandr with dpi or fbmm (or xorg.conf*'s DisplaySize to set logical DPI), and if the fonts are too big or too small to suit, adjust them to different values in your desktop's font settings.

Note that depending on your WM or DE, xrdb's Xft.dpi could be interfering with your intent to customize. GTK3 since v3.17 forces 96 if it hasn't been otherwise set, unless you're using openSUSE, which reverts the upstream patch that caused the change in 3.17. Whether any other distros do the same I have no idea, but I've not seen it in Fedora (indirectly responsible for the tyrannical GTK3 change), Mageia, Gentoo or Debian or any of its common derivatives, such as *buntu, Devuan or Mint.
 
Old 11-07-2018, 02:26 PM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by jlinkels View Post
Code:
xrandr --scale 1.125x1.125
i think this command does not do what you think it does.
try to reset that to 1x1 and then use Xorg's (or your DE's) dpi settings instead: https://wiki.archlinux.org/index.php...y_size_and_DPI
 
Old 11-07-2018, 05:28 PM   #5
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Original Poster
Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
@mrmazda: console = vtty. My bad. So used to KDE's konsole that I forgot it was not the right name.
You confirm my idea that something special is done to display fonts correctly. I could not imagine that, given the large number of font types and size available.
The multiple-of-12 and multiple-of-24 I had discovered as well. A scale of 1.125 is 108 dpi. I started with a scale of 1.1 and that was very unpleasant. A multiple of 24 (120 dpi) is cleaner than the multiple of 12 (108 dpi) I use now. But too small.

@ondoho Maybe xrandr --scale does something different than what I think it does (my understanding of X is very, very limited) but at least it does what I expected it to do. I remember that long time ago I had to fiddle with the dpi in the Xorg settings to get an acceptable picture on a laptop. But there was always the problem that some fonts somewhere did not have the proper sizes. I tried to avoid that, but it cannot do harm to look into it again.

jlinkels

Last edited by jlinkels; 11-07-2018 at 05:30 PM.
 
Old 11-07-2018, 05:46 PM   #6
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,808
Blog Entries: 1

Rep: Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066
Quote:
Originally Posted by jlinkels View Post
A scale of 1.125 is 108 dpi.
Only the logical DPI, unless the screen density matches the physical density. Your 25" screen being about 88 DPI physically is why I indicated 8% instead of your calculated 12.5%.
 
Old 11-08-2018, 01:12 AM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
jlinkels, the fuzziness your thread complains about is a direct result of scaling the screen with xrandr.
plese do try the dpi settings; i believe the arch wiki has all the info.

excerpt from my ~/.Xresources:
Code:
!! taken care of by something in /etc/X11/xinit.d
Xft.autohint: 0
Xft.antialias: 1
Xft.hinting: 1
!Xft.hintstyle: hintfull
Xft.hintstyle: hintslight

! my monitors dpi, calculated with 
askubuntu.com/questions/197828/how-to-find-and-change-the-screen-dpi
Xft.dpi: 99

Xft.rgba: rgb
Xft.lcdfilter: lcddefault
 
Old 11-09-2018, 06:05 PM   #8
TheLexx
Member
 
Registered: Apr 2013
Distribution: Gentoo
Posts: 79

Rep: Reputation: Disabled
Have you checked the basics? I know it can sometimes be easy to forget the little stuff. But fuzziness seems to imply that the video card is not generating the LCD's native resolution. I seem to get he worst fuzziness when the LCD has to scale. Do you get the fuzziness when drawing vertical and horizontal lines, or drawing an outline circle on a high contrast background? Just making sure you are only experiencing the fuzziness when it comes to rendering fonts.

If it truly is the "only fonts" case, I won't be much help, I'm not that knowledgeable on X's rendering of fonts. I do remember on some old-school graphics software, I was given the ability to adjust anti-aliasing. If it was turned-up to high it resulted on blurry letters. I have no-idea if X has that ability or not.
 
Old 11-10-2018, 04:13 AM   #9
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by TheLexx View Post
If it truly is the "only fonts" case
it isn't.
try 'xrandr --scale 1.125x1.125', you will see it immediately.
 
Old 11-10-2018, 09:17 AM   #10
TheLexx
Member
 
Registered: Apr 2013
Distribution: Gentoo
Posts: 79

Rep: Reputation: Disabled
Quote:
Originally Posted by ondoho View Post
Quote:
Originally Posted by TheLexx View Post
If it truly is the "only fonts" case
it isn't.
Ondoho, I'm sorry I don't understand your response. By responding "it isn't" you are saying that when you look at Jlinkels' new monitor that the lines and circles are blurry in addition to the letters that X renders. It seems presumptuous to say that, since, I assume that you have not physically looking at his monitor. I have re-read Jlinkels' two posts on this thread and he only talks about the fonts being rendered in an undesirable way. He says nothing about whether or not the non-font components are blurry or not.

There may be a new way of dealing with the problem that came about in the last decade that I am unaware of but back in my day we dealt with the problem this way. FIRST make sure that vertical lines horizontal lines and thin outline circles are sharp and clear. Then SECOND worry about how the fonts are rendered.

I gave Jlinkels the benefit of the doubt that he did the first step first, but I just wanted him to verify that for us.

If it is the case that the lines and circles are blurry, the way I would do it would be to verify that the actual native display on the new monitor is 1920x1080 and not just take it for granted. The command xrandr does show you the actual current output of your video card.
 
Old 11-11-2018, 05:00 AM   #11
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
please look at post #1:
Quote:
Originally Posted by jlinkels View Post
Anyway, the resolution was correct, 1920x1080 but everything looked BIG. So I tried to change the dpi setting usng xrandr:
Code:
xrandr --scale 1.125x1.125
Using this command, the dpi is set to 108, and characters in the console look slightly fuzzy.
have you actually tried this command?
it does not do what jlinkels thinks (adjust dpi for font rendering) - it just scales the whole desktop down, or up. the visible image.
this might be useful in certain situations, but it will certainly decrease the quality of what is visible, and it does in no way address font scaling, which seems to be op's issue.
instead of scaling the whole desktop, one should provide the proper values to the X server, that allow fonts to be rendered accordingly.
if one wants fonts (everywhere: the desktop environment, documents, web content) to be genrally smaller than normal, one could fake a higher or lower dpi, and leave the rest to freetype (which i believe is responsible for font rendering). that should yield satisfactory results.

but maybe jlinkels could tell us how it goes, and if they tried my suggestions yet.

Last edited by ondoho; 11-11-2018 at 05:02 AM.
 
Old 11-16-2018, 01:46 PM   #12
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Original Poster
Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Please be aware that I cam not complaining about fuzzyness. I am wondering why fonts are not fuzzy when I do not scale the display output with xrandr. I was wondering if fonts were generated in such a way that the Xserver knew how to align them on the 1920x1080 grid. Apparently that seems true.

But I cannot match that conclusion with these line in Xorg.0.log:
Code:
[ 18826.964] (==) FontPath set to:
    /usr/share/fonts/X11/misc,
    /usr/share/fonts/X11/100dpi/:unscaled,
    /usr/share/fonts/X11/75dpi/:unscaled,
    /usr/share/fonts/X11/Type1,
    /usr/share/fonts/X11/100dpi,
    /usr/share/fonts/X11/75dpi,
I had expected multiples op 12 or multiples of 24 here. Not multiples of 25.

The explanation on https://wiki.archlinux.org/index.php...y_size_and_DPI do not make much sense. The are talking about real screen sizes in millimeters and actual dpi. DPI does not make any sense. Monitors with a resolution of 1920x1080 come in any size from 15" to 42". This discussion is about how fonts are (or are not) adjusted according to the DPI setting of the X-server.

I tried this:
Code:
Section "Monitor"
    Identifier             "Monitor0"
    Option                 "DPI" "108 x 108"
EndSection
From the same ArchWiki page.
Xorg uses the config file:
Code:
[ 18826.964] (==) Using config file: "/etc/X11/xorg.conf"
But also:
Code:
[ 18826.964] (==) No Layout section.  Using the first Screen section.
[ 18826.964] (==) No screen section available. Using defaults.
[ 18826.964] (**) |-->Screen "Default Screen Section" (0)
[ 18826.964] (**) |   |-->Monitor "<default monitor>"
[ 18826.964] (==) No monitor specified for screen "Default Screen Section".
And indeed, the screen is rendered at 96 DPI. I have no idea as to how much of a custom Xorg.conf I have to write in order to make X render in 108 DPI.

Straight lines (like on this LQ page) are more fuzzy then when I do not use xrandr scaling. Apparently the layout of this page is calculated in integer pixels.

Circles are identical to what they were when xrandr scaling is not used. In Inkscape line thickness and position can be set at floating point values. Circles are correctly rendered, using anti-aliasing.

Something funny as well. Last week I have been working at the computer screen for many, many hours to produce a complicated report. I hardly notice fuzzyness anymore, although it is still there of course. I do notice that on other screens the characters are more crisp, sure. But my eyes and my brain simply did not notice it anymore after a week or so. I also have to add that only when looking through my glasses in a very specific angle I have the screen completely focused. My eyes are old and I wear glasses with variable strength. The bottom part has less diopters than the top part and in between there is continuous variation.

jlinkels
 
Old 11-16-2018, 04:22 PM   #13
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,808
Blog Entries: 1

Rep: Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066Reputation: 2066
Quote:
Originally Posted by jlinkels View Post
Code:
[ 18826.964] (==) FontPath set to:
    /usr/share/fonts/X11/misc,
    /usr/share/fonts/X11/100dpi/:unscaled,
    /usr/share/fonts/X11/75dpi/:unscaled,
    /usr/share/fonts/X11/Type1,
    /usr/share/fonts/X11/100dpi,
    /usr/share/fonts/X11/75dpi,
I had expected multiples op 12 or multiples of 24 here. Not multiples of 25.
75 & 100 are bitmap anachronisms with roots in X11 on 1980s Unix from which XFree86 was derived, from which Xorg was derived. Scalable fonts designed for computers are multiples of 12 & 24 with roots in Windows and fonts sized in points (1/72"). Modern app and DE scalable fonts use began in the 1990s as the Internet via web browsers began exploding. https://blogs.msdn.microsoft.com/fon...om-in-windows/ explains where 96 in Windows (and consequently CSS) came from, while https://bugs.freedesktop.org/show_bug.cgi?id=23705 and https://bugs.launchpad.net/ubuntu/+s...er/+bug/589485 speak to why we see it as we do in Xorg.

Quote:
Code:
Section "Monitor"
    Identifier             "Monitor0"
    Option                 "DPI" "108 x 108"
EndSection
That "Option" is exclusive to the proprietary NVidia drivers.

Quote:
I have no idea as to how much of a custom Xorg.conf I have to write in order to make X render in 108 DPI.
See "DisplaySize" defined in man xorg.conf and various xorg.conf* examples @ http://fm.no-ip.com/Share/Linux/ .
 
Old 11-17-2018, 12:26 AM   #14
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
i personally think ~/.Xresources is the correct place to put this setting, in slightly different syntax.
many linux wikis say the same.
please see post #7.

Quote:
Originally Posted by jlinkels View Post
I was wondering if fonts were generated in such a way that the Xserver knew how to align them on the 1920x1080 grid.
this used to be true (and still is) for bitmappped fonts, which are rendered in pixels on actual screen pixels => very sharp, 100% contrast, but often considered edgy (not round) and too small on modern monitors.
there's also the problem that resizing them means to create a completely new font that uses more screen pixels, so resizing is limited.

nowadays the easiest solution is to render fonts on a separate layer of abstraction that is totally unaware of actual screen pixels, but the result is imperfect in many ways, so various methods exist to mitigate that (hinting, subpixel rendering, anti-aliasing...).
they are vectorized, i.e. they can easily be resized on that abstract layer, independently of screen pixels.

the term "DPI" is somewhat confusing, because "dots per inch" suggests that we're talking about physical pixels here, but in my experience it has very little to do with that.
it's just a way to adjust font sizes (and a few other things that go with that) globally.

Last edited by ondoho; 11-17-2018 at 12:30 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What DPI setting for monitor? JosephS Linux - Software 1 03-24-2011 01:12 PM
how to dual monitor on laptop using suse 10.3 and lcd monitor 17''/19''? b1ue_sky88 Linux - General 7 02-05-2009 05:42 AM
analog lcd monitor not working after installing a digital lcd monitor nishlq Linux - Hardware 6 08-18-2006 02:18 PM
Issue trying to dual monitor with Dell 2005FPW LCD monitor damg Linux - Hardware 2 12-05-2005 10:13 AM
what's difference between 75 dpi and 100 dpi fonts? webazoid Linux - Software 0 07-06-2004 10:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 03:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration