2

I have a document with a mix of Latin and African (Tifinagh) scripts.

\documentclass{book}
\usepackage{fontspec}
\setmainfont{Ebrima}

\begin{document}

ⵖⵉⴽⴽⴰⴷ ⵙ ⵎⵔⴰⵡ ⵉⵙⴳⴳⵯⴰⵙⵏ, ⵔⴰⴷ ⵢⵓⵜⵉ ⵍⵍⴱⴰⵙⵜⵉⴽ ⵉⵙⵍⵎⴰⵏ ⵖ ⵢⵉⵍⵍ.

Latin regular
\textbf{Latin bold}
\textit{Latin italics}

\end{document}

It turns out that the Latin scripts is rendered in bold correctly but isn't rendered in italics. Why is that? Is there a convenient way to mix Latin and African scripts in a single document while at the same time still have italics applicable to the Latin script?

Tfovid
  • 123
  • Are you sure Ebrima has an actual italic version? If you're new to all of this it's important to understand that that little I button in Microsoft Word occasionally selects a specially designed italic version of the font you're using, if the font is quite professional. But a lot of the time, it fakes it with essentially a slant and various italic corrections. True italics aren't just a slanty version of the normal font, it's a totally different font with totally different versions of each character designed specially to look like italic handwriting – Au101 Jun 29 '17 at 18:56
  • If your font doesn't have an italic version you may find this helpful, although it is quite interesting that the font does seem to have a bold version – Au101 Jun 29 '17 at 18:57
  • I am actually using Ebrima since it's the only one (to my knowledge) that can render the Tifinagh script, although it is indeed unlikely that it supports italics. But my problem wasn't with the Tifinagh script, but rather with the Latin script, which could not be italicize.

    Ideally, what I want to do is to be able to seamlessly mix Tifinagh and Latin scripts in the same document and still be able to use textit and textbf. The latter works on both Tifinagh and Latin but not the former.

    – Tfovid Jun 29 '17 at 19:07
  • But it's the same font you're using for Latin and Tifinagh, so that font needs to have an italic version with an italic a for \textit{a} to work. Otherwise it won't. If it doesn't, that's the reason for your problem and you should see, for starters, whether \setmainfont[AutoFakeSlant=4.0]{Ebrima} helps. The script has nothing to do with it, I'm talking about the font. I mean it's true many scripts don't have a concept of italics per se, but that's not really here nor there – Au101 Jun 29 '17 at 19:09
  • Right---I didn't realize that Ebrima encompassed both scripts. I've tried [AutoFakeBold=4.0] and it doesn't make a difference. Bold always worked for both Tifinagh and Latin anyways. It's the italics that's problematic. – Tfovid Jun 29 '17 at 19:16
  • Yeah sorry about that, I realised too late I'd copied across the wrong thing from the linked post. I edited but obviously you didn't catch it, try \setmainfont[AutoFakeSlant=4.0]{Ebrima} - that's what I meant to write first time! :P – Au101 Jun 29 '17 at 19:16
  • Also little site feature, everything I write under your post you get notified about by the little white on red 1 in your inbox - because it's your post. But because it's not my post, when you reply to me, I don't get any notifications. To reply to a user, use @ , as in @Tfovid, this isn't necessary if you're commenting to the OP on their post, but if somebody wants to address me they can write @Au101 and I will get a notification (cause of the @) and so will you, cause it's your post they're writing on – Au101 Jun 29 '17 at 19:18
  • @Au101 Your trick worked, thanks! That said, I guess I'll be stuck with this Ebrima font all throughout my document? I was hoping that the Latin script would instead default to the usual Latin font of, say the book or article document class, but that's clearly not the case. – Tfovid Jun 29 '17 at 19:24
  • 1
    Oh you can make that happen, I didn't realise that's what you wanted, however, you do need to introduce a font switching command - otherwise how does XeTeX know that you want to use a different font? So what you wanna do for that is: \newfontfamily{\TI}{Ebrima} in your preamble. And then in the document you would have Hello world, here is some English. {\TI ⵖⵉⴽⴽⴰⴷ ⵙ ⵎⵔⴰⵡ ⵉⵙⴳⴳⵯⴰⵙⵏ, ⵔⴰⴷ ⵢⵓⵜⵉ ⵍⵍⴱⴰⵙⵜⵉⴽ ⵉⵙⵍⵎⴰⵏ ⵖ ⵢⵉⵍⵍ.} Back to English. Hi. Obviously get rid of \setmainfont{Ebrima} that, well, it sets the main font, the default font, to be Ebrima :P – Au101 Jun 29 '17 at 19:30
  • @Au101 Almost there! I just need a way to tell \newfontfamily{\TI}{Ebrima} that Tifinagh can also be faked into italics. How do I weasle in the AutoFakeSlant command in this case? – Tfovid Jun 29 '17 at 19:37
  • I attempted \newfontfamily{\TI}{Ebrima[AutoFakeSlant=.3]} but it doesn't work. – Tfovid Jun 29 '17 at 19:46
  • Yeah you need to do it like before \newfontfamily{\TI}[AutoFakeSlant=.3]{Ebrima} should work, optional arguments (in [ ... ]) go outside mandatory arguments (in { ... }) – Au101 Jun 29 '17 at 20:08
  • @Au101 Perfect. Thanks for all the help! – Tfovid Jun 29 '17 at 20:17

