ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* XeTeX and OpenType LM
@ 2007-01-31  4:44 Mojca Miklavec
  2007-01-31 11:09 ` Hans Hagen
  0 siblings, 1 reply; 9+ messages in thread
From: Mojca Miklavec @ 2007-01-31  4:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 1359 bytes --]

Hello,

Since there are serious problems with XeTeX on non-TeXLive
distributions anyway: why not mess it up properly this time?


The attached file seems to work OK, although kpathsea complains a bit
(but these are only warnings - no serious problems; perhaps other
macros could or should be adapted - I didn't dig too much into the
internals):

kpathsea: Illegal fontname `[lmsans12-regular]': contains '['
kpathsea: Illegal fontname `[lmsans10-bold]': contains '['
kpathsea: Illegal fontname `[lmsans12-oblique]': contains '['
kpathsea: Illegal fontname `[lmtypewriter12-regular]': contains '['
kpathsea: Illegal fontname `[lmtypewriter10-oblique]': contains '['

Can someone please take a look? I don't know how well this integrates
with luaTeX. Perhaps the name can be changed from
\definexetexfontsynonym to \defineotffontsynonym or something similar,
so that the underlying code can then differ depending on whether it's
luatex or XeTeX the one which has to access the otf fonts.

If this or a modified version of it makes it into the core, I would
suggest another (slightly radical) change - to redefine default
encoding to "uc" instead of "ec" for XeTeX (and luatex) before loading
the formats. It would be really great if the default XeTeX settings
would simply work out-of-the-box, contrary to now, when the default
ec-lmr is nearly useless.

Mojca

[-- Attachment #2: lm-uc.tex --]
[-- Type: application/x-tex, Size: 20250 bytes --]

[-- Attachment #3: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: XeTeX and OpenType LM
  2007-01-31  4:44 XeTeX and OpenType LM Mojca Miklavec
@ 2007-01-31 11:09 ` Hans Hagen
  2007-01-31 16:58   ` Mojca Miklavec
  0 siblings, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2007-01-31 11:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Mojca Miklavec wrote:
> Hello,
>
> Since there are serious problems with XeTeX on non-TeXLive
> distributions anyway: why not mess it up properly this time?
>
>
> The attached file seems to work OK, although kpathsea complains a bit
> (but these are only warnings - no serious problems; perhaps other
> macros could or should be adapted - I didn't dig too much into the
> internals):
>
> kpathsea: Illegal fontname `[lmsans12-regular]': contains '['
> kpathsea: Illegal fontname `[lmsans10-bold]': contains '['
> kpathsea: Illegal fontname `[lmsans12-oblique]': contains '['
> kpathsea: Illegal fontname `[lmtypewriter12-regular]': contains '['
> kpathsea: Illegal fontname `[lmtypewriter10-oblique]': contains '['
>
> Can someone please take a look? I don't know how well this integrates
> with luaTeX. Perhaps the name can be changed from
> \definexetexfontsynonym to \defineotffontsynonym or something similar,
> so that the underlying code can then differ depending on whether it's
> luatex or XeTeX the one which has to access the otf fonts.
>
> If this or a modified version of it makes it into the core, I would
> suggest another (slightly radical) change - to redefine default
> encoding to "uc" instead of "ec" for XeTeX (and luatex) before loading
> the formats. It would be really great if the default XeTeX settings
> would simply work out-of-the-box, contrary to now, when the default
> ec-lmr is nearly useless.
hm, i'm still wondering why xetex needs the extra [] ; is this somewhere documented? is it something new? why not {} 

having an extra series of defs for xetex is a bad idea, so i'd rather fix that 'automatically'

Hans 


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: XeTeX and OpenType LM
  2007-01-31 11:09 ` Hans Hagen
@ 2007-01-31 16:58   ` Mojca Miklavec
  2007-01-31 17:16     ` Jonathan Kew
  2007-02-02  8:26     ` Hans Hagen
  0 siblings, 2 replies; 9+ messages in thread
From: Mojca Miklavec @ 2007-01-31 16:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Jonathan Kew

On 1/31/07, Hans Hagen wrote:
> Mojca Miklavec wrote:
> > Hello,
> >
> > Since there are serious problems with XeTeX on non-TeXLive
> > distributions anyway: why not mess it up properly this time?
> >
> >
> > The attached file seems to work OK, although kpathsea complains a bit
> > (but these are only warnings - no serious problems; perhaps other
> > macros could or should be adapted - I didn't dig too much into the
> > internals):
> >
> > kpathsea: Illegal fontname `[lmsans12-regular]': contains '['
> > kpathsea: Illegal fontname `[lmsans10-bold]': contains '['
> > kpathsea: Illegal fontname `[lmsans12-oblique]': contains '['
> > kpathsea: Illegal fontname `[lmtypewriter12-regular]': contains '['
> > kpathsea: Illegal fontname `[lmtypewriter10-oblique]': contains '['
> >
> > Can someone please take a look? I don't know how well this integrates
> > with luaTeX. Perhaps the name can be changed from
> > \definexetexfontsynonym to \defineotffontsynonym or something similar,
> > so that the underlying code can then differ depending on whether it's
> > luatex or XeTeX the one which has to access the otf fonts.
> >
> > If this or a modified version of it makes it into the core, I would
> > suggest another (slightly radical) change - to redefine default
> > encoding to "uc" instead of "ec" for XeTeX (and luatex) before loading
> > the formats. It would be really great if the default XeTeX settings
> > would simply work out-of-the-box, contrary to now, when the default
> > ec-lmr is nearly useless.
> hm, i'm still wondering why xetex needs the extra [] ; is this somewhere documented? is it something new? why not {}
>
> having an extra series of defs for xetex is a bad idea, so i'd rather fix that 'automatically'

Using OpenType fonts from the TeX tree has been implemented in the
second half of 2006 (I was probably among those who requested that
feature). The only documentation I know of are "release notes". I
guess that only Jonathan can answer your question.

Mojca

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: XeTeX and OpenType LM
  2007-01-31 16:58   ` Mojca Miklavec
@ 2007-01-31 17:16     ` Jonathan Kew
  2007-01-31 19:12       ` Hans Hagen
  2007-02-02  8:26     ` Hans Hagen
  1 sibling, 1 reply; 9+ messages in thread
From: Jonathan Kew @ 2007-01-31 17:16 UTC (permalink / raw)
  To: Mojca Miklavec; +Cc: mailing list for ConTeXt users

On 31 Jan 2007, at 4:58 pm, Mojca Miklavec wrote:

>> hm, i'm still wondering why xetex needs the extra [] ; is this  
>> somewhere documented? is it something new? why not {}
>>
>> having an extra series of defs for xetex is a bad idea, so i'd  
>> rather fix that 'automatically'
>
> Using OpenType fonts from the TeX tree has been implemented in the
> second half of 2006 (I was probably among those who requested that
> feature).

Yes :)

> The only documentation I know of are "release notes". I
> guess that only Jonathan can answer your question.

Normally, XeTeX loads OpenType fonts by *font name* (i.e., things  
like \font\x="Latin Modern Roman 10pt" or \font\y="Times New Roman",  
etc). It will find fonts in this way if they are "installed" in the  
normal desktop sense (in the c:\windows\fonts folder, or /Library/ 
Fonts etc under Mac OS X, or /etc/fonts or ~/.fonts under Linux, and  
so on).

To repeat: such fonts are identified by their font names. Moreover,  
there is some support for font families, in that xetex looks for the  
appropriate optically-sized face, and can locate bold and italic  
variants of a base font.

The square-bracket notation is quite different, in that it allows a  
font (anywhere on the machine) to be loaded by *file name* (not font  
name). The texmf tree is searched by default, but full pathnames can  
also be used. In this case, there is no additional font family  
management; xetex will simply use the font file specified.

Font names and font filenames are quite different, in many cases, and  
it didn't seem wise to mix them up and allow the exact same form of  
the \font declaration to access either one. This could lead to  
ambiguity and confusion in the case where a filename does happen to  
be the same as a font name.

As for why square brackets.... why not? :) We just needed a way to  
distinguish filenames from font names, and this seemed a reasonably  
safe choice -- unlikely to be present in a real font name, and not  
usually given special treatment in TeX.

JK

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: XeTeX and OpenType LM
  2007-01-31 17:16     ` Jonathan Kew
@ 2007-01-31 19:12       ` Hans Hagen
  0 siblings, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2007-01-31 19:12 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Mojca Miklavec

Jonathan Kew wrote:
>
> Font names and font filenames are quite different, in many cases, and  
> it didn't seem wise to mix them up and allow the exact same form of  
> the \font declaration to access either one. This could lead to  
> ambiguity and confusion in the case where a filename does happen to  
> be the same as a font name.
>
> As for why square brackets.... why not? :) We just needed a way to  
> distinguish filenames from font names, and this seemed a reasonably  
> safe choice -- unlikely to be present in a real font name, and not  
> usually given special treatment in TeX.
>   
hm, but square brackets can interfere with optional args where [] don't 
nest well (tex does not treat them as delimiters as it does {}

using {} would probably have been safer or maybe () (round ones) since 
afaik these are seldom used for delimiting args; or maybe just

file:somename

anyhow, if it's filename stuff i can probably just feed the [] deep down 
in context to the xetex font command

will think of something


please forward to jonathan since his mailer an dmy mail server don;t 
like each other -)

Hans

-- 

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: XeTeX and OpenType LM
  2007-01-31 16:58   ` Mojca Miklavec
  2007-01-31 17:16     ` Jonathan Kew
@ 2007-02-02  8:26     ` Hans Hagen
  2007-02-02 13:23       ` Mojca Miklavec
  1 sibling, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2007-02-02  8:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Mojca Miklavec wrote:
> ... much much text .. begging for []'s ...
>
How about this ... no quotes in specs, only file: or name: in front of 
the name, and for xetex we default to filenames using file:

It means that existing defs need to be adapted, but this syntax is 
better than funny " [ ] etc and more extensible (i can intercept the 
prefixes in luatex and treat them accordingly)

\unprotect

\def\donoparsefontspec % #1 == \cs
  {\edef\fontfile{\truefontname\somefontname}%
   \ifx\fontfile\s!unknown \let\fontfile\defaultfontfile \fi
   \checkfontfilename
   \edef\lastfontname{\fontfile\somefontspec}%
   \ifx\fontclass\empty
     \expandafter\definefontlocal
   \else
     \expandafter\definefontglobal
   \fi} % #1 == \cs

\ifnum\contextmarkmode=4

    \let\checkfontfilename\relax

\else

    \def\checkfontfilename
      {\expandafter\docheckfontfilename\fontfile:\empty:\empty\relax}

    \def\docheckfontfilename#1:#2:#3#4\relax
      {\edef\temp{#1}%
       \ifx\temp\v!file
          \edef\fontfile{\fontfilefile{#2}}%
       \else\ifx\temp\v!name
          \edef\fontfile{\fontfilename{#2}}%
       \else
          \edef\fontfile{\fontfilesome{#2}}%
       \fi\fi}

    \def\fontfilename#1{"#1"}
    \def\fontfilefile#1{"#1"}
    \def\fontfilesome#1{"#1"}

    \beginXETEX

        \def\fontfilename#1{"#1"}
        \def\fontfilefile#1{"[#1]"}
        \def\fontfilesome#1{"[#1]"}

    \endXETEX

\fi

\protect

\starttext
    \definefont
        [blabla]
        [name:Latin Modern Something]
    \definefont
        [blabla]
        [file:texnansi-lmr10]
    \blabla test
\stoptext


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: XeTeX and OpenType LM
  2007-02-02  8:26     ` Hans Hagen
@ 2007-02-02 13:23       ` Mojca Miklavec
  2007-02-02 13:50         ` Hans Hagen
  0 siblings, 1 reply; 9+ messages in thread
From: Mojca Miklavec @ 2007-02-02 13:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Jonathan Kew

On 2/2/07, Hans Hagen wrote:
> Mojca Miklavec wrote:
> > ... much much text .. begging for []'s ...
> >
> How about this ... no quotes in specs, only file: or name: in front of
> the name, and for xetex we default to filenames using file:

I would default to "name:"

> It means that existing defs need to be adapted, but this syntax is
> better than funny " [ ] etc and more extensible (i can intercept the
> prefixes in luatex and treat them accordingly)
>
> \unprotect
>
> \def\donoparsefontspec % #1 == \cs
>   {\edef\fontfile{\truefontname\somefontname}%
>    \ifx\fontfile\s!unknown \let\fontfile\defaultfontfile \fi
>    \checkfontfilename
>    \edef\lastfontname{\fontfile\somefontspec}%
>    \ifx\fontclass\empty
>      \expandafter\definefontlocal
>    \else
>      \expandafter\definefontglobal
>    \fi} % #1 == \cs
>
> \ifnum\contextmarkmode=4
>
>     \let\checkfontfilename\relax
>
> \else
>
>     \def\checkfontfilename
>       {\expandafter\docheckfontfilename\fontfile:\empty:\empty\relax}
>
>     \def\docheckfontfilename#1:#2:#3#4\relax
>       {\edef\temp{#1}%
>        \ifx\temp\v!file
>           \edef\fontfile{\fontfilefile{#2}}%
>        \else\ifx\temp\v!name
>           \edef\fontfile{\fontfilename{#2}}%
>        \else
>           \edef\fontfile{\fontfilesome{#2}}%
>        \fi\fi}
>
>     \def\fontfilename#1{"#1"}
>     \def\fontfilefile#1{"#1"}
>     \def\fontfilesome#1{"#1"}
>
>     \beginXETEX
>
>         \def\fontfilename#1{"#1"}
>         \def\fontfilefile#1{"[#1]"}
>         \def\fontfilesome#1{"[#1]"}
>
>     \endXETEX
>
> \fi
>
> \protect
>
> \starttext
>     \definefont
>         [blabla]
>         [name:Latin Modern Something]
>     \definefont
>         [blabla]
>         [file:texnansi-lmr10]
>     \blabla test
> \stoptext

Great!

I need to try to run these, but I like the syntax. Although it would
probably make sense to default to "name" (so: no brackets,
\def\fontfilesome#1{"#1"}) under XeTeX. Those fonts that come as .otf
are relatively rare and for those (I have Polish fonts in mind)
ConTeXt can provide ready typescripts with "file:" prefix. I assume
that for most users it would be an overhead having to write "name:"
for each single font that they want to use, and most such fonts are
probably installed on the system.

There is one more thing though. I'm taking these from Adam's notes on the wiki:

\definefontsynonym
    [DidotCaps]
    ['Didot:mapping=tex-text;
         Letter Case=Small Capitals;Ligatures=!Common Ligatures']
    [encoding=uc]

I have to check the state of special features in case of
[this/syntay/for/fonts.otf], but is it possible that the colon might
interfere with definitions such as the one above?

Now I need to actualy run your code on some examples ...

Mojca

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: XeTeX and OpenType LM
  2007-02-02 13:23       ` Mojca Miklavec
@ 2007-02-02 13:50         ` Hans Hagen
  2007-02-02 15:40           ` Mojca Miklavec
  0 siblings, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2007-02-02 13:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Mojca Miklavec wrote:
> On 2/2/07, Hans Hagen wrote:
>   
>> Mojca Miklavec wrote:
>>     
>>> ... much much text .. begging for []'s ...
>>>
>>>       
>> How about this ... no quotes in specs, only file: or name: in front of
>> the name, and for xetex we default to filenames using file:
>>     
>
> I would default to "name:"
>   
no, because that way we can use existing context typescripts and i'm not 
going to add a complete extra set now (clows down too much); so, if 
names are used prefix it with name:
>
> I need to try to run these, but I like the syntax. Although it would
> probably make sense to default to "name" (so: no brackets,
> \def\fontfilesome#1{"#1"}) under XeTeX. Those fonts that come as .otf
> are relatively rare and for those (I have Polish fonts in mind)
> ConTeXt can provide ready typescripts with "file:" prefix. I assume
> that for most users it would be an overhead having to write "name:"
> for each single font that they want to use, and most such fonts are
> probably installed on the system.
>
> There is one more thing though. I'm taking these from Adam's notes on the wiki:
>
> \definefontsynonym
>     [DidotCaps]
>     ['Didot:mapping=tex-text;
>          Letter Case=Small Capitals;Ligatures=!Common Ligatures']
>     [encoding=uc]
>   
that will be done differently, with a features key: 
\definefont[...][...][features=]

and lowlevel that one will be xetex'd or luatex'd

Hans


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: XeTeX and OpenType LM
  2007-02-02 13:50         ` Hans Hagen
@ 2007-02-02 15:40           ` Mojca Miklavec
  0 siblings, 0 replies; 9+ messages in thread
From: Mojca Miklavec @ 2007-02-02 15:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 2/2/07, Hans Hagen wrote:
> Mojca Miklavec wrote:
> > On 2/2/07, Hans Hagen wrote:
> >
> >> Mojca Miklavec wrote:
> >>
> >>> ... much much text .. begging for []'s ...
> >>>
> >>>
> >> How about this ... no quotes in specs, only file: or name: in front of
> >> the name, and for xetex we default to filenames using file:
> >>
> >
> > I would default to "name:"
> >
> no, because that way we can use existing context typescripts and i'm not
> going to add a complete extra set now (clows down too much); so, if
> names are used prefix it with name:

How do you mean "existing typescripts"? OpenType names
(lmroman12-regular) are different than Type1 names (ec-lmr12) anyway.
I already did it for Latin Modern (I can run a few regular expressions
on that file to replace \definexetexfontsynonym with something more
suitable), and I can do it for the rest of Polish font names as well
if needed.

But in any case: I guess that if there are two regimes (file & name),
at least for what's hidden from user, it would make sense to set it to
"file:" explicitely.


Btw: In the patch that I sent you in the first mail in this thread is
also a section which originally had a "TODO" in type-enc.tex:

\starttypescript [serif] [modern,latin-modern,computer-modern]
[uc,texnansi,ec,qx,t5]

  \definefontsynonym [cmr5]      [LMRoman5-Regular]
[encoding=\typescriptthree]
  \definefontsynonym [cmr6]      [LMRoman6-Regular]
[encoding=\typescriptthree]
  \definefontsynonym [cmr7]      [LMRoman7-Regular]
[encoding=\typescriptthree]

instead of

  \definefontsynonym [cmr5]      [lmr5]      [encoding=\typescriptthree]
  \definefontsynonym [cmr6]      [lmr6]      [encoding=\typescriptthree]
  \definefontsynonym [cmr7]      [lmr7]      [encoding=\typescriptthree]

Do the corrections look OK?

> > I need to try to run these, but I like the syntax. Although it would
> > probably make sense to default to "name" (so: no brackets,
> > \def\fontfilesome#1{"#1"}) under XeTeX. Those fonts that come as .otf
> > are relatively rare and for those (I have Polish fonts in mind)
> > ConTeXt can provide ready typescripts with "file:" prefix. I assume
> > that for most users it would be an overhead having to write "name:"
> > for each single font that they want to use, and most such fonts are
> > probably installed on the system.
> >
> > There is one more thing though. I'm taking these from Adam's notes on the wiki:
> >
> > \definefontsynonym
> >     [DidotCaps]
> >     ['Didot:mapping=tex-text;
> >          Letter Case=Small Capitals;Ligatures=!Common Ligatures']
> >     [encoding=uc]
> >
> that will be done differently, with a features key:
> \definefont[...][...][features=]
>
> and lowlevel that one will be xetex'd or luatex'd

Great! It will be much better that way.

Mojca

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-02-02 15:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-31  4:44 XeTeX and OpenType LM Mojca Miklavec
2007-01-31 11:09 ` Hans Hagen
2007-01-31 16:58   ` Mojca Miklavec
2007-01-31 17:16     ` Jonathan Kew
2007-01-31 19:12       ` Hans Hagen
2007-02-02  8:26     ` Hans Hagen
2007-02-02 13:23       ` Mojca Miklavec
2007-02-02 13:50         ` Hans Hagen
2007-02-02 15:40           ` Mojca Miklavec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).