ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* switching font encodings
@ 2006-07-15 18:13 Mojca Miklavec
  2006-07-17  9:56 ` Hans Hagen
  0 siblings, 1 reply; 8+ messages in thread
From: Mojca Miklavec @ 2006-07-15 18:13 UTC (permalink / raw)


Hello,

I have to print plenty of utf-8-encoded entries from a database. I
will probably output entries as
    \contestant{name}{country}{code},
for example
    \contestant{Đức Đặng}{VNM}{1}

I have defined
    \def\contestant#1#2#3{...#1...}

But what's the easiest way to change the encoding to t5 if the country
code is VNM and to some other encoding if country code is RUS, SER (or
one of other countries using Cyrillic)?
I'll probably use

\usetypescript[antykwa-torunska][ec] % for most of entries
\setupbodyfont[antykwa]

I wanted to use XeTeX, but that I figured out/remembered that XeTeX
doesn't yet support inclusion of images which I need for this
document.

Thanks a lot,
    Mojca

(I need this pretty soon.)
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: switching font encodings
  2006-07-15 18:13 switching font encodings Mojca Miklavec
@ 2006-07-17  9:56 ` Hans Hagen
  2006-07-18 16:52   ` Mojca Miklavec
  0 siblings, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2006-07-17  9:56 UTC (permalink / raw)


Mojca Miklavec wrote:
> Hello,
>
> I have to print plenty of utf-8-encoded entries from a database. I
> will probably output entries as
>     \contestant{name}{country}{code},
> for example
>     \contestant{Đức Đặng}{VNM}{1}
>
> I have defined
>     \def\contestant#1#2#3{...#1...}
>
> But what's the easiest way to change the encoding to t5 if the country
> code is VNM and to some other encoding if country code is RUS, SER (or
> one of other countries using Cyrillic)?
> I'll probably use
>   
you can try to define multiple typefaces, say mainfont-ec, mainfont-qx, mainfont-t5 and then switch to them using languagespecifics related definitions 

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
-----------------------------------------------------------------

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

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

* Re: switching font encodings
  2006-07-17  9:56 ` Hans Hagen
@ 2006-07-18 16:52   ` Mojca Miklavec
  2006-07-18 18:16     ` Taco Hoekwater
  2006-07-18 22:35     ` Hans Hagen
  0 siblings, 2 replies; 8+ messages in thread
From: Mojca Miklavec @ 2006-07-18 16:52 UTC (permalink / raw)


On 7/17/06, Hans Hagen wrote:
> Mojca Miklavec wrote:
> > Hello,
> >
> > I have to print plenty of utf-8-encoded entries from a database. I
> > will probably output entries as
> >     \contestant{name}{country}{code},
> > for example
> >     \contestant{Đức Đặng}{VNM}{1}
> >
> > I have defined
> >     \def\contestant#1#2#3{...#1...}
> >
> > But what's the easiest way to change the encoding to t5 if the country
> > code is VNM and to some other encoding if country code is RUS, SER (or
> > one of other countries using Cyrillic)?
> > I'll probably use
> >
> you can try to define multiple typefaces, say mainfont-ec, mainfont-qx, mainfont-t5 and then switch to them using languagespecifics related definitions


The Vietnamese left, I can sleep well again ;)
I swear that they will pay for each single letter that caused us
headaches this year: they'll have to organize the same event by
themselves next year. (But then again: next year both pdfTeX and XeTeX
will hopefully work in a much less painful way.)

But I still can't understand why the following code costed me at least
an hour to trace and find a workaround for it:

\definetypeface [iwona-t5] [ss] [sans] [iwona] [default] [encoding=t5]
\definetypeface [iwona] [ss] [sans] [iwona] [default] [encoding=ec]
\setupbodyfont [iwona,12pt,ss]

\starttext
abc \switchtobodyfont[20pt]\switchtobodyfont[iwona-t5] abc
\stoptext

Here's the output:
...
(c:\Programi\context\texmf-local/tex/context/base/type-buy.tex)
(c:\Programi\context\texmf-local/tex/context/base/pdfr-ec.tex) (./file.tuo)
(./file.tuo) (./file.tuo) (./file.tuo) (./file.tuo) (./file.tuo) (./file.tuo)
(./file.tuo) (./file.tuo) (./file.tuo)
(c:\Programi\context\texmf-local/tex/context/base/sort-def.tex)
(c:\Programi\context\texmf-local/tex/context/base/sort-lan.tex) (./file.tuo)
(./file.tuo)
systems         : begin file file at line 28
! pdfTeX error (font): invalid font identifier.
\@@expanded ->\pdffontattr \font
                                 {/ToUnicode 1 0 R}
<argument> ...fontresource \endcsname \space 0 R}}
                                                  \letgvalue {\s!ucmap \font...

\firstofoneargument #1->#1

\doincludepdffontresource ...cludepdffontresource
                                                  \fi
\includepdffontresource ...includepdffontresource
                                                  \fi \fi \fi
\setfontcharacteristics ...ifier }\the \everyfont
                                                  \synchronizepatterns
...
l.31 ...obodyfont[20pt]\switchtobodyfont[iwona-t5]
                                                   abc
No pages of output.
Transcript written on file.log.
TeXExec | runtime: 2.183


The funny part is that it compiles fine on contextgarden (and most
probably compiled OK on my computer as well some time ago: the error
just appeared at once).

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

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

* Re: switching font encodings
  2006-07-18 16:52   ` Mojca Miklavec
