GeneralFont/PDF Blurriness

LaTeX specific issues not fitting into one of the other forums of this category.
InquisitorMo
Posts: 44
Joined: Mon Jul 15, 2013 12:22 am

Font/PDF Blurriness

Post by InquisitorMo »

Hello,

I have a wonderfully formatted Latex CV that I made from scratch which looks perfect in TexShop (Mac)'s compiled preview version, the text is sharp to the highest zoom, etc.

Unfortunately when actually created as a PDF, the entire document takes on a hazy blurriness, completing ruining the entire purpose of using Latex for me.

I have come to realize this is likely because I'm using a non-standard font (I'm using a system font I downloaded) and using XeLatex.

1. I'm wondering if there's anyway I can use this font but maintain the same appearance of the compiled preview document - I'm rather upset it looks so great on my computer, but I can't "get" THAT document to export into some format I can show others!

2. If not... I have tried changing the preamble to change the font, but I seem unable to get it to compile. I have been able to produce a NEW document which compiles with one of the default fonts, and it looks FINE in PDF, but when I basically copy this preamble to MY (heavily customized) document, it doesn't work - I can't figure out why...

Any help would be MUCH appreciated.

Thank you!

This is my document preamble - I have included everything because I don't know if something is causing a conflict; I also cannot get it to work, so I don't have a 'working example'.

Basically I'm trying to SWITCH this to default fonts, instead of 'baskerville' which I have used here...

Code: Select all

\documentclass[letter,12pt]{article}    %letter paper and 12 size font default

