ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* How to switch between fonts?
@ 2005-03-16  8:33 Stefan Wachter
  2005-03-17 20:58 ` Hans Hagen
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Wachter @ 2005-03-16  8:33 UTC (permalink / raw)


Dear font experts!

For some weeks I try very hard to generate minimal PDF documents using 
the PDF base 14 fonts. Now the following problem popped up:

The Helvitica, Times, and Courier fonts have "8a" as their default 
encoding. Unfortunately, the 8a encoding is somewhat incomplete because 
it misses some characters (eg. the degree character). In TeX I use 
texnansi encoding because it offers most of the special characters that 
I need.

If I use 8a encoding for the PDF document (in order to avoid reencoding) 
then the degree symbol is typeset by an embedded "txsy" font. The bad 
thing about this solution is that this degree character does not take 
care of \bf, \it, or \bi. Therefore the result is unsatisfactory.

If I use texnansi encoding for the PDF document then the degree symbol 
is typeset nicely. The disadvantage of this option is that now the 
built-in fonts are always reencoding which make some additional 2kb for 
the PDF document. I would like to have the reeconded font to be used 
only if it is really necessary.

Now I see two problems:

1. A particual problem in this situation

Is it possible to define font synonymes locally (i.e. inside a group)? 
In that case I could map the virtual fonts that are base on 8a encoded 
raw fonts into virtual fonts that are based on texnansi reencoded raw fonts.

I tried that but it seems that font synonymes are accepted only at the 
beginning.

2. A general problem

Provided that I write a set of typescripts for defining a typeface 
similar to the postscript typefaces of ConTeXt but based on other 
(virtual) fonts: is it possible to switch between these two typefaces. 
The switch must respect the current font characteristics (i.e. \ss, \rm, 
\tt, \bf, \it, \bi, and size).

Thanks for your attention,
--Stefan

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

* Re: How to switch between fonts?
  2005-03-16  8:33 How to switch between fonts? Stefan Wachter
@ 2005-03-17 20:58 ` Hans Hagen
  2005-03-18 13:41   ` Stefan Wachter
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2005-03-17 20:58 UTC (permalink / raw)


Stefan Wachter wrote:

> 1. A particual problem in this situation
> 
> Is it possible to define font synonymes locally (i.e. inside a group)? 
> In that case I could map the virtual fonts that are base on 8a encoded 
> raw fonts into virtual fonts that are based on texnansi reencoded raw 
> fonts.
> 
> I tried that but it seems that font synonymes are accepted only at the 
> beginning.

not true; what you observe is that font defs are frozen; an option is to define 
multiple typeface collections, since these store information; so,


\definetypeface[timesa][rm][serif][times][default[encoding=texnansi]

\definetypeface[timesb][rm][serif][times][default[encoding=ec]

now you can use both intermixed

> The switch must respect the current font characteristics (i.e. \ss, \rm, 
> \tt, \bf, \it, \bi, and size).

\timesa \bf test \pushcurrentfont \timesb \popcurrentfont test

alternatively you can define symbols for those special chars, see symb-*.tex; 
\getglyph is also an option; this one follows the style

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

* Re: How to switch between fonts?
  2005-03-17 20:58 ` Hans Hagen
@ 2005-03-18 13:41   ` Stefan Wachter
  2005-03-18 14:12     ` Hans Hagen
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Wachter @ 2005-03-18 13:41 UTC (permalink / raw)


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

Hi Hans,

thanks for the information. I changed my test document accordingly and 
deleted obsolete parts from the typescript.

When I use the "builtInPostscript" or the "reencodedPostscript" as the 
sole body font then the document is typeset correctly. Yet, if I try to 
switch the family for example to the reencodedPostscript then the text 
that follows after the switch does not appear in the created PDF document.

Do you have an idea?
--Stefan


\enableregime[il1]
\setupencoding[default=texnansi]
\setupoutput[pdftex]
\pdfoptionpdfminorversion 4

\usetypescriptfile[smallpdf.tex]

\definetypeface [builtInPostscript] [rm] [serif] [times]     [default] 
[encoding=ec]
\definetypeface [builtInPostscript] [ss] [sans]  [helvetica] [default] 
[encoding=ec]
\definetypeface [builtInPostscript] [tt] [mono]  [courier]   [default] 
[encoding=ec]
%\definetypeface [builtInPostscript] [mm] [math]  [times]     [default]