@ 2006-07-18 18:16     ` Taco Hoekwater
  2006-07-18 18:51       ` Mojca Miklavec
  2006-07-18 22:35     ` Hans Hagen
  1 sibling, 1 reply; 8+ messages in thread
From: Taco Hoekwater @ 2006-07-18 18:16 UTC (permalink / raw)


Mojca Miklavec wrote:
> \starttext
> abc \switchtobodyfont[20pt]\switchtobodyfont[iwona-t5] abc
> \stoptext

There is no defined bodyfont at 20pt, and that is what is causing
the error (indirectly). Add this:

\definebodyfont [20pt] [ss]
   [tf=Sans            sa 1,
    bf=SansBold        sa 1,
    it=SansItalic      sa 1,
    sl=SansSlanted     sa 1,
    bs=SansBoldSlanted sa 1,
    bi=SansBoldSlanted sa 1,
    sc=SansCaps        sa .8,
   tfa=Sans            sa 1.200,
   tfb=Sans            sa 1.440,
   tfc=Sans            sa 1.728,
   tfd=Sans            sa 2.074,
   bfa=SansBold        sa 1.200,
   bfb=SansBold        sa 1.440,
   bfc=SansBold        sa 1.728,
   bfd=SansBold        sa 2.074,
   bsa=SansBoldSlanted sa 1.200,
   bsb=SansBoldSlanted sa 1.440,
   bsc=SansBoldSlanted sa 1.728,
   bsd=SansBoldSlanted sa 2.074]


Cheers, Taco

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

* Re: switching font encodings
  2006-07-18 18:16     ` Taco Hoekwater
@ 2006-07-18 18:51       ` Mojca Miklavec
  2006-07-19  6:59         ` Thomas A. Schmitz
  0 siblings, 1 reply; 8+ messages in thread
From: Mojca Miklavec @ 2006-07-18 18:51 UTC (permalink / raw)


On 7/18/06, Taco Hoekwater wrote:
> Mojca Miklavec wrote:
> > \starttext
> > abc \switchtobodyfont[20pt]\switchtobodyfont[iwona-t5] abc
> > \stoptext
>
> There is no defined bodyfont at 20pt, and that is what is causing
> the error (indirectly). Add this:
>
> \definebodyfont [20pt] [ss]
>    [tf=Sans            sa 1,
>     bf=SansBold        sa 1,
>     it=SansItalic      sa 1,
>     sl=SansSlanted     sa 1,
>     bs=SansBoldSlanted sa 1,
>     bi=SansBoldSlanted sa 1,
>     sc=SansCaps        sa .8,
>    tfa=Sans            sa 1.200,
>    tfb=Sans            sa 1.440,
>    tfc=Sans            sa 1.728,
>    tfd=Sans            sa 2.074,
>    bfa=SansBold        sa 1.200,
>    bfb=SansBold        sa 1.440,
>    bfc=SansBold        sa 1.728,
>    bfd=SansBold        sa 2.074,
>    bsa=SansBoldSlanted sa 1.200,
>    bsb=SansBoldSlanted sa 1.440,
>    bsc=SansBoldSlanted sa 1.728,
>    bsd=SansBoldSlanted sa 2.074]

But why do I have to do it? I would only like that
\switchtobodyfont[20pt] scales the font properly (according to
whatever definitions are default). I can't define that for all the
possible sizes of the font that I want to use in the document.

\switchtobodyfont[iwona-t5,20pt] works OK, but one command after
another doesn't.

Mojca

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

* Re: switching font encodings
  2006-07-18 16:52   ` Mojca Miklavec
  2006-07-18 18:16     ` Taco Hoekwater
@ 2006-07-18 22:35     ` Hans Hagen
  1 sibling, 0 replies; 8+ messages in thread
From: Hans Hagen @ 2006-07-18 22:35 UTC (permalink / raw)


Mojca Miklavec wrote:
>
> But I still can't understand why the following code costed me at least
> an hour to trace and find a workaround for it:
>
> \definetypeface [iwona-t5] [ss] [sans] [iwona] [default] [encoding=t5]
> \definetypeface [iwona] [ss] [sans] [iwona] [default] [encoding=ec]
> \setupbodyfont [iwona,12pt,ss]
>
> \starttext
> abc \switchtobodyfont[20pt]\switchtobodyfont[iwona-t5] abc
> \stoptext
>
> Here's the output:
>   
strange indeed; anyhow this vector stuff will be dealt ith in pdftex itself soon (the problem is that some font things are global in pdftex and then we can end up in sync problems with resources); 

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] 8+ messages in thread

* Re: switching font encodings
  2006-07-18 18:51       ` Mojca Miklavec
@ 2006-07-19  6:59         ` Thomas A. Schmitz
  2006-07-19  8:35           ` Hans Hagen
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas A. Schmitz @ 2006-07-19  6:59 UTC (permalink / raw)