%A Few Useful Packages
\usepackage[margin=0.9in]{geometry}
\usepackage{marvosym}
\usepackage{fontspec} 					%for loading fonts %%RESET
\usepackage{xunicode,xltxtra,url,parskip} 	%other packages for formatting
\RequirePackage{color,graphicx}
\usepackage[usenames,dvipsnames]{xcolor}
%\usepackage[big]{layaureo} 				%better formatting of the A4 page
% an alternative to Layaureo can be ** \usepackage{fullpage} **
\usepackage{supertabular} 				%for Grades
\usepackage{titlesec}					%custom \section\
\usepackage{tabularx}
\usepackage{array}
\newfontfamily\smallcaps{Baskerville Small Caps SSi} %I had to DL a small caps version of Baskerville so it would work - this is the command to call that completely different font (but it's supposedly the correct matching 'small caps' font

%%reset above

\usepackage{enumitem}


\newcolumntype{R}{>{\raggedleft\arraybackslash}X}%
  %This is for the Personal Data Section - not sure about using 'X'...

%Setup hyperref package, and colours for links
\usepackage{hyperref}
\definecolor{linkcolour}{rgb}{0,0.2,0.6}
\hypersetup{colorlinks,breaklinks,urlcolor=linkcolour, linkcolor=linkcolour}

%FONTS
\defaultfontfeatures{Mapping=tex-text} %% RESET
\setmainfont{Baskerville} %%reset
%CV Sections inspired by: 
%http://stefano.italians.nl/archives/26
\titleformat{\section}{\Large\scshape\raggedright}{}{0em}{}[\titlerule]

\titlespacing{\section}{0pt}{3pt}{3pt}
%Tweak a bit the top margin
%\addtolength{\voffset}{-1.3cm}

\newenvironment{packed_enum}{ %THIS IS THE BULLET FORMAT FOR THE BULLET SECTIONS IN THE TABLE PART
\begin{itemize}[topsep={-10pt}, partopsep={0pt}, leftmargin={10pt}, labelindent={0pt}, itemindent={0pt}]
  \setlength{\itemsep}{1pt}
  \setlength{\parskip}{0pt}
  \setlength{\parsep}{0pt}
}{\end{itemize}}\vspace{-\baselineskip}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Font/PDF Blurriness

Post by Johannes_B »

Post related to Change to Default Latex Fonts?.


I never used Texshop, but instead i use texworks, which is a cross platform alternative. The document is compiled, and the build in pdfreader shows the compiled pdf. I suppose it's the same with Texshop.
Try to open the pdf in different viewers, sometimes things seem to be blurry at a special zoom level. You could also print out a page, and see how it looks.

Your code looks like taken pieces from many different places. My advice would be to take a good Introduction and do some reading.

An alternative to XeLaTeX could be LuaLaTeX. You can call the Fonts by given name, no nead to give fontspec the exact filename. Please also have a look at The LaTeX Font Catalogue.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
InquisitorMo
Posts: 44
Joined: Mon Jul 15, 2013 12:22 am

Re: Font/PDF Blurriness

Post by InquisitorMo »

Yes, they are related - I just wasn't sure if the problem was defaulting the font OR just something related to how I was creating the PDF at first.

It seems that my PDF is being created fine - I have tried different viewers as suggested, and while it does have a difference, the font is blurry (there's also a different effect I don't know how to explain - the letters seem to be misaligned slightly with some below the invisible ruled line on the page - it seems to be an optical illusion as when you zoom in it looks ok)

Also pertaining to the zoom - when you zoom fully in the PDF viewer, the font looks fine, but only at VERY high zoom, which presumably someone reading it won't use... it's blurry/distorted at full page zoom.

--

I have read online that this is because I'm using XeLatex to begin with with a system font, and that I should switch it to compile with plain Latex with the basic serif font - but as you mentioned, because I have cobbled together and then subsequently modified different codes, when I try to just remove the font formatting, it won't compile anymore.

I don't know why though, as I feel as if ALL the information related to fonts is in the preamble - if I get the preamble right, shouldn't the font compile as default with Latex? (not XeLatex or anything else)

Thanks!
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Font/PDF Blurriness

Post by Johannes_B »

I don't think the problem has anything to do with XeLaTeX. You could read a bit about fonts. A bitmap font will always looks bad when highly zoomed. Be sure to use outline fonts (they are completely scalable).

When switching to pdflatex, you can't compile. You are using fontspec, which only works with XeLaTeX and LuaLaTeX. Those engines also give you the opportunity of directly working with unicode.

If you want to use pdflatex, use something like:

Code: Select all

\usepackage[T1]{fontenc}
\usepackage{selinput}
\SelectInputMappings{
 adieresis={ä},
 agrave={à}
}
Have a look into the selinput documentation for further information.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
InquisitorMo
Posts: 44
Joined: Mon Jul 15, 2013 12:22 am

Font/PDF Blurriness

Post by InquisitorMo »

1. I'm not sure - will switching to pdflatex be better than using XeLatex?

2. I managed to get the preamble below, which I cleaned up, to compile in XeLatex with default font!

(I discovered for example that "\smallcaps" was a problem because it was referring to the system font file I was specifying originally, so I switched to "\textsc" which I believe is default.

3. When using it with the document however, it is NOT compiling, and I am getting "letter" and "overfill hbox" errors amongst 1 or two others which I think are related...

4. What can I do about this?

--
5. On TOP of this, I looked at the PDF created documents again, and I'm confused about 2 things - one is whether or not it's just the font I chose which APPEARS blurry (an optical illusion at 100% regular zoom, but it's fine at 400% zoom - so it's great at high zoom, blurry at low zoom, which is of course where most people will read it full page format), and the second is that I use a Mac Retina display which is very high resolution, and it appears to be much clearer on this screen. When I look on it however on a 'normal' screen, it's quite blurry - So this could actually be a simple fact of this font being TOO FINE for a lower res screen.
---

6. This Compiles with default font:

Code: Select all

\documentclass[letter,12pt]{article}    %letter paper and 12 size font default

%A Few Useful Packages
\usepackage[margin=0.9in]{geometry}
\usepackage{marvosym}
\usepackage{fontspec} 					

%%%%Formatting 
\usepackage{xunicode,xltxtra,url,parskip} 	%other packages for formatting
\RequirePackage{color,graphicx}
\usepackage[usenames,dvipsnames]{xcolor}

%I would like to use a letter size, so I believe this is for an A4 sheet
%\usepackage[big]{layaureo} 				%better formatting of the A4 page

%Various table and numbering packages
\usepackage{supertabular} 			
\usepackage{titlesec}					
\usepackage{tabularx}
\usepackage{array}
\usepackage{enumitem}

%Column Type used for various sections
\newcolumntype{R}{>{\raggedleft\arraybackslash}X}%

%FONTS
\defaultfontfeatures{Mapping=tex-text}
\titleformat{\section}{\Large\scshape\raggedright}{}{0em}{}[\titlerule]

\titlespacing{\section}{0pt}{3pt}{3pt}
%Bump Margin
\addtolength{\voffset}{-1.3cm}

%This has nothing to do with the fonts, but I'm not sure if it's conflicting with anything?
\newenvironment{packed_enum}{ 
\begin{itemize}[topsep={-10pt}, partopsep={0pt}, leftmargin={10pt}, labelindent={0pt}, itemindent={0pt}]
  \setlength{\itemsep}{1pt}
  \setlength{\parskip}{0pt}
  \setlength{\parsep}{0pt}
}{\end{itemize}}\vspace{-\baselineskip}

\begin{document}

\pagestyle{empty}

\par{\centering{\textsc{\Huge{My Name Here}}\bigskip\par}}

\end{document}
InquisitorMo
Posts: 44
Joined: Mon Jul 15, 2013 12:22 am

Font/PDF Blurriness

Post by InquisitorMo »

3-4. I spoke too soon - I managed to compile the document in default font.

7. It does seem to be less blurry and better aligned (I'm not sure why Baskerville, the other font, seemed blurry - I don't know if it's just an optical illusion (the letter 'e' for example is written quite differently in Baskerville than in the default font, and looks blurry in the former at low zoom)

8. I will have to look at it on a non-retina screen and with different PDF viewers to see whether it's actually better.

9. I do still have alignment errors though, with the margins much smaller than before - I'm not sure if my preamble is written correctly to format an A4 or Letter page.

10. Still as was noted, I believe you are correct that most of these issues are likely a result of the font selection combined with the PDF viewer. The built-in PDF viewer into TexShop seems to display everything much better.

11. However, it's NOT at high zoom that I have ever had a problem, but at LOW zoom (100% view) - I assume this means it is NOT a rendering problem, but rather just AN OPTICAL EFFECT of the selected font - if the font is too thick for instance, the letters can appear blurred at low zoom.
InquisitorMo
Posts: 44
Joined: Mon Jul 15, 2013 12:22 am

Re: Font/PDF Blurriness

Post by InquisitorMo »

I would like someone else's opinion of whether this test document looks blurry to them on a PDF reader, as I'm not accustomed to looking at Latex PDFs and as such am not really sure what to expect. I looked as some PDF LATEX examples online, and some look similar, but others look quite different.

1. I've managed to view the document on various computers now and while the default font DOES look better than the previous custom font, it still doesn't look quite like what I expected.

e.g. when I create a word document into a PDF document, the font seems quite clear and dark. The LATEX document doesn't look this way, it seems a bit more faded and more slightly more difficult to read to me.

(of course as noted it does look better on a higher resolution screen, but that's obviously irrelevant.)
Attachments
TestingFonts Privatized.pdf
(31.83 KiB) Downloaded 417 times
InquisitorMo
Posts: 44
Joined: Mon Jul 15, 2013 12:22 am

Re: Font/PDF Blurriness

Post by InquisitorMo »

I have created another PDF document which I have appended here created with the BASKERVILLE font (which I would prefer to use over default), as I would like someone's opinion as to whether they also see any differences between this and the default font.

I have realized upon analyzing the fonts that the Baskerville font tends to have some assymetrical thickness in the letters, which creates the well-known optical illusion that the letters are not properly aligned - this is why when zoomed in, they look fine, but when viewed from a low-zoom, they appear distorted - I'm wondering though whether anyone else detects this - it's SEEN in the small font bullet paragraphs.
Attachments
Baskerville Privatized.pdf
(38.36 KiB) Downloaded 364 times
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Font/PDF Blurriness

Post by Johannes_B »

I beg you to sit down, take a break and a very deep breath.

Your documents, not only contain different contents, but also are compiled using different engines (xetex and pdftex). How is one supposed to compare them if everything is different?

Take the following as a starting point:

Code: Select all

\documentclass{article}
\usepackage{ifluatex}
\usepackage{blindtext}
\ifluatex
\usepackage{fontspec}
%\setmainfont{Baskerville}
\setmainfont{Latin Modern Roman}
\else
\usepackage{lmodern}
%\usepackage{baskervald}
\usepackage[T1]{fontenc}
\usepackage{selinput}
\SelectInputMappings{}
\fi

\begin{document}
Straßencafé Geigenfiedler 

\blindtext
\end{document}
I am using LuaLaTeX, because i do not want to remember the filenames of the fonts. Have a look at the fontspec manual for details.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
InquisitorMo
Posts: 44
Joined: Mon Jul 15, 2013 12:22 am

Re: Font/PDF Blurriness

Post by InquisitorMo »

Yes, I realized that afterwards - I thought it wouldn't matter though as the curving ruled line 'illusion' is very obvious on the Baskerville font (I have tested it with different people and they see it as well, confirming I'm not crazy! lol)

--

I have tested both fonts using your example (though I couldn't get them to compile with LuaLatex, but they worked when I used XeLatex).

Both of the examples you gave do NOT reproduce my problem - they both display seemingly fine on my PDF viewer - there are no visually misaligned letters as there are in my Baskerville version on PDF viewer (I also changed the fontsize to footnote, which is what I'm using).

I have to assume it's something else I'm doing then...

I don't know whether my use of a special 'small caps' Baskerville font that I had to import are possibly causing it.

I checked through some of the documentation, but I felt myself getting a bit more confused; I also haven't found anything about this online...

I am going to try testing using the preamble you provided to see if I can port pieces of my document into it and see where/when it breaks.

Thanks
Post Reply