\usetypescript[reencode][texnansi][texnansi]

\definetypeface [reencodedPostscript] [rm] [serif] [times]     [default] 
[encoding=texnansi]
\definetypeface [reencodedPostscript] [ss] [sans]  [helvetica] [default] 
[encoding=texnansi]
\definetypeface [reencodedPostscript] [tt] [mono]  [courier]   [default] 
[encoding=texnansi]
%\definetypeface [reencodedPostscript] [mm] [math]  [times]     [default]

\setupbodyfont[builtInPostscript,sans,15pt]

\mainlanguage[de]
\setupheadertexts[]

\def\Show{This is a test. 45\char176 \quotedblbase äöüßÄÖÜ\quotedblleft}
\def\ShowVariants{\Show\par{\bf\Show}\par{\it\Show}\par{\bi\Show}\par}

\starttext\pdfmapfile{+smallpdf.map}

{\ss Helvetica\par\ShowVariants}
{\rm Times-Roman\par\ShowVariants}
{\tt Courier\par\ShowVariants}

\reencodedPostscript

{\ss Helvetica\par\ShowVariants}
{\rm Times-Roman\par\ShowVariants}
{\tt Courier\par\ShowVariants}

\stoptext



[-- Attachment #2: smallpdf.tex --]
[-- Type: application/x-tex, Size: 3228 bytes --]

[-- Attachment #3: smallpdf.map --]
[-- Type: text/plain, Size: 1349 bytes --]

raw-phvr8a Helvetica
raw-phvb8a Helvetica-Bold
raw-phvbo8a Helvetica-BoldOblique
raw-phvro8a Helvetica-Oblique
raw-ptmr8a Times-Roman
raw-ptmb8a Times-Bold
raw-ptmbi8a Times-BoldItalic
raw-ptmri8a Times-Italic
raw-pcrr8a Courier
raw-pcrb8a Courier-Bold
raw-pcrbo8a Courier-BoldOblique
raw-pcrro8a Courier-Oblique
raw-psyr Symbol
raw-pzdr ZapfDingbats

texnansi-raw-phvb8a Helvetica-Bold " TeXnANSIEncoding ReEncodeFont " <texnansi.enc
texnansi-raw-phvro8a Helvetica-Oblique " TeXnANSIEncoding ReEncodeFont " <texnansi.enc
texnansi-raw-phvr8a Helvetica " TeXnANSIEncoding ReEncodeFont " <texnansi.enc
texnansi-raw-phvbo8a Helvetica-BoldOblique " TeXnANSIEncoding ReEncodeFont " <texnansi.enc
texnansi-raw-pcrb8a Courier-Bold " TeXnANSIEncoding ReEncodeFont " <texnansi.enc
texnansi-raw-pcrbo8a Courier-BoldOblique " TeXnANSIEncoding ReEncodeFont " <texnansi.enc
texnansi-raw-pcrr8a Courier " TeXnANSIEncoding ReEncodeFont " <texnansi.enc
texnansi-raw-pcrro8a Courier-Oblique " TeXnANSIEncoding ReEncodeFont " <texnansi.enc
texnansi-raw-ptmr8a Times-Roman " TeXnANSIEncoding ReEncodeFont " <texnansi.enc
texnansi-raw-ptmri8a Times-Italic " TeXnANSIEncoding ReEncodeFont " <texnansi.enc
texnansi-raw-ptmbi8a Times-BoldItalic " TeXnANSIEncoding ReEncodeFont " <texnansi.enc
texnansi-raw-ptmb8a Times-Bold " TeXnANSIEncoding ReEncodeFont " <texnansi.enc

[-- Attachment #4: 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] 5+ messages in thread

* Re: Re: How to switch between fonts?
  2005-03-18 13:41   ` Stefan Wachter
@ 2005-03-18 14:12     ` Hans Hagen
  2005-03-18 15:16       ` Stefan Wachter
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2005-03-18 14:12 UTC (permalink / raw)


Stefan Wachter wrote:

> When I use the "builtInPostscript" or the "reencodedPostscript" as the 
> sole body font then the document is typeset correctly. Yet, if I try to 
> switch the family for example to the reencodedPostscript then the text 
> that follows after the switch does not appear in the created PDF document.
> 
> Do you have an idea?

hard to test without those tfm files (i don't want to clobber my system by 
generating them; also, i never use the p* variants)

looking at your map file:

there are no pfb files mentioned ... why?

raw-phvr8a Helvetica
raw-phvb8a Helvetica-Bold
raw-phvbo8a Helvetica-BoldOblique
raw-phvro8a Helvetica-Oblique
raw-ptmr8a Times-Roman
raw-ptmb8a Times-Bold
raw-ptmbi8a Times-BoldItalic
raw-ptmri8a Times-Italic
raw-pcrr8a Courier
raw-pcrb8a Courier-Bold
raw-pcrbo8a Courier-BoldOblique
raw-pcrro8a Courier-Oblique
raw-psyr Symbol
raw-pzdr ZapfDingbats

texnansi-raw-phvb8a Helvetica-Bold " TeXnANSIEncoding ReEncodeFont " <texnansi.enc
texnansi-raw-phvro8a Helvetica-Oblique " TeXnANSIEncoding ReEncodeFont " 
<texnansi.enc
texnansi-raw-phvr8a Helvetica " TeXnANSIEncoding ReEncodeFont " <texnansi.enc
texnansi-raw-phvbo8a Helvetica-BoldOblique " TeXnANSIEncoding ReEncodeFont " 
<texnansi.enc
texnansi-raw-pcrb8a Courier-Bold " TeXnANSIEncoding ReEncodeFont " <texnansi.enc
texnansi-raw-pcrbo8a Courier-BoldOblique " TeXnANSIEncoding ReEncodeFont " 
<texnansi.enc
texnansi-raw-pcrr8a Courier " TeXnANSIEncoding ReEncodeFont " <texnansi.enc
texnansi-raw-pcrro8a Courier-Oblique " TeXnANSIEncoding ReEncodeFont " <texnansi.enc
texnansi-raw-ptmr8a Times-Roman " TeXnANSIEncoding ReEncodeFont " <texnansi.enc
texnansi-raw-ptmri8a Times-Italic " TeXnANSIEncoding ReEncodeFont " <texnansi.enc
texnansi-raw-ptmbi8a Times-BoldItalic " TeXnANSIEncoding ReEncodeFont " 
<texnansi.enc
texnansi-raw-ptmb8a Times-Bold " TeXnANSIEncoding ReEncodeFont " <texnansi.enc



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

* Re: How to switch between fonts?
  2005-03-18 14:12     ` Hans Hagen
@ 2005-03-18 15:16       ` Stefan Wachter
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Wachter @ 2005-03-18 15:16 UTC (permalink / raw)


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

> hard to test without those tfm files (i don't want to clobber my system 
> by generating them; also, i never use the p* variants)

I created the vf and tfm files with the attached script. Maybe you can 
setup a local directory? Creating these fonts simply needs the following 
calls (the files are generated in the current directory!):

fonts.sh <path-to-afm-dir> adobe helvetic ec
fonts.sh <path-to-afm-dir> adobe times ec
fonts.sh <path-to-afm-dir> adobe courier ec
fonts.sh <path-to-afm-dir> adobe helvetic texnansi texnansi
fonts.sh <path-to-afm-dir> adobe times texnansi texnansi
fonts.sh <path-to-afm-dir> adobe courier texnansi texnansi

The first three calls generate virtual fonts that are base on raw fonts 
with default encoding and the last three calls generate virtual fonts 
that are based on texnansi reencoded raw fonts.

(After studying texfont I think that generating fonts based on the 
default encoding of raw fonts is not possible with texfont.)

I think the generate vf and tfm files are correct because they can be 
used without problems as long as no family switching occurs.

Is there a specific reason why the p* variants should not be used? I 
hoped that they are very similar to what is present in the different 
Acrobat Reader versions.


> 
> looking at your map file:
> 
> there are no pfb files mentioned ... why?

I want to use the built in fonts because the size of the PDF documents 
must be as small as possible.

--Stefan

[-- Attachment #2: font.sh --]
[-- Type: application/x-sh, Size: 1151 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] 5+ messages in thread

end of thread, other threads:[~2005-03-18 15:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-16  8:33 How to switch between fonts? Stefan Wachter
2005-03-17 20:58 ` Hans Hagen
2005-03-18 13:41   ` Stefan Wachter
2005-03-18 14:12     ` Hans Hagen
2005-03-18 15:16       ` Stefan Wachter

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