Discussion:
[XeTeX] ".ttf" automatically added to font names
Dirk Hünniger
2017-05-12 09:29:20 UTC
Permalink
Hello,
my name is Dirk Hünniger. Since approx 10 years I am working on
mediawiki2latex a pdf and latex export tool for mediawiki. I am
currently using Ubuntu 17.04 and observe a behavior of the \setmainfont
command that I don't understand. The string ".ttf" seems to be added
magically, which causes problems for me.

Everything works fine if I write it like this:

\setmainfont[Path=/usr/share/fonts/truetype/cmu/,UprightFont=cmunrm,BoldFont=cmunbx,ItalicFont=cmunti,BoldItalicFont=cmunbi]{cmunti}

I am using

This is XeTeX, Version 3.14159265-2.6-0.99996 (TeX Live 2016/Debian)
(preloaded format=xelatex)
restricted \write18 enabled.

In an older version of xetex I had to write it like this.

\setmainfont[Path=/usr/share/fonts/truetype/cmu/,UprightFont=cmunrm.ttf,BoldFont=cmunbx.ttf,ItalicFont=cmunti.ttf,BoldItalicFont=cmunbi.ttf]{cmunrm.ttf}
kpathsea:make_tex: Invalid fontname
`[/usr/share/fonts/truetype/cmu/cmunrm.ttf.ttf]/OT', contains '['
kpathsea:make_tex: Invalid fontname
`[/usr/share/fonts/truetype/cmu/cmuntt.ttf.ttf]/OT', contains '['
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "cmuntt.ttf" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................
l.24 ...ttf,BoldItalicFont=cmuntx.ttf]{cmunbx.ttf}
So the string .ttf is automatically added which causes the problem. The
problem gets serious If I want to uses east-asian fonts like

/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc

which does not end on ttf. So I propose to revert this change so that
the file extension .ttf is not automatically added and thus has to be
written out by the user of xetex.
Yours Dirk Hünniger



--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/x
Ulrike Fischer
2017-05-12 13:01:59 UTC
Permalink
Post by Dirk Hünniger
Hello,
my name is Dirk Hünniger. Since approx 10 years I am working on
mediawiki2latex a pdf and latex export tool for mediawiki. I am
currently using Ubuntu 17.04 and observe a behavior of the \setmainfont
command that I don't understand. The string ".ttf" seems to be added
magically, which causes problems for me.
\setmainfont[Path=/usr/share/fonts/truetype/cmu/,UprightFont=cmunrm,BoldFont=cmunbx,ItalicFont=cmunti,BoldItalicFont=cmunbi]{cmunti}
I am using
This is XeTeX, Version 3.14159265-2.6-0.99996 (TeX Live 2016/Debian)
(preloaded format=xelatex)
restricted \write18 enabled.
In an older version of xetex I had to write it like this.
\setmainfont[Path=/usr/share/fonts/truetype/cmu/,UprightFont=cmunrm.ttf,BoldFont=cmunbx.ttf,ItalicFont=cmunti.ttf,BoldItalicFont=cmunbi.ttf]{cmunrm.ttf}
kpathsea:make_tex: Invalid fontname
`[/usr/share/fonts/truetype/cmu/cmunrm.ttf.ttf]/OT', contains '['
So the string .ttf is automatically added which causes the problem. The
problem gets serious If I want to uses east-asian fonts like
In my texlive 2016 (in windows) the fonts are otf and not ttf-font,
so using ttf as extension leads to errors.

Beside this I get the error if I use the UprightFont-key, which
looks a bit senseless anyway.

This works without problems:

\setmainfont{cmunrm.otf}[BoldFont=cmunbx.otf,ItalicFont=cmunti.otf,BoldItalicFont=cmunbi.otf]
--
Ulrike Fischer
http://www.troubleshooting-tex.de/



--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/xetex
Dirk Hünniger
2017-05-12 14:02:32 UTC
Permalink
Hi,

this works for me:

\setmainfont[Path=/usr/share/fonts/truetype/cmu/,UprightFont=cmunrm,BoldFont=cmunbx,ItalicFont=cmunti,BoldItalicFont=cmunbi]{cmunbx.ttf}

but this

\setmainfont[Path=/usr/share/fonts/truetype/cmu/,UprightFont=cmunrm.ttf,BoldFont=cmunbx,ItalicFont=cmunti,BoldItalicFont=cmunbi]{cmunbx.ttf}

causes the following error
kpathsea:make_tex: Invalid fontname
`[/usr/share/fonts/truetype/cmu/cmunrm.ttf.ttf]/OT', contains '['
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "cmunrm.ttf" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................
l.23 ...=cmunti,BoldItalicFont=cmunbi]{cmunbx.ttf}
So the only question remaining is: Will the xetex compiler developers
keep it like this will a later version again require to write out the
extensions like in

\setmainfont[Path=/usr/share/fonts/truetype/cmu/,UprightFont=cmunrm.ttf,BoldFont=cmunbx.ttf,ItalicFont=cmunti.ttf,BoldItalicFont=cmunbi.ttf]{cmunbx.ttf}

I just need to know so I can use the right form when generation latex
code in my system.
Yours Dirk




--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/xetex
David Carlisle
2017-05-12 14:18:38 UTC
Permalink
Post by Dirk Hünniger
So the only question remaining is: Will the xetex compiler developers
keep it like this


Note that mostly this is not a xetex question as you are using the syntax
of the fontspec macro package rather than the xetex primitive font loading
syntax (although of course these are not unrelated)

it might be more portable to use the opentype cm Unicode distributed with
tex than the ttf ones that you are pulling from /usr/share/fonts eg I have

