Fonts & Character SetsUndesired Fonts used for ASCII Text

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Post Reply
User avatar
OsakaWebbie
Posts: 9
Joined: Thu Apr 19, 2012 2:56 am

Undesired Fonts used for ASCII Text

Post by OsakaWebbie »

Sorry, you might not be able to run my MWE as is, unless you have uplatex (Japanese UTF-8 LaTeX flavor), but I'll give you as much supporting information as I can. MWE:

Code: Select all

\documentclass{ujarticle}
\usepackage[uplatex]{otf}

\begin{document}
\sffamily  % makes the ASCII sans-serif
\gtfamily  % makes the Japanese sans-serif
\fontsize{36}{40}\selectfont
English 日本語
\end{document}
I want to keep the fonts very simple - I'd be happy if it would just use one basic gothic (i.e. sans-serif) font for everything (I'm only programatically printing addresses on envelopes). I have IPAexGothic font in the right place to be used by dvipdfmx, and it does seem to be used... but only for the multibyte text! And the font it is deciding to use for ASCII text doesn't do big sizes - my 36pt text gets shrunk to 24.88pt.

The PDF file is attached - if you look at the properties, you can see the IPAexGothic font plus two others: CMR10 and CMSS17, and those are also evident in the log file. If I remove the word English, CMSS17 will go away, but CMR10 will still be there, and apparently something invisible is using that font both in the docclass base size (10pt, since I didn't specify something else) and in 36pt - even if I put everything from begin{document} until end{document} on a single line with no spaces! And the log file mentions Mincho, so apparently there is something invisible that is being printed in serif, despite my best efforts to tell the system I don't need/want it. The log file is also attached.
Attachments
FontSizeMWE.log
(6.11 KiB) Downloaded 403 times
FontSizeMWE.pdf
(4.77 KiB) Downloaded 347 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

OsakaWebbie
Posts: 9
Joined: Thu Apr 19, 2012 2:56 am

Re: Undesired Fonts used for ASCII Text

Post by OsakaWebbie »

Any thoughts on this? I'm discovering additional problems that I think relate to those CM* fonts - they apparently use the limited original character set from the 1970's - for example, a simple ">" in my text comes out as an upside-down question mark, and replacing it with "\textgreater" results in a much larger character. I could chase each of these things one by one, but I'd rather figure out how to get LaTeX to use my TrueType UTF-8 font for everything. I sure hope someone has some insight.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10337
Joined: Mon Mar 10, 2008 9:44 pm

Undesired Fonts used for ASCII Text

Post by Stefan Kottwitz »

OsakaWebbie wrote:a simple ">" in my text comes out as an upside-down question mark, and replacing it with "\textgreater" results in a much larger character.
That's an font encoding issue (not input encoding, independent of UTF-8). The standard encoding is OT1, which doesn't support < and > characters. T1 encoding does, so you can use it directly within the text. With Computer Modern, install the cm-super package for T1 support. Even better in my opinion, is to switch to the very similar high quality Latin Modern font, which has T1 support. So I recommend:

Code: Select all

\usepackage[T1]{fontenc}
\usepackage{lmodern}
Stefan
LaTeX.org admin
User avatar
OsakaWebbie
Posts: 9
Joined: Thu Apr 19, 2012 2:56 am

Re: Undesired Fonts used for ASCII Text

Post by OsakaWebbie »

Thanks! I'm sure inclusion of those two packages and the meanings thereof are basic knowledge to long-term LaTeX users, but I'm pretty new to the game, and had spent most of my font-related research trying to get the Japanese text working right, so I'm a real noob about English font usage in LaTeX. In fact, I didn't even know it was packages that I needed, since on the Japanese side my issues were configuration files on the server and commands inside the document area. After your reply, I read about those packages and learned more, and adding them solved my main issues. The > character in T1 looks the same as what I was getting with \textgreater (big!), but that's not a big deal.

I would still like to understand why English (or probably more accurately stated, ASCII or single-byte) has to be rendered in a different font from the Japanese. On my regular PC, TrueType and OpenType fonts designed for Japanese also have all the English, European, and even other characters in them, and most software just uses that single font for both ASCII and Japanese if I mix them in text. But LaTeX seems to be handling them differently. Also, although a single Japanese font appears to be handling various sizes, weights, etc. (only one, IPAexGothic, ever appears in the PDF Properties), the English uses multiples. In the case of my envelope printing, LMSans10-Regular and LMSans17-Regular are used, and in the case of another project (song sheets) that involves smaller sizes, bold, and guitar chords (using math mode for sharp and flat), I get LMSans12-Bold, LMSans10-Regular, and LMMathItalic8-Regular. Presumably the multibyte font has the ASCII characters in it - why won't LaTex just use it? (I might not like the look if it did, but I wouldn't know until I saw it.) Perhaps this question doesn't really matter, but I'm curious to understand the mechanics.

"Give a man a fish and you feed him for a day. Teach him to fish and you feed him for a lifetime." Stefen_K's reply gave me the "fish", and that's great, but if someone can explain a little about how this works (or point me to some good documentation about it - it's difficult to know what to search for), that will help even more for the future. It's difficult even to figure out what fonts I have available (texlive2011), because the package names, the filenames, and what appears in PDF Properties are all different. If I was smarter, I might branch out from just settling for a single font - e.g. for the song sheets generator I might pick a more compressed font (something akin to a PC's Arial Narrow) for the lyrics. But since I have no idea how to choose LaTeX fonts or even what choices I have, I have so far only tried to get one font working. I can occasionally find a fish, but the art of fishing is still beyond me. ;)
Post Reply