1 Answers1

5

If I head over to the Microsoft typography page for Ebrima, I see "Other Variants: Ebrima Bold", but no italic version. This is the root of your problem I believe. I don't have Ebrima on this computer, but I suspect you would have received warning messages along the lines of the ones I get if I try Noto Sans Tifinagh:

LaTeX Font Warning: Font shape `EU1/NotoSansTifinagh(0)/m/it' undefined
(Font)              using `EU1/NotoSansTifinagh(0)/m/n' instead on input line 1

And:

LaTeX Font Warning: Some font shapes were not available, defaults substituted.

The issue here is that, in order to use \textit{...}, you need to have an italic font available and Ebrima doesn't seem to have that. Similarly, in order to use \textbf{...} you need to have a bold font available. Interestingly, Ebrima does seem to have one of those, which is why \textbf{...} works and \textit{...} doesn't.

What a lot of people don't realise about italic type particularly, is that it isn't really just slanty writing. Rather, it is a totally different font with totally different versions of each character designed specially to look like italic handwriting:

In typography, italic type is a cursive font based on a stylized form of calligraphic handwriting. Owing to the influence from calligraphy, italics normally slant slightly to the right.

https://en.wikipedia.org/wiki/Italic_type

As such, many high-quality (and some not-so-high-quality) fonts will come with specially designed italic variants.

It's actually the same with bold. You can fake bold quite easily, but you won't get the same high quality results you would get from a bespoke selection of bold characters. However, it's when we get to italics that this is especially noticeable, with many fonts having italic variants with radically different characters.

However, a lot of people are used to Microsoft Word's (and other WYSIWYG programmes') magic I button. What that does is to select the italic variant of the font if one exists, but if one doesn't, it simply fakes it with a bit of a slant, essentially producing oblique type, rather than true italics. However, again, as with bold, best results will be obtained from a bespoke slanted/oblique variant and some fonts come with one of those as well, rather than leaving it up to some algorithm.

So, to sum up, what's happening with you is you're setting up your document to use Ebrima with

\setmainfont{Ebrima}

And then you're trying to get some 'italics' with \textit{}. The trouble is, when you use \textit{}, XeLaTeX tries to use the italic variant and, oh dear, there isn't one. So it substitutes the next best fit, which, unfortunately, is just the upright version. So what can we do about that? Well, just like Microsoft Word, we can fake it too:

\setmainfont[AutoFakeSlant=4.0]{Ebrima}

\textit{} will now give you oblique type, although it may not look as good as if the font had come with its own specially-designed oblique variant.

However, from the comments, it appears that what you really wanted was not to set the whole document in Ebrima, but just to use a Tifinagh font for Tifinagh, because the default Computer Modern font doesn't have support for Tifinagh. Well that's no problem, however, you do need to introduce a font switching declaration - otherwise how does XeTeX know that you want to use a different font? So what you wanna do for that is:

\documentclass{book}
\usepackage{fontspec}
\newfontfamily{\TI}[AutoFakeSlant=0.3]{Noto Sans Tifinagh}

\begin{document}

Hello world, here is some English. {\TI ⵖⵉⴽⴽⴰⴷ ⵙ ⵎⵔⴰⵡ ⵉⵙⴳⴳⵯⴰⵙⵏ ⵔⴰⴷ
  ⵢⵓⵜⵉ ⵍⵍⴱⴰⵙⵜⵉⴽ ⵉⵙⵍⵎⴰⵏ ⵖ ⵢⵉⵍⵍ} \textit{Back to English. But this
  time, it's italic.} \textit{{\TI ⵖⵉⴽⴽⴰⴷ ⵙ ⵎⵔⴰⵡ ⵉⵙⴳⴳⵯⴰⵙⵏ ⵔⴰⴷ ⵢⵓⵜⵉ
    ⵍⵍⴱⴰⵙⵜⵉⴽ ⵉⵙⵍⵎⴰⵏ ⵖ ⵢⵉⵍⵍ}}

\end{document}

enter image description here

I've used the AutoFakeSlant option to give you 'italics' in Tifinagh as you requested, but it's worth noting that the cursive italic style is really a Western concept applying to certain alphabets. I doubt Tifinagh has a cursive form that is analogous to true Latin italics, but I'm sure that oblique type is used with Tifinagh just like it is in English and many other languages and that's really what you're getting with AutoFakeSlant, but it's a fairly pedantic footnote really.

Au101
  • 10,278