Characters are fuzzy. Where do these fonts come from?

I ran the script show below on my windows 10 based computer with 3 differenct versions of Matlab (2021b, 2013b, and version 6.1 from 2001).
The top figure in the image shown below is from Matlab 6.1 and is also identical to the figure generated by Matlab R2013b. (I looked quite carefully and I couldn't see any differences). The bottom figure is from Matlab R2021b. Note that the top line uses the default font which is Helvetica followed by 5 other popular fonts (the last two with serifs). The default font size (which is 10) has been used thruout. One fairly objective difference is that Matlab 6 uses less horizontal space for the default font and for the Lucida Fax font, but uses more horizontal space for Verdana and the Times font (when compared to Matlab 2021b). A more important difference is obvious to me immediately. The characters in the top figure are bright, crisp, and pleasing where as the characters in the bottom figure are ... well excuse my language ... shitty. Makes me think I forgot to put my glasses on. I'm I wrong to be worried about essthetics in a computational tool? I can after all read the text in both figures, but good looking figures just make me feel better (whether it's a figure on a computer screen or a person's figure). Where does Matlab get these fonts from? If it's from Windows, shouldn't they look the same in all Matlab versions? If Matlab stores these fonts internally, is there any hack to allow Matlab 2021b to import a font from an older version of Matlab. I would be happy with just two nice looking san serif fonts (one proportionally spaces like Helvetica and one mono spaced such as Lucida Sans Typewriter). By the way, although I used white characters here, the same effect is there when using black characters on a white background. Thanks for any insights you may have. ~Paul
figure('pos',[10 10 995 140],'Menubar','none');
axes('pos',[0 0 1 1],'color','black','xcolor','black','ycolor','black');
t = ['The quick brown fox jumps over the lazy dog. ' ...
'1234567890-=~!@#$%\^&*()+?>< ' ...
'THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.'];
text(.01,6/7,t,'color','white');
text(.01,5/7,t,'color','white','fontname','Verdana');
text(.01,4/7,t,'color','white','fontname','Segoe UI');
text(.01,3/7,t,'color','white','fontname','Lucida Sans Typewriter');
text(.01,2/7,t,'color','white','fontname','Lucida Fax');
text(.01,1/7,t,'color','white','fontname','Times');

1 Commento

I don't have an actual answer for you, but this is one of the reasons why I wrote my text2im function.

Accedi per commentare.

Risposte (1)

DGM
DGM il 11 Apr 2022
Modificato: DGM il 11 Apr 2022
Well, this shows up like extra-fuzzy garbage in the forum editor due to the figure resizing, so I don't know if this demonstrates anything. It looks better when I run it on desktop, but I don't have these fonts, so I'm running it here instead.
At any rate, here's a possible improvement. Try turning off the font smoothing. As far as what I'm seeing from other posts, the font smoothing in various parts of the newer versions (e.g. the editor) is what might be described as "aggressive" or "bad". That's just my second-hand impressions though. It might also depend on the environment.
figure('pos',[10 10 200 140],'Menubar','none');
axes('pos',[0 0 1 1],'color','black','xcolor','black','ycolor','black');
t = ['The quick brown fox'];
text(.01,6/7,t,'color','white');
text(.01,5/7,t,'color','white','fontname','Verdana');
text(.01,4/7,t,'color','white','fontname','Segoe UI');
text(.01,3/7,t,'color','white','fontname','Lucida Sans Typewriter');
text(.01,2/7,t,'color','white','fontname','Lucida Fax');
text(.01,1/7,t,'color','white','fontname','Times');
figure('pos',[10 10 200 140],'Menubar','none');
axes('pos',[0 0 1 1],'color','black','xcolor','black','ycolor','black');
t = ['The quick brown fox'];
text(.01,6/7,t,'color','white');
text(.01,5/7,t,'color','white','fontname','Verdana','fontsmoothing','off');
text(.01,4/7,t,'color','white','fontname','Segoe UI','fontsmoothing','off');
text(.01,3/7,t,'color','white','fontname','Lucida Sans Typewriter','fontsmoothing','off');
text(.01,2/7,t,'color','white','fontname','Lucida Fax','fontsmoothing','off');
text(.01,1/7,t,'color','white','fontname','Times','fontsmoothing','off');

5 Commenti

Ok, I tried turning off fontsmoothing as you suggested. The result is certainly different. Still pretty ugly, but a different kind of ugly. (The unsmoothed result is particularly grim for Segoe UI) Since you reported that the forum resizes images, I have uploaded the new image which you can get here:
As before the top image is from Matlab 6.1. The middle image is from Matlab 2021b with the default smoothing (i.e. 'on') and the bottom image is from Matlab 2021b with smoothing turned off.
I just added this line to the end of the script: set(findobj(gcf,'type','text'),'fontsmoothing','off');
Wow, has font technology really degraded this dramatically since 2001?
Are there any other font settings in addition to smoothing that might give some reasonable results?
~Paul
I forgot to mention that if you look closely at the top figure (from Matlab 6.1) you will see that it actually is smoothed. There is no way to turn off the smoothing because neither Matlab 6.1 nor Matlab R2013b has a property called 'fontsmoothing' for text objects. But of course there is no need to do that because these fonts look great!
As I mentioned, I don't have all the fonts, so I don't really get unique results, and they might not be much help. This is what I get in R2015b (doesn't have 'smoothing' option either)
The results I get in R2019b are identical except for a change in kerning:
... and this is what I get in R2019b when smoothing is disabled:
Like I said, I'm not really sure if this bad smoothing is an environment-specific issue or if it has something to do with changes in recent versions.
It's hard for me to tell for sure since your screen shots only include 16 characters, but it looks consistant with my screen captures of R2021b for both the smoothed and unsmothed fonts assuming Verdana is used for every line in your output except the 4th which is Lucida Sans Typwriter. This could happen if the other fonts specified in the script don't exist on your system. In any case none of your versions are old enough to see the effect I am talking about. To see it I believe you would need R2013b or older, or you could see it in my screen capture (https://postimg.cc/zb35vc7y). The top figure in that capture is from the older Matlab versions and as you can see, these fonts are smooth yet much crisper and look in focus compared to the other figures. Is this something I should let the Mathworks know about (or do they follow these forums)? Although it seems hard to imagine that they don't already know about this problem since pretty much everybody uses text on their plots. Perhaps the font specialists they had in 2001 left and they simply don't have the same knowledge about typefaces that they used to?
FWIW, this is what I get in R2009b
A lot of the graphics stuff has changed since 2014. I haven't seen any clear answers to similar issues before, and I agree that it looks terrible, so maybe contacting support would be worthwhile. You might get an answer, but I don't know if you'll get a solution.

Accedi per commentare.

Categorie

Scopri di più su Graphics Performance in Centro assistenza e File Exchange

Prodotti

Release

R2021b

Tag

Richiesto:

il 11 Apr 2022

Commentato:

DGM
il 12 Apr 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by