On Jul 18, 2006, at 8:51 PM, Mojca Miklavec wrote:

>> There is no defined bodyfont at 20pt, and that is what is causing
>> the error (indirectly). Add this:
>>
>> \definebodyfont [20pt] [ss]
>>    [tf=Sans            sa 1,
>>     bf=SansBold        sa 1,
>>     it=SansItalic      sa 1,
>>     sl=SansSlanted     sa 1,
>>     bs=SansBoldSlanted sa 1,
>>     bi=SansBoldSlanted sa 1,
>>     sc=SansCaps        sa .8,
>>    tfa=Sans            sa 1.200,
>>    tfb=Sans            sa 1.440,
>>    tfc=Sans            sa 1.728,
>>    tfd=Sans            sa 2.074,
>>    bfa=SansBold        sa 1.200,
>>    bfb=SansBold        sa 1.440,
>>    bfc=SansBold        sa 1.728,
>>    bfd=SansBold        sa 2.074,
>>    bsa=SansBoldSlanted sa 1.200,
>>    bsb=SansBoldSlanted sa 1.440,
>>    bsc=SansBoldSlanted sa 1.728,
>>    bsd=SansBoldSlanted sa 2.074]
>
> But why do I have to do it? I would only like that
> \switchtobodyfont[20pt] scales the font properly (according to
> whatever definitions are default). I can't define that for all the
> possible sizes of the font that I want to use in the document.
>
> \switchtobodyfont[iwona-t5,20pt] works OK, but one command after
> another doesn't.
>
> Mojca

Taco, Mojca,

wouldn't this suffice:

\starttypescript [sans] [default] [size]
\definebodyfont [20pt] [ss] [default]
\stoptypescript

Somewhat shorter...

Best

Thomas

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

* Re: switching font encodings
  2006-07-19  6:59         ` Thomas A. Schmitz
@ 2006-07-19  8:35           ` Hans Hagen
  0 siblings, 0 replies; 8+ messages in thread
From: Hans Hagen @ 2006-07-19  8:35 UTC (permalink / raw)


Thomas A. Schmitz wrote:
> On Jul 18, 2006, at 8:51 PM, Mojca Miklavec wrote:
>
>   
>>> There is no defined bodyfont at 20pt, and that is what is causing
>>> the error (indirectly). Add this:
>>>
>>> \definebodyfont [20pt] [ss]
>>>    [tf=Sans            sa 1,
>>>     bf=SansBold        sa 1,
>>>     it=SansItalic      sa 1,
>>>     sl=SansSlanted     sa 1,
>>>     bs=SansBoldSlanted sa 1,
>>>     bi=SansBoldSlanted sa 1,
>>>     sc=SansCaps        sa .8,
>>>    tfa=Sans            sa 1.200,
>>>    tfb=Sans            sa 1.440,
>>>    tfc=Sans            sa 1.728,
>>>    tfd=Sans            sa 2.074,
>>>    bfa=SansBold        sa 1.200,
>>>    bfb=SansBold        sa 1.440,
>>>    bfc=SansBold        sa 1.728,
>>>    bfd=SansBold        sa 2.074,
>>>    bsa=SansBoldSlanted sa 1.200,
>>>    bsb=SansBoldSlanted sa 1.440,
>>>    bsc=SansBoldSlanted sa 1.728,
>>>    bsd=SansBoldSlanted sa 2.074]
>>>       
>> But why do I have to do it? I would only like that
>> \switchtobodyfont[20pt] scales the font properly (according to
>> whatever definitions are default). I can't define that for all the
>> possible sizes of the font that I want to use in the document.
>>
>> \switchtobodyfont[iwona-t5,20pt] works OK, but one command after
>> another doesn't.
>>
>> Mojca
>>     
>
> Taco, Mojca,
>
> wouldn't this suffice:
>
> \starttypescript [sans] [default] [size]
> \definebodyfont [20pt] [ss] [default]
> \stoptypescript
>
> Somewhat shorter...
>   
\definebodyfontenvironment[20pt][default]

\definetypeface [iwona-t5] [ss] [sans] [iwona] [default] [encoding=t5]
\definetypeface [iwona]    [ss] [sans] [iwona] [default] [encoding=ec]

\setupbodyfont [iwona,12pt,ss]

\starttext
abc
\switchtobodyfont[iwona-t5,20pt]
abc
\stoptext

is also ok; some time ago we had auto-bodyfontenv definition but since fonts are often used grouped, it generated many messages (warnings) and was slow too; best to let users be aware of the need to define an environment 

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] 8+ messages in thread

end of thread, other threads:[~2006-07-19  8:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-15 18:13 switching font encodings Mojca Miklavec
2006-07-17  9:56 ` Hans Hagen
2006-07-18 16:52   ` Mojca Miklavec
2006-07-18 18:16     ` Taco Hoekwater
2006-07-18 18:51       ` Mojca Miklavec
2006-07-19  6:59         ` Thomas A. Schmitz
2006-07-19  8:35           ` Hans Hagen
2006-07-18 22:35     ` Hans Hagen

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).