/usr/local/texlive/2017/texmf-dist/fonts/opentype/public/cm-unicode/cmunrm.otf

I don't have them as .ttf as far as I can see in tl2016 or tl2017.

David
Post by Dirk Hünniger
Hi,
\setmainfont[Path=/usr/share/fonts/truetype/cmu/,UprightFont
=cmunrm,BoldFont=cmunbx,ItalicFont=cmunti,BoldItalicFo
nt=cmunbi]{cmunbx.ttf}
but this
\setmainfont[Path=/usr/share/fonts/truetype/cmu/,UprightFont
=cmunrm.ttf,BoldFont=cmunbx,ItalicFont=cmunti,
BoldItalicFont=cmunbi]{cmunbx.ttf}
causes the following error
kpathsea:make_tex: Invalid fontname `[/usr/share/fonts/truetype/cmu/cmunrm.ttf.ttf]/OT',
contains '['
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "cmunrm.ttf" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................
l.23 ...=cmunti,BoldItalicFont=cmunbi]{cmunbx.ttf}
So the only question remaining is: Will the xetex compiler developers keep
it like this will a later version again require to write out the extensions
like in
\setmainfont[Path=/usr/share/fonts/truetype/cmu/,UprightFont
=cmunrm.ttf,BoldFont=cmunbx.ttf,ItalicFont=cmunti.ttf,Bold
ItalicFont=cmunbi.ttf]{cmunbx.ttf}
I just need to know so I can use the right form when generation latex code
in my system.
Yours Dirk
--------------------------------------------------
http://tug.org/mailman/listinfo/xetex
Ulrike Fischer
2017-05-12 14:26:21 UTC
Permalink
Post by Dirk Hünniger
\setmainfont[Path=/usr/share/fonts/truetype/cmu/,UprightFont=cmunrm.ttf,BoldFont=cmunbx,ItalicFont=cmunti,BoldItalicFont=cmunbi]{cmunbx.ttf}
causes the following error
kpathsea:make_tex: Invalid fontname
`[/usr/share/fonts/truetype/cmu/cmunrm.ttf.ttf]/OT', contains '['
Yes, as I wrote the UprightFont key gives this error. But why do you
use it in this way? It is normally only need to add some suffix to
the font.
Post by Dirk Hünniger
So the only question remaining is: Will the xetex compiler developers
It is not a xetex but a fontspec question. And fontspec certainly
won't drop the use of extensions -- it is actually normally
recommended to use them. So if you get errors it either a bug or you
are trying to use a font that doesn't exist on your system (or can't
be found).
--
Ulrike Fischer
http://www.troubleshooting-tex.de/



--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/xetex
Dirk Hünniger
2017-05-12 14:32:10 UTC
Permalink
Hi,
look at the error message closely. It talks about
cmunrm.ttf.ttf
This file obviously does not exist since it got a doubled extension.
Post by Dirk Hünniger
causes the following error
kpathsea:make_tex: Invalid fontname
`[/usr/share/fonts/truetype/cmu/cmunrm.ttf.ttf]/OT', contains '['
Yes, as I wrote the UprightFont key gives this error. But why do you
use it in this way? It is normally only need to add some suffix to
the font.
Post by Dirk Hünniger
So the only question remaining is: Will the xetex compiler developers
It is not a xetex but a fontspec question. And fontspec certainly
won't drop the use of extensions -- it is actually normally
recommended to use them. So if you get errors it either a bug or you
are trying to use a font that doesn't exist on your system (or can't
be found).
So its a bug.
Yours Dirk


--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/xetex
Ulrike Fischer
2017-05-12 14:59:55 UTC
Permalink
Post by Dirk Hünniger
look at the error message closely. It talks about
cmunrm.ttf.ttf
I saw this. But it comes from the UprightFont option. So I'm asking
again: why don't you drop it? Fontspec obviously don't expect that
the value of this key has an extension.
Post by Dirk Hünniger
So its a bug.
Perhaps. \setmainfont[UprightFont=arial.ttf]{arial.ttf} worked in
TL15 but not in TL16. But as I don't see the reason for this setting
I don't know if it a bug or if simply some unsupported side-effect
no longer works. But you should better ask this in the issue tracker
of fontspec: https://github.com/wspr/fontspec/issues
--
Ulrike Fischer
http://www.troubleshooting-tex.de/



--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/xetex
Dirk Hünniger
2017-05-12 19:57:12 UTC
Permalink
Hi Ulrike,

thanks for your help so far. Since this way of writing it seems to work
today.

\setmainfont[Path=/usr/share/fonts/truetype/cmu/,UprightFont=cmunrm,BoldFont=cmunbx,ItalicFont=cmunti,BoldItalicFont=cmunbi]{cmunbx.ttf}

I changed my source code to use this way of writing it. I will wait for
a few days, to see if someone objects. I will then publish a new version
of mediawiki2latex.

Thanks a lot

Yours Dirk
Post by Ulrike Fischer
Post by Dirk Hünniger
look at the error message closely. It talks about
cmunrm.ttf.ttf
I saw this. But it comes from the UprightFont option. So I'm asking
again: why don't you drop it? Fontspec obviously don't expect that
the value of this key has an extension.
Post by Dirk Hünniger
So its a bug.
Perhaps. \setmainfont[UprightFont=arial.ttf]{arial.ttf} worked in
TL15 but not in TL16. But as I don't see the reason for this setting
I don't know if it a bug or if simply some unsupported side-effect
no longer works. But you should better ask this in the issue tracker
of fontspec: https://github.com/wspr/fontspec/issues
--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
http://tug.org/mailman/listinfo/xetex

Continue reading on narkive:
